@kubb/plugin-faker 4.3.1 → 4.4.0

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 (32) hide show
  1. package/dist/chunk-DMmIE7y6.js +28 -0
  2. package/dist/{components-BHsLXkVC.cjs → components-BtFAhtPK.cjs} +9 -9
  3. package/dist/{components-BHsLXkVC.cjs.map → components-BtFAhtPK.cjs.map} +1 -1
  4. package/dist/{components-C-Ia_yc3.js → components-DdXRywj6.js} +3 -3
  5. package/dist/{components-C-Ia_yc3.js.map → components-DdXRywj6.js.map} +1 -1
  6. package/dist/components.cjs +1 -1
  7. package/dist/components.d.cts +3 -2
  8. package/dist/components.d.ts +3 -2
  9. package/dist/components.js +1 -1
  10. package/dist/{fakerGenerator-BgUuFQPq.cjs → fakerGenerator-6YTX8ENZ.cjs} +23 -22
  11. package/dist/fakerGenerator-6YTX8ENZ.cjs.map +1 -0
  12. package/dist/{fakerGenerator-CXvRE7-U.js → fakerGenerator-D3zaPh1_.js} +6 -5
  13. package/dist/fakerGenerator-D3zaPh1_.js.map +1 -0
  14. package/dist/generators.cjs +2 -2
  15. package/dist/generators.d.cts +2 -2
  16. package/dist/generators.d.ts +2 -2
  17. package/dist/generators.js +2 -2
  18. package/dist/index.cjs +4 -2
  19. package/dist/index.cjs.map +1 -1
  20. package/dist/index.d.cts +1 -1
  21. package/dist/index.d.ts +1 -1
  22. package/dist/index.js +4 -2
  23. package/dist/index.js.map +1 -1
  24. package/dist/{types-CToFojIM.d.ts → types-Bh4LPXtV.d.ts} +225 -206
  25. package/dist/{types-BlR7cTJa.d.cts → types-C6bgZQkZ.d.cts} +220 -201
  26. package/package.json +9 -9
  27. package/src/components/Faker.tsx +3 -3
  28. package/src/generators/fakerGenerator.tsx +3 -2
  29. package/src/plugin.ts +2 -0
  30. package/src/types.ts +1 -1
  31. package/dist/fakerGenerator-BgUuFQPq.cjs.map +0 -1
  32. package/dist/fakerGenerator-CXvRE7-U.js.map +0 -1
@@ -1,28 +1,29 @@
1
+ import { Fabric, FileManager } from "@kubb/react-fabric";
1
2
  import { ConsolaInstance, LogLevel } from "consola";
2
- import { FileManager } from "@kubb/fabric-core";
3
3
  import * as OasTypes from "oas/types";
4
4
  import { HttpMethods as HttpMethod, OASDocument, SchemaObject, User } from "oas/types";
5
5
  import { Operation, Operation as Operation$1 } from "oas/operation";
6
6
  import { OpenAPIV3 } from "openapi-types";
7
7
  import * as oas_normalize_lib_types0 from "oas-normalize/lib/types";
8
8
  import BaseOas from "oas";
9
+ import { KubbNode } from "@kubb/react-fabric/types";
9
10
 
10
11
  //#region ../core/src/BaseGenerator.d.ts
11
12
  /**
12
13
  * Abstract class that contains the building blocks for plugins to create their own Generator
13
14
  * @link idea based on https://github.com/colinhacks/zod/blob/master/src/types.ts#L137
14
15
  */
