@kubb/plugin-oas 0.0.0-canary-20240806053140 → 0.0.0-canary-20241106205013

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/README.md +14 -5
  2. package/dist/OperationGenerator-Bw6sj3Eb.d.cts +560 -0
  3. package/dist/OperationGenerator-Bw6sj3Eb.d.ts +560 -0
  4. package/dist/Schema-4FwWfdim.d.cts +22 -0
  5. package/dist/Schema-BlGtSgNB.d.ts +22 -0
  6. package/dist/chunk-2TGWPVZN.cjs +92 -0
  7. package/dist/chunk-2TGWPVZN.cjs.map +1 -0
  8. package/dist/chunk-A3ROGKLW.cjs +752 -0
  9. package/dist/chunk-A3ROGKLW.cjs.map +1 -0
  10. package/dist/chunk-ABOQ73FL.cjs +36 -0
  11. package/dist/chunk-ABOQ73FL.cjs.map +1 -0
  12. package/dist/chunk-BG77DP54.js +30 -0
  13. package/dist/chunk-BG77DP54.js.map +1 -0
  14. package/dist/chunk-GF26SDHQ.js +28 -0
  15. package/dist/chunk-GF26SDHQ.js.map +1 -0
  16. package/dist/chunk-JA75IPYU.js +744 -0
  17. package/dist/chunk-JA75IPYU.js.map +1 -0
  18. package/dist/chunk-PADR76WZ.cjs +4 -0
  19. package/dist/chunk-PADR76WZ.cjs.map +1 -0
  20. package/dist/chunk-QAFBZLJA.cjs +48 -0
  21. package/dist/chunk-QAFBZLJA.cjs.map +1 -0
  22. package/dist/chunk-R47XMJ32.js +3 -0
  23. package/dist/chunk-R47XMJ32.js.map +1 -0
  24. package/dist/chunk-TNWNNVQW.js +88 -0
  25. package/dist/chunk-TNWNNVQW.js.map +1 -0
  26. package/dist/chunk-XNCEFOE6.js +45 -0
  27. package/dist/chunk-XNCEFOE6.js.map +1 -0
  28. package/dist/chunk-ZWHQ54JM.cjs +32 -0
  29. package/dist/chunk-ZWHQ54JM.cjs.map +1 -0
  30. package/dist/components.cjs +20 -17
  31. package/dist/components.cjs.map +1 -1
  32. package/dist/components.d.cts +12 -9
  33. package/dist/components.d.ts +12 -9
  34. package/dist/components.js +3 -17
  35. package/dist/components.js.map +1 -1
  36. package/dist/generators.cjs +14 -0
  37. package/dist/generators.cjs.map +1 -0
  38. package/dist/generators.d.cts +9 -0
  39. package/dist/generators.d.ts +9 -0
  40. package/dist/generators.js +5 -0
  41. package/dist/generators.js.map +1 -0
  42. package/dist/hooks.cjs +90 -58
  43. package/dist/hooks.cjs.map +1 -1
  44. package/dist/hooks.d.cts +37 -10
  45. package/dist/hooks.d.ts +37 -10
  46. package/dist/hooks.js +79 -54
  47. package/dist/hooks.js.map +1 -1
  48. package/dist/index.cjs +277 -270
  49. package/dist/index.cjs.map +1 -1
  50. package/dist/index.d.cts +6 -78
  51. package/dist/index.d.ts +6 -78
  52. package/dist/index.js +235 -255
  53. package/dist/index.js.map +1 -1
  54. package/dist/utils.cjs +32 -87
  55. package/dist/utils.cjs.map +1 -1
  56. package/dist/utils.d.cts +8 -43
  57. package/dist/utils.d.ts +8 -43
  58. package/dist/utils.js +8 -86
  59. package/dist/utils.js.map +1 -1
  60. package/package.json +21 -15
  61. package/src/OperationGenerator.ts +91 -64
  62. package/src/SchemaGenerator.ts +102 -22
  63. package/src/SchemaMapper.ts +24 -5
  64. package/src/components/Oas.tsx +9 -3
  65. package/src/components/Operation.tsx +1 -1
  66. package/src/components/Schema.tsx +2 -102
  67. package/src/generator.tsx +129 -0
  68. package/src/generators/index.ts +1 -0
  69. package/src/generators/jsonGenerator.ts +32 -0
  70. package/src/hooks/index.ts +2 -0
  71. package/src/hooks/useOperationManager.ts +56 -30
  72. package/src/hooks/useSchemaManager.ts +77 -0
  73. package/src/index.ts +5 -13
  74. package/src/plugin.ts +73 -69
  75. package/src/types.ts +29 -27
  76. package/src/utils/getParams.ts +2 -2
  77. package/src/utils/getSchemaFactory.ts +1 -1
  78. package/src/utils/index.ts +2 -2
  79. package/src/utils/parseFromConfig.ts +7 -7
  80. package/dist/OperationGenerator-BV6QRtkW.d.cts +0 -60
  81. package/dist/OperationGenerator-DO5tNGuT.d.ts +0 -60
  82. package/dist/Schema-DefwBJMc.d.ts +0 -35
  83. package/dist/Schema-an5hOrjZ.d.cts +0 -35
  84. package/dist/SchemaMapper-CsBQ6eEx.d.cts +0 -248
  85. package/dist/SchemaMapper-CsBQ6eEx.d.ts +0 -248
  86. package/dist/chunk-6QFVU3BI.js +0 -3265
  87. package/dist/chunk-6QFVU3BI.js.map +0 -1
  88. package/dist/chunk-7BYOJGO3.js +0 -35
  89. package/dist/chunk-7BYOJGO3.js.map +0 -1
  90. package/dist/chunk-DHPXS6V7.cjs +0 -35
  91. package/dist/chunk-DHPXS6V7.cjs.map +0 -1
  92. package/dist/chunk-E4NYDEAU.js +0 -101
  93. package/dist/chunk-E4NYDEAU.js.map +0 -1
  94. package/dist/chunk-KGR7UP2W.js +0 -695
  95. package/dist/chunk-KGR7UP2W.js.map +0 -1
  96. package/dist/chunk-M62LERKB.cjs +0 -695
  97. package/dist/chunk-M62LERKB.cjs.map +0 -1
  98. package/dist/chunk-NLQIW5KR.cjs +0 -3265
  99. package/dist/chunk-NLQIW5KR.cjs.map +0 -1
  100. package/dist/chunk-PHNRHM3I.cjs +0 -101
  101. package/dist/chunk-PHNRHM3I.cjs.map +0 -1
  102. package/dist/types-Db0qp8u-.d.cts +0 -148
  103. package/dist/types-Db0qp8u-.d.ts +0 -148
  104. package/src/utils/getGroupedByTagFiles.ts +0 -82
  105. package/src/utils/refSorter.ts +0 -13
