@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.
Files changed (152) hide show
  1. package/LICENSE.md +190 -0
  2. package/README.md +81 -0
  3. package/assert/CustomAssert.d.ts +2 -0
  4. package/assert/CustomAssert.js +5 -0
  5. package/lib/AjvUtilities.d.ts +7 -0
  6. package/lib/AjvUtilities.js +59 -0
  7. package/lib/ArrayUtilities.d.ts +24 -0
  8. package/lib/ArrayUtilities.js +21 -0
  9. package/lib/CustomParsingTypes/CustomPairingTypes.d.ts +37 -0
  10. package/lib/CustomParsingTypes/CustomPairingTypes.js +42 -0
  11. package/lib/CustomParsingTypes/TypedString.d.ts +411 -0
  12. package/lib/CustomParsingTypes/TypedString.js +204 -0
  13. package/lib/CustomParsingTypes/TypedStringConst.d.ts +28 -0
  14. package/lib/CustomParsingTypes/TypedStringConst.js +35 -0
  15. package/lib/CustomParsingTypes/TypedStringEnum.d.ts +30 -0
  16. package/lib/CustomParsingTypes/TypedStringEnum.js +36 -0
  17. package/lib/CustomParsingTypes/TypedStringPattern.d.ts +64 -0
  18. package/lib/CustomParsingTypes/TypedStringPattern.js +82 -0
  19. package/lib/CustomParsingTypes/UnrealEngineString.d.ts +215 -0
  20. package/lib/CustomParsingTypes/UnrealEngineString.js +308 -0
  21. package/lib/CustomParsingTypes/ValueToRegexFormatter.d.ts +29 -0
  22. package/lib/CustomParsingTypes/ValueToRegexFormatter.js +205 -0
  23. package/lib/DataDiscovery/CustomTypes/BooleanOrBooleanExtended.d.ts +12 -0
  24. package/lib/DataDiscovery/CustomTypes/BooleanOrBooleanExtended.js +32 -0
  25. package/lib/DataDiscovery/CustomTypes/StringStartsWith.d.ts +9 -0
  26. package/lib/DataDiscovery/CustomTypes/StringStartsWith.js +19 -0
  27. package/lib/DataDiscovery/CustomTypes/TypedString.d.ts +23 -0
  28. package/lib/DataDiscovery/CustomTypes/TypedString.js +251 -0
  29. package/lib/DataDiscovery/CustomTypes/UnrealEngineString.d.ts +9 -0
  30. package/lib/DataDiscovery/CustomTypes/UnrealEngineString.js +45 -0
  31. package/lib/DataDiscovery/Generator.d.ts +19 -0
  32. package/lib/DataDiscovery/Generator.js +41 -0
  33. package/lib/DataDiscovery/JsonSchema/Array.d.ts +17 -0
  34. package/lib/DataDiscovery/JsonSchema/Array.js +41 -0
  35. package/lib/DataDiscovery/JsonSchema/Object.d.ts +61 -0
  36. package/lib/DataDiscovery/JsonSchema/Object.js +184 -0
  37. package/lib/DataDiscovery/JsonSchema/OneOf.d.ts +13 -0
  38. package/lib/DataDiscovery/JsonSchema/OneOf.js +47 -0
  39. package/lib/DataDiscovery/JsonSchema/Ref.d.ts +17 -0
  40. package/lib/DataDiscovery/JsonSchema/Ref.js +66 -0
  41. package/lib/DataDiscovery/JsonSchema/StringType.d.ts +39 -0
  42. package/lib/DataDiscovery/JsonSchema/StringType.js +121 -0
  43. package/lib/DataDiscovery/Literal.d.ts +8 -0
  44. package/lib/DataDiscovery/Literal.js +69 -0
  45. package/lib/DataDiscovery.d.ts +28 -0
  46. package/lib/DataDiscovery.js +116 -0
  47. package/lib/DocsToAutoImport/ArrayTypeNodes.d.ts +5 -0
  48. package/lib/DocsToAutoImport/ArrayTypeNodes.js +7 -0
  49. package/lib/DocsToAutoImport/ClassDeclarations.d.ts +5 -0
  50. package/lib/DocsToAutoImport/ClassDeclarations.js +14 -0
  51. package/lib/DocsToAutoImport/FunctionDeclaration.d.ts +5 -0
  52. package/lib/DocsToAutoImport/FunctionDeclaration.js +16 -0
  53. package/lib/DocsToAutoImport/LiteralTypeNodes.d.ts +5 -0
  54. package/lib/DocsToAutoImport/LiteralTypeNodes.js +23 -0
  55. package/lib/DocsToAutoImport/MethodDeclarations.d.ts +5 -0
  56. package/lib/DocsToAutoImport/MethodDeclarations.js +15 -0
  57. package/lib/DocsToAutoImport/NodeExtraction.d.ts +6 -0
  58. package/lib/DocsToAutoImport/NodeExtraction.js +21 -0
  59. package/lib/DocsToAutoImport/PropertyDeclarations.d.ts +5 -0
  60. package/lib/DocsToAutoImport/PropertyDeclarations.js +10 -0
  61. package/lib/DocsToAutoImport/TupleTypeNodes.d.ts +5 -0
  62. package/lib/DocsToAutoImport/TupleTypeNodes.js +7 -0
  63. package/lib/DocsToAutoImport/TypeLiteralNodes.d.ts +5 -0
  64. package/lib/DocsToAutoImport/TypeLiteralNodes.js +33 -0
  65. package/lib/DocsToAutoImport/TypeReferenceNodes.d.ts +5 -0
  66. package/lib/DocsToAutoImport/TypeReferenceNodes.js +7 -0
  67. package/lib/DocsToAutoImport/from_Node_array.d.ts +3 -0
  68. package/lib/DocsToAutoImport/from_Node_array.js +245 -0
  69. package/lib/DocsTsAutoImports.d.ts +21 -0
  70. package/lib/DocsTsAutoImports.js +110 -0
  71. package/lib/DocsTsGenerator/FilesGenerator.d.ts +25 -0
  72. package/lib/DocsTsGenerator/FilesGenerator.js +52 -0
  73. package/lib/DocsTsGenerator.d.ts +47 -0
  74. package/lib/DocsTsGenerator.js +188 -0
  75. package/lib/DocsValidation.d.ts +7 -0
  76. package/lib/DocsValidation.js +179 -0
  77. package/lib/Exceptions.d.ts +7 -0
  78. package/lib/Exceptions.js +13 -0
  79. package/lib/FilesGenerator.d.ts +19 -0
  80. package/lib/FilesGenerator.js +38 -0
  81. package/lib/MarkdownUtilities.d.ts +16 -0
  82. package/lib/MarkdownUtilities.js +68 -0
  83. package/lib/StringStartsWith.d.ts +10 -0
  84. package/lib/StringStartsWith.js +20 -0
  85. package/lib/TsFactoryWrapper.d.ts +80 -0
  86. package/lib/TsFactoryWrapper.js +236 -0
  87. package/lib/TypeDefinitionDiscovery/CustomParsingTypes/UnrealEngineString.d.ts +13 -0
  88. package/lib/TypeDefinitionDiscovery/CustomParsingTypes/UnrealEngineString.js +26 -0
  89. package/lib/TypeDefinitionDiscovery/CustomParsingTypes/string_starts_with.d.ts +25 -0
  90. package/lib/TypeDefinitionDiscovery/CustomParsingTypes/string_starts_with.js +20 -0
  91. package/lib/TypeDefinitionDiscovery/CustomParsingTypes/typed_string.d.ts +14 -0
  92. package/lib/TypeDefinitionDiscovery/CustomParsingTypes/typed_string.js +96 -0
  93. package/lib/TypeDefinitionDiscovery/Generator.d.ts +8 -0
  94. package/lib/TypeDefinitionDiscovery/Generator.js +8 -0
  95. package/lib/TypeDefinitionDiscovery/GeneratorDoesDiscovery.d.ts +8 -0
  96. package/lib/TypeDefinitionDiscovery/GeneratorDoesDiscovery.js +9 -0
  97. package/lib/TypeDefinitionDiscovery/JsonSchema/ArrayType.d.ts +19 -0
  98. package/lib/TypeDefinitionDiscovery/JsonSchema/ArrayType.js +61 -0
  99. package/lib/TypeDefinitionDiscovery/JsonSchema/Object/ExtendsObject.d.ts +23 -0
  100. package/lib/TypeDefinitionDiscovery/JsonSchema/Object/ExtendsObject.js +40 -0
  101. package/lib/TypeDefinitionDiscovery/JsonSchema/ObjectType.d.ts +91 -0
  102. package/lib/TypeDefinitionDiscovery/JsonSchema/ObjectType.js +76 -0
  103. package/lib/TypeDefinitionDiscovery/JsonSchema/String/Const.d.ts +29 -0
  104. package/lib/TypeDefinitionDiscovery/JsonSchema/String/Const.js +20 -0
  105. package/lib/TypeDefinitionDiscovery/JsonSchema/String/Enum/BooleanEnum.d.ts +16 -0
  106. package/lib/TypeDefinitionDiscovery/JsonSchema/String/Enum/BooleanEnum.js +47 -0
  107. package/lib/TypeDefinitionDiscovery/JsonSchema/String/Enum.d.ts +40 -0
  108. package/lib/TypeDefinitionDiscovery/JsonSchema/String/Enum.js +22 -0
  109. package/lib/TypeDefinitionDiscovery/JsonSchema/String/Pattern.d.ts +13 -0
  110. package/lib/TypeDefinitionDiscovery/JsonSchema/String/Pattern.js +21 -0
  111. package/lib/TypeDefinitionDiscovery/JsonSchema/String.d.ts +52 -0
  112. package/lib/TypeDefinitionDiscovery/JsonSchema/String.js +72 -0
  113. package/lib/TypeDefinitionDiscovery/JsonSchema/oneOf_or_anyOf.d.ts +63 -0
  114. package/lib/TypeDefinitionDiscovery/JsonSchema/oneOf_or_anyOf.js +47 -0
  115. package/lib/TypeDefinitionDiscovery.d.ts +49 -0
  116. package/lib/TypeDefinitionDiscovery.js +376 -0
  117. package/lib/TypeDefinitionWriter.d.ts +22 -0
  118. package/lib/TypeDefinitionWriter.js +233 -0
  119. package/lib/TypesDiscovery/CandidatesDiscovery.d.ts +10 -0
  120. package/lib/TypesDiscovery/CandidatesDiscovery.js +14 -0
  121. package/lib/TypesDiscovery/CustomParsingTypes/UnrealEngineString.d.ts +5 -0
  122. package/lib/TypesDiscovery/CustomParsingTypes/UnrealEngineString.js +18 -0
  123. package/lib/TypesDiscovery/CustomParsingTypes/typed_string.d.ts +6 -0
  124. package/lib/TypesDiscovery/CustomParsingTypes/typed_string.js +34 -0
  125. package/lib/TypesDiscovery/JsonSchema/$ref.d.ts +7 -0
  126. package/lib/TypesDiscovery/JsonSchema/$ref.js +33 -0
  127. package/lib/TypesDiscovery/JsonSchema/const.d.ts +6 -0
  128. package/lib/TypesDiscovery/JsonSchema/const.js +22 -0
  129. package/lib/TypesDiscovery/JsonSchema/enum.d.ts +6 -0
  130. package/lib/TypesDiscovery/JsonSchema/enum.js +22 -0
  131. package/lib/TypesDiscovery/JsonSchema/properties.d.ts +4 -0
  132. package/lib/TypesDiscovery/JsonSchema/properties.js +14 -0
  133. package/lib/TypesDiscovery/non_array_object_property.d.ts +4 -0
  134. package/lib/TypesDiscovery/non_array_object_property.js +11 -0
  135. package/lib/TypesDiscovery/non_empty_array_property.d.ts +4 -0
  136. package/lib/TypesDiscovery/non_empty_array_property.js +11 -0
  137. package/lib/TypesDiscovery.d.ts +24 -0
  138. package/lib/TypesDiscovery.js +77 -0
  139. package/lib/TypesGeneration/validators.d.ts +9 -0
  140. package/lib/TypesGeneration/validators.js +26 -0
  141. package/lib/TypesGeneration.d.ts +17 -0
  142. package/lib/TypesGeneration.js +53 -0
  143. package/lib/__dirname.d.ts +1 -0
  144. package/lib/__dirname.js +6 -0
  145. package/lib/helpers.d.ts +5 -0
  146. package/lib/helpers.js +29 -0
  147. package/lib/index.d.ts +8 -0
  148. package/lib/index.js +9 -0
  149. package/package.json +39 -0
  150. package/schema/update8.schema.json +8848 -0
  151. package/setup_PerformanceObserver.d.ts +3 -0
  152. package/setup_PerformanceObserver.js +55 -0
