@kubb/core 1.15.0-canary.20231025T123615 → 1.15.0-canary.20231025T223729

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
@@ -1,86 +1,18 @@
1
1
  import { DirectoryTreeOptions } from 'directory-tree';
2
2
  import { Ora } from 'ora';
3
- export { default as pc } from 'picocolors';
4
3
 
5
- interface Cache<TStore extends object = object> {
6
- delete(id: keyof TStore): boolean;
7
- get(id: keyof TStore): TStore[keyof TStore] | null;
8
- has(id: keyof TStore): boolean;
9
- set(id: keyof TStore, value: unknown): void;
10
- }
11
- declare function createPluginCache<TStore extends PluginCache>(Store?: TStore): Cache<TStore>;
12
-
13
- declare function clean(path: string): Promise<void>;
14
-
15
- type FunctionParamsASTWithoutType = {
16
- name?: string;
17
- type?: string;
18
- /**
19
- * @default true
20
- */
21
- required?: boolean;
22
- /**
23
- * @default true
24
- */
25
- enabled?: boolean;
26
- default?: string;
27
- };
28
- type FunctionParamsASTWithType = {
29
- name?: never;
30
- type: string;
31
- /**
32
- * @default true
33
- */
34
- required?: boolean;
35
- /**
36
- * @default true
37
- */
38
- enabled?: boolean;
39
- default?: string;
40
- };
41
- type FunctionParamsAST = FunctionParamsASTWithoutType | FunctionParamsASTWithType;
42
- declare class FunctionParams {
43
- type?: 'generics' | 'typed';
44
- items: FunctionParamsAST[];
45
- constructor(type?: 'generics' | 'typed');
46
- add(item: FunctionParamsAST | Array<FunctionParamsAST | undefined> | undefined): FunctionParams;
47
- toString(): string;
48
- }
49
-
50
- declare function isPromise<T>(result: PossiblePromise<T>): result is Promise<T>;
51
- declare function isPromiseFulfilledResult<T = unknown>(result: PromiseSettledResult<unknown>): result is PromiseFulfilledResult<T>;
52
- declare function isPromiseRejectedResult<T>(result: PromiseSettledResult<unknown>): result is Omit<PromiseRejectedResult, 'reason'> & {
53
- reason: T;
54
- };
4
+ declare function read(path: string): Promise<string>;
55
5
 
56
- declare function createJSDocBlockText({ comments }: {
57
- comments: Array<string>;
58
- }): string;
6
+ declare function write(data: string, path: string): Promise<string | undefined>;
59
7
 