package/README.md CHANGED
@@ -13,12 +13,8 @@
13
13
  [![Coverage][coverage-src]][coverage-href]
14
14
  [![License][license-src]][license-href]
15
15
 
16
- <!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
17
- <!-- ALL-CONTRIBUTORS-BADGE:END -->
18
- </p>
19
-
20
16
  <h4>
21
- <a href="https://codesandbox.io/s/github/kubb-labs/kubb/tree/alpha/examples/typescript" target="_blank">View Demo</a>
17
+ <a href="https://codesandbox.io/s/github/kubb-labs/kubb/tree/main//examples/typescript" target="_blank">View Demo</a>
22
18
  <span> · </span>
23
19
  <a href="https://kubb.dev/" target="_blank">Documentation</a>
24
20
  <span> · </span>
@@ -28,6 +24,19 @@
28
24
  </h4>
29
25
  </div>
30
26
 
27
+ ## Supporting Kubb
28
+
29
+ Kubb uses an MIT-licensed open source project with its ongoing development made possible entirely by the support of Sponsors. If you would like to become a sponsor, please consider:
30
+
31
+ - [Become a Sponsor on GitHub](https://github.com/sponsors/stijnvanhulle)
32
+
33
+ <p align="center">
34
+ <a href="https://github.com/sponsors/stijnvanhulle">
35
+ <img src="https://raw.githubusercontent.com/stijnvanhulle/sponsors/main/sponsors.svg" alt="My sponsors" />
36
+ </a>
37
+ </p>
38
+
39
+
31
40
  <!-- Badges -->
32
41
 
33
42
  [npm-version-src]: https://img.shields.io/npm/v/@kubb/plugin-oas?flat&colorA=18181B&colorB=f58517
@@ -0,0 +1,560 @@
1
+ import { Plugin, ResolveNameParams, Output, PluginFactoryOptions, FileMetaBase, BaseGenerator, PluginManager } from '@kubb/core';
2
+ import * as KubbFile from '@kubb/fs/types';
3
+ import { Oas, contentType, OasTypes, SchemaObject, Operation, HttpMethod } from '@kubb/oas';
4
+ import { KubbNode } from '@kubb/react/types';
5
+
6
+ type SchemaKeywordMapper = {
7
+ object: {
8
+ keyword: 'object';
9
+ args: {
10
+ properties: {
11
+ [x: string]: Schema[];
12
+ };
13
+ additionalProperties: Schema[];
14
+ strict?: boolean;
15
+ };
16
+ };
17
+ strict: {
18
+ keyword: 'strict';
19
+ };
20
+ url: {
21
+ keyword: 'url';
22
+ };
23
+ readOnly: {
24
+ keyword: 'readOnly';
25
+ };
26
+ writeOnly: {
27
+ keyword: 'writeOnly';
28
+ };
29
+ uuid: {
30
+ keyword: 'uuid';
31
+ };
32
+ email: {
33
+ keyword: 'email';
34
+ };
35
+ firstName: {
36
+ keyword: 'firstName';
37
+ };
38
+ lastName: {
39
+ keyword: 'lastName';
40
+ };
41
+ phone: {
42
+ keyword: 'phone';
43
+ };
44
+ password: {
45
+ keyword: 'password';
46
+ };
47
+ date: {
48
+ keyword: 'date';
49
+ args: {
50
+ type?: 'date' | 'string';
51
+ };
52
+ };
53
+ time: {
54
+ keyword: 'time';
55
+ args: {
56
+ type?: 'date' | 'string';
57
+ };
58
+ };
59
+ datetime: {
60
+ keyword: 'datetime';
61
+ args: {
62
+ offset?: boolean;
63
+ local?: boolean;
64
+ };
65
+ };
66
+ tuple: {
67
+ keyword: 'tuple';
68
+ args: {
69
+ items: Schema[];
70
+ min?: number;
71
+ max?: number;
72
+ };
73
+ };
74
+ array: {
75
+ keyword: 'array';
76
+ args: {
77
+ items: Schema[];
78
+ min?: number;
79
+ max?: number;
80
+ };
81
+ };
82
+ enum: {
83
+ keyword: 'enum';
84
+ args: {
85
+ name: string;
86
+ typeName: string;
87
+ asConst: boolean;
88
+ items: Array<{
89
+ name: string | number;
90
+ format: 'string' | 'number' | 'boolean';
91
+ value?: string | number | boolean;
92
+ }>;
93
+ };
94
+ };
95
+ and: {
96
+ keyword: 'and';
97
+ args: Schema[];
98
+ };
99
+ const: {
100
+ keyword: 'const';
101
+ args: {
102
+ name: string | number;
103
+ format: 'string' | 'number' | 'boolean';
104
+ value?: string | number | boolean;
105
+ };
106
+ };
107
+ union: {
108
+ keyword: 'union';
109
+ args: Schema[];
110
+ };
111
+ ref: {
112
+ keyword: 'ref';
113
+ args: {
114
+ name: string;
115
+ /**
116
+ * Full qualified path.
117
+ */
118
+ path: KubbFile.OptionalPath;
119
+ /**
120
+ * When true `File.Import` will be used.
121
+ * When false a reference will be used inside the current file.
122
+ */
123
+ isImportable: boolean;
124
+ };
125
+ };
126
+ matches: {
127
+ keyword: 'matches';
128
+ args?: string;
129
+ };
130
+ boolean: {
131
+ keyword: 'boolean';
132
+ };
133
+ default: {
134
+ keyword: 'default';
135
+ args: string | number | boolean;
136
+ };
137
+ string: {
138
+ keyword: 'string';
139
+ };
140
+ integer: {
141
+ keyword: 'integer';
142
+ };
143
+ number: {
144
+ keyword: 'number';
145
+ };
146
+ max: {
147
+ keyword: 'max';
148
+ args: number;
149
+ };
150
+ min: {
151
+ keyword: 'min';
152
+ args: number;
153
+ };
154
+ describe: {
155
+ keyword: 'describe';
156
+ args: string;
157
+ };
158
+ example: {
159
+ keyword: 'example';
160
+ args: string;
161
+ };
162
+ deprecated: {
163
+ keyword: 'deprecated';
164
+ };
165
+ optional: {
166
+ keyword: 'optional';
167
+ };
168
+ undefined: {
169
+ keyword: 'undefined';
170
+ };
171
+ nullish: {
172
+ keyword: 'nullish';
173
+ };
174
+ nullable: {
175
+ keyword: 'nullable';
176
+ };
177
+ null: {
178
+ keyword: 'null';
179
+ };
180
+ any: {
181
+ keyword: 'any';
182
+ };
183
+ unknown: {
184
+ keyword: 'unknown';
185
+ };
186
+ blob: {
187
+ keyword: 'blob';
188
+ };
189
+ schema: {
190
+ keyword: 'schema';
191
+ args: {
192
+ type: 'string' | 'number' | 'integer' | 'boolean' | 'array' | 'object';
193
+ format?: string;
194
+ };
195
+ };
196
+ name: {
197
+ keyword: 'name';
198
+ args: string;
199
+ };
200
+ catchall: {
201
+ keyword: 'catchall';
202
+ };
203
+ };
204
+ declare const schemaKeywords: {
205
+ any: "any";
206
+ strict: "strict";
207
+ unknown: "unknown";
208
+ number: "number";
209
+ integer: "integer";
210
+ string: "string";
211
+ boolean: "boolean";
212
+ undefined: "undefined";
213
+ nullable: "nullable";
214
+ null: "null";
215
+ nullish: "nullish";
216
+ array: "array";
217
+ tuple: "tuple";
218
+ enum: "enum";
219
+ union: "union";
220
+ datetime: "datetime";
221
+ date: "date";
222
+ email: "email";
223
+ uuid: "uuid";
224
+ url: "url";
225
+ default: "default";
226
+ const: "const";
227
+ and: "and";
228
+ describe: "describe";
229
+ min: "min";
230
+ max: "max";
231
+ optional: "optional";
232
+ readOnly: "readOnly";
233
+ writeOnly: "writeOnly";
234
+ object: "object";
235
+ ref: "ref";
236
+ matches: "matches";
237
+ firstName: "firstName";
238
+ lastName: "lastName";
239
+ password: "password";
240
+ phone: "phone";
241
+ blob: "blob";
242
+ deprecated: "deprecated";
243
+ example: "example";
244
+ schema: "schema";
245
+ catchall: "catchall";
246
+ time: "time";
247
+ name: "name";
248
+ };
249
+ type SchemaKeyword = keyof SchemaKeywordMapper;
250
+ type SchemaMapper<T = string | null | undefined> = {
251
+ [K in keyof SchemaKeywordMapper]: (() => T | undefined) | undefined;
252
+ };
253
+ type SchemaKeywordBase<T> = {
254
+ keyword: SchemaKeyword;
255
+ args: T;
256
+ };
257
+ type Schema = {
258
+ keyword: string;
259
+ } | SchemaKeywordMapper[keyof SchemaKeywordMapper];
260
+ type SchemaTree = {
261
+ parent: Schema | undefined;
262
+ current: Schema;
263
+ siblings: Schema[];
264
+ };
265
+ declare function isKeyword<T extends Schema, K extends keyof SchemaKeywordMapper>(meta: T, keyword: K): meta is Extract<T, SchemaKeywordMapper[K]>;
266
+
267
+ type Mode = 'schemas' | 'responses' | 'requestBodies';
268
+ type GetSchemasProps = {
269
+ oas: Oas;
270
+ contentType?: contentType;
271
+ includes?: Mode[];
272
+ };
273
+ declare function getSchemas({ oas, contentType, includes }: GetSchemasProps): Record<string, OasTypes.SchemaObject>;
274
+
275
+ type ResolvePathOptions = {
276
+ pluginKey?: Plugin['key'];
277
+ tag?: string;
278
+ type?: ResolveNameParams['type'];
279
+ };
280
+ type API = {
281
+ getOas: () => Promise<Oas>;
282
+ getSchemas: (options?: Pick<GetSchemasProps, 'includes'>) => Promise<Record<string, SchemaObject>>;
283
+ getBaseURL: () => Promise<string | undefined>;
284
+ contentType?: contentType;
285
+ };
286
+ type Options = {
287
+ /**
288
+ * Validate your input(see kubb.config) based on '@readme/openapi-parser'.
289
+ * @default true
290
+ */
291
+ validate?: boolean;
292
+ /**
293
+ * Specify the export location for the files and define the behavior of the output
294
+ * @default { path: 'schemas', barrelType: 'named' }
295
+ */
296
+ output?: Output;
297
+ /**
298
+ * Which server to use from the array of `servers.url[serverIndex]`
299
+ * @example
300
+ * - `0` will return `http://petstore.swagger.io/api`
301
+ * - `1` will return `http://localhost:3000`
302
+ */
303
+ serverIndex?: number;
304
+ /**
305
+ * Define which contentType should be used.
306
+ * By default, this is set based on the contentType being found.
307
+ */
308
+ contentType?: contentType;
309
+ /**
310
+ * Override some behaviour of the Oas class instance, see '@kubb/oas'
311
+ */
312
+ oasClass?: typeof Oas;
313
+ /**
314
+ * Define some generators next to the JSON generation
315
+ */
316
+ generators?: Array<Generator<PluginOas>>;
317
+ };
318
+ /**
319
+ * `propertyName` is the ref name + resolved with the nameResolver
320
+ * @example import { Pet } from './Pet'
321
+ *
322
+ * `originalName` is the original name used(in PascalCase), only used to remove duplicates
323
+ *
324
+ * `pluginKey` can be used to override the current plugin being used, handy when you want to import a type/schema out of another plugin
325
+ * @example import a type(plugin-ts) for a mock file(swagger-faker)
326
+ */
327
+ type Ref = {
328
+ propertyName: string;
329
+ originalName: string;
330
+ path: KubbFile.OptionalPath;
331
+ pluginKey?: Plugin['key'];
332
+ };
333
+ type Refs = Record<string, Ref>;
334
+ type Resolver = {
335
+ /**
336
+ * Original name or name resolved by `resolveName({ name: operation?.getOperationId() as string, pluginName })`
337
+ */
338
+ name: string;
339
+ baseName: KubbFile.BaseName;
340
+ path: KubbFile.Path;
341
+ };
342
+ type OperationSchema = {
343
+ /**
344
+ * Converted name, contains already `PathParams`, `QueryParams`, ...
345
+ */
346
+ name: string;
347
+ schema: SchemaObject;
348
+ operation?: Operation;
349
+ /**
350
+ * OperationName in PascalCase, only being used in OperationGenerator
351
+ */
352
+ operationName: string;
353
+ description?: string;
354
+ statusCode?: number;
355
+ keys?: string[];
356
+ keysToOmit?: string[];
357
+ withData?: boolean;
358
+ };
359
+ type OperationSchemas = {
360
+ pathParams?: OperationSchema & {
361
+ keysToOmit?: never;
362
+ };
363
+ queryParams?: OperationSchema & {
364
+ keysToOmit?: never;
365
+ };
366
+ headerParams?: OperationSchema & {
367
+ keysToOmit?: never;
368
+ };
369
+ request?: OperationSchema;
370
+ response: OperationSchema;
371
+ responses: Array<OperationSchema>;
372
+ statusCodes?: Array<OperationSchema>;
373
+ errors?: Array<OperationSchema>;
374
+ };
375
+ type OperationsByMethod = Record<string, Record<HttpMethod, {
376
+ operation: Operation;
377
+ schemas: OperationSchemas;
378
+ }>>;
379
+ type ByTag = {
380
+ type: 'tag';
381
+ pattern: string | RegExp;
382
+ };
383
+ type ByOperationId = {
384
+ type: 'operationId';
385
+ pattern: string | RegExp;
386
+ };
387
+ type ByPath = {
388
+ type: 'path';
389
+ pattern: string | RegExp;
390
+ };
391
+ type ByMethod = {
392
+ type: 'method';
393
+ pattern: HttpMethod | RegExp;
394
+ };
395
+ type BySchemaName = {
396
+ type: 'schemaName';
397
+ pattern: string | RegExp;
398
+ };
399
+ type Exclude = ByTag | ByOperationId | ByPath | ByMethod;
400
+ type Include = ByTag | ByOperationId | ByPath | ByMethod;
401
+ type Override<TOptions> = (ByTag | ByOperationId | ByPath | ByMethod | BySchemaName) & {
402
+ options: Partial<TOptions>;
403
+ };
404
+ type ResolvedOptions = Options & {
405
+ output: Output;
406
+ };
407
+ type PluginOas = PluginFactoryOptions<'plugin-oas', Options, ResolvedOptions, API, never>;
408
+
409
+ type GetSchemaGeneratorOptions<T extends SchemaGenerator<any, any, any>> = T extends SchemaGenerator<infer Options, any, any> ? Options : never;
410
+ type SchemaMethodResult<TFileMeta extends FileMetaBase> = Promise<KubbFile.File<TFileMeta> | Array<KubbFile.File<TFileMeta>> | null>;
411
+ type Context$1<TOptions, TPluginOptions extends PluginFactoryOptions> = {
412
+ oas: Oas;
413
+ pluginManager: PluginManager;
414
+ /**
415
+ * Current plugin
416
+ */
417
+ plugin: Plugin<TPluginOptions>;
418
+ mode: KubbFile.Mode;
419
+ include?: Array<'schemas' | 'responses' | 'requestBodies'>;
420
+ override: Array<Override<TOptions>> | undefined;
421
+ contentType?: contentType;
422
+ output?: string;
423
+ };
424
+ type SchemaGeneratorOptions = {
425
+ dateType: false | 'string' | 'stringOffset' | 'stringLocal' | 'date';
426
+ unknownType: 'any' | 'unknown';
427
+ enumType?: 'enum' | 'asConst' | 'asPascalConst' | 'constEnum' | 'literal';
428
+ enumSuffix?: string;
429
+ usedEnumNames?: Record<string, number>;
430
+ mapper?: Record<string, string>;
431
+ typed?: boolean;
432
+ transformers: {
433
+ /**
434
+ * Customize the names based on the type that is provided by the plugin.
435
+ */
436
+ name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
437
+ /**
438
+ * Receive schema and name(propertName) and return FakerMeta array
439
+ * TODO TODO add docs
440
+ * @beta
441
+ */
442
+ schema?: (schemaProps: SchemaProps$1, defaultSchemas: Schema[]) => Schema[] | undefined;
443
+ };
444
+ };
445
+ type SchemaGeneratorBuildOptions = Omit<OperationSchema, 'name' | 'schema'>;
446
+ type SchemaProps$1 = {
447
+ schema?: SchemaObject;
448
+ name?: string;
449
+ parentName?: string;
450
+ };
451
+ declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGeneratorOptions, TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TOptions, Context$1<TOptions, TPluginOptions>> {
452
+ #private;
453
+ refs: Refs;
454
+ /**
455
+ * Creates a type node from a given schema.
456
+ * Delegates to getBaseTypeFromSchema internally and
457
+ * optionally adds a union with null.
458
+ */
459
+ parse(props: SchemaProps$1): Schema[];
460
+ deepSearch<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T][];
461
+ find<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
462
+ static deepSearch<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T][];
463
+ static findInObject<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
464
+ static find<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
465
+ build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
466
+ /**
467
+ * Schema
468
+ */
469
+ schema(name: string, object: SchemaObject, options: TOptions): SchemaMethodResult<TFileMeta>;
470
+ }
471
+
472
+ type OperationsProps<TOptions extends PluginFactoryOptions> = {
473
+ instance: Omit<OperationGenerator<TOptions>, 'build'>;
474
+ options: TOptions['resolvedOptions'];
475
+ operations: Array<Operation>;
476
+ operationsByMethod: OperationsByMethod;
477
+ };
478
+ type OperationProps<TOptions extends PluginFactoryOptions> = {
479
+ instance: Omit<OperationGenerator<TOptions>, 'build'>;
480
+ options: TOptions['resolvedOptions'];
481
+ operation: Operation;
482
+ };
483
+ type SchemaProps<TOptions extends PluginFactoryOptions> = {
484
+ instance: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions>, 'build'>;
485
+ options: TOptions['resolvedOptions'];
486
+ schema: {
487
+ name: string;
488
+ tree: Array<Schema>;
489
+ value: SchemaObject;
490
+ };
491
+ };
492
+ type GeneratorOptions<TOptions extends PluginFactoryOptions> = {
493
+ name: string;
494
+ operations?: (this: GeneratorOptions<TOptions>, props: OperationsProps<TOptions>) => Promise<KubbFile.File[]>;
495
+ operation?: (this: GeneratorOptions<TOptions>, props: OperationProps<TOptions>) => Promise<KubbFile.File[]>;
496
+ schema?: (this: GeneratorOptions<TOptions>, props: SchemaProps<TOptions>) => Promise<KubbFile.File[]>;
497
+ };
498
+ type Generator<TOptions extends PluginFactoryOptions> = GeneratorOptions<TOptions>;
499
+ declare function createGenerator<TOptions extends PluginFactoryOptions>(parseOptions: GeneratorOptions<TOptions>): Generator<TOptions>;
500
+ type ReactGeneratorOptions<TOptions extends PluginFactoryOptions> = {
501
+ name: string;
502
+ Operations?: (this: ReactGeneratorOptions<TOptions>, props: OperationsProps<TOptions>) => KubbNode;
503
+ Operation?: (this: ReactGeneratorOptions<TOptions>, props: OperationProps<TOptions>) => KubbNode;
504
+ Schema?: (this: ReactGeneratorOptions<TOptions>, props: SchemaProps<TOptions>) => KubbNode;
505
+ };
506
+ declare function createReactGenerator<TOptions extends PluginFactoryOptions>(parseOptions: ReactGeneratorOptions<TOptions>): Generator<TOptions>;
507
+
508
+ type OperationMethodResult<TFileMeta extends FileMetaBase> = Promise<KubbFile.File<TFileMeta> | Array<KubbFile.File<TFileMeta>> | null>;
509
+ type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
510
+ oas: Oas;
511
+ exclude: Array<Exclude> | undefined;
512
+ include: Array<Include> | undefined;
513
+ override: Array<Override<TOptions>> | undefined;
514
+ contentType: contentType | undefined;
515
+ pluginManager: PluginManager;
516
+ /**
517
+ * Current plugin
518
+ */
519
+ plugin: Plugin<TPluginOptions>;
520
+ mode: KubbFile.Mode;
521
+ };
522
+ declare class OperationGenerator<TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TPluginOptions['resolvedOptions'], Context<TPluginOptions['resolvedOptions'], TPluginOptions>> {
523
+ #private;
524
+ get operationsByMethod(): OperationsByMethod;
525
+ set operationsByMethod(paths: OperationsByMethod);
526
+ getSchemas(operation: Operation, { resolveName, }?: {
527
+ resolveName?: (name: string) => string;
528
+ }): OperationSchemas;
529
+ build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
530
+ /**
531
+ * Operation
532
+ */
533
+ operation(operation: Operation, options: TPluginOptions['resolvedOptions']): OperationMethodResult<TFileMeta>;
534
+ /**
535
+ * GET
536
+ */
537
+ get(operation: Operation, options: TPluginOptions['resolvedOptions']): OperationMethodResult<TFileMeta>;
538
+ /**
539
+ * POST
540
+ */
541
+ post(operation: Operation, options: TPluginOptions['resolvedOptions']): OperationMethodResult<TFileMeta>;
542
+ /**
543
+ * PATCH
544
+ */
545
+ patch(operation: Operation, options: TPluginOptions['resolvedOptions']): OperationMethodResult<TFileMeta>;
546
+ /**
547
+ * PUT
548
+ */
549
+ put(operation: Operation, options: TPluginOptions['resolvedOptions']): OperationMethodResult<TFileMeta>;
550
+ /**
551
+ * DELETE
552
+ */
553
+ delete(operation: Operation, options: TPluginOptions['resolvedOptions']): OperationMethodResult<TFileMeta>;
554
+ /**
555
+ * Combination of GET, POST, PATCH, PUT, DELETE
556
+ */
557
+ all(operations: Operation[], paths: OperationsByMethod): OperationMethodResult<TFileMeta>;
558
+ }
559
+
560
+ export { type API as A, getSchemas as B, type Exclude as E, type GetSchemaGeneratorOptions as G, type Include as I, type Options as O, type PluginOas as P, type ReactGeneratorOptions as R, type SchemaGeneratorBuildOptions as S, type OperationMethodResult as a, OperationGenerator as b, type SchemaGeneratorOptions as c, type SchemaMethodResult as d, SchemaGenerator as e, type Schema as f, type SchemaTree as g, type SchemaKeyword as h, type SchemaKeywordBase as i, type SchemaKeywordMapper as j, type SchemaMapper as k, isKeyword as l, createGenerator as m, createReactGenerator as n, type Generator as o, type GeneratorOptions as p, type ResolvePathOptions as q, type Ref as r, schemaKeywords as s, type Refs as t, type Resolver as u, type OperationSchema as v, type OperationSchemas as w, type OperationsByMethod as x, type Override as y, type GetSchemasProps as z };