@gopowerteam/request-generate 0.3.1 → 0.3.3
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/dist/index.mjs +1 -13
- package/package.json +6 -9
- package/dist/chunk-C0xms8kb.cjs +0 -34
- package/dist/index.cjs +0 -1109
- package/dist/index.d.cts +0 -739
- package/dist/vite-plugin/index.cjs +0 -238
- package/dist/vite-plugin/index.d.cts +0 -13
- /package/dist/templates/{templates/export-model.hbs → export-model.hbs} +0 -0
- /package/dist/templates/{templates/export-service.hbs → export-service.hbs} +0 -0
- /package/dist/templates/{templates/partials → partials}/export-description.hbs +0 -0
- /package/dist/templates/{templates/partials → partials}/export-header.hbs +0 -0
- /package/dist/templates/{templates/partials → partials}/export-model-field.hbs +0 -0
- /package/dist/templates/{templates/partials → partials}/export-model-import.hbs +0 -0
- /package/dist/templates/{templates/partials → partials}/export-model-type.hbs +0 -0
- /package/dist/templates/{templates/partials → partials}/export-operation-params-body.hbs +0 -0
- /package/dist/templates/{templates/partials → partials}/export-operation-params-path.hbs +0 -0
- /package/dist/templates/{templates/partials → partials}/export-operation-params-query.hbs +0 -0
- /package/dist/templates/{templates/partials → partials}/export-operation-response.hbs +0 -0
- /package/dist/templates/{templates/partials → partials}/export-schema-type.hbs +0 -0
- /package/dist/templates/{templates/partials → partials}/export-service-class.hbs +0 -0
- /package/dist/templates/{templates/partials → partials}/export-service-import.hbs +0 -0
- /package/dist/templates/{templates/partials → partials}/export-service-namespace-type.hbs +0 -0
- /package/dist/templates/{templates/partials → partials}/export-service-namespace.hbs +0 -0
- /package/dist/templates/{templates/partials → partials}/export-service-operation.hbs +0 -0
- /package/dist/templates/{templates/partials → partials}/is-required.hbs +0 -0
package/dist/index.d.cts
DELETED
|
@@ -1,739 +0,0 @@
|
|
|
1
|
-
//#region ../../node_modules/.pnpm/openapi-types@12.1.3/node_modules/openapi-types/dist/index.d.ts
|
|
2
|
-
declare namespace OpenAPIV3 {
|
|
3
|
-
interface Document<T extends {} = {}> {
|
|
4
|
-
openapi: string;
|
|
5
|
-
info: InfoObject;
|
|
6
|
-
servers?: ServerObject[];
|
|
7
|
-
paths: PathsObject<T>;
|
|
8
|
-
components?: ComponentsObject;
|
|
9
|
-
security?: SecurityRequirementObject[];
|
|
10
|
-
tags?: TagObject[];
|
|
11
|
-
externalDocs?: ExternalDocumentationObject;
|
|
12
|
-
'x-express-openapi-additional-middleware'?: (((request: any, response: any, next: any) => Promise<void>) | ((request: any, response: any, next: any) => void))[];
|
|
13
|
-
'x-express-openapi-validation-strict'?: boolean;
|
|
14
|
-
}
|
|
15
|
-
interface InfoObject {
|
|
16
|
-
title: string;
|
|
17
|
-
description?: string;
|
|
18
|
-
termsOfService?: string;
|
|
19
|
-
contact?: ContactObject;
|
|
20
|
-
license?: LicenseObject;
|
|
21
|
-
version: string;
|
|
22
|
-
}
|
|
23
|
-
interface ContactObject {
|
|
24
|
-
name?: string;
|
|
25
|
-
url?: string;
|
|
26
|
-
email?: string;
|
|
27
|
-
}
|
|
28
|
-
interface LicenseObject {
|
|
29
|
-
name: string;
|
|
30
|
-
url?: string;
|
|
31
|
-
}
|
|
32
|
-
interface ServerObject {
|
|
33
|
-
url: string;
|
|
34
|
-
description?: string;
|
|
35
|
-
variables?: {
|
|
36
|
-
[variable: string]: ServerVariableObject;
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
interface ServerVariableObject {
|
|
40
|
-
enum?: string[];
|
|
41
|
-
default: string;
|
|
42
|
-
description?: string;
|
|
43
|
-
}
|
|
44
|
-
interface PathsObject<T extends {} = {}, P extends {} = {}> {
|
|
45
|
-
[pattern: string]: (PathItemObject<T> & P) | undefined;
|
|
46
|
-
}
|
|
47
|
-
enum HttpMethods {
|
|
48
|
-
GET = "get",
|
|
49
|
-
PUT = "put",
|
|
50
|
-
POST = "post",
|
|
51
|
-
DELETE = "delete",
|
|
52
|
-
OPTIONS = "options",
|
|
53
|
-
HEAD = "head",
|
|
54
|
-
PATCH = "patch",
|
|
55
|
-
TRACE = "trace"
|
|
56
|
-
}
|
|
57
|
-
type PathItemObject<T extends {} = {}> = {
|
|
58
|
-
$ref?: string;
|
|
59
|
-
summary?: string;
|
|
60
|
-
description?: string;
|
|
61
|
-
servers?: ServerObject[];
|
|
62
|
-
parameters?: (ReferenceObject | ParameterObject)[];
|
|
63
|
-
} & { [method in HttpMethods]?: OperationObject<T> };
|
|
64
|
-
type OperationObject<T extends {} = {}> = {
|
|
65
|
-
tags?: string[];
|
|
66
|
-
summary?: string;
|
|
67
|
-
description?: string;
|
|
68
|
-
externalDocs?: ExternalDocumentationObject;
|
|
69
|
-
operationId?: string;
|
|
70
|
-
parameters?: (ReferenceObject | ParameterObject)[];
|
|
71
|
-
requestBody?: ReferenceObject | RequestBodyObject;
|
|
72
|
-
responses: ResponsesObject;
|
|
73
|
-
callbacks?: {
|
|
74
|
-
[callback: string]: ReferenceObject | CallbackObject;
|
|
75
|
-
};
|
|
76
|
-
deprecated?: boolean;
|
|
77
|
-
security?: SecurityRequirementObject[];
|
|
78
|
-
servers?: ServerObject[];
|
|
79
|
-
} & T;
|
|
80
|
-
interface ExternalDocumentationObject {
|
|
81
|
-
description?: string;
|
|
82
|
-
url: string;
|
|
83
|
-
}
|
|
84
|
-
interface ParameterObject extends ParameterBaseObject {
|
|
85
|
-
name: string;
|
|
86
|
-
in: string;
|
|
87
|
-
}
|
|
88
|
-
interface HeaderObject extends ParameterBaseObject {}
|
|
89
|
-
interface ParameterBaseObject {
|
|
90
|
-
description?: string;
|
|
91
|
-
required?: boolean;
|
|
92
|
-
deprecated?: boolean;
|
|
93
|
-
allowEmptyValue?: boolean;
|
|
94
|
-
style?: string;
|
|
95
|
-
explode?: boolean;
|
|
96
|
-
allowReserved?: boolean;
|
|
97
|
-
schema?: ReferenceObject | SchemaObject;
|
|
98
|
-
example?: any;
|
|
99
|
-
examples?: {
|
|
100
|
-
[media: string]: ReferenceObject | ExampleObject;
|
|
101
|
-
};
|
|
102
|
-
content?: {
|
|
103
|
-
[media: string]: MediaTypeObject;
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
type NonArraySchemaObjectType = 'boolean' | 'object' | 'number' | 'string' | 'integer';
|
|
107
|
-
type ArraySchemaObjectType = 'array';
|
|
108
|
-
type SchemaObject = ArraySchemaObject | NonArraySchemaObject;
|
|
109
|
-
interface ArraySchemaObject extends BaseSchemaObject {
|
|
110
|
-
type: ArraySchemaObjectType;
|
|
111
|
-
items: ReferenceObject | SchemaObject;
|
|
112
|
-
}
|
|
113
|
-
interface NonArraySchemaObject extends BaseSchemaObject {
|
|
114
|
-
type?: NonArraySchemaObjectType;
|
|
115
|
-
}
|
|
116
|
-
interface BaseSchemaObject {
|
|
117
|
-
title?: string;
|
|
118
|
-
description?: string;
|
|
119
|
-
format?: string;
|
|
120
|
-
default?: any;
|
|
121
|
-
multipleOf?: number;
|
|
122
|
-
maximum?: number;
|
|
123
|
-
exclusiveMaximum?: boolean;
|
|
124
|
-
minimum?: number;
|
|
125
|
-
exclusiveMinimum?: boolean;
|
|
126
|
-
maxLength?: number;
|
|
127
|
-
minLength?: number;
|
|
128
|
-
pattern?: string;
|
|
129
|
-
additionalProperties?: boolean | ReferenceObject | SchemaObject;
|
|
130
|
-
maxItems?: number;
|
|
131
|
-
minItems?: number;
|
|
132
|
-
uniqueItems?: boolean;
|
|
133
|
-
maxProperties?: number;
|
|
134
|
-
minProperties?: number;
|
|
135
|
-
required?: string[];
|
|
136
|
-
enum?: any[];
|
|
137
|
-
properties?: {
|
|
138
|
-
[name: string]: ReferenceObject | SchemaObject;
|
|
139
|
-
};
|
|
140
|
-
allOf?: (ReferenceObject | SchemaObject)[];
|
|
141
|
-
oneOf?: (ReferenceObject | SchemaObject)[];
|
|
142
|
-
anyOf?: (ReferenceObject | SchemaObject)[];
|
|
143
|
-
not?: ReferenceObject | SchemaObject;
|
|
144
|
-
nullable?: boolean;
|
|
145
|
-
discriminator?: DiscriminatorObject;
|
|
146
|
-
readOnly?: boolean;
|
|
147
|
-
writeOnly?: boolean;
|
|
148
|
-
xml?: XMLObject;
|
|
149
|
-
externalDocs?: ExternalDocumentationObject;
|
|
150
|
-
example?: any;
|
|
151
|
-
deprecated?: boolean;
|
|
152
|
-
}
|
|
153
|
-
interface DiscriminatorObject {
|
|
154
|
-
propertyName: string;
|
|
155
|
-
mapping?: {
|
|
156
|
-
[value: string]: string;
|
|
157
|
-
};
|
|
158
|
-
}
|
|
159
|
-
interface XMLObject {
|
|
160
|
-
name?: string;
|
|
161
|
-
namespace?: string;
|
|
162
|
-
prefix?: string;
|
|
163
|
-
attribute?: boolean;
|
|
164
|
-
wrapped?: boolean;
|
|
165
|
-
}
|
|
166
|
-
interface ReferenceObject {
|
|
167
|
-
$ref: string;
|
|
168
|
-
}
|
|
169
|
-
interface ExampleObject {
|
|
170
|
-
summary?: string;
|
|
171
|
-
description?: string;
|
|
172
|
-
value?: any;
|
|
173
|
-
externalValue?: string;
|
|
174
|
-
}
|
|
175
|
-
interface MediaTypeObject {
|
|
176
|
-
schema?: ReferenceObject | SchemaObject;
|
|
177
|
-
example?: any;
|
|
178
|
-
examples?: {
|
|
179
|
-
[media: string]: ReferenceObject | ExampleObject;
|
|
180
|
-
};
|
|
181
|
-
encoding?: {
|
|
182
|
-
[media: string]: EncodingObject;
|
|
183
|
-
};
|
|
184
|
-
}
|
|
185
|
-
interface EncodingObject {
|
|
186
|
-
contentType?: string;
|
|
187
|
-
headers?: {
|
|
188
|
-
[header: string]: ReferenceObject | HeaderObject;
|
|
189
|
-
};
|
|
190
|
-
style?: string;
|
|
191
|
-
explode?: boolean;
|
|
192
|
-
allowReserved?: boolean;
|
|
193
|
-
}
|
|
194
|
-
interface RequestBodyObject {
|
|
195
|
-
description?: string;
|
|
196
|
-
content: {
|
|
197
|
-
[media: string]: MediaTypeObject;
|
|
198
|
-
};
|
|
199
|
-
required?: boolean;
|
|
200
|
-
}
|
|
201
|
-
interface ResponsesObject {
|
|
202
|
-
[code: string]: ReferenceObject | ResponseObject;
|
|
203
|
-
}
|
|
204
|
-
interface ResponseObject {
|
|
205
|
-
description: string;
|
|
206
|
-
headers?: {
|
|
207
|
-
[header: string]: ReferenceObject | HeaderObject;
|
|
208
|
-
};
|
|
209
|
-
content?: {
|
|
210
|
-
[media: string]: MediaTypeObject;
|
|
211
|
-
};
|
|
212
|
-
links?: {
|
|
213
|
-
[link: string]: ReferenceObject | LinkObject;
|
|
214
|
-
};
|
|
215
|
-
}
|
|
216
|
-
interface LinkObject {
|
|
217
|
-
operationRef?: string;
|
|
218
|
-
operationId?: string;
|
|
219
|
-
parameters?: {
|
|
220
|
-
[parameter: string]: any;
|
|
221
|
-
};
|
|
222
|
-
requestBody?: any;
|
|
223
|
-
description?: string;
|
|
224
|
-
server?: ServerObject;
|
|
225
|
-
}
|
|
226
|
-
interface CallbackObject {
|
|
227
|
-
[url: string]: PathItemObject;
|
|
228
|
-
}
|
|
229
|
-
interface SecurityRequirementObject {
|
|
230
|
-
[name: string]: string[];
|
|
231
|
-
}
|
|
232
|
-
interface ComponentsObject {
|
|
233
|
-
schemas?: {
|
|
234
|
-
[key: string]: ReferenceObject | SchemaObject;
|
|
235
|
-
};
|
|
236
|
-
responses?: {
|
|
237
|
-
[key: string]: ReferenceObject | ResponseObject;
|
|
238
|
-
};
|
|
239
|
-
parameters?: {
|
|
240
|
-
[key: string]: ReferenceObject | ParameterObject;
|
|
241
|
-
};
|
|
242
|
-
examples?: {
|
|
243
|
-
[key: string]: ReferenceObject | ExampleObject;
|
|
244
|
-
};
|
|
245
|
-
requestBodies?: {
|
|
246
|
-
[key: string]: ReferenceObject | RequestBodyObject;
|
|
247
|
-
};
|
|
248
|
-
headers?: {
|
|
249
|
-
[key: string]: ReferenceObject | HeaderObject;
|
|
250
|
-
};
|
|
251
|
-
securitySchemes?: {
|
|
252
|
-
[key: string]: ReferenceObject | SecuritySchemeObject;
|
|
253
|
-
};
|
|
254
|
-
links?: {
|
|
255
|
-
[key: string]: ReferenceObject | LinkObject;
|
|
256
|
-
};
|
|
257
|
-
callbacks?: {
|
|
258
|
-
[key: string]: ReferenceObject | CallbackObject;
|
|
259
|
-
};
|
|
260
|
-
}
|
|
261
|
-
type SecuritySchemeObject = HttpSecurityScheme | ApiKeySecurityScheme | OAuth2SecurityScheme | OpenIdSecurityScheme;
|
|
262
|
-
interface HttpSecurityScheme {
|
|
263
|
-
type: 'http';
|
|
264
|
-
description?: string;
|
|
265
|
-
scheme: string;
|
|
266
|
-
bearerFormat?: string;
|
|
267
|
-
}
|
|
268
|
-
interface ApiKeySecurityScheme {
|
|
269
|
-
type: 'apiKey';
|
|
270
|
-
description?: string;
|
|
271
|
-
name: string;
|
|
272
|
-
in: string;
|
|
273
|
-
}
|
|
274
|
-
interface OAuth2SecurityScheme {
|
|
275
|
-
type: 'oauth2';
|
|
276
|
-
description?: string;
|
|
277
|
-
flows: {
|
|
278
|
-
implicit?: {
|
|
279
|
-
authorizationUrl: string;
|
|
280
|
-
refreshUrl?: string;
|
|
281
|
-
scopes: {
|
|
282
|
-
[scope: string]: string;
|
|
283
|
-
};
|
|
284
|
-
};
|
|
285
|
-
password?: {
|
|
286
|
-
tokenUrl: string;
|
|
287
|
-
refreshUrl?: string;
|
|
288
|
-
scopes: {
|
|
289
|
-
[scope: string]: string;
|
|
290
|
-
};
|
|
291
|
-
};
|
|
292
|
-
clientCredentials?: {
|
|
293
|
-
tokenUrl: string;
|
|
294
|
-
refreshUrl?: string;
|
|
295
|
-
scopes: {
|
|
296
|
-
[scope: string]: string;
|
|
297
|
-
};
|
|
298
|
-
};
|
|
299
|
-
authorizationCode?: {
|
|
300
|
-
authorizationUrl: string;
|
|
301
|
-
tokenUrl: string;
|
|
302
|
-
refreshUrl?: string;
|
|
303
|
-
scopes: {
|
|
304
|
-
[scope: string]: string;
|
|
305
|
-
};
|
|
306
|
-
};
|
|
307
|
-
};
|
|
308
|
-
}
|
|
309
|
-
interface OpenIdSecurityScheme {
|
|
310
|
-
type: 'openIdConnect';
|
|
311
|
-
description?: string;
|
|
312
|
-
openIdConnectUrl: string;
|
|
313
|
-
}
|
|
314
|
-
interface TagObject {
|
|
315
|
-
name: string;
|
|
316
|
-
description?: string;
|
|
317
|
-
externalDocs?: ExternalDocumentationObject;
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
declare namespace OpenAPIV2 {
|
|
321
|
-
interface Document<T extends {} = {}> {
|
|
322
|
-
basePath?: string;
|
|
323
|
-
consumes?: MimeTypes;
|
|
324
|
-
definitions?: DefinitionsObject;
|
|
325
|
-
externalDocs?: ExternalDocumentationObject;
|
|
326
|
-
host?: string;
|
|
327
|
-
info: InfoObject;
|
|
328
|
-
parameters?: ParametersDefinitionsObject;
|
|
329
|
-
paths: PathsObject<T>;
|
|
330
|
-
produces?: MimeTypes;
|
|
331
|
-
responses?: ResponsesDefinitionsObject;
|
|
332
|
-
schemes?: string[];
|
|
333
|
-
security?: SecurityRequirementObject[];
|
|
334
|
-
securityDefinitions?: SecurityDefinitionsObject;
|
|
335
|
-
swagger: string;
|
|
336
|
-
tags?: TagObject[];
|
|
337
|
-
'x-express-openapi-additional-middleware'?: (((request: any, response: any, next: any) => Promise<void>) | ((request: any, response: any, next: any) => void))[];
|
|
338
|
-
'x-express-openapi-validation-strict'?: boolean;
|
|
339
|
-
}
|
|
340
|
-
interface TagObject {
|
|
341
|
-
name: string;
|
|
342
|
-
description?: string;
|
|
343
|
-
externalDocs?: ExternalDocumentationObject;
|
|
344
|
-
}
|
|
345
|
-
interface SecuritySchemeObjectBase {
|
|
346
|
-
type: 'basic' | 'apiKey' | 'oauth2';
|
|
347
|
-
description?: string;
|
|
348
|
-
}
|
|
349
|
-
interface SecuritySchemeBasic extends SecuritySchemeObjectBase {
|
|
350
|
-
type: 'basic';
|
|
351
|
-
}
|
|
352
|
-
interface SecuritySchemeApiKey extends SecuritySchemeObjectBase {
|
|
353
|
-
type: 'apiKey';
|
|
354
|
-
name: string;
|
|
355
|
-
in: string;
|
|
356
|
-
}
|
|
357
|
-
type SecuritySchemeOauth2 = SecuritySchemeOauth2Implicit | SecuritySchemeOauth2AccessCode | SecuritySchemeOauth2Password | SecuritySchemeOauth2Application;
|
|
358
|
-
interface ScopesObject {
|
|
359
|
-
[index: string]: any;
|
|
360
|
-
}
|
|
361
|
-
interface SecuritySchemeOauth2Base extends SecuritySchemeObjectBase {
|
|
362
|
-
type: 'oauth2';
|
|
363
|
-
flow: 'implicit' | 'password' | 'application' | 'accessCode';
|
|
364
|
-
scopes: ScopesObject;
|
|
365
|
-
}
|
|
366
|
-
interface SecuritySchemeOauth2Implicit extends SecuritySchemeOauth2Base {
|
|
367
|
-
flow: 'implicit';
|
|
368
|
-
authorizationUrl: string;
|
|
369
|
-
}
|
|
370
|
-
interface SecuritySchemeOauth2AccessCode extends SecuritySchemeOauth2Base {
|
|
371
|
-
flow: 'accessCode';
|
|
372
|
-
authorizationUrl: string;
|
|
373
|
-
tokenUrl: string;
|
|
374
|
-
}
|
|
375
|
-
interface SecuritySchemeOauth2Password extends SecuritySchemeOauth2Base {
|
|
376
|
-
flow: 'password';
|
|
377
|
-
tokenUrl: string;
|
|
378
|
-
}
|
|
379
|
-
interface SecuritySchemeOauth2Application extends SecuritySchemeOauth2Base {
|
|
380
|
-
flow: 'application';
|
|
381
|
-
tokenUrl: string;
|
|
382
|
-
}
|
|
383
|
-
type SecuritySchemeObject = SecuritySchemeBasic | SecuritySchemeApiKey | SecuritySchemeOauth2;
|
|
384
|
-
interface SecurityDefinitionsObject {
|
|
385
|
-
[index: string]: SecuritySchemeObject;
|
|
386
|
-
}
|
|
387
|
-
interface SecurityRequirementObject {
|
|
388
|
-
[index: string]: string[];
|
|
389
|
-
}
|
|
390
|
-
interface ReferenceObject {
|
|
391
|
-
$ref: string;
|
|
392
|
-
}
|
|
393
|
-
type Response = ResponseObject | ReferenceObject;
|
|
394
|
-
interface ResponsesDefinitionsObject {
|
|
395
|
-
[index: string]: ResponseObject;
|
|
396
|
-
}
|
|
397
|
-
type Schema = SchemaObject | ReferenceObject;
|
|
398
|
-
interface ResponseObject {
|
|
399
|
-
description: string;
|
|
400
|
-
schema?: Schema;
|
|
401
|
-
headers?: HeadersObject;
|
|
402
|
-
examples?: ExampleObject;
|
|
403
|
-
}
|
|
404
|
-
interface HeadersObject {
|
|
405
|
-
[index: string]: HeaderObject;
|
|
406
|
-
}
|
|
407
|
-
interface HeaderObject extends ItemsObject {
|
|
408
|
-
description?: string;
|
|
409
|
-
}
|
|
410
|
-
interface ExampleObject {
|
|
411
|
-
[index: string]: any;
|
|
412
|
-
}
|
|
413
|
-
interface ResponseObject {
|
|
414
|
-
description: string;
|
|
415
|
-
schema?: Schema;
|
|
416
|
-
headers?: HeadersObject;
|
|
417
|
-
examples?: ExampleObject;
|
|
418
|
-
}
|
|
419
|
-
type OperationObject<T extends {} = {}> = {
|
|
420
|
-
tags?: string[];
|
|
421
|
-
summary?: string;
|
|
422
|
-
description?: string;
|
|
423
|
-
externalDocs?: ExternalDocumentationObject;
|
|
424
|
-
operationId?: string;
|
|
425
|
-
consumes?: MimeTypes;
|
|
426
|
-
produces?: MimeTypes;
|
|
427
|
-
parameters?: Parameters;
|
|
428
|
-
responses: ResponsesObject;
|
|
429
|
-
schemes?: string[];
|
|
430
|
-
deprecated?: boolean;
|
|
431
|
-
security?: SecurityRequirementObject[];
|
|
432
|
-
} & T;
|
|
433
|
-
interface ResponsesObject {
|
|
434
|
-
[index: string]: Response | undefined;
|
|
435
|
-
default?: Response;
|
|
436
|
-
}
|
|
437
|
-
type Parameters = (ReferenceObject | Parameter)[];
|
|
438
|
-
type Parameter = InBodyParameterObject | GeneralParameterObject;
|
|
439
|
-
interface InBodyParameterObject extends ParameterObject {
|
|
440
|
-
schema: Schema;
|
|
441
|
-
}
|
|
442
|
-
interface GeneralParameterObject extends ParameterObject, ItemsObject {
|
|
443
|
-
allowEmptyValue?: boolean;
|
|
444
|
-
}
|
|
445
|
-
enum HttpMethods {
|
|
446
|
-
GET = "get",
|
|
447
|
-
PUT = "put",
|
|
448
|
-
POST = "post",
|
|
449
|
-
DELETE = "delete",
|
|
450
|
-
OPTIONS = "options",
|
|
451
|
-
HEAD = "head",
|
|
452
|
-
PATCH = "patch"
|
|
453
|
-
}
|
|
454
|
-
type PathItemObject<T extends {} = {}> = {
|
|
455
|
-
$ref?: string;
|
|
456
|
-
parameters?: Parameters;
|
|
457
|
-
} & { [method in HttpMethods]?: OperationObject<T> };
|
|
458
|
-
interface PathsObject<T extends {} = {}> {
|
|
459
|
-
[index: string]: PathItemObject<T>;
|
|
460
|
-
}
|
|
461
|
-
interface ParametersDefinitionsObject {
|
|
462
|
-
[index: string]: ParameterObject;
|
|
463
|
-
}
|
|
464
|
-
interface ParameterObject {
|
|
465
|
-
name: string;
|
|
466
|
-
in: string;
|
|
467
|
-
description?: string;
|
|
468
|
-
required?: boolean;
|
|
469
|
-
[index: string]: any;
|
|
470
|
-
}
|
|
471
|
-
type MimeTypes = string[];
|
|
472
|
-
interface DefinitionsObject {
|
|
473
|
-
[index: string]: SchemaObject;
|
|
474
|
-
}
|
|
475
|
-
interface SchemaObject extends IJsonSchema {
|
|
476
|
-
[index: string]: any;
|
|
477
|
-
discriminator?: string;
|
|
478
|
-
readOnly?: boolean;
|
|
479
|
-
xml?: XMLObject;
|
|
480
|
-
externalDocs?: ExternalDocumentationObject;
|
|
481
|
-
example?: any;
|
|
482
|
-
default?: any;
|
|
483
|
-
items?: ItemsObject | ReferenceObject;
|
|
484
|
-
properties?: {
|
|
485
|
-
[name: string]: SchemaObject;
|
|
486
|
-
};
|
|
487
|
-
}
|
|
488
|
-
interface ExternalDocumentationObject {
|
|
489
|
-
[index: string]: any;
|
|
490
|
-
description?: string;
|
|
491
|
-
url: string;
|
|
492
|
-
}
|
|
493
|
-
interface ItemsObject {
|
|
494
|
-
type: string;
|
|
495
|
-
format?: string;
|
|
496
|
-
items?: ItemsObject | ReferenceObject;
|
|
497
|
-
collectionFormat?: string;
|
|
498
|
-
default?: any;
|
|
499
|
-
maximum?: number;
|
|
500
|
-
exclusiveMaximum?: boolean;
|
|
501
|
-
minimum?: number;
|
|
502
|
-
exclusiveMinimum?: boolean;
|
|
503
|
-
maxLength?: number;
|
|
504
|
-
minLength?: number;
|
|
505
|
-
pattern?: string;
|
|
506
|
-
maxItems?: number;
|
|
507
|
-
minItems?: number;
|
|
508
|
-
uniqueItems?: boolean;
|
|
509
|
-
enum?: any[];
|
|
510
|
-
multipleOf?: number;
|
|
511
|
-
$ref?: string;
|
|
512
|
-
}
|
|
513
|
-
interface XMLObject {
|
|
514
|
-
[index: string]: any;
|
|
515
|
-
name?: string;
|
|
516
|
-
namespace?: string;
|
|
517
|
-
prefix?: string;
|
|
518
|
-
attribute?: boolean;
|
|
519
|
-
wrapped?: boolean;
|
|
520
|
-
}
|
|
521
|
-
interface InfoObject {
|
|
522
|
-
title: string;
|
|
523
|
-
description?: string;
|
|
524
|
-
termsOfService?: string;
|
|
525
|
-
contact?: ContactObject;
|
|
526
|
-
license?: LicenseObject;
|
|
527
|
-
version: string;
|
|
528
|
-
}
|
|
529
|
-
interface ContactObject {
|
|
530
|
-
name?: string;
|
|
531
|
-
url?: string;
|
|
532
|
-
email?: string;
|
|
533
|
-
}
|
|
534
|
-
interface LicenseObject {
|
|
535
|
-
name: string;
|
|
536
|
-
url?: string;
|
|
537
|
-
}
|
|
538
|
-
}
|
|
539
|
-
interface IJsonSchema {
|
|
540
|
-
id?: string;
|
|
541
|
-
$schema?: string;
|
|
542
|
-
title?: string;
|
|
543
|
-
description?: string;
|
|
544
|
-
multipleOf?: number;
|
|
545
|
-
maximum?: number;
|
|
546
|
-
exclusiveMaximum?: boolean;
|
|
547
|
-
minimum?: number;
|
|
548
|
-
exclusiveMinimum?: boolean;
|
|
549
|
-
maxLength?: number;
|
|
550
|
-
minLength?: number;
|
|
551
|
-
pattern?: string;
|
|
552
|
-
additionalItems?: boolean | IJsonSchema;
|
|
553
|
-
items?: IJsonSchema | IJsonSchema[];
|
|
554
|
-
maxItems?: number;
|
|
555
|
-
minItems?: number;
|
|
556
|
-
uniqueItems?: boolean;
|
|
557
|
-
maxProperties?: number;
|
|
558
|
-
minProperties?: number;
|
|
559
|
-
required?: string[];
|
|
560
|
-
additionalProperties?: boolean | IJsonSchema;
|
|
561
|
-
definitions?: {
|
|
562
|
-
[name: string]: IJsonSchema;
|
|
563
|
-
};
|
|
564
|
-
properties?: {
|
|
565
|
-
[name: string]: IJsonSchema;
|
|
566
|
-
};
|
|
567
|
-
patternProperties?: {
|
|
568
|
-
[name: string]: IJsonSchema;
|
|
569
|
-
};
|
|
570
|
-
dependencies?: {
|
|
571
|
-
[name: string]: IJsonSchema | string[];
|
|
572
|
-
};
|
|
573
|
-
enum?: any[];
|
|
574
|
-
type?: string | string[];
|
|
575
|
-
allOf?: IJsonSchema[];
|
|
576
|
-
anyOf?: IJsonSchema[];
|
|
577
|
-
oneOf?: IJsonSchema[];
|
|
578
|
-
not?: IJsonSchema;
|
|
579
|
-
$ref?: string;
|
|
580
|
-
}
|
|
581
|
-
//#endregion
|
|
582
|
-
//#region src/types/generate-options.d.ts
|
|
583
|
-
/**
|
|
584
|
-
* 生成全局选项
|
|
585
|
-
*/
|
|
586
|
-
interface GenerateOptions {
|
|
587
|
-
// 网关地址
|
|
588
|
-
gateway: string; // OpenAPI地址
|
|
589
|
-
openapi: string; // 输出目录
|
|
590
|
-
output: string; // 输出Model路径
|
|
591
|
-
exportModels: boolean; // 开启日志输出
|
|
592
|
-
logger?: boolean; // 输出Model路径
|
|
593
|
-
exportServices?: {
|
|
594
|
-
serviceResolve?: (options: {
|
|
595
|
-
path: string;
|
|
596
|
-
method: string;
|
|
597
|
-
object: OpenAPIV2.OperationObject | OpenAPIV3.OperationObject;
|
|
598
|
-
tags: OpenAPIV2.TagObject[];
|
|
599
|
-
}) => string;
|
|
600
|
-
operationResolve?: (options: {
|
|
601
|
-
path: string;
|
|
602
|
-
method: string;
|
|
603
|
-
object: OpenAPIV2.OperationObject | OpenAPIV3.OperationObject;
|
|
604
|
-
}) => string;
|
|
605
|
-
excludeQueryParams?: string[];
|
|
606
|
-
responseType?: 'promise' | 'observable';
|
|
607
|
-
}; // 多应用列表
|
|
608
|
-
applications?: Record<string, ApplicationConfig>; // 追加service
|
|
609
|
-
appendService?: boolean;
|
|
610
|
-
}
|
|
611
|
-
type ApplicationConfig = {
|
|
612
|
-
key: string;
|
|
613
|
-
openapi: string;
|
|
614
|
-
} | string;
|
|
615
|
-
/**
|
|
616
|
-
* 生成应用选项
|
|
617
|
-
*/
|
|
618
|
-
type GenerateApplicationOptions = Pick<GenerateOptions, 'exportModels' | 'output'> & {
|
|
619
|
-
// 服务名称
|
|
620
|
-
name?: string; // 应用名称
|
|
621
|
-
application?: string; // OPENAPI地址
|
|
622
|
-
input: string;
|
|
623
|
-
};
|
|
624
|
-
//#endregion
|
|
625
|
-
//#region src/download/index.d.ts
|
|
626
|
-
declare class Download {
|
|
627
|
-
static options: GenerateOptions;
|
|
628
|
-
static startup(options: GenerateOptions): Promise<void>;
|
|
629
|
-
static downloadOpenAPIFile(option: GenerateApplicationOptions): Promise<unknown>;
|
|
630
|
-
}
|
|
631
|
-
//#endregion
|
|
632
|
-
//#region src/entities/field.d.ts
|
|
633
|
-
declare class Field {
|
|
634
|
-
name: string;
|
|
635
|
-
required: boolean;
|
|
636
|
-
type: string;
|
|
637
|
-
ref?: string;
|
|
638
|
-
enums?: string[];
|
|
639
|
-
description?: string;
|
|
640
|
-
imports?: string[];
|
|
641
|
-
constructor(name: string, required: boolean);
|
|
642
|
-
}
|
|
643
|
-
//#endregion
|
|
644
|
-
//#region src/entities/model.d.ts
|
|
645
|
-
declare class Model {
|
|
646
|
-
name: string;
|
|
647
|
-
fields: Field[];
|
|
648
|
-
imports: string[];
|
|
649
|
-
constructor(name: string);
|
|
650
|
-
}
|
|
651
|
-
//#endregion
|
|
652
|
-
//#region src/entities/operation-parameter.d.ts
|
|
653
|
-
declare class OperationParameter {
|
|
654
|
-
in: 'path' | 'query' | 'body';
|
|
655
|
-
name: string;
|
|
656
|
-
type: string;
|
|
657
|
-
ref?: string;
|
|
658
|
-
enums?: string[];
|
|
659
|
-
description?: string;
|
|
660
|
-
required?: boolean;
|
|
661
|
-
imports: string[];
|
|
662
|
-
}
|
|
663
|
-
//#endregion
|
|
664
|
-
//#region src/entities/operation.d.ts
|
|
665
|
-
declare class Operation {
|
|
666
|
-
name: string;
|
|
667
|
-
method: string;
|
|
668
|
-
path: string;
|
|
669
|
-
description?: string;
|
|
670
|
-
responseRef: string;
|
|
671
|
-
responseType: 'promise' | 'observable';
|
|
672
|
-
parametersPath: OperationParameter[];
|
|
673
|
-
parametersQuery: OperationParameter[];
|
|
674
|
-
parametersBody?: OperationParameter;
|
|
675
|
-
imports: string[];
|
|
676
|
-
constructor(name: string, method: string, path: string);
|
|
677
|
-
}
|
|
678
|
-
//#endregion
|
|
679
|
-
//#region src/entities/service.d.ts
|
|
680
|
-
declare class Service {
|
|
681
|
-
constructor(name: string);
|
|
682
|
-
name: string;
|
|
683
|
-
application?: string;
|
|
684
|
-
imports: string[];
|
|
685
|
-
operations: Operation[];
|
|
686
|
-
responseType: 'promise' | 'observable';
|
|
687
|
-
}
|
|
688
|
-
//#endregion
|
|
689
|
-
//#region src/types/generate-client.d.ts
|
|
690
|
-
interface GenerateClient {
|
|
691
|
-
// 模型列表
|
|
692
|
-
models: Model[]; // 服务列表
|
|
693
|
-
services: Service[];
|
|
694
|
-
}
|
|
695
|
-
//#endregion
|
|
696
|
-
//#region src/config/enum.config.d.ts
|
|
697
|
-
declare enum OpenAPIVersion {
|
|
698
|
-
V2 = 2,
|
|
699
|
-
V3 = 3
|
|
700
|
-
}
|
|
701
|
-
//#endregion
|
|
702
|
-
//#region src/generate/index.d.ts
|
|
703
|
-
type UnkownVersionDocument = OpenAPIV3.Document & OpenAPIV2.Document;
|
|
704
|
-
declare class Generate {
|
|
705
|
-
static options: GenerateOptions;
|
|
706
|
-
/**
|
|
707
|
-
* 生成入口
|
|
708
|
-
* @param options
|
|
709
|
-
* @returns Promise<void>
|
|
710
|
-
*/
|
|
711
|
-
static startup(options: GenerateOptions): Promise<void>;
|
|
712
|
-
static getApiDocument(input: string): Promise<UnkownVersionDocument>;
|
|
713
|
-
/**
|
|
714
|
-
* 生成应用
|
|
715
|
-
*/
|
|
716
|
-
static generateApplicationClient(options: GenerateApplicationOptions): Promise<GenerateClient>;
|
|
717
|
-
/**
|
|
718
|
-
* 生成对象信息
|
|
719
|
-
* @param document
|
|
720
|
-
* @param version
|
|
721
|
-
* @returns GenerateClient
|
|
722
|
-
*/
|
|
723
|
-
static generateClient(document: UnkownVersionDocument, version: OpenAPIVersion): GenerateClient;
|
|
724
|
-
/**
|
|
725
|
-
* 写入Client对象
|
|
726
|
-
* @param client
|
|
727
|
-
* @param options
|
|
728
|
-
*/
|
|
729
|
-
static writeClient(client: GenerateClient, options: GenerateApplicationOptions): void;
|
|
730
|
-
}
|
|
731
|
-
//#endregion
|
|
732
|
-
//#region src/define-config.d.ts
|
|
733
|
-
declare function defineConfig(config: GenerateOptions): GenerateOptions;
|
|
734
|
-
//#endregion
|
|
735
|
-
//#region src/index.d.ts
|
|
736
|
-
declare const generate: typeof Generate.startup;
|
|
737
|
-
declare const download: typeof Download.startup;
|
|
738
|
-
//#endregion
|
|
739
|
-
export { type GenerateOptions, defineConfig, download, generate };
|