15
- declare abstract class BaseGenerator<TOptions$1 = unknown, TContext = unknown> {
16
+ declare abstract class BaseGenerator<TOptions = unknown, TContext = unknown> {
16
17
  #private;
17
- constructor(options?: TOptions$1, context?: TContext);
18
- get options(): TOptions$1;
18
+ constructor(options?: TOptions, context?: TContext);
19
+ get options(): TOptions;
19
20
  get context(): TContext;
20
- set options(options: TOptions$1);
21
+ set options(options: TOptions);
21
22
  abstract build(...params: unknown[]): unknown;
22
23
  }
23
24
  //#endregion
24
25
  //#region ../core/src/fs/types.d.ts
25
- type BasePath<T$1 extends string = string> = `${T$1}/`;
26
+ type BasePath<T extends string = string> = `${T}/`;
26
27
  type Import = {
27
28
  /**
28
29
  * Import name to be used
@@ -96,7 +97,7 @@ type BaseName = `${string}.${string}`;
96
97
  * Path will be full qualified path to a specified file
97
98
  */
98
99
  type Path = string;
99
- type AdvancedPath<T$1 extends BaseName = BaseName> = `${BasePath}${T$1}`;
100
+ type AdvancedPath<T extends BaseName = BaseName> = `${BasePath}${T}`;
100
101
  type OptionalPath = Path | undefined | null;
101
102
  type File<TMeta extends object = object> = {
102
103
  /**
@@ -185,7 +186,7 @@ type Logger = {
185
186
  };
186
187
  //#endregion
187
188
  //#region ../core/src/utils/types.d.ts
188
- type PossiblePromise<T$1> = Promise<T$1> | T$1;
189
+ type PossiblePromise<T> = Promise<T> | T;
189
190
  //#endregion
190
191
  //#region ../core/src/types.d.ts
191
192
  type InputPath = {
@@ -298,11 +299,11 @@ TName extends string = string,
298
299
  /**
299
300
  * Options of the plugin.
300
301
  */
301
- TOptions$1 extends object = object,
302
+ TOptions extends object = object,
302
303
  /**
303
304
  * Options of the plugin that can be used later on, see `options` inside your plugin config.
304
305
  */
305
- TResolvedOptions extends object = TOptions$1,
306
+ TResolvedOptions extends object = TOptions,
306
307
  /**
307
308
  * Context that you want to expose to other plugins.
308
309
  */
@@ -316,23 +317,23 @@ TResolvePathOptions extends object = object> = {
316
317
  * Same behaviour like what has been done with `QueryKey` in `@tanstack/react-query`
317
318
  */
318
319
  key: PluginKey<TName | string>;
319
- options: TOptions$1;
320
+ options: TOptions;
320
321
  resolvedOptions: TResolvedOptions;
321
322
  context: TContext;
322
323
  resolvePathOptions: TResolvePathOptions;
323
324
  };
324
325
  type PluginKey<TName> = [name: TName, identifier?: string | number];
325
- type UserPlugin<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = {
326
+ type UserPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
326
327
  /**
327
328
  * Unique name used for the plugin
328
329
  * The name of the plugin follows the format scope:foo-bar or foo-bar, adding scope: can avoid naming conflicts with other plugins.
329
330
  * @example @kubb/typescript
330
331
  */
331
- name: TOptions$1['name'];
332
+ name: TOptions['name'];
332
333
  /**
333
334
  * Options set for a specific plugin(see kubb.config.js), passthrough of options.
334
335
  */
335
- options: TOptions$1['resolvedOptions'];
336
+ options: TOptions['resolvedOptions'];
336
337
  /**
337
338
  * 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.
338
339
  * Can be used to validate dependent plugins.
@@ -342,23 +343,23 @@ type UserPlugin<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions>
342
343
  * 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.
343
344
  */
344
345
  post?: Array<string>;
345
- } & (TOptions$1['context'] extends never ? {
346
+ } & (TOptions['context'] extends never ? {
346
347
  context?: never;
347
348
  } : {
348
- context: (this: TOptions$1['name'] extends 'core' ? null : Omit<PluginContext<TOptions$1>, 'addFile'>) => TOptions$1['context'];
349
+ context: (this: TOptions['name'] extends 'core' ? null : Omit<PluginContext<TOptions>, 'addFile'>) => TOptions['context'];
349
350
  });
350
- type UserPluginWithLifeCycle<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = UserPlugin<TOptions$1> & PluginLifecycle<TOptions$1>;
351
- type Plugin<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = {
351
+ type UserPluginWithLifeCycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = UserPlugin<TOptions> & PluginLifecycle<TOptions>;
352
+ type Plugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
352
353
  /**
353
354
  * Unique name used for the plugin
354
355
  * @example @kubb/typescript
355
356
  */
356
- name: TOptions$1['name'];
357
+ name: TOptions['name'];
357
358
  /**
358
359
  * Internal key used when a developer uses more than one of the same plugin
359
360
  * @private
360
361
  */
361
- key: TOptions$1['key'];
362
+ key: TOptions['key'];
362
363
  /**
363
364
  * 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.
364
365
  * Can be used to validate dependent plugins.
@@ -371,49 +372,49 @@ type Plugin<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = {
371
372
  /**
372
373
  * Options set for a specific plugin(see kubb.config.js), passthrough of options.
373
374
  */
374
- options: TOptions$1['resolvedOptions'];
375
- } & (TOptions$1['context'] extends never ? {
375
+ options: TOptions['resolvedOptions'];
376
+ } & (TOptions['context'] extends never ? {
376
377
  context?: never;
377
378
  } : {
378
- context: TOptions$1['context'];
379
+ context: TOptions['context'];
379
380
  });
380
- type PluginWithLifeCycle<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = Plugin<TOptions$1> & PluginLifecycle<TOptions$1>;
381
- type PluginLifecycle<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = {
381
+ type PluginWithLifeCycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = Plugin<TOptions> & PluginLifecycle<TOptions>;
382
+ type PluginLifecycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
382
383
  /**
383
384
  * Start of the lifecycle of a plugin.
384
385
  * @type hookParallel
385
386
  */
386
- buildStart?: (this: PluginContext<TOptions$1>, Config: Config) => PossiblePromise<void>;
387
+ buildStart?: (this: PluginContext<TOptions>, Config: Config) => PossiblePromise<void>;
387
388
  /**
388
389
  * Resolve to a Path based on a baseName(example: `./Pet.ts`) and directory(example: `./models`).
389
390
  * Options can als be included.
390
391
  * @type hookFirst
391
392
  * @example ('./Pet.ts', './src/gen/') => '/src/gen/Pet.ts'
392
393
  */
393
- resolvePath?: (this: PluginContext<TOptions$1>, baseName: BaseName, mode?: Mode, options?: TOptions$1['resolvePathOptions']) => OptionalPath;
394
+ resolvePath?: (this: PluginContext<TOptions>, baseName: BaseName, mode?: Mode, options?: TOptions['resolvePathOptions']) => OptionalPath;
394
395
  /**
395
396
  * Resolve to a name based on a string.
396
397
  * Useful when converting to PascalCase or camelCase.
397
398
  * @type hookFirst
398
399
  * @example ('pet') => 'Pet'
399
400
  */
400
- resolveName?: (this: PluginContext<TOptions$1>, name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
401
+ resolveName?: (this: PluginContext<TOptions>, name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
401
402
  /**
402
403
  * End of the plugin lifecycle.
403
404
  * @type hookParallel
404
405
  */
405
- buildEnd?: (this: PluginContext<TOptions$1>) => PossiblePromise<void>;
406
+ buildEnd?: (this: PluginContext<TOptions>) => PossiblePromise<void>;
406
407
  };
407
408
  type PluginLifecycleHooks = keyof PluginLifecycle;
408
- type PluginParameter<H$1 extends PluginLifecycleHooks> = Parameters<Required<PluginLifecycle>[H$1]>;
409
- type ResolvePathParams<TOptions$1 = object> = {
409
+ type PluginParameter<H extends PluginLifecycleHooks> = Parameters<Required<PluginLifecycle>[H]>;
410
+ type ResolvePathParams<TOptions = object> = {
410
411
  pluginKey?: Plugin['key'];
411
412
  baseName: BaseName;
412
413
  mode?: Mode;
413
414
  /**
414
415
  * Options to be passed to 'resolvePath' 3th parameter
415
416
  */
416
- options?: TOptions$1;
417
+ options?: TOptions;
417
418
  };
418
419
  type ResolveNameParams = {
419
420
  name: string;
@@ -426,7 +427,8 @@ type ResolveNameParams = {
426
427
  */
427
428
  type?: 'file' | 'function' | 'type' | 'const';
428
429
  };
429
- type PluginContext<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = {
430
+ type PluginContext<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
431
+ fabric: Fabric;
430
432
  config: Config;
431
433
  /**
432
434
  * @deprecated
@@ -434,7 +436,7 @@ type PluginContext<TOptions$1 extends PluginFactoryOptions = PluginFactoryOption
434
436
  fileManager: FileManager;
435
437
  pluginManager: PluginManager;
436
438
  addFile: (...file: Array<File>) => Promise<Array<ResolvedFile>>;
437
- resolvePath: (params: ResolvePathParams<TOptions$1['resolvePathOptions']>) => OptionalPath;
439
+ resolvePath: (params: ResolvePathParams<TOptions['resolvePathOptions']>) => OptionalPath;
438
440
  resolveName: (params: ResolveNameParams) => string;
439
441
  logger: Logger;
440
442
  /**
@@ -444,12 +446,12 @@ type PluginContext<TOptions$1 extends PluginFactoryOptions = PluginFactoryOption
444
446
  /**
445
447
  * Current plugin
446
448
  */
447
- plugin: Plugin<TOptions$1>;
449
+ plugin: Plugin<TOptions>;
448
450
  };
449
451
  /**
450
452
  * Specify the export location for the files and define the behavior of the output
451
453
  */
452
- type Output<TOptions$1> = {
454
+ type Output<TOptions> = {
453
455
  /**
454
456
  * Path to the output folder or file that will contain the generated code
455
457
  */
@@ -462,11 +464,11 @@ type Output<TOptions$1> = {
462
464
  /**
463
465
  * Add a banner text in the beginning of every file
464
466
  */
465
- banner?: string | ((options: TOptions$1) => string);
467
+ banner?: string | ((options: TOptions) => string);
466
468
  /**
467
469
  * Add a footer text in the beginning of every file
468
470
  */
469
- footer?: string | ((options: TOptions$1) => string);
471
+ footer?: string | ((options: TOptions) => string);
470
472
  };
471
473
  type GroupContext = {
472
474
  group: string;
@@ -485,20 +487,21 @@ type Group = {
485
487
  //#region ../core/src/PluginManager.d.ts
486
488
  type RequiredPluginLifecycle = Required<PluginLifecycle>;
487
489
  type Strategy = 'hookFirst' | 'hookForPlugin' | 'hookParallel' | 'hookSeq';
488
- type Executer<H$1 extends PluginLifecycleHooks = PluginLifecycleHooks> = {
490
+ type Executer<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
489
491
  message: string;
490
492
  strategy: Strategy;
491
- hookName: H$1;
493
+ hookName: H;
492
494
  plugin: Plugin;
493
495
  parameters?: unknown[] | undefined;
494
496
  output?: unknown;
495
497
  };
496
- type ParseResult<H$1 extends PluginLifecycleHooks> = RequiredPluginLifecycle[H$1];
497
- type SafeParseResult<H$1 extends PluginLifecycleHooks, Result = ReturnType<ParseResult<H$1>>> = {
498
+ type ParseResult<H extends PluginLifecycleHooks> = RequiredPluginLifecycle[H];
499
+ type SafeParseResult<H extends PluginLifecycleHooks, Result = ReturnType<ParseResult<H>>> = {
498
500
  result: Result;
499
501
  plugin: Plugin;
500
502
  };
501
503
  type Options$3 = {
504
+ fabric: Fabric;
502
505
  logger: Logger;
503
506
  /**
504
507
  * @default Number.POSITIVE_INFINITY
@@ -510,20 +513,16 @@ type Events = {
510
513
  executed: [executer: Executer];
511
514
  error: [error: Error];
512
515
  };
513
- type GetFileProps<TOptions$1 = object> = {
516
+ type GetFileProps<TOptions = object> = {
514
517
  name: string;
515
518
  mode?: Mode;
516
519
  extname: Extname;
517
520
  pluginKey: Plugin['key'];
518
- options?: TOptions$1;
521
+ options?: TOptions;
519
522
  };
520
523
  declare class PluginManager {
521
524
  #private;
522
525
  readonly plugins: Set<Plugin<PluginFactoryOptions<string, object, object, any, object>>>;
523
- /**
524
- * @deprecated do not use from pluginManager
525
- */
526
- readonly fileManager: FileManager;
527
526
  readonly events: EventEmitter<Events>;
528
527
  readonly config: Config;
529
528
  readonly executed: Array<Executer>;
@@ -671,6 +670,170 @@ declare class Oas<const TOAS = unknown> extends BaseOas {
671
670
  valdiate(): Promise<oas_normalize_lib_types0.ValidationResult>;
672
671
  }
673
672
  //#endregion
673
+ //#region ../plugin-oas/src/generators/createReactGenerator.d.ts
674
+ type ReactGenerator<TOptions extends PluginFactoryOptions> = {
675
+ name: string;
676
+ type: 'react';
677
+ Operations: (props: OperationsProps<TOptions>) => KubbNode;
678
+ Operation: (props: OperationProps<TOptions>) => KubbNode;
679
+ Schema: (props: SchemaProps$1<TOptions>) => KubbNode;
680
+ };
681
+ //#endregion
682
+ //#region ../plugin-oas/src/generators/types.d.ts
683
+ type OperationsProps<TOptions extends PluginFactoryOptions> = {
684
+ /**
685
+ * @deprecated
686
+ */
687
+ instance: Omit<OperationGenerator<TOptions>, 'build'>;
688
+ options: TOptions['resolvedOptions'];
689
+ operations: Array<Operation$1>;
690
+ };
691
+ type OperationProps<TOptions extends PluginFactoryOptions> = {
692
+ /**
693
+ * @deprecated
694
+ */
695
+ instance: Omit<OperationGenerator<TOptions>, 'build'>;
696
+ options: TOptions['resolvedOptions'];
697
+ operation: Operation$1;
698
+ };
699
+ type SchemaProps$1<TOptions extends PluginFactoryOptions> = {
700
+ instance: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions>, 'build'>;
701
+ options: TOptions['resolvedOptions'];
702
+ schema: {
703
+ name: string;
704
+ tree: Array<Schema>;
705
+ value: SchemaObject$1;
706
+ };
707
+ };
708
+ type Generator<TOptions extends PluginFactoryOptions> = CoreGenerator<TOptions> | ReactGenerator<TOptions>;
709
+ //#endregion
710
+ //#region ../plugin-oas/src/generators/createGenerator.d.ts
711
+ type CoreGenerator<TOptions extends PluginFactoryOptions> = {
712
+ name: string;
713
+ type: 'core';
714
+ operations: (props: OperationsProps<TOptions>) => Promise<File[]>;
715
+ operation: (props: OperationProps<TOptions>) => Promise<File[]>;
716
+ schema: (props: SchemaProps$1<TOptions>) => Promise<File[]>;
717
+ };
718
+ //#endregion
719
+ //#region ../plugin-oas/src/types.d.ts
720
+ type ResolvePathOptions = {
721
+ pluginKey?: Plugin['key'];
722
+ group?: {
723
+ tag?: string;
724
+ path?: string;
725
+ };
726
+ type?: ResolveNameParams['type'];
727
+ };
728
+ /**
729
+ * `propertyName` is the ref name + resolved with the nameResolver
730
+ * @example import { Pet } from './Pet'
731
+ *
732
+ * `originalName` is the original name used(in PascalCase), only used to remove duplicates
733
+ *
734
+ * `pluginKey` can be used to override the current plugin being used, handy when you want to import a type/schema out of another plugin
735
+ * @example import a type(plugin-ts) for a mock file(swagger-faker)
736
+ */
737
+ type Ref = {
738
+ propertyName: string;
739
+ originalName: string;
740
+ path: OptionalPath;
741
+ pluginKey?: Plugin['key'];
742
+ };
743
+ type Refs = Record<string, Ref>;
744
+ type OperationSchema = {
745
+ /**
746
+ * Converted name, contains already `PathParams`, `QueryParams`, ...
747
+ */
748
+ name: string;
749
+ schema: SchemaObject$1;
750
+ operation?: Operation$1;
751
+ /**
752
+ * OperationName in PascalCase, only being used in OperationGenerator
753
+ */
754
+ operationName: string;
755
+ description?: string;
756
+ statusCode?: number;
757
+ keys?: string[];
758
+ keysToOmit?: string[];
759
+ withData?: boolean;
760
+ };
761
+ type OperationSchemas = {
762
+ pathParams?: OperationSchema & {
763
+ keysToOmit?: never;
764
+ };
765
+ queryParams?: OperationSchema & {
766
+ keysToOmit?: never;
767
+ };
768
+ headerParams?: OperationSchema & {
769
+ keysToOmit?: never;
770
+ };
771
+ request?: OperationSchema;
772
+ response: OperationSchema;
773
+ responses: Array<OperationSchema>;
774
+ statusCodes?: Array<OperationSchema>;
775
+ errors?: Array<OperationSchema>;
776
+ };
777
+ type ByTag = {
778
+ type: 'tag';
779
+ pattern: string | RegExp;
780
+ };
781
+ type ByOperationId = {
782
+ type: 'operationId';
783
+ pattern: string | RegExp;
784
+ };
785
+ type ByPath = {
786
+ type: 'path';
787
+ pattern: string | RegExp;
788
+ };
789
+ type ByMethod = {
790
+ type: 'method';
791
+ pattern: HttpMethod | RegExp;
792
+ };
793
+ type BySchemaName = {
794
+ type: 'schemaName';
795
+ pattern: string | RegExp;
796
+ };
797
+ type ByContentType = {
798
+ type: 'contentType';
799
+ pattern: string | RegExp;
800
+ };
801
+ type Exclude$1 = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
802
+ type Include = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
803
+ type Override<TOptions> = (ByTag | ByOperationId | ByPath | ByMethod | BySchemaName | ByContentType) & {
804
+ options: Partial<TOptions>;
805
+ };
806
+ //#endregion
807
+ //#region ../plugin-oas/src/OperationGenerator.d.ts
808
+ type Context$1<TOptions, TPluginOptions extends PluginFactoryOptions> = {
809
+ fabric: Fabric;
810
+ oas: Oas;
811
+ exclude: Array<Exclude$1> | undefined;
812
+ include: Array<Include> | undefined;
813
+ override: Array<Override<TOptions>> | undefined;
814
+ contentType: contentType | undefined;
815
+ pluginManager: PluginManager;
816
+ /**
817
+ * Current plugin
818
+ */
819
+ plugin: Plugin<TPluginOptions>;
820
+ mode: Mode;
821
+ };
822
+ declare class OperationGenerator<TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TPluginOptions['resolvedOptions'], Context$1<TPluginOptions['resolvedOptions'], TPluginOptions>> {
823
+ #private;
824
+ getSchemas(operation: Operation$1, {
825
+ resolveName
826
+ }?: {
827
+ resolveName?: (name: string) => string;
828
+ }): OperationSchemas;
829
+ getOperations(): Promise<Array<{
830
+ path: string;
831
+ method: HttpMethod;
832
+ operation: Operation$1;
833
+ }>>;
834
+ build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<File<TFileMeta>>>;
835
+ }
836
+ //#endregion
674
837
  //#region ../plugin-oas/src/SchemaMapper.d.ts
675
838
  type SchemaKeywordMapper = {
676
839
  object: {
@@ -888,96 +1051,9 @@ type Schema = {
888
1051
  keyword: string;
889
1052
  } | SchemaKeywordMapper[keyof SchemaKeywordMapper];
890
1053
  //#endregion
891
- //#region ../plugin-oas/src/types.d.ts
892
- type ResolvePathOptions = {
893
- pluginKey?: Plugin['key'];
894
- group?: {
895
- tag?: string;
896
- path?: string;
897
- };
898
- type?: ResolveNameParams['type'];
899
- };
900
- /**
901
- * `propertyName` is the ref name + resolved with the nameResolver
902
- * @example import { Pet } from './Pet'
903
- *
904
- * `originalName` is the original name used(in PascalCase), only used to remove duplicates
905
- *
906
- * `pluginKey` can be used to override the current plugin being used, handy when you want to import a type/schema out of another plugin
907
- * @example import a type(plugin-ts) for a mock file(swagger-faker)
908
- */
909
- type Ref = {
910
- propertyName: string;
911
- originalName: string;
912
- path: OptionalPath;
913
- pluginKey?: Plugin['key'];
914
- };
915
- type Refs = Record<string, Ref>;
916
- type OperationSchema = {
917
- /**
918
- * Converted name, contains already `PathParams`, `QueryParams`, ...
919
- */
920
- name: string;
921
- schema: SchemaObject$1;
922
- operation?: Operation$1;
923
- /**
924
- * OperationName in PascalCase, only being used in OperationGenerator
925
- */
926
- operationName: string;
927
- description?: string;
928
- statusCode?: number;
929
- keys?: string[];
930
- keysToOmit?: string[];
931
- withData?: boolean;
932
- };
933
- type OperationSchemas = {
934
- pathParams?: OperationSchema & {
935
- keysToOmit?: never;
936
- };
937
- queryParams?: OperationSchema & {
938
- keysToOmit?: never;
939
- };
940
- headerParams?: OperationSchema & {
941
- keysToOmit?: never;
942
- };
943
- request?: OperationSchema;
944
- response: OperationSchema;
945
- responses: Array<OperationSchema>;
946
- statusCodes?: Array<OperationSchema>;
947
- errors?: Array<OperationSchema>;
948
- };
949
- type ByTag = {
950
- type: 'tag';
951
- pattern: string | RegExp;
952
- };
953
- type ByOperationId = {
954
- type: 'operationId';
955
- pattern: string | RegExp;
956
- };
957
- type ByPath = {
958
- type: 'path';
959
- pattern: string | RegExp;
960
- };
961
- type ByMethod = {
962
- type: 'method';
963
- pattern: HttpMethod | RegExp;
964
- };
965
- type BySchemaName = {
966
- type: 'schemaName';
967
- pattern: string | RegExp;
968
- };
969
- type ByContentType = {
970
- type: 'contentType';
971
- pattern: string | RegExp;
972
- };
973
- type Exclude$1 = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
974
- type Include = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
975
- type Override<TOptions$1> = (ByTag | ByOperationId | ByPath | ByMethod | BySchemaName | ByContentType) & {
976
- options: Partial<TOptions$1>;
977
- };
978
- //#endregion
979
1054
  //#region ../plugin-oas/src/SchemaGenerator.d.ts
980
- type Context$1<TOptions$1, TPluginOptions extends PluginFactoryOptions> = {
1055
+ type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
1056
+ fabric: Fabric;
981
1057
  oas: Oas;
982
1058
  pluginManager: PluginManager;
983
1059
  /**
@@ -986,7 +1062,7 @@ type Context$1<TOptions$1, TPluginOptions extends PluginFactoryOptions> = {
986
1062
  plugin: Plugin<TPluginOptions>;
987
1063
  mode: Mode;
988
1064
  include?: Array<'schemas' | 'responses' | 'requestBodies'>;
989
- override: Array<Override<TOptions$1>> | undefined;
1065
+ override: Array<Override<TOptions>> | undefined;
990
1066
  contentType?: contentType;
991
1067
  output?: string;
992
1068
  };
@@ -1009,15 +1085,15 @@ type SchemaGeneratorOptions = {
1009
1085
  * TODO TODO add docs
1010
1086
  * @beta
1011
1087
  */
1012
- schema?: (schemaProps: SchemaProps$1, defaultSchemas: Schema[]) => Schema[] | undefined;
1088
+ schema?: (schemaProps: SchemaProps, defaultSchemas: Schema[]) => Schema[] | undefined;
1013
1089
  };
1014
1090
  };
1015
- type SchemaProps$1 = {
1091
+ type SchemaProps = {
1016
1092
  schemaObject?: SchemaObject$1;
1017
1093
  name?: string;
1018
1094
  parentName?: string;
1019
1095
  };
1020
- 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>> {
1096
+ declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGeneratorOptions, TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TOptions, Context<TOptions, TPluginOptions>> {
1021
1097
  #private;
1022
1098
  refs: Refs;
1023
1099
  /**
@@ -1025,7 +1101,7 @@ declare class SchemaGenerator<TOptions$1 extends SchemaGeneratorOptions = Schema
1025
1101
  * Delegates to getBaseTypeFromSchema internally and
1026
1102
  * optionally adds a union with null.
1027
1103
  */
1028
- parse(props: SchemaProps$1): Schema[];
1104
+ parse(props: SchemaProps): Schema[];
1029
1105
  deepSearch<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): Array<SchemaKeywordMapper[T]>;
1030
1106
  find<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
1031
1107
  static deepSearch<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): Array<SchemaKeywordMapper[T]>;
@@ -1035,63 +1111,6 @@ declare class SchemaGenerator<TOptions$1 extends SchemaGeneratorOptions = Schema
1035
1111
  build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<File<TFileMeta>>>;
1036
1112
  }
1037
1113
  //#endregion
1038
- //#region ../plugin-oas/src/generator.d.ts
1039
- type OperationsProps<TOptions$1 extends PluginFactoryOptions> = {
1040
- instance: Omit<OperationGenerator<TOptions$1>, 'build'>;
1041
- options: TOptions$1['resolvedOptions'];
1042
- operations: Array<Operation$1>;
1043
- };
1044
- type OperationProps<TOptions$1 extends PluginFactoryOptions> = {
1045
- instance: Omit<OperationGenerator<TOptions$1>, 'build'>;
1046
- options: TOptions$1['resolvedOptions'];
1047
- operation: Operation$1;
1048
- };
1049
- type SchemaProps<TOptions$1 extends PluginFactoryOptions> = {
1050
- instance: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions$1>, 'build'>;
1051
- options: TOptions$1['resolvedOptions'];
1052
- schema: {
1053
- name: string;
1054
- tree: Array<Schema>;
1055
- value: SchemaObject$1;
1056
- };
1057
- };
1058
- type GeneratorOptions<TOptions$1 extends PluginFactoryOptions> = {
1059
- name: string;
1060
- operations?: (this: GeneratorOptions<TOptions$1>, props: OperationsProps<TOptions$1>) => Promise<File[]>;
1061
- operation?: (this: GeneratorOptions<TOptions$1>, props: OperationProps<TOptions$1>) => Promise<File[]>;
1062
- schema?: (this: GeneratorOptions<TOptions$1>, props: SchemaProps<TOptions$1>) => Promise<File[]>;
1063
- };
1064
- type Generator<TOptions$1 extends PluginFactoryOptions> = GeneratorOptions<TOptions$1>;
1065
- //#endregion
1066
- //#region ../plugin-oas/src/OperationGenerator.d.ts
1067
- type Context<TOptions$1, TPluginOptions extends PluginFactoryOptions> = {
1068
- oas: Oas;
1069
- exclude: Array<Exclude$1> | undefined;
1070
- include: Array<Include> | undefined;
1071
- override: Array<Override<TOptions$1>> | undefined;
1072
- contentType: contentType | undefined;
1073
- pluginManager: PluginManager;
1074
- /**
1075
- * Current plugin
1076
- */
1077
- plugin: Plugin<TPluginOptions>;
1078
- mode: Mode;
1079
- };
1080
- declare class OperationGenerator<TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TPluginOptions['resolvedOptions'], Context<TPluginOptions['resolvedOptions'], TPluginOptions>> {
1081
- #private;
1082
- getSchemas(operation: Operation$1, {
1083
- resolveName
1084
- }?: {
1085
- resolveName?: (name: string) => string;
1086
- }): OperationSchemas;
1087
- getOperations(): Promise<Array<{
1088
- path: string;
1089
- method: HttpMethod;
1090
- operation: Operation$1;
1091
- }>>;
1092
- build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<File<TFileMeta>>>;
1093
- }
1094
- //#endregion
1095
1114
  //#region src/types.d.ts
1096
1115
  type Options$1 = {
1097
1116
  /**
@@ -1195,5 +1214,5 @@ type ResolvedOptions = {
1195
1214
  };
1196
1215
  type PluginFaker = PluginFactoryOptions<'plugin-faker', Options$1, ResolvedOptions, never, ResolvePathOptions>;
1197
1216
  //#endregion
1198
- export { UserPluginWithLifeCycle as a, Schema as i, PluginFaker as n, Generator as r, Options$1 as t };
1199
- //# sourceMappingURL=types-BlR7cTJa.d.cts.map
1217
+ export { UserPluginWithLifeCycle as a, ReactGenerator as i, PluginFaker as n, Schema as r, Options$1 as t };
1218
+ //# sourceMappingURL=types-C6bgZQkZ.d.cts.map