@kubb/plugin-zod 4.1.4 → 4.2.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.
@@ -46,17 +46,17 @@ declare class Oas<const TOAS = unknown> extends BaseOas {
46
46
  * Abstract class that contains the building blocks for plugins to create their own Generator
47
47
  * @link idea based on https://github.com/colinhacks/zod/blob/master/src/types.ts#L137
48
48
  */
49
- declare abstract class BaseGenerator<TOptions = unknown, TContext = unknown> {
49
+ declare abstract class BaseGenerator<TOptions$1 = unknown, TContext = unknown> {
50
50
  #private;
51
- constructor(options?: TOptions, context?: TContext);
52
- get options(): TOptions;
51
+ constructor(options?: TOptions$1, context?: TContext);
52
+ get options(): TOptions$1;
53
53
  get context(): TContext;
54
- set options(options: TOptions);
54
+ set options(options: TOptions$1);
55
55
  abstract build(...params: unknown[]): unknown;
56
56
  }
57
57
  //#endregion
58
58
  //#region ../core/src/fs/types.d.ts
59
- type BasePath<T extends string = string> = `${T}/`;
59
+ type BasePath<T$1 extends string = string> = `${T$1}/`;
60
60
  type Import = {
61
61
  /**
62
62
  * Import name to be used
@@ -130,7 +130,7 @@ type BaseName = `${string}.${string}`;
130
130
  * Path will be full qualified path to a specified file
131
131
  */
132
132
  type Path = string;
133
- type AdvancedPath<T extends BaseName = BaseName> = `${BasePath}${T}`;
133
+ type AdvancedPath<T$1 extends BaseName = BaseName> = `${BasePath}${T$1}`;
134
134
  type OptionalPath = Path | undefined | null;
135
135
  type File<TMeta extends object = object> = {
136
136
  /**
@@ -219,9 +219,9 @@ type Logger = {
219
219
  };
220
220
  //#endregion
221
221
  //#region ../core/src/utils/types.d.ts
222
- type PossiblePromise<T> = Promise<T> | T;
223
- type ArrayWithLength<T extends number, U extends any[] = []> = U['length'] extends T ? U : ArrayWithLength<T, [true, ...U]>;
224
- type GreaterThan<T extends number, U extends number> = ArrayWithLength<U> extends [...ArrayWithLength<T>, ...infer _] ? false : true;
222
+ type PossiblePromise<T$1> = Promise<T$1> | T$1;
223
+ type ArrayWithLength<T$1 extends number, U extends any[] = []> = U['length'] extends T$1 ? U : ArrayWithLength<T$1, [true, ...U]>;
224
+ type GreaterThan<T$1 extends number, U extends number> = ArrayWithLength<U> extends [...ArrayWithLength<T$1>, ...infer _] ? false : true;
225
225
  //#endregion
226
226
  //#region ../core/src/types.d.ts
227
227
  type InputPath = {
@@ -334,11 +334,11 @@ TName extends string = string,
334
334
  /**
335
335
  * Options of the plugin.
336
336
  */
337
- TOptions extends object = object,
337
+ TOptions$1 extends object = object,
338
338
  /**
339
339
  * Options of the plugin that can be used later on, see `options` inside your plugin config.
340
340
  */
341
- TResolvedOptions extends object = TOptions,
341
+ TResolvedOptions extends object = TOptions$1,
342
342
  /**
343
343
  * Context that you want to expose to other plugins.
344
344
  */
@@ -352,23 +352,23 @@ TResolvePathOptions extends object = object> = {
352
352
  * Same behaviour like what has been done with `QueryKey` in `@tanstack/react-query`
353
353
  */
354
354
  key: PluginKey<TName | string>;
355
- options: TOptions;
355
+ options: TOptions$1;
356
356
  resolvedOptions: TResolvedOptions;
357
357
  context: TContext;
358
358
  resolvePathOptions: TResolvePathOptions;
359
359
  };
360
360
  type PluginKey<TName> = [name: TName, identifier?: string | number];
361
- type UserPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
361
+ type UserPlugin<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = {
362
362
  /**
363
363
  * Unique name used for the plugin
364
364
  * The name of the plugin follows the format scope:foo-bar or foo-bar, adding scope: can avoid naming conflicts with other plugins.
365
365
  * @example @kubb/typescript
366
366
  */
367
- name: TOptions['name'];
367
+ name: TOptions$1['name'];
368
368
  /**
369
369
  * Options set for a specific plugin(see kubb.config.js), passthrough of options.
370
370
  */
371
- options: TOptions['resolvedOptions'];
371
+ options: TOptions$1['resolvedOptions'];
372
372
  /**
373
373
  * 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.
374
374
  * Can be used to validate dependent plugins.
@@ -378,23 +378,23 @@ type UserPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> =
378
378
  * 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.
379
379
  */
380
380
  post?: Array<string>;
381
- } & (TOptions['context'] extends never ? {
381
+ } & (TOptions$1['context'] extends never ? {
382
382
  context?: never;
383
383
  } : {
384
- context: (this: TOptions['name'] extends 'core' ? null : Omit<PluginContext<TOptions>, 'addFile'>) => TOptions['context'];
384
+ context: (this: TOptions$1['name'] extends 'core' ? null : Omit<PluginContext<TOptions$1>, 'addFile'>) => TOptions$1['context'];
385
385
  });
386
- type UserPluginWithLifeCycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = UserPlugin<TOptions> & PluginLifecycle<TOptions>;
387
- type Plugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
386
+ type UserPluginWithLifeCycle<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = UserPlugin<TOptions$1> & PluginLifecycle<TOptions$1>;
387
+ type Plugin<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = {
388
388
  /**
389
389
  * Unique name used for the plugin
390
390
  * @example @kubb/typescript
391
391
  */
392
- name: TOptions['name'];
392
+ name: TOptions$1['name'];
393
393
  /**
394
394
  * Internal key used when a developer uses more than one of the same plugin
395
395
  * @private
396
396
  */
397
- key: TOptions['key'];
397
+ key: TOptions$1['key'];
398
398
  /**
399
399
  * 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.
400
400
  * Can be used to validate dependent plugins.
@@ -407,49 +407,49 @@ type Plugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
407
407
  /**
408
408
  * Options set for a specific plugin(see kubb.config.js), passthrough of options.
409
409
  */
410
- options: TOptions['resolvedOptions'];
411
- } & (TOptions['context'] extends never ? {
410
+ options: TOptions$1['resolvedOptions'];
411
+ } & (TOptions$1['context'] extends never ? {
412
412
  context?: never;
413
413
  } : {
414
- context: TOptions['context'];
414
+ context: TOptions$1['context'];
415
415
  });
416
- type PluginWithLifeCycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = Plugin<TOptions> & PluginLifecycle<TOptions>;
417
- type PluginLifecycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
416
+ type PluginWithLifeCycle<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = Plugin<TOptions$1> & PluginLifecycle<TOptions$1>;
417
+ type PluginLifecycle<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = {
418
418
  /**
419
419
  * Start of the lifecycle of a plugin.
420
420
  * @type hookParallel
421
421
  */
422
- buildStart?: (this: PluginContext<TOptions>, Config: Config) => PossiblePromise<void>;
422
+ buildStart?: (this: PluginContext<TOptions$1>, Config: Config) => PossiblePromise<void>;
423
423
  /**
424
424
  * Resolve to a Path based on a baseName(example: `./Pet.ts`) and directory(example: `./models`).
425
425
  * Options can als be included.
426
426
  * @type hookFirst
427
427
  * @example ('./Pet.ts', './src/gen/') => '/src/gen/Pet.ts'
428
428
  */
429
- resolvePath?: (this: PluginContext<TOptions>, baseName: BaseName, mode?: Mode, options?: TOptions['resolvePathOptions']) => OptionalPath;
429
+ resolvePath?: (this: PluginContext<TOptions$1>, baseName: BaseName, mode?: Mode, options?: TOptions$1['resolvePathOptions']) => OptionalPath;
430
430
  /**
431
431
  * Resolve to a name based on a string.
432
432
  * Useful when converting to PascalCase or camelCase.
433
433
  * @type hookFirst
434
434
  * @example ('pet') => 'Pet'
435
435
  */
436
- resolveName?: (this: PluginContext<TOptions>, name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
436
+ resolveName?: (this: PluginContext<TOptions$1>, name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
437
437
  /**
438
438
  * End of the plugin lifecycle.
439
439
  * @type hookParallel
440
440
  */
441
- buildEnd?: (this: PluginContext<TOptions>) => PossiblePromise<void>;
441
+ buildEnd?: (this: PluginContext<TOptions$1>) => PossiblePromise<void>;
442
442
  };
443
443
  type PluginLifecycleHooks = keyof PluginLifecycle;
444
- type PluginParameter<H extends PluginLifecycleHooks> = Parameters<Required<PluginLifecycle>[H]>;
445
- type ResolvePathParams<TOptions = object> = {
444
+ type PluginParameter<H$1 extends PluginLifecycleHooks> = Parameters<Required<PluginLifecycle>[H$1]>;
445
+ type ResolvePathParams<TOptions$1 = object> = {
446
446
  pluginKey?: Plugin['key'];
447
447
  baseName: BaseName;
448
448
  mode?: Mode;
449
449
  /**
450
450
  * Options to be passed to 'resolvePath' 3th parameter
451
451
  */
452
- options?: TOptions;
452
+ options?: TOptions$1;
453
453
  };
454
454
  type ResolveNameParams = {
455
455
  name: string;
@@ -462,12 +462,12 @@ type ResolveNameParams = {
462
462
  */
463
463
  type?: 'file' | 'function' | 'type' | 'const';
464
464
  };
465
- type PluginContext<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
465
+ type PluginContext<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = {
466
466
  config: Config;
467
467
  fileManager: FileManager;
468
468
  pluginManager: PluginManager;
469
469
  addFile: (...file: Array<File>) => Promise<Array<ResolvedFile>>;
470
- resolvePath: (params: ResolvePathParams<TOptions['resolvePathOptions']>) => OptionalPath;
470
+ resolvePath: (params: ResolvePathParams<TOptions$1['resolvePathOptions']>) => OptionalPath;
471
471
  resolveName: (params: ResolveNameParams) => string;
472
472
  logger: Logger;
473
473
  /**
@@ -477,12 +477,12 @@ type PluginContext<TOptions extends PluginFactoryOptions = PluginFactoryOptions>
477
477
  /**
478
478
  * Current plugin
479
479
  */
480
- plugin: Plugin<TOptions>;
480
+ plugin: Plugin<TOptions$1>;
481
481
  };
482
482
  /**
483
483
  * Specify the export location for the files and define the behavior of the output
484
484
  */
485
- type Output<TOptions> = {
485
+ type Output<TOptions$1> = {
486
486
  /**
487
487
  * Path to the output folder or file that will contain the generated code
488
488
  */
@@ -495,11 +495,11 @@ type Output<TOptions> = {
495
495
  /**
496
496
  * Add a banner text in the beginning of every file
497
497
  */
498
- banner?: string | ((options: TOptions) => string);
498
+ banner?: string | ((options: TOptions$1) => string);
499
499
  /**
500
500
  * Add a footer text in the beginning of every file
501
501
  */
502
- footer?: string | ((options: TOptions) => string);
502
+ footer?: string | ((options: TOptions$1) => string);
503
503
  };
504
504
  type GroupContext = {
505
505
  group: string;
@@ -519,7 +519,7 @@ type Group = {
519
519
  type FileMetaBase = {
520
520
  pluginKey?: Plugin['key'];
521
521
  };
522
- type AddResult<T extends Array<File>> = Promise<Awaited<GreaterThan<T['length'], 1> extends true ? Promise<ResolvedFile[]> : Promise<ResolvedFile>>>;
522
+ type AddResult<T$1 extends Array<File>> = Promise<Awaited<GreaterThan<T$1['length'], 1> extends true ? Promise<ResolvedFile[]> : Promise<ResolvedFile>>>;
523
523
  type AddIndexesProps = {
524
524
  type: BarrelType | false | undefined;
525
525
  /**
@@ -572,16 +572,16 @@ declare class FileManager {
572
572
  //#region ../core/src/PluginManager.d.ts
573
573
  type RequiredPluginLifecycle = Required<PluginLifecycle>;
574
574
  type Strategy = 'hookFirst' | 'hookForPlugin' | 'hookParallel' | 'hookSeq';
575
- type Executer<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
575
+ type Executer<H$1 extends PluginLifecycleHooks = PluginLifecycleHooks> = {
576
576
  message: string;
577
577
  strategy: Strategy;
578
- hookName: H;
578
+ hookName: H$1;
579
579
  plugin: Plugin;
580
580
  parameters?: unknown[] | undefined;
581
581
  output?: unknown;
582
582
  };
583
- type ParseResult<H extends PluginLifecycleHooks> = RequiredPluginLifecycle[H];
584
- type SafeParseResult<H extends PluginLifecycleHooks, Result = ReturnType<ParseResult<H>>> = {
583
+ type ParseResult<H$1 extends PluginLifecycleHooks> = RequiredPluginLifecycle[H$1];
584
+ type SafeParseResult<H$1 extends PluginLifecycleHooks, Result = ReturnType<ParseResult<H$1>>> = {
585
585
  result: Result;
586
586
  plugin: Plugin;
587
587
  };
@@ -597,12 +597,12 @@ type Events = {
597
597
  executed: [executer: Executer];
598
598
  error: [error: Error];
599
599
  };
600
- type GetFileProps<TOptions = object> = {
600
+ type GetFileProps<TOptions$1 = object> = {
601
601
  name: string;
602
602
  mode?: Mode;
603
603
  extname: Extname;
604
604
  pluginKey: Plugin['key'];
605
- options?: TOptions;
605
+ options?: TOptions$1;
606
606
  };
607
607
  declare class PluginManager {
608
608
  #private;
@@ -716,11 +716,11 @@ declare class PluginManager {
716
716
  }
717
717
  //#endregion
718
718
  //#region ../plugin-oas/src/OperationGenerator.d.ts
719
- type Context$1<TOptions, TPluginOptions extends PluginFactoryOptions> = {
719
+ type Context$1<TOptions$1, TPluginOptions extends PluginFactoryOptions> = {
720
720
  oas: Oas;
721
721
  exclude: Array<Exclude$1> | undefined;
722
722
  include: Array<Include> | undefined;
723
- override: Array<Override<TOptions>> | undefined;
723
+ override: Array<Override<TOptions$1>> | undefined;
724
724
  contentType: contentType | undefined;
725
725
  pluginManager: PluginManager;
726
726
  /**
@@ -954,7 +954,7 @@ type Schema = {
954
954
  } | SchemaKeywordMapper[keyof SchemaKeywordMapper];
955
955
  //#endregion
956
956
  //#region ../plugin-oas/src/SchemaGenerator.d.ts
957
- type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
957
+ type Context<TOptions$1, TPluginOptions extends PluginFactoryOptions> = {
958
958
  oas: Oas;
959
959
  pluginManager: PluginManager;
960
960
  /**
@@ -963,7 +963,7 @@ type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
963
963
  plugin: Plugin<TPluginOptions>;
964
964
  mode: Mode;
965
965
  include?: Array<'schemas' | 'responses' | 'requestBodies'>;
966
- override: Array<Override<TOptions>> | undefined;
966
+ override: Array<Override<TOptions$1>> | undefined;
967
967
  contentType?: contentType;
968
968
  output?: string;
969
969
  };
@@ -994,7 +994,7 @@ type SchemaProps$1 = {
994
994
  name?: string;
995
995
  parentName?: string;
996
996
  };
997
- declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGeneratorOptions, TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TOptions, Context<TOptions, TPluginOptions>> {
997
+ declare class SchemaGenerator<TOptions$1 extends SchemaGeneratorOptions = SchemaGeneratorOptions, TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TOptions$1, Context<TOptions$1, TPluginOptions>> {
998
998
  #private;
999
999
  refs: Refs;
1000
1000
  /**
@@ -1013,32 +1013,32 @@ declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGe
1013
1013
  }
1014
1014
  //#endregion
1015
1015
  //#region ../plugin-oas/src/generator.d.ts
1016
- type OperationsProps<TOptions extends PluginFactoryOptions> = {
1017
- instance: Omit<OperationGenerator<TOptions>, 'build'>;
1018
- options: TOptions['resolvedOptions'];
1016
+ type OperationsProps<TOptions$1 extends PluginFactoryOptions> = {
1017
+ instance: Omit<OperationGenerator<TOptions$1>, 'build'>;
1018
+ options: TOptions$1['resolvedOptions'];
1019
1019
  operations: Array<Operation$1>;
1020
1020
  };
1021
- type OperationProps<TOptions extends PluginFactoryOptions> = {
1022
- instance: Omit<OperationGenerator<TOptions>, 'build'>;
1023
- options: TOptions['resolvedOptions'];
1021
+ type OperationProps<TOptions$1 extends PluginFactoryOptions> = {
1022
+ instance: Omit<OperationGenerator<TOptions$1>, 'build'>;
1023
+ options: TOptions$1['resolvedOptions'];
1024
1024
  operation: Operation$1;
1025
1025
  };
1026
- type SchemaProps<TOptions extends PluginFactoryOptions> = {
1027
- instance: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions>, 'build'>;
1028
- options: TOptions['resolvedOptions'];
1026
+ type SchemaProps<TOptions$1 extends PluginFactoryOptions> = {
1027
+ instance: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions$1>, 'build'>;
1028
+ options: TOptions$1['resolvedOptions'];
1029
1029
  schema: {
1030
1030
  name: string;
1031
1031
  tree: Array<Schema>;
1032
1032
  value: SchemaObject$1;
1033
1033
  };
1034
1034
  };
1035
- type GeneratorOptions<TOptions extends PluginFactoryOptions> = {
1035
+ type GeneratorOptions<TOptions$1 extends PluginFactoryOptions> = {
1036
1036
  name: string;
1037
- operations?: (this: GeneratorOptions<TOptions>, props: OperationsProps<TOptions>) => Promise<File[]>;
1038
- operation?: (this: GeneratorOptions<TOptions>, props: OperationProps<TOptions>) => Promise<File[]>;
1039
- schema?: (this: GeneratorOptions<TOptions>, props: SchemaProps<TOptions>) => Promise<File[]>;
1037
+ operations?: (this: GeneratorOptions<TOptions$1>, props: OperationsProps<TOptions$1>) => Promise<File[]>;
1038
+ operation?: (this: GeneratorOptions<TOptions$1>, props: OperationProps<TOptions$1>) => Promise<File[]>;
1039
+ schema?: (this: GeneratorOptions<TOptions$1>, props: SchemaProps<TOptions$1>) => Promise<File[]>;
1040
1040
  };
1041
- type Generator<TOptions extends PluginFactoryOptions> = GeneratorOptions<TOptions>;
1041
+ type Generator<TOptions$1 extends PluginFactoryOptions> = GeneratorOptions<TOptions$1>;
1042
1042
  //#endregion
1043
1043
  //#region ../plugin-oas/src/types.d.ts
1044
1044
  type ResolvePathOptions = {
@@ -1124,8 +1124,8 @@ type ByContentType = {
1124
1124
  };
1125
1125
  type Exclude$1 = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
1126
1126
  type Include = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
1127
- type Override<TOptions> = (ByTag | ByOperationId | ByPath | ByMethod | BySchemaName | ByContentType) & {
1128
- options: Partial<TOptions>;
1127
+ type Override<TOptions$1> = (ByTag | ByOperationId | ByPath | ByMethod | BySchemaName | ByContentType) & {
1128
+ options: Partial<TOptions$1>;
1129
1129
  };
1130
1130
  //#endregion
1131
1131
  //#region src/types.d.ts
@@ -1254,5 +1254,5 @@ type ResolvedOptions = {
1254
1254
  };
1255
1255
  type PluginZod = PluginFactoryOptions<'plugin-zod', Options$1, ResolvedOptions, never, ResolvePathOptions>;
1256
1256
  //#endregion
1257
- export { Generator, type Operation$1 as Operation, Options$1 as Options, PluginZod, Schema, SchemaObject$1 as SchemaObject, UserPluginWithLifeCycle };
1258
- //# sourceMappingURL=types-BY-RtmUj.d.ts.map
1257
+ export { UserPluginWithLifeCycle as a, Schema as i, PluginZod as n, Operation$1 as o, Generator as r, SchemaObject$1 as s, Options$1 as t };
1258
+ //# sourceMappingURL=types-CQb3A4Sz.d.ts.map