@kubb/plugin-oas 4.3.1 → 4.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/dist/{Oas-DoN76W2_.js → Oas-CHC1IC5D.js} +5 -9
  2. package/dist/Oas-CHC1IC5D.js.map +1 -0
  3. package/dist/{Oas--cvTRMTA.cjs → Oas-CQrRP_NH.cjs} +13 -17
  4. package/dist/Oas-CQrRP_NH.cjs.map +1 -0
  5. package/dist/{OperationGenerator-XkW6FZJh.d.cts → OperationGenerator-CRZpkIpZ.d.ts} +182 -109
  6. package/dist/{OperationGenerator-ki8g970_.d.ts → OperationGenerator-S_1PevQN.d.cts} +182 -109
  7. package/dist/{Schema-CHstINXC.d.ts → Schema-CZsDEhET.d.cts} +7 -6
  8. package/dist/{Schema-BXYfUkqN.d.cts → Schema-DBvtiLS7.d.ts} +7 -6
  9. package/dist/{SchemaGenerator-DsK0wuii.cjs → SchemaGenerator-DWj6buY0.cjs} +22 -5
  10. package/dist/SchemaGenerator-DWj6buY0.cjs.map +1 -0
  11. package/dist/{SchemaGenerator-B07tXh1b.js → SchemaGenerator-b7XixzRv.js} +21 -4
  12. package/dist/SchemaGenerator-b7XixzRv.js.map +1 -0
  13. package/dist/{SchemaMapper-qjB3rBph.d.ts → SchemaMapper-CX7sIIuZ.d.cts} +5 -118
  14. package/dist/{SchemaMapper-MiRB5_Zp.d.cts → SchemaMapper-CtfTw3hq.d.ts} +5 -118
  15. package/dist/{SchemaMapper-CM1eXksi.js → SchemaMapper-Cx4X1al6.js} +1 -1
  16. package/dist/SchemaMapper-Cx4X1al6.js.map +1 -0
  17. package/dist/{SchemaMapper-CpAbmGiH.cjs → SchemaMapper-DoL-a6qq.cjs} +1 -1
  18. package/dist/SchemaMapper-DoL-a6qq.cjs.map +1 -0
  19. package/dist/chunk-BEV-X5tz.js +27 -0
  20. package/dist/components.cjs +1 -1
  21. package/dist/components.d.cts +8 -11
  22. package/dist/components.d.ts +8 -11
  23. package/dist/components.js +1 -1
  24. package/dist/generators-B27La9Vd.cjs +99 -0
  25. package/dist/generators-B27La9Vd.cjs.map +1 -0
  26. package/dist/generators-C61FxVIj.js +80 -0
  27. package/dist/generators-C61FxVIj.js.map +1 -0
  28. package/dist/generators.cjs +9 -3
  29. package/dist/generators.d.cts +3 -8
  30. package/dist/generators.d.ts +3 -8
  31. package/dist/generators.js +5 -4
  32. package/dist/{getFooter-pQXwqM81.cjs → getFooter-CwjCW4h5.cjs} +3 -3
  33. package/dist/{getFooter-pQXwqM81.cjs.map → getFooter-CwjCW4h5.cjs.map} +1 -1
  34. package/dist/{getFooter-CvTKkK7-.js → getFooter-D5MdeUVv.js} +2 -2
  35. package/dist/{getFooter-CvTKkK7-.js.map → getFooter-D5MdeUVv.js.map} +1 -1
  36. package/dist/{getSchemas-CvUX0jWa.js → getSchemas-Bdg6n9Qk.js} +1 -1
  37. package/dist/{getSchemas-CvUX0jWa.js.map → getSchemas-Bdg6n9Qk.js.map} +1 -1
  38. package/dist/{getSchemas-08CU8KWq.cjs → getSchemas-DY8s2CSl.cjs} +1 -1
  39. package/dist/{getSchemas-08CU8KWq.cjs.map → getSchemas-DY8s2CSl.cjs.map} +1 -1
  40. package/dist/hooks.cjs +12 -27
  41. package/dist/hooks.cjs.map +1 -1
  42. package/dist/hooks.d.cts +11 -31
  43. package/dist/hooks.d.ts +11 -31
  44. package/dist/hooks.js +9 -23
  45. package/dist/hooks.js.map +1 -1
  46. package/dist/index.cjs +37 -9
  47. package/dist/index.cjs.map +1 -1
  48. package/dist/index.d.cts +3 -9
  49. package/dist/index.d.ts +3 -9
  50. package/dist/index.js +33 -9
  51. package/dist/index.js.map +1 -1
  52. package/dist/mocks.cjs +1 -1
  53. package/dist/mocks.d.cts +1 -1
  54. package/dist/mocks.d.ts +1 -1
  55. package/dist/mocks.js +1 -1
  56. package/dist/{parseFromConfig-DSI6Meg0.js → parseFromConfig-CqiiLCPe.js} +1 -1
  57. package/dist/{parseFromConfig-DSI6Meg0.js.map → parseFromConfig-CqiiLCPe.js.map} +1 -1
  58. package/dist/{parseFromConfig-o3tU1XJt.cjs → parseFromConfig-RR31a98-.cjs} +1 -1
  59. package/dist/{parseFromConfig-o3tU1XJt.cjs.map → parseFromConfig-RR31a98-.cjs.map} +1 -1
  60. package/dist/utils-DYf-j63H.cjs +115 -0
  61. package/dist/utils-DYf-j63H.cjs.map +1 -0
  62. package/dist/utils-DaV25sy8.js +95 -0
  63. package/dist/utils-DaV25sy8.js.map +1 -0
  64. package/dist/utils.cjs +3 -3
  65. package/dist/utils.cjs.map +1 -1
  66. package/dist/utils.d.cts +4 -3
  67. package/dist/utils.d.ts +4 -3
  68. package/dist/utils.js +3 -3
  69. package/dist/utils.js.map +1 -1
  70. package/package.json +14 -11
  71. package/src/OperationGenerator.ts +36 -7
  72. package/src/SchemaGenerator.ts +26 -2
  73. package/src/SchemaMapper.ts +1 -1
  74. package/src/components/Oas.tsx +5 -12
  75. package/src/components/Operation.tsx +3 -3
  76. package/src/components/Schema.tsx +3 -4
  77. package/src/generators/createGenerator.ts +34 -0
  78. package/src/generators/createReactGenerator.ts +41 -0
  79. package/src/generators/index.ts +4 -0
  80. package/src/generators/jsonGenerator.ts +1 -1
  81. package/src/generators/types.ts +35 -0
  82. package/src/generators/utils.tsx +114 -0
  83. package/src/hooks/index.ts +1 -2
  84. package/src/hooks/useOas.ts +5 -11
  85. package/src/hooks/useOperation.ts +1 -1
  86. package/src/hooks/useOperationManager.ts +2 -2
  87. package/src/hooks/useSchema.ts +1 -1
  88. package/src/hooks/useSchemaManager.ts +1 -1
  89. package/src/index.ts +3 -5
  90. package/src/plugin.ts +2 -0
  91. package/src/types.ts +2 -2
  92. package/src/utils/getParams.ts +1 -1
  93. package/dist/Oas--cvTRMTA.cjs.map +0 -1
  94. package/dist/Oas-DoN76W2_.js.map +0 -1
  95. package/dist/SchemaGenerator-B07tXh1b.js.map +0 -1
  96. package/dist/SchemaGenerator-DsK0wuii.cjs.map +0 -1
  97. package/dist/SchemaMapper-CM1eXksi.js.map +0 -1
  98. package/dist/SchemaMapper-CpAbmGiH.cjs.map +0 -1
  99. package/dist/generators-BUNmB1lx.js +0 -154
  100. package/dist/generators-BUNmB1lx.js.map +0 -1
  101. package/dist/generators-CoiXCnDY.cjs +0 -175
  102. package/dist/generators-CoiXCnDY.cjs.map +0 -1
  103. package/src/generator.tsx +0 -139
  104. package/src/hooks/useOperations.ts +0 -40
