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

satisfactory-dev / Docs.json.ts / 20185801370

13 Dec 2025 02:48AM UTC coverage: 0.0%. Remained the same
20185801370

push

github

SignpostMarv
satisfying eslint

0 of 45 branches covered (0.0%)

Branch coverage included in aggregate %.

0 of 6 new or added lines in 2 files covered. (0.0%)

177 existing lines in 5 files now uncovered.

0 of 7338 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/PrefixedString.ts
1
import type {
×
2
        TemplateLiteralTypeNode,
×
3
} from 'typescript';
×
4

×
5
import type {
×
6
        SchemaDefinitionDefinition,
×
7
        SchemalessTypeOptions,
×
8
        SchemaParser,
×
9
} from '@signpostmarv/json-schema-typescript-codegen';
×
10
import {
×
11
        $defs_schema,
×
12
} from '@signpostmarv/json-schema-typescript-codegen';
×
13

×
14
import type {
×
15
        TemplatedStringParts,
×
16
} from '@signpostmarv/json-schema-typescript-codegen/ajv';
×
17
import {
×
18
        KeywordType,
×
19
        RegexpFailureError,
×
20
        TemplatedString,
×
21
} from '@signpostmarv/json-schema-typescript-codegen/ajv';
×
22

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

×
28
import type {
×
29
} from 'regexp.escape/auto';
×
30

×
31
export type mode = 'quoted'|'non_quoted'|'single_quoted';
×
32

×
33
export type PrefixedString_base_type<
×
34
        Mode extends string = string,
×
35
> = {
×
36
        type: 'string',
×
37
        DocsDotJson_PrefixedString: {
×
38
                prefix: string,
×
39
                mode: Mode,
×
40
                value: string|null,
×
41
        },
×
42
};
×
43

×
44
export type PrefixedString_type<
×
45
        Mode extends mode = mode,
×
46
> = PrefixedString_base_type<Mode>;
×
47

×
48
export type PrefixedString_base_schema<
×
49
        Mode extends string,
×
50
> = SchemaDefinitionDefinition<
×
51
        ['type', 'DocsDotJson_PrefixedString'],
×
52
        {
×
53
                $defs: (typeof $defs_schema)['properties']['$defs'],
×
54
                type: {
×
55
                        type: 'string',
×
56
                        const: 'string',
×
57
                },
×
58
                DocsDotJson_PrefixedString: {
×
59
                        type: 'object',
×
60
                        additionalProperties: false,
×
61
                        required: ['prefix', 'mode', 'value'],
×
62
                        properties: {
×
63
                                prefix: {
×
64
                                        type: 'string',
×
65
                                        minLength: 1,
×
66
                                },
×
67
                                mode: {
×
68
                                        type: 'string',
×
69
                                        const: Mode,
×
70
                                },
×
71
                                value: {
×
72
                                        oneOf: [
×
73
                                                {
×
74
                                                        type: 'string',
×
75
                                                        minLength: 1,
×
76
                                                },
×
77
                                                {
×
78
                                                        type: 'null',
×
79
                                                },
×
80
                                        ],
×
81
                                },
×
82
                        },
×
83
                },
×
84
        }
×
85
>;
×
86

×
87
type PrefixedString_schema<
×
88
        Mode extends mode,
×
89
> = PrefixedString_base_schema<Mode>;
×
90

×
91
export abstract class PrefixedString_base<
×
92
        Mode extends string,
×
93
        T_by_mode extends {[key in Mode]: string},
×
94
        SpecificOptions extends {mode: Mode},
×
95
        Type extends PrefixedString_base_type<Mode>,
×
96
        Schema extends PrefixedString_base_schema<Mode>,
×
97
> extends KeywordType<
×
98
                T_by_mode[Mode],
×
99
                Type,
×
100
                SpecificOptions,
×
101
                Schema,
×
102
                SpecificOptions
