@kubb/plugin-client 4.20.3 → 4.20.5
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/components.d.cts +1 -1
- package/dist/components.d.ts +1 -1
- package/dist/generators.d.cts +1 -1
- package/dist/generators.d.ts +1 -1
- package/dist/index.d.cts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/types-C7VsqK9z.d.ts +682 -0
- package/dist/types-Dnr7qYvG.d.cts +682 -0
- package/package.json +8 -8
- package/dist/types-B6KTAQpK.d.ts +0 -1341
- package/dist/types-Cvppe_Zq.d.cts +0 -1341
|
@@ -0,0 +1,682 @@
|
|
|
1
|
+
import { t as __name } from "./chunk-iVr_oF3V.js";
|
|
2
|
+
import { BaseGenerator, Config, FileMetaBase, Group, KubbEvents, Output, Plugin, PluginFactoryOptions, PluginManager, ResolveNameParams } from "@kubb/core";
|
|
3
|
+
import { Fabric } from "@kubb/react-fabric";
|
|
4
|
+
import * as oas_normalize_lib_types0 from "oas-normalize/lib/types";
|
|
5
|
+
import BaseOas from "oas";
|
|
6
|
+
import { Operation } from "oas/operation";
|
|
7
|
+
import { DiscriminatorObject, HttpMethods, OASDocument, SchemaObject } from "oas/types";
|
|
8
|
+
import { KubbFile } from "@kubb/fabric-core/types";
|
|
9
|
+
import { FabricReactNode } from "@kubb/react-fabric/types";
|
|
10
|
+
|
|
11
|
+
//#region ../oas/src/types.d.ts
|
|
12
|
+
type contentType = 'application/json' | (string & {});
|
|
13
|
+
type SchemaObject$1 = SchemaObject & {
|
|
14
|
+
'x-nullable'?: boolean;
|
|
15
|
+
$ref?: string;
|
|
16
|
+
};
|
|
17
|
+
type HttpMethod = HttpMethods;
|
|
18
|
+
type Document = OASDocument;
|
|
19
|
+
type Operation$1 = Operation;
|
|
20
|
+
type DiscriminatorObject$1 = DiscriminatorObject;
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region ../oas/src/Oas.d.ts
|
|
23
|
+
type OasOptions = {
|
|
24
|
+
contentType?: contentType;
|
|
25
|
+
discriminator?: 'strict' | 'inherit';
|
|
26
|
+
/**
|
|
27
|
+
* Resolve name collisions when schemas from different components share the same name (case-insensitive).
|
|
28
|
+
* @default false
|
|
29
|
+
*/
|
|
30
|
+
collisionDetection?: boolean;
|
|
31
|
+
};
|
|
32
|
+
declare class Oas extends BaseOas {
|
|
33
|
+
#private;
|
|
34
|
+
document: Document;
|
|
35
|
+
constructor(document: Document);
|
|
36
|
+
setOptions(options: OasOptions): void;
|
|
37
|
+
get options(): OasOptions;
|
|
38
|
+
get<T = unknown>($ref: string): T | null;
|
|
39
|
+
getKey($ref: string): string | undefined;
|
|
40
|
+
set($ref: string, value: unknown): false | undefined;
|
|
41
|
+
getDiscriminator(schema: SchemaObject$1 | null): DiscriminatorObject$1 | null;
|
|
42
|
+
dereferenceWithRef<T = unknown>(schema?: T): T;
|
|
43
|
+
getResponseSchema(operation: Operation$1, statusCode: string | number): SchemaObject$1;
|
|
44
|
+
getRequestSchema(operation: Operation$1): SchemaObject$1 | undefined;
|
|
45
|
+
getParametersSchema(operation: Operation$1, inKey: 'path' | 'query' | 'header'): SchemaObject$1 | null;
|
|
46
|
+
validate(): Promise<oas_normalize_lib_types0.ValidationResult>;
|
|
47
|
+
flattenSchema(schema: SchemaObject$1 | null): SchemaObject$1 | null;
|
|
48
|
+
/**
|
|
49
|
+
* Get schemas from OpenAPI components (schemas, responses, requestBodies).
|
|
50
|
+
* Returns schemas in dependency order along with name mapping for collision resolution.
|
|
51
|
+
*/
|
|
52
|
+
getSchemas(options?: {
|
|
53
|
+
contentType?: contentType;
|
|
54
|
+
includes?: Array<'schemas' | 'responses' | 'requestBodies'>;
|
|
55
|
+
collisionDetection?: boolean;
|
|
56
|
+
}): {
|
|
57
|
+
schemas: Record<string, SchemaObject$1>;
|
|
58
|
+
nameMapping: Map<string, string>;
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
//#endregion
|
|
62
|
+
//#region ../core/src/utils/AsyncEventEmitter.d.ts
|
|
63
|
+
declare class AsyncEventEmitter<TEvents extends Record<string, any>> {
|
|
64
|
+
#private;
|
|
65
|
+
constructor(maxListener?: number);
|
|
66
|
+
emit<TEventName extends keyof TEvents & string>(eventName: TEventName, ...eventArgs: TEvents[TEventName]): Promise<void>;
|
|
67
|
+
on<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
|
|
68
|
+
onOnce<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArgs: TEvents[TEventName]) => void): void;
|
|
69
|
+
off<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
|
|
70
|
+
removeAll(): void;
|
|
71
|
+
}
|
|
72
|
+
//#endregion
|
|
73
|
+
//#region ../core/src/types.d.ts
|
|
74
|
+
declare global {
|
|
75
|
+
namespace Kubb {
|
|
76
|
+
interface PluginContext {}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Config used in `kubb.config.ts`
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* import { defineConfig } from '@kubb/core'
|
|
84
|
+
* export default defineConfig({
|
|
85
|
+
* ...
|
|
86
|
+
* })
|
|
87
|
+
*/
|
|
88
|
+
//#endregion
|
|
89
|
+
//#region ../plugin-oas/src/types.d.ts
|
|
90
|
+
type GetOasOptions = {
|
|
91
|
+
validate?: boolean;
|
|
92
|
+
};
|
|
93
|
+
type Context$2 = {
|
|
94
|
+
getOas(options?: GetOasOptions): Promise<Oas>;
|
|
95
|
+
getBaseURL(): Promise<string | undefined>;
|
|
96
|
+
};
|
|
97
|
+
declare global {
|
|
98
|
+
namespace Kubb {
|
|
99
|
+
interface PluginContext extends Context$2 {}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
type ResolvePathOptions = {
|
|
103
|
+
pluginKey?: Plugin['key'];
|
|
104
|
+
group?: {
|
|
105
|
+
tag?: string;
|
|
106
|
+
path?: string;
|
|
107
|
+
};
|
|
108
|
+
type?: ResolveNameParams['type'];
|
|
109
|
+
};
|
|
110
|
+
/**
|
|
111
|
+
* `propertyName` is the ref name + resolved with the nameResolver
|
|
112
|
+
* @example import { Pet } from './Pet'
|
|
113
|
+
*
|
|
114
|
+
* `originalName` is the original name used(in PascalCase), only used to remove duplicates
|
|
115
|
+
*
|
|
116
|
+
* `pluginKey` can be used to override the current plugin being used, handy when you want to import a type/schema out of another plugin
|
|
117
|
+
* @example import a type(plugin-ts) for a mock file(swagger-faker)
|
|
118
|
+
*/
|
|
119
|
+
type Ref = {
|
|
120
|
+
propertyName: string;
|
|
121
|
+
originalName: string;
|
|
122
|
+
path: KubbFile.Path;
|
|
123
|
+
pluginKey?: Plugin['key'];
|
|
124
|
+
};
|
|
125
|
+
type Refs = Record<string, Ref>;
|
|
126
|
+
type OperationSchema = {
|
|
127
|
+
/**
|
|
128
|
+
* Converted name, contains already `PathParams`, `QueryParams`, ...
|
|
129
|
+
*/
|
|
130
|
+
name: string;
|
|
131
|
+
schema: SchemaObject$1;
|
|
132
|
+
operation?: Operation$1;
|
|
133
|
+
/**
|
|
134
|
+
* OperationName in PascalCase, only being used in OperationGenerator
|
|
135
|
+
*/
|
|
136
|
+
operationName: string;
|
|
137
|
+
description?: string;
|
|
138
|
+
statusCode?: number;
|
|
139
|
+
keys?: string[];
|
|
140
|
+
keysToOmit?: string[];
|
|
141
|
+
withData?: boolean;
|
|
142
|
+
};
|
|
143
|
+
type OperationSchemas = {
|
|
144
|
+
pathParams?: OperationSchema & {
|
|
145
|
+
keysToOmit?: never;
|
|
146
|
+
};
|
|
147
|
+
queryParams?: OperationSchema & {
|
|
148
|
+
keysToOmit?: never;
|
|
149
|
+
};
|
|
150
|
+
headerParams?: OperationSchema & {
|
|
151
|
+
keysToOmit?: never;
|
|
152
|
+
};
|
|
153
|
+
request?: OperationSchema;
|
|
154
|
+
response: OperationSchema;
|
|
155
|
+
responses: Array<OperationSchema>;
|
|
156
|
+
statusCodes?: Array<OperationSchema>;
|
|
157
|
+
errors?: Array<OperationSchema>;
|
|
158
|
+
};
|
|
159
|
+
type ByTag = {
|
|
160
|
+
type: 'tag';
|
|
161
|
+
pattern: string | RegExp;
|
|
162
|
+
};
|
|
163
|
+
type ByOperationId = {
|
|
164
|
+
type: 'operationId';
|
|
165
|
+
pattern: string | RegExp;
|
|
166
|
+
};
|
|
167
|
+
type ByPath = {
|
|
168
|
+
type: 'path';
|
|
169
|
+
pattern: string | RegExp;
|
|
170
|
+
};
|
|
171
|
+
type ByMethod = {
|
|
172
|
+
type: 'method';
|
|
173
|
+
pattern: HttpMethod | RegExp;
|
|
174
|
+
};
|
|
175
|
+
type BySchemaName = {
|
|
176
|
+
type: 'schemaName';
|
|
177
|
+
pattern: string | RegExp;
|
|
178
|
+
};
|
|
179
|
+
type ByContentType = {
|
|
180
|
+
type: 'contentType';
|
|
181
|
+
pattern: string | RegExp;
|
|
182
|
+
};
|
|
183
|
+
type Exclude$1 = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
|
|
184
|
+
type Include = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
|
|
185
|
+
type Override<TOptions> = (ByTag | ByOperationId | ByPath | ByMethod | BySchemaName | ByContentType) & {
|
|
186
|
+
options: Partial<TOptions>;
|
|
187
|
+
};
|
|
188
|
+
//#endregion
|
|
189
|
+
//#region ../plugin-oas/src/OperationGenerator.d.ts
|
|
190
|
+
type Context$1<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
191
|
+
fabric: Fabric;
|
|
192
|
+
oas: Oas;
|
|
193
|
+
exclude: Array<Exclude$1> | undefined;
|
|
194
|
+
include: Array<Include> | undefined;
|
|
195
|
+
override: Array<Override<TOptions>> | undefined;
|
|
196
|
+
contentType: contentType | undefined;
|
|
197
|
+
pluginManager: PluginManager;
|
|
198
|
+
events?: AsyncEventEmitter<KubbEvents>;
|
|
199
|
+
/**
|
|
200
|
+
* Current plugin
|
|
201
|
+
*/
|
|
202
|
+
plugin: Plugin<TPluginOptions>;
|
|
203
|
+
mode: KubbFile.Mode;
|
|
204
|
+
UNSTABLE_NAMING?: true;
|
|
205
|
+
};
|
|
206
|
+
declare class OperationGenerator<TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TPluginOptions['resolvedOptions'], Context$1<TPluginOptions['resolvedOptions'], TPluginOptions>> {
|
|
207
|
+
#private;
|
|
208
|
+
getOptions(operation: Operation$1, method: HttpMethod): Partial<TPluginOptions['resolvedOptions']>;
|
|
209
|
+
getSchemas(operation: Operation$1, {
|
|
210
|
+
resolveName
|
|
211
|
+
}?: {
|
|
212
|
+
resolveName?: (name: string) => string;
|
|
213
|
+
}): OperationSchemas;
|
|
214
|
+
getOperations(): Promise<Array<{
|
|
215
|
+
path: string;
|
|
216
|
+
method: HttpMethod;
|
|
217
|
+
operation: Operation$1;
|
|
218
|
+
}>>;
|
|
219
|
+
build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
|
|
220
|
+
}
|
|
221
|
+
//#endregion
|
|
222
|
+
//#region ../plugin-oas/src/SchemaMapper.d.ts
|
|
223
|
+
type SchemaKeywordMapper = {
|
|
224
|
+
object: {
|
|
225
|
+
keyword: 'object';
|
|
226
|
+
args: {
|
|
227
|
+
properties: {
|
|
228
|
+
[x: string]: Schema[];
|
|
229
|
+
};
|
|
230
|
+
additionalProperties: Schema[];
|
|
231
|
+
patternProperties?: Record<string, Schema[]>;
|
|
232
|
+
strict?: boolean;
|
|
233
|
+
};
|
|
234
|
+
};
|
|
235
|
+
url: {
|
|
236
|
+
keyword: 'url';
|
|
237
|
+
};
|
|
238
|
+
readOnly: {
|
|
239
|
+
keyword: 'readOnly';
|
|
240
|
+
};
|
|
241
|
+
writeOnly: {
|
|
242
|
+
keyword: 'writeOnly';
|
|
243
|
+
};
|
|
244
|
+
uuid: {
|
|
245
|
+
keyword: 'uuid';
|
|
246
|
+
};
|
|
247
|
+
email: {
|
|
248
|
+
keyword: 'email';
|
|
249
|
+
};
|
|
250
|
+
firstName: {
|
|
251
|
+
keyword: 'firstName';
|
|
252
|
+
};
|
|
253
|
+
lastName: {
|
|
254
|
+
keyword: 'lastName';
|
|
255
|
+
};
|
|
256
|
+
phone: {
|
|
257
|
+
keyword: 'phone';
|
|
258
|
+
};
|
|
259
|
+
password: {
|
|
260
|
+
keyword: 'password';
|
|
261
|
+
};
|
|
262
|
+
date: {
|
|
263
|
+
keyword: 'date';
|
|
264
|
+
args: {
|
|
265
|
+
type?: 'date' | 'string';
|
|
266
|
+
};
|
|
267
|
+
};
|
|
268
|
+
time: {
|
|
269
|
+
keyword: 'time';
|
|
270
|
+
args: {
|
|
271
|
+
type?: 'date' | 'string';
|
|
272
|
+
};
|
|
273
|
+
};
|
|
274
|
+
datetime: {
|
|
275
|
+
keyword: 'datetime';
|
|
276
|
+
args: {
|
|
277
|
+
offset?: boolean;
|
|
278
|
+
local?: boolean;
|
|
279
|
+
};
|
|
280
|
+
};
|
|
281
|
+
tuple: {
|
|
282
|
+
keyword: 'tuple';
|
|
283
|
+
args: {
|
|
284
|
+
items: Schema[];
|
|
285
|
+
min?: number;
|
|
286
|
+
max?: number;
|
|
287
|
+
rest?: Schema;
|
|
288
|
+
};
|
|
289
|
+
};
|
|
290
|
+
array: {
|
|
291
|
+
keyword: 'array';
|
|
292
|
+
args: {
|
|
293
|
+
items: Schema[];
|
|
294
|
+
min?: number;
|
|
295
|
+
max?: number;
|
|
296
|
+
unique?: boolean;
|
|
297
|
+
};
|
|
298
|
+
};
|
|
299
|
+
enum: {
|
|
300
|
+
keyword: 'enum';
|
|
301
|
+
args: {
|
|
302
|
+
name: string;
|
|
303
|
+
typeName: string;
|
|
304
|
+
asConst: boolean;
|
|
305
|
+
items: Array<{
|
|
306
|
+
name: string | number;
|
|
307
|
+
format: 'string' | 'number' | 'boolean';
|
|
308
|
+
value?: string | number | boolean;
|
|
309
|
+
}>;
|
|
310
|
+
};
|
|
311
|
+
};
|
|
312
|
+
and: {
|
|
313
|
+
keyword: 'and';
|
|
314
|
+
args: Schema[];
|
|
315
|
+
};
|
|
316
|
+
const: {
|
|
317
|
+
keyword: 'const';
|
|
318
|
+
args: {
|
|
319
|
+
name: string | number;
|
|
320
|
+
format: 'string' | 'number' | 'boolean';
|
|
321
|
+
value?: string | number | boolean;
|
|
322
|
+
};
|
|
323
|
+
};
|
|
324
|
+
union: {
|
|
325
|
+
keyword: 'union';
|
|
326
|
+
args: Schema[];
|
|
327
|
+
};
|
|
328
|
+
ref: {
|
|
329
|
+
keyword: 'ref';
|
|
330
|
+
args: {
|
|
331
|
+
name: string;
|
|
332
|
+
$ref: string;
|
|
333
|
+
/**
|
|
334
|
+
* Full qualified path.
|
|
335
|
+
*/
|
|
336
|
+
path: KubbFile.Path;
|
|
337
|
+
/**
|
|
338
|
+
* When true `File.Import` is used.
|
|
339
|
+
* When false a reference is used inside the current file.
|
|
340
|
+
*/
|
|
341
|
+
isImportable: boolean;
|
|
342
|
+
};
|
|
343
|
+
};
|
|
344
|
+
matches: {
|
|
345
|
+
keyword: 'matches';
|
|
346
|
+
args?: string;
|
|
347
|
+
};
|
|
348
|
+
boolean: {
|
|
349
|
+
keyword: 'boolean';
|
|
350
|
+
};
|
|
351
|
+
default: {
|
|
352
|
+
keyword: 'default';
|
|
353
|
+
args: string | number | boolean;
|
|
354
|
+
};
|
|
355
|
+
string: {
|
|
356
|
+
keyword: 'string';
|
|
357
|
+
};
|
|
358
|
+
integer: {
|
|
359
|
+
keyword: 'integer';
|
|
360
|
+
};
|
|
361
|
+
number: {
|
|
362
|
+
keyword: 'number';
|
|
363
|
+
};
|
|
364
|
+
max: {
|
|
365
|
+
keyword: 'max';
|
|
366
|
+
args: number;
|
|
367
|
+
};
|
|
368
|
+
min: {
|
|
369
|
+
keyword: 'min';
|
|
370
|
+
args: number;
|
|
371
|
+
};
|
|
372
|
+
exclusiveMaximum: {
|
|
373
|
+
keyword: 'exclusiveMaximum';
|
|
374
|
+
args: number;
|
|
375
|
+
};
|
|
376
|
+
exclusiveMinimum: {
|
|
377
|
+
keyword: 'exclusiveMinimum';
|
|
378
|
+
args: number;
|
|
379
|
+
};
|
|
380
|
+
describe: {
|
|
381
|
+
keyword: 'describe';
|
|
382
|
+
args: string;
|
|
383
|
+
};
|
|
384
|
+
example: {
|
|
385
|
+
keyword: 'example';
|
|
386
|
+
args: string;
|
|
387
|
+
};
|
|
388
|
+
deprecated: {
|
|
389
|
+
keyword: 'deprecated';
|
|
390
|
+
};
|
|
391
|
+
optional: {
|
|
392
|
+
keyword: 'optional';
|
|
393
|
+
};
|
|
394
|
+
undefined: {
|
|
395
|
+
keyword: 'undefined';
|
|
396
|
+
};
|
|
397
|
+
nullish: {
|
|
398
|
+
keyword: 'nullish';
|
|
399
|
+
};
|
|
400
|
+
nullable: {
|
|
401
|
+
keyword: 'nullable';
|
|
402
|
+
};
|
|
403
|
+
null: {
|
|
404
|
+
keyword: 'null';
|
|
405
|
+
};
|
|
406
|
+
any: {
|
|
407
|
+
keyword: 'any';
|
|
408
|
+
};
|
|
409
|
+
unknown: {
|
|
410
|
+
keyword: 'unknown';
|
|
411
|
+
};
|
|
412
|
+
void: {
|
|
413
|
+
keyword: 'void';
|
|
414
|
+
};
|
|
415
|
+
blob: {
|
|
416
|
+
keyword: 'blob';
|
|
417
|
+
};
|
|
418
|
+
schema: {
|
|
419
|
+
keyword: 'schema';
|
|
420
|
+
args: {
|
|
421
|
+
type: 'string' | 'number' | 'integer' | 'boolean' | 'array' | 'object';
|
|
422
|
+
format?: string;
|
|
423
|
+
};
|
|
424
|
+
};
|
|
425
|
+
name: {
|
|
426
|
+
keyword: 'name';
|
|
427
|
+
args: string;
|
|
428
|
+
};
|
|
429
|
+
catchall: {
|
|
430
|
+
keyword: 'catchall';
|
|
431
|
+
};
|
|
432
|
+
interface: {
|
|
433
|
+
keyword: 'interface';
|
|
434
|
+
};
|
|
435
|
+
};
|
|
436
|
+
type Schema = {
|
|
437
|
+
keyword: string;
|
|
438
|
+
} | SchemaKeywordMapper[keyof SchemaKeywordMapper];
|
|
439
|
+
//#endregion
|
|
440
|
+
//#region ../plugin-oas/src/SchemaGenerator.d.ts
|
|
441
|
+
type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
442
|
+
fabric: Fabric;
|
|
443
|
+
oas: Oas;
|
|
444
|
+
pluginManager: PluginManager;
|
|
445
|
+
events?: AsyncEventEmitter<KubbEvents>;
|
|
446
|
+
/**
|
|
447
|
+
* Current plugin
|
|
448
|
+
*/
|
|
449
|
+
plugin: Plugin<TPluginOptions>;
|
|
450
|
+
mode: KubbFile.Mode;
|
|
451
|
+
include?: Array<'schemas' | 'responses' | 'requestBodies'>;
|
|
452
|
+
override: Array<Override<TOptions>> | undefined;
|
|
453
|
+
contentType?: contentType;
|
|
454
|
+
output?: string;
|
|
455
|
+
};
|
|
456
|
+
type SchemaGeneratorOptions = {
|
|
457
|
+
dateType: false | 'string' | 'stringOffset' | 'stringLocal' | 'date';
|
|
458
|
+
unknownType: 'any' | 'unknown' | 'void';
|
|
459
|
+
emptySchemaType: 'any' | 'unknown' | 'void';
|
|
460
|
+
enumType?: 'enum' | 'asConst' | 'asPascalConst' | 'constEnum' | 'literal' | 'inlineLiteral';
|
|
461
|
+
enumSuffix?: string;
|
|
462
|
+
/**
|
|
463
|
+
* @deprecated Will be removed in v5. Use `collisionDetection: true` instead to prevent enum name collisions.
|
|
464
|
+
* When `collisionDetection` is enabled, the rootName-based approach eliminates the need for numeric suffixes.
|
|
465
|
+
* @internal
|
|
466
|
+
*/
|
|
467
|
+
usedEnumNames?: Record<string, number>;
|
|
468
|
+
mapper?: Record<string, string>;
|
|
469
|
+
typed?: boolean;
|
|
470
|
+
transformers: {
|
|
471
|
+
/**
|
|
472
|
+
* Customize the names based on the type that is provided by the plugin.
|
|
473
|
+
*/
|
|
474
|
+
name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
|
|
475
|
+
/**
|
|
476
|
+
* Receive schema and name(propertyName) and return FakerMeta array
|
|
477
|
+
* TODO TODO add docs
|
|
478
|
+
* @beta
|
|
479
|
+
*/
|
|
480
|
+
schema?: (schemaProps: SchemaProps$1, defaultSchemas: Schema[]) => Array<Schema> | undefined;
|
|
481
|
+
};
|
|
482
|
+
};
|
|
483
|
+
type SchemaProps$1 = {
|
|
484
|
+
schema: SchemaObject$1 | null;
|
|
485
|
+
name: string | null;
|
|
486
|
+
parentName: string | null;
|
|
487
|
+
rootName?: string | null;
|
|
488
|
+
};
|
|
489
|
+
declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGeneratorOptions, TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TOptions, Context<TOptions, TPluginOptions>> {
|
|
490
|
+
#private;
|
|
491
|
+
refs: Refs;
|
|
492
|
+
/**
|
|
493
|
+
* Creates a type node from a given schema.
|
|
494
|
+
* Delegates to getBaseTypeFromSchema internally and
|
|
495
|
+
* optionally adds a union with null.
|
|
496
|
+
*/
|
|
497
|
+
parse(props: SchemaProps$1): Schema[];
|
|
498
|
+
static deepSearch<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): Array<SchemaKeywordMapper[T]>;
|
|
499
|
+
static find<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
|
|
500
|
+
static combineObjects(tree: Schema[] | undefined): Schema[];
|
|
501
|
+
build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
|
|
502
|
+
}
|
|
503
|
+
//#endregion
|
|
504
|
+
//#region ../plugin-oas/src/generators/createReactGenerator.d.ts
|
|
505
|
+
type ReactGenerator<TOptions extends PluginFactoryOptions> = {
|
|
506
|
+
name: string;
|
|
507
|
+
type: 'react';
|
|
508
|
+
Operations: (props: OperationsProps<TOptions>) => FabricReactNode;
|
|
509
|
+
Operation: (props: OperationProps<TOptions>) => FabricReactNode;
|
|
510
|
+
Schema: (props: SchemaProps<TOptions>) => FabricReactNode;
|
|
511
|
+
};
|
|
512
|
+
//#endregion
|
|
513
|
+
//#region ../plugin-oas/src/generators/types.d.ts
|
|
514
|
+
type OperationsProps<TOptions extends PluginFactoryOptions> = {
|
|
515
|
+
config: Config;
|
|
516
|
+
generator: Omit<OperationGenerator<TOptions>, 'build'>;
|
|
517
|
+
plugin: Plugin<TOptions>;
|
|
518
|
+
operations: Array<Operation$1>;
|
|
519
|
+
};
|
|
520
|
+
type OperationProps<TOptions extends PluginFactoryOptions> = {
|
|
521
|
+
config: Config;
|
|
522
|
+
generator: Omit<OperationGenerator<TOptions>, 'build'>;
|
|
523
|
+
plugin: Plugin<TOptions>;
|
|
524
|
+
operation: Operation$1;
|
|
525
|
+
};
|
|
526
|
+
type SchemaProps<TOptions extends PluginFactoryOptions> = {
|
|
527
|
+
config: Config;
|
|
528
|
+
generator: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions>, 'build'>;
|
|
529
|
+
plugin: Plugin<TOptions>;
|
|
530
|
+
schema: {
|
|
531
|
+
name: string;
|
|
532
|
+
tree: Array<Schema>;
|
|
533
|
+
value: SchemaObject$1;
|
|
534
|
+
};
|
|
535
|
+
};
|
|
536
|
+
type Generator<TOptions extends PluginFactoryOptions> = CoreGenerator<TOptions> | ReactGenerator<TOptions>;
|
|
537
|
+
//#endregion
|
|
538
|
+
//#region ../plugin-oas/src/generators/createGenerator.d.ts
|
|
539
|
+
type CoreGenerator<TOptions extends PluginFactoryOptions> = {
|
|
540
|
+
name: string;
|
|
541
|
+
type: 'core';
|
|
542
|
+
operations: (props: OperationsProps<TOptions>) => Promise<KubbFile.File[]>;
|
|
543
|
+
operation: (props: OperationProps<TOptions>) => Promise<KubbFile.File[]>;
|
|
544
|
+
schema: (props: SchemaProps<TOptions>) => Promise<KubbFile.File[]>;
|
|
545
|
+
};
|
|
546
|
+
//#endregion
|
|
547
|
+
//#region src/types.d.ts
|
|
548
|
+
type Options = {
|
|
549
|
+
/**
|
|
550
|
+
* Specify the export location for the files and define the behavior of the output
|
|
551
|
+
* @default { path: 'clients', barrelType: 'named' }
|
|
552
|
+
*/
|
|
553
|
+
output?: Output<Oas>;
|
|
554
|
+
/**
|
|
555
|
+
* Define which contentType should be used.
|
|
556
|
+
* By default, the first JSON valid mediaType is used
|
|
557
|
+
*/
|
|
558
|
+
contentType?: contentType;
|
|
559
|
+
/**
|
|
560
|
+
* Group the clients based on the provided name.
|
|
561
|
+
*/
|
|
562
|
+
group?: Group;
|
|
563
|
+
/**
|
|
564
|
+
* Array containing exclude parameters to exclude/skip tags/operations/methods/paths.
|
|
565
|
+
*/
|
|
566
|
+
exclude?: Array<Exclude$1>;
|
|
567
|
+
/**
|
|
568
|
+
* Array containing include parameters to include tags/operations/methods/paths.
|
|
569
|
+
*/
|
|
570
|
+
include?: Array<Include>;
|
|
571
|
+
/**
|
|
572
|
+
* Array containing override parameters to override `options` based on tags/operations/methods/paths.
|
|
573
|
+
*/
|
|
574
|
+
override?: Array<Override<ResolvedOptions>>;
|
|
575
|
+
/**
|
|
576
|
+
* Create `operations.ts` file with all operations grouped by methods.
|
|
577
|
+
* @default false
|
|
578
|
+
*/
|
|
579
|
+
operations?: boolean;
|
|
580
|
+
/**
|
|
581
|
+
* Export urls that are used by operation x.
|
|
582
|
+
* - 'export' makes them part of your barrel file.
|
|
583
|
+
* - false does not make them exportable.
|
|
584
|
+
* @default false
|
|
585
|
+
* @example getGetPetByIdUrl
|
|
586
|
+
*/
|
|
587
|
+
urlType?: 'export' | false;
|
|
588
|
+
/**
|
|
589
|
+
* Client import path for API calls.
|
|
590
|
+
* Used as `import client from '${client.importPath}'`.
|
|
591
|
+
* Accepts relative and absolute paths; path changes are not performed.
|
|
592
|
+
*/
|
|
593
|
+
importPath?: string;
|
|
594
|
+
/**
|
|
595
|
+
* Allows you to set a custom base url for all generated calls.
|
|
596
|
+
*/
|
|
597
|
+
baseURL?: string;
|
|
598
|
+
/**
|
|
599
|
+
* ReturnType that is used when calling the client.
|
|
600
|
+
* - 'data' returns ResponseConfig[data].
|
|
601
|
+
* - 'full' returns ResponseConfig.
|
|
602
|
+
* @default 'data'
|
|
603
|
+
*/
|
|
604
|
+
dataReturnType?: 'data' | 'full';
|
|
605
|
+
/**
|
|
606
|
+
* How to style your params, by default no casing is applied
|
|
607
|
+
* - 'camelcase' uses camelcase for the params names
|
|
608
|
+
*/
|
|
609
|
+
paramsCasing?: 'camelcase';
|
|
610
|
+
/**
|
|
611
|
+
* How to pass your params.
|
|
612
|
+
* - 'object' returns the params and pathParams as an object.
|
|
613
|
+
* - 'inline' returns the params as comma separated params.
|
|
614
|
+
* @default 'inline'
|
|
615
|
+
*/
|
|
616
|
+
paramsType?: 'object' | 'inline';
|
|
617
|
+
/**
|
|
618
|
+
* How to pass your pathParams.
|
|
619
|
+
* - 'object' returns the pathParams as an object.
|
|
620
|
+
* - 'inline' returns the pathParams as comma separated params.
|
|
621
|
+
* @default 'inline'
|
|
622
|
+
*/
|
|
623
|
+
pathParamsType?: 'object' | 'inline';
|
|
624
|
+
/**
|
|
625
|
+
* Which parser can be used before returning the data.
|
|
626
|
+
* - 'client' returns the data as-is from the client.
|
|
627
|
+
* - 'zod' uses @kubb/plugin-zod to parse the data.
|
|
628
|
+
* @default 'client'
|
|
629
|
+
*/
|
|
630
|
+
parser?: 'client' | 'zod';
|
|
631
|
+
/**
|
|
632
|
+
* Which client should be used to do the HTTP calls.
|
|
633
|
+
* - 'axios' uses axios client for HTTP requests.
|
|
634
|
+
* - 'fetch' uses native fetch API for HTTP requests.
|
|
635
|
+
* @default 'axios'
|
|
636
|
+
*/
|
|
637
|
+
client?: 'axios' | 'fetch';
|
|
638
|
+
/**
|
|
639
|
+
* How to generate the client code.
|
|
640
|
+
* - 'function' generates standalone functions for each operation.
|
|
641
|
+
* - 'class' generates a class with methods for each operation.
|
|
642
|
+
* - 'staticClass' generates a class with static methods for each operation.
|
|
643
|
+
* @default 'function'
|
|
644
|
+
*/
|
|
645
|
+
clientType?: 'function' | 'class' | 'staticClass';
|
|
646
|
+
/**
|
|
647
|
+
* Bundle the selected client into the generated `.kubb` directory.
|
|
648
|
+
* When disabled the generated clients will import the shared runtime from `@kubb/plugin-client/clients/*`.
|
|
649
|
+
* @default false
|
|
650
|
+
* In version 5 of Kubb this is by default true
|
|
651
|
+
*/
|
|
652
|
+
bundle?: boolean;
|
|
653
|
+
transformers?: {
|
|
654
|
+
/**
|
|
655
|
+
* Customize the names based on the type that is provided by the plugin.
|
|
656
|
+
*/
|
|
657
|
+
name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
|
|
658
|
+
};
|
|
659
|
+
/**
|
|
660
|
+
* Define some generators next to the client generators
|
|
661
|
+
*/
|
|
662
|
+
generators?: Array<Generator<PluginClient>>;
|
|
663
|
+
};
|
|
664
|
+
type ResolvedOptions = {
|
|
665
|
+
output: Output<Oas>;
|
|
666
|
+
group?: Options['group'];
|
|
667
|
+
baseURL: string | undefined;
|
|
668
|
+
client: Options['client'];
|
|
669
|
+
clientType: NonNullable<Options['clientType']>;
|
|
670
|
+
bundle: NonNullable<Options['bundle']>;
|
|
671
|
+
parser: NonNullable<Options['parser']>;
|
|
672
|
+
urlType: NonNullable<Options['urlType']>;
|
|
673
|
+
importPath: Options['importPath'];
|
|
674
|
+
dataReturnType: NonNullable<Options['dataReturnType']>;
|
|
675
|
+
pathParamsType: NonNullable<Options['pathParamsType']>;
|
|
676
|
+
paramsType: NonNullable<Options['paramsType']>;
|
|
677
|
+
paramsCasing: Options['paramsCasing'];
|
|
678
|
+
};
|
|
679
|
+
type PluginClient = PluginFactoryOptions<'plugin-client', Options, ResolvedOptions, never, ResolvePathOptions>;
|
|
680
|
+
//#endregion
|
|
681
|
+
export { Operation$1 as a, OperationSchemas as i, PluginClient as n, ReactGenerator as r, Options as t };
|
|
682
|
+
//# sourceMappingURL=types-C7VsqK9z.d.ts.map
|