@@ -1,15 +1,15 @@
1
- import { d as File, g as ResolvedFile, h as Path, i as SchemaKeywordMapper, l as BaseName, m as OptionalPath, p as Mode, t as Schema, u as Extname } from "./SchemaMapper-qjB3rBph.js";
1
+ import { i as SchemaKeywordMapper, t as Schema } from "./SchemaMapper-CX7sIIuZ.cjs";
2
2
  import * as OasTypes from "oas/types";
3
3
  import { HttpMethods as HttpMethod, OASDocument, SchemaObject, User } from "oas/types";
4
4
  import { Operation, Operation as Operation$1 } from "oas/operation";
5
5
  import { OpenAPIV3, OpenAPIV3 as OpenAPIV3$1, OpenAPIV3_1 } from "openapi-types";
6
6
  import * as oas_normalize_lib_types0 from "oas-normalize/lib/types";
7
7
  import BaseOas from "oas";
8
+ import { KubbNode } from "@kubb/react-fabric/types";
9
+ import { KubbFile } from "@kubb/fabric-core/types";
10
+ import { Fabric, FileManager } from "@kubb/react-fabric";
8
11
  import { ConsolaInstance, LogLevel } from "consola";
9
- import { FileManager } from "@kubb/fabric-core";
10
12
 
11
- //#region rolldown:runtime
12
- //#endregion
13
13
  //#region ../oas/src/types.d.ts
14
14
  type contentType = 'application/json' | (string & {});
