• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

satisfactory-dev / Docs.json.ts / 19984833845

06 Dec 2025 06:43AM UTC coverage: 0.0%. Remained the same
19984833845

push

github

SignpostMarv
adjusting indentation

0 of 40 branches covered (0.0%)

Branch coverage included in aggregate %.

0 of 2 new or added lines in 1 file covered. (0.0%)

217 existing lines in 4 files now uncovered.

0 of 9031 relevant lines covered (0.0%)

0.0 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/version-specific/0.3.7.7/TypedString/Object.ts
1
import type {
×
2
        Ajv2020 as Ajv,
×
3
        ValidateFunction,
×
4
} from 'ajv/dist/2020.js';
×
5

×
6
import type {
×
7
        ComputedPropertyName,
×
8
        PropertyAssignment,
×
9
} from 'typescript';
×
10

×
11
import type {
×
12
        object_schema,
×
13
        object_type_base,
×
14
        object_TypeLiteralNode_possibly_extended,
×
15
        ObjectOfSchemas,
×
16
        SchemaObject,
×
17
        SchemaParser,
×
18
} from '@signpostmarv/json-schema-typescript-codegen';
×
19
import {
×
20
        ObjectUnspecified,
×
21
        Type,
×
22
} from '@signpostmarv/json-schema-typescript-codegen';
×
23

×
24
import {
×
25
        factory,
×
26
        type ObjectLiteralExpression,
×
27
} from '@signpostmarv/json-schema-typescript-codegen/typescript-overrides';
×
28

×
29
export type Object_type = object_type_base<
×
30
        'properties',
×
31
        SchemaObject,
×
32
        [string, ...string[]],
×
33
        ObjectOfSchemas,
×
34
        ObjectOfSchemas
×
35
>;
×
36

×
37
export type Object_properties = object_schema<'properties'>;
×
38

×
39
export type Object_DataTo = ObjectLiteralExpression;
×
40

×
41
export type Object_SchemaTo = object_TypeLiteralNode_possibly_extended<
×
42
        'properties'
×
43
>;
×
44

×
45
export type Object_TypeGenerator = (
×
46
        schema: object_type_base<
×
47
                'properties',
×
48
                SchemaObject,
×
49
                [string, ...string[]],
×
50
                ObjectOfSchemas,
×
51
                ObjectOfSchemas
×
52
        >,
×
53
        schema_parser: SchemaParser,
×
54
) => Promise<object_TypeLiteralNode_possibly_extended<'properties'>>;
×
55

×
56
export const Object_type_schema = Object.freeze({
×
57
        type: 'object',
×
58
        required: ['type'],
×
59
        properties: {
×
60
                type: {
×
61
                        type: 'string',
×
62
                        const: 'object',
×
63
                },
×
64
        },
×
65
});
×
66

×
67
export function Object_compile_validator(
×
68
        ajv: Ajv,
×
69
): ValidateFunction<Object_type> {
×
70
        return ajv.compile<
×
71
                Object_type
×
72
        >(
×
73
                Object_type_schema,
×
74
        );
×
75
}
×
76

×
77
export function computedProperty_or_string(
×
78
        property: string,
×
79
): ComputedPropertyName|string {
×
80
        return /[?[\] ]/.test(property)
×
81
                ? factory.createComputedPropertyName(
×
82
                        factory.createStringLiteral(property),
×
83
                )
×
84
                : property;
×
85
}
×
86

×
87
export function Object_generate_typescript_data(
×
88
        data: string,
×
89
        schema_parser: SchemaParser,
×
90
        coerced_schema: Object_type,
×
91
        schema: SchemaObject,
×
92
): Object_DataTo {
×
93
        const properties = Object.keys(
×
94
                coerced_schema.properties,
×
95
        );
×
96

×
97
        const regex = new RegExp(`^\\((?:,?${properties.map(
×
98
                (property): [
×
99
                        string,
×
100
                        string,
×
101
                ] => [
×
102
                        property,
×
103
                        `(${RegExp.escape(property)})=([^=]+|\\(.+\\)(?=[,\\)]))`,
×
104
                ],
×
105
        ).map(([
×
106
                property,
×
107
                regex,
×
108
        ], i) => (
×
109
                (
×
110
                        coerced_schema.required || ([] as string[])
×
111
                ).includes(property)
×
112
                        ? `${i > 0 ? ',' : ''}${regex}`
×
113
                        : `(?:${i > 0 ? ',' : ''}${regex})?`
×
114
        )).join('')})*\\)$`);
