swagger-typescript-api 13.1.0 → 13.1.2
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/CHANGELOG.md +14 -0
- package/dist/chunk-Cl8Af3a2.js +11 -0
- package/dist/cli.cjs +326 -1
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.d.cts +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +325 -1
- package/dist/cli.js.map +1 -1
- package/dist/lib.cjs +10 -2
- package/dist/lib.d.cts +1638 -3
- package/dist/lib.d.cts.map +1 -0
- package/dist/lib.d.ts +1637 -3
- package/dist/lib.d.ts.map +1 -0
- package/dist/lib.js +3 -2
- package/dist/src-D3nQpZ1i.cjs +3133 -0
- package/dist/src-D3nQpZ1i.cjs.map +1 -0
- package/dist/src-gaIHrOQ9.js +3066 -0
- package/dist/src-gaIHrOQ9.js.map +1 -0
- package/package.json +10 -11
- package/dist/_tsup-dts-rollup.d.cts +0 -1963
- package/dist/_tsup-dts-rollup.d.ts +0 -1963
- package/dist/chunk-NO753Z7P.cjs +0 -42
- package/dist/chunk-NO753Z7P.cjs.map +0 -1
- package/dist/chunk-TVX6OCDM.js +0 -42
- package/dist/chunk-TVX6OCDM.js.map +0 -1
- package/dist/lib.cjs.map +0 -1
- package/dist/lib.js.map +0 -1
|
@@ -1,1963 +0,0 @@
|
|
|
1
|
-
import { CodeGenConfig as CodeGenConfig_2 } from './configuration.js';
|
|
2
|
-
import { CodeGenProcess as CodeGenProcess_2 } from '../src/code-gen-process.js';
|
|
3
|
-
import { EtaConfig } from 'eta';
|
|
4
|
-
import { GenerateTemplatesOutput as GenerateTemplatesOutput_2 } from '../../../types/index.js';
|
|
5
|
-
import { internalCase as internalCase_2 } from './util/internal-case.js';
|
|
6
|
-
import lodash from 'lodash';
|
|
7
|
-
import { LoDashStatic } from 'lodash';
|
|
8
|
-
import { NameResolver as NameResolver_2 } from './util/name-resolver.js';
|
|
9
|
-
import type { OpenAPI } from 'openapi-types';
|
|
10
|
-
import { Options } from 'tsup';
|
|
11
|
-
import { ParsedRoute as ParsedRoute_2 } from '../types/index.js';
|
|
12
|
-
import { ParsedSchema as ParsedSchema_2 } from '../types/index.js';
|
|
13
|
-
import { ParsedSchema as ParsedSchema_3 } from '../../../types/index.js';
|
|
14
|
-
import { pascalCase as pascalCase_2 } from './util/pascal-case.js';
|
|
15
|
-
import { RouteNameInfo as RouteNameInfo_2 } from '../../types/index.js';
|
|
16
|
-
import { SchemaComponent as SchemaComponent_2 } from '../../types/index.js';
|
|
17
|
-
import { SchemaComponent as SchemaComponent_3 } from '../types/index.js';
|
|
18
|
-
import { SchemaComponent as SchemaComponent_4 } from '../../../types/index.js';
|
|
19
|
-
import { SchemaParser as SchemaParser_2 } from '../src/schema-parser/schema-parser.js';
|
|
20
|
-
import { SchemaTypeEnumContent as SchemaTypeEnumContent_2 } from '../types/index.js';
|
|
21
|
-
import { SchemaTypeEnumContent as SchemaTypeEnumContent_3 } from '../../../types/index.js';
|
|
22
|
-
import { SchemaTypeObjectContent as SchemaTypeObjectContent_2 } from '../types/index.js';
|
|
23
|
-
import { SchemaTypeObjectContent as SchemaTypeObjectContent_3 } from '../../../types/index.js';
|
|
24
|
-
import { SchemaTypePrimitiveContent as SchemaTypePrimitiveContent_2 } from '../types/index.js';
|
|
25
|
-
import { SchemaTypePrimitiveContent as SchemaTypePrimitiveContent_3 } from '../../../types/index.js';
|
|
26
|
-
import { Spec } from 'swagger-schema-official';
|
|
27
|
-
import { Translator as Translator_2 } from './translators/translator.js';
|
|
28
|
-
import { TranslatorIO as TranslatorIO_2 } from './translators/translator.js';
|
|
29
|
-
import * as typescript from 'typescript';
|
|
30
|
-
import { UserConfig } from 'vite';
|
|
31
|
-
|
|
32
|
-
export declare class AllOfSchemaParser extends MonoSchemaParser {
|
|
33
|
-
parse(): any;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export declare class AnyOfSchemaParser extends MonoSchemaParser {
|
|
37
|
-
parse(): any;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export declare class ArraySchemaParser extends MonoSchemaParser {
|
|
41
|
-
parse(): any;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
declare type BuildRouteParam = {
|
|
45
|
-
/** {bar} */
|
|
46
|
-
$match: string;
|
|
47
|
-
name: string;
|
|
48
|
-
required: boolean;
|
|
49
|
-
type: "string";
|
|
50
|
-
description: string;
|
|
51
|
-
schema: {
|
|
52
|
-
type: string;
|
|
53
|
-
};
|
|
54
|
-
in: "path" | "query";
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
declare type BuildRoutePath = {
|
|
58
|
-
/** /foo/{bar}/baz */
|
|
59
|
-
originalRoute: string;
|
|
60
|
-
/** /foo/${bar}/baz */
|
|
61
|
-
route: string;
|
|
62
|
-
pathParams: BuildRouteParam[];
|
|
63
|
-
queryParams: BuildRouteParam[];
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
export declare class CodeFormatter {
|
|
67
|
-
config: CodeGenConfig;
|
|
68
|
-
constructor(config: CodeGenConfig);
|
|
69
|
-
removeUnusedImports: (content: string) => string;
|
|
70
|
-
format: (content: string) => Promise<string>;
|
|
71
|
-
formatCode: (code: string, { removeUnusedImports, format }?: {
|
|
72
|
-
removeUnusedImports?: boolean | undefined;
|
|
73
|
-
format?: boolean | undefined;
|
|
74
|
-
}) => Promise<string>;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
export declare class CodeGenConfig {
|
|
78
|
-
version: string;
|
|
79
|
-
/** CLI flag */
|
|
80
|
-
templates: string;
|
|
81
|
-
/** CLI flag */
|
|
82
|
-
generateResponses: boolean;
|
|
83
|
-
/** CLI flag */
|
|
84
|
-
defaultResponseAsSuccess: boolean;
|
|
85
|
-
/** CLI flag */
|
|
86
|
-
generateRouteTypes: boolean;
|
|
87
|
-
/** CLI flag */
|
|
88
|
-
generateClient: boolean;
|
|
89
|
-
/** CLI flag */
|
|
90
|
-
generateUnionEnums: boolean;
|
|
91
|
-
/** CLI flag */
|
|
92
|
-
addReadonly: boolean;
|
|
93
|
-
enumNamesAsValues: boolean;
|
|
94
|
-
/** parsed swagger schema from getSwaggerObject() */
|
|
95
|
-
/** parsed swagger schema ref */
|
|
96
|
-
swaggerSchema: null;
|
|
97
|
-
/** original (converted to json) swagger schema ref */
|
|
98
|
-
originalSchema: null;
|
|
99
|
-
/** { "#/components/schemas/Foo": @TypeInfo, ... } */
|
|
100
|
-
componentsMap: {};
|
|
101
|
-
/** flag for catching conversion from swagger 2.0 */
|
|
102
|
-
convertedFromSwagger2: boolean;
|
|
103
|
-
/** url index from paths used for merging into modules */
|
|
104
|
-
moduleNameIndex: number;
|
|
105
|
-
/** use the first tag for the module name */
|
|
106
|
-
moduleNameFirstTag: boolean;
|
|
107
|
-
extractRequestParams: boolean;
|
|
108
|
-
extractRequestBody: boolean;
|
|
109
|
-
extractResponseBody: boolean;
|
|
110
|
-
extractResponseError: boolean;
|
|
111
|
-
extractResponses: boolean;
|
|
112
|
-
extractEnums: boolean;
|
|
113
|
-
fileNames: {
|
|
114
|
-
dataContracts: string;
|
|
115
|
-
routeTypes: string;
|
|
116
|
-
httpClient: string;
|
|
117
|
-
outOfModuleApi: string;
|
|
118
|
-
};
|
|
119
|
-
routeNameDuplicatesMap: Map<any, any>;
|
|
120
|
-
hooks: Hooks;
|
|
121
|
-
defaultResponseType: string;
|
|
122
|
-
singleHttpClient: boolean;
|
|
123
|
-
httpClientType: "fetch";
|
|
124
|
-
unwrapResponseData: boolean;
|
|
125
|
-
disableThrowOnError: boolean;
|
|
126
|
-
sortTypes: boolean;
|
|
127
|
-
sortRoutes: boolean;
|
|
128
|
-
templatePaths: {
|
|
129
|
-
/** `templates/base` */
|
|
130
|
-
base: string;
|
|
131
|
-
/** `templates/default` */
|
|
132
|
-
default: string;
|
|
133
|
-
/** `templates/modular` */
|
|
134
|
-
modular: string;
|
|
135
|
-
/** usage path if `--templates` option is not set */
|
|
136
|
-
original: string;
|
|
137
|
-
/** custom path to templates (`--templates`) */
|
|
138
|
-
custom: string;
|
|
139
|
-
};
|
|
140
|
-
/** Record<templateName, templateContent> */
|
|
141
|
-
templatesToRender: {
|
|
142
|
-
api: string;
|
|
143
|
-
dataContracts: string;
|
|
144
|
-
dataContractJsDoc: string;
|
|
145
|
-
interfaceDataContract: string;
|
|
146
|
-
typeDataContract: string;
|
|
147
|
-
enumDataContract: string;
|
|
148
|
-
objectFieldJsDoc: string;
|
|
149
|
-
httpClient: string;
|
|
150
|
-
routeTypes: string;
|
|
151
|
-
routeName: string;
|
|
152
|
-
};
|
|
153
|
-
schemaParsers: Record<string, (...args: unknown[]) => MonoSchemaParser>;
|
|
154
|
-
toJS: boolean;
|
|
155
|
-
silent: boolean;
|
|
156
|
-
typePrefix: string;
|
|
157
|
-
typeSuffix: string;
|
|
158
|
-
enumKeyPrefix: string;
|
|
159
|
-
enumKeySuffix: string;
|
|
160
|
-
patch: boolean;
|
|
161
|
-
componentTypeNameResolver: ComponentTypeNameResolver;
|
|
162
|
-
/** name of the main exported class */
|
|
163
|
-
apiClassName: string;
|
|
164
|
-
debug: boolean;
|
|
165
|
-
anotherArrayType: boolean;
|
|
166
|
-
internalTemplateOptions: {
|
|
167
|
-
addUtilRequiredKeysType: boolean;
|
|
168
|
-
};
|
|
169
|
-
extraTemplates: never[];
|
|
170
|
-
input: string;
|
|
171
|
-
modular: boolean;
|
|
172
|
-
output: string;
|
|
173
|
-
url: string;
|
|
174
|
-
cleanOutput: boolean;
|
|
175
|
-
spec: OpenAPI.Document | null;
|
|
176
|
-
fileName: string;
|
|
177
|
-
authorizationToken: string | undefined;
|
|
178
|
-
requestOptions: null;
|
|
179
|
-
jsPrimitiveTypes: string[];
|
|
180
|
-
jsEmptyTypes: string[];
|
|
181
|
-
fixInvalidTypeNamePrefix: string;
|
|
182
|
-
fixInvalidEnumKeyPrefix: string;
|
|
183
|
-
enumKeyResolverName: string;
|
|
184
|
-
typeNameResolverName: string;
|
|
185
|
-
specificArgNameResolverName: string;
|
|
186
|
-
successResponseStatusRange: number[];
|
|
187
|
-
extractingOptions: Partial<ExtractingOptions>;
|
|
188
|
-
compilerTsConfig: {
|
|
189
|
-
module: typescript.ModuleKind;
|
|
190
|
-
noImplicitReturns: boolean;
|
|
191
|
-
alwaysStrict: boolean;
|
|
192
|
-
target: typescript.ScriptTarget;
|
|
193
|
-
declaration: boolean;
|
|
194
|
-
noImplicitAny: boolean;
|
|
195
|
-
sourceMap: boolean;
|
|
196
|
-
removeComments: boolean;
|
|
197
|
-
disableSizeLimit: boolean;
|
|
198
|
-
esModuleInterop: boolean;
|
|
199
|
-
emitDecoratorMetadata: boolean;
|
|
200
|
-
skipLibCheck: boolean;
|
|
201
|
-
};
|
|
202
|
-
customTranslator?: new () => Translator;
|
|
203
|
-
Ts: {
|
|
204
|
-
Keyword: {
|
|
205
|
-
Number: string;
|
|
206
|
-
String: string;
|
|
207
|
-
Boolean: string;
|
|
208
|
-
Any: string;
|
|
209
|
-
Void: string;
|
|
210
|
-
Unknown: string;
|
|
211
|
-
Null: string;
|
|
212
|
-
Undefined: string;
|
|
213
|
-
Object: string;
|
|
214
|
-
File: string;
|
|
215
|
-
Date: string;
|
|
216
|
-
Type: string;
|
|
217
|
-
Enum: string;
|
|
218
|
-
Interface: string;
|
|
219
|
-
Array: string;
|
|
220
|
-
Record: string;
|
|
221
|
-
Intersection: string;
|
|
222
|
-
Union: string;
|
|
223
|
-
};
|
|
224
|
-
CodeGenKeyword: {
|
|
225
|
-
UtilRequiredKeys: string;
|
|
226
|
-
};
|
|
227
|
-
/**
|
|
228
|
-
* $A[] or Array<$A>
|
|
229
|
-
*/
|
|
230
|
-
ArrayType: (content: unknown) => string;
|
|
231
|
-
/**
|
|
232
|
-
* "$A"
|
|
233
|
-
*/
|
|
234
|
-
StringValue: (content: unknown) => string;
|
|
235
|
-
/**
|
|
236
|
-
* $A
|
|
237
|
-
*/
|
|
238
|
-
BooleanValue: (content: unknown) => string;
|
|
239
|
-
/**
|
|
240
|
-
* $A
|
|
241
|
-
*/
|
|
242
|
-
NumberValue: (content: unknown) => string;
|
|
243
|
-
/**
|
|
244
|
-
* $A
|
|
245
|
-
*/
|
|
246
|
-
NullValue: () => string;
|
|
247
|
-
/**
|
|
248
|
-
* $A1 | $A2
|
|
249
|
-
*/
|
|
250
|
-
UnionType: (contents: unknown[]) => string;
|
|
251
|
-
/**
|
|
252
|
-
* ($A1)
|
|
253
|
-
*/
|
|
254
|
-
ExpressionGroup: (content: unknown) => string;
|
|
255
|
-
/**
|
|
256
|
-
* $A1 & $A2
|
|
257
|
-
*/
|
|
258
|
-
IntersectionType: (contents: unknown[]) => string;
|
|
259
|
-
/**
|
|
260
|
-
* Record<$A1, $A2>
|
|
261
|
-
*/
|
|
262
|
-
RecordType: (key: unknown, value: unknown) => string;
|
|
263
|
-
/**
|
|
264
|
-
* readonly $key?:$value
|
|
265
|
-
*/
|
|
266
|
-
TypeField: ({ readonly, key, optional, value }: Record<string, unknown>) => string;
|
|
267
|
-
/**
|
|
268
|
-
* [key: $A1]: $A2
|
|
269
|
-
*/
|
|
270
|
-
InterfaceDynamicField: (key: unknown, value: unknown) => string;
|
|
271
|
-
/**
|
|
272
|
-
* EnumName.EnumKey
|
|
273
|
-
*/
|
|
274
|
-
EnumUsageKey: (enumStruct: unknown, key: unknown) => string;
|
|
275
|
-
/**
|
|
276
|
-
* $A1 = $A2
|
|
277
|
-
*/
|
|
278
|
-
EnumField: (key: unknown, value: unknown) => string;
|
|
279
|
-
/**
|
|
280
|
-
* $A0.key = $A0.value,
|
|
281
|
-
* $A1.key = $A1.value,
|
|
282
|
-
* $AN.key = $AN.value,
|
|
283
|
-
*/
|
|
284
|
-
EnumFieldsWrapper: (contents: Record<string, unknown>[]) => string;
|
|
285
|
-
/**
|
|
286
|
-
* {\n $A \n}
|
|
287
|
-
*/
|
|
288
|
-
ObjectWrapper: (content: unknown) => string;
|
|
289
|
-
/**
|
|
290
|
-
* /** $A *\/
|
|
291
|
-
*/
|
|
292
|
-
MultilineComment: (contents: unknown[], formatFn: (arg: unknown) => unknown) => string[];
|
|
293
|
-
/**
|
|
294
|
-
* $A1<...$A2.join(,)>
|
|
295
|
-
*/
|
|
296
|
-
TypeWithGeneric: (typeName: unknown, genericArgs: unknown[]) => string;
|
|
297
|
-
/**
|
|
298
|
-
* [$A1, $A2, ...$AN]
|
|
299
|
-
*/
|
|
300
|
-
Tuple: (values: unknown[]) => string;
|
|
301
|
-
};
|
|
302
|
-
/**
|
|
303
|
-
* swagger schema type -> typescript type
|
|
304
|
-
* https://json-schema.org/understanding-json-schema/reference/string.html#dates-and-times
|
|
305
|
-
*/
|
|
306
|
-
primitiveTypes: Record<string, string | ((schema: OpenAPI.Document, parser: SchemaParser) => string) | ({
|
|
307
|
-
$default: string;
|
|
308
|
-
} & Record<string, string | ((schema: OpenAPI.Document, parser: SchemaParser) => string)>)>;
|
|
309
|
-
templateInfos: {
|
|
310
|
-
name: string;
|
|
311
|
-
fileName: string;
|
|
312
|
-
}[];
|
|
313
|
-
templateExtensions: string[];
|
|
314
|
-
constructor({ codeGenConstructs, primitiveTypeConstructs, constants, templateInfos, hooks, ...otherConfig }: Partial<GenerateApiConfiguration["config"]>);
|
|
315
|
-
update: (update: Partial<GenerateApiConfiguration["config"]>) => void;
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
declare type CodeGenConstruct = {
|
|
319
|
-
Keyword: {
|
|
320
|
-
Number: string;
|
|
321
|
-
String: string;
|
|
322
|
-
Boolean: string;
|
|
323
|
-
Any: string;
|
|
324
|
-
Void: string;
|
|
325
|
-
Unknown: string;
|
|
326
|
-
Null: string;
|
|
327
|
-
Undefined: string;
|
|
328
|
-
Object: string;
|
|
329
|
-
File: string;
|
|
330
|
-
Date: string;
|
|
331
|
-
Type: string;
|
|
332
|
-
Enum: string;
|
|
333
|
-
Interface: string;
|
|
334
|
-
Array: string;
|
|
335
|
-
Record: string;
|
|
336
|
-
Intersection: string;
|
|
337
|
-
Union: string;
|
|
338
|
-
};
|
|
339
|
-
CodeGenKeyword: {
|
|
340
|
-
UtilRequiredKeys: string;
|
|
341
|
-
};
|
|
342
|
-
ArrayType: (content: unknown) => string;
|
|
343
|
-
StringValue: (content: unknown) => string;
|
|
344
|
-
BooleanValue: (content: unknown) => string;
|
|
345
|
-
NumberValue: (content: unknown) => string;
|
|
346
|
-
NullValue: (content: unknown) => string;
|
|
347
|
-
UnionType: (content: unknown) => string;
|
|
348
|
-
ExpressionGroup: (content: unknown) => string;
|
|
349
|
-
IntersectionType: (content: unknown) => string;
|
|
350
|
-
RecordType: (content: unknown) => string;
|
|
351
|
-
TypeField: (content: unknown) => string;
|
|
352
|
-
InterfaceDynamicField: (content: unknown) => string;
|
|
353
|
-
EnumField: (content: unknown) => string;
|
|
354
|
-
EnumFieldsWrapper: (content: unknown) => string;
|
|
355
|
-
ObjectWrapper: (content: unknown) => string;
|
|
356
|
-
MultilineComment: (content: unknown) => string;
|
|
357
|
-
TypeWithGeneric: (content: unknown) => string;
|
|
358
|
-
};
|
|
359
|
-
|
|
360
|
-
export declare class CodeGenProcess {
|
|
361
|
-
config: CodeGenConfig;
|
|
362
|
-
swaggerSchemaResolver: SwaggerSchemaResolver;
|
|
363
|
-
schemaComponentsMap: SchemaComponentsMap;
|
|
364
|
-
typeNameFormatter: TypeNameFormatter;
|
|
365
|
-
schemaParserFabric: SchemaParserFabric;
|
|
366
|
-
schemaRoutes: SchemaRoutes;
|
|
367
|
-
fileSystem: FileSystem;
|
|
368
|
-
codeFormatter: CodeFormatter;
|
|
369
|
-
templatesWorker: TemplatesWorker;
|
|
370
|
-
schemaWalker: SchemaWalker;
|
|
371
|
-
javascriptTranslator: JavascriptTranslator;
|
|
372
|
-
constructor(config: Partial<GenerateApiConfiguration["config"]>);
|
|
373
|
-
start(): Promise<{
|
|
374
|
-
files: TranslatorIO[];
|
|
375
|
-
configuration: GenerateApiConfiguration | {
|
|
376
|
-
apiConfig: {
|
|
377
|
-
info: any;
|
|
378
|
-
servers: any;
|
|
379
|
-
basePath: any;
|
|
380
|
-
host: any;
|
|
381
|
-
externalDocs: any;
|
|
382
|
-
tags: unknown[];
|
|
383
|
-
baseUrl: any;
|
|
384
|
-
title: any;
|
|
385
|
-
version: any;
|
|
386
|
-
};
|
|
387
|
-
config: CodeGenConfig;
|
|
388
|
-
modelTypes: any[];
|
|
389
|
-
hasSecurityRoutes: boolean;
|
|
390
|
-
hasQueryRoutes: boolean;
|
|
391
|
-
hasFormDataRoutes: boolean;
|
|
392
|
-
generateResponses: boolean;
|
|
393
|
-
routes: {
|
|
394
|
-
outOfModule: ParsedRoute_2[];
|
|
395
|
-
combined?: {
|
|
396
|
-
moduleName: string;
|
|
397
|
-
routes: ParsedRoute_2[];
|
|
398
|
-
}[];
|
|
399
|
-
};
|
|
400
|
-
extraTemplates: never[];
|
|
401
|
-
fileName: string;
|
|
402
|
-
translateToJavaScript: boolean;
|
|
403
|
-
customTranslator: Translator_2 | null;
|
|
404
|
-
utils: {
|
|
405
|
-
Ts: {
|
|
406
|
-
Keyword: {
|
|
407
|
-
Number: string;
|
|
408
|
-
String: string;
|
|
409
|
-
Boolean: string;
|
|
410
|
-
Any: string;
|
|
411
|
-
Void: string;
|
|
412
|
-
Unknown: string;
|
|
413
|
-
Null: string;
|
|
414
|
-
Undefined: string;
|
|
415
|
-
Object: string;
|
|
416
|
-
File: string;
|
|
417
|
-
Date: string;
|
|
418
|
-
Type: string;
|
|
419
|
-
Enum: string;
|
|
420
|
-
Interface: string;
|
|
421
|
-
Array: string;
|
|
422
|
-
Record: string;
|
|
423
|
-
Intersection: string;
|
|
424
|
-
Union: string;
|
|
425
|
-
};
|
|
426
|
-
CodeGenKeyword: {
|
|
427
|
-
UtilRequiredKeys: string;
|
|
428
|
-
};
|
|
429
|
-
ArrayType: (content: unknown) => string;
|
|
430
|
-
StringValue: (content: unknown) => string;
|
|
431
|
-
BooleanValue: (content: unknown) => string;
|
|
432
|
-
NumberValue: (content: unknown) => string;
|
|
433
|
-
NullValue: () => string;
|
|
434
|
-
UnionType: (contents: unknown[]) => string;
|
|
435
|
-
ExpressionGroup: (content: unknown) => string;
|
|
436
|
-
IntersectionType: (contents: unknown[]) => string;
|
|
437
|
-
RecordType: (key: unknown, value: unknown) => string;
|
|
438
|
-
TypeField: ({ readonly, key, optional, value }: Record<string, unknown>) => string;
|
|
439
|
-
InterfaceDynamicField: (key: unknown, value: unknown) => string;
|
|
440
|
-
EnumUsageKey: (enumStruct: unknown, key: unknown) => string;
|
|
441
|
-
EnumField: (key: unknown, value: unknown) => string;
|
|
442
|
-
EnumFieldsWrapper: (contents: Record<string, unknown>[]) => string;
|
|
443
|
-
ObjectWrapper: (content: unknown) => string;
|
|
444
|
-
MultilineComment: (contents: unknown[], formatFn: (arg: unknown) => unknown) => string[];
|
|
445
|
-
TypeWithGeneric: (typeName: unknown, genericArgs: unknown[]) => string;
|
|
446
|
-
Tuple: (values: unknown[]) => string;
|
|
447
|
-
};
|
|
448
|
-
formatDescription: (description: any, inline: any) => any;
|
|
449
|
-
internalCase: typeof internalCase;
|
|
450
|
-
classNameCase: typeof pascalCase;
|
|
451
|
-
pascalCase: typeof pascalCase;
|
|
452
|
-
getInlineParseContent: (schema: string, typeName: string | null, schemaPath: string[]) => Record<string, any>;
|
|
453
|
-
getParseContent: (schema: string, typeName: string | null, schemaPath: string[]) => Record<string, any>;
|
|
454
|
-
getComponentByRef: ($ref: string) => SchemaComponent | null;
|
|
455
|
-
parseSchema: (schema: string, typeName?: string | null, schemaPath?: string[]) => ParsedSchema_2<SchemaTypeObjectContent_2 | SchemaTypeEnumContent_2 | SchemaTypePrimitiveContent_2>;
|
|
456
|
-
checkAndAddNull: (schema: any, type: any) => any;
|
|
457
|
-
safeAddNullToType: (schema: any, type: any) => any;
|
|
458
|
-
isNeedToAddNull: (schema: any, type: any) => any;
|
|
459
|
-
inlineExtraFormatters: {
|
|
460
|
-
enum: (parsedSchema: any) => any;
|
|
461
|
-
object: (parsedSchema: any) => any;
|
|
462
|
-
};
|
|
463
|
-
formatters: {
|
|
464
|
-
enum: (parsedSchema: any) => any;
|
|
465
|
-
object: (parsedSchema: any) => any;
|
|
466
|
-
primitive: (parsedSchema: any) => any;
|
|
467
|
-
};
|
|
468
|
-
formatModelName: (name: string, options?: {
|
|
469
|
-
type?: "enum-key" | "type-name";
|
|
470
|
-
}) => string | undefined;
|
|
471
|
-
fmtToJSDocLine: (line: string, { eol }: {
|
|
472
|
-
eol?: boolean | undefined;
|
|
473
|
-
}) => string;
|
|
474
|
-
NameResolver: typeof NameResolver;
|
|
475
|
-
_: lodash.LoDashStatic;
|
|
476
|
-
require: (packageOrPath: string) => Promise<any>;
|
|
477
|
-
};
|
|
478
|
-
};
|
|
479
|
-
getTemplate: (name: string, fileName: string, path?: string) => string | undefined;
|
|
480
|
-
renderTemplate: (template: string, configuration: object, options?: object) => string;
|
|
481
|
-
createFile: ({ path: path_, fileName, content, withPrefix }: {
|
|
482
|
-
path: any;
|
|
483
|
-
fileName: any;
|
|
484
|
-
content: any;
|
|
485
|
-
withPrefix: any;
|
|
486
|
-
}) => void;
|
|
487
|
-
formatTSContent: (code: string, { removeUnusedImports, format }?: {
|
|
488
|
-
removeUnusedImports?: boolean | undefined;
|
|
489
|
-
format?: boolean | undefined;
|
|
490
|
-
}) => Promise<string>;
|
|
491
|
-
}>;
|
|
492
|
-
getRenderTemplateData: () => {
|
|
493
|
-
utils: {
|
|
494
|
-
Ts: {
|
|
495
|
-
Keyword: {
|
|
496
|
-
Number: string;
|
|
497
|
-
String: string;
|
|
498
|
-
Boolean: string;
|
|
499
|
-
Any: string;
|
|
500
|
-
Void: string;
|
|
501
|
-
Unknown: string;
|
|
502
|
-
Null: string;
|
|
503
|
-
Undefined: string;
|
|
504
|
-
Object: string;
|
|
505
|
-
File: string;
|
|
506
|
-
Date: string;
|
|
507
|
-
Type: string;
|
|
508
|
-
Enum: string;
|
|
509
|
-
Interface: string;
|
|
510
|
-
Array: string;
|
|
511
|
-
Record: string;
|
|
512
|
-
Intersection: string;
|
|
513
|
-
Union: string;
|
|
514
|
-
};
|
|
515
|
-
CodeGenKeyword: {
|
|
516
|
-
UtilRequiredKeys: string;
|
|
517
|
-
};
|
|
518
|
-
ArrayType: (content: unknown) => string;
|
|
519
|
-
StringValue: (content: unknown) => string;
|
|
520
|
-
BooleanValue: (content: unknown) => string;
|
|
521
|
-
NumberValue: (content: unknown) => string;
|
|
522
|
-
NullValue: () => string;
|
|
523
|
-
UnionType: (contents: unknown[]) => string;
|
|
524
|
-
ExpressionGroup: (content: unknown) => string;
|
|
525
|
-
IntersectionType: (contents: unknown[]) => string;
|
|
526
|
-
RecordType: (key: unknown, value: unknown) => string;
|
|
527
|
-
TypeField: ({ readonly, key, optional, value }: Record<string, unknown>) => string;
|
|
528
|
-
InterfaceDynamicField: (key: unknown, value: unknown) => string;
|
|
529
|
-
EnumUsageKey: (enumStruct: unknown, key: unknown) => string;
|
|
530
|
-
EnumField: (key: unknown, value: unknown) => string;
|
|
531
|
-
EnumFieldsWrapper: (contents: Record<string, unknown>[]) => string;
|
|
532
|
-
ObjectWrapper: (content: unknown) => string;
|
|
533
|
-
MultilineComment: (contents: unknown[], formatFn: (arg: unknown) => unknown) => string[];
|
|
534
|
-
TypeWithGeneric: (typeName: unknown, genericArgs: unknown[]) => string;
|
|
535
|
-
Tuple: (values: unknown[]) => string;
|
|
536
|
-
};
|
|
537
|
-
formatDescription: (description: any, inline: any) => any;
|
|
538
|
-
internalCase: typeof internalCase;
|
|
539
|
-
classNameCase: typeof pascalCase;
|
|
540
|
-
pascalCase: typeof pascalCase;
|
|
541
|
-
getInlineParseContent: (schema: string, typeName: string | null, schemaPath: string[]) => Record<string, any>;
|
|
542
|
-
getParseContent: (schema: string, typeName: string | null, schemaPath: string[]) => Record<string, any>;
|
|
543
|
-
getComponentByRef: ($ref: string) => SchemaComponent | null;
|
|
544
|
-
parseSchema: (schema: string, typeName?: string | null, schemaPath?: string[]) => ParsedSchema_2<SchemaTypeObjectContent_2 | SchemaTypeEnumContent_2 | SchemaTypePrimitiveContent_2>;
|
|
545
|
-
checkAndAddNull: (schema: any, type: any) => any;
|
|
546
|
-
safeAddNullToType: (schema: any, type: any) => any;
|
|
547
|
-
isNeedToAddNull: (schema: any, type: any) => any;
|
|
548
|
-
inlineExtraFormatters: {
|
|
549
|
-
enum: (parsedSchema: any) => any;
|
|
550
|
-
object: (parsedSchema: any) => any;
|
|
551
|
-
};
|
|
552
|
-
formatters: {
|
|
553
|
-
enum: (parsedSchema: any) => any;
|
|
554
|
-
object: (parsedSchema: any) => any;
|
|
555
|
-
primitive: (parsedSchema: any) => any;
|
|
556
|
-
};
|
|
557
|
-
formatModelName: (name: string, options?: {
|
|
558
|
-
type?: "enum-key" | "type-name";
|
|
559
|
-
}) => string | undefined;
|
|
560
|
-
fmtToJSDocLine: (line: string, { eol }: {
|
|
561
|
-
eol?: boolean | undefined;
|
|
562
|
-
}) => string;
|
|
563
|
-
NameResolver: typeof NameResolver;
|
|
564
|
-
_: lodash.LoDashStatic;
|
|
565
|
-
require: (packageOrPath: string) => Promise<any>;
|
|
566
|
-
};
|
|
567
|
-
config: CodeGenConfig;
|
|
568
|
-
};
|
|
569
|
-
collectModelTypes: () => any[];
|
|
570
|
-
prepareModelType: (typeInfo: any) => any;
|
|
571
|
-
generateOutputFiles: ({ configuration }: {
|
|
572
|
-
configuration: any;
|
|
573
|
-
}) => Promise<TranslatorIO[]>;
|
|
574
|
-
createMultipleFileInfos: (templatesToRender: any, configuration: any) => Promise<TranslatorIO[]>;
|
|
575
|
-
createSingleFileInfo: (templatesToRender: any, configuration: any) => Promise<TranslatorIO[]>;
|
|
576
|
-
createOutputFileInfo: (configuration: any, fileNameFull: any, content: any) => Promise<TranslatorIO[]>;
|
|
577
|
-
createApiConfig: (swaggerSchema: any) => {
|
|
578
|
-
info: any;
|
|
579
|
-
servers: any;
|
|
580
|
-
basePath: any;
|
|
581
|
-
host: any;
|
|
582
|
-
externalDocs: any;
|
|
583
|
-
tags: unknown[];
|
|
584
|
-
baseUrl: any;
|
|
585
|
-
title: any;
|
|
586
|
-
version: any;
|
|
587
|
-
};
|
|
588
|
-
injectClassInstance: (key: any, value: any) => void;
|
|
589
|
-
}
|
|
590
|
-
|
|
591
|
-
export declare function collectAllSchemas(): Promise<Schema[]>;
|
|
592
|
-
|
|
593
|
-
export declare class ComplexSchemaParser extends MonoSchemaParser {
|
|
594
|
-
parse(): any;
|
|
595
|
-
}
|
|
596
|
-
|
|
597
|
-
export declare class ComponentTypeNameResolver extends NameResolver {
|
|
598
|
-
counter: number;
|
|
599
|
-
fallbackNameCounter: number;
|
|
600
|
-
countersByVariant: Map<string, number>;
|
|
601
|
-
constructor(config: CodeGenConfig, reservedNames: string[]);
|
|
602
|
-
}
|
|
603
|
-
|
|
604
|
-
export declare namespace constants {
|
|
605
|
-
export {
|
|
606
|
-
DEFAULT_BODY_ARG_NAME,
|
|
607
|
-
FILE_PREFIX,
|
|
608
|
-
HTTP_CLIENT,
|
|
609
|
-
PROJECT_VERSION,
|
|
610
|
-
RESERVED_BODY_ARG_NAMES,
|
|
611
|
-
RESERVED_HEADER_ARG_NAMES,
|
|
612
|
-
RESERVED_PATH_ARG_NAMES,
|
|
613
|
-
RESERVED_QUERY_ARG_NAMES,
|
|
614
|
-
RESERVED_REQ_PARAMS_ARG_NAMES,
|
|
615
|
-
SCHEMA_TYPES
|
|
616
|
-
}
|
|
617
|
-
}
|
|
618
|
-
|
|
619
|
-
export declare const default_alias: Options | Options[] | ((overrideOptions: Options) => Options | Options[] | Promise<Options | Options[]>);
|
|
620
|
-
|
|
621
|
-
export declare const default_alias_1: UserConfig;
|
|
622
|
-
|
|
623
|
-
export declare const DEFAULT_BODY_ARG_NAME = "data";
|
|
624
|
-
|
|
625
|
-
export declare class DiscriminatorSchemaParser extends MonoSchemaParser {
|
|
626
|
-
parse(): any;
|
|
627
|
-
createDiscriminatorSchema: ({ skipMappingType, abstractSchemaStruct }: {
|
|
628
|
-
skipMappingType: any;
|
|
629
|
-
abstractSchemaStruct: any;
|
|
630
|
-
}) => {
|
|
631
|
-
content: string;
|
|
632
|
-
} | null;
|
|
633
|
-
createMappingPropertySchemaEnumKeys: ({ abstractSchemaStruct, discPropertyName, }: {
|
|
634
|
-
abstractSchemaStruct: any;
|
|
635
|
-
discPropertyName: any;
|
|
636
|
-
}) => {};
|
|
637
|
-
mutateMappingDependentSchema: ({ discPropertyName, abstractSchemaStruct, mappingSchema, refPath, mappingPropertySchemaEnumKeysMap, }: {
|
|
638
|
-
discPropertyName: any;
|
|
639
|
-
abstractSchemaStruct: any;
|
|
640
|
-
mappingSchema: any;
|
|
641
|
-
refPath: any;
|
|
642
|
-
mappingPropertySchemaEnumKeysMap: any;
|
|
643
|
-
}) => void;
|
|
644
|
-
createAbstractSchemaStruct: () => {
|
|
645
|
-
typeName: string | null;
|
|
646
|
-
component: SchemaComponent_4;
|
|
647
|
-
content: any;
|
|
648
|
-
} | null;
|
|
649
|
-
createComplexSchemaStruct: () => {
|
|
650
|
-
content: string;
|
|
651
|
-
} | null;
|
|
652
|
-
}
|
|
653
|
-
|
|
654
|
-
export declare class EnumKeyResolver extends NameResolver {
|
|
655
|
-
counter: number;
|
|
656
|
-
constructor(config: CodeGenConfig, reservedNames: string[]);
|
|
657
|
-
}
|
|
658
|
-
|
|
659
|
-
export declare class EnumSchemaParser extends MonoSchemaParser {
|
|
660
|
-
enumKeyResolver: EnumKeyResolver;
|
|
661
|
-
constructor(...args: any[]);
|
|
662
|
-
extractEnum: (pathTypeName: any) => ParsedSchema_3<SchemaTypeObjectContent_3 | SchemaTypeEnumContent_3 | SchemaTypePrimitiveContent_3>;
|
|
663
|
-
parse(): any;
|
|
664
|
-
formatEnumKey: ({ key, value }: {
|
|
665
|
-
key: any;
|
|
666
|
-
value: any;
|
|
667
|
-
}) => string | null;
|
|
668
|
-
}
|
|
669
|
-
|
|
670
|
-
export declare type ExtractingOptions = {
|
|
671
|
-
requestBodySuffix: string[];
|
|
672
|
-
responseBodySuffix: string[];
|
|
673
|
-
responseErrorSuffix: string[];
|
|
674
|
-
requestParamsSuffix: string[];
|
|
675
|
-
enumSuffix: string[];
|
|
676
|
-
discriminatorMappingSuffix: string[];
|
|
677
|
-
discriminatorAbstractPrefix: string[];
|
|
678
|
-
requestBodyNameResolver: (name: string, reservedNames: string) => string | undefined;
|
|
679
|
-
responseBodyNameResolver: (name: string, reservedNames: string) => string | undefined;
|
|
680
|
-
responseErrorNameResolver: (name: string, reservedNames: string) => string | undefined;
|
|
681
|
-
requestParamsNameResolver: (name: string, reservedNames: string) => string | undefined;
|
|
682
|
-
enumNameResolver: (name: string, reservedNames: string) => string | undefined;
|
|
683
|
-
discriminatorMappingNameResolver: (name: string, reservedNames: string) => string | undefined;
|
|
684
|
-
discriminatorAbstractResolver: (name: string, reservedNames: string) => string | undefined;
|
|
685
|
-
};
|
|
686
|
-
|
|
687
|
-
export declare const FILE_PREFIX = "/* eslint-disable */\n/* tslint:disable */\n// @ts-nocheck\n/*\n * ---------------------------------------------------------------\n * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ##\n * ## ##\n * ## AUTHOR: acacode ##\n * ## SOURCE: https://github.com/acacode/swagger-typescript-api ##\n * ---------------------------------------------------------------\n */\n\n";
|
|
688
|
-
|
|
689
|
-
declare type FileInfo = {
|
|
690
|
-
/** @example myFilename */
|
|
691
|
-
fileName: string;
|
|
692
|
-
/** @example .d.ts */
|
|
693
|
-
fileExtension: string;
|
|
694
|
-
/** content of the file */
|
|
695
|
-
fileContent: string;
|
|
696
|
-
};
|
|
697
|
-
|
|
698
|
-
export declare class FileSystem {
|
|
699
|
-
getFileContent: (path: string) => string;
|
|
700
|
-
readDir: (path: string) => string[];
|
|
701
|
-
pathIsDir: (path: string) => boolean;
|
|
702
|
-
cropExtension: (fileName: string) => string;
|
|
703
|
-
removeDir: (path: string) => void;
|
|
704
|
-
createDir: (path: string) => void;
|
|
705
|
-
cleanDir: (path: string) => void;
|
|
706
|
-
pathIsExist: (path: string) => boolean;
|
|
707
|
-
createFile: ({ path: path_, fileName, content, withPrefix }: {
|
|
708
|
-
path: any;
|
|
709
|
-
fileName: any;
|
|
710
|
-
content: any;
|
|
711
|
-
withPrefix: any;
|
|
712
|
-
}) => void;
|
|
713
|
-
}
|
|
714
|
-
|
|
715
|
-
declare type FormattingSchemaType = "enum-key" | "type-name";
|
|
716
|
-
|
|
717
|
-
export declare function generateApi(config: Partial<GenerateApiConfiguration["config"]>): Promise<{
|
|
718
|
-
files: TranslatorIO_2[];
|
|
719
|
-
configuration: GenerateApiConfiguration | {
|
|
720
|
-
apiConfig: {
|
|
721
|
-
info: any;
|
|
722
|
-
servers: any;
|
|
723
|
-
basePath: any;
|
|
724
|
-
host: any;
|
|
725
|
-
externalDocs: any;
|
|
726
|
-
tags: unknown[];
|
|
727
|
-
baseUrl: any;
|
|
728
|
-
title: any;
|
|
729
|
-
version: any;
|
|
730
|
-
};
|
|
731
|
-
config: CodeGenConfig_2;
|
|
732
|
-
modelTypes: any[];
|
|
733
|
-
hasSecurityRoutes: boolean;
|
|
734
|
-
hasQueryRoutes: boolean;
|
|
735
|
-
hasFormDataRoutes: boolean;
|
|
736
|
-
generateResponses: boolean;
|
|
737
|
-
routes: {
|
|
738
|
-
outOfModule: ParsedRoute_2[];
|
|
739
|
-
combined?: {
|
|
740
|
-
moduleName: string;
|
|
741
|
-
routes: ParsedRoute_2[];
|
|
742
|
-
}[];
|
|
743
|
-
};
|
|
744
|
-
extraTemplates: never[];
|
|
745
|
-
fileName: string;
|
|
746
|
-
translateToJavaScript: boolean;
|
|
747
|
-
customTranslator: Translator_2 | null;
|
|
748
|
-
utils: {
|
|
749
|
-
Ts: {
|
|
750
|
-
Keyword: {
|
|
751
|
-
Number: string;
|
|
752
|
-
String: string;
|
|
753
|
-
Boolean: string;
|
|
754
|
-
Any: string;
|
|
755
|
-
Void: string;
|
|
756
|
-
Unknown: string;
|
|
757
|
-
Null: string;
|
|
758
|
-
Undefined: string;
|
|
759
|
-
Object: string;
|
|
760
|
-
File: string;
|
|
761
|
-
Date: string;
|
|
762
|
-
Type: string;
|
|
763
|
-
Enum: string;
|
|
764
|
-
Interface: string;
|
|
765
|
-
Array: string;
|
|
766
|
-
Record: string;
|
|
767
|
-
Intersection: string;
|
|
768
|
-
Union: string;
|
|
769
|
-
};
|
|
770
|
-
CodeGenKeyword: {
|
|
771
|
-
UtilRequiredKeys: string;
|
|
772
|
-
};
|
|
773
|
-
ArrayType: (content: unknown) => string;
|
|
774
|
-
StringValue: (content: unknown) => string;
|
|
775
|
-
BooleanValue: (content: unknown) => string;
|
|
776
|
-
NumberValue: (content: unknown) => string;
|
|
777
|
-
NullValue: () => string;
|
|
778
|
-
UnionType: (contents: unknown[]) => string;
|
|
779
|
-
ExpressionGroup: (content: unknown) => string;
|
|
780
|
-
IntersectionType: (contents: unknown[]) => string;
|
|
781
|
-
RecordType: (key: unknown, value: unknown) => string;
|
|
782
|
-
TypeField: ({ readonly, key, optional, value }: Record<string, unknown>) => string;
|
|
783
|
-
InterfaceDynamicField: (key: unknown, value: unknown) => string;
|
|
784
|
-
EnumUsageKey: (enumStruct: unknown, key: unknown) => string;
|
|
785
|
-
EnumField: (key: unknown, value: unknown) => string;
|
|
786
|
-
EnumFieldsWrapper: (contents: Record<string, unknown>[]) => string;
|
|
787
|
-
ObjectWrapper: (content: unknown) => string;
|
|
788
|
-
MultilineComment: (contents: unknown[], formatFn: (arg: unknown) => unknown) => string[];
|
|
789
|
-
TypeWithGeneric: (typeName: unknown, genericArgs: unknown[]) => string;
|
|
790
|
-
Tuple: (values: unknown[]) => string;
|
|
791
|
-
};
|
|
792
|
-
formatDescription: (description: any, inline: any) => any;
|
|
793
|
-
internalCase: internalCase_2;
|
|
794
|
-
classNameCase: pascalCase_2;
|
|
795
|
-
pascalCase: pascalCase_2;
|
|
796
|
-
getInlineParseContent: (schema: string, typeName: string | null, schemaPath: string[]) => Record<string, any>;
|
|
797
|
-
getParseContent: (schema: string, typeName: string | null, schemaPath: string[]) => Record<string, any>;
|
|
798
|
-
getComponentByRef: ($ref: string) => SchemaComponent_3 | null;
|
|
799
|
-
parseSchema: (schema: string, typeName?: string | null, schemaPath?: string[]) => ParsedSchema_2<SchemaTypeObjectContent_2 | SchemaTypeEnumContent_2 | SchemaTypePrimitiveContent_2>;
|
|
800
|
-
checkAndAddNull: (schema: any, type: any) => any;
|
|
801
|
-
safeAddNullToType: (schema: any, type: any) => any;
|
|
802
|
-
isNeedToAddNull: (schema: any, type: any) => any;
|
|
803
|
-
inlineExtraFormatters: {
|
|
804
|
-
enum: (parsedSchema: any) => any;
|
|
805
|
-
object: (parsedSchema: any) => any;
|
|
806
|
-
};
|
|
807
|
-
formatters: {
|
|
808
|
-
enum: (parsedSchema: any) => any;
|
|
809
|
-
object: (parsedSchema: any) => any;
|
|
810
|
-
primitive: (parsedSchema: any) => any;
|
|
811
|
-
};
|
|
812
|
-
formatModelName: (name: string, options?: {
|
|
813
|
-
type?: "enum-key" | "type-name";
|
|
814
|
-
}) => string | undefined;
|
|
815
|
-
fmtToJSDocLine: (line: string, { eol }: {
|
|
816
|
-
eol?: boolean | undefined;
|
|
817
|
-
}) => string;
|
|
818
|
-
NameResolver: NameResolver_2;
|
|
819
|
-
_: LoDashStatic;
|
|
820
|
-
require: (packageOrPath: string) => Promise<any>;
|
|
821
|
-
};
|
|
822
|
-
};
|
|
823
|
-
getTemplate: (name: string, fileName: string, path?: string) => string | undefined;
|
|
824
|
-
renderTemplate: (template: string, configuration: object, options?: object) => string;
|
|
825
|
-
createFile: ({ path: path_, fileName, content, withPrefix }: {
|
|
826
|
-
path: any;
|
|
827
|
-
fileName: any;
|
|
828
|
-
content: any;
|
|
829
|
-
withPrefix: any;
|
|
830
|
-
}) => void;
|
|
831
|
-
formatTSContent: (code: string, { removeUnusedImports, format }?: {
|
|
832
|
-
removeUnusedImports?: boolean | undefined;
|
|
833
|
-
format?: boolean | undefined;
|
|
834
|
-
}) => Promise<string>;
|
|
835
|
-
}>;
|
|
836
|
-
|
|
837
|
-
export declare function generateApi_alias_1(params: GenerateApiParams): Promise<GenerateApiOutput>;
|
|
838
|
-
|
|
839
|
-
export declare interface GenerateApiConfiguration {
|
|
840
|
-
apiConfig: {
|
|
841
|
-
baseUrl: string;
|
|
842
|
-
title: string;
|
|
843
|
-
version: string;
|
|
844
|
-
description: string[];
|
|
845
|
-
hasDescription: boolean;
|
|
846
|
-
};
|
|
847
|
-
config: {
|
|
848
|
-
input: string;
|
|
849
|
-
output: string | false;
|
|
850
|
-
url: string;
|
|
851
|
-
spec: unknown;
|
|
852
|
-
fileName: string;
|
|
853
|
-
templatePaths: {
|
|
854
|
-
/** `templates/base` */
|
|
855
|
-
base: string;
|
|
856
|
-
/** `templates/default` */
|
|
857
|
-
default: string;
|
|
858
|
-
/** `templates/modular` */
|
|
859
|
-
modular: string;
|
|
860
|
-
/** usage path if `--templates` option is not set */
|
|
861
|
-
original: string;
|
|
862
|
-
/** custom path to templates (`--templates`) */
|
|
863
|
-
custom: string | null;
|
|
864
|
-
};
|
|
865
|
-
authorizationToken?: string;
|
|
866
|
-
generateResponses: boolean;
|
|
867
|
-
defaultResponseAsSuccess: boolean;
|
|
868
|
-
generateRouteTypes: boolean;
|
|
869
|
-
generateClient: boolean;
|
|
870
|
-
generateUnionEnums: boolean;
|
|
871
|
-
swaggerSchema: object;
|
|
872
|
-
originalSchema: object;
|
|
873
|
-
componentsMap: Record<string, SchemaComponent>;
|
|
874
|
-
convertedFromSwagger2: boolean;
|
|
875
|
-
moduleNameIndex: number;
|
|
876
|
-
moduleNameFirstTag: boolean;
|
|
877
|
-
extraTemplates: {
|
|
878
|
-
name: string;
|
|
879
|
-
path: string;
|
|
880
|
-
}[];
|
|
881
|
-
extractRequestParams: boolean;
|
|
882
|
-
unwrapResponseData: boolean;
|
|
883
|
-
sortTypes: boolean;
|
|
884
|
-
sortRoutes: boolean;
|
|
885
|
-
singleHttpClient: boolean;
|
|
886
|
-
typePrefix: string;
|
|
887
|
-
typeSuffix: string;
|
|
888
|
-
enumKeyPrefix: string;
|
|
889
|
-
enumKeySuffix: string;
|
|
890
|
-
patch: boolean;
|
|
891
|
-
cleanOutput: boolean;
|
|
892
|
-
debug: boolean;
|
|
893
|
-
anotherArrayType: boolean;
|
|
894
|
-
extractRequestBody: boolean;
|
|
895
|
-
httpClientType: "axios" | "fetch";
|
|
896
|
-
addReadonly: boolean;
|
|
897
|
-
extractResponseBody: boolean;
|
|
898
|
-
extractResponseError: boolean;
|
|
899
|
-
extractEnums: boolean;
|
|
900
|
-
extractResponses: boolean;
|
|
901
|
-
fixInvalidTypeNamePrefix: string;
|
|
902
|
-
fixInvalidEnumKeyPrefix: string;
|
|
903
|
-
defaultResponseType: string;
|
|
904
|
-
toJS: boolean;
|
|
905
|
-
disableThrowOnError: boolean;
|
|
906
|
-
silent: boolean;
|
|
907
|
-
hooks: Partial<Hooks>;
|
|
908
|
-
enumNamesAsValues: boolean;
|
|
909
|
-
version: string;
|
|
910
|
-
compilerTsConfig: Record<string, unknown>;
|
|
911
|
-
enumKeyResolverName: string;
|
|
912
|
-
typeNameResolverName: string;
|
|
913
|
-
specificArgNameResolverName: string;
|
|
914
|
-
customTranslator?: new () => Translator;
|
|
915
|
-
internalTemplateOptions: {
|
|
916
|
-
addUtilRequiredKeysType: boolean;
|
|
917
|
-
};
|
|
918
|
-
componentTypeNameResolver: ComponentTypeNameResolver;
|
|
919
|
-
fileNames: {
|
|
920
|
-
dataContracts: string;
|
|
921
|
-
routeTypes: string;
|
|
922
|
-
httpClient: string;
|
|
923
|
-
outOfModuleApi: string;
|
|
924
|
-
};
|
|
925
|
-
templatesToRender: {
|
|
926
|
-
api: string;
|
|
927
|
-
dataContracts: string;
|
|
928
|
-
httpClient: string;
|
|
929
|
-
routeTypes: string;
|
|
930
|
-
routeName: string;
|
|
931
|
-
dataContractJsDoc: string;
|
|
932
|
-
interfaceDataContract: string;
|
|
933
|
-
typeDataContract: string;
|
|
934
|
-
enumDataContract: string;
|
|
935
|
-
objectFieldJsDoc: string;
|
|
936
|
-
};
|
|
937
|
-
routeNameDuplicatesMap: Map<string, string>;
|
|
938
|
-
apiClassName: string;
|
|
939
|
-
requestOptions?: RequestInit;
|
|
940
|
-
extractingOptions: ExtractingOptions;
|
|
941
|
-
};
|
|
942
|
-
modelTypes: ModelType[];
|
|
943
|
-
hasFormDataRoutes: boolean;
|
|
944
|
-
hasSecurityRoutes: boolean;
|
|
945
|
-
hasQueryRoutes: boolean;
|
|
946
|
-
generateResponses: boolean;
|
|
947
|
-
routes: {
|
|
948
|
-
outOfModule: ParsedRoute[];
|
|
949
|
-
combined?: {
|
|
950
|
-
moduleName: string;
|
|
951
|
-
routes: ParsedRoute[];
|
|
952
|
-
}[];
|
|
953
|
-
};
|
|
954
|
-
requestOptions?: Partial<RequestInit>;
|
|
955
|
-
utils: {
|
|
956
|
-
formatDescription: (description: string, inline?: boolean) => string;
|
|
957
|
-
internalCase: (value: string) => string;
|
|
958
|
-
/** @deprecated */
|
|
959
|
-
classNameCase: (value: string) => string;
|
|
960
|
-
pascalCase: (value: string) => string;
|
|
961
|
-
getInlineParseContent: (rawTypeData: SchemaComponent["rawTypeData"], typeName?: string) => string;
|
|
962
|
-
getParseContent: (rawTypeData: SchemaComponent["rawTypeData"], typeName?: string) => ModelType;
|
|
963
|
-
getComponentByRef: (ref: string) => SchemaComponent;
|
|
964
|
-
parseSchema: (rawSchema: string | SchemaComponent["rawTypeData"], typeName?: string, formattersMap?: Record<MAIN_SCHEMA_TYPES, (content: ModelType) => string>) => ModelType;
|
|
965
|
-
formatters: Record<MAIN_SCHEMA_TYPES, (content: string | object | string[] | object[]) => string>;
|
|
966
|
-
inlineExtraFormatters: Record<Exclude<MAIN_SCHEMA_TYPES, SCHEMA_TYPES_alias_1.PRIMITIVE>, (schema: ModelType) => string>;
|
|
967
|
-
formatModelName: (name: string) => string;
|
|
968
|
-
fmtToJSDocLine: (line: string, params?: {
|
|
969
|
-
eol?: boolean;
|
|
970
|
-
}) => string;
|
|
971
|
-
_: LoDashStatic;
|
|
972
|
-
require: (path: string) => unknown;
|
|
973
|
-
};
|
|
974
|
-
}
|
|
975
|
-
|
|
976
|
-
export declare interface GenerateApiOutput {
|
|
977
|
-
configuration: GenerateApiConfiguration;
|
|
978
|
-
files: FileInfo[];
|
|
979
|
-
createFile: (params: {
|
|
980
|
-
path: string;
|
|
981
|
-
fileName: string;
|
|
982
|
-
content: string;
|
|
983
|
-
withPrefix: boolean;
|
|
984
|
-
}) => void;
|
|
985
|
-
renderTemplate: (templateContent: string, data: Record<string, unknown>, etaOptions?: Partial<EtaConfig>) => Promise<string> | string;
|
|
986
|
-
getTemplate: (params: {
|
|
987
|
-
fileName?: string;
|
|
988
|
-
name?: string;
|
|
989
|
-
path?: string;
|
|
990
|
-
}) => string;
|
|
991
|
-
formatTSContent: (content: string) => Promise<string>;
|
|
992
|
-
}
|
|
993
|
-
|
|
994
|
-
export declare type GenerateApiParams = GenerateApiParamsFromPath | GenerateApiParamsFromUrl | GenerateApiParamsFromSpecLiteral;
|
|
995
|
-
|
|
996
|
-
declare interface GenerateApiParamsBase {
|
|
997
|
-
/**
|
|
998
|
-
* default 'api.ts'
|
|
999
|
-
*/
|
|
1000
|
-
fileName?: string;
|
|
1001
|
-
/**
|
|
1002
|
-
* name of the main exported class
|
|
1003
|
-
*/
|
|
1004
|
-
apiClassName?: string;
|
|
1005
|
-
/**
|
|
1006
|
-
* path to folder where will be located the created api module.
|
|
1007
|
-
*
|
|
1008
|
-
* may set to `false` to skip writing content to disk. in this case,
|
|
1009
|
-
* you may access the `files` on the return value.
|
|
1010
|
-
*/
|
|
1011
|
-
output?: string | false;
|
|
1012
|
-
/**
|
|
1013
|
-
* path to folder containing templates (default: ./src/templates)
|
|
1014
|
-
*/
|
|
1015
|
-
templates?: string;
|
|
1016
|
-
/**
|
|
1017
|
-
* generate all "enum" types as union types (T1 | T2 | TN) (default: false)
|
|
1018
|
-
*/
|
|
1019
|
-
generateUnionEnums?: boolean;
|
|
1020
|
-
/**
|
|
1021
|
-
* generate type definitions for API routes (default: false)
|
|
1022
|
-
*/
|
|
1023
|
-
generateRouteTypes?: boolean;
|
|
1024
|
-
/**
|
|
1025
|
-
* do not generate an API class
|
|
1026
|
-
*/
|
|
1027
|
-
generateClient?: boolean;
|
|
1028
|
-
/**
|
|
1029
|
-
* generated http client type
|
|
1030
|
-
*/
|
|
1031
|
-
httpClientType?: HttpClientType;
|
|
1032
|
-
/**
|
|
1033
|
-
* use "default" response status code as success response too.
|
|
1034
|
-
* some swagger schemas use "default" response status code as success response type by default.
|
|
1035
|
-
*/
|
|
1036
|
-
defaultResponseAsSuccess?: boolean;
|
|
1037
|
-
/**
|
|
1038
|
-
* generate additional information about request responses
|
|
1039
|
-
* also add typings for bad responses
|
|
1040
|
-
*/
|
|
1041
|
-
generateResponses?: boolean;
|
|
1042
|
-
/**
|
|
1043
|
-
* unwrap the data item from the response
|
|
1044
|
-
*/
|
|
1045
|
-
unwrapResponseData?: boolean;
|
|
1046
|
-
/**
|
|
1047
|
-
* sort data contracts in alphabetical order
|
|
1048
|
-
*/
|
|
1049
|
-
sortTypes?: boolean;
|
|
1050
|
-
/**
|
|
1051
|
-
* sort routes in alphabetical order
|
|
1052
|
-
*/
|
|
1053
|
-
sortRoutes?: boolean;
|
|
1054
|
-
/**
|
|
1055
|
-
* generate js api module with declaration file (default: false)
|
|
1056
|
-
*/
|
|
1057
|
-
toJS?: boolean;
|
|
1058
|
-
/**
|
|
1059
|
-
* determines which path index should be used for routes separation
|
|
1060
|
-
*/
|
|
1061
|
-
moduleNameIndex?: number;
|
|
1062
|
-
/**
|
|
1063
|
-
* users operation's first tag for route separation
|
|
1064
|
-
*/
|
|
1065
|
-
moduleNameFirstTag?: boolean;
|
|
1066
|
-
/**
|
|
1067
|
-
* generate separated files for http client, data contracts, and routes (default: false)
|
|
1068
|
-
*/
|
|
1069
|
-
modular?: boolean;
|
|
1070
|
-
/**
|
|
1071
|
-
* extract request params to data contract (Also combine path params and query params into one object)
|
|
1072
|
-
*/
|
|
1073
|
-
extractRequestParams?: boolean;
|
|
1074
|
-
/**
|
|
1075
|
-
* extract request body type to data contract
|
|
1076
|
-
*/
|
|
1077
|
-
extractRequestBody?: boolean;
|
|
1078
|
-
/**
|
|
1079
|
-
* extract response body type to data contract
|
|
1080
|
-
*/
|
|
1081
|
-
extractResponseBody?: boolean;
|
|
1082
|
-
/**
|
|
1083
|
-
* extract response error type to data contract
|
|
1084
|
-
*/
|
|
1085
|
-
extractResponseError?: boolean;
|
|
1086
|
-
/**
|
|
1087
|
-
* Output only errors to console (default: false)
|
|
1088
|
-
*/
|
|
1089
|
-
silent?: boolean;
|
|
1090
|
-
/**
|
|
1091
|
-
* default type for empty response schema (default: "void")
|
|
1092
|
-
*/
|
|
1093
|
-
defaultResponseType?: string;
|
|
1094
|
-
/**
|
|
1095
|
-
* Ability to send HttpClient instance to Api constructor
|
|
1096
|
-
*/
|
|
1097
|
-
singleHttpClient?: boolean;
|
|
1098
|
-
cleanOutput?: boolean;
|
|
1099
|
-
enumNamesAsValues?: boolean;
|
|
1100
|
-
hooks?: Partial<Hooks>;
|
|
1101
|
-
/**
|
|
1102
|
-
* extra templates
|
|
1103
|
-
*/
|
|
1104
|
-
extraTemplates?: {
|
|
1105
|
-
name: string;
|
|
1106
|
-
path: string;
|
|
1107
|
-
}[];
|
|
1108
|
-
/**
|
|
1109
|
-
* fix up small errors in the swagger source definition
|
|
1110
|
-
*/
|
|
1111
|
-
patch?: boolean;
|
|
1112
|
-
/**
|
|
1113
|
-
* authorization token
|
|
1114
|
-
*/
|
|
1115
|
-
authorizationToken?: string;
|
|
1116
|
-
/**
|
|
1117
|
-
* generate readonly properties (default: false)
|
|
1118
|
-
*/
|
|
1119
|
-
addReadonly?: boolean;
|
|
1120
|
-
primitiveTypeConstructs?: (struct: PrimitiveTypeStruct) => Partial<PrimitiveTypeStruct>;
|
|
1121
|
-
codeGenConstructs?: (struct: CodeGenConstruct) => Partial<CodeGenConstruct>;
|
|
1122
|
-
/** extract all enums from nested types\interfaces to `enum` construction */
|
|
1123
|
-
extractEnums?: boolean;
|
|
1124
|
-
/** prefix string value needed to fix invalid type names (default: 'Type') */
|
|
1125
|
-
fixInvalidTypeNamePrefix?: string;
|
|
1126
|
-
/** prefix string value needed to fix invalid enum keys (default: 'Value') */
|
|
1127
|
-
fixInvalidEnumKeyPrefix?: string;
|
|
1128
|
-
/** prefix string value for enum keys */
|
|
1129
|
-
enumKeyPrefix?: string;
|
|
1130
|
-
/** suffix string value for enum keys */
|
|
1131
|
-
enumKeySuffix?: string;
|
|
1132
|
-
/** prefix string value for type names */
|
|
1133
|
-
typePrefix?: string;
|
|
1134
|
-
/** suffix string value for type names */
|
|
1135
|
-
typeSuffix?: string;
|
|
1136
|
-
/** extra configuration for extracting type names operations */
|
|
1137
|
-
extractingOptions?: ExtractingOptions;
|
|
1138
|
-
/** configuration for fetching swagger schema requests */
|
|
1139
|
-
requestOptions?: Partial<RequestInit>;
|
|
1140
|
-
/** ts compiler configuration object (for --to-js option) */
|
|
1141
|
-
compilerTsConfig?: Record<string, unknown>;
|
|
1142
|
-
/** extract all enums from inline interface\\type content to typescript enum construction */
|
|
1143
|
-
extractResponses?: boolean;
|
|
1144
|
-
/** generate array types as Array<Type> (by default Type[]) */
|
|
1145
|
-
anotherArrayType?: boolean;
|
|
1146
|
-
/**
|
|
1147
|
-
* custom ts->* translator
|
|
1148
|
-
* do not use constructor args, it can break functionality of this property, just send class reference
|
|
1149
|
-
*
|
|
1150
|
-
* @example
|
|
1151
|
-
* ```ts
|
|
1152
|
-
* import { Translator } from "swagger-typescript-api/src/translators/translator";
|
|
1153
|
-
*
|
|
1154
|
-
* class MyTranslator extends Translator {
|
|
1155
|
-
*
|
|
1156
|
-
* translate({ fileName, fileExtension, fileContent }) {
|
|
1157
|
-
* this.codeFormatter.format()
|
|
1158
|
-
* this.config.
|
|
1159
|
-
*
|
|
1160
|
-
* return [
|
|
1161
|
-
* {
|
|
1162
|
-
* fileName,
|
|
1163
|
-
* fileExtension,
|
|
1164
|
-
* fileContent,
|
|
1165
|
-
* }
|
|
1166
|
-
* ]
|
|
1167
|
-
* }
|
|
1168
|
-
* }
|
|
1169
|
-
* ```
|
|
1170
|
-
*/
|
|
1171
|
-
customTranslator?: new () => Translator;
|
|
1172
|
-
/** fallback name for enum key resolver */
|
|
1173
|
-
enumKeyResolverName?: string;
|
|
1174
|
-
/** fallback name for type name resolver */
|
|
1175
|
-
typeNameResolverName?: string;
|
|
1176
|
-
/** fallback name for specific arg name resolver */
|
|
1177
|
-
specificArgNameResolverName?: string;
|
|
1178
|
-
schemaParsers?: {
|
|
1179
|
-
complexOneOf?: MonoSchemaParser;
|
|
1180
|
-
complexAllOf?: MonoSchemaParser;
|
|
1181
|
-
complexAnyOf?: MonoSchemaParser;
|
|
1182
|
-
complexNot?: MonoSchemaParser;
|
|
1183
|
-
enum?: MonoSchemaParser;
|
|
1184
|
-
object?: MonoSchemaParser;
|
|
1185
|
-
complex?: MonoSchemaParser;
|
|
1186
|
-
primitive?: MonoSchemaParser;
|
|
1187
|
-
discriminator?: MonoSchemaParser;
|
|
1188
|
-
array?: MonoSchemaParser;
|
|
1189
|
-
};
|
|
1190
|
-
}
|
|
1191
|
-
|
|
1192
|
-
declare interface GenerateApiParamsFromPath extends GenerateApiParamsBase {
|
|
1193
|
-
/**
|
|
1194
|
-
* path to swagger schema
|
|
1195
|
-
*/
|
|
1196
|
-
input: string;
|
|
1197
|
-
}
|
|
1198
|
-
|
|
1199
|
-
declare interface GenerateApiParamsFromSpecLiteral extends GenerateApiParamsBase {
|
|
1200
|
-
/**
|
|
1201
|
-
* swagger schema JSON
|
|
1202
|
-
*/
|
|
1203
|
-
spec: Spec;
|
|
1204
|
-
}
|
|
1205
|
-
|
|
1206
|
-
declare interface GenerateApiParamsFromUrl extends GenerateApiParamsBase {
|
|
1207
|
-
/**
|
|
1208
|
-
* url to swagger schema
|
|
1209
|
-
*/
|
|
1210
|
-
url: string;
|
|
1211
|
-
}
|
|
1212
|
-
|
|
1213
|
-
export declare const generateId: (size?: number) => string;
|
|
1214
|
-
|
|
1215
|
-
declare function generateTemplates(config: GenerateTemplatesParams): Promise<GenerateTemplatesOutput_2>;
|
|
1216
|
-
export { generateTemplates }
|
|
1217
|
-
export { generateTemplates as generateTemplates_alias_1 }
|
|
1218
|
-
|
|
1219
|
-
export declare function generateTemplates_alias_2(params: GenerateTemplatesParams): Promise<GenerateTemplatesOutput>;
|
|
1220
|
-
|
|
1221
|
-
export declare interface GenerateTemplatesOutput extends Pick<GenerateApiOutput, "files" | "createFile"> {
|
|
1222
|
-
}
|
|
1223
|
-
|
|
1224
|
-
export declare interface GenerateTemplatesParams {
|
|
1225
|
-
cleanOutput?: boolean;
|
|
1226
|
-
output?: string;
|
|
1227
|
-
httpClientType?: HttpClientType;
|
|
1228
|
-
modular?: boolean;
|
|
1229
|
-
rewrite?: boolean;
|
|
1230
|
-
silent?: boolean;
|
|
1231
|
-
debug?: boolean;
|
|
1232
|
-
}
|
|
1233
|
-
|
|
1234
|
-
export declare const getRandomFloat: (min?: number, max?: number) => number;
|
|
1235
|
-
|
|
1236
|
-
export declare const getRandomInt: (min?: number, max?: number) => number;
|
|
1237
|
-
|
|
1238
|
-
export declare interface Hooks {
|
|
1239
|
-
/** calls before parse\process route path */
|
|
1240
|
-
onPreBuildRoutePath: (routePath: string) => string | undefined;
|
|
1241
|
-
/** calls after parse\process route path */
|
|
1242
|
-
onBuildRoutePath: (data: BuildRoutePath) => BuildRoutePath | undefined;
|
|
1243
|
-
/** calls before insert path param name into string path interpolation */
|
|
1244
|
-
onInsertPathParam: (paramName: string, index: number, arr: BuildRouteParam[], resultRoute: string) => string | undefined;
|
|
1245
|
-
/** calls after parse schema component */
|
|
1246
|
-
onCreateComponent: (component: SchemaComponent) => SchemaComponent | undefined;
|
|
1247
|
-
/** calls before parse any kind of schema */
|
|
1248
|
-
onPreParseSchema: (originalSchema: unknown, typeName: string, schemaType: string) => undefined;
|
|
1249
|
-
/** calls after parse any kind of schema */
|
|
1250
|
-
onParseSchema: (originalSchema: unknown, parsedSchema: unknown) => unknown | undefined;
|
|
1251
|
-
/** calls after parse route (return type: customized route (ParsedRoute), nothing change (void), false (ignore this route)) */
|
|
1252
|
-
onCreateRoute: (routeData: ParsedRoute) => ParsedRoute | false | undefined;
|
|
1253
|
-
/** Start point of work this tool (after fetching schema) */
|
|
1254
|
-
onInit?: <C extends GenerateApiConfiguration["config"]>(configuration: C, codeGenProcess: CodeGenProcess_2) => C | undefined;
|
|
1255
|
-
/** customize configuration object before sending it to ETA templates */
|
|
1256
|
-
onPrepareConfig?: <C extends GenerateApiConfiguration>(currentConfiguration: C) => C | undefined;
|
|
1257
|
-
/** customize route name as you need */
|
|
1258
|
-
onCreateRouteName?: (routeNameInfo: RouteNameInfo, rawRouteInfo: RawRouteInfo) => RouteNameInfo | undefined;
|
|
1259
|
-
/** customize request params (path params, query params) */
|
|
1260
|
-
onCreateRequestParams?: (rawType: SchemaComponent["rawTypeData"]) => SchemaComponent["rawTypeData"] | undefined;
|
|
1261
|
-
/** customize name of model type */
|
|
1262
|
-
onFormatTypeName?: (typeName: string, rawTypeName?: string, schemaType?: "type-name" | "enum-key") => string | undefined;
|
|
1263
|
-
/** customize name of route (operationId), you can do it with using onCreateRouteName too */
|
|
1264
|
-
onFormatRouteName?: (routeInfo: RawRouteInfo, templateRouteName: string) => string | undefined;
|
|
1265
|
-
}
|
|
1266
|
-
|
|
1267
|
-
export declare const HTTP_CLIENT: {
|
|
1268
|
-
readonly FETCH: "fetch";
|
|
1269
|
-
readonly AXIOS: "axios";
|
|
1270
|
-
};
|
|
1271
|
-
|
|
1272
|
-
export declare type HttpClientType = (typeof HTTP_CLIENT)[keyof typeof HTTP_CLIENT];
|
|
1273
|
-
|
|
1274
|
-
export declare function internalCase(value: string): string;
|
|
1275
|
-
|
|
1276
|
-
export declare class JavascriptTranslator extends Translator {
|
|
1277
|
-
compileTSCode: (input: TranslatorIO) => Record<string, string>;
|
|
1278
|
-
translate: (input: any) => Promise<{
|
|
1279
|
-
fileName: any;
|
|
1280
|
-
fileExtension: typescript.Extension;
|
|
1281
|
-
fileContent: string;
|
|
1282
|
-
}[]>;
|
|
1283
|
-
}
|
|
1284
|
-
|
|
1285
|
-
declare type MAIN_SCHEMA_TYPES = SCHEMA_TYPES_alias_1.PRIMITIVE | SCHEMA_TYPES_alias_1.OBJECT | SCHEMA_TYPES_alias_1.ENUM;
|
|
1286
|
-
|
|
1287
|
-
export declare type ModelType = {
|
|
1288
|
-
typeIdentifier: string;
|
|
1289
|
-
name: string;
|
|
1290
|
-
rawContent: string;
|
|
1291
|
-
description: string;
|
|
1292
|
-
content: string;
|
|
1293
|
-
};
|
|
1294
|
-
|
|
1295
|
-
export declare class MonoSchemaParser {
|
|
1296
|
-
schema: any;
|
|
1297
|
-
typeName: any;
|
|
1298
|
-
schemaPath: never[];
|
|
1299
|
-
schemaParser: SchemaParser;
|
|
1300
|
-
schemaParserFabric: SchemaParserFabric;
|
|
1301
|
-
typeNameFormatter: TypeNameFormatter;
|
|
1302
|
-
schemaComponentsMap: SchemaComponentsMap;
|
|
1303
|
-
schemaUtils: SchemaUtils;
|
|
1304
|
-
config: CodeGenConfig;
|
|
1305
|
-
schemaFormatters: SchemaFormatters;
|
|
1306
|
-
constructor(schemaParser: SchemaParser, schema: any, typeName?: null, schemaPath?: never[]);
|
|
1307
|
-
parse(): void;
|
|
1308
|
-
buildTypeNameFromPath: () => Capitalize<string> | null;
|
|
1309
|
-
}
|
|
1310
|
-
|
|
1311
|
-
export declare class NameResolver {
|
|
1312
|
-
reservedNames: string[];
|
|
1313
|
-
getFallbackName: Resolver;
|
|
1314
|
-
config: CodeGenConfig;
|
|
1315
|
-
constructor(config: CodeGenConfig, reservedNames: string[], getFallbackName: Resolver);
|
|
1316
|
-
reserve(names: string[]): void;
|
|
1317
|
-
unreserve(names: string[]): void;
|
|
1318
|
-
isReserved(name: string): boolean;
|
|
1319
|
-
resolve(variants: string[], resolver?: Resolver, extras?: string[], shouldReserve?: boolean): string | null;
|
|
1320
|
-
}
|
|
1321
|
-
|
|
1322
|
-
export declare class NotSchemaParser extends MonoSchemaParser {
|
|
1323
|
-
parse(): string;
|
|
1324
|
-
}
|
|
1325
|
-
|
|
1326
|
-
export declare const objectAssign: (target: object, updater: Updater | unknown) => void;
|
|
1327
|
-
|
|
1328
|
-
export declare class ObjectSchemaParser extends MonoSchemaParser {
|
|
1329
|
-
parse(): any;
|
|
1330
|
-
getObjectSchemaContent: (schema: any) => any[];
|
|
1331
|
-
}
|
|
1332
|
-
|
|
1333
|
-
export declare class OneOfSchemaParser extends MonoSchemaParser {
|
|
1334
|
-
parse(): any;
|
|
1335
|
-
}
|
|
1336
|
-
|
|
1337
|
-
export declare interface ParsedRoute {
|
|
1338
|
-
id: string;
|
|
1339
|
-
namespace: string;
|
|
1340
|
-
routeParams?: Record<string, any>;
|
|
1341
|
-
requestBodyInfo?: {
|
|
1342
|
-
paramName: any;
|
|
1343
|
-
contentTypes: any[];
|
|
1344
|
-
contentKind: string;
|
|
1345
|
-
schema: any;
|
|
1346
|
-
type: any;
|
|
1347
|
-
required: any;
|
|
1348
|
-
};
|
|
1349
|
-
responseBodyInfo?: {
|
|
1350
|
-
contentTypes: any[];
|
|
1351
|
-
responses: any[];
|
|
1352
|
-
success?: Record<string, any>;
|
|
1353
|
-
error?: Record<string, any>;
|
|
1354
|
-
full?: Record<string, any>;
|
|
1355
|
-
};
|
|
1356
|
-
specificArgs?: Record<string, any>;
|
|
1357
|
-
queryObjectSchema?: Record<string, any>;
|
|
1358
|
-
pathObjectSchema?: Record<string, any>;
|
|
1359
|
-
headersObjectSchema?: Record<string, any>;
|
|
1360
|
-
responseBodySchema?: Record<string, any>;
|
|
1361
|
-
requestBodySchema?: Record<string, any>;
|
|
1362
|
-
specificArgNameResolver?: Record<string, any>;
|
|
1363
|
-
request: ParsedRouteRequest;
|
|
1364
|
-
response: ParsedRouteResponse;
|
|
1365
|
-
routeName: RouteNameInfo;
|
|
1366
|
-
raw: RawRouteInfo;
|
|
1367
|
-
}
|
|
1368
|
-
|
|
1369
|
-
export declare interface ParsedRouteRequest {
|
|
1370
|
-
contentTypes?: string[];
|
|
1371
|
-
formData?: boolean;
|
|
1372
|
-
headers?: {
|
|
1373
|
-
name: string | null;
|
|
1374
|
-
optional: boolean | undefined;
|
|
1375
|
-
type: Record<string, any>;
|
|
1376
|
-
};
|
|
1377
|
-
isQueryBody?: boolean;
|
|
1378
|
-
method?: string;
|
|
1379
|
-
parameters?: Record<string, unknown>[];
|
|
1380
|
-
path?: string;
|
|
1381
|
-
pathParams?: Record<string, unknown>;
|
|
1382
|
-
payload?: {
|
|
1383
|
-
name: string | null;
|
|
1384
|
-
optional?: boolean;
|
|
1385
|
-
type: string;
|
|
1386
|
-
};
|
|
1387
|
-
query?: Record<string, unknown>;
|
|
1388
|
-
requestParams?: Record<string, unknown> | null;
|
|
1389
|
-
security?: boolean;
|
|
1390
|
-
}
|
|
1391
|
-
|
|
1392
|
-
export declare interface ParsedRouteResponse {
|
|
1393
|
-
contentTypes?: string[];
|
|
1394
|
-
errorType?: string;
|
|
1395
|
-
fullTypes?: string;
|
|
1396
|
-
type?: string;
|
|
1397
|
-
}
|
|
1398
|
-
|
|
1399
|
-
export declare interface ParsedSchema<C> {
|
|
1400
|
-
$parsedSchema: boolean;
|
|
1401
|
-
schemaType: string;
|
|
1402
|
-
type: string;
|
|
1403
|
-
typeIdentifier: string;
|
|
1404
|
-
name: string;
|
|
1405
|
-
description?: string;
|
|
1406
|
-
allFieldsAreOptional?: boolean;
|
|
1407
|
-
content: C;
|
|
1408
|
-
isExtractedRequestParams?: boolean;
|
|
1409
|
-
isExtractedRequestBody?: boolean;
|
|
1410
|
-
isExtractedResponseBody?: boolean;
|
|
1411
|
-
isExtractedResponseError?: boolean;
|
|
1412
|
-
}
|
|
1413
|
-
|
|
1414
|
-
export declare function pascalCase(value: string): Capitalize<string>;
|
|
1415
|
-
|
|
1416
|
-
export declare interface PathArgInfo {
|
|
1417
|
-
name: string;
|
|
1418
|
-
optional: boolean;
|
|
1419
|
-
type: string;
|
|
1420
|
-
description?: string;
|
|
1421
|
-
}
|
|
1422
|
-
|
|
1423
|
-
export declare class PrimitiveSchemaParser extends MonoSchemaParser {
|
|
1424
|
-
parse(): any;
|
|
1425
|
-
}
|
|
1426
|
-
|
|
1427
|
-
declare type PrimitiveTypeStruct = Record<"integer" | "number" | "boolean" | "object" | "file" | "string" | "array", string | ({
|
|
1428
|
-
$default: PrimitiveTypeStructValue;
|
|
1429
|
-
} & Record<string, PrimitiveTypeStructValue>)>;
|
|
1430
|
-
|
|
1431
|
-
declare type PrimitiveTypeStructValue = string | ((schema: Record<string, unknown>, parser: SchemaParser_2) => string);
|
|
1432
|
-
|
|
1433
|
-
export declare const PROJECT_VERSION: string;
|
|
1434
|
-
|
|
1435
|
-
export declare type RawRouteInfo = {
|
|
1436
|
-
operationId: string;
|
|
1437
|
-
method: string;
|
|
1438
|
-
route: string;
|
|
1439
|
-
moduleName: string;
|
|
1440
|
-
responsesTypes: RequestResponseInfo[];
|
|
1441
|
-
description?: string;
|
|
1442
|
-
tags?: string[];
|
|
1443
|
-
summary?: string;
|
|
1444
|
-
responses?: Spec["responses"];
|
|
1445
|
-
produces?: string[];
|
|
1446
|
-
requestBody?: object;
|
|
1447
|
-
consumes?: string[];
|
|
1448
|
-
};
|
|
1449
|
-
|
|
1450
|
-
declare class Request_2 {
|
|
1451
|
-
config: CodeGenConfig;
|
|
1452
|
-
constructor(config: CodeGenConfig);
|
|
1453
|
-
download({ url, authToken, ...options }: {
|
|
1454
|
-
url: string;
|
|
1455
|
-
authToken?: string;
|
|
1456
|
-
options?: Partial<RequestInit>;
|
|
1457
|
-
}): Promise<string>;
|
|
1458
|
-
}
|
|
1459
|
-
export { Request_2 as Request }
|
|
1460
|
-
|
|
1461
|
-
export declare enum RequestContentKind {
|
|
1462
|
-
JSON = "JSON",
|
|
1463
|
-
URL_ENCODED = "URL_ENCODED",
|
|
1464
|
-
FORM_DATA = "FORM_DATA",
|
|
1465
|
-
IMAGE = "IMAGE",
|
|
1466
|
-
OTHER = "OTHER",
|
|
1467
|
-
TEXT = "TEXT"
|
|
1468
|
-
}
|
|
1469
|
-
|
|
1470
|
-
export declare interface RequestResponseInfo {
|
|
1471
|
-
contentTypes: string[];
|
|
1472
|
-
contentKind: RequestContentKind;
|
|
1473
|
-
type: string;
|
|
1474
|
-
description: string;
|
|
1475
|
-
status: string | number;
|
|
1476
|
-
isSuccess: boolean;
|
|
1477
|
-
}
|
|
1478
|
-
|
|
1479
|
-
export declare const RESERVED_BODY_ARG_NAMES: string[];
|
|
1480
|
-
|
|
1481
|
-
export declare const RESERVED_HEADER_ARG_NAMES: string[];
|
|
1482
|
-
|
|
1483
|
-
export declare const RESERVED_PATH_ARG_NAMES: string[];
|
|
1484
|
-
|
|
1485
|
-
export declare const RESERVED_QUERY_ARG_NAMES: string[];
|
|
1486
|
-
|
|
1487
|
-
export declare const RESERVED_REQ_PARAMS_ARG_NAMES: string[];
|
|
1488
|
-
|
|
1489
|
-
declare type Resolver = (reserved: string[], extras?: string[]) => string;
|
|
1490
|
-
|
|
1491
|
-
export declare type RouteNameInfo = {
|
|
1492
|
-
usage: string;
|
|
1493
|
-
original: string;
|
|
1494
|
-
duplicate: boolean;
|
|
1495
|
-
};
|
|
1496
|
-
|
|
1497
|
-
export declare type RouteNameRouteInfo = Record<string, unknown>;
|
|
1498
|
-
|
|
1499
|
-
declare interface Schema {
|
|
1500
|
-
name: string;
|
|
1501
|
-
filePath: string;
|
|
1502
|
-
}
|
|
1503
|
-
|
|
1504
|
-
export declare const SCHEMA_TYPES: {
|
|
1505
|
-
readonly ARRAY: "array";
|
|
1506
|
-
readonly OBJECT: "object";
|
|
1507
|
-
readonly ENUM: "enum";
|
|
1508
|
-
readonly REF: "$ref";
|
|
1509
|
-
readonly PRIMITIVE: "primitive";
|
|
1510
|
-
readonly COMPLEX: "complex";
|
|
1511
|
-
readonly DISCRIMINATOR: "discriminator";
|
|
1512
|
-
readonly COMPLEX_ONE_OF: "oneOf";
|
|
1513
|
-
readonly COMPLEX_ANY_OF: "anyOf";
|
|
1514
|
-
readonly COMPLEX_ALL_OF: "allOf";
|
|
1515
|
-
readonly COMPLEX_NOT: "not";
|
|
1516
|
-
readonly COMPLEX_UNKNOWN: "__unknown";
|
|
1517
|
-
};
|
|
1518
|
-
|
|
1519
|
-
export declare enum SCHEMA_TYPES_alias_1 {
|
|
1520
|
-
ARRAY = "array",
|
|
1521
|
-
OBJECT = "object",
|
|
1522
|
-
ENUM = "enum",
|
|
1523
|
-
REF = "$ref",
|
|
1524
|
-
PRIMITIVE = "primitive",
|
|
1525
|
-
COMPLEX = "complex",
|
|
1526
|
-
COMPLEX_ONE_OF = "oneOf",
|
|
1527
|
-
COMPLEX_ANY_OF = "anyOf",
|
|
1528
|
-
COMPLEX_ALL_OF = "allOf",
|
|
1529
|
-
COMPLEX_NOT = "not",
|
|
1530
|
-
COMPLEX_UNKNOWN = "__unknown"
|
|
1531
|
-
}
|
|
1532
|
-
|
|
1533
|
-
export declare interface SchemaComponent {
|
|
1534
|
-
$ref: string;
|
|
1535
|
-
typeName: string;
|
|
1536
|
-
rawTypeData?: {
|
|
1537
|
-
type: string;
|
|
1538
|
-
required?: string[];
|
|
1539
|
-
properties?: Record<string, {
|
|
1540
|
-
name?: string;
|
|
1541
|
-
type: string;
|
|
1542
|
-
required: boolean;
|
|
1543
|
-
$parsed?: SchemaTypePrimitiveContent;
|
|
1544
|
-
}>;
|
|
1545
|
-
discriminator?: {
|
|
1546
|
-
propertyName?: string;
|
|
1547
|
-
};
|
|
1548
|
-
$parsed: ParsedSchema<SchemaTypeObjectContent | SchemaTypeEnumContent | SchemaTypePrimitiveContent>;
|
|
1549
|
-
};
|
|
1550
|
-
componentName: "schemas" | "paths";
|
|
1551
|
-
typeData: ParsedSchema<SchemaTypeObjectContent | SchemaTypeEnumContent | SchemaTypePrimitiveContent> | null;
|
|
1552
|
-
}
|
|
1553
|
-
|
|
1554
|
-
export declare class SchemaComponentsMap {
|
|
1555
|
-
_data: SchemaComponent[];
|
|
1556
|
-
config: CodeGenConfig;
|
|
1557
|
-
constructor(config: CodeGenConfig);
|
|
1558
|
-
clear(): void;
|
|
1559
|
-
createRef: (paths: string[]) => string;
|
|
1560
|
-
parseRef: (ref: string) => string[];
|
|
1561
|
-
createComponent($ref: string, rawTypeData: SchemaComponent["rawTypeData"]): SchemaComponent;
|
|
1562
|
-
getComponents(): SchemaComponent[];
|
|
1563
|
-
filter(...componentNames: (string[] | string)[]): SchemaComponent[];
|
|
1564
|
-
get($ref: string): SchemaComponent | null;
|
|
1565
|
-
}
|
|
1566
|
-
|
|
1567
|
-
export declare class SchemaFormatters {
|
|
1568
|
-
config: CodeGenConfig;
|
|
1569
|
-
templatesWorker: TemplatesWorker;
|
|
1570
|
-
schemaUtils: SchemaUtils;
|
|
1571
|
-
constructor(schemaParser: SchemaParser | SchemaParserFabric);
|
|
1572
|
-
base: {
|
|
1573
|
-
enum: (parsedSchema: any) => any;
|
|
1574
|
-
object: (parsedSchema: any) => any;
|
|
1575
|
-
primitive: (parsedSchema: any) => any;
|
|
1576
|
-
};
|
|
1577
|
-
inline: {
|
|
1578
|
-
enum: (parsedSchema: any) => any;
|
|
1579
|
-
object: (parsedSchema: any) => any;
|
|
1580
|
-
};
|
|
1581
|
-
formatSchema: (parsedSchema: Record<string, any>, formatType?: "base" | "inline") => any;
|
|
1582
|
-
formatDescription: (description: any, inline: any) => any;
|
|
1583
|
-
formatObjectContent: (content: any) => string;
|
|
1584
|
-
}
|
|
1585
|
-
|
|
1586
|
-
export declare class SchemaParser {
|
|
1587
|
-
schemaParserFabric: SchemaParserFabric;
|
|
1588
|
-
config: CodeGenConfig;
|
|
1589
|
-
schemaComponentsMap: SchemaComponentsMap;
|
|
1590
|
-
typeNameFormatter: TypeNameFormatter;
|
|
1591
|
-
schemaFormatters: SchemaFormatters;
|
|
1592
|
-
schemaUtils: SchemaUtils;
|
|
1593
|
-
templatesWorker: TemplatesWorker;
|
|
1594
|
-
schemaWalker: SchemaWalker;
|
|
1595
|
-
typeName: any;
|
|
1596
|
-
schema: any;
|
|
1597
|
-
schemaPath: never[];
|
|
1598
|
-
constructor(schemaParserFabric: any, { typeName, schema, schemaPath }?: {});
|
|
1599
|
-
_complexSchemaParsers: {
|
|
1600
|
-
oneOf: (schema: any) => any;
|
|
1601
|
-
allOf: (schema: any) => any;
|
|
1602
|
-
anyOf: (schema: any) => any;
|
|
1603
|
-
not: (schema: any) => any;
|
|
1604
|
-
};
|
|
1605
|
-
_baseSchemaParsers: {
|
|
1606
|
-
enum: (schema: any, typeName: any) => any;
|
|
1607
|
-
object: (schema: any, typeName: any) => any;
|
|
1608
|
-
complex: (schema: any, typeName: any) => any;
|
|
1609
|
-
primitive: (schema: any, typeName: any) => any;
|
|
1610
|
-
discriminator: (schema: any, typeName: any) => any;
|
|
1611
|
-
array: (schema: any, typeName: any) => any;
|
|
1612
|
-
};
|
|
1613
|
-
parseSchema: () => any;
|
|
1614
|
-
getInlineParseContent: () => any;
|
|
1615
|
-
getParseContent: () => any;
|
|
1616
|
-
extractSchemaFromResponseStruct: (responseStruct: any) => any;
|
|
1617
|
-
}
|
|
1618
|
-
|
|
1619
|
-
export declare class SchemaParserFabric {
|
|
1620
|
-
config: CodeGenConfig;
|
|
1621
|
-
schemaComponentsMap: SchemaComponentsMap;
|
|
1622
|
-
typeNameFormatter: TypeNameFormatter;
|
|
1623
|
-
schemaFormatters: SchemaFormatters;
|
|
1624
|
-
templatesWorker: TemplatesWorker;
|
|
1625
|
-
schemaUtils: SchemaUtils;
|
|
1626
|
-
schemaWalker: SchemaWalker;
|
|
1627
|
-
constructor(config: CodeGenConfig, templatesWorker: TemplatesWorker, schemaComponentsMap: SchemaComponentsMap, typeNameFormatter: TypeNameFormatter, schemaWalker: SchemaWalker);
|
|
1628
|
-
createSchemaParser: ({ schema, typeName, schemaPath }: {
|
|
1629
|
-
schema: any;
|
|
1630
|
-
typeName: any;
|
|
1631
|
-
schemaPath: any;
|
|
1632
|
-
}) => SchemaParser;
|
|
1633
|
-
createSchema: ({ content, linkedSchema, linkedComponent, schemaPath, ...otherSchemaProps }: {
|
|
1634
|
-
[x: string]: any;
|
|
1635
|
-
content: any;
|
|
1636
|
-
linkedSchema?: {} | undefined;
|
|
1637
|
-
linkedComponent: any;
|
|
1638
|
-
schemaPath: any;
|
|
1639
|
-
}) => any;
|
|
1640
|
-
createParsedComponent: ({ typeName, schema, schemaPath, }: {
|
|
1641
|
-
typeName: any;
|
|
1642
|
-
schema: any;
|
|
1643
|
-
schemaPath: any;
|
|
1644
|
-
}) => SchemaComponent;
|
|
1645
|
-
parseSchema: (schema: string, typeName?: string | null, schemaPath?: string[]) => ParsedSchema<SchemaTypeObjectContent | SchemaTypeEnumContent | SchemaTypePrimitiveContent>;
|
|
1646
|
-
getInlineParseContent: (schema: string, typeName: string | null, schemaPath: string[]) => Record<string, any>;
|
|
1647
|
-
getParseContent: (schema: string, typeName: string | null, schemaPath: string[]) => Record<string, any>;
|
|
1648
|
-
}
|
|
1649
|
-
|
|
1650
|
-
export declare class SchemaRoutes {
|
|
1651
|
-
config: CodeGenConfig;
|
|
1652
|
-
schemaParserFabric: SchemaParserFabric;
|
|
1653
|
-
schemaUtils: SchemaUtils;
|
|
1654
|
-
typeNameFormatter: TypeNameFormatter;
|
|
1655
|
-
schemaComponentsMap: SchemaComponentsMap;
|
|
1656
|
-
templatesWorker: TemplatesWorker;
|
|
1657
|
-
FORM_DATA_TYPES: string[];
|
|
1658
|
-
routes: ParsedRoute[];
|
|
1659
|
-
hasSecurityRoutes: boolean;
|
|
1660
|
-
hasQueryRoutes: boolean;
|
|
1661
|
-
hasFormDataRoutes: boolean;
|
|
1662
|
-
constructor(config: CodeGenConfig, schemaParserFabric: SchemaParserFabric, schemaComponentsMap: SchemaComponentsMap, templatesWorker: TemplatesWorker, typeNameFormatter: TypeNameFormatter);
|
|
1663
|
-
createRequestsMap: (routeInfoByMethodsMap: any) => {};
|
|
1664
|
-
parseRouteName: (originalRouteName: any) => {
|
|
1665
|
-
originalRoute: string;
|
|
1666
|
-
route: string;
|
|
1667
|
-
pathParams: {
|
|
1668
|
-
$match: string;
|
|
1669
|
-
name: string;
|
|
1670
|
-
required: boolean;
|
|
1671
|
-
type: "string";
|
|
1672
|
-
description: string;
|
|
1673
|
-
schema: {
|
|
1674
|
-
type: string;
|
|
1675
|
-
};
|
|
1676
|
-
in: "path" | "query";
|
|
1677
|
-
}[];
|
|
1678
|
-
queryParams: {
|
|
1679
|
-
$match: string;
|
|
1680
|
-
name: string;
|
|
1681
|
-
required: boolean;
|
|
1682
|
-
type: "string";
|
|
1683
|
-
description: string;
|
|
1684
|
-
schema: {
|
|
1685
|
-
type: string;
|
|
1686
|
-
};
|
|
1687
|
-
in: "path" | "query";
|
|
1688
|
-
}[];
|
|
1689
|
-
} | {
|
|
1690
|
-
originalRoute: any;
|
|
1691
|
-
route: any;
|
|
1692
|
-
pathParams: never[];
|
|
1693
|
-
queryParams: {
|
|
1694
|
-
$match: unknown;
|
|
1695
|
-
name: string;
|
|
1696
|
-
required: boolean;
|
|
1697
|
-
type: string;
|
|
1698
|
-
description: string;
|
|
1699
|
-
schema: {
|
|
1700
|
-
type: string;
|
|
1701
|
-
};
|
|
1702
|
-
in: string;
|
|
1703
|
-
}[];
|
|
1704
|
-
};
|
|
1705
|
-
getRouteParams: (routeInfo: any, pathParamsFromRouteName: any, queryParamsFromRouteName: any) => {
|
|
1706
|
-
path: never[];
|
|
1707
|
-
header: never[];
|
|
1708
|
-
body: never[];
|
|
1709
|
-
query: never[];
|
|
1710
|
-
formData: never[];
|
|
1711
|
-
cookie: never[];
|
|
1712
|
-
};
|
|
1713
|
-
getContentTypes: (requestInfo: any, extraContentTypes: any) => any[];
|
|
1714
|
-
getContentKind: (contentTypes: any) => string;
|
|
1715
|
-
isSuccessStatus: (status: any) => boolean;
|
|
1716
|
-
getSchemaFromRequestType: (requestInfo: any) => any;
|
|
1717
|
-
getTypeFromRequestInfo: ({ requestInfo, parsedSchemas, operationId, defaultType, typeName, }: {
|
|
1718
|
-
requestInfo: any;
|
|
1719
|
-
parsedSchemas: any;
|
|
1720
|
-
operationId: any;
|
|
1721
|
-
defaultType: any;
|
|
1722
|
-
typeName: any;
|
|
1723
|
-
}) => any;
|
|
1724
|
-
getRequestInfoTypes: ({ requestInfos, parsedSchemas, operationId, defaultType, }: {
|
|
1725
|
-
requestInfos: any;
|
|
1726
|
-
parsedSchemas: any;
|
|
1727
|
-
operationId: any;
|
|
1728
|
-
defaultType: any;
|
|
1729
|
-
}) => never[];
|
|
1730
|
-
getResponseBodyInfo: (routeInfo: any, parsedSchemas: any) => {
|
|
1731
|
-
contentTypes: any[];
|
|
1732
|
-
responses: never[];
|
|
1733
|
-
success: {
|
|
1734
|
-
schema: undefined;
|
|
1735
|
-
type: any;
|
|
1736
|
-
};
|
|
1737
|
-
error: {
|
|
1738
|
-
schemas: never[];
|
|
1739
|
-
type: string;
|
|
1740
|
-
};
|
|
1741
|
-
full: {
|
|
1742
|
-
types: string;
|
|
1743
|
-
};
|
|
1744
|
-
};
|
|
1745
|
-
convertRouteParamsIntoObject: (params: any) => any;
|
|
1746
|
-
getRequestBodyInfo: (routeInfo: any, routeParams: any, parsedSchemas: any, routeName: any) => {
|
|
1747
|
-
paramName: any;
|
|
1748
|
-
contentTypes: any[];
|
|
1749
|
-
contentKind: string;
|
|
1750
|
-
schema: any;
|
|
1751
|
-
type: any;
|
|
1752
|
-
required: any;
|
|
1753
|
-
};
|
|
1754
|
-
createRequestParamsSchema: ({ queryParams, queryObjectSchema, pathArgsSchemas, extractRequestParams, routeName, }: {
|
|
1755
|
-
queryParams: any;
|
|
1756
|
-
queryObjectSchema: any;
|
|
1757
|
-
pathArgsSchemas: any;
|
|
1758
|
-
extractRequestParams: any;
|
|
1759
|
-
routeName: any;
|
|
1760
|
-
}) => any;
|
|
1761
|
-
extractResponseBodyIfItNeeded: (routeInfo: any, responseBodyInfo: any, routeName: any) => void;
|
|
1762
|
-
extractResponseErrorIfItNeeded: (routeInfo: any, responseBodyInfo: any, routeName: any) => void;
|
|
1763
|
-
getRouteName: (rawRouteInfo: any) => RouteNameInfo_2;
|
|
1764
|
-
parseRouteInfo: (rawRouteName: any, routeInfo: any, method: any, usageSchema: any, parsedSchemas: any) => ParsedRoute;
|
|
1765
|
-
attachSchema: ({ usageSchema, parsedSchemas }: {
|
|
1766
|
-
usageSchema: any;
|
|
1767
|
-
parsedSchemas: any;
|
|
1768
|
-
}) => void;
|
|
1769
|
-
getGroupedRoutes: () => {
|
|
1770
|
-
outOfModule: ParsedRoute[];
|
|
1771
|
-
combined?: {
|
|
1772
|
-
moduleName: string;
|
|
1773
|
-
routes: ParsedRoute[];
|
|
1774
|
-
}[];
|
|
1775
|
-
};
|
|
1776
|
-
sortRoutes: (routes: ParsedRoute[]) => ParsedRoute[];
|
|
1777
|
-
}
|
|
1778
|
-
|
|
1779
|
-
export declare type SchemaTypeEnumContent = {
|
|
1780
|
-
key: string;
|
|
1781
|
-
type: string;
|
|
1782
|
-
value: string;
|
|
1783
|
-
};
|
|
1784
|
-
|
|
1785
|
-
export declare type SchemaTypeObjectContent = {
|
|
1786
|
-
$$raw: {
|
|
1787
|
-
type: string;
|
|
1788
|
-
required: boolean;
|
|
1789
|
-
$parsed: SchemaTypePrimitiveContent;
|
|
1790
|
-
};
|
|
1791
|
-
isRequired: boolean;
|
|
1792
|
-
field: string;
|
|
1793
|
-
}[];
|
|
1794
|
-
|
|
1795
|
-
export declare type SchemaTypePrimitiveContent = {
|
|
1796
|
-
$parsedSchema: boolean;
|
|
1797
|
-
schemaType: string;
|
|
1798
|
-
type: string;
|
|
1799
|
-
typeIdentifier: string;
|
|
1800
|
-
name?: unknown;
|
|
1801
|
-
description: string;
|
|
1802
|
-
content: string;
|
|
1803
|
-
};
|
|
1804
|
-
|
|
1805
|
-
export declare class SchemaUtils {
|
|
1806
|
-
config: CodeGenConfig;
|
|
1807
|
-
schemaComponentsMap: SchemaComponentsMap;
|
|
1808
|
-
typeNameFormatter: TypeNameFormatter;
|
|
1809
|
-
schemaWalker: SchemaWalker;
|
|
1810
|
-
constructor({ config, schemaComponentsMap, typeNameFormatter, schemaWalker, }: {
|
|
1811
|
-
config: any;
|
|
1812
|
-
schemaComponentsMap: any;
|
|
1813
|
-
typeNameFormatter: any;
|
|
1814
|
-
schemaWalker: any;
|
|
1815
|
-
});
|
|
1816
|
-
getRequiredProperties: (schema: any) => unknown[];
|
|
1817
|
-
isRefSchema: (schema: any) => boolean;
|
|
1818
|
-
getEnumNames: (schema: any) => any;
|
|
1819
|
-
getSchemaRefType: (schema: any) => SchemaComponent_2 | null;
|
|
1820
|
-
isPropertyRequired: (name: any, propertySchema: any, rootSchema: any) => any;
|
|
1821
|
-
isNullMissingInType: (schema: any, type: any) => any;
|
|
1822
|
-
safeAddNullToType: (schema: any, type: any) => any;
|
|
1823
|
-
getSchemaPrimitiveType: (rawSchema: any) => string | null | undefined;
|
|
1824
|
-
checkAndAddRequiredKeys: (schema: any, resultType: any) => any;
|
|
1825
|
-
makeAddRequiredToChildSchema: (parentSchema: any, childSchema: any) => any;
|
|
1826
|
-
filterSchemaContents: (contents: any, filterFn: any) => unknown[];
|
|
1827
|
-
resolveTypeName: (typeName: any, { suffixes, resolver, prefixes, shouldReserve }: {
|
|
1828
|
-
suffixes: any;
|
|
1829
|
-
resolver: any;
|
|
1830
|
-
prefixes: any;
|
|
1831
|
-
shouldReserve?: boolean | undefined;
|
|
1832
|
-
}) => string | null;
|
|
1833
|
-
getComplexType: (schema: any) => "oneOf" | "anyOf" | "allOf" | "not" | "__unknown";
|
|
1834
|
-
getInternalSchemaType: (schema: any) => "object" | "array" | "enum" | "primitive" | "complex" | "discriminator";
|
|
1835
|
-
getSchemaType: (schema: any) => any;
|
|
1836
|
-
buildTypeNameFromPath: (schemaPath: any) => Capitalize<string> | null;
|
|
1837
|
-
isConstantSchema(schema: any): boolean;
|
|
1838
|
-
formatJsValue: (value: any) => string;
|
|
1839
|
-
}
|
|
1840
|
-
|
|
1841
|
-
export declare class SchemaWalker {
|
|
1842
|
-
config: CodeGenConfig;
|
|
1843
|
-
swaggerSchemaResolver: SwaggerSchemaResolver;
|
|
1844
|
-
schemas: Map<string, OpenAPI.Document<{}>>;
|
|
1845
|
-
caches: Map<string, OpenAPI.Document<{}>>;
|
|
1846
|
-
constructor(config: CodeGenConfig, swaggerSchemaResolver: SwaggerSchemaResolver);
|
|
1847
|
-
addSchema: (name: string, schema: OpenAPI.Document) => void;
|
|
1848
|
-
_isLocalRef: (ref: string) => boolean;
|
|
1849
|
-
_isRemoteRef: (ref: string) => boolean;
|
|
1850
|
-
_getRefDataFromSchema: (schema: Record<string, unknown>, ref: string) => any;
|
|
1851
|
-
}
|
|
1852
|
-
|
|
1853
|
-
export declare const sortByProperty: (propertyName: string) => (o1: Record<string, any>, o2: Record<string, any>) => 1 | -1 | 0;
|
|
1854
|
-
|
|
1855
|
-
export declare class SpecificArgNameResolver extends NameResolver {
|
|
1856
|
-
counter: number;
|
|
1857
|
-
constructor(config: CodeGenConfig, reservedNames: string[]);
|
|
1858
|
-
}
|
|
1859
|
-
|
|
1860
|
-
export declare class SwaggerSchemaResolver {
|
|
1861
|
-
config: CodeGenConfig;
|
|
1862
|
-
fileSystem: FileSystem;
|
|
1863
|
-
request: Request_2;
|
|
1864
|
-
constructor(config: CodeGenConfig, fileSystem: FileSystem);
|
|
1865
|
-
create(): Promise<{
|
|
1866
|
-
usageSchema: OpenAPI.Document;
|
|
1867
|
-
originalSchema: OpenAPI.Document;
|
|
1868
|
-
}>;
|
|
1869
|
-
convertSwaggerObject(swaggerSchema: OpenAPI.Document, converterOptions: {
|
|
1870
|
-
patch?: boolean;
|
|
1871
|
-
}): Promise<{
|
|
1872
|
-
usageSchema: OpenAPI.Document;
|
|
1873
|
-
originalSchema: OpenAPI.Document;
|
|
1874
|
-
}>;
|
|
1875
|
-
getSwaggerSchemaByPath: (pathToSwagger: string) => string;
|
|
1876
|
-
fetchSwaggerSchemaFile(pathToSwagger: string, urlToSwagger: string, authToken?: string): Promise<string>;
|
|
1877
|
-
processSwaggerSchemaFile(file: string): any;
|
|
1878
|
-
fixSwaggerSchema({ usageSchema, originalSchema }: {
|
|
1879
|
-
usageSchema: any;
|
|
1880
|
-
originalSchema: any;
|
|
1881
|
-
}): void;
|
|
1882
|
-
}
|
|
1883
|
-
|
|
1884
|
-
export declare class TemplatesGenConfig {
|
|
1885
|
-
cleanOutput: boolean;
|
|
1886
|
-
debug: boolean;
|
|
1887
|
-
httpClientType: HttpClientType;
|
|
1888
|
-
modular: boolean;
|
|
1889
|
-
output: undefined;
|
|
1890
|
-
rewrite: boolean;
|
|
1891
|
-
silent: boolean;
|
|
1892
|
-
version: string;
|
|
1893
|
-
constructor(config: GenerateTemplatesParams);
|
|
1894
|
-
update: (update: Partial<GenerateTemplatesParams>) => void;
|
|
1895
|
-
}
|
|
1896
|
-
|
|
1897
|
-
export declare class TemplatesGenProcess {
|
|
1898
|
-
config: TemplatesGenConfig;
|
|
1899
|
-
fileSystem: FileSystem;
|
|
1900
|
-
rootDir: string;
|
|
1901
|
-
paths: {
|
|
1902
|
-
baseTemplates: string;
|
|
1903
|
-
httpClientTemplates: string;
|
|
1904
|
-
moduleApiTemplates: string;
|
|
1905
|
-
defaultApiTemplates: string;
|
|
1906
|
-
};
|
|
1907
|
-
importTemplatePrefixes: string[];
|
|
1908
|
-
constructor(config: GenerateTemplatesParams);
|
|
1909
|
-
start(): Promise<GenerateTemplatesOutput>;
|
|
1910
|
-
getTemplates: () => {
|
|
1911
|
-
name: string;
|
|
1912
|
-
content: any;
|
|
1913
|
-
}[];
|
|
1914
|
-
fixTemplateContent: (content: any) => any;
|
|
1915
|
-
getTemplateNamesFromDir: (dir: any) => string[];
|
|
1916
|
-
getTemplateContent: (pathToFile: any) => string;
|
|
1917
|
-
}
|
|
1918
|
-
|
|
1919
|
-
export declare class TemplatesWorker {
|
|
1920
|
-
config: CodeGenConfig;
|
|
1921
|
-
fileSystem: FileSystem;
|
|
1922
|
-
getRenderTemplateData: CodeGenProcess["getRenderTemplateData"];
|
|
1923
|
-
constructor(config: CodeGenConfig, fileSystem: FileSystem, getRenderTemplateData: CodeGenProcess["getRenderTemplateData"]);
|
|
1924
|
-
getTemplatePaths: (config: CodeGenConfig) => CodeGenConfig["templatePaths"];
|
|
1925
|
-
cropExtension: (path: string) => string;
|
|
1926
|
-
getTemplateFullPath: (path_: string, fileName: string) => string | undefined;
|
|
1927
|
-
requireFnFromTemplate: (packageOrPath: string) => Promise<any>;
|
|
1928
|
-
getTemplate: (name: string, fileName: string, path?: string) => string | undefined;
|
|
1929
|
-
getTemplates: ({ templatePaths }: CodeGenConfig) => {};
|
|
1930
|
-
findTemplateWithExt: (path: string) => string | undefined;
|
|
1931
|
-
getTemplateContent: (path_: string) => string;
|
|
1932
|
-
renderTemplate: (template: string, configuration: object, options?: object) => string;
|
|
1933
|
-
}
|
|
1934
|
-
|
|
1935
|
-
export declare class Translator {
|
|
1936
|
-
config: CodeGenConfig;
|
|
1937
|
-
codeFormatter: CodeFormatter;
|
|
1938
|
-
constructor(config: CodeGenConfig, codeFormatter: CodeFormatter);
|
|
1939
|
-
translate(_input: TranslatorIO): Promise<TranslatorIO[]>;
|
|
1940
|
-
}
|
|
1941
|
-
|
|
1942
|
-
export declare interface TranslatorIO {
|
|
1943
|
-
fileName: string;
|
|
1944
|
-
fileExtension: string;
|
|
1945
|
-
fileContent: string;
|
|
1946
|
-
}
|
|
1947
|
-
|
|
1948
|
-
export declare class TypeNameFormatter {
|
|
1949
|
-
formattedModelNamesMap: Map<string, string>;
|
|
1950
|
-
config: CodeGenConfig;
|
|
1951
|
-
constructor(config: CodeGenConfig);
|
|
1952
|
-
format: (name: string, options?: {
|
|
1953
|
-
type?: FormattingSchemaType;
|
|
1954
|
-
}) => string | undefined;
|
|
1955
|
-
isValidName: (name: string) => boolean;
|
|
1956
|
-
fixModelName: (name: string, options: {
|
|
1957
|
-
type?: FormattingSchemaType;
|
|
1958
|
-
}) => string;
|
|
1959
|
-
}
|
|
1960
|
-
|
|
1961
|
-
declare type Updater = (target: unknown) => unknown;
|
|
1962
|
-
|
|
1963
|
-
export { }
|