15
15
  type SchemaObject$1 = OasTypes.SchemaObject & {
@@ -44,19 +44,18 @@ declare class Oas<const TOAS = unknown> extends BaseOas {
44
44
  getParametersSchema(operation: Operation, inKey: 'path' | 'query' | 'header'): SchemaObject | null;
45
45
  valdiate(): Promise<oas_normalize_lib_types0.ValidationResult>;
46
46
  }
47
- import * as import___kubb_react_fabric_types from "@kubb/react-fabric/types";
48
47
  //#endregion
49
48
  //#region ../core/src/BaseGenerator.d.ts
50
49
  /**
51
50
  * Abstract class that contains the building blocks for plugins to create their own Generator
52
51
  * @link idea based on https://github.com/colinhacks/zod/blob/master/src/types.ts#L137
53
52
  */
54
- declare abstract class BaseGenerator<TOptions$1 = unknown, TContext = unknown> {
53
+ declare abstract class BaseGenerator<TOptions = unknown, TContext = unknown> {
55
54
  #private;
56
- constructor(options?: TOptions$1, context?: TContext);
57
- get options(): TOptions$1;
55
+ constructor(options?: TOptions, context?: TContext);
56
+ get options(): TOptions;
58
57
  get context(): TContext;
59
- set options(options: TOptions$1);
58
+ set options(options: TOptions);
60
59
  abstract build(...params: unknown[]): unknown;
61
60
  }
62
61
  //#endregion
@@ -109,7 +108,7 @@ type Logger = {
109
108
  };
110
109
  //#endregion
111
110
  //#region ../core/src/utils/types.d.ts
112
- type PossiblePromise<T$1> = Promise<T$1> | T$1;
111
+ type PossiblePromise<T> = Promise<T> | T;
113
112
  //#endregion
114
113
  //#region ../core/src/types.d.ts
115
114
  type InputPath = {
@@ -183,7 +182,7 @@ type Config<TInput = Input> = {
183
182
  * Override the extension to the generated imports and exports, by default each plugin will add an extension
184
183
  * @default { '.ts': '.ts'}
185
184
  */
186
- extension?: Record<Extname, Extname | ''>;
185
+ extension?: Record<KubbFile.Extname, KubbFile.Extname | ''>;
187
186
  /**
188
187
  * Specify how `index.ts` files should be created. You can also disable the generation of barrel files here. While each plugin has its own `barrelType` option, this setting controls the creation of the root barrel file, such as` src/gen/index.ts`.
189
188
  * @default 'named'
@@ -222,11 +221,11 @@ TName extends string = string,
222
221
  /**
223
222
  * Options of the plugin.
224
223
  */
225
- TOptions$1 extends object = object,
224
+ TOptions extends object = object,
226
225
  /**
227
226
  * Options of the plugin that can be used later on, see `options` inside your plugin config.
228
227
  */
229
- TResolvedOptions extends object = TOptions$1,
228
+ TResolvedOptions extends object = TOptions,
230
229
  /**
231
230
  * Context that you want to expose to other plugins.
232
231
  */
@@ -240,23 +239,23 @@ TResolvePathOptions extends object = object> = {
240
239
  * Same behaviour like what has been done with `QueryKey` in `@tanstack/react-query`
241
240
  */
242
241
  key: PluginKey<TName | string>;
243
- options: TOptions$1;
242
+ options: TOptions;
244
243
  resolvedOptions: TResolvedOptions;
245
244
  context: TContext;
246
245
  resolvePathOptions: TResolvePathOptions;
247
246
  };
248
247
  type PluginKey<TName> = [name: TName, identifier?: string | number];
249
- type UserPlugin<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = {
248
+ type UserPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
250
249
  /**
251
250
  * Unique name used for the plugin
252
251
  * The name of the plugin follows the format scope:foo-bar or foo-bar, adding scope: can avoid naming conflicts with other plugins.
253
252
  * @example @kubb/typescript
254
253
  */
255
- name: TOptions$1['name'];
254
+ name: TOptions['name'];
256
255
  /**
257
256
  * Options set for a specific plugin(see kubb.config.js), passthrough of options.
258
257
  */
259
- options: TOptions$1['resolvedOptions'];
258
+ options: TOptions['resolvedOptions'];
260
259
  /**
261
260
  * Specifies the preceding plugins for the current plugin. You can pass an array of preceding plugin names, and the current plugin will be executed after these plugins.
262
261
  * Can be used to validate dependent plugins.
@@ -266,23 +265,23 @@ type UserPlugin<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions>
266
265
  * Specifies the succeeding plugins for the current plugin. You can pass an array of succeeding plugin names, and the current plugin will be executed before these plugins.
267
266
  */
268
267
  post?: Array<string>;
269
- } & (TOptions$1['context'] extends never ? {
268
+ } & (TOptions['context'] extends never ? {
270
269
  context?: never;
271
270
  } : {
272
- context: (this: TOptions$1['name'] extends 'core' ? null : Omit<PluginContext<TOptions$1>, 'addFile'>) => TOptions$1['context'];
271
+ context: (this: TOptions['name'] extends 'core' ? null : Omit<PluginContext<TOptions>, 'addFile'>) => TOptions['context'];
273
272
  });
274
- type UserPluginWithLifeCycle<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = UserPlugin<TOptions$1> & PluginLifecycle<TOptions$1>;
275
- type Plugin<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = {
273
+ type UserPluginWithLifeCycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = UserPlugin<TOptions> & PluginLifecycle<TOptions>;
274
+ type Plugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
276
275
  /**
277
276
  * Unique name used for the plugin
278
277
  * @example @kubb/typescript
279
278
  */
280
- name: TOptions$1['name'];
279
+ name: TOptions['name'];
281
280
  /**
282
281
  * Internal key used when a developer uses more than one of the same plugin
283
282
  * @private
284
283
  */
285
- key: TOptions$1['key'];
284
+ key: TOptions['key'];
286
285
  /**
287
286
  * Specifies the preceding plugins for the current plugin. You can pass an array of preceding plugin names, and the current plugin will be executed after these plugins.
288
287
  * Can be used to validate dependent plugins.
@@ -295,49 +294,49 @@ type Plugin<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = {
295
294
  /**
296
295
  * Options set for a specific plugin(see kubb.config.js), passthrough of options.
297
296
  */
298
- options: TOptions$1['resolvedOptions'];
299
- } & (TOptions$1['context'] extends never ? {
297
+ options: TOptions['resolvedOptions'];
298
+ } & (TOptions['context'] extends never ? {
300
299
  context?: never;
301
300
  } : {
302
- context: TOptions$1['context'];
301
+ context: TOptions['context'];
303
302
  });
304
- type PluginWithLifeCycle<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = Plugin<TOptions$1> & PluginLifecycle<TOptions$1>;
305
- type PluginLifecycle<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = {
303
+ type PluginWithLifeCycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = Plugin<TOptions> & PluginLifecycle<TOptions>;
304
+ type PluginLifecycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
306
305
  /**
307
306
  * Start of the lifecycle of a plugin.
308
307
  * @type hookParallel
309
308
  */
310
- buildStart?: (this: PluginContext<TOptions$1>, Config: Config) => PossiblePromise<void>;
309
+ buildStart?: (this: PluginContext<TOptions>, Config: Config) => PossiblePromise<void>;
311
310
  /**
312
311
  * Resolve to a Path based on a baseName(example: `./Pet.ts`) and directory(example: `./models`).
313
312
  * Options can als be included.
314
313
  * @type hookFirst
315
314
  * @example ('./Pet.ts', './src/gen/') => '/src/gen/Pet.ts'
316
315
  */
317
- resolvePath?: (this: PluginContext<TOptions$1>, baseName: BaseName, mode?: Mode, options?: TOptions$1['resolvePathOptions']) => OptionalPath;
316
+ resolvePath?: (this: PluginContext<TOptions>, baseName: KubbFile.BaseName, mode?: KubbFile.Mode, options?: TOptions['resolvePathOptions']) => KubbFile.OptionalPath;
318
317
  /**
319
318
  * Resolve to a name based on a string.
320
319
  * Useful when converting to PascalCase or camelCase.
321
320
  * @type hookFirst
322
321
  * @example ('pet') => 'Pet'
323
322
  */
324
- resolveName?: (this: PluginContext<TOptions$1>, name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
323
+ resolveName?: (this: PluginContext<TOptions>, name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
325
324
  /**
326
325
  * End of the plugin lifecycle.
327
326
  * @type hookParallel
328
327
  */
329
- buildEnd?: (this: PluginContext<TOptions$1>) => PossiblePromise<void>;
328
+ buildEnd?: (this: PluginContext<TOptions>) => PossiblePromise<void>;
330
329
  };
331
330
  type PluginLifecycleHooks = keyof PluginLifecycle;
332
- type PluginParameter<H$1 extends PluginLifecycleHooks> = Parameters<Required<PluginLifecycle>[H$1]>;
333
- type ResolvePathParams<TOptions$1 = object> = {
331
+ type PluginParameter<H extends PluginLifecycleHooks> = Parameters<Required<PluginLifecycle>[H]>;
332
+ type ResolvePathParams<TOptions = object> = {
334
333
  pluginKey?: Plugin['key'];
335
- baseName: BaseName;
336
- mode?: Mode;
334
+ baseName: KubbFile.BaseName;
335
+ mode?: KubbFile.Mode;
337
336
  /**
338
337
  * Options to be passed to 'resolvePath' 3th parameter
339
338
  */
340
- options?: TOptions$1;
339
+ options?: TOptions;
341
340
  };
342
341
  type ResolveNameParams = {
343
342
  name: string;
@@ -350,15 +349,16 @@ type ResolveNameParams = {
350
349
  */
351
350
  type?: 'file' | 'function' | 'type' | 'const';
352
351
  };
353
- type PluginContext<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = {
352
+ type PluginContext<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
353
+ fabric: Fabric;
354
354
  config: Config;
355
355
  /**
356
356
  * @deprecated
357
357
  */
358
358
  fileManager: FileManager;
359
359
  pluginManager: PluginManager;
360
- addFile: (...file: Array<File>) => Promise<Array<ResolvedFile>>;
361
- resolvePath: (params: ResolvePathParams<TOptions$1['resolvePathOptions']>) => OptionalPath;
360
+ addFile: (...file: Array<KubbFile.File>) => Promise<Array<KubbFile.ResolvedFile>>;
361
+ resolvePath: (params: ResolvePathParams<TOptions['resolvePathOptions']>) => KubbFile.OptionalPath;
362
362
  resolveName: (params: ResolveNameParams) => string;
363
363
  logger: Logger;
364
364
  /**
@@ -368,12 +368,12 @@ type PluginContext<TOptions$1 extends PluginFactoryOptions = PluginFactoryOption
368
368
  /**
369
369
  * Current plugin
370
370
  */
371
- plugin: Plugin<TOptions$1>;
371
+ plugin: Plugin<TOptions>;
372
372
  };
373
373
  /**
374
374
  * Specify the export location for the files and define the behavior of the output
375
375
  */
376
- type Output<TOptions$1> = {
376
+ type Output<TOptions> = {
377
377
  /**
378
378
  * Path to the output folder or file that will contain the generated code
379
379
  */
@@ -386,11 +386,11 @@ type Output<TOptions$1> = {
386
386
  /**
387
387
  * Add a banner text in the beginning of every file
388
388
  */
389
- banner?: string | ((options: TOptions$1) => string);
389
+ banner?: string | ((options: TOptions) => string);
390
390
  /**
391
391
  * Add a footer text in the beginning of every file
392
392
  */
393
- footer?: string | ((options: TOptions$1) => string);
393
+ footer?: string | ((options: TOptions) => string);
394
394
  };
395
395
  type GroupContext = {
396
396
  group: string;
@@ -409,20 +409,21 @@ type Group = {
409
409
  //#region ../core/src/PluginManager.d.ts
410
410
  type RequiredPluginLifecycle = Required<PluginLifecycle>;
411
411
  type Strategy = 'hookFirst' | 'hookForPlugin' | 'hookParallel' | 'hookSeq';
412
- type Executer<H$1 extends PluginLifecycleHooks = PluginLifecycleHooks> = {
412
+ type Executer<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
413
413
  message: string;
414
414
  strategy: Strategy;
415
- hookName: H$1;
415
+ hookName: H;
416
416
  plugin: Plugin;
417
417
  parameters?: unknown[] | undefined;
418
418
  output?: unknown;
419
419
  };
420
- type ParseResult<H$1 extends PluginLifecycleHooks> = RequiredPluginLifecycle[H$1];
421
- type SafeParseResult<H$1 extends PluginLifecycleHooks, Result = ReturnType<ParseResult<H$1>>> = {
420
+ type ParseResult<H extends PluginLifecycleHooks> = RequiredPluginLifecycle[H];
421
+ type SafeParseResult<H extends PluginLifecycleHooks, Result = ReturnType<ParseResult<H>>> = {
422
422
  result: Result;
423
423
  plugin: Plugin;
424
424
  };
425
425
  type Options$2 = {
426
+ fabric: Fabric;
426
427
  logger: Logger;
427
428
  /**
428
429
  * @default Number.POSITIVE_INFINITY
@@ -434,20 +435,16 @@ type Events = {
434
435
  executed: [executer: Executer];
435
436
  error: [error: Error];
436
437
  };
437
- type GetFileProps<TOptions$1 = object> = {
438
+ type GetFileProps<TOptions = object> = {
438
439
  name: string;
439
- mode?: Mode;
440
- extname: Extname;
440
+ mode?: KubbFile.Mode;
441
+ extname: KubbFile.Extname;
441
442
  pluginKey: Plugin['key'];
442
- options?: TOptions$1;
443
+ options?: TOptions;
443
444
  };
444
445
  declare class PluginManager {
445
446
  #private;
446
447
  readonly plugins: Set<Plugin<PluginFactoryOptions<string, object, object, any, object>>>;
447
- /**
448
- * @deprecated do not use from pluginManager
449
- */
450
- readonly fileManager: FileManager;
451
448
  readonly events: EventEmitter<Events>;
452
449
  readonly config: Config;
453
450
  readonly executed: Array<Executer>;
@@ -460,10 +457,10 @@ declare class PluginManager {
460
457
  extname,
461
458
  pluginKey,
462
459
  options
463
- }: GetFileProps<TOptions>): File<{
460
+ }: GetFileProps<TOptions>): KubbFile.File<{
464
461
  pluginKey: Plugin['key'];
465
462
  }>;
466
- resolvePath: <TOptions = object>(params: ResolvePathParams<TOptions>) => OptionalPath;
463
+ resolvePath: <TOptions = object>(params: ResolvePathParams<TOptions>) => KubbFile.OptionalPath;
467
464
  resolveName: (params: ResolveNameParams) => string;
468
465
  /**
469
466
  * Instead of calling `pluginManager.events.on` you can use `pluginManager.on`. This one also has better types.
@@ -560,6 +557,45 @@ type FileMetaBase = {
560
557
  pluginKey?: Plugin['key'];
561
558
  };
562
559
  //#endregion
560
+ //#region src/generators/createGenerator.d.ts
561
+ type UserGenerator$1<TOptions extends PluginFactoryOptions> = {
562
+ name: string;
563
+ operations?: (props: OperationsProps<TOptions>) => Promise<KubbFile.File[]>;
564
+ operation?: (props: OperationProps<TOptions>) => Promise<KubbFile.File[]>;
565
+ schema?: (props: SchemaProps<TOptions>) => Promise<KubbFile.File[]>;
566
+ };
567
+ type CoreGenerator<TOptions extends PluginFactoryOptions> = {
568
+ name: string;
569
+ type: 'core';
570
+ operations: (props: OperationsProps<TOptions>) => Promise<KubbFile.File[]>;
571
+ operation: (props: OperationProps<TOptions>) => Promise<KubbFile.File[]>;
572
+ schema: (props: SchemaProps<TOptions>) => Promise<KubbFile.File[]>;
573
+ };
574
+ declare function createGenerator<TOptions extends PluginFactoryOptions>(generator: UserGenerator$1<TOptions>): CoreGenerator<TOptions>;
575
+ //#endregion
576
+ //#region src/generators/createReactGenerator.d.ts
577
+ type UserGenerator<TOptions extends PluginFactoryOptions> = {
578
+ name: string;
579
+ Operations?: (props: OperationsProps<TOptions>) => KubbNode;
580
+ Operation?: (props: OperationProps<TOptions>) => KubbNode;
581
+ Schema?: (props: SchemaProps<TOptions>) => KubbNode;
582
+ };
583
+ type ReactGenerator<TOptions extends PluginFactoryOptions> = {
584
+ name: string;
585
+ type: 'react';
586
+ Operations: (props: OperationsProps<TOptions>) => KubbNode;
587
+ Operation: (props: OperationProps<TOptions>) => KubbNode;
588
+ Schema: (props: SchemaProps<TOptions>) => KubbNode;
589
+ };
590
+ /****
591
+ * Creates a generator that uses React component functions to generate files for OpenAPI operations and schemas.
592
+ *
593
+ * The returned generator exposes async methods for generating files from operations, a single operation, or a schema, using the corresponding React components if provided. If a component is not defined, the method returns an empty array.
594
+ *
595
+ * @returns A generator object with async methods for operations, operation, and schema file generation.
596
+ */
597
+ declare function createReactGenerator<TOptions extends PluginFactoryOptions>(generator: UserGenerator<TOptions>): ReactGenerator<TOptions>;
598
+ //#endregion
563
599
  //#region src/types.d.ts
564
600
  type ResolvePathOptions = {
565
601
  pluginKey?: Plugin['key'];
@@ -633,7 +669,7 @@ type Options$1 = {
633
669
  type Ref = {
634
670
  propertyName: string;
635
671
  originalName: string;
636
- path: OptionalPath;
672
+ path: KubbFile.OptionalPath;
637
673
  pluginKey?: Plugin['key'];
638
674
  };
639
675
  type Refs = Record<string, Ref>;
@@ -642,8 +678,8 @@ type Resolver = {
642
678
  * Original name or name resolved by `resolveName({ name: operation?.getOperationId() as string, pluginName })`
643
679
  */
644
680
  name: string;
645
- baseName: BaseName;
646
- path: Path;
681
+ baseName: KubbFile.BaseName;
682
+ path: KubbFile.Path;
647
683
  };
648
684
  type OperationSchema = {
649
685
  /**
@@ -704,27 +740,31 @@ type ByContentType = {
704
740
  };
705
741
  type Exclude$1 = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
706
742
  type Include = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
707
- type Override<TOptions$1> = (ByTag | ByOperationId | ByPath | ByMethod | BySchemaName | ByContentType) & {
708
- options: Partial<TOptions$1>;
743
+ type Override<TOptions> = (ByTag | ByOperationId | ByPath | ByMethod | BySchemaName | ByContentType) & {
744
+ options: Partial<TOptions>;
709
745
  };
710
746
  type ResolvedOptions = Options$1 & {
711
747
  output: Output<Oas>;
712
748
  };
713
749
  type PluginOas = PluginFactoryOptions<'plugin-oas', Options$1, ResolvedOptions, API, ResolvePathOptions>;
714
750
  //#endregion
751
+ //#region src/generators/jsonGenerator.d.ts
752
+ declare const jsonGenerator: CoreGenerator<PluginOas>;
753
+ //#endregion
715
754
  //#region src/SchemaGenerator.d.ts
716
- type GetSchemaGeneratorOptions<T$1 extends SchemaGenerator<any, any, any>> = T$1 extends SchemaGenerator<infer Options, any, any> ? Options : never;
717
- type SchemaMethodResult<TFileMeta extends FileMetaBase> = Promise<File<TFileMeta> | Array<File<TFileMeta>> | null>;
718
- type Context$1<TOptions$1, TPluginOptions extends PluginFactoryOptions> = {
755
+ type GetSchemaGeneratorOptions<T extends SchemaGenerator<any, any, any>> = T extends SchemaGenerator<infer Options, any, any> ? Options : never;
756
+ type SchemaMethodResult<TFileMeta extends FileMetaBase> = Promise<KubbFile.File<TFileMeta> | Array<KubbFile.File<TFileMeta>> | null>;
757
+ type Context$1<TOptions, TPluginOptions extends PluginFactoryOptions> = {
758
+ fabric: Fabric;
719
759
  oas: Oas;
720
760
  pluginManager: PluginManager;
721
761
  /**
722
762
  * Current plugin
723
763
  */
724
764
  plugin: Plugin<TPluginOptions>;
725
- mode: Mode;
765
+ mode: KubbFile.Mode;
726
766
  include?: Array<'schemas' | 'responses' | 'requestBodies'>;
727
- override: Array<Override<TOptions$1>> | undefined;
767
+ override: Array<Override<TOptions>> | undefined;
728
768
  contentType?: contentType;
729
769
  output?: string;
730
770
  };
@@ -756,7 +796,7 @@ type SchemaProps$1 = {
756
796
  name?: string;
757
797
  parentName?: string;
758
798
  };
759
- declare class SchemaGenerator<TOptions$1 extends SchemaGeneratorOptions = SchemaGeneratorOptions, TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TOptions$1, Context$1<TOptions$1, TPluginOptions>> {
799
+ declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGeneratorOptions, TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TOptions, Context$1<TOptions, TPluginOptions>> {
760
800
  #private;
761
801
  refs: Refs;
762
802
  /**
@@ -771,66 +811,99 @@ declare class SchemaGenerator<TOptions$1 extends SchemaGeneratorOptions = Schema
771
811
  static findInObject<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
772
812
  static find<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
773
813
  static combineObjects(tree: Schema[] | undefined): Schema[];
774
- build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<File<TFileMeta>>>;
814
+ build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
775
815
  }
776
816
  //#endregion
777
- //#region src/generator.d.ts
778
- type OperationsProps<TOptions$1 extends PluginFactoryOptions> = {
779
- instance: Omit<OperationGenerator<TOptions$1>, 'build'>;
780
- options: TOptions$1['resolvedOptions'];
817
+ //#region src/generators/utils.d.ts
818
+ type BuildOperationsOptions<TOptions extends PluginFactoryOptions> = {
819
+ fabric: Fabric;
820
+ generator: ReactGenerator<any>;
821
+ /**
822
+ * @deprecated
823
+ */
824
+ instance: Omit<OperationGenerator<TOptions>, 'build'>;
825
+ options: TOptions['resolvedOptions'];
826
+ };
827
+ declare function buildOperations<TOptions extends PluginFactoryOptions>(operations: Array<Operation$1>, {
828
+ fabric,
829
+ options,
830
+ instance,
831
+ generator
832
+ }: BuildOperationsOptions<TOptions>): Promise<void>;
833
+ type BuildOperationOptions<TOptions extends PluginFactoryOptions> = BuildOperationsOptions<TOptions>;
834
+ declare function buildOperation<TOptions extends PluginFactoryOptions>(operation: Operation$1, {
835
+ fabric,
836
+ options,
837
+ instance,
838
+ generator
839
+ }: BuildOperationOptions<TOptions>): Promise<void>;
840
+ type BuildSchemaOptions<TOptions extends PluginFactoryOptions> = {
841
+ fabric: Fabric;
842
+ generator: ReactGenerator<any>;
843
+ /**
844
+ * @deprecated
845
+ */
846
+ instance: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions>, 'build'>;
847
+ options: TOptions['resolvedOptions'];
848
+ };
849
+ declare function buildSchema<TOptions extends PluginFactoryOptions>(schema: {
850
+ name: string;
851
+ tree: Array<Schema>;
852
+ value: SchemaObject$1;
853
+ }, {
854
+ fabric,
855
+ options,
856
+ instance,
857
+ generator
858
+ }: BuildSchemaOptions<TOptions>): Promise<void>;
859
+ //#endregion
860
+ //#region src/plugin.d.ts
861
+ declare const pluginOasName = "plugin-oas";
862
+ declare const pluginOas: (options?: Options$1 | undefined) => UserPluginWithLifeCycle<PluginOas>;
863
+ //#endregion
864
+ //#region src/generators/types.d.ts
865
+ type OperationsProps<TOptions extends PluginFactoryOptions> = {
866
+ /**
867
+ * @deprecated
868
+ */
869
+ instance: Omit<OperationGenerator<TOptions>, 'build'>;
870
+ options: TOptions['resolvedOptions'];
781
871
  operations: Array<Operation$1>;
782
872
  };
783
- type OperationProps<TOptions$1 extends PluginFactoryOptions> = {
784
- instance: Omit<OperationGenerator<TOptions$1>, 'build'>;
785
- options: TOptions$1['resolvedOptions'];
873
+ type OperationProps<TOptions extends PluginFactoryOptions> = {
874
+ /**
875
+ * @deprecated
876
+ */
877
+ instance: Omit<OperationGenerator<TOptions>, 'build'>;
878
+ options: TOptions['resolvedOptions'];
786
879
  operation: Operation$1;
787
880
  };
788
- type SchemaProps<TOptions$1 extends PluginFactoryOptions> = {
789
- instance: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions$1>, 'build'>;
790
- options: TOptions$1['resolvedOptions'];
881
+ type SchemaProps<TOptions extends PluginFactoryOptions> = {
882
+ instance: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions>, 'build'>;
883
+ options: TOptions['resolvedOptions'];
791
884
  schema: {
792
885
  name: string;
793
886
  tree: Array<Schema>;
794
887
  value: SchemaObject$1;
795
888
  };
796
889
  };
797
- type GeneratorOptions<TOptions$1 extends PluginFactoryOptions> = {
798
- name: string;
799
- operations?: (this: GeneratorOptions<TOptions$1>, props: OperationsProps<TOptions$1>) => Promise<File[]>;
800
- operation?: (this: GeneratorOptions<TOptions$1>, props: OperationProps<TOptions$1>) => Promise<File[]>;
801
- schema?: (this: GeneratorOptions<TOptions$1>, props: SchemaProps<TOptions$1>) => Promise<File[]>;
802
- };
803
- type Generator<TOptions$1 extends PluginFactoryOptions> = GeneratorOptions<TOptions$1>;
804
- declare function createGenerator<TOptions$1 extends PluginFactoryOptions>(parseOptions: GeneratorOptions<TOptions$1>): Generator<TOptions$1>;
805
- type ReactGeneratorOptions<TOptions$1 extends PluginFactoryOptions> = {
806
- name: string;
807
- Operations?: (this: ReactGeneratorOptions<TOptions$1>, props: OperationsProps<TOptions$1>) => types_d_exports$1.KubbNode;
808
- Operation?: (this: ReactGeneratorOptions<TOptions$1>, props: OperationProps<TOptions$1>) => types_d_exports$1.KubbNode;
809
- Schema?: (this: ReactGeneratorOptions<TOptions$1>, props: SchemaProps<TOptions$1>) => types_d_exports$1.KubbNode;
810
- };
811
- /****
812
- * Creates a generator that uses React component functions to generate files for OpenAPI operations and schemas.
813
- *
814
- * The returned generator exposes async methods for generating files from operations, a single operation, or a schema, using the corresponding React components if provided. If a component is not defined, the method returns an empty array.
815
- *
816
- * @returns A generator object with async methods for operations, operation, and schema file generation.
817
- */
818
- declare function createReactGenerator<TOptions$1 extends PluginFactoryOptions>(parseOptions: ReactGeneratorOptions<TOptions$1>): Generator<TOptions$1>;
890
+ type Generator<TOptions extends PluginFactoryOptions> = CoreGenerator<TOptions> | ReactGenerator<TOptions>;
819
891
  //#endregion
820
892
  //#region src/OperationGenerator.d.ts
821
- type OperationMethodResult<TFileMeta extends FileMetaBase> = Promise<File<TFileMeta> | Array<File<TFileMeta>> | null>;
822
- type Context<TOptions$1, TPluginOptions extends PluginFactoryOptions> = {
893
+ type OperationMethodResult<TFileMeta extends FileMetaBase> = Promise<KubbFile.File<TFileMeta> | Array<KubbFile.File<TFileMeta>> | null>;
894
+ type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
895
+ fabric: Fabric;
823
896
  oas: Oas;
824
897
  exclude: Array<Exclude$1> | undefined;
825
898
  include: Array<Include> | undefined;
826
- override: Array<Override<TOptions$1>> | undefined;
899
+ override: Array<Override<TOptions>> | undefined;
827
900
  contentType: contentType | undefined;
828
901
  pluginManager: PluginManager;
829
902
  /**
830
903
  * Current plugin
831
904
  */
832
905
  plugin: Plugin<TPluginOptions>;
833
- mode: Mode;
906
+ mode: KubbFile.Mode;
834
907
  };
835
908
  declare class OperationGenerator<TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TPluginOptions['resolvedOptions'], Context<TPluginOptions['resolvedOptions'], TPluginOptions>> {
836
909
  #private;
@@ -844,8 +917,8 @@ declare class OperationGenerator<TPluginOptions extends PluginFactoryOptions = P
844
917
  method: HttpMethod;
845
918
  operation: Operation$1;
846
919
  }>>;
847
- build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<File<TFileMeta>>>;
920
+ build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
848
921
  }
849
922
  //#endregion
850
- export { UserPluginWithLifeCycle as A, ResolvePathOptions as C, Output as D, Config as E, OpenAPIV3$1 as F, OpenAPIV3_1 as I, Operation$1 as L, Oas as M, HttpMethod as N, Plugin as O, OasTypes as P, SchemaObject$1 as R, Refs as S, FileMetaBase as T, OperationSchemas as _, ReactGeneratorOptions as a, PluginOas as b, GetSchemaGeneratorOptions as c, SchemaGeneratorOptions as d, SchemaMethodResult as f, OperationSchema as g, Include as h, GeneratorOptions as i, types_d_exports$1 as j, ResolveNameParams as k, SchemaGenerator as l, Exclude$1 as m, OperationMethodResult as n, createGenerator as o, API as p, Generator as r, createReactGenerator as s, OperationGenerator as t, SchemaGeneratorBuildOptions as u, Options$1 as v, Resolver as w, Ref as x, Override as y, contentType as z };
851
- //# sourceMappingURL=OperationGenerator-ki8g970_.d.ts.map
923
+ export { Config as A, contentType as B, Ref as C, createReactGenerator as D, Resolver as E, OasTypes as F, OpenAPIV3$1 as I, OpenAPIV3_1 as L, Plugin as M, ResolveNameParams as N, createGenerator as O, Oas as P, Operation$1 as R, PluginOas as S, ResolvePathOptions as T, Include as _, pluginOasName as a, Options$1 as b, buildSchema as c, SchemaGeneratorBuildOptions as d, SchemaGeneratorOptions as f, Exclude$1 as g, API as h, pluginOas as i, Output as j, FileMetaBase as k, GetSchemaGeneratorOptions as l, jsonGenerator as m, OperationMethodResult as n, buildOperation as o, SchemaMethodResult as p, Generator as r, buildOperations as s, OperationGenerator as t, SchemaGenerator as u, OperationSchema as v, Refs as w, Override as x, OperationSchemas as y, SchemaObject$1 as z };
924
+ //# sourceMappingURL=OperationGenerator-S_1PevQN.d.cts.map
@@ -1,5 +1,6 @@
1
- import { R as SchemaObject, j as types_d_exports } from "./OperationGenerator-ki8g970_.js";
2
- import { t as Schema } from "./SchemaMapper-qjB3rBph.js";
1
+ import { z as SchemaObject } from "./OperationGenerator-S_1PevQN.cjs";
2
+ import { t as Schema } from "./SchemaMapper-CX7sIIuZ.cjs";
3
+ import { Key, KubbNode } from "@kubb/react-fabric/types";
3
4
 
4
5
  //#region src/components/Schema.d.ts
5
6
  type SchemaContextProps = {
@@ -8,11 +9,11 @@ type SchemaContextProps = {
8
9
  tree: Array<Schema>;
9
10
  };
10
11
  type Props = {
11
- key?: types_d_exports.Key;
12
+ key?: Key;
12
13
  name: string;
13
14
  schemaObject?: SchemaObject;
14
15
  tree?: Array<Schema>;
15
- children?: types_d_exports.KubbNode;
16
+ children?: KubbNode;
16
17
  };
17
18
  /**
18
19
  * Provides schema-related context to descendant components.
@@ -28,10 +29,10 @@ declare function Schema$1({
28
29
  schemaObject,
29
30
  tree,
30
31
  children
31
- }: Props): any;
32
+ }: Props): KubbNode;
32
33
  declare namespace Schema$1 {
33
34
  var Context;
34
35
  }
35
36
  //#endregion
36
37
  export { SchemaContextProps as n, Schema$1 as t };
37
- //# sourceMappingURL=Schema-CHstINXC.d.ts.map
38
+ //# sourceMappingURL=Schema-CZsDEhET.d.cts.map
@@ -1,5 +1,6 @@
1
- import { R as SchemaObject, j as types_d_exports } from "./OperationGenerator-XkW6FZJh.cjs";
2
- import { t as Schema } from "./SchemaMapper-MiRB5_Zp.cjs";
1
+ import { z as SchemaObject } from "./OperationGenerator-CRZpkIpZ.js";
2
+ import { t as Schema } from "./SchemaMapper-CtfTw3hq.js";
3
+ import { Key, KubbNode } from "@kubb/react-fabric/types";
3
4
 
4
5
  //#region src/components/Schema.d.ts
5
6
  type SchemaContextProps = {
@@ -8,11 +9,11 @@ type SchemaContextProps = {
8
9
  tree: Array<Schema>;
9
10
  };
10
11
  type Props = {
11
- key?: types_d_exports.Key;
12
+ key?: Key;
12
13
  name: string;
13
14
  schemaObject?: SchemaObject;
14
15
  tree?: Array<Schema>;
15
- children?: types_d_exports.KubbNode;
16
+ children?: KubbNode;
16
17
  };
17
18
  /**
18
19
  * Provides schema-related context to descendant components.
@@ -28,10 +29,10 @@ declare function Schema$1({
28
29
  schemaObject,
29
30
  tree,
30
31
  children
31
- }: Props): any;
32
+ }: Props): KubbNode;
32
33
  declare namespace Schema$1 {
33
34
  var Context;
34
35
  }
35
36
  //#endregion
36
37
  export { SchemaContextProps as n, Schema$1 as t };
37
- //# sourceMappingURL=Schema-BXYfUkqN.d.cts.map
38
+ //# sourceMappingURL=Schema-DBvtiLS7.d.ts.map