@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,188 @@
|
|
|
1
|
+
import { readFile, writeFile, } from 'node:fs/promises';
|
|
2
|
+
import { basename, dirname, } from 'node:path';
|
|
3
|
+
import { existsSync, } from 'node:fs';
|
|
4
|
+
import { fileURLToPath, } from 'node:url';
|
|
5
|
+
import * as prettier from 'prettier';
|
|
6
|
+
import standalone from 'ajv/dist/standalone';
|
|
7
|
+
import { ESLint, } from 'eslint';
|
|
8
|
+
import update8_schema from '../schema/update8.schema.json' assert {
|
|
9
|
+
type: 'json'
|
|
10
|
+
};
|
|
11
|
+
import { createHash, } from 'node:crypto';
|
|
12
|
+
import { is_non_empty_array, object_has_only_properties_that_match_predicate, object_has_property, property_exists_on_object, value_is_non_array_object, } from './CustomParsingTypes/CustomPairingTypes';
|
|
13
|
+
import { is_string, } from './StringStartsWith';
|
|
14
|
+
import { NoMatchError, } from './Exceptions';
|
|
15
|
+
import { TypedString, } from './CustomParsingTypes/TypedString';
|
|
16
|
+
import { compile, esmify, } from './AjvUtilities';
|
|
17
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
18
|
+
export class ValidationError extends Error {
|
|
19
|
+
errors;
|
|
20
|
+
json;
|
|
21
|
+
constructor(message, errors, json) {
|
|
22
|
+
super(message);
|
|
23
|
+
this.errors = errors || [];
|
|
24
|
+
this.json = json;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
export class DocsTsGenerator {
|
|
28
|
+
docs;
|
|
29
|
+
cache_path;
|
|
30
|
+
docs_path;
|
|
31
|
+
ajv;
|
|
32
|
+
static PERF_EARLY_RETURN = 'Early Return of Docs.json';
|
|
33
|
+
static PERF_FAILURE = 'Failure to load Docs.json';
|
|
34
|
+
static PERF_FILE_PARSED = 'Docs.json contents parsed';
|
|
35
|
+
static PERF_FILE_READ = 'Docs.json contents read';
|
|
36
|
+
static PERF_START_LOADING_JSON = 'Start Loading Docs.json';
|
|
37
|
+
static PERF_VALIDATION_COMPILED = 'Docs.json validation compiled';
|
|
38
|
+
static PERF_VALIDATION_FINISHED = 'Docs.json validation finished';
|
|
39
|
+
static PERF_VALIDATION_PRECOMPILE = 'Docs.json validation pre-compilation started';
|
|
40
|
+
static PERF_VALIDATION_STARTED = 'Docs.json validation started';
|
|
41
|
+
constructor({
|
|
42
|
+
// Ajv instance
|
|
43
|
+
ajv,
|
|
44
|
+
// raw JSON or path to UTF-16LE encoded Docs.json
|
|
45
|
+
docs_path,
|
|
46
|
+
// optional cache folder path for cacheable resources
|
|
47
|
+
cache_path = undefined, }) {
|
|
48
|
+
this.ajv = ajv;
|
|
49
|
+
this.docs_path = docs_path;
|
|
50
|
+
this.cache_path = cache_path;
|
|
51
|
+
}
|
|
52
|
+
async definition($ref) {
|
|
53
|
+
const schema = await this.schema();
|
|
54
|
+
if (!property_exists_on_object(schema.$defs, $ref)) {
|
|
55
|
+
throw new NoMatchError({
|
|
56
|
+
$ref,
|
|
57
|
+
options: Object.keys(schema.$defs),
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
return schema.$defs[$ref];
|
|
61
|
+
}
|
|
62
|
+
async get() {
|
|
63
|
+
return this.validate(await this.load(), await this.schema());
|
|
64
|
+
}
|
|
65
|
+
async schema() {
|
|
66
|
+
await this.validate_schema(update8_schema);
|
|
67
|
+
return update8_schema;
|
|
68
|
+
}
|
|
69
|
+
async load() {
|
|
70
|
+
if (undefined === this.docs) {
|
|
71
|
+
performance.mark(DocsTsGenerator.PERF_START_LOADING_JSON);
|
|
72
|
+
if ('string' !== typeof this.docs_path) {
|
|
73
|
+
performance.measure(DocsTsGenerator.PERF_EARLY_RETURN, DocsTsGenerator.PERF_START_LOADING_JSON);
|
|
74
|
+
return this.docs_path;
|
|
75
|
+
}
|
|
76
|
+
else if (!this.docs_path.endsWith('.json')) {
|
|
77
|
+
performance.measure(DocsTsGenerator.PERF_FAILURE, DocsTsGenerator.PERF_START_LOADING_JSON);
|
|
78
|
+
throw new Error('Probably not a JSON file');
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
let maybe_json;
|
|
82
|
+
try {
|
|
83
|
+
if (this.cache_path) {
|
|
84
|
+
const utf8_filename = basename(this.docs_path).replace(/\.json$/, '.utf8.json');
|
|
85
|
+
const utf8_filepath = `${this.cache_path}/${utf8_filename}`;
|
|
86
|
+
if (existsSync(utf8_filepath)) {
|
|
87
|
+
const file_contents = await readFile(utf8_filepath);
|
|
88
|
+
performance.measure(DocsTsGenerator.PERF_FILE_READ, DocsTsGenerator.PERF_START_LOADING_JSON);
|
|
89
|
+
maybe_json = JSON.parse(file_contents.toString());
|
|
90
|
+
performance.measure(DocsTsGenerator.PERF_FILE_PARSED, DocsTsGenerator.PERF_START_LOADING_JSON);
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
maybe_json = await this.load_from_file(this.docs_path);
|
|
94
|
+
performance.measure(DocsTsGenerator.PERF_FILE_PARSED, DocsTsGenerator.PERF_START_LOADING_JSON);
|
|
95
|
+
await writeFile(utf8_filepath, JSON.stringify(maybe_json, null, '\t') + '\n');
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
maybe_json = await this.load_from_file(this.docs_path);
|
|
100
|
+
performance.measure(DocsTsGenerator.PERF_FILE_PARSED, DocsTsGenerator.PERF_START_LOADING_JSON);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
catch (err) {
|
|
104
|
+
performance.measure(DocsTsGenerator.PERF_FAILURE, DocsTsGenerator.PERF_START_LOADING_JSON);
|
|
105
|
+
throw err;
|
|
106
|
+
}
|
|
107
|
+
if (!is_non_empty_array(maybe_json, value_is_non_array_object)) {
|
|
108
|
+
performance.measure(DocsTsGenerator.PERF_FAILURE, DocsTsGenerator.PERF_START_LOADING_JSON);
|
|
109
|
+
throw new Error('Was expecting json to be an array!');
|
|
110
|
+
}
|
|
111
|
+
this.docs = maybe_json;
|
|
112
|
+
}
|
|
113
|
+
if (undefined === this.docs) {
|
|
114
|
+
throw new Error('this.docs not set!');
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return this.docs;
|
|
118
|
+
}
|
|
119
|
+
async load_from_file(filepath) {
|
|
120
|
+
const file = await readFile(filepath, {
|
|
121
|
+
encoding: 'utf-16le',
|
|
122
|
+
});
|
|
123
|
+
performance.measure(DocsTsGenerator.PERF_FILE_READ, DocsTsGenerator.PERF_START_LOADING_JSON);
|
|
124
|
+
const utf8 = Buffer.from(file).toString('utf-8');
|
|
125
|
+
return JSON.parse(utf8.trim());
|
|
126
|
+
}
|
|
127
|
+
async validate(json, schema) {
|
|
128
|
+
performance.mark(DocsTsGenerator.PERF_VALIDATION_STARTED);
|
|
129
|
+
const validateDocs = await this.validate_schema(schema);
|
|
130
|
+
performance.measure(DocsTsGenerator.PERF_VALIDATION_COMPILED, DocsTsGenerator.PERF_VALIDATION_STARTED);
|
|
131
|
+
const result = validateDocs(json);
|
|
132
|
+
performance.measure(DocsTsGenerator.PERF_VALIDATION_FINISHED, DocsTsGenerator.PERF_VALIDATION_STARTED);
|
|
133
|
+
if (!result) {
|
|
134
|
+
throw new ValidationError('Failed to validate against the provided JSON Schema', validateDocs.errors, json);
|
|
135
|
+
}
|
|
136
|
+
return json;
|
|
137
|
+
}
|
|
138
|
+
async validate_schema(schema) {
|
|
139
|
+
if (object_has_property(schema, '$defs', value_is_non_array_object)
|
|
140
|
+
&& object_has_only_properties_that_match_predicate(schema.$defs, value_is_non_array_object)) {
|
|
141
|
+
const { $defs } = schema;
|
|
142
|
+
if (object_has_only_properties_that_match_predicate($defs, value_is_non_array_object)) {
|
|
143
|
+
TypedString.instance().configure_ajv($defs, this.ajv);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
if (this.cache_path) {
|
|
147
|
+
const file_sha512 = createHash('sha512');
|
|
148
|
+
if (!object_has_property(schema, '$id', is_string)) {
|
|
149
|
+
throw new ValidationError('Schema does not have an id!', undefined, schema);
|
|
150
|
+
}
|
|
151
|
+
file_sha512.update(await readFile(`${__dirname}/../schema/${schema['$id']}`));
|
|
152
|
+
const filename = `${schema['$id']}.${file_sha512.digest('hex')}.mjs`;
|
|
153
|
+
const filepath = `${this.cache_path}/${filename}`;
|
|
154
|
+
if (!existsSync(filepath)) {
|
|
155
|
+
performance.mark(DocsTsGenerator.PERF_VALIDATION_PRECOMPILE);
|
|
156
|
+
performance.measure('ajv configured', DocsTsGenerator.PERF_VALIDATION_PRECOMPILE);
|
|
157
|
+
await writeFile(filepath, esmify(standalone(this.ajv, compile(this.ajv, schema))));
|
|
158
|
+
performance.measure('ajv pre-compilation done', DocsTsGenerator.PERF_VALIDATION_PRECOMPILE, DocsTsGenerator.PERF_VALIDATION_PRECOMPILE);
|
|
159
|
+
}
|
|
160
|
+
const { default: validateDocs, } = (await import(filepath));
|
|
161
|
+
return validateDocs;
|
|
162
|
+
}
|
|
163
|
+
return compile(this.ajv, schema);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
const prettier_config = prettier.resolveConfig(`${__dirname}/../.prettierrc`);
|
|
167
|
+
export async function format_code(code, parser = 'typescript') {
|
|
168
|
+
const config = await prettier_config;
|
|
169
|
+
if (!config) {
|
|
170
|
+
throw new Error('could not find prettier config');
|
|
171
|
+
}
|
|
172
|
+
code = await prettier.format(code, Object.assign({
|
|
173
|
+
parser,
|
|
174
|
+
}, config));
|
|
175
|
+
return code.replace(/(\t+) +/gm, '$1');
|
|
176
|
+
}
|
|
177
|
+
export async function eslint_generated_types(parent_folder) {
|
|
178
|
+
const eslint = new ESLint({
|
|
179
|
+
fix: true,
|
|
180
|
+
cache: true,
|
|
181
|
+
cacheLocation: `${parent_folder}/.eslintcache`,
|
|
182
|
+
cacheStrategy: 'content',
|
|
183
|
+
});
|
|
184
|
+
const eslint_formatter = eslint.loadFormatter('stylish');
|
|
185
|
+
const results = await eslint.lintFiles(`${parent_folder}/**/*.ts`);
|
|
186
|
+
process.stdout.write(`${await (await eslint_formatter).format(results)}\n`);
|
|
187
|
+
}
|
|
188
|
+
//# sourceMappingURL=DocsTsGenerator.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import Ajv from 'ajv/dist/2020';
|
|
2
|
+
export declare function string_to_native_type(data: string, shallow?: boolean): object | unknown[] | string | false;
|
|
3
|
+
export declare function string_to_object<T extends {
|
|
4
|
+
[key: string]: unknown;
|
|
5
|
+
}>(data: string, shallow?: boolean): T | false;
|
|
6
|
+
export declare function string_to_array<T extends unknown[]>(data: string, shallow?: boolean): T | false;
|
|
7
|
+
export declare function configure_ajv(ajv: Ajv): void;
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { _, } from 'ajv/dist/2020';
|
|
2
|
+
import { UnrealEngineString, } from './CustomParsingTypes/UnrealEngineString';
|
|
3
|
+
import { is_string, } from './StringStartsWith';
|
|
4
|
+
export function string_to_native_type(data, shallow = false) {
|
|
5
|
+
data = data.trim();
|
|
6
|
+
if (/^\(.+\)$/.test(data)) {
|
|
7
|
+
const object = string_to_object(data, shallow);
|
|
8
|
+
return false !== object ? object : string_to_array(data, shallow);
|
|
9
|
+
}
|
|
10
|
+
else if (/^".+"$/.test(data)) {
|
|
11
|
+
return data.substring(1, data.length - 1);
|
|
12
|
+
}
|
|
13
|
+
return data;
|
|
14
|
+
}
|
|
15
|
+
export function string_to_object(data, shallow = false) {
|
|
16
|
+
if ('' === data) {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
const match = /^\([^=]+=([^,]+|\([^)]+\))(,[^=]+=(\([^)]+)\)|,[^=]+=[^,]+)*\)$/
|
|
20
|
+
.test(data);
|
|
21
|
+
if (!match) {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
return Object.fromEntries(data
|
|
25
|
+
.substring(1, data.length - 1)
|
|
26
|
+
.split('')
|
|
27
|
+
.reduce((was, is, index, array) => {
|
|
28
|
+
let add_buffer = false;
|
|
29
|
+
if ('key' === was.mode && '=' !== is) {
|
|
30
|
+
add_buffer = true;
|
|
31
|
+
}
|
|
32
|
+
else if ('key' === was.mode && '=' === is) {
|
|
33
|
+
was.mode = 'value';
|
|
34
|
+
was.current_value_nesting = 0;
|
|
35
|
+
add_buffer = false;
|
|
36
|
+
}
|
|
37
|
+
else if ('value' === was.mode) {
|
|
38
|
+
add_buffer = true;
|
|
39
|
+
if ('(' === is) {
|
|
40
|
+
++was.current_value_nesting;
|
|
41
|
+
}
|
|
42
|
+
else if (')' === is) {
|
|
43
|
+
--was.current_value_nesting;
|
|
44
|
+
}
|
|
45
|
+
else if (',' === is
|
|
46
|
+
&& 0 === was.current_value_nesting) {
|
|
47
|
+
if (/^".+"$/.test(was.current_value_buffer)) {
|
|
48
|
+
was.current_value_buffer =
|
|
49
|
+
was.current_value_buffer.substring(1, was.current_value_buffer.length - 1);
|
|
50
|
+
}
|
|
51
|
+
const coerced_value = shallow
|
|
52
|
+
? was.current_value_buffer
|
|
53
|
+
: string_to_native_type(was.current_value_buffer);
|
|
54
|
+
was.properties.push([
|
|
55
|
+
was.current_key_buffer,
|
|
56
|
+
false !== coerced_value
|
|
57
|
+
? coerced_value
|
|
58
|
+
: was.current_value_buffer,
|
|
59
|
+
]);
|
|
60
|
+
was.mode = 'key';
|
|
61
|
+
was.current_key_buffer = '';
|
|
62
|
+
was.current_value_buffer = '';
|
|
63
|
+
add_buffer = false;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
if (add_buffer) {
|
|
67
|
+
if ('key' === was.mode) {
|
|
68
|
+
was.current_key_buffer += is;
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
was.current_value_buffer += is;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
if (index === array.length - 1) {
|
|
75
|
+
if ('' !== was.current_key_buffer) {
|
|
76
|
+
const coerced_value = shallow
|
|
77
|
+
? (/^".+"$/.test(was.current_value_buffer)
|
|
78
|
+
? was.current_value_buffer.substring(1, was.current_value_buffer.length - 1)
|
|
79
|
+
: was.current_value_buffer)
|
|
80
|
+
: string_to_native_type(was.current_value_buffer);
|
|
81
|
+
was.properties.push([
|
|
82
|
+
was.current_key_buffer,
|
|
83
|
+
false !== coerced_value
|
|
84
|
+
? coerced_value
|
|
85
|
+
: was.current_value_buffer,
|
|
86
|
+
]);
|
|
87
|
+
}
|
|
88
|
+
was.current_key_buffer = '';
|
|
89
|
+
was.current_value_buffer = '';
|
|
90
|
+
was.current_value_nesting = 0;
|
|
91
|
+
}
|
|
92
|
+
return was;
|
|
93
|
+
}, {
|
|
94
|
+
properties: [],
|
|
95
|
+
mode: 'key',
|
|
96
|
+
current_key_buffer: '',
|
|
97
|
+
current_value_buffer: '',
|
|
98
|
+
current_value_nesting: 0,
|
|
99
|
+
}).properties);
|
|
100
|
+
}
|
|
101
|
+
export function string_to_array(data, shallow = false) {
|
|
102
|
+
if (!/^\(.+\)$/.test(data)) {
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
return data
|
|
106
|
+
.substring(1, data.length - 1)
|
|
107
|
+
.split('')
|
|
108
|
+
.reduce((was, is, index, array) => {
|
|
109
|
+
let add_buffer = true;
|
|
110
|
+
let add_value = false;
|
|
111
|
+
if (',' === is && 0 === was.current_value_nesting) {
|
|
112
|
+
add_buffer = false;
|
|
113
|
+
add_value = true;
|
|
114
|
+
}
|
|
115
|
+
if ('(' === is) {
|
|
116
|
+
++was.current_value_nesting;
|
|
117
|
+
}
|
|
118
|
+
else if (')' === is) {
|
|
119
|
+
--was.current_value_nesting;
|
|
120
|
+
}
|
|
121
|
+
if (add_buffer) {
|
|
122
|
+
was.current_item_buffer += is;
|
|
123
|
+
}
|
|
124
|
+
if (add_value
|
|
125
|
+
|| (index === array.length - 1
|
|
126
|
+
&& '' !== was.current_item_buffer)) {
|
|
127
|
+
if (/^".+"$/.test(was.current_item_buffer)) {
|
|
128
|
+
was.values.push(was.current_item_buffer.substring(1, was.current_item_buffer.length - 1));
|
|
129
|
+
was.current_item_buffer = '';
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
const coerced_value = shallow
|
|
133
|
+
? was.current_item_buffer.trim()
|
|
134
|
+
: string_to_native_type(was.current_item_buffer);
|
|
135
|
+
was.values.push(false !== coerced_value
|
|
136
|
+
? coerced_value
|
|
137
|
+
: was.current_item_buffer.trim());
|
|
138
|
+
was.current_item_buffer = '';
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
if (index === array.length - 1) {
|
|
142
|
+
was.current_item_buffer = '';
|
|
143
|
+
was.current_value_nesting = 0;
|
|
144
|
+
}
|
|
145
|
+
return was;
|
|
146
|
+
}, {
|
|
147
|
+
values: [],
|
|
148
|
+
current_item_buffer: '',
|
|
149
|
+
current_value_nesting: 0,
|
|
150
|
+
}).values;
|
|
151
|
+
}
|
|
152
|
+
const already_configured = new WeakSet();
|
|
153
|
+
export function configure_ajv(ajv) {
|
|
154
|
+
if (already_configured.has(ajv)) {
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
already_configured.add(ajv);
|
|
158
|
+
UnrealEngineString.configure_ajv(ajv);
|
|
159
|
+
ajv.addKeyword({
|
|
160
|
+
keyword: 'string_starts_with',
|
|
161
|
+
type: 'string',
|
|
162
|
+
metaSchema: {
|
|
163
|
+
type: 'string',
|
|
164
|
+
minLength: 1,
|
|
165
|
+
},
|
|
166
|
+
compile: (value) => {
|
|
167
|
+
return (data) => data.startsWith(value);
|
|
168
|
+
},
|
|
169
|
+
code: (ctx) => {
|
|
170
|
+
const schema = ctx?.schema;
|
|
171
|
+
if (!is_string(schema)) {
|
|
172
|
+
throw new Error(`ctx.schema was not a string, ${typeof schema} found!`);
|
|
173
|
+
}
|
|
174
|
+
const { data } = ctx;
|
|
175
|
+
ctx.pass(_ `${data}.startsWith(${schema})`);
|
|
176
|
+
},
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
//# sourceMappingURL=DocsValidation.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export class NoMatchError extends Error {
|
|
2
|
+
property;
|
|
3
|
+
constructor(property, message = 'No match found!') {
|
|
4
|
+
super(message);
|
|
5
|
+
this.property = property;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
export class FragileTypeSafetyError extends NoMatchError {
|
|
9
|
+
constructor(property) {
|
|
10
|
+
super(property, 'type safety in here is a bit fragile, check earlier in the stack');
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=Exceptions.js.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Node } from 'typescript';
|
|
2
|
+
export type entry = {
|
|
3
|
+
file: string;
|
|
4
|
+
node: Node;
|
|
5
|
+
};
|
|
6
|
+
export declare abstract class FilesGenerator {
|
|
7
|
+
abstract generate_files(): AsyncGenerator<entry>;
|
|
8
|
+
static merge_files(generators: FilesGenerator[], onto?: {
|
|
9
|
+
[key: string]: Node[];
|
|
10
|
+
} | undefined): Promise<{
|
|
11
|
+
[key: string]: Node[];
|
|
12
|
+
}>;
|
|
13
|
+
}
|
|
14
|
+
export declare class FromArray extends FilesGenerator {
|
|
15
|
+
private readonly entries;
|
|
16
|
+
constructor(entries: [entry, ...entry[]]);
|
|
17
|
+
generate_files(): AsyncGenerator<entry, void, undefined>;
|
|
18
|
+
}
|
|
19
|
+
export declare function guess_filename(ref: string): string;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export class FilesGenerator {
|
|
2
|
+
static async merge_files(generators, onto = undefined) {
|
|
3
|
+
onto = onto || {};
|
|
4
|
+
for (const generator of generators) {
|
|
5
|
+
for await (const entry of generator.generate_files()) {
|
|
6
|
+
if (!(entry.file in onto)) {
|
|
7
|
+
onto[entry.file] = [];
|
|
8
|
+
}
|
|
9
|
+
onto[entry.file].push(entry.node);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
return onto;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export class FromArray extends FilesGenerator {
|
|
16
|
+
entries;
|
|
17
|
+
constructor(entries) {
|
|
18
|
+
super();
|
|
19
|
+
this.entries = entries;
|
|
20
|
+
}
|
|
21
|
+
async *generate_files() {
|
|
22
|
+
await Promise.resolve(); // lazier than figuring out the correct syntax
|
|
23
|
+
if (this.entries.length > 0) {
|
|
24
|
+
yield* this.entries; // phpstorm doesn't track this as a query 🤷♂️
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
export function guess_filename(ref) {
|
|
29
|
+
if (/^FG[A-Za-z]+([-_]{2,}[A-Za-z-_]+)?$/.test(ref)) {
|
|
30
|
+
return `classes/CoreUObject/${ref.split(/[-_]{2,}/)[0]}.ts`;
|
|
31
|
+
}
|
|
32
|
+
else if (ref.startsWith('NativeClass--')
|
|
33
|
+
|| ref.startsWith('EditorCurveData--')) {
|
|
34
|
+
return 'classes/base.ts';
|
|
35
|
+
}
|
|
36
|
+
return 'common/unassigned.ts';
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=FilesGenerator.js.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type progress_group = {
|
|
2
|
+
members: string[];
|
|
3
|
+
subgroups: {
|
|
4
|
+
[key: string]: progress_group;
|
|
5
|
+
};
|
|
6
|
+
};
|
|
7
|
+
export declare function remap(group: progress_group): void;
|
|
8
|
+
export declare function reduce(group: progress_group, title?: string, current_depth?: number): {
|
|
9
|
+
title: string;
|
|
10
|
+
members: string[];
|
|
11
|
+
depth: number;
|
|
12
|
+
}[];
|
|
13
|
+
export declare function remove_indentation(input: string): string;
|
|
14
|
+
export interface GeneratesMarkdown {
|
|
15
|
+
generate_markdown(): Promise<string>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
export function remap(group) {
|
|
2
|
+
const subgroups = Object.keys(group.subgroups);
|
|
3
|
+
const retain = [];
|
|
4
|
+
const remap_items = {};
|
|
5
|
+
for (const item of group.members) {
|
|
6
|
+
let retain_item = true;
|
|
7
|
+
for (const subgroup of subgroups) {
|
|
8
|
+
if (item.startsWith(subgroup)) {
|
|
9
|
+
if (!(subgroup in remap_items)) {
|
|
10
|
+
remap_items[subgroup] = [];
|
|
11
|
+
}
|
|
12
|
+
remap_items[subgroup].push(item);
|
|
13
|
+
retain_item = false;
|
|
14
|
+
break;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
if (retain_item) {
|
|
18
|
+
retain.push(item);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
group.members = retain;
|
|
22
|
+
for (const entry of Object.entries(remap_items)) {
|
|
23
|
+
const [subgroup, items] = entry;
|
|
24
|
+
group.subgroups[subgroup].members = [
|
|
25
|
+
...items,
|
|
26
|
+
...group.subgroups[subgroup].members,
|
|
27
|
+
];
|
|
28
|
+
}
|
|
29
|
+
for (const subgroup of Object.values(group.subgroups)) {
|
|
30
|
+
remap(subgroup);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
export function reduce(group, title = 'Basic Types', current_depth = 1) {
|
|
34
|
+
const head = [];
|
|
35
|
+
if (group.members.length > 0) {
|
|
36
|
+
head.push({
|
|
37
|
+
title,
|
|
38
|
+
depth: 1 === current_depth ? 2 : current_depth,
|
|
39
|
+
members: group.members,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
return [
|
|
43
|
+
...head,
|
|
44
|
+
...Object.entries(group.subgroups)
|
|
45
|
+
.map((subgroup) => {
|
|
46
|
+
return reduce(subgroup[1], subgroup[0], current_depth + 1);
|
|
47
|
+
})
|
|
48
|
+
.reduce((was, is) => {
|
|
49
|
+
was.push(...is);
|
|
50
|
+
return was;
|
|
51
|
+
}, [])
|
|
52
|
+
.sort((a, b) => {
|
|
53
|
+
return a.title.localeCompare(b.title);
|
|
54
|
+
}),
|
|
55
|
+
];
|
|
56
|
+
}
|
|
57
|
+
export function remove_indentation(input) {
|
|
58
|
+
const str = input.replace(/^\n+/, '').replace(/\n+\t*$/, '\n');
|
|
59
|
+
const matches = /^(\t+)/gm.exec(str);
|
|
60
|
+
if (matches) {
|
|
61
|
+
const min = matches.reduce((was, is) => Math.min(was, is.length), Infinity);
|
|
62
|
+
if (min > 0 && min !== Infinity) {
|
|
63
|
+
return str.replace(new RegExp(`^\t{${min}}`, 'gm'), '');
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return str;
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=MarkdownUtilities.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type StringStartsWith<Prefix extends string, Suffix extends string = string> = string & keyof {
|
|
2
|
+
[T in keyof {
|
|
3
|
+
[key: string]: unknown;
|
|
4
|
+
} as T extends string ? `${Prefix}${Suffix}` : never]: string;
|
|
5
|
+
};
|
|
6
|
+
export type local_ref<T extends string> = StringStartsWith<'#/$defs/', T>;
|
|
7
|
+
export declare function local_ref<T extends string = string>(ref_like_string: T): local_ref<T>;
|
|
8
|
+
export declare function is_string(maybe: unknown): maybe is string;
|
|
9
|
+
export declare function is_$ref(maybe: unknown): maybe is (typeof maybe extends string ? local_ref<typeof maybe> : never);
|
|
10
|
+
export declare function $ref_in_array(maybe_$ref: unknown, $ref_array: local_ref<string>[]): maybe_$ref is never;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { NoMatchError, } from './Exceptions';
|
|
2
|
+
export function local_ref(ref_like_string) {
|
|
3
|
+
if (/\s+/.test(ref_like_string)) {
|
|
4
|
+
throw new Error('No spacing characters allowed!');
|
|
5
|
+
}
|
|
6
|
+
if (ref_like_string.startsWith('#/$defs/')) {
|
|
7
|
+
throw new NoMatchError(ref_like_string, 'Already a local ref!');
|
|
8
|
+
}
|
|
9
|
+
return `#/$defs/${ref_like_string}`;
|
|
10
|
+
}
|
|
11
|
+
export function is_string(maybe) {
|
|
12
|
+
return 'string' === typeof maybe;
|
|
13
|
+
}
|
|
14
|
+
export function is_$ref(maybe) {
|
|
15
|
+
return is_string(maybe) && maybe.startsWith('#/$defs/');
|
|
16
|
+
}
|
|
17
|
+
export function $ref_in_array(maybe_$ref, $ref_array) {
|
|
18
|
+
return is_$ref(maybe_$ref) && $ref_array.includes(maybe_$ref);
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=StringStartsWith.js.map
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import ts, { ClassDeclaration, Expression, KeywordTypeSyntaxKind, LiteralTypeNode, MethodDeclaration, NodeArray, NullLiteral, ParenthesizedExpression, PrefixUnaryExpression, PropertyDeclaration, PropertySignature, RegularExpressionLiteral, StringLiteral, SyntaxKind, TemplateExpression, TypeLiteralNode, TypeNode, TypeParameterDeclaration, TypeReferenceNode, UnionTypeNode, VariableDeclaration, VariableDeclarationList, VariableStatement } from 'typescript';
|
|
2
|
+
declare type supported_class_modifiers = ('export' | 'abstract')[];
|
|
3
|
+
declare type supported_modifier = 'abstract' | 'protected' | 'public' | 'static';
|
|
4
|
+
declare type supported_method_modifiers = [
|
|
5
|
+
supported_modifier,
|
|
6
|
+
...supported_modifier[]
|
|
7
|
+
];
|
|
8
|
+
export declare function adjust_class_name(class_name: string): string;
|
|
9
|
+
export declare const modifier_map: {
|
|
10
|
+
[key: string]: () => ts.ModifierToken<ts.ModifierSyntaxKind>;
|
|
11
|
+
};
|
|
12
|
+
type modifier = Exclude<keyof typeof modifier_map, number>;
|
|
13
|
+
export declare function create_modifiers(first: modifier, ...rest: modifier[]): [ts.ModifierToken<ts.ModifierSyntaxKind>, ...ts.ModifierToken<ts.ModifierSyntaxKind>[]];
|
|
14
|
+
export declare function type_reference_node(name: string, ...type_arguments: TypeNode[]): TypeReferenceNode;
|
|
15
|
+
export type create_class_options = {
|
|
16
|
+
modifiers?: supported_class_modifiers;
|
|
17
|
+
extends?: string;
|
|
18
|
+
};
|
|
19
|
+
export declare function createClass(name: string, members: (PropertyDeclaration | MethodDeclaration)[], options?: create_class_options, type_parameters?: [TypeParameterDeclaration, ...TypeParameterDeclaration[]] | undefined): ClassDeclaration;
|
|
20
|
+
export declare function createParameter(name: string | ts.ObjectBindingPattern, type: KeywordTypeSyntaxKind | TypeNode, initializer?: ts.Expression | undefined): ts.ParameterDeclaration;
|
|
21
|
+
declare type createMethod_parameters_entry = [string, KeywordTypeSyntaxKind | ts.TypeNode] | ts.ParameterDeclaration;
|
|
22
|
+
export declare function create_method_with_type_parameters(name: string, type_parameters: [
|
|
23
|
+
ts.TypeParameterDeclaration,
|
|
24
|
+
...ts.TypeParameterDeclaration[]
|
|
25
|
+
], parameters: createMethod_parameters_entry[], body: ts.Statement[], modifiers: supported_method_modifiers, return_type?: ts.TypeNode | undefined): ts.MethodDeclaration;
|
|
26
|
+
export declare function create_method_without_type_parameters(name: string, modifiers: supported_method_modifiers, parameters: createMethod_parameters_entry[], body: ts.Statement[], return_type?: ts.TypeNode | undefined): ts.MethodDeclaration;
|
|
27
|
+
export declare function create_throw(throw_this: string, throw_arguments: [ts.Expression, ...ts.Expression[]], type_parameters?: [ts.TypeNode, ...ts.TypeNode[]] | undefined): ts.ThrowStatement;
|
|
28
|
+
export declare function create_throw_if(throw_this: string, throw_if: ts.Expression, throw_arguments: [ts.Expression, ...ts.Expression[]], type_parameters?: [ts.TypeNode, ...ts.TypeNode[]] | undefined): ts.IfStatement;
|
|
29
|
+
export declare function template_expression_from_string(template: string): TemplateExpression;
|
|
30
|
+
export declare function parenthesize(expression: Expression): ParenthesizedExpression;
|
|
31
|
+
export declare function create_property_access(on: Expression, property: string): ts.PropertyAccessExpression;
|
|
32
|
+
declare const type_map: {
|
|
33
|
+
boolean: ts.SyntaxKind;
|
|
34
|
+
number: ts.SyntaxKind;
|
|
35
|
+
object: ts.SyntaxKind;
|
|
36
|
+
string: ts.SyntaxKind;
|
|
37
|
+
undefined: ts.SyntaxKind;
|
|
38
|
+
never: ts.SyntaxKind;
|
|
39
|
+
unknown: ts.SyntaxKind;
|
|
40
|
+
};
|
|
41
|
+
export declare function create_type(type: keyof typeof type_map): ts.KeywordTypeNode;
|
|
42
|
+
export declare function create_object_type_from_entries(entries: [string, TypeNode][], required?: [string, ...string[]]): TypeLiteralNode;
|
|
43
|
+
export declare function createPropertySignature(property: string, type: TypeNode, required?: boolean): PropertySignature;
|
|
44
|
+
export declare function needs_element_access(property: string): boolean;
|
|
45
|
+
export declare function computed_property_name_or_undefined(property: string): ts.ComputedPropertyName | undefined;
|
|
46
|
+
export declare function property_name_or_computed<T extends string = string>(property: T): T | ts.ComputedPropertyName;
|
|
47
|
+
export declare function minimum_size_array_of_single_type(repeat: number, generate: () => ts.TypeNode, max?: number | undefined): ts.TupleTypeNode;
|
|
48
|
+
export declare function create_this_assignment(property: string, identifier: string | ts.Expression): ts.ExpressionStatement;
|
|
49
|
+
export declare function create_index_access(identifier: string, index: number): ts.ElementAccessExpression;
|
|
50
|
+
export declare function create_literal<T1 extends string | RegExp | null = string | RegExp | null, T2 = T1 extends null ? ts.LiteralTypeNode & {
|
|
51
|
+
literal: NullLiteral;
|
|
52
|
+
} : (T1 extends RegExp ? RegularExpressionLiteral : (ts.LiteralTypeNode & {
|
|
53
|
+
literal: StringLiteral;
|
|
54
|
+
}))>(value: T1): T2;
|
|
55
|
+
export declare function create_union(a: ts.TypeNode, b: ts.TypeNode, ...rest: ts.TypeNode[]): ts.UnionTypeNode;
|
|
56
|
+
declare type lazy_union_item = string | {
|
|
57
|
+
$ref: string;
|
|
58
|
+
} | ({
|
|
59
|
+
type: string;
|
|
60
|
+
} & ({
|
|
61
|
+
pattern: string;
|
|
62
|
+
} | {
|
|
63
|
+
const: string;
|
|
64
|
+
}));
|
|
65
|
+
export declare function create_lazy_union(a: lazy_union_item, b: lazy_union_item, ...rest: lazy_union_item[]): ts.UnionTypeNode;
|
|
66
|
+
export declare function possibly_create_lazy_union(items: lazy_union_item[]): ts.TypeNode;
|
|
67
|
+
type string_literal = LiteralTypeNode & {
|
|
68
|
+
literal: StringLiteral;
|
|
69
|
+
};
|
|
70
|
+
export type non_empty_string_literal_union = UnionTypeNode & {
|
|
71
|
+
types: NodeArray<string_literal> & [string_literal, ...string_literal[]];
|
|
72
|
+
};
|
|
73
|
+
export declare function create_typed_union(items: [string, ...string[]]): non_empty_string_literal_union;
|
|
74
|
+
export declare function create_const_declaration_list(first: VariableDeclaration, ...rest: VariableDeclaration[]): VariableDeclarationList;
|
|
75
|
+
export declare function create_const_statement(first: VariableDeclaration, ...rest: VariableDeclaration[]): VariableStatement;
|
|
76
|
+
export declare function variable(name: string, value: Expression, type?: TypeNode | undefined): VariableDeclaration;
|
|
77
|
+
export declare function not(expression: Expression): PrefixUnaryExpression & {
|
|
78
|
+
operator: SyntaxKind.ExclamationToken;
|
|
79
|
+
};
|
|
80
|
+
export {};
|