×
103
        > {
×
104
        #regex_from_instance: (
×
105
                instance: Type['DocsDotJson_PrefixedString'],
×
106
        ) => RegExp;
×
107

×
108
        constructor(
×
109
                options: SchemalessTypeOptions,
×
110
                specific_options: SpecificOptions,
×
111
                regex_from_instance: (
×
112
                        instance: Type['DocsDotJson_PrefixedString'],
×
113
                ) => RegExp,
×
114
        ) {
×
115
                super(
×
116
                        {
×
117
                                ...options,
×
118
                                ajv_keyword: {
×
119
                                        keyword: 'DocsDotJson_PrefixedString',
×
120
                                        type: 'string',
×
121
                                        macro: (
×
122
                                                instance: Type['DocsDotJson_PrefixedString'],
×
123
                                        ) => {
×
124
                                                let pattern = regex_from_instance(instance).toString();
×
125

×
126
                                                if (pattern.startsWith('/') && pattern.endsWith('/')) {
×
127
                                                        pattern = pattern.substring(1, pattern.length - 1);
×
128
                                                }
×
129

×
130
                                                return {
×
131
                                                        pattern,
×
132
                                                };
×
133
                                        },
×
134
                                },
×
135
                                type_definition: specific_options,
×
136
                                schema_definition: specific_options,
×
137
                                add_to_$defs_excluded: true,
×
138
                        },
×
139
                );
×
140

×
141
                this.#regex_from_instance = regex_from_instance;
×
142
        }
×
143

×
144
        generate_typescript_data(
×
145
                data: T_by_mode[Mode],
×
146
                schema_parser: SchemaParser,
×
147
                instance: Type,
×
148
        ): StringLiteral {
×
149
                const regex = this.#regex_from_instance(
×
150
                        instance.DocsDotJson_PrefixedString,
×
151
                );
×
152

×
153
                if (!regex.test(data)) {
×
154
                        throw new RegexpFailureError(
×
155
                                'Value does not match expected regex!',
×
156
                                regex,
×
157
                                data,
×
158
                        );
×
159
                }
×
160

×
161
                return factory.createStringLiteral(data);
×
162
        }
×
163

×
164
        generate_typescript_type({
×
165
                schema,
×
166
        }: {
×
167
                schema: Type,
×
168
        }): Promise<TemplateLiteralTypeNode> {
×
169
                return Promise.resolve(
×
170
                        TemplatedString.generate_typescript_type_from_parts(
×
171
                                this.TemplatedStringParts_by_value(
×
172
                                        schema.DocsDotJson_PrefixedString,
×
173
                                ),
×
174
                        ),
×
175
                );
×
176
        }
×
177

×
178
        protected abstract TemplatedStringParts_by_value(
×
179
                value: Type['DocsDotJson_PrefixedString'],
×
180
        ): TemplatedStringParts;
×
181
}
×
182

×
183
export class PrefixedString<
×
184
        Mode extends mode,
×
185
        Prefix extends Exclude<string, ''>,
×
186
> extends PrefixedString_base<
×
187
                Mode,
×
188
                {
×
189
                        quoted: `${Prefix}'"/Game/FactoryGame/${
×
190
                                string
×
191
                        }"'`,
×
192
                        single_quoted: `${Prefix}'/Game/FactoryGame/${
×
193
                                string
×
194
                        }'`,
×
195
                        non_quoted: `${Prefix} /Game/FactoryGame/${
×
196
                                string
×
197
                        }`,
×
198
                },
×
199
                {mode: Mode},
×
200
                PrefixedString_type<Mode>,
×
201
                PrefixedString_schema<Mode>
×
202
        > {
×
203
        constructor(
×
204
                options: SchemalessTypeOptions,
×
205
                mode: Mode,
×
206
        ) {
×
207
                super(
×
208
                        options,
×
209
                        {mode},
×
210
                        ({
×
211
                                prefix,
×
212
                                value,
×
213
                                mode,
×
214
                        }) => PrefixedString.#regex_from_prefix_value_and_mode(
×
215
                                prefix,
×
216
                                value,
×
217
                                mode,
×
218
                        ),
×
219
                );
×
220
        }