60
- type LogType = 'error' | 'info' | 'warning';
61
- type Logger = {
62
- /**
63
- * Optional config name to show in CLI output
64
- */
65
- name?: string;
66
- logLevel: LogLevel;
67
- log: (message: string | null) => void;
68
- error: (message: string | null) => void;
69
- info: (message: string | null) => void;
70
- warn: (message: string | null) => void;
71
- spinner?: Ora;
72
- logs: string[];
73
- };
74
- type Props = {
75
- name?: string;
76
- logLevel: LogLevel;
77
- spinner?: Ora;
8
+ type BarrelManagerOptions = {
9
+ treeNode?: DirectoryTreeOptions;
10
+ isTypeOnly?: boolean;
11
+ filter?: (file: KubbFile.File) => boolean;
12
+ map?: (file: KubbFile.File) => KubbFile.File;
13
+ includeExt?: boolean;
14
+ output?: string;
78
15
  };
79
- declare function createLogger({ logLevel, name, spinner }: Props): Logger;
80
-
81
- declare function nameSorter<T extends {
82
- name: string;
83
- }>(a: T, b: T): 0 | 1 | -1;
84
16
 
85
17
  declare class EventEmitter<TEvents extends Record<string, any>> {
86
18
  #private;
@@ -113,122 +45,6 @@ declare class Queue {
113
45
  get count(): number;
114
46
  }
115
47
 
116
- declare function randomColour(text?: string, colours?: readonly ["black", "blue", "darkBlue", "cyan", "gray", "green", "darkGreen", "magenta", "red", "darkRed", "yellow", "darkYellow"]): string;
117
- declare function randomPicoColour(text?: string, colors?: readonly ["black", "blue", "darkBlue", "cyan", "gray", "green", "darkGreen", "magenta", "red", "darkRed", "yellow", "darkYellow"]): string;
118
-
119
- declare function getRelativePath(rootDir?: string | null, filePath?: string | null, platform?: 'windows' | 'mac' | 'linux'): string;
120
- declare function read(path: string): Promise<string>;
121
- declare function readSync(path: string): string;
122
-
123
- declare function renderTemplate<TData extends Record<string, unknown> = Record<string, unknown>>(template: string, data?: TData | undefined): string;
124
-
125
- declare class SummaryError extends Error {
126
- summary: string[];
127
- constructor(message: string, options: {
128
- cause: Error;
129
- summary?: string[];
130
- });
131
- }
132
-
133
- declare const throttle: <R, A extends any[]>(fn: (...args: A) => R, delay: number) => [(...args: A) => R | undefined, () => void];
134
-
135
- declare function timeout(ms: number): Promise<unknown>;
136
-
137
- declare function combineCodes(codes: string[]): string;
138
-
139
- declare function escape(text?: string): string;
140
- /**
141
- * Escape all characters not included in SingleStringCharacters and DoubleStringCharacters on
142
- * @link http://www.ecma-international.org/ecma-262/5.1/#sec-7.8.4
143
- * @link https://github.com/joliss/js-string-escape/blob/master/index.js
144
- */
145
- declare function jsStringEscape(input: any): string;
146
-
147
- declare function createIndent(size: number): string;
148
-
149
- declare function transformReservedWord(word: string): string;
150
-
151
- declare const transformers: {
152
- readonly combineCodes: typeof combineCodes;
153
- readonly escape: typeof escape;
154
- readonly jsStringEscape: typeof jsStringEscape;
155
- readonly createIndent: typeof createIndent;
156
- readonly transformReservedWord: typeof transformReservedWord;
157
- };
158
-
159
- type TreeNodeOptions = DirectoryTreeOptions;
160
- declare class TreeNode<T = unknown> {
161
- data: T;
162
- parent?: TreeNode<T>;
163
- children: Array<TreeNode<T>>;
164
- constructor(data: T, parent?: TreeNode<T>);
165
- addChild(data: T): TreeNode<T>;
166
- find(data?: T): TreeNode<T> | null;
167
- get leaves(): TreeNode<T>[];
168
- get root(): TreeNode<T>;
169
- forEach(callback: (treeNode: TreeNode<T>) => void): this;
170
- static build<T = unknown>(path: string, options?: TreeNodeOptions): TreeNode<T> | null;
171
- }
172
-
173
- declare const uniqueIdFactory: (counter: number) => (str?: string) => string;
174
-
175
- declare function getUniqueName(originalName: string, data: Record<string, number>): string;
176
- declare function setUniqueName(originalName: string, data: Record<string, number>): string;
177
-
178
- type URLObject = {
179
- url: string;
180
- params?: Record<string, string>;
181
- };
182
- type ObjectOptions = {
183
- type?: 'path' | 'template';
184
- replacer?: (pathParam: string) => string;
185
- stringify?: boolean;
186
- };
187
- declare class URLPath {
188
- path: string;
189
- constructor(path: string);
190
- /**
191
- * Convert Swagger path to URLPath(syntax of Express)
192
- * @example /pet/{petId} => /pet/:petId
193
- */
194
- get URL(): string;
195
- get isURL(): boolean;
196
- /**
197
- * Convert Swagger path to template literals/ template strings(camelcase)
198
- * @example /pet/{petId} => `/pet/${petId}`
199
- * @example /account/monetary-accountID => `/account/${monetaryAccountId}`
200
- * @example /account/userID => `/account/${userId}`
201
- */
202
- get template(): string;
203
- get object(): URLObject | string;
204
- get params(): Record<string, string> | undefined;
205
- toObject({ type, replacer, stringify }?: ObjectOptions): URLObject | string;
206
- /**
207
- * Convert Swagger path to template literals/ template strings(camelcase)
208
- * @example /pet/{petId} => `/pet/${petId}`
209
- * @example /account/monetary-accountID => `/account/${monetaryAccountId}`
210
- * @example /account/userID => `/account/${userId}`
211
- */
212
- toTemplateString(replacer?: (pathParam: string) => string): string;
213
- getParams(replacer?: (pathParam: string) => string): Record<string, string> | undefined;
214
- /**
215
- * Convert Swagger path to URLPath(syntax of Express)
216
- * @example /pet/{petId} => /pet/:petId
217
- */
218
- toURLPath(): string;
219
- }
220
-
221
- /**
222
- * Behaves as an Error to log a warning in the console(still stops the execution)
223
- */
224
- declare class Warning extends Error {
225
- constructor(message?: string, options?: {
226
- cause: Error;
227
- });
228
- }
229
-
230
- declare function write(data: string, path: string): Promise<string | undefined>;
231
-
232
48
  type BasePath<T extends string = string> = `${T}/`;
233
49
  declare namespace KubbFile {
234
50
  type Import = {
@@ -250,11 +66,15 @@ declare namespace KubbFile {
250
66
  type Path = string;
251
67
  type AdvancedPath<T extends BaseName = BaseName> = `${BasePath}${T}`;
252
68
  type OptionalPath = Path | undefined | null;
253
- type File<TMeta extends {
254
- pluginKey?: KubbPlugin['key'];
255
- } = {
69
+ type FileMetaBase = {
256
70
  pluginKey?: KubbPlugin['key'];
257
- }, TBaseName extends BaseName = BaseName> = {
71
+ };
72
+ type File<TMeta extends FileMetaBase = FileMetaBase, TBaseName extends BaseName = BaseName> = {
73
+ /**
74
+ * Unique identifier to reuse later
75
+ * @default crypto.randomUUID()
76
+ */
77
+ id?: string;
258
78
  /**
259
79
  * Name to be used to dynamicly create the baseName(based on input.path)
260
80
  * Based on UNIX basename
@@ -270,6 +90,7 @@ declare namespace KubbFile {
270
90
  exports?: Export[];
271
91
  /**
272
92
  * This will call fileManager.add instead of fileManager.addOrAppend, adding the source when the files already exists
93
+ * This will also ignore the combinefiles utils
273
94
  * @default `false`
274
95
  */
275
96
  override?: boolean;
@@ -278,31 +99,23 @@ declare namespace KubbFile {
278
99
  * This will override `process.env[key]` inside the `source`, see `getFileSource`.
279
100
  */
280
101
  env?: NodeJS.ProcessEnv;
102
+ validate?: boolean;
281
103
  };
282
104
  type ResolvedFile = KubbFile.File & {
283
105
  /**
284
- * crypto.randomUUID()
106
+ * @default crypto.randomUUID()
285
107
  */
286
108
  id: UUID;
287
109
  };
288
110
  }
289
-
290
- type IndexesOptions = {
291
- treeNode?: TreeNodeOptions;
292
- isTypeOnly?: boolean;
293
- filter?: (file: KubbFile.File) => boolean;
294
- map?: (file: KubbFile.File) => KubbFile.File;
295
- includeExt?: boolean;
296
- output?: string;
297
- };
298
-
111
+ type AddResult<T extends Array<KubbFile.File>> = Promise<Awaited<GreaterThan<T['length'], 1> extends true ? Promise<KubbFile.ResolvedFile[]> : Promise<KubbFile.ResolvedFile>>>;
299
112
  type AddIndexesProps = {
300
113
  root: KubbFile.Path;
301
114
  extName?: KubbFile.Extname;
302
- options?: IndexesOptions;
115
+ options?: BarrelManagerOptions;
303
116
  meta?: KubbFile.File['meta'];
304
117
  };
305
- type Options$1 = {
118
+ type Options$2 = {
306
119
  queue?: Queue;
307
120
  task?: QueueJob<KubbFile.ResolvedFile>;
308
121
  /**
@@ -312,27 +125,77 @@ type Options$1 = {
312
125
  };
313
126
  declare class FileManager {
314
127
  #private;
315
- constructor(options?: Options$1);
316
- get extensions(): Array<KubbFile.Extname>;
128
+ constructor(options?: Options$2);
317
129
  get files(): Array<KubbFile.File>;
318
130
  get isExecuting(): boolean;
319
- add(file: KubbFile.File): Promise<KubbFile.ResolvedFile>;
320
- addOrAppend(file: KubbFile.File): Promise<KubbFile.ResolvedFile>;
131
+ add<T extends Array<KubbFile.File> = Array<KubbFile.File>>(...files: T): AddResult<T>;
321
132
  addIndexes({ root, extName, meta, options }: AddIndexesProps): Promise<Array<KubbFile.File> | undefined>;
322
133
  getCacheByUUID(UUID: KubbFile.UUID): KubbFile.File | undefined;
323
134
  get(path: KubbFile.Path): Array<KubbFile.File> | undefined;
324
135
  remove(path: KubbFile.Path): void;
325
136
  write(...params: Parameters<typeof write>): Promise<string | undefined>;
326
137
  read(...params: Parameters<typeof read>): Promise<string>;
327
- static getSource(file: KubbFile.File): string;
328
- static combineFiles(files: Array<KubbFile.File | null>): Array<KubbFile.File>;
138
+ static getSource<TMeta extends KubbFile.FileMetaBase = KubbFile.FileMetaBase>(file: KubbFile.File<TMeta>): string;
139
+ static combineFiles<TMeta extends KubbFile.FileMetaBase = KubbFile.FileMetaBase>(files: Array<KubbFile.File<TMeta> | null>): Array<KubbFile.File<TMeta>>;
329
140
  static getMode(path: string | undefined | null): KubbFile.Mode;
141
+ static get extensions(): Array<KubbFile.Extname>;
142
+ static isExtensionAllowed(baseName: string): boolean;
330
143
  }
331
144
 
332
- type SeqOutput<TInput extends Array<PromiseFunc<TPromise, null>>, TPromise = unknown> = ReturnType<NonNullable<TInput[number]>>;
333
- declare function hookSeq<TInput extends Array<PromiseFunc<TPromise, null>>, TPromise = unknown, TOutput = SeqOutput<TInput, TPromise>>(promises: TInput): TOutput;
334
- declare const executeStrategies: {
335
- readonly hookSeq: typeof hookSeq;
145
+ declare class PluginError extends Error {
146
+ pluginManager: PluginManager;
147
+ cause: Error;
148
+ constructor(message: string, options: {
149
+ cause: Error;
150
+ pluginManager: PluginManager;
151
+ });
152
+ }
153
+ declare class ParallelPluginError extends Error {
154
+ errors: PluginError[];
155
+ pluginManager: PluginManager;
156
+ constructor(message: string, options: {
157
+ cause?: Error;
158
+ errors: PluginError[];
159
+ pluginManager: PluginManager;
160
+ });
161
+ findError<T extends Error = Error>(searchError: T | undefined): T | undefined;
162
+ }
163
+ declare class SummaryError extends Error {
164
+ summary: string[];
165
+ constructor(message: string, options: {
166
+ cause: Error;
167
+ summary?: string[];
168
+ });
169
+ }
170
+ /**
171
+ * Behaves as an Error to log a warning in the console(still stops the execution)
172
+ */
173
+ declare class Warning extends Error {
174
+ constructor(message?: string, options?: {
175
+ cause: Error;
176
+ });
177
+ }
178
+ declare class ValidationPluginError extends Error {
179
+ }
180
+
181
+ declare const LogLevel: {
182
+ readonly silent: "silent";
183
+ readonly info: "info";
184
+ readonly debug: "debug";
185
+ };
186
+ type LogLevel = keyof typeof LogLevel;
187
+ type Logger = {
188
+ /**
189
+ * Optional config name to show in CLI output
190
+ */
191
+ name?: string;
192
+ logLevel: LogLevel;
193
+ log: (message: string | null) => void;
194
+ error: (message: string | null) => void;
195
+ info: (message: string | null) => void;
196
+ warn: (message: string | null) => void;
197
+ spinner?: Ora;
198
+ logs: string[];
336
199
  };
337
200
 
338
201
  type RequiredPluginLifecycle = Required<PluginLifecycle>;
@@ -341,9 +204,9 @@ type RequiredPluginLifecycle = Required<PluginLifecycle>;
341
204
  * @example Arg0<(a: string, b: number) => void> -> string
342
205
  */
343
206
  type Argument0<H extends keyof PluginLifecycle> = Parameters<RequiredPluginLifecycle[H]>[0];
344
- type Strategy = 'hookFirst' | 'hookForPlugin' | 'hookParallel' | 'hookReduceArg0' | 'hookSeq';
207
+ type Strategy$1 = 'hookFirst' | 'hookForPlugin' | 'hookParallel' | 'hookReduceArg0' | 'hookSeq';
345
208
  type Executer<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
346
- strategy: Strategy;
209
+ strategy: Strategy$1;
347
210
  hookName: H;
348
211
  plugin: KubbPlugin;
349
212
  parameters?: unknown[] | undefined;
@@ -354,10 +217,7 @@ type SafeParseResult<H extends PluginLifecycleHooks, Result = ReturnType<ParseRe
354
217
  result: Result;
355
218
  plugin: KubbPlugin;
356
219
  };
357
- type PluginParameter<H extends PluginLifecycleHooks> = Parameters<RequiredPluginLifecycle[H]>;
358
-
359
- declare const hooks: [keyof PluginLifecycle<PluginFactoryOptions<string, KubbPluginKind, unknown, false, unknown, Record<string, unknown>>>];
360
- type Options = {
220
+ type Options$1 = {
361
221
  logger: Logger;
362
222
  /**
363
223
  * Task for the FileManager
@@ -381,8 +241,7 @@ declare class PluginManager {
381
241
  readonly queue: Queue;
382
242
  readonly executed: Executer[];
383
243
  readonly logger: Logger;
384
- usedPluginNames: Record<string, number>;
385
- constructor(config: KubbConfig, options: Options);
244
+ constructor(config: KubbConfig, options: Options$1);
386
245
  resolvePath: (params: ResolvePathParams) => KubbFile.OptionalPath;
387
246
  resolveName: (params: ResolveNameParams) => string;
388
247
  on<TEventName extends keyof Events & string>(eventName: TEventName, handler: (...eventArg: Events[TEventName]) => void): void;
@@ -428,7 +287,7 @@ declare class PluginManager {
428
287
  hookReduceArg0<H extends PluginLifecycleHooks>({ hookName, parameters, reduce, }: {
429
288
  hookName: H;
430
289
  parameters: PluginParameter<H>;
431
- reduce: (reduction: Argument0<H>, result: ReturnType<ParseResult<H>>, plugin: KubbPlugin) => PossiblePromise<Argument0<H> | null>;
290
+ reduce: (reduction: Argument0<H>, result: ReturnType<ParseResult<H>>, plugin: KubbPlugin) => PossiblePromise$1<Argument0<H> | null>;
432
291
  }): Promise<Argument0<H>>;
433
292
  /**
434
293
  * Chains plugins
@@ -438,31 +297,16 @@ declare class PluginManager {
438
297
  parameters?: PluginParameter<H>;
439
298
  }): Promise<void>;
440
299
  getPluginsByKey(hookName: keyof PluginLifecycle, pluginKey: KubbPlugin['key']): KubbPlugin[];
300
+ static getDependedPlugins<T1 extends PluginFactoryOptions, T2 extends PluginFactoryOptions = never, T3 extends PluginFactoryOptions = never, TOutput = T3 extends never ? T2 extends never ? [T1: KubbPlugin<T1>] : [T1: KubbPlugin<T1>, T2: KubbPlugin<T2>] : [T1: KubbPlugin<T1>, T2: KubbPlugin<T2>, T3: KubbPlugin<T3>]>(plugins: Array<KubbPlugin>, dependedPluginNames: string | string[]): TOutput;
301
+ static get hooks(): readonly ["validate", "buildStart", "resolvePath", "resolveName", "load", "transform", "writeFile", "buildEnd"];
441
302
  }
442
303
 
443
- declare class PluginError extends Error {
444
- pluginManager: PluginManager;
445
- cause: Error;
446
- constructor(message: string, options: {
447
- cause: Error;
448
- pluginManager: PluginManager;
449
- });
450
- }
451
-
452
- declare class ParallelPluginError extends Error {
453
- errors: PluginError[];
454
- pluginManager: PluginManager;
455
- constructor(message: string, options: {
456
- cause?: Error;
457
- errors: PluginError[];
458
- pluginManager: PluginManager;
459
- });
460
- findError<T extends Error = Error>(searchError: T | undefined): T | undefined;
461
- }
462
-
463
- declare class ValidationPluginError extends Error {
304
+ interface Cache<TStore extends object = object> {
305
+ delete(id: keyof TStore): boolean;
306
+ get(id: keyof TStore): TStore[keyof TStore] | null;
307
+ has(id: keyof TStore): boolean;
308
+ set(id: keyof TStore, value: unknown): void;
464
309
  }
465
- declare function getDependedPlugins<T1 extends PluginFactoryOptions, T2 extends PluginFactoryOptions = never, T3 extends PluginFactoryOptions = never, TOutput = T3 extends never ? T2 extends never ? [T1: KubbPlugin<T1>] : [T1: KubbPlugin<T1>, T2: KubbPlugin<T2>] : [T1: KubbPlugin<T1>, T2: KubbPlugin<T2>, T3: KubbPlugin<T3>]>(plugins: Array<KubbPlugin>, dependedPluginNames: string | string[]): TOutput;
466
310
 
467
311
  /**
468
312
  * Config used in `kubb.config.js`
@@ -651,12 +495,12 @@ type PluginLifecycle<TOptions extends PluginFactoryOptions = PluginFactoryOption
651
495
  * Valdiate all plugins to see if their depended plugins are installed and configured.
652
496
  * @type hookParallel
653
497
  */
654
- validate?: (this: Omit<PluginContext, 'addFile'>, plugins: NonNullable<KubbConfig['plugins']>) => PossiblePromise<true>;
498
+ validate?: (this: Omit<PluginContext, 'addFile'>, plugins: NonNullable<KubbConfig['plugins']>) => PossiblePromise$1<true>;
655
499
  /**
656
500
  * Start of the lifecycle of a plugin.
657
501
  * @type hookParallel
658
502
  */
659
- buildStart?: (this: PluginContext, kubbConfig: KubbConfig) => PossiblePromise<void>;
503
+ buildStart?: (this: PluginContext, kubbConfig: KubbConfig) => PossiblePromise$1<void>;
660
504
  /**
661
505
  * Resolve to a Path based on a baseName(example: `./Pet.ts`) and directory(example: `./models`).
662
506
  * Options can als be included.
@@ -675,24 +519,25 @@ type PluginLifecycle<TOptions extends PluginFactoryOptions = PluginFactoryOption
675
519
  * Makes it possible to run async logic to override the path defined previously by `resolvePath`.
676
520
  * @type hookFirst
677
521
  */
678
- load?: (this: Omit<PluginContext, 'addFile'>, path: KubbFile.Path) => PossiblePromise<TransformResult | null>;
522
+ load?: (this: Omit<PluginContext, 'addFile'>, path: KubbFile.Path) => PossiblePromise$1<TransformResult | null>;
679
523
  /**
680
524
  * Transform the source-code.
681
525
  * @type hookReduceArg0
682
526
  */
683
- transform?: (this: Omit<PluginContext, 'addFile'>, source: string, path: KubbFile.Path) => PossiblePromise<TransformResult>;
527
+ transform?: (this: Omit<PluginContext, 'addFile'>, source: string, path: KubbFile.Path) => PossiblePromise$1<TransformResult>;
684
528
  /**
685
529
  * Write the result to the file-system based on the id(defined by `resolvePath` or changed by `load`).
686
530
  * @type hookParallel
687
531
  */
688
- writeFile?: (this: Omit<PluginContext, 'addFile'>, source: string | undefined, path: KubbFile.Path) => PossiblePromise<string | void>;
532
+ writeFile?: (this: Omit<PluginContext, 'addFile'>, source: string | undefined, path: KubbFile.Path) => PossiblePromise$1<string | void>;
689
533
  /**
690
534
  * End of the plugin lifecycle.
691
535
  * @type hookParallel
692
536
  */
693
- buildEnd?: (this: PluginContext) => PossiblePromise<void>;
537
+ buildEnd?: (this: PluginContext) => PossiblePromise$1<void>;
694
538
  };
695
539
  type PluginLifecycleHooks = keyof PluginLifecycle;
540
+ type PluginParameter<H extends PluginLifecycleHooks> = Parameters<Required<PluginLifecycle>[H]>;
696
541
  type PluginCache = Record<string, [number, unknown]>;
697
542
  type ResolvePathParams<TOptions = Record<string, unknown>> = {
698
543
  pluginKey?: KubbPlugin['key'];
@@ -727,26 +572,41 @@ type PluginContext<TOptions = Record<string, unknown>> = {
727
572
  plugin: KubbPlugin;
728
573
  };
729
574
  type TransformResult = string | null;
730
- declare const LogLevel: {
731
- readonly silent: "silent";
732
- readonly info: "info";
733
- readonly debug: "debug";
734
- };
735
- type LogLevel = keyof typeof LogLevel;
736
575
  type AppMeta = {
737
576
  pluginManager: PluginManager;
738
577
  };
739
578
  type Prettify<T> = {
740
579
  [K in keyof T]: T[K];
741
580
  } & {};
742
- type PossiblePromise<T> = Promise<T> | T;
743
- type PromiseFunc<T, T2 = never> = () => T2 extends never ? Promise<T> : Promise<T> | T2;
581
+ /**
582
+ * TODO move to @kubb/types
583
+ * @deprecated
584
+ */
585
+ type PossiblePromise$1<T> = Promise<T> | T;
744
586
  type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
745
587
  type LastOf<T> = UnionToIntersection<T extends any ? () => T : never> extends () => infer R ? R : never;
746
588
  type Push<T extends any[], V> = [...T, V];
747
589
  type TuplifyUnion<T, L = LastOf<T>, N = [T] extends [never] ? true : false> = true extends N ? [] : Push<TuplifyUnion<Exclude<T, L>>, L>;
590
+ /**
591
+ * TODO move to @kubb/types
592
+ * @deprecated
593
+ */
748
594
  type ObjValueTuple<T, KS extends any[] = TuplifyUnion<keyof T>, R extends any[] = []> = KS extends [infer K, ...infer KT] ? ObjValueTuple<T, KT, [...R, [name: K & keyof T, options: T[K & keyof T]]]> : R;
595
+ /**
596
+ * TODO move to @kubb/types
597
+ * @deprecated
598
+ */
749
599
  type TupleToUnion<T> = T extends Array<infer ITEMS> ? ITEMS : never;
600
+ /**
601
+ * TODO move to @kubb/types
602
+ * @deprecated
603
+ */
604
+ type ArrayWithLength<T extends number, U extends any[] = []> = U['length'] extends T ? U : ArrayWithLength<T, [true, ...U]>;
605
+ /**
606
+ * TODO move to @kubb/types
607
+ * @deprecated
608
+ */
609
+ type GreaterThan<T extends number, U extends number> = ArrayWithLength<U> extends [...ArrayWithLength<T>, ...infer _] ? false : true;
750
610
 
751
611
  type BuildOptions = {
752
612
  config: PluginContext['config'];
@@ -762,9 +622,9 @@ declare function build(options: BuildOptions): Promise<BuildOutput>;
762
622
  * accepts a direct {@link KubbConfig} object, or a function that returns it.
763
623
  * The function receives a {@link ConfigEnv} object that exposes two properties:
764
624
  */
765
- declare function defineConfig(options: PossiblePromise<KubbUserConfig | Array<KubbUserConfig>> | ((
625
+ declare function defineConfig(options: PossiblePromise$1<KubbUserConfig | Array<KubbUserConfig>> | ((
766
626
  /** The options derived from the CLI flags */
767
- cliOptions: CLIOptions) => PossiblePromise<KubbUserConfig | Array<KubbUserConfig>>)): typeof options;
627
+ cliOptions: CLIOptions) => PossiblePromise$1<KubbUserConfig | Array<KubbUserConfig>>)): typeof options;
768
628
  declare function isInputPath(result: KubbConfig | undefined): result is KubbConfig<InputPath>;
769
629
 
770
630
  /**
@@ -780,13 +640,6 @@ declare abstract class Generator<TOptions = unknown, TContext = unknown> {
780
640
  abstract build(...params: unknown[]): unknown;
781
641
  }
782
642
 
783
- /**
784
- * Abstract class that contains the building blocks for plugins to create their own SchemaGenerator
785
- */
786
- declare abstract class SchemaGenerator<TOptions extends object, TInput, TOutput> extends Generator<TOptions> {
787
- abstract build(schema: TInput, name: string, description?: string): TOutput;
788
- }
789
-
790
643
  type PackageJSON = {
791
644
  dependencies?: Record<string, string>;
792
645
  devDependencies?: Record<string, string>;
@@ -814,6 +667,29 @@ type KubbPluginFactory<T extends PluginFactoryOptions = PluginFactoryOptions> =
814
667
  declare function createPlugin<T extends PluginFactoryOptions = PluginFactoryOptions>(factory: KubbPluginFactory<T>): (options: T['options']) => ReturnType<KubbPluginFactory<T>>;
815
668
  declare const pluginName = "core";
816
669
 
670
+ type PossiblePromise<T> = Promise<T> | T;
671
+ type PromiseFunc<T, T2 = never> = () => T2 extends never ? Promise<T> : Promise<T> | T2;
672
+ type SeqOutput<TInput extends Array<PromiseFunc<TPromise, null>>, TPromise = unknown> = ReturnType<NonNullable<TInput[number]>>;
673
+ type Options = {};
674
+ type Strategy = 'seq';
675
+ declare class PromiseManager {
676
+ #private;
677
+ constructor(options?: Options);
678
+ run<TInput extends Array<PromiseFunc<TPromise, null>>, TPromise = unknown, TOutput = SeqOutput<TInput, TPromise>>(strategy: Strategy, promises: TInput): TOutput;
679
+ }
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
+
686
+ /**
687
+ * Abstract class that contains the building blocks for plugins to create their own SchemaGenerator
688
+ */
689
+ declare abstract class SchemaGenerator<TOptions extends object, TInput, TOutput> extends Generator<TOptions> {
690
+ abstract build(schema: TInput, name: string, description?: string): TOutput;
691
+ }
692
+
817
693
  interface _Register {
818
694
  }
819
695
  type Plugins = _Register;
@@ -824,4 +700,4 @@ type OptionsOfPlugin<K extends keyof Plugins> = Plugins[K]['options'];
824
700
  type PluginUnion = TupleToUnion<ObjValueTuple<OptionsPlugins>>;
825
701
  type Plugin = keyof Plugins;
826
702
 
827
- export { AppMeta, BuildOutput, CLIOptions, Cache, FileManager, FunctionParams, FunctionParamsAST, Generator, GetPluginFactoryOptions, InputData, InputPath, KubbConfig, KubbFile, KubbObjectPlugin, KubbPlugin, KubbPluginKind, KubbUnionPlugins, KubbUserConfig, KubbUserPlugin, LogLevel, LogType, Logger, ObjValueTuple, OptionsOfPlugin, OptionsPlugins, PackageManager, ParallelPluginError, Plugin, PluginCache, PluginContext, PluginError, PluginFactoryOptions, PluginLifecycle, PluginLifecycleHooks, PluginManager, PluginUnion, Plugins, PossiblePromise, Prettify, PromiseFunc, Queue, QueueJob, ResolveNameParams, ResolvePathParams, SchemaGenerator, SummaryError, TransformResult, TreeNode, TreeNodeOptions, TupleToUnion, URLObject, URLPath, ValidationPluginError, Warning, _Register, build, clean, createJSDocBlockText, createLogger, createPlugin, createPluginCache, build as default, defineConfig, executeStrategies, getDependedPlugins, getRelativePath, getUniqueName, hooks, isInputPath, isPromise, isPromiseFulfilledResult, isPromiseRejectedResult, pluginName as name, nameSorter, pluginName, randomColour, randomPicoColour, read, readSync, renderTemplate, setUniqueName, throttle, timeout, transformers, uniqueIdFactory, write };
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 };