@@ -0,0 +1,21 @@
1
+ import ts from 'typescript';
2
+ import { EntityName_array_from_Node_array, } from './from_Node_array';
3
+ export class NodeExtraction {
4
+ results = [];
5
+ constructor(nodes) {
6
+ if (nodes.length < 1) {
7
+ return;
8
+ }
9
+ const sub_nodes = [];
10
+ for (const node of this.extract(nodes)) {
11
+ if (ts.isEntityName(node)) {
12
+ this.results.push(node);
13
+ }
14
+ else {
15
+ sub_nodes.push(node);
16
+ }
17
+ }
18
+ this.results.push(...EntityName_array_from_Node_array(sub_nodes));
19
+ }
20
+ }
21
+ //# sourceMappingURL=NodeExtraction.js.map
@@ -0,0 +1,5 @@
1
+ import { NodeExtraction } from './NodeExtraction';
2
+ import { Node, PropertyDeclaration } from 'typescript';
3
+ export declare class PropertyDeclarations extends NodeExtraction<PropertyDeclaration> {
4
+ protected extract(nodes: PropertyDeclaration[]): Node[];
5
+ }
@@ -0,0 +1,10 @@
1
+ import { NodeExtraction, } from './NodeExtraction';
2
+ export class PropertyDeclarations extends NodeExtraction {
3
+ extract(nodes) {
4
+ return nodes
5
+ .map((e) => [e.type, e.initializer])
6
+ .flat()
7
+ .filter((maybe) => !!maybe);
8
+ }
9
+ }
10
+ //# sourceMappingURL=PropertyDeclarations.js.map
@@ -0,0 +1,5 @@
1
+ import { NodeExtraction } from './NodeExtraction';
2
+ import { Node, TupleTypeNode } from 'typescript';
3
+ export declare class TupleTypeNodes extends NodeExtraction<TupleTypeNode> {
4
+ extract(nodes: TupleTypeNode[]): Node[];
5
+ }
@@ -0,0 +1,7 @@
1
+ import { NodeExtraction, } from './NodeExtraction';
2
+ export class TupleTypeNodes extends NodeExtraction {
3
+ extract(nodes) {
4
+ return nodes.map((e) => e.elements).flat();
5
+ }
6
+ }
7
+ //# sourceMappingURL=TupleTypeNodes.js.map
@@ -0,0 +1,5 @@
1
+ import { NodeExtraction } from './NodeExtraction';
2
+ import { Node, TypeLiteralNode } from 'typescript';
3
+ export declare class TypeLiteralNodes extends NodeExtraction<TypeLiteralNode> {
4
+ protected extract(nodes: TypeLiteralNode[]): Node[];
5
+ }
@@ -0,0 +1,33 @@
1
+ import { NodeExtraction, } from './NodeExtraction';
2
+ import ts from 'typescript';
3
+ import { NoMatchError, } from '../Exceptions';
4
+ export class TypeLiteralNodes extends NodeExtraction {
5
+ extract(nodes) {
6
+ if (nodes.length < 1) {
7
+ return [];
8
+ }
9
+ const elements = nodes.map((e) => e.members).flat();
10
+ const other_elements = [];
11
+ const types = [];
12
+ for (const element of elements) {
13
+ if (ts.isPropertySignature(element) && !!element.type) {
14
+ types.push(element.type);
15
+ }
16
+ else if (ts.isIndexSignatureDeclaration(element)) {
17
+ types.push(...[
18
+ element.type,
19
+ ...(element.typeParameters || []),
20
+ ...element.parameters,
21
+ ].filter((maybe) => !!maybe));
22
+ }
23
+ else {
24
+ other_elements.push(element);
25
+ }
26
+ }
27
+ if (other_elements.length) {
28
+ throw new NoMatchError(other_elements, 'Unsupported elements found!');
29
+ }
30
+ return types;
31
+ }
32
+ }
33
+ //# sourceMappingURL=TypeLiteralNodes.js.map
@@ -0,0 +1,5 @@
1
+ import { NodeExtraction } from './NodeExtraction';
2
+ import { Node, TypeReferenceNode } from 'typescript';
3
+ export declare class TypeReferenceNodes extends NodeExtraction<TypeReferenceNode> {
4
+ protected extract(nodes: TypeReferenceNode[]): Node[];
5
+ }
@@ -0,0 +1,7 @@
1
+ import { NodeExtraction, } from './NodeExtraction';
2
+ export class TypeReferenceNodes extends NodeExtraction {
3
+ extract(nodes) {
4
+ return nodes.map((e) => e.typeName);
5
+ }
6
+ }
7
+ //# sourceMappingURL=TypeReferenceNodes.js.map
@@ -0,0 +1,3 @@
1
+ import { EntityName, Node } from 'typescript';
2
+ export declare function EntityName_array_from_Node_array(nodes: Node[]): EntityName[];
3
+ export declare function from_Node_array(nodes: Node[]): string[];
@@ -0,0 +1,245 @@
1
+ import ts from 'typescript';
2
+ import { TypeReferenceNodes, } from './TypeReferenceNodes';
3
+ import { ClassDeclarations, } from './ClassDeclarations';
4
+ import { TupleTypeNodes, } from './TupleTypeNodes';
5
+ import { TypeLiteralNodes, } from './TypeLiteralNodes';
6
+ import { LiteralTypeNodes, } from './LiteralTypeNodes';
7
+ import { ArrayTypeNodes, } from './ArrayTypeNodes';
8
+ import { MethodDeclarations, } from './MethodDeclarations';
9
+ import { PropertyDeclarations, } from './PropertyDeclarations';
10
+ import { FunctionDeclarations, } from './FunctionDeclaration';
11
+ import { NoMatchError, } from '../Exceptions';
12
+ const recursion_limit = 10;
13
+ export function EntityName_array_from_Node_array(nodes) {
14
+ if (nodes.length < 1) {
15
+ return [];
16
+ }
17
+ const class_declarations = [];
18
+ const tuple_types = [];
19
+ const type_literals = [];
20
+ const literal_types = [];
21
+ const reference_nodes = [];
22
+ const array_types = [];
23
+ const method_declarations = [];
24
+ const property_declarations = [];
25
+ const function_types = [];
26
+ const sub_nodes = [];
27
+ const entity_names = [];
28
+ const others = [];
29
+ for (const node of nodes) {
30
+ if (ts.isEntityName(node)) {
31
+ entity_names.push(node);
32
+ }
33
+ else if (ts.isClassDeclaration(node)) {
34
+ class_declarations.push(node);
35
+ }
36
+ else if (ts.isUnionTypeNode(node)
37
+ || ts.isIntersectionTypeNode(node)) {
38
+ sub_nodes.push(...node.types);
39
+ }
40
+ else if (ts.isTupleTypeNode(node)) {
41
+ tuple_types.push(node);
42
+ }
43
+ else if (ts.isTypeLiteralNode(node)) {
44
+ type_literals.push(node);
45
+ }
46
+ else if (ts.isLiteralTypeNode(node)) {
47
+ literal_types.push(node);
48
+ }
49
+ else if (ts.isTypeReferenceNode(node)) {
50
+ reference_nodes.push(node);
51
+ sub_nodes.push(...(node.typeArguments || []));
52
+ }
53
+ else if (ts.isArrayTypeNode(node)) {
54
+ array_types.push(node);
55
+ }
56
+ else if (ts.isParenthesizedTypeNode(node)
57
+ || ts.isTypeOperatorNode(node)
58
+ || ts.isRestTypeNode(node)
59
+ || ts.isTypeAliasDeclaration(node)) {
60
+ sub_nodes.push(node.type);
61
+ if (ts.isTypeAliasDeclaration(node)) {
62
+ sub_nodes.push(...(node.typeParameters || []));
63
+ }
64
+ }
65
+ else if (ts.isMethodDeclaration(node)) {
66
+ method_declarations.push(node);
67
+ }
68
+ else if (ts.isPropertyDeclaration(node)) {
69
+ property_declarations.push(node);
70
+ }
71
+ else if (ts.isFunctionDeclaration(node)) {
72
+ function_types.push(node);
73
+ }
74
+ else if (ts.isArrowFunction(node)) {
75
+ sub_nodes.push(...[
76
+ ...node.parameters,
77
+ ...(node.typeParameters || []),
78
+ node.body,
79
+ ...((node.type && ts.isTypeLiteralNode(node.type))
80
+ ? [node.type]
81
+ : []),
82
+ ].filter(e => !!e));
83
+ }
84
+ else if (ts.isBlock(node)) {
85
+ sub_nodes.push(...node.statements);
86
+ }
87
+ else if (ts.isTypeParameterDeclaration(node)) {
88
+ sub_nodes.push(...[node.name, node.constraint, node.expression].filter((maybe) => {
89
+ return undefined !== maybe;
90
+ }));
91
+ }
92
+ else if (ts.isIfStatement(node)) {
93
+ sub_nodes.push(...[
94
+ node.elseStatement,
95
+ node.expression,
96
+ node.thenStatement,
97
+ ].filter((maybe) => !!maybe));
98
+ }
99
+ else if (ts.isVariableStatement(node)) {
100
+ sub_nodes.push(node.declarationList);
101
+ }
102
+ else if (ts.isReturnStatement(node)
103
+ || ts.isExpressionStatement(node)
104
+ || ts.isThrowStatement(node)
105
+ || ts.isParenthesizedExpression(node)) {
106
+ if (node.expression) {
107
+ sub_nodes.push(node.expression);
108
+ }
109
+ }
110
+ else if (ts.isParameter(node)) {
111
+ sub_nodes.push(...[node.initializer, node.type].filter((maybe) => !!maybe));
112
+ }
113
+ else if (ts.isNewExpression(node)) {
114
+ sub_nodes.push(...[
115
+ ...(node.arguments || []),
116
+ node.expression,
117
+ ...(node.typeArguments || []),
118
+ ].filter((maybe) => !!maybe));
119
+ }
120
+ else if (ts.isPrefixUnaryExpression(node)) {
121
+ sub_nodes.push(node.operand);
122
+ }
123
+ else if (ts.isBinaryExpression(node)) {
124
+ sub_nodes.push(...[node.left, node.right].filter((maybe) => !ts.isIdentifier(maybe)));
125
+ }
126
+ else if (ts.isVariableDeclarationList(node)) {
127
+ sub_nodes.push(...node.declarations);
128
+ }
129
+ else if (ts.isConditionalTypeNode(node)) {
130
+ sub_nodes.push(node.trueType, node.checkType, node.extendsType, node.falseType);
131
+ }
132
+ else if (ts.isObjectBindingPattern(node)) {
133
+ sub_nodes.push(...node.elements);
134
+ }
135
+ else if (ts.isAsExpression(node)) {
136
+ sub_nodes.push(node.expression, node.type);
137
+ }
138
+ else if (ts.isElementAccessExpression(node)) {
139
+ sub_nodes.push(node.argumentExpression, node.expression);
140
+ }
141
+ else if (ts.isCallExpression(node)) {
142
+ sub_nodes.push(...[
143
+ ...node.arguments,
144
+ node.expression,
145
+ ...(node.typeArguments || []),
146
+ ].filter((maybe) => !!maybe));
147
+ }
148
+ else if (ts.isVariableDeclaration(node)) {
149
+ sub_nodes.push(...[
150
+ node.initializer,
151
+ node.type,
152
+ node.initializer,
153
+ ].filter((maybe) => !!maybe));
154
+ }
155
+ else if (ts.isTypeQueryNode(node)) {
156
+ sub_nodes.push(...[...(node.typeArguments || []), node.exprName].filter((maybe) => !!maybe));
157
+ }
158
+ else if (ts.isBindingElement(node)) {
159
+ sub_nodes.push(...[node.initializer].filter((maybe) => !!maybe));
160
+ }
161
+ else if (ts.isPropertyAccessExpression(node)) {
162
+ sub_nodes.push(node.expression);
163
+ }
164
+ else if (ts.isTemplateExpression(node)
165
+ || ts.isTemplateLiteralTypeNode(node)) {
166
+ sub_nodes.push(node.head, ...node.templateSpans);
167
+ }
168
+ else if (ts.isTemplateSpan(node)) {
169
+ sub_nodes.push(node.expression, node.literal);
170
+ }
171
+ else if (ts.isMappedTypeNode(node)) {
172
+ sub_nodes.push(...[
173
+ node.nameType,
174
+ ...(node.members || []),
175
+ node.type,
176
+ node.typeParameter,
177
+ ].filter((maybe) => !!maybe));
178
+ }
179
+ else if (ts.isTemplateLiteralTypeSpan(node)) {
180
+ sub_nodes.push(node.literal, node.type);
181
+ }
182
+ else if (ts.isHeritageClause(node)) {
183
+ sub_nodes.push(...node.types);
184
+ }
185
+ else if (ts.isExpressionWithTypeArguments(node)) {
186
+ sub_nodes.push(node.expression, ...(node.typeArguments || []));
187
+ }
188
+ else if (ts.isExportDeclaration(node)
189
+ && node.exportClause
190
+ && ts.isNamedExports(node.exportClause)) {
191
+ sub_nodes.push(...node.exportClause.elements.map((sub_node) => {
192
+ return sub_node.name;
193
+ }));
194
+ }
195
+ else if (ts.isObjectLiteralExpression(node)) {
196
+ sub_nodes.push(...node.properties);
197
+ }
198
+ else if (ts.isPropertyAssignment(node)) {
199
+ sub_nodes.push(node.initializer);
200
+ }
201
+ else if (ts.isArrayLiteralExpression(node)) {
202
+ sub_nodes.push(...node.elements);
203
+ }
204
+ else if (ts.isComputedPropertyName(node)) {
205
+ sub_nodes.push(node.expression);
206
+ }
207
+ else if (!ts.isToken(node)
208
+ && !ts.isNamedExports(node)
209
+ && !ts.isShorthandPropertyAssignment(node)) {
210
+ others.push(node);
211
+ }
212
+ }
213
+ if (others.length) {
214
+ throw new NoMatchError(others, 'Unsupported types found!');
215
+ }
216
+ return [
217
+ ...new ClassDeclarations(class_declarations).results,
218
+ ...new TupleTypeNodes(tuple_types).results,
219
+ ...new TypeLiteralNodes(type_literals).results,
220
+ ...new LiteralTypeNodes(literal_types).results,
221
+ ...new TypeReferenceNodes(reference_nodes).results,
222
+ ...new ArrayTypeNodes(array_types).results,
223
+ ...new MethodDeclarations(method_declarations).results,
224
+ ...new PropertyDeclarations(property_declarations).results,
225
+ ...new FunctionDeclarations(function_types).results,
226
+ ...EntityName_array_from_Node_array(sub_nodes),
227
+ ...entity_names,
228
+ ];
229
+ }
230
+ export function from_Node_array(nodes) {
231
+ return [
232
+ ...EntityName_array_from_Node_array(nodes).map((checking) => {
233
+ let recursion_iteration = 0;
234
+ while (ts.isQualifiedName(checking)) {
235
+ if (recursion_iteration > recursion_limit) {
236
+ throw new Error('Recursion limit exceeded!');
237
+ }
238
+ checking = checking.left;
239
+ ++recursion_iteration;
240
+ }
241
+ return checking.escapedText.toString();
242
+ }),
243
+ ];
244
+ }
245
+ //# sourceMappingURL=from_Node_array.js.map
@@ -0,0 +1,21 @@
1
+ import ts from 'typescript';
2
+ import { ImportTracker } from './TypesGeneration';
3
+ export declare class DocsTsAutoImports {
4
+ private readonly comes_from;
5
+ private readonly files_entries;
6
+ constructor(files: {
7
+ [key: string]: ts.Node[];
8
+ });
9
+ get imports_come_from(): string;
10
+ generate(): ImportTracker;
11
+ protected file_exports(): {
12
+ [key: string]: [string, ...string[]];
13
+ };
14
+ private static filter_node;
15
+ private static filter_nodes;
16
+ private static has_export;
17
+ private static is_Identifier;
18
+ private static is_named_ClassDeclaration;
19
+ private static is_named_FunctionDeclaration;
20
+ private static node_IdentifierName;
21
+ }
@@ -0,0 +1,110 @@
1
+ import ts from 'typescript';
2
+ import { ImportTracker, } from './TypesGeneration';
3
+ import { basename, dirname, relative, } from 'node:path';
4
+ import { from_Node_array, } from './DocsToAutoImport/from_Node_array';
5
+ import { NoMatchError, } from './Exceptions';
6
+ export class DocsTsAutoImports {
7
+ comes_from = {};
8
+ files_entries;
9
+ constructor(files) {
10
+ this.files_entries = Object.entries(files);
11
+ }
12
+ get imports_come_from() {
13
+ return `${JSON.stringify(this.comes_from, null, '\t')}\n`;
14
+ }
15
+ generate() {
16
+ const file_exports = this.file_exports();
17
+ for (const entry of Object.entries(file_exports)) {
18
+ const [filename, exports_these] = entry;
19
+ for (const export_name of exports_these) {
20
+ if (export_name in this.comes_from) {
21
+ throw new NoMatchError(entry, `${export_name} conflict!`);
22
+ }
23
+ this.comes_from[export_name] = filename.replace(/\.ts$/, '');
24
+ }
25
+ }
26
+ const auto_imports = {};
27
+ for (const entry of this.files_entries) {
28
+ const [filename, nodes] = entry;
29
+ const node_names = from_Node_array(nodes);
30
+ const reference_names = [...node_names]
31
+ .filter((maybe) => maybe in this.comes_from)
32
+ .filter((maybe) => filename.replace(/\.ts$/, '') !==
33
+ this.comes_from[maybe]);
34
+ if (reference_names.length) {
35
+ if (!(filename in auto_imports)) {
36
+ auto_imports[filename] = {};
37
+ }
38
+ for (const import_this of reference_names) {
39
+ let import_from = `${relative(dirname(filename), dirname(this.comes_from[import_this]))}/${basename(this.comes_from[import_this])}`;
40
+ if (import_from.startsWith('/')) {
41
+ import_from = `.${import_from}`;
42
+ }
43
+ if (!import_from.startsWith('.')) {
44
+ import_from = `./${import_from}`;
45
+ }
46
+ if (!(import_from in auto_imports[filename])) {
47
+ auto_imports[filename][import_from] = [];
48
+ }
49
+ if (!auto_imports[filename][import_from].includes(import_this)) {
50
+ auto_imports[filename][import_from].push(import_this);
51
+ }
52
+ }
53
+ }
54
+ }
55
+ const import_tracker = new ImportTracker();
56
+ import_tracker.merge_and_set_imports(auto_imports);
57
+ return import_tracker;
58
+ }
59
+ file_exports() {
60
+ const file_exports = {};
61
+ for (const entry of this.files_entries) {
62
+ const [filename, nodes] = entry;
63
+ const check_these = DocsTsAutoImports.filter_nodes(nodes);
64
+ for (const checking of check_these) {
65
+ if (!(filename in file_exports)) {
66
+ file_exports[filename] = [
67
+ DocsTsAutoImports.node_IdentifierName(checking),
68
+ ];
69
+ }
70
+ else {
71
+ file_exports[filename].push(DocsTsAutoImports.node_IdentifierName(checking));
72
+ }
73
+ }
74
+ }
75
+ return file_exports;
76
+ }
77
+ static filter_node(maybe) {
78
+ return ((this.is_named_ClassDeclaration(maybe)
79
+ || this.is_named_FunctionDeclaration(maybe)
80
+ || ts.isTypeAliasDeclaration(maybe))
81
+ && this.has_export(maybe));
82
+ }
83
+ static filter_nodes(nodes) {
84
+ return nodes.filter((maybe) => {
85
+ return this.filter_node(maybe);
86
+ });
87
+ }
88
+ static has_export(node) {
89
+ return (!!node.modifiers
90
+ && node.modifiers
91
+ .map((inner_maybe) => inner_maybe.kind)
92
+ .includes(ts.SyntaxKind.ExportKeyword));
93
+ }
94
+ static is_Identifier(maybe) {
95
+ return !!maybe && ts.isIdentifier(maybe);
96
+ }
97
+ static is_named_ClassDeclaration(node) {
98
+ return (ts.isClassDeclaration(node)
99
+ && DocsTsAutoImports.is_Identifier(node.name));
100
+ }
101
+ static is_named_FunctionDeclaration(node) {
102
+ return (ts.isFunctionDeclaration(node)
103
+ && DocsTsAutoImports.is_Identifier(node.name));
104
+ }
105
+ static node_IdentifierName(node) {
106
+ const from = ts.isTypeReferenceNode(node) ? node.typeName : node.name;
107
+ return from.escapedText.toString();
108
+ }
109
+ }
110
+ //# sourceMappingURL=DocsTsAutoImports.js.map
@@ -0,0 +1,25 @@
1
+ import { FilesGenerator as Base } from '../FilesGenerator';
2
+ import { ValidateFunction } from 'ajv/dist/2020';
3
+ import { TypeAliasDeclaration, TypeNode } from 'typescript';
4
+ import { TypeDefinitionDiscovery } from '../TypeDefinitionDiscovery';
5
+ import { DocsDataItem } from '../DocsTsGenerator';
6
+ export declare class FilesGenerator extends Base {
7
+ private readonly discovery;
8
+ private readonly is_NativeClass;
9
+ private readonly types;
10
+ private readonly validations;
11
+ constructor(validations: ValidateFunction[], discovery: TypeDefinitionDiscovery);
12
+ generate_files(): AsyncGenerator<{
13
+ file: string;
14
+ node: TypeAliasDeclaration;
15
+ }, void, unknown>;
16
+ protected generate_file(entry: DocsDataItem): Promise<{
17
+ file: string;
18
+ node: TypeAliasDeclaration;
19
+ }>;
20
+ protected generate_files_class_name(value: string): string;
21
+ protected generate_files_entry_yield(entry_type: TypeNode, entry_class_name: string): {
22
+ file: string;
23
+ node: TypeAliasDeclaration;
24
+ };
25
+ }
@@ -0,0 +1,52 @@
1
+ import { FilesGenerator as Base, } from '../FilesGenerator';
2
+ import { NoMatchError, } from '../Exceptions';
3
+ import { adjust_unrealengine_value, } from '../CustomParsingTypes/UnrealEngineString';
4
+ import { UnrealEngineString, } from '../TypeDefinitionDiscovery/CustomParsingTypes/UnrealEngineString';
5
+ import ts from 'typescript';
6
+ import { create_modifiers, } from '../TsFactoryWrapper';
7
+ import { TypesDiscovery, } from '../TypesDiscovery';
8
+ export class FilesGenerator extends Base {
9
+ discovery;
10
+ is_NativeClass;
11
+ types;
12
+ validations;
13
+ constructor(validations, discovery) {
14
+ super();
15
+ this.validations = validations;
16
+ this.discovery = discovery;
17
+ this.is_NativeClass = TypesDiscovery.generate_is_NativeClass(this.discovery.docs);
18
+ this.types = this.discovery.discover_type_$defs();
19
+ }
20
+ async *generate_files() {
21
+ for (const entry of await this.discovery.docs.get()) {
22
+ yield await this.generate_file(entry);
23
+ }
24
+ }
25
+ async generate_file(entry) {
26
+ const types = await this.types;
27
+ const is_NativeClass = await this.is_NativeClass;
28
+ const check = this.validations.find(maybe => maybe(entry));
29
+ if (!check) {
30
+ throw new NoMatchError({
31
+ types,
32
+ entry,
33
+ }, 'Could not find matching validator!');
34
+ }
35
+ else if (!is_NativeClass(entry)) {
36
+ throw new NoMatchError(entry, 'Entry not a general NativeClass!');
37
+ }
38
+ const entry_type = this.discovery.find(types.found_classes[this.validations.indexOf(check)]);
39
+ return this.generate_files_entry_yield(entry_type, this.generate_files_class_name(entry.NativeClass));
40
+ }
41
+ generate_files_class_name(value) {
42
+ return adjust_unrealengine_value(UnrealEngineString.fromString(value).right);
43
+ }
44
+ generate_files_entry_yield(entry_type, entry_class_name) {
45
+ const entry_filename = `classes/CoreUObject/${entry_class_name}.ts`;
46
+ return {
47
+ file: entry_filename,
48
+ node: ts.factory.createTypeAliasDeclaration(create_modifiers('export'), `${entry_class_name}__NativeClass`, undefined, entry_type),
49
+ };
50
+ }
51
+ }
52
+ //# sourceMappingURL=FilesGenerator.js.map
@@ -0,0 +1,47 @@
1
+ import Ajv, { ErrorObject, SchemaObject } from 'ajv/dist/2020';
2
+ import update8_schema from '../schema/update8.schema.json';
3
+ import { BuiltInParserName } from 'prettier';
4
+ export declare class ValidationError extends Error {
5
+ readonly errors: ErrorObject[];
6
+ readonly json: unknown;
7
+ constructor(message: string, errors: ErrorObject[] | undefined | null, json: unknown);
8
+ }
9
+ export type DocsDataItem_Classes_entry<TypeOfUnknownProperties = unknown> = ({
10
+ [key: string]: TypeOfUnknownProperties;
11
+ } & {
12
+ ClassName: string;
13
+ });
14
+ export type DocsDataItem<TypeOfUnknownProperties = unknown, TypeOfNativeClass = string> = {
15
+ NativeClass: TypeOfNativeClass;
16
+ Classes: DocsDataItem_Classes_entry<TypeOfUnknownProperties>[];
17
+ };
18
+ export type DocsData = [DocsDataItem, ...DocsDataItem[]];
19
+ export declare class DocsTsGenerator {
20
+ private docs;
21
+ private readonly cache_path;
22
+ private readonly docs_path;
23
+ readonly ajv: Ajv;
24
+ static readonly PERF_EARLY_RETURN = "Early Return of Docs.json";
25
+ static readonly PERF_FAILURE = "Failure to load Docs.json";
26
+ static readonly PERF_FILE_PARSED = "Docs.json contents parsed";
27
+ static readonly PERF_FILE_READ = "Docs.json contents read";
28
+ static readonly PERF_START_LOADING_JSON = "Start Loading Docs.json";
29
+ static readonly PERF_VALIDATION_COMPILED = "Docs.json validation compiled";
30
+ static readonly PERF_VALIDATION_FINISHED = "Docs.json validation finished";
31
+ static readonly PERF_VALIDATION_PRECOMPILE = "Docs.json validation pre-compilation started";
32
+ static readonly PERF_VALIDATION_STARTED = "Docs.json validation started";
33
+ constructor({ ajv, docs_path, cache_path, }: {
34
+ ajv: Ajv;
35
+ docs_path: string | DocsData;
36
+ cache_path?: string;
37
+ });
38
+ definition($ref: string): Promise<SchemaObject>;
39
+ get(): Promise<DocsData>;
40
+ schema(): Promise<typeof update8_schema>;
41
+ private load;
42
+ private load_from_file;
43
+ private validate;
44
+ private validate_schema;
45
+ }
46
+ export declare function format_code(code: string, parser?: BuiltInParserName): Promise<string>;
47
+ export declare function eslint_generated_types(parent_folder: string): Promise<void>;