×
221

×
222
        protected TemplatedStringParts_by_value({
×
223
                prefix,
×
224
                mode,
×
225
                value,
×
226
        }: PrefixedString_type<
×
227
                Mode
×
228
        >['DocsDotJson_PrefixedString']): TemplatedStringParts {
×
229
                return [
×
230
                        {
×
231
                                non_quoted: `${prefix} /Game/FactoryGame/`,
×
232
                                quoted: `${prefix}'"/Game/FactoryGame/`,
×
233
                                single_quoted: `${prefix}'/Game/FactoryGame/`,
×
234
                        }[mode],
×
235
                        null === value ? {type: 'string', minLength: 1} : value,
×
236
                        {
×
237
                                non_quoted: '',
×
238
                                quoted: `"'`,
×
239
                                single_quoted: `'`,
×
240
                        }[mode],
×
241
                ];
×
242
        }
×
243

×
244
        static generate_schema_definition<
×
245
                Mode extends mode,
×
246
        >({
×
247
                mode,
×
248
        }: {
×
249
                mode: Mode,
×
250
        }): Readonly<PrefixedString_schema<Mode>> {
×
251
                const result: PrefixedString_schema<Mode> = {
×
252
                        type: 'object',
×
253
                        additionalProperties: false,
×
254
                        required: [
×
255
                                'type',
×
256
                                'DocsDotJson_PrefixedString',
×
257
                        ],
×
258
                        properties: {
×
259
                                $defs: $defs_schema.properties.$defs,
×
260
                                type: {
×
261
                                        type: 'string',
×
262
                                        const: 'string',
×
263
                                },
×
264
                                DocsDotJson_PrefixedString: {
×
265
                                        type: 'object',
×
266
                                        additionalProperties: false,
×
267
                                        required: ['prefix', 'mode', 'value'],
×
268
                                        properties: {
×
269
                                                prefix: {
×
270
                                                        type: 'string',
×
271
                                                        minLength: 1,
×
272
                                                },
×
273
                                                mode: {
×
274
                                                        type: 'string',
×
275
                                                        const: mode,
×
276
                                                },
×
277
                                                value: {
×
278
                                                        oneOf: [
×
279
                                                                {
×
280
                                                                        type: 'string',
×
281
                                                                        minLength: 1,
×
282
                                                                },
×
283
                                                                {
×
284
                                                                        type: 'null',
×
285
                                                                },
×
286
                                                        ],
×
287
                                                },
×
288
                                        },
×
289
                                },
×
290
                        },
×
291
                };
×
292

×
293
                return Object.freeze(result);
×
294
        }
×
295

×
296
        static generate_type_definition<
×
297
                Mode extends mode,
×
298
        >({
×
299
                prefix,
×
300
                mode,
×
301
        }: {
×
302
                prefix: Exclude<string, ''>,
×
303
                mode: Mode,
×
304
        }): Readonly<PrefixedString_type> {
×
UNCOV
305
                const result: PrefixedString_type<Mode> = {
×
UNCOV
306
                        type: 'string',
×
UNCOV
307
                        DocsDotJson_PrefixedString: {
×
UNCOV
308
                                prefix,
×
UNCOV
309
                                mode,
×
UNCOV
310
                                value: null,
×
UNCOV
311
                        },
×
UNCOV
312
                };
×
UNCOV
313

×
UNCOV
314
                return Object.freeze(result);
×
UNCOV
315
        }
×
UNCOV
316

×
UNCOV
317
        static regex_from_prefix_value_and_mode(
×
UNCOV
318
                prefix_string: Exclude<string, ''>|undefined,
×
UNCOV
319
                value: Exclude<string, ''>|null,
×
UNCOV
320
                mode: mode,
×
UNCOV
321
        ): string {
×
UNCOV
322
                let start: string;
×
UNCOV
323

×
UNCOV
324
                if (prefix_string) {
×
NEW
325
                        start = RegExp.escape({
×
NEW
326
                                quoted: `${prefix_string}'"`,
×
UNCOV
327
                                single_quoted: `${prefix_string}'`,
×
NEW
328
                                non_quoted: `${prefix_string} `,
×
NEW
329
                        }[mode]);
×
UNCOV
330
                } else {
×
UNCOV
331
                        start = {
×
UNCOV
332
                                quoted: `[^'"]+'"`,
×
UNCOV
333
                                single_quoted: `[^']+'`,
×
UNCOV
334
                                non_quoted: '[^ ]+ ',
×
UNCOV
335
                        }[mode];
×
UNCOV
336
                }
×
UNCOV
337

×
UNCOV
338

×
UNCOV
339
                if (null !== value) {
×
UNCOV
340
                        const escaped = RegExp.escape(value);
×
UNCOV
341
                        if ('quoted' === mode) {
×
UNCOV
342
                                return `${start}${escaped}"'`;
×
UNCOV
343
                        }
×
UNCOV
344

×
UNCOV
345
                        return `${start}${escaped}`;
×
UNCOV
346
                }
×
UNCOV
347

×
UNCOV
348
                const prefix = RegExp.escape('/Game/FactoryGame/');
×
UNCOV
349
                const suffix = RegExp.escape({
×
UNCOV
350
                        quoted: `"'`,
×
UNCOV
351
                        single_quoted: `'`,
×
UNCOV
352
                        non_quoted: '',
×
UNCOV
353
                }[mode]);
×
UNCOV
354

×
UNCOV
355
                if ('quoted' === mode) {
×
UNCOV
356
                        return `${start}${prefix}(?:[^\\/_]+\\/)*[^."]+\\.[^."]+${suffix}`;
×
UNCOV
357
                }
×
UNCOV
358

×
UNCOV
359
                return `${start}${prefix}(?:[^\\/_]+\\/)*[^.]+\\.[^.]+${suffix}`;
×
UNCOV
360
        }
×
UNCOV
361

×
UNCOV
362
        static TemplatedStringParts_by_value(
×
UNCOV
363
                prefix: Exclude<string, ''>,
×
UNCOV
364
                mode: mode,
×
UNCOV
365
                value: Exclude<string, ''>|null,
×
UNCOV
366
        ): TemplatedStringParts {
×
UNCOV
367
                return [
×
UNCOV
368
                        {
×
UNCOV
369
                                non_quoted: `${prefix} /Game/FactoryGame/`,
×
UNCOV
370
                                quoted: `${prefix}'"/Game/FactoryGame/`,
×
UNCOV
371
                                single_quoted: `${prefix}'/Game/FactoryGame/`,
×
UNCOV
372
                        }[mode],
×
UNCOV
373
                        null === value ? {type: 'string'} : value,
×
UNCOV
374
                        {
×
UNCOV
375
                                non_quoted: '',
×
UNCOV
376
                                quoted: `"'`,
×
UNCOV
377
                                single_quoted: `'`,
×
UNCOV
378
                        }[mode],
×
UNCOV
379
                ];
×
UNCOV
380
        }
×
UNCOV
381

×
UNCOV
382
        static #regex_from_prefix_value_and_mode(
×
UNCOV
383
                prefix: Exclude<string, ''>,
×
UNCOV
384
                value: Exclude<string, ''>|null,
×
UNCOV
385
                mode: mode,
×
UNCOV
386
        ): RegExp {
×
UNCOV
387
                return new RegExp(`^${
×
UNCOV
388
                        this.regex_from_prefix_value_and_mode(prefix, value, mode)
×
UNCOV
389
                }$`);
×
UNCOV
390
        }
×
UNCOV
391
}
×
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