×
115

×
116
        const match = regex.exec(data);
×
117

×
118
        if (null === match) {
×
119
                throw new TypeError('Data does not match expected regex!');
×
120
        }
×
121

×
122
        const [, ...matches] = match;
×
123

×
124
        const property_assignments: PropertyAssignment[] = [];
×
125

×
126
        for (let i = 0; i < matches.length; i += 2) {
×
127
                const property_name = matches[i];
×
128
                const property_value = matches[i + 1];
×
129

×
130
                if (
×
131
                        undefined === property_name
×
132
                        && undefined === property_value
×
133
                ) {
×
134
                        continue;
×
135
                }
×
136

×
137
                const property_schema = Type.maybe_add_$defs(
×
138
                        schema,
×
139
                        coerced_schema.properties[
×
140
                                property_name
×
141
                        ],
×
142
                );
×
143

×
144
                const type_for_property = schema_parser.parse(
×
145
                        property_schema,
×
146
                );
×
147

×
148
                const value = type_for_property
×
149
                        .generate_typescript_data(
×
150
                                property_value,
×
151
                                schema_parser,
×
152
                                property_schema,
×
153
                        );
×
154

×
155
                const property_assignment = factory
×
156
                        .createPropertyAssignment(
×
157
                                computedProperty_or_string(property_name),
×
158
                                value,
×
159
                        );
×
160

×
161
                property_assignments.push(property_assignment);
×
162
        }
×
163

×
164
        const sanity_check: Object_DataTo = factory
×
165
                .createObjectLiteralExpression(
×
166
                        property_assignments,
×
167
                        true,
×
168
                );
×
169

×
170
        return sanity_check;
×
171
}
×
172

×
173
export function Object_generate_typescript_type(
×
174
        schema: Object_type,
×
175
        schema_parser: SchemaParser,
×
176
): Promise<Object_SchemaTo> {
×
177
        const instance = schema_parser.types
×
178
                .find((maybe): maybe is ObjectUnspecified<
×
179
                        {[key: string]: unknown},
×
180
                        'properties'
×
181
                > => (
×
182
                        maybe instanceof ObjectUnspecified
×
183
                        && 'properties' === maybe.properties_mode
×
184
                ));
×
185

×
186
        if (undefined === instance) {
×
187
                throw new TypeError(`schema_parser not loaded with ${
×
188
                        ObjectUnspecified.constructor.name
×
189
                }<{[key: string]: unknown}, 'properties'>`);
×
190
        }
×
191

×
192
        return instance.generate_typescript_type({
×
193
                schema,
×
194
                schema_parser,
×
195
        });
×
196
}
×
197

×
198
export function Object_ajv_macro(
×
199
        schema: Object_type,
×
200
) {
×
201
        const regex = `${
×
202
                Object.keys(schema.properties)
×
203
                        .map((property) => `(?:,?${
×
204
                                RegExp.escape(property)
×
205
                        }=(?:${
×
206
                                `\\((?:,?[^=]+=(?:\\([^)]+\\)|\\d+))+\\)`
×
207
                        }|${
×
208
                                `\\([^=]+=\\([^)]+\\)\\)`
×
209
                        }|${
×
210
                                `\\([^)]+\\)`
×
211
                        }|${
×
212
                                `[^=]+`
×
213
                        }))${
×
214
                                (
×
215
                                        (schema.required || ([] as string[]))
×
216
                                                .includes(property)
×
217
                                )
×
218
                                        ? ''
×
219
                                        : '?'
×
220
                        }`)
×
221
                        .join('')
×
222
        }`;
×
223

×
224
        return Object.freeze({
×
225
                pattern: `^\\(${regex}(?:,${regex})*\\)$`,
×
226
        });
×
227
}
×
228

×
229
export function Object_generate_schema_definition(
×
230
): Readonly<Object_properties> {
×
231
        return ObjectUnspecified
×
232
                .generate_schema_definition({
×
233
                        properties_mode: 'properties',
×
UNCOV
234
                });
×
UNCOV
235
}
×
UNCOV
236

×
UNCOV
237
export function Object_generate_type_definition(
×
UNCOV
238
): Readonly<Object_type> {
×
UNCOV
239
        return ObjectUnspecified
×
UNCOV
240
                .generate_type_definition({
×
UNCOV
241
                        properties_mode: 'properties',
×
UNCOV
242
                        properties: {},
×
UNCOV
243
                });
×
UNCOV
244
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc