@kubb/core 1.15.0-canary.20231025T223729 → 1.15.0-canary.20231026T131818

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -141,6 +141,8 @@ declare class FileManager {
141
141
  static get extensions(): Array<KubbFile.Extname>;
142
142
  static isExtensionAllowed(baseName: string): boolean;
143
143
  }
144
+ declare function combineExports(exports: Array<KubbFile.Export>): Array<KubbFile.Export>;
145
+ declare function combineImports(imports: Array<KubbFile.Import>, exports: Array<KubbFile.Export>, source?: string): Array<KubbFile.Import>;
144
146
 
145
147
  declare class PluginError extends Error {
146
148
  pluginManager: PluginManager;
@@ -287,7 +289,7 @@ declare class PluginManager {
287
289
  hookReduceArg0<H extends PluginLifecycleHooks>({ hookName, parameters, reduce, }: {
288
290
  hookName: H;
289
291
  parameters: PluginParameter<H>;
290
- reduce: (reduction: Argument0<H>, result: ReturnType<ParseResult<H>>, plugin: KubbPlugin) => PossiblePromise$1<Argument0<H> | null>;
292
+ reduce: (reduction: Argument0<H>, result: ReturnType<ParseResult<H>>, plugin: KubbPlugin) => PossiblePromise<Argument0<H> | null>;
291
293
  }): Promise<Argument0<H>>;
292
294
  /**
293
295
  * Chains plugins
@@ -495,12 +497,12 @@ type PluginLifecycle<TOptions extends PluginFactoryOptions = PluginFactoryOption
495
497
  * Valdiate all plugins to see if their depended plugins are installed and configured.
496
498
  * @type hookParallel
497
499
  */
498
- validate?: (this: Omit<PluginContext, 'addFile'>, plugins: NonNullable<KubbConfig['plugins']>) => PossiblePromise$1<true>;
500
+ validate?: (this: Omit<PluginContext, 'addFile'>, plugins: NonNullable<KubbConfig['plugins']>) => PossiblePromise<true>;
499
501
  /**
500
502
  * Start of the lifecycle of a plugin.
501
503
  * @type hookParallel
502
504
  */
503
- buildStart?: (this: PluginContext, kubbConfig: KubbConfig) => PossiblePromise$1<void>;
505
+ buildStart?: (this: PluginContext, kubbConfig: KubbConfig) => PossiblePromise<void>;
504
506
  /**
505
507
  * Resolve to a Path based on a baseName(example: `./Pet.ts`) and directory(example: `./models`).
506
508
  * Options can als be included.
@@ -519,22 +521,22 @@ type PluginLifecycle<TOptions extends PluginFactoryOptions = PluginFactoryOption
519
521
  * Makes it possible to run async logic to override the path defined previously by `resolvePath`.
520
522
  * @type hookFirst
521
523
  */
522
- load?: (this: Omit<PluginContext, 'addFile'>, path: KubbFile.Path) => PossiblePromise$1<TransformResult | null>;
524
+ load?: (this: Omit<PluginContext, 'addFile'>, path: KubbFile.Path) => PossiblePromise<TransformResult | null>;
523
525
  /**
524
526
  * Transform the source-code.
525
527
  * @type hookReduceArg0
526
528
  */
527
- transform?: (this: Omit<PluginContext, 'addFile'>, source: string, path: KubbFile.Path) => PossiblePromise$1<TransformResult>;
529
+ transform?: (this: Omit<PluginContext, 'addFile'>, source: string, path: KubbFile.Path) => PossiblePromise<TransformResult>;
528
530
  /**
529
531
  * Write the result to the file-system based on the id(defined by `resolvePath` or changed by `load`).
530
532
  * @type hookParallel
531
533
  */
532
- writeFile?: (this: Omit<PluginContext, 'addFile'>, source: string | undefined, path: KubbFile.Path) => PossiblePromise$1<string | void>;
534
+ writeFile?: (this: Omit<PluginContext, 'addFile'>, source: string | undefined, path: KubbFile.Path) => PossiblePromise<string | void>;
533
535
  /**
534
536
  * End of the plugin lifecycle.
535
537
  * @type hookParallel
536
538
  */
537
- buildEnd?: (this: PluginContext) => PossiblePromise$1<void>;
539
+ buildEnd?: (this: PluginContext) => PossiblePromise<void>;
538
540
  };
539
541
  type PluginLifecycleHooks = keyof PluginLifecycle;
540
542
  type PluginParameter<H extends PluginLifecycleHooks> = Parameters<Required<PluginLifecycle>[H]>;
@@ -582,7 +584,7 @@ type Prettify<T> = {
582
584
  * TODO move to @kubb/types
583
585
  * @deprecated
584
586
  */
585
- type PossiblePromise$1<T> = Promise<T> | T;
587
+ type PossiblePromise<T> = Promise<T> | T;
586
588
  type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
587
589
  type LastOf<T> = UnionToIntersection<T extends any ? () => T : never> extends () => infer R ? R : never;
588
590
  type Push<T extends any[], V> = [...T, V];
@@ -622,9 +624,9 @@ declare function build(options: BuildOptions): Promise<BuildOutput>;
622
624
  * accepts a direct {@link KubbConfig} object, or a function that returns it.
623
625
  * The function receives a {@link ConfigEnv} object that exposes two properties:
624
626
  */
625
- declare function defineConfig(options: PossiblePromise$1<KubbUserConfig | Array<KubbUserConfig>> | ((
627
+ declare function defineConfig(options: PossiblePromise<KubbUserConfig | Array<KubbUserConfig>> | ((
626
628
  /** The options derived from the CLI flags */
627
- cliOptions: CLIOptions) => PossiblePromise$1<KubbUserConfig | Array<KubbUserConfig>>)): typeof options;
629
+ cliOptions: CLIOptions) => PossiblePromise<KubbUserConfig | Array<KubbUserConfig>>)): typeof options;
628
630
  declare function isInputPath(result: KubbConfig | undefined): result is KubbConfig<InputPath>;
629
631
 
630
632
  /**
@@ -667,7 +669,6 @@ type KubbPluginFactory<T extends PluginFactoryOptions = PluginFactoryOptions> =
667
669
  declare function createPlugin<T extends PluginFactoryOptions = PluginFactoryOptions>(factory: KubbPluginFactory<T>): (options: T['options']) => ReturnType<KubbPluginFactory<T>>;
668
670
  declare const pluginName = "core";
669
671
 
670
- type PossiblePromise<T> = Promise<T> | T;
671
672
  type PromiseFunc<T, T2 = never> = () => T2 extends never ? Promise<T> : Promise<T> | T2;
672
673
  type SeqOutput<TInput extends Array<PromiseFunc<TPromise, null>>, TPromise = unknown> = ReturnType<NonNullable<TInput[number]>>;
673
674
  type Options = {};
@@ -677,11 +678,6 @@ declare class PromiseManager {
677
678
  constructor(options?: Options);
678
679
  run<TInput extends Array<PromiseFunc<TPromise, null>>, TPromise = unknown, TOutput = SeqOutput<TInput, TPromise>>(strategy: Strategy, promises: TInput): TOutput;
679
680
  }
680
- declare function isPromise<T>(result: PossiblePromise<T>): result is Promise<T>;
681
- declare function isPromiseFulfilledResult<T = unknown>(result: PromiseSettledResult<unknown>): result is PromiseFulfilledResult<T>;
682
- declare function isPromiseRejectedResult<T>(result: PromiseSettledResult<unknown>): result is Omit<PromiseRejectedResult, 'reason'> & {
683
- reason: T;
684
- };
685
681
 
686
682
  /**
687
683
  * Abstract class that contains the building blocks for plugins to create their own SchemaGenerator
@@ -700,4 +696,4 @@ type OptionsOfPlugin<K extends keyof Plugins> = Plugins[K]['options'];
700
696
  type PluginUnion = TupleToUnion<ObjValueTuple<OptionsPlugins>>;
701
697
  type Plugin = keyof Plugins;
702
698
 
703
- export { AppMeta, BuildOutput, CLIOptions, FileManager, Generator, GetPluginFactoryOptions, GreaterThan, InputData, InputPath, KubbConfig, KubbFile, KubbObjectPlugin, KubbPlugin, KubbPluginKind, KubbUnionPlugins, KubbUserConfig, KubbUserPlugin, ObjValueTuple, OptionsOfPlugin, OptionsPlugins, PackageManager, ParallelPluginError, Plugin, PluginCache, PluginContext, PluginError, PluginFactoryOptions, PluginLifecycle, PluginLifecycleHooks, PluginManager, PluginParameter, PluginUnion, Plugins, PossiblePromise$1 as PossiblePromise, Prettify, PromiseManager, ResolveNameParams, ResolvePathParams, SchemaGenerator, SummaryError, TransformResult, TupleToUnion, ValidationPluginError, Warning, _Register, build, createPlugin, build as default, defineConfig, isInputPath, isPromise, isPromiseFulfilledResult, isPromiseRejectedResult, pluginName as name, pluginName };
699
+ export { AppMeta, BuildOutput, CLIOptions, FileManager, Generator, GetPluginFactoryOptions, GreaterThan, InputData, InputPath, KubbConfig, KubbFile, KubbObjectPlugin, KubbPlugin, KubbPluginKind, KubbUnionPlugins, KubbUserConfig, KubbUserPlugin, ObjValueTuple, OptionsOfPlugin, OptionsPlugins, PackageManager, ParallelPluginError, Plugin, PluginCache, PluginContext, PluginError, PluginFactoryOptions, PluginLifecycle, PluginLifecycleHooks, PluginManager, PluginParameter, PluginUnion, Plugins, PossiblePromise, Prettify, PromiseManager, ResolveNameParams, ResolvePathParams, SchemaGenerator, SummaryError, TransformResult, TupleToUnion, ValidationPluginError, Warning, _Register, build, combineExports, combineImports, createPlugin, build as default, defineConfig, isInputPath, pluginName as name, pluginName };
package/dist/index.d.ts CHANGED
@@ -141,6 +141,8 @@ declare class FileManager {
141
141
  static get extensions(): Array<KubbFile.Extname>;
142
142
  static isExtensionAllowed(baseName: string): boolean;
143
143
  }
144
+ declare function combineExports(exports: Array<KubbFile.Export>): Array<KubbFile.Export>;
145
+ declare function combineImports(imports: Array<KubbFile.Import>, exports: Array<KubbFile.Export>, source?: string): Array<KubbFile.Import>;
144
146
 
145
147
  declare class PluginError extends Error {
146
148
  pluginManager: PluginManager;
@@ -287,7 +289,7 @@ declare class PluginManager {
287
289
  hookReduceArg0<H extends PluginLifecycleHooks>({ hookName, parameters, reduce, }: {
288
290
  hookName: H;
289
291
  parameters: PluginParameter<H>;
290
- reduce: (reduction: Argument0<H>, result: ReturnType<ParseResult<H>>, plugin: KubbPlugin) => PossiblePromise$1<Argument0<H> | null>;
292
+ reduce: (reduction: Argument0<H>, result: ReturnType<ParseResult<H>>, plugin: KubbPlugin) => PossiblePromise<Argument0<H> | null>;
291
293
  }): Promise<Argument0<H>>;
292
294
  /**
293
295
  * Chains plugins
@@ -495,12 +497,12 @@ type PluginLifecycle<TOptions extends PluginFactoryOptions = PluginFactoryOption
495
497
  * Valdiate all plugins to see if their depended plugins are installed and configured.
496
498
  * @type hookParallel
497
499
  */
498
- validate?: (this: Omit<PluginContext, 'addFile'>, plugins: NonNullable<KubbConfig['plugins']>) => PossiblePromise$1<true>;
500
+ validate?: (this: Omit<PluginContext, 'addFile'>, plugins: NonNullable<KubbConfig['plugins']>) => PossiblePromise<true>;
499
501
  /**
500
502
  * Start of the lifecycle of a plugin.
501
503
  * @type hookParallel
502
504
  */
503
- buildStart?: (this: PluginContext, kubbConfig: KubbConfig) => PossiblePromise$1<void>;
505
+ buildStart?: (this: PluginContext, kubbConfig: KubbConfig) => PossiblePromise<void>;
504
506
  /**
505
507
  * Resolve to a Path based on a baseName(example: `./Pet.ts`) and directory(example: `./models`).
506
508
  * Options can als be included.
@@ -519,22 +521,22 @@ type PluginLifecycle<TOptions extends PluginFactoryOptions = PluginFactoryOption
519
521
  * Makes it possible to run async logic to override the path defined previously by `resolvePath`.
520
522
  * @type hookFirst
521
523
  */
522
- load?: (this: Omit<PluginContext, 'addFile'>, path: KubbFile.Path) => PossiblePromise$1<TransformResult | null>;
524
+ load?: (this: Omit<PluginContext, 'addFile'>, path: KubbFile.Path) => PossiblePromise<TransformResult | null>;
523
525
  /**
524
526
  * Transform the source-code.
525
527
  * @type hookReduceArg0
526
528
  */
527
- transform?: (this: Omit<PluginContext, 'addFile'>, source: string, path: KubbFile.Path) => PossiblePromise$1<TransformResult>;
529
+ transform?: (this: Omit<PluginContext, 'addFile'>, source: string, path: KubbFile.Path) => PossiblePromise<TransformResult>;
528
530
  /**
529
531
  * Write the result to the file-system based on the id(defined by `resolvePath` or changed by `load`).
530
532
  * @type hookParallel
531
533
  */
532
- writeFile?: (this: Omit<PluginContext, 'addFile'>, source: string | undefined, path: KubbFile.Path) => PossiblePromise$1<string | void>;
534
+ writeFile?: (this: Omit<PluginContext, 'addFile'>, source: string | undefined, path: KubbFile.Path) => PossiblePromise<string | void>;
533
535
  /**
534
536
  * End of the plugin lifecycle.
535
537
  * @type hookParallel
536
538
  */
537
- buildEnd?: (this: PluginContext) => PossiblePromise$1<void>;
539
+ buildEnd?: (this: PluginContext) => PossiblePromise<void>;
538
540
  };
539
541
  type PluginLifecycleHooks = keyof PluginLifecycle;
540
542
  type PluginParameter<H extends PluginLifecycleHooks> = Parameters<Required<PluginLifecycle>[H]>;
@@ -582,7 +584,7 @@ type Prettify<T> = {
582
584
  * TODO move to @kubb/types
583
585
  * @deprecated
584
586
  */
585
- type PossiblePromise$1<T> = Promise<T> | T;
587
+ type PossiblePromise<T> = Promise<T> | T;
586
588
  type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
587
589
  type LastOf<T> = UnionToIntersection<T extends any ? () => T : never> extends () => infer R ? R : never;
588
590
  type Push<T extends any[], V> = [...T, V];
@@ -622,9 +624,9 @@ declare function build(options: BuildOptions): Promise<BuildOutput>;
622
624
  * accepts a direct {@link KubbConfig} object, or a function that returns it.
623
625
  * The function receives a {@link ConfigEnv} object that exposes two properties:
624
626
  */
625
- declare function defineConfig(options: PossiblePromise$1<KubbUserConfig | Array<KubbUserConfig>> | ((
627
+ declare function defineConfig(options: PossiblePromise<KubbUserConfig | Array<KubbUserConfig>> | ((
626
628
  /** The options derived from the CLI flags */
627
- cliOptions: CLIOptions) => PossiblePromise$1<KubbUserConfig | Array<KubbUserConfig>>)): typeof options;
629
+ cliOptions: CLIOptions) => PossiblePromise<KubbUserConfig | Array<KubbUserConfig>>)): typeof options;
628
630
  declare function isInputPath(result: KubbConfig | undefined): result is KubbConfig<InputPath>;
629
631
 
630
632
  /**
@@ -667,7 +669,6 @@ type KubbPluginFactory<T extends PluginFactoryOptions = PluginFactoryOptions> =
667
669
  declare function createPlugin<T extends PluginFactoryOptions = PluginFactoryOptions>(factory: KubbPluginFactory<T>): (options: T['options']) => ReturnType<KubbPluginFactory<T>>;
668
670
  declare const pluginName = "core";
669
671
 
670
- type PossiblePromise<T> = Promise<T> | T;
671
672
  type PromiseFunc<T, T2 = never> = () => T2 extends never ? Promise<T> : Promise<T> | T2;
672
673
  type SeqOutput<TInput extends Array<PromiseFunc<TPromise, null>>, TPromise = unknown> = ReturnType<NonNullable<TInput[number]>>;
673
674
  type Options = {};
@@ -677,11 +678,6 @@ declare class PromiseManager {
677
678
  constructor(options?: Options);
678
679
  run<TInput extends Array<PromiseFunc<TPromise, null>>, TPromise = unknown, TOutput = SeqOutput<TInput, TPromise>>(strategy: Strategy, promises: TInput): TOutput;
679
680
  }
680
- declare function isPromise<T>(result: PossiblePromise<T>): result is Promise<T>;
681
- declare function isPromiseFulfilledResult<T = unknown>(result: PromiseSettledResult<unknown>): result is PromiseFulfilledResult<T>;
682
- declare function isPromiseRejectedResult<T>(result: PromiseSettledResult<unknown>): result is Omit<PromiseRejectedResult, 'reason'> & {
683
- reason: T;
684
- };
685
681
 
686
682
  /**
687
683
  * Abstract class that contains the building blocks for plugins to create their own SchemaGenerator
@@ -700,4 +696,4 @@ type OptionsOfPlugin<K extends keyof Plugins> = Plugins[K]['options'];
700
696
  type PluginUnion = TupleToUnion<ObjValueTuple<OptionsPlugins>>;
701
697
  type Plugin = keyof Plugins;
702
698
 
703
- export { AppMeta, BuildOutput, CLIOptions, FileManager, Generator, GetPluginFactoryOptions, GreaterThan, InputData, InputPath, KubbConfig, KubbFile, KubbObjectPlugin, KubbPlugin, KubbPluginKind, KubbUnionPlugins, KubbUserConfig, KubbUserPlugin, ObjValueTuple, OptionsOfPlugin, OptionsPlugins, PackageManager, ParallelPluginError, Plugin, PluginCache, PluginContext, PluginError, PluginFactoryOptions, PluginLifecycle, PluginLifecycleHooks, PluginManager, PluginParameter, PluginUnion, Plugins, PossiblePromise$1 as PossiblePromise, Prettify, PromiseManager, ResolveNameParams, ResolvePathParams, SchemaGenerator, SummaryError, TransformResult, TupleToUnion, ValidationPluginError, Warning, _Register, build, createPlugin, build as default, defineConfig, isInputPath, isPromise, isPromiseFulfilledResult, isPromiseRejectedResult, pluginName as name, pluginName };
699
+ export { AppMeta, BuildOutput, CLIOptions, FileManager, Generator, GetPluginFactoryOptions, GreaterThan, InputData, InputPath, KubbConfig, KubbFile, KubbObjectPlugin, KubbPlugin, KubbPluginKind, KubbUnionPlugins, KubbUserConfig, KubbUserPlugin, ObjValueTuple, OptionsOfPlugin, OptionsPlugins, PackageManager, ParallelPluginError, Plugin, PluginCache, PluginContext, PluginError, PluginFactoryOptions, PluginLifecycle, PluginLifecycleHooks, PluginManager, PluginParameter, PluginUnion, Plugins, PossiblePromise, Prettify, PromiseManager, ResolveNameParams, ResolvePathParams, SchemaGenerator, SummaryError, TransformResult, TupleToUnion, ValidationPluginError, Warning, _Register, build, combineExports, combineImports, createPlugin, build as default, defineConfig, isInputPath, pluginName as name, pluginName };
package/dist/index.js CHANGED
@@ -1173,9 +1173,6 @@ var PromiseManager = class {
1173
1173
  function isPromise(result) {
1174
1174
  return !!result && typeof result?.then === "function";
1175
1175
  }
1176
- function isPromiseFulfilledResult(result) {
1177
- return result.status === "fulfilled";
1178
- }
1179
1176
  function isPromiseRejectedResult(result) {
1180
1177
  return result.status === "rejected";
1181
1178
  }
@@ -1849,6 +1846,6 @@ var SchemaGenerator = class extends Generator {
1849
1846
  // src/index.ts
1850
1847
  var src_default = build;
1851
1848
 
1852
- export { FileManager, Generator, PackageManager, ParallelPluginError, PluginError, PluginManager, PromiseManager, SchemaGenerator, SummaryError, ValidationPluginError, Warning, build, createPlugin, src_default as default, defineConfig, isInputPath, isPromise, isPromiseFulfilledResult, isPromiseRejectedResult, pluginName as name, pluginName };
1849
+ export { FileManager, Generator, PackageManager, ParallelPluginError, PluginError, PluginManager, PromiseManager, SchemaGenerator, SummaryError, ValidationPluginError, Warning, build, combineExports, combineImports, createPlugin, src_default as default, defineConfig, isInputPath, pluginName as name, pluginName };
1853
1850
  //# sourceMappingURL=out.js.map
1854
1851
  //# sourceMappingURL=index.js.map