@satisfactory-dev/docs.json.ts 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +190 -0
- package/README.md +81 -0
- package/assert/CustomAssert.d.ts +2 -0
- package/assert/CustomAssert.js +5 -0
- package/lib/AjvUtilities.d.ts +7 -0
- package/lib/AjvUtilities.js +59 -0
- package/lib/ArrayUtilities.d.ts +24 -0
- package/lib/ArrayUtilities.js +21 -0
- package/lib/CustomParsingTypes/CustomPairingTypes.d.ts +37 -0
- package/lib/CustomParsingTypes/CustomPairingTypes.js +42 -0
- package/lib/CustomParsingTypes/TypedString.d.ts +411 -0
- package/lib/CustomParsingTypes/TypedString.js +204 -0
- package/lib/CustomParsingTypes/TypedStringConst.d.ts +28 -0
- package/lib/CustomParsingTypes/TypedStringConst.js +35 -0
- package/lib/CustomParsingTypes/TypedStringEnum.d.ts +30 -0
- package/lib/CustomParsingTypes/TypedStringEnum.js +36 -0
- package/lib/CustomParsingTypes/TypedStringPattern.d.ts +64 -0
- package/lib/CustomParsingTypes/TypedStringPattern.js +82 -0
- package/lib/CustomParsingTypes/UnrealEngineString.d.ts +215 -0
- package/lib/CustomParsingTypes/UnrealEngineString.js +308 -0
- package/lib/CustomParsingTypes/ValueToRegexFormatter.d.ts +29 -0
- package/lib/CustomParsingTypes/ValueToRegexFormatter.js +205 -0
- package/lib/DataDiscovery/CustomTypes/BooleanOrBooleanExtended.d.ts +12 -0
- package/lib/DataDiscovery/CustomTypes/BooleanOrBooleanExtended.js +32 -0
- package/lib/DataDiscovery/CustomTypes/StringStartsWith.d.ts +9 -0
- package/lib/DataDiscovery/CustomTypes/StringStartsWith.js +19 -0
- package/lib/DataDiscovery/CustomTypes/TypedString.d.ts +23 -0
- package/lib/DataDiscovery/CustomTypes/TypedString.js +251 -0
- package/lib/DataDiscovery/CustomTypes/UnrealEngineString.d.ts +9 -0
- package/lib/DataDiscovery/CustomTypes/UnrealEngineString.js +45 -0
- package/lib/DataDiscovery/Generator.d.ts +19 -0
- package/lib/DataDiscovery/Generator.js +41 -0
- package/lib/DataDiscovery/JsonSchema/Array.d.ts +17 -0
- package/lib/DataDiscovery/JsonSchema/Array.js +41 -0
- package/lib/DataDiscovery/JsonSchema/Object.d.ts +61 -0
- package/lib/DataDiscovery/JsonSchema/Object.js +184 -0
- package/lib/DataDiscovery/JsonSchema/OneOf.d.ts +13 -0
- package/lib/DataDiscovery/JsonSchema/OneOf.js +47 -0
- package/lib/DataDiscovery/JsonSchema/Ref.d.ts +17 -0
- package/lib/DataDiscovery/JsonSchema/Ref.js +66 -0
- package/lib/DataDiscovery/JsonSchema/StringType.d.ts +39 -0
- package/lib/DataDiscovery/JsonSchema/StringType.js +121 -0
- package/lib/DataDiscovery/Literal.d.ts +8 -0
- package/lib/DataDiscovery/Literal.js +69 -0
- package/lib/DataDiscovery.d.ts +28 -0
- package/lib/DataDiscovery.js +116 -0
- package/lib/DocsToAutoImport/ArrayTypeNodes.d.ts +5 -0
- package/lib/DocsToAutoImport/ArrayTypeNodes.js +7 -0
- package/lib/DocsToAutoImport/ClassDeclarations.d.ts +5 -0
- package/lib/DocsToAutoImport/ClassDeclarations.js +14 -0
- package/lib/DocsToAutoImport/FunctionDeclaration.d.ts +5 -0
- package/lib/DocsToAutoImport/FunctionDeclaration.js +16 -0
- package/lib/DocsToAutoImport/LiteralTypeNodes.d.ts +5 -0
- package/lib/DocsToAutoImport/LiteralTypeNodes.js +23 -0
- package/lib/DocsToAutoImport/MethodDeclarations.d.ts +5 -0
- package/lib/DocsToAutoImport/MethodDeclarations.js +15 -0
- package/lib/DocsToAutoImport/NodeExtraction.d.ts +6 -0
- package/lib/DocsToAutoImport/NodeExtraction.js +21 -0
- package/lib/DocsToAutoImport/PropertyDeclarations.d.ts +5 -0
- package/lib/DocsToAutoImport/PropertyDeclarations.js +10 -0
- package/lib/DocsToAutoImport/TupleTypeNodes.d.ts +5 -0
- package/lib/DocsToAutoImport/TupleTypeNodes.js +7 -0
- package/lib/DocsToAutoImport/TypeLiteralNodes.d.ts +5 -0
- package/lib/DocsToAutoImport/TypeLiteralNodes.js +33 -0
- package/lib/DocsToAutoImport/TypeReferenceNodes.d.ts +5 -0
- package/lib/DocsToAutoImport/TypeReferenceNodes.js +7 -0
- package/lib/DocsToAutoImport/from_Node_array.d.ts +3 -0
- package/lib/DocsToAutoImport/from_Node_array.js +245 -0
- package/lib/DocsTsAutoImports.d.ts +21 -0
- package/lib/DocsTsAutoImports.js +110 -0
- package/lib/DocsTsGenerator/FilesGenerator.d.ts +25 -0
- package/lib/DocsTsGenerator/FilesGenerator.js +52 -0
- package/lib/DocsTsGenerator.d.ts +47 -0
- package/lib/DocsTsGenerator.js +188 -0
- package/lib/DocsValidation.d.ts +7 -0
- package/lib/DocsValidation.js +179 -0
- package/lib/Exceptions.d.ts +7 -0
- package/lib/Exceptions.js +13 -0
- package/lib/FilesGenerator.d.ts +19 -0
- package/lib/FilesGenerator.js +38 -0
- package/lib/MarkdownUtilities.d.ts +16 -0
- package/lib/MarkdownUtilities.js +68 -0
- package/lib/StringStartsWith.d.ts +10 -0
- package/lib/StringStartsWith.js +20 -0
- package/lib/TsFactoryWrapper.d.ts +80 -0
- package/lib/TsFactoryWrapper.js +236 -0
- package/lib/TypeDefinitionDiscovery/CustomParsingTypes/UnrealEngineString.d.ts +13 -0
- package/lib/TypeDefinitionDiscovery/CustomParsingTypes/UnrealEngineString.js +26 -0
- package/lib/TypeDefinitionDiscovery/CustomParsingTypes/string_starts_with.d.ts +25 -0
- package/lib/TypeDefinitionDiscovery/CustomParsingTypes/string_starts_with.js +20 -0
- package/lib/TypeDefinitionDiscovery/CustomParsingTypes/typed_string.d.ts +14 -0
- package/lib/TypeDefinitionDiscovery/CustomParsingTypes/typed_string.js +96 -0
- package/lib/TypeDefinitionDiscovery/Generator.d.ts +8 -0
- package/lib/TypeDefinitionDiscovery/Generator.js +8 -0
- package/lib/TypeDefinitionDiscovery/GeneratorDoesDiscovery.d.ts +8 -0
- package/lib/TypeDefinitionDiscovery/GeneratorDoesDiscovery.js +9 -0
- package/lib/TypeDefinitionDiscovery/JsonSchema/ArrayType.d.ts +19 -0
- package/lib/TypeDefinitionDiscovery/JsonSchema/ArrayType.js +61 -0
- package/lib/TypeDefinitionDiscovery/JsonSchema/Object/ExtendsObject.d.ts +23 -0
- package/lib/TypeDefinitionDiscovery/JsonSchema/Object/ExtendsObject.js +40 -0
- package/lib/TypeDefinitionDiscovery/JsonSchema/ObjectType.d.ts +91 -0
- package/lib/TypeDefinitionDiscovery/JsonSchema/ObjectType.js +76 -0
- package/lib/TypeDefinitionDiscovery/JsonSchema/String/Const.d.ts +29 -0
- package/lib/TypeDefinitionDiscovery/JsonSchema/String/Const.js +20 -0
- package/lib/TypeDefinitionDiscovery/JsonSchema/String/Enum/BooleanEnum.d.ts +16 -0
- package/lib/TypeDefinitionDiscovery/JsonSchema/String/Enum/BooleanEnum.js +47 -0
- package/lib/TypeDefinitionDiscovery/JsonSchema/String/Enum.d.ts +40 -0
- package/lib/TypeDefinitionDiscovery/JsonSchema/String/Enum.js +22 -0
- package/lib/TypeDefinitionDiscovery/JsonSchema/String/Pattern.d.ts +13 -0
- package/lib/TypeDefinitionDiscovery/JsonSchema/String/Pattern.js +21 -0
- package/lib/TypeDefinitionDiscovery/JsonSchema/String.d.ts +52 -0
- package/lib/TypeDefinitionDiscovery/JsonSchema/String.js +72 -0
- package/lib/TypeDefinitionDiscovery/JsonSchema/oneOf_or_anyOf.d.ts +63 -0
- package/lib/TypeDefinitionDiscovery/JsonSchema/oneOf_or_anyOf.js +47 -0
- package/lib/TypeDefinitionDiscovery.d.ts +49 -0
- package/lib/TypeDefinitionDiscovery.js +376 -0
- package/lib/TypeDefinitionWriter.d.ts +22 -0
- package/lib/TypeDefinitionWriter.js +233 -0
- package/lib/TypesDiscovery/CandidatesDiscovery.d.ts +10 -0
- package/lib/TypesDiscovery/CandidatesDiscovery.js +14 -0
- package/lib/TypesDiscovery/CustomParsingTypes/UnrealEngineString.d.ts +5 -0
- package/lib/TypesDiscovery/CustomParsingTypes/UnrealEngineString.js +18 -0
- package/lib/TypesDiscovery/CustomParsingTypes/typed_string.d.ts +6 -0
- package/lib/TypesDiscovery/CustomParsingTypes/typed_string.js +34 -0
- package/lib/TypesDiscovery/JsonSchema/$ref.d.ts +7 -0
- package/lib/TypesDiscovery/JsonSchema/$ref.js +33 -0
- package/lib/TypesDiscovery/JsonSchema/const.d.ts +6 -0
- package/lib/TypesDiscovery/JsonSchema/const.js +22 -0
- package/lib/TypesDiscovery/JsonSchema/enum.d.ts +6 -0
- package/lib/TypesDiscovery/JsonSchema/enum.js +22 -0
- package/lib/TypesDiscovery/JsonSchema/properties.d.ts +4 -0
- package/lib/TypesDiscovery/JsonSchema/properties.js +14 -0
- package/lib/TypesDiscovery/non_array_object_property.d.ts +4 -0
- package/lib/TypesDiscovery/non_array_object_property.js +11 -0
- package/lib/TypesDiscovery/non_empty_array_property.d.ts +4 -0
- package/lib/TypesDiscovery/non_empty_array_property.js +11 -0
- package/lib/TypesDiscovery.d.ts +24 -0
- package/lib/TypesDiscovery.js +77 -0
- package/lib/TypesGeneration/validators.d.ts +9 -0
- package/lib/TypesGeneration/validators.js +26 -0
- package/lib/TypesGeneration.d.ts +17 -0
- package/lib/TypesGeneration.js +53 -0
- package/lib/__dirname.d.ts +1 -0
- package/lib/__dirname.js +6 -0
- package/lib/helpers.d.ts +5 -0
- package/lib/helpers.js +29 -0
- package/lib/index.d.ts +8 -0
- package/lib/index.js +9 -0
- package/package.json +39 -0
- package/schema/update8.schema.json +8848 -0
- package/setup_PerformanceObserver.d.ts +3 -0
- package/setup_PerformanceObserver.js +55 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { CandidatesDiscovery, } from '../CandidatesDiscovery';
|
|
2
|
+
import { object_has_property, value_is_non_array_object, } from '../../CustomParsingTypes/CustomPairingTypes';
|
|
3
|
+
import { local_ref, } from '../../StringStartsWith';
|
|
4
|
+
import { is_UnrealEngineString_parent, } from '../../CustomParsingTypes/UnrealEngineString';
|
|
5
|
+
export class UnrealEngineString extends CandidatesDiscovery {
|
|
6
|
+
discovery_candidates(current, discovered_types) {
|
|
7
|
+
if (object_has_property(current, '$defs', value_is_non_array_object)) {
|
|
8
|
+
for (const entry of Object.entries(current.$defs)) {
|
|
9
|
+
const [property, value] = entry;
|
|
10
|
+
if (is_UnrealEngineString_parent(value)) {
|
|
11
|
+
discovered_types.add(local_ref(property));
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=UnrealEngineString.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { CandidatesDiscovery } from '../CandidatesDiscovery';
|
|
2
|
+
import { SchemaObject } from 'ajv/dist/2020';
|
|
3
|
+
export declare class typed_string extends CandidatesDiscovery {
|
|
4
|
+
discovery_candidates(current: SchemaObject, discovered_types: Set<string>): [unknown, ...unknown[]] | undefined;
|
|
5
|
+
private is_typed_string;
|
|
6
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { CandidatesDiscovery, } from '../CandidatesDiscovery';
|
|
2
|
+
import { object_has_non_empty_array_property, object_has_property, object_has_property_that_equals, value_is_non_array_object, } from '../../CustomParsingTypes/CustomPairingTypes';
|
|
3
|
+
import { is_string, local_ref, } from '../../StringStartsWith';
|
|
4
|
+
export class typed_string extends CandidatesDiscovery {
|
|
5
|
+
discovery_candidates(current, discovered_types) {
|
|
6
|
+
if (object_has_property(current, '$defs', value_is_non_array_object)) {
|
|
7
|
+
for (const entry of Object.entries(current.$defs)) {
|
|
8
|
+
const [property, value] = entry;
|
|
9
|
+
if (this.is_typed_string(value)) {
|
|
10
|
+
discovered_types.add(local_ref(property));
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
return undefined;
|
|
15
|
+
}
|
|
16
|
+
is_typed_string(maybe) {
|
|
17
|
+
return (value_is_non_array_object(maybe)
|
|
18
|
+
&& 3 === Object.keys(maybe).length
|
|
19
|
+
&& object_has_property_that_equals(maybe, 'type', 'string')
|
|
20
|
+
&& object_has_property_that_equals(maybe, 'minLength', 1)
|
|
21
|
+
&& object_has_property(maybe, 'typed_string', value_is_non_array_object)
|
|
22
|
+
&& ((2 === Object.keys(maybe.typed_string).length
|
|
23
|
+
&& object_has_non_empty_array_property(maybe.typed_string, 'required', is_string)
|
|
24
|
+
&& object_has_property(maybe.typed_string, 'properties', value_is_non_array_object))
|
|
25
|
+
|| (((4 === Object.keys(maybe.typed_string).length
|
|
26
|
+
&& object_has_property(maybe.typed_string, 'maxItems', (e) => 'number' === typeof e))
|
|
27
|
+
|| (3 === Object.keys(maybe.typed_string).length
|
|
28
|
+
&& !object_has_property(maybe.typed_string, 'maxItems')))
|
|
29
|
+
&& object_has_property(maybe.typed_string, 'minItems', (e) => 'number' === typeof e)
|
|
30
|
+
&& object_has_property_that_equals(maybe.typed_string, 'items', false)
|
|
31
|
+
&& object_has_non_empty_array_property(maybe.typed_string, 'prefixItems', value_is_non_array_object))));
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=typed_string.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CandidatesDiscovery } from '../CandidatesDiscovery';
|
|
2
|
+
import { SchemaObject } from 'ajv/dist/2020';
|
|
3
|
+
export declare class $ref extends CandidatesDiscovery {
|
|
4
|
+
private readonly $defs;
|
|
5
|
+
constructor(schema: SchemaObject);
|
|
6
|
+
discovery_candidates(current: unknown, discovered_types: Set<string>): [unknown, ...unknown[]] | undefined;
|
|
7
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { CandidatesDiscovery, } from '../CandidatesDiscovery';
|
|
2
|
+
import { object_has_property, value_is_non_array_object, } from '../../CustomParsingTypes/CustomPairingTypes';
|
|
3
|
+
import { is_string, } from '../../StringStartsWith';
|
|
4
|
+
export class $ref extends CandidatesDiscovery {
|
|
5
|
+
$defs;
|
|
6
|
+
constructor(schema) {
|
|
7
|
+
super(schema);
|
|
8
|
+
this.$defs =
|
|
9
|
+
object_has_property(schema, '$defs', value_is_non_array_object)
|
|
10
|
+
? Object.fromEntries(Object.keys(schema.$defs).map(e => [e, true]))
|
|
11
|
+
: {};
|
|
12
|
+
}
|
|
13
|
+
discovery_candidates(current, discovered_types) {
|
|
14
|
+
const $defs = this.$defs;
|
|
15
|
+
function has_definition_$ref(maybe) {
|
|
16
|
+
return (object_has_property(maybe, '$ref', is_string)
|
|
17
|
+
&& maybe.$ref.startsWith('#/$defs/')
|
|
18
|
+
&& maybe.$ref.substring(8) in $defs);
|
|
19
|
+
}
|
|
20
|
+
function schema_has_definition(maybe, schema) {
|
|
21
|
+
return (maybe.startsWith('#/$defs/')
|
|
22
|
+
&& maybe.substring(8) in schema.$defs);
|
|
23
|
+
}
|
|
24
|
+
if (has_definition_$ref(current)
|
|
25
|
+
&& schema_has_definition(current.$ref, this.schema)
|
|
26
|
+
&& !discovered_types.has(current.$ref)) {
|
|
27
|
+
discovered_types.add(current.$ref);
|
|
28
|
+
return [this.schema.$defs[current.$ref.substring(8)]];
|
|
29
|
+
}
|
|
30
|
+
return undefined;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=$ref.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { CandidatesDiscovery } from '../CandidatesDiscovery';
|
|
2
|
+
import { SchemaObject } from 'ajv/dist/2020';
|
|
3
|
+
export declare class ConstString extends CandidatesDiscovery {
|
|
4
|
+
discovery_candidates(current: SchemaObject, discovered_types: Set<string>): [unknown, ...unknown[]] | undefined;
|
|
5
|
+
private is_const_string;
|
|
6
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { CandidatesDiscovery, } from '../CandidatesDiscovery';
|
|
2
|
+
import { object_has_property, object_has_property_that_equals, value_is_non_array_object, } from '../../CustomParsingTypes/CustomPairingTypes';
|
|
3
|
+
import { is_string, local_ref, } from '../../StringStartsWith';
|
|
4
|
+
export class ConstString extends CandidatesDiscovery {
|
|
5
|
+
discovery_candidates(current, discovered_types) {
|
|
6
|
+
if (object_has_property(current, '$defs', value_is_non_array_object)) {
|
|
7
|
+
for (const entry of Object.entries(current.$defs)) {
|
|
8
|
+
const [property, value] = entry;
|
|
9
|
+
if (this.is_const_string(value)) {
|
|
10
|
+
discovered_types.add(local_ref(property));
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
return undefined;
|
|
15
|
+
}
|
|
16
|
+
is_const_string(maybe) {
|
|
17
|
+
return (object_has_property_that_equals(maybe, 'type', 'string')
|
|
18
|
+
&& object_has_property(maybe, 'const', is_string)
|
|
19
|
+
&& 2 === Object.keys(maybe).length);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=const.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { CandidatesDiscovery } from '../CandidatesDiscovery';
|
|
2
|
+
import { SchemaObject } from 'ajv/dist/2020';
|
|
3
|
+
export declare class EnumString extends CandidatesDiscovery {
|
|
4
|
+
discovery_candidates(current: SchemaObject, discovered_types: Set<string>): [unknown, ...unknown[]] | undefined;
|
|
5
|
+
private is_enum_string;
|
|
6
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { CandidatesDiscovery, } from '../CandidatesDiscovery';
|
|
2
|
+
import { object_has_non_empty_array_property, object_has_property, object_has_property_that_equals, value_is_non_array_object, } from '../../CustomParsingTypes/CustomPairingTypes';
|
|
3
|
+
import { is_string, local_ref, } from '../../StringStartsWith';
|
|
4
|
+
export class EnumString extends CandidatesDiscovery {
|
|
5
|
+
discovery_candidates(current, discovered_types) {
|
|
6
|
+
if (object_has_property(current, '$defs', value_is_non_array_object)) {
|
|
7
|
+
for (const entry of Object.entries(current.$defs)) {
|
|
8
|
+
const [property, value] = entry;
|
|
9
|
+
if (this.is_enum_string(value)) {
|
|
10
|
+
discovered_types.add(local_ref(property));
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
return undefined;
|
|
15
|
+
}
|
|
16
|
+
is_enum_string(maybe) {
|
|
17
|
+
return (object_has_property_that_equals(maybe, 'type', 'string')
|
|
18
|
+
&& object_has_non_empty_array_property(maybe, 'enum', is_string)
|
|
19
|
+
&& 2 === Object.keys(maybe).length);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=enum.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CandidatesDiscovery, } from '../CandidatesDiscovery';
|
|
2
|
+
import { is_non_empty_array, object_has_property, value_is_non_array_object, } from '../../CustomParsingTypes/CustomPairingTypes';
|
|
3
|
+
export class properties extends CandidatesDiscovery {
|
|
4
|
+
discovery_candidates(current) {
|
|
5
|
+
if (object_has_property(current, 'properties', value_is_non_array_object)) {
|
|
6
|
+
const properties = Object.values(current.properties);
|
|
7
|
+
if (is_non_empty_array(properties)) {
|
|
8
|
+
return properties;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
return undefined;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=properties.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { PropertyDependentDiscovery, } from './CandidatesDiscovery';
|
|
2
|
+
import { object_has_property, value_is_non_array_object, } from '../CustomParsingTypes/CustomPairingTypes';
|
|
3
|
+
export class non_array_object_property extends PropertyDependentDiscovery {
|
|
4
|
+
discovery_candidates(current) {
|
|
5
|
+
if (object_has_property(current, this.property, value_is_non_array_object)) {
|
|
6
|
+
return [current[this.property]];
|
|
7
|
+
}
|
|
8
|
+
return undefined;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=non_array_object_property.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { PropertyDependentDiscovery, } from './CandidatesDiscovery';
|
|
2
|
+
import { object_has_non_empty_array_property, value_is_non_array_object, } from '../CustomParsingTypes/CustomPairingTypes';
|
|
3
|
+
export class non_empty_array_property extends PropertyDependentDiscovery {
|
|
4
|
+
discovery_candidates(current) {
|
|
5
|
+
if (object_has_non_empty_array_property(current, this.property, value_is_non_array_object)) {
|
|
6
|
+
return current[this.property];
|
|
7
|
+
}
|
|
8
|
+
return undefined;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=non_empty_array_property.js.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { SchemaObject } from 'ajv/dist/2020';
|
|
2
|
+
import { CandidatesDiscovery } from './TypesDiscovery/CandidatesDiscovery';
|
|
3
|
+
import { DocsDataItem, DocsTsGenerator } from './DocsTsGenerator';
|
|
4
|
+
import { local_ref } from './StringStartsWith';
|
|
5
|
+
export declare class TypesDiscovery {
|
|
6
|
+
private discovery;
|
|
7
|
+
private readonly candidates_discovery;
|
|
8
|
+
private readonly docs;
|
|
9
|
+
constructor(candidates_discovery: [CandidatesDiscovery, ...CandidatesDiscovery[]], docs: DocsTsGenerator);
|
|
10
|
+
discover_types(): Promise<{
|
|
11
|
+
discovered_types: local_ref<string>[];
|
|
12
|
+
missed_types: string[];
|
|
13
|
+
}>;
|
|
14
|
+
private discover_types_from;
|
|
15
|
+
static custom_parsing_types(schema: SchemaObject): ([
|
|
16
|
+
CandidatesDiscovery,
|
|
17
|
+
...CandidatesDiscovery[]
|
|
18
|
+
]);
|
|
19
|
+
static generate_is_NativeClass(docs: DocsTsGenerator): Promise<import("ajv/dist/types").ValidateFunction<DocsDataItem>>;
|
|
20
|
+
static standard_jsonschema_discovery(schema: SchemaObject): ([
|
|
21
|
+
CandidatesDiscovery,
|
|
22
|
+
...CandidatesDiscovery[]
|
|
23
|
+
]);
|
|
24
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { object_has_property, value_is_non_array_object, } from './CustomParsingTypes/CustomPairingTypes';
|
|
2
|
+
import { properties, } from './TypesDiscovery/JsonSchema/properties';
|
|
3
|
+
import { non_empty_array_property, } from './TypesDiscovery/non_empty_array_property';
|
|
4
|
+
import { $ref, } from './TypesDiscovery/JsonSchema/$ref';
|
|
5
|
+
import { non_array_object_property, } from './TypesDiscovery/non_array_object_property';
|
|
6
|
+
import { compile, } from './AjvUtilities';
|
|
7
|
+
import { local_ref, } from './StringStartsWith';
|
|
8
|
+
import { typed_string, } from './TypesDiscovery/CustomParsingTypes/typed_string';
|
|
9
|
+
import { ConstString, } from './TypesDiscovery/JsonSchema/const';
|
|
10
|
+
import { EnumString, } from './TypesDiscovery/JsonSchema/enum';
|
|
11
|
+
import { UnrealEngineString, } from './TypesDiscovery/CustomParsingTypes/UnrealEngineString';
|
|
12
|
+
export class TypesDiscovery {
|
|
13
|
+
discovery;
|
|
14
|
+
candidates_discovery;
|
|
15
|
+
docs;
|
|
16
|
+
constructor(candidates_discovery, docs) {
|
|
17
|
+
this.candidates_discovery = candidates_discovery;
|
|
18
|
+
this.docs = docs;
|
|
19
|
+
}
|
|
20
|
+
async discover_types() {
|
|
21
|
+
if (!this.discovery) {
|
|
22
|
+
const schema = await this.docs.schema();
|
|
23
|
+
const discovered_types = new Set();
|
|
24
|
+
this.discover_types_from(schema, schema, discovered_types);
|
|
25
|
+
this.discovery = Promise.resolve({
|
|
26
|
+
discovered_types: [...discovered_types.values()],
|
|
27
|
+
missed_types: Object.keys(object_has_property(schema, '$defs', value_is_non_array_object)
|
|
28
|
+
? schema.$defs
|
|
29
|
+
: {}).map(local_ref).filter(maybe => !discovered_types.has(maybe)),
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
return this.discovery;
|
|
33
|
+
}
|
|
34
|
+
discover_types_from(current, schema, discovered_types) {
|
|
35
|
+
if (!value_is_non_array_object(current)) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
for (const discovery of this.candidates_discovery) {
|
|
39
|
+
const candidates = discovery.discovery_candidates(current, discovered_types);
|
|
40
|
+
for (const candidate of (candidates || [])) {
|
|
41
|
+
this.discover_types_from(candidate, schema, discovered_types);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
static custom_parsing_types(schema) {
|
|
46
|
+
return [
|
|
47
|
+
new UnrealEngineString(schema),
|
|
48
|
+
new typed_string(schema),
|
|
49
|
+
];
|
|
50
|
+
}
|
|
51
|
+
static async generate_is_NativeClass(docs) {
|
|
52
|
+
const schema = await docs.schema();
|
|
53
|
+
if (!object_has_property(schema, '$defs', value_is_non_array_object)) {
|
|
54
|
+
throw new Error('Schema appears to have no $defs');
|
|
55
|
+
}
|
|
56
|
+
if (!object_has_property(schema.$defs, 'NativeClass', value_is_non_array_object)) {
|
|
57
|
+
throw new Error('Could not find NativeClass on provided schema!');
|
|
58
|
+
}
|
|
59
|
+
return compile(docs.ajv, {
|
|
60
|
+
$defs: schema.$defs,
|
|
61
|
+
...schema.$defs.NativeClass,
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
static standard_jsonschema_discovery(schema) {
|
|
65
|
+
return [
|
|
66
|
+
new non_empty_array_property('prefixItems', schema),
|
|
67
|
+
new non_empty_array_property('oneOf', schema),
|
|
68
|
+
new non_empty_array_property('anyOf', schema),
|
|
69
|
+
new non_array_object_property('items', schema),
|
|
70
|
+
new properties(schema),
|
|
71
|
+
new $ref(schema),
|
|
72
|
+
new ConstString(schema),
|
|
73
|
+
new EnumString(schema),
|
|
74
|
+
];
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=TypesDiscovery.js.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
import { create_modifiers, create_type, createParameter, type_reference_node, } from '../TsFactoryWrapper';
|
|
3
|
+
export const string_starts_with = {
|
|
4
|
+
file: 'utils/validators.ts',
|
|
5
|
+
node: ts.factory.createTypeAliasDeclaration(create_modifiers('export'), ts.factory.createIdentifier('StringStartsWith'), [
|
|
6
|
+
ts.factory.createTypeParameterDeclaration(undefined, 'prefix', create_type('string')),
|
|
7
|
+
], ts.factory.createTypeOperatorNode(ts.SyntaxKind.KeyOfKeyword, ts.factory.createMappedTypeNode(undefined, ts.factory.createTypeParameterDeclaration(undefined, 'pseudo_key', ts.factory.createTypeOperatorNode(ts.SyntaxKind.KeyOfKeyword, ts.factory.createTypeLiteralNode([
|
|
8
|
+
ts.factory.createIndexSignature(undefined, [
|
|
9
|
+
createParameter('key', create_type('string')),
|
|
10
|
+
], create_type('unknown')),
|
|
11
|
+
]))), ts.factory.createConditionalTypeNode(type_reference_node('pseudo_key'), create_type('string'), ts.factory.createTemplateLiteralType(ts.factory.createTemplateHead(''), [
|
|
12
|
+
ts.factory.createTemplateLiteralTypeSpan(type_reference_node('prefix'), ts.factory.createTemplateMiddle('')),
|
|
13
|
+
ts.factory.createTemplateLiteralTypeSpan(type_reference_node('pseudo_key'), ts.factory.createTemplateTail('')),
|
|
14
|
+
]), create_type('never')), undefined, create_type('string'), undefined))),
|
|
15
|
+
};
|
|
16
|
+
export const StringPassedRegExp = {
|
|
17
|
+
file: 'utils/validators.ts',
|
|
18
|
+
node: ts.factory.createTypeAliasDeclaration(create_modifiers('export'), 'StringPassedRegExp', [
|
|
19
|
+
ts.factory.createTypeParameterDeclaration(undefined, 'pattern', create_type('string')),
|
|
20
|
+
ts.factory.createTypeParameterDeclaration(undefined, 'T', create_type('string'), create_type('string')),
|
|
21
|
+
], ts.factory.createIntersectionTypeNode([
|
|
22
|
+
type_reference_node('T'),
|
|
23
|
+
ts.factory.createMappedTypeNode(undefined, ts.factory.createTypeParameterDeclaration(undefined, 'pseudo_key', type_reference_node('pattern')), undefined, undefined, create_type('never'), undefined),
|
|
24
|
+
])),
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=validators.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
export declare type import_these_somewhere_later = {
|
|
3
|
+
[key: string]: string[];
|
|
4
|
+
};
|
|
5
|
+
export declare type import_these_later = {
|
|
6
|
+
[key: string]: import_these_somewhere_later;
|
|
7
|
+
};
|
|
8
|
+
export declare type imports_shorthand = {
|
|
9
|
+
import_these: [string, ...string[]];
|
|
10
|
+
from: string;
|
|
11
|
+
}[];
|
|
12
|
+
export declare class ImportTracker {
|
|
13
|
+
private imports;
|
|
14
|
+
get number_of_files(): number;
|
|
15
|
+
generate_imports(file: string): ts.ImportDeclaration[];
|
|
16
|
+
merge_and_set_imports(imports: import_these_later): void;
|
|
17
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
import { NoMatchError, } from './Exceptions';
|
|
3
|
+
export class ImportTracker {
|
|
4
|
+
imports = {};
|
|
5
|
+
get number_of_files() {
|
|
6
|
+
return Object.keys(this.imports).length;
|
|
7
|
+
}
|
|
8
|
+
generate_imports(file) {
|
|
9
|
+
if (!(file in this.imports)) {
|
|
10
|
+
return [];
|
|
11
|
+
}
|
|
12
|
+
return this.imports[file].map((entry) => {
|
|
13
|
+
return ts.factory.createImportDeclaration([], ts.factory.createImportClause(false, undefined, ts.factory.createNamedImports(entry.import_these.map((import_this) => {
|
|
14
|
+
return ts.factory.createImportSpecifier(false, undefined, ts.factory.createIdentifier(import_this));
|
|
15
|
+
}))), ts.factory.createStringLiteral(entry.from));
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
merge_and_set_imports(imports) {
|
|
19
|
+
for (const entry of Object.entries(imports)) {
|
|
20
|
+
const [filename, file_imports] = entry;
|
|
21
|
+
const merge_here = Object.fromEntries((this.imports[filename] || []).map((shorthand_entry) => {
|
|
22
|
+
return [
|
|
23
|
+
shorthand_entry.from,
|
|
24
|
+
shorthand_entry.import_these,
|
|
25
|
+
];
|
|
26
|
+
}));
|
|
27
|
+
for (const inner_entry of Object.entries(file_imports)) {
|
|
28
|
+
const [from, import_these] = inner_entry;
|
|
29
|
+
if (from.endsWith('.ts')) {
|
|
30
|
+
throw new NoMatchError(from, 'files ending with .ts should not end up here');
|
|
31
|
+
}
|
|
32
|
+
if (import_these.length) {
|
|
33
|
+
if (!(from in merge_here)) {
|
|
34
|
+
merge_here[from] = import_these;
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
for (const import_this of import_these) {
|
|
38
|
+
if (!merge_here[from].includes(import_this)) {
|
|
39
|
+
merge_here[from].push(import_this);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
if (Object.keys(merge_here).length) {
|
|
46
|
+
this.imports[filename] = Object.entries(merge_here).map((unpack) => {
|
|
47
|
+
return { from: unpack[0], import_these: unpack[1] };
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=TypesGeneration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function __dirname_from_meta(meta: ImportMeta): string;
|
package/lib/__dirname.js
ADDED
package/lib/helpers.d.ts
ADDED
package/lib/helpers.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { existsSync, } from 'node:fs';
|
|
2
|
+
import { DocsTsGenerator, } from './DocsTsGenerator';
|
|
3
|
+
import { __dirname_from_meta, } from './__dirname';
|
|
4
|
+
import Ajv from 'ajv/dist/2020';
|
|
5
|
+
import { configure_ajv, } from './DocsValidation';
|
|
6
|
+
const __dirname = __dirname_from_meta(import.meta);
|
|
7
|
+
const ajv = new Ajv({
|
|
8
|
+
verbose: true,
|
|
9
|
+
logger: false,
|
|
10
|
+
allErrors: false,
|
|
11
|
+
code: {
|
|
12
|
+
source: true,
|
|
13
|
+
esm: true,
|
|
14
|
+
lines: true,
|
|
15
|
+
optimize: 2,
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
configure_ajv(ajv);
|
|
19
|
+
export const docs = new DocsTsGenerator({
|
|
20
|
+
ajv,
|
|
21
|
+
docs_path: `${__dirname}/../data/Docs.json`,
|
|
22
|
+
cache_path: `${__dirname}/../data/`,
|
|
23
|
+
});
|
|
24
|
+
export const skip_because_docs_dot_json_not_yet_bundled = {
|
|
25
|
+
skip: existsSync(`${__dirname}/../data/Docs.json`)
|
|
26
|
+
? false
|
|
27
|
+
: 'Docs.json not yet bundled!',
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=helpers.js.map
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './AjvUtilities';
|
|
2
|
+
export * from './ArrayUtilities';
|
|
3
|
+
export * from './DocsTsGenerator';
|
|
4
|
+
export * from './DocsValidation';
|
|
5
|
+
export * from './Exceptions';
|
|
6
|
+
export * from './StringStartsWith';
|
|
7
|
+
export * from './TypeDefinitionWriter';
|
|
8
|
+
export * from '../setup_PerformanceObserver';
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './AjvUtilities';
|
|
2
|
+
export * from './ArrayUtilities';
|
|
3
|
+
export * from './DocsTsGenerator';
|
|
4
|
+
export * from './DocsValidation';
|
|
5
|
+
export * from './Exceptions';
|
|
6
|
+
export * from './StringStartsWith';
|
|
7
|
+
export * from './TypeDefinitionWriter';
|
|
8
|
+
export * from '../setup_PerformanceObserver';
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "module",
|
|
3
|
+
"name": "@satisfactory-dev/docs.json.ts",
|
|
4
|
+
"description": "TypeScript mappings for the Docs.json file that ships with Satisfactory",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"satisfactory",
|
|
8
|
+
"Docs.json"
|
|
9
|
+
],
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/satisfactory-dev/Docs.json.ts.git"
|
|
13
|
+
},
|
|
14
|
+
"funding": "https://github.com/satisfactory-dev/Docs.json.ts?sponsor=1",
|
|
15
|
+
"exports": "./lib/index.js",
|
|
16
|
+
"types": "./lib/index.d.ts",
|
|
17
|
+
"scripts": {
|
|
18
|
+
"test": "ts-node ./tests.ts",
|
|
19
|
+
"generate": "ts-node ./generate-typescript-types.ts",
|
|
20
|
+
"validate": "ts-node validate-Docs.ts"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@satisfactory-dev/custom-assert": "^0.2.2",
|
|
24
|
+
"@signpostmarv/ts-assert": "^0.3.0",
|
|
25
|
+
"@types/eslint": "^8.56.6",
|
|
26
|
+
"@types/node": "^20.11.20",
|
|
27
|
+
"c8": "^10.1.2",
|
|
28
|
+
"ts-node": "^10.9.2"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"ajv": "^8.12.0",
|
|
32
|
+
"eslint": "^8.57.0",
|
|
33
|
+
"glob": "^10.3.10",
|
|
34
|
+
"prettier": "^3.2.5",
|
|
35
|
+
"typescript": "~5.5.2",
|
|
36
|
+
"typescript-eslint": "^7.3.1"
|
|
37
|
+
},
|
|
38
|
+
"version": "0.6.1"
|
|
39
|
+
}
|