@kubb/plugin-oas 4.11.3 → 4.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{SchemaGenerator-BpPB5lqA.cjs → SchemaGenerator-Dq-VUskF.cjs} +4 -5
- package/dist/SchemaGenerator-Dq-VUskF.cjs.map +1 -0
- package/dist/{SchemaGenerator-HVn_098D.js → SchemaGenerator-EtUI1o9z.js} +4 -5
- package/dist/SchemaGenerator-EtUI1o9z.js.map +1 -0
- package/dist/{SchemaMapper-Dfz9lGho.d.cts → SchemaMapper-Cjte6oBd.d.cts} +214 -101
- package/dist/{SchemaMapper-CIK5L5DN.d.ts → SchemaMapper-DlcrPonN.d.ts} +214 -101
- package/dist/{createGenerator-5Mu_DEco.d.cts → createGenerator-B1p6Pl-d.d.ts} +38 -6
- package/dist/{createGenerator-CQWDp6sV.d.ts → createGenerator-DyVUP-Aj.d.cts} +38 -6
- package/dist/generators.d.cts +2 -2
- package/dist/generators.d.ts +2 -2
- package/dist/hooks.cjs +1 -1
- package/dist/hooks.d.cts +2 -2
- package/dist/hooks.d.ts +2 -2
- package/dist/hooks.js +1 -1
- package/dist/index.cjs +4 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -5
- package/dist/index.js.map +1 -1
- package/dist/mocks.d.cts +1 -1
- package/dist/mocks.d.ts +1 -1
- package/dist/utils.d.cts +2 -34
- package/dist/utils.d.ts +2 -34
- package/package.json +5 -5
- package/src/OperationGenerator.ts +4 -5
- package/src/SchemaGenerator.ts +6 -8
- package/src/plugin.ts +2 -2
- package/dist/SchemaGenerator-BpPB5lqA.cjs.map +0 -1
- package/dist/SchemaGenerator-HVn_098D.js.map +0 -1
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Fabric } from "@kubb/react-fabric";
|
|
2
2
|
import { KubbFile } from "@kubb/fabric-core/types";
|
|
3
|
-
import { ConsolaInstance, LogLevel } from "consola";
|
|
4
3
|
import * as OasTypes from "oas/types";
|
|
5
4
|
import { HttpMethods as HttpMethod, OASDocument, SchemaObject, User } from "oas/types";
|
|
6
5
|
import { Operation, Operation as Operation$1 } from "oas/operation";
|
|
@@ -22,75 +21,229 @@ declare abstract class BaseGenerator<TOptions = unknown, TContext = unknown> {
|
|
|
22
21
|
abstract build(...params: unknown[]): unknown;
|
|
23
22
|
}
|
|
24
23
|
//#endregion
|
|
25
|
-
//#region ../core/src/
|
|
26
|
-
declare class EventEmitter<TEvents extends Record<string, any>> {
|
|
27
|
-
#private;
|
|
28
|
-
constructor();
|
|
29
|
-
emit<TEventName extends keyof TEvents & string>(eventName: TEventName, ...eventArg: TEvents[TEventName]): void;
|
|
30
|
-
on<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
|
|
31
|
-
off<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
|
|
32
|
-
removeAll(): void;
|
|
33
|
-
}
|
|
34
|
-
//#endregion
|
|
35
|
-
//#region ../core/src/logger.d.ts
|
|
24
|
+
//#region ../core/src/Kubb.d.ts
|
|
36
25
|
type DebugEvent = {
|
|
37
26
|
date: Date;
|
|
38
27
|
logs: string[];
|
|
39
28
|
fileName?: string;
|
|
29
|
+
};
|
|
30
|
+
type ProgressStartMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
|
|
31
|
+
hookName: H;
|
|
32
|
+
plugins: Array<Plugin>;
|
|
33
|
+
};
|
|
34
|
+
type ProgressStopMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
|
|
35
|
+
hookName: H;
|
|
36
|
+
};
|
|
37
|
+
type ExecutingMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
|
|
38
|
+
strategy: Strategy;
|
|
39
|
+
hookName: H;
|
|
40
|
+
plugin: Plugin;
|
|
41
|
+
parameters?: unknown[] | undefined;
|
|
42
|
+
output?: unknown;
|
|
43
|
+
};
|
|
44
|
+
type ExecutedMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
|
|
45
|
+
duration: number;
|
|
46
|
+
strategy: Strategy;
|
|
47
|
+
hookName: H;
|
|
48
|
+
plugin: Plugin;
|
|
49
|
+
parameters?: unknown[] | undefined;
|
|
50
|
+
output?: unknown;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Events emitted during the Kubb code generation lifecycle.
|
|
54
|
+
* These events can be listened to for logging, progress tracking, and custom integrations.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```typescript
|
|
58
|
+
* import type { AsyncEventEmitter } from '@kubb/core'
|
|
59
|
+
* import type { KubbEvents } from '@kubb/core'
|
|
60
|
+
*
|
|
61
|
+
* const events: AsyncEventEmitter<KubbEvents> = new AsyncEventEmitter()
|
|
62
|
+
*
|
|
63
|
+
* events.on('lifecycle:start', () => {
|
|
64
|
+
* console.log('Starting Kubb generation')
|
|
65
|
+
* })
|
|
66
|
+
*
|
|
67
|
+
* events.on('plugin:end', (plugin, duration) => {
|
|
68
|
+
* console.log(`Plugin ${plugin.name} completed in ${duration}ms`)
|
|
69
|
+
* })
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
interface KubbEvents {
|
|
40
73
|
/**
|
|
41
|
-
*
|
|
42
|
-
* - 'setup': Initial configuration and environment setup
|
|
43
|
-
* - 'plugin': Plugin installation and execution
|
|
44
|
-
* - 'hook': Plugin hook execution details
|
|
45
|
-
* - 'schema': Schema parsing and generation
|
|
46
|
-
* - 'file': File operations (read/write/generate)
|
|
47
|
-
* - 'error': Error details and stack traces
|
|
48
|
-
* - undefined: Generic logs (always inline)
|
|
74
|
+
* Emitted at the beginning of the Kubb lifecycle, before any code generation starts.
|
|
49
75
|
*/
|
|
50
|
-
|
|
76
|
+
'lifecycle:start': [version: string];
|
|
51
77
|
/**
|
|
52
|
-
*
|
|
78
|
+
* Emitted at the end of the Kubb lifecycle, after all code generation is complete.
|
|
53
79
|
*/
|
|
54
|
-
|
|
80
|
+
'lifecycle:end': [];
|
|
55
81
|
/**
|
|
56
|
-
*
|
|
57
|
-
* - 'start': Start of plugin execution group
|
|
58
|
-
* - 'end': End of plugin execution group
|
|
82
|
+
* Emitted when configuration loading starts.
|
|
59
83
|
*/
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
84
|
+
'config:start': [];
|
|
85
|
+
/**
|
|
86
|
+
* Emitted when configuration loading is complete.
|
|
87
|
+
*/
|
|
88
|
+
'config:end': [configs: Array<Config>];
|
|
89
|
+
/**
|
|
90
|
+
* Emitted when code generation phase starts.
|
|
91
|
+
*/
|
|
92
|
+
'generation:start': [config: Config];
|
|
93
|
+
/**
|
|
94
|
+
* Emitted when code generation phase completes.
|
|
95
|
+
*/
|
|
96
|
+
'generation:end': [Config: Config];
|
|
97
|
+
/**
|
|
98
|
+
* Emitted with a summary of the generation results.
|
|
99
|
+
* Contains summary lines, title, and success status.
|
|
100
|
+
*/
|
|
101
|
+
'generation:summary': [Config: Config, {
|
|
102
|
+
failedPlugins: Set<{
|
|
103
|
+
plugin: Plugin;
|
|
104
|
+
error: Error;
|
|
105
|
+
}>;
|
|
106
|
+
status: 'success' | 'failed';
|
|
107
|
+
hrStart: [number, number];
|
|
108
|
+
filesCreated: number;
|
|
109
|
+
pluginTimings?: Map<string, number>;
|
|
78
110
|
}];
|
|
79
|
-
|
|
80
|
-
|
|
111
|
+
/**
|
|
112
|
+
* Emitted when code formatting starts (e.g., running Biome or Prettier).
|
|
113
|
+
*/
|
|
114
|
+
'format:start': [];
|
|
115
|
+
/**
|
|
116
|
+
* Emitted when code formatting completes.
|
|
117
|
+
*/
|
|
118
|
+
'format:end': [];
|
|
119
|
+
/**
|
|
120
|
+
* Emitted when linting starts.
|
|
121
|
+
*/
|
|
122
|
+
'lint:start': [];
|
|
123
|
+
/**
|
|
124
|
+
* Emitted when linting completes.
|
|
125
|
+
*/
|
|
126
|
+
'lint:end': [];
|
|
127
|
+
/**
|
|
128
|
+
* Emitted when plugin hooks execution starts.
|
|
129
|
+
*/
|
|
130
|
+
'hooks:start': [];
|
|
131
|
+
/**
|
|
132
|
+
* Emitted when plugin hooks execution completes.
|
|
133
|
+
*/
|
|
134
|
+
'hooks:end': [];
|
|
135
|
+
/**
|
|
136
|
+
* Emitted when a single hook execution starts.
|
|
137
|
+
*/
|
|
138
|
+
'hook:start': [command: string];
|
|
139
|
+
/**
|
|
140
|
+
* Emitted to execute a hook command (e.g., format or lint).
|
|
141
|
+
* The callback should be invoked when the command completes.
|
|
142
|
+
*/
|
|
143
|
+
'hook:execute': [{
|
|
144
|
+
command: string | URL;
|
|
145
|
+
args?: readonly string[];
|
|
146
|
+
}, cb: () => void];
|
|
147
|
+
/**
|
|
148
|
+
* Emitted when a single hook execution completes.
|
|
149
|
+
*/
|
|
150
|
+
'hook:end': [command: string];
|
|
151
|
+
/**
|
|
152
|
+
* Emitted when a new version of Kubb is available.
|
|
153
|
+
*/
|
|
154
|
+
'version:new': [currentVersion: string, latestVersion: string];
|
|
155
|
+
/**
|
|
156
|
+
* Informational message event.
|
|
157
|
+
*/
|
|
158
|
+
info: [message: string, info?: string];
|
|
159
|
+
/**
|
|
160
|
+
* Error event. Emitted when an error occurs during code generation.
|
|
161
|
+
*/
|
|
162
|
+
error: [error: Error, meta?: Record<string, unknown>];
|
|
163
|
+
/**
|
|
164
|
+
* Success message event.
|
|
165
|
+
*/
|
|
166
|
+
success: [message: string, info?: string];
|
|
167
|
+
/**
|
|
168
|
+
* Warning message event.
|
|
169
|
+
*/
|
|
170
|
+
warn: [message: string, info?: string];
|
|
171
|
+
/**
|
|
172
|
+
* Debug event for detailed logging.
|
|
173
|
+
* Contains timestamp, log messages, and optional filename.
|
|
174
|
+
*/
|
|
175
|
+
debug: [meta: DebugEvent];
|
|
176
|
+
/**
|
|
177
|
+
* Emitted when file processing starts.
|
|
178
|
+
* Contains the list of files to be processed.
|
|
179
|
+
*/
|
|
180
|
+
'files:processing:start': [files: Array<KubbFile.ResolvedFile>];
|
|
181
|
+
/**
|
|
182
|
+
* Emitted for each file being processed, providing progress updates.
|
|
183
|
+
* Contains processed count, total count, percentage, and file details.
|
|
184
|
+
*/
|
|
185
|
+
'file:processing:update': [{
|
|
186
|
+
/** Number of files processed so far */
|
|
187
|
+
processed: number;
|
|
188
|
+
/** Total number of files to process */
|
|
189
|
+
total: number;
|
|
190
|
+
/** Processing percentage (0-100) */
|
|
191
|
+
percentage: number;
|
|
192
|
+
/** Optional source identifier */
|
|
193
|
+
source?: string;
|
|
194
|
+
/** The file being processed */
|
|
195
|
+
file: KubbFile.ResolvedFile;
|
|
196
|
+
/**
|
|
197
|
+
* Kubb configuration (not present in Fabric).
|
|
198
|
+
* Provides access to the current config during file processing.
|
|
199
|
+
*/
|
|
200
|
+
config: Config;
|
|
81
201
|
}];
|
|
82
|
-
};
|
|
83
|
-
type Logger = {
|
|
84
202
|
/**
|
|
85
|
-
*
|
|
203
|
+
* Emitted when file processing completes.
|
|
204
|
+
* Contains the list of processed files.
|
|
86
205
|
*/
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
206
|
+
'files:processing:end': [files: KubbFile.ResolvedFile[]];
|
|
207
|
+
/**
|
|
208
|
+
* Emitted when a plugin starts executing.
|
|
209
|
+
*/
|
|
210
|
+
'plugin:start': [plugin: Plugin];
|
|
211
|
+
/**
|
|
212
|
+
* Emitted when a plugin completes execution.
|
|
213
|
+
*/
|
|
214
|
+
'plugin:end': [plugin: Plugin, duration: number];
|
|
215
|
+
/**
|
|
216
|
+
* Emitted when plugin hook progress tracking starts.
|
|
217
|
+
* Contains the hook name and list of plugins to execute.
|
|
218
|
+
*/
|
|
219
|
+
'plugins:hook:progress:start': [meta: ProgressStartMeta];
|
|
220
|
+
/**
|
|
221
|
+
* Emitted when plugin hook progress tracking ends.
|
|
222
|
+
* Contains the hook name that completed.
|
|
223
|
+
*/
|
|
224
|
+
'plugins:hook:progress:end': [meta: ProgressStopMeta];
|
|
225
|
+
/**
|
|
226
|
+
* Emitted when a plugin hook starts processing.
|
|
227
|
+
* Contains strategy, hook name, plugin, parameters, and output.
|
|
228
|
+
*/
|
|
229
|
+
'plugins:hook:processing:start': [meta: ExecutingMeta];
|
|
230
|
+
/**
|
|
231
|
+
* Emitted when a plugin hook completes processing.
|
|
232
|
+
* Contains duration, strategy, hook name, plugin, parameters, and output.
|
|
233
|
+
*/
|
|
234
|
+
'plugins:hook:processing:end': [meta: ExecutedMeta];
|
|
235
|
+
}
|
|
236
|
+
//#endregion
|
|
237
|
+
//#region ../core/src/utils/AsyncEventEmitter.d.ts
|
|
238
|
+
declare class AsyncEventEmitter<TEvents extends Record<string, any>> {
|
|
239
|
+
#private;
|
|
240
|
+
constructor(maxListener?: number);
|
|
241
|
+
emit<TEventName extends keyof TEvents & string>(eventName: TEventName, ...eventArgs: TEvents[TEventName]): Promise<void>;
|
|
242
|
+
on<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
|
|
243
|
+
onOnce<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArgs: TEvents[TEventName]) => void): void;
|
|
244
|
+
off<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
|
|
245
|
+
removeAll(): void;
|
|
246
|
+
}
|
|
94
247
|
//#endregion
|
|
95
248
|
//#region ../core/src/utils/types.d.ts
|
|
96
249
|
type PossiblePromise<T> = Promise<T> | T;
|
|
@@ -354,7 +507,7 @@ type PluginContext<TOptions extends PluginFactoryOptions = PluginFactoryOptions>
|
|
|
354
507
|
* merging multiple sources into the same output file
|
|
355
508
|
*/
|
|
356
509
|
upsertFile: (...file: Array<KubbFile.File>) => Promise<void>;
|
|
357
|
-
|
|
510
|
+
events: AsyncEventEmitter<KubbEvents>;
|
|
358
511
|
mode: KubbFile.Mode;
|
|
359
512
|
/**
|
|
360
513
|
* Current plugin
|
|
@@ -400,35 +553,6 @@ type Group = {
|
|
|
400
553
|
//#region ../core/src/PluginManager.d.ts
|
|
401
554
|
type RequiredPluginLifecycle = Required<PluginLifecycle>;
|
|
402
555
|
type Strategy = 'hookFirst' | 'hookForPlugin' | 'hookParallel' | 'hookSeq';
|
|
403
|
-
type ExecutingMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
|
|
404
|
-
strategy: Strategy;
|
|
405
|
-
hookName: H;
|
|
406
|
-
plugin: Plugin;
|
|
407
|
-
parameters?: unknown[] | undefined;
|
|
408
|
-
output?: unknown;
|
|
409
|
-
};
|
|
410
|
-
type ExecutedMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
|
|
411
|
-
duration: number;
|
|
412
|
-
strategy: Strategy;
|
|
413
|
-
hookName: H;
|
|
414
|
-
plugin: Plugin;
|
|
415
|
-
parameters?: unknown[] | undefined;
|
|
416
|
-
output?: unknown;
|
|
417
|
-
};
|
|
418
|
-
type ErrorMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
|
|
419
|
-
hookName: H;
|
|
420
|
-
duration: number;
|
|
421
|
-
strategy: Strategy;
|
|
422
|
-
parameters?: unknown[] | undefined;
|
|
423
|
-
plugin: Plugin;
|
|
424
|
-
};
|
|
425
|
-
type ProgressStartMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
|
|
426
|
-
hookName: H;
|
|
427
|
-
plugins: Array<Plugin>;
|
|
428
|
-
};
|
|
429
|
-
type ProgressStopMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
|
|
430
|
-
hookName: H;
|
|
431
|
-
};
|
|
432
556
|
type ParseResult<H extends PluginLifecycleHooks> = RequiredPluginLifecycle[H];
|
|
433
557
|
type SafeParseResult<H extends PluginLifecycleHooks, Result = ReturnType<ParseResult<H>>> = {
|
|
434
558
|
result: Result;
|
|
@@ -436,19 +560,12 @@ type SafeParseResult<H extends PluginLifecycleHooks, Result = ReturnType<ParseRe
|
|
|
436
560
|
};
|
|
437
561
|
type Options$1 = {
|
|
438
562
|
fabric: Fabric;
|
|
439
|
-
|
|
563
|
+
events: AsyncEventEmitter<KubbEvents>;
|
|
440
564
|
/**
|
|
441
565
|
* @default Number.POSITIVE_INFINITY
|
|
442
566
|
*/
|
|
443
567
|
concurrency?: number;
|
|
444
568
|
};
|
|
445
|
-
type Events = {
|
|
446
|
-
progress_start: [meta: ProgressStartMeta];
|
|
447
|
-
progress_stop: [meta: ProgressStopMeta];
|
|
448
|
-
executing: [meta: ExecutingMeta];
|
|
449
|
-
executed: [meta: ExecutedMeta];
|
|
450
|
-
error: [error: Error, meta: ErrorMeta];
|
|
451
|
-
};
|
|
452
569
|
type GetFileProps<TOptions = object> = {
|
|
453
570
|
name: string;
|
|
454
571
|
mode?: KubbFile.Mode;
|
|
@@ -458,10 +575,10 @@ type GetFileProps<TOptions = object> = {
|
|
|
458
575
|
};
|
|
459
576
|
declare class PluginManager {
|
|
460
577
|
#private;
|
|
461
|
-
readonly events: EventEmitter<Events>;
|
|
462
578
|
readonly config: Config;
|
|
463
579
|
readonly options: Options$1;
|
|
464
580
|
constructor(config: Config, options: Options$1);
|
|
581
|
+
get events(): AsyncEventEmitter<KubbEvents>;
|
|
465
582
|
getContext<TOptions extends PluginFactoryOptions>(plugin: Plugin<TOptions>): PluginContext<TOptions> & Record<string, any>;
|
|
466
583
|
get plugins(): Array<Plugin>;
|
|
467
584
|
getFile<TOptions = object>({
|
|
@@ -475,10 +592,6 @@ declare class PluginManager {
|
|
|
475
592
|
}>;
|
|
476
593
|
resolvePath: <TOptions = object>(params: ResolvePathParams<TOptions>) => KubbFile.Path;
|
|
477
594
|
resolveName: (params: ResolveNameParams) => string;
|
|
478
|
-
/**
|
|
479
|
-
* Instead of calling `pluginManager.events.on` you can use `pluginManager.on`. This one also has better types.
|
|
480
|
-
*/
|
|
481
|
-
on<TEventName extends keyof Events & string>(eventName: TEventName, handler: (...eventArg: Events[TEventName]) => void): void;
|
|
482
595
|
/**
|
|
483
596
|
* Run a specific hookName for plugin x.
|
|
484
597
|
*/
|
|
@@ -876,5 +989,5 @@ type SchemaTree = {
|
|
|
876
989
|
};
|
|
877
990
|
declare function isKeyword<T extends Schema, K extends keyof SchemaKeywordMapper>(meta: T, keyword: K): meta is Extract<T, SchemaKeywordMapper[K]>;
|
|
878
991
|
//#endregion
|
|
879
|
-
export { Plugin as C,
|
|
880
|
-
//# sourceMappingURL=SchemaMapper-
|
|
992
|
+
export { Plugin as C, AsyncEventEmitter as D, UserPluginWithLifeCycle as E, KubbEvents as O, Output as S, ResolveNameParams as T, contentType as _, SchemaMapper as a, Config as b, schemaKeywords as c, HttpMethod as d, OasTypes as f, SchemaObject$1 as g, Operation$1 as h, SchemaKeywordMapper as i, BaseGenerator as k, isOptional as l, OpenAPIV3_1 as m, SchemaKeyword as n, SchemaTree as o, OpenAPIV3$1 as p, SchemaKeywordBase as r, isKeyword as s, Schema as t, Oas as u, FileMetaBase as v, PluginFactoryOptions as w, Group as x, PluginManager as y };
|
|
993
|
+
//# sourceMappingURL=SchemaMapper-DlcrPonN.d.ts.map
|
|
@@ -1,8 +1,40 @@
|
|
|
1
|
-
import { C as Plugin, D as
|
|
2
|
-
import { KubbFile } from "@kubb/fabric-core/types";
|
|
1
|
+
import { C as Plugin, D as AsyncEventEmitter, O as KubbEvents, S as Output, T as ResolveNameParams, _ as contentType, b as Config, d as HttpMethod, g as SchemaObject, h as Operation, i as SchemaKeywordMapper, k as BaseGenerator, t as Schema, u as Oas, v as FileMetaBase, w as PluginFactoryOptions, x as Group, y as PluginManager } from "./SchemaMapper-DlcrPonN.js";
|
|
3
2
|
import { Fabric } from "@kubb/react-fabric";
|
|
3
|
+
import { KubbFile } from "@kubb/fabric-core/types";
|
|
4
4
|
import { KubbNode } from "@kubb/react-fabric/types";
|
|
5
5
|
|
|
6
|
+
//#region ../core/src/utils/FunctionParams.d.ts
|
|
7
|
+
type FunctionParamsASTWithoutType = {
|
|
8
|
+
name?: string;
|
|
9
|
+
type?: string;
|
|
10
|
+
/**
|
|
11
|
+
* @default true
|
|
12
|
+
*/
|
|
13
|
+
required?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* @default true
|
|
16
|
+
*/
|
|
17
|
+
enabled?: boolean;
|
|
18
|
+
default?: string;
|
|
19
|
+
};
|
|
20
|
+
type FunctionParamsASTWithType = {
|
|
21
|
+
name?: never;
|
|
22
|
+
type: string;
|
|
23
|
+
/**
|
|
24
|
+
* @default true
|
|
25
|
+
*/
|
|
26
|
+
required?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* @default true
|
|
29
|
+
*/
|
|
30
|
+
enabled?: boolean;
|
|
31
|
+
default?: string;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* @deprecated
|
|
35
|
+
*/
|
|
36
|
+
type FunctionParamsAST = FunctionParamsASTWithoutType | FunctionParamsASTWithType;
|
|
37
|
+
//#endregion
|
|
6
38
|
//#region src/types.d.ts
|
|
7
39
|
type Context$2 = {
|
|
8
40
|
getOas(): Promise<Oas>;
|
|
@@ -170,7 +202,7 @@ type Context$1<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
|
170
202
|
override: Array<Override<TOptions>> | undefined;
|
|
171
203
|
contentType: contentType | undefined;
|
|
172
204
|
pluginManager: PluginManager;
|
|
173
|
-
|
|
205
|
+
events?: AsyncEventEmitter<KubbEvents>;
|
|
174
206
|
/**
|
|
175
207
|
* Current plugin
|
|
176
208
|
*/
|
|
@@ -199,7 +231,7 @@ type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
|
199
231
|
fabric: Fabric;
|
|
200
232
|
oas: Oas;
|
|
201
233
|
pluginManager: PluginManager;
|
|
202
|
-
|
|
234
|
+
events?: AsyncEventEmitter<KubbEvents>;
|
|
203
235
|
/**
|
|
204
236
|
* Current plugin
|
|
205
237
|
*/
|
|
@@ -317,5 +349,5 @@ type CoreGenerator<TOptions extends PluginFactoryOptions> = {
|
|
|
317
349
|
};
|
|
318
350
|
declare function createGenerator<TOptions extends PluginFactoryOptions>(generator: UserGenerator<TOptions>): CoreGenerator<TOptions>;
|
|
319
351
|
//#endregion
|
|
320
|
-
export { Resolver as C, ResolvePathOptions as S, Options as _, createReactGenerator as a, Ref as b, SchemaGeneratorBuildOptions as c, OperationGenerator as d, OperationMethodResult as f, OperationSchemas as g, OperationSchema as h, ReactGenerator as i, SchemaGeneratorOptions as l, Include as m, createGenerator as n, GetSchemaGeneratorOptions as o, Exclude as p, Generator as r, SchemaGenerator as s, CoreGenerator as t, SchemaMethodResult as u, Override as v, Refs as x, PluginOas as y };
|
|
321
|
-
//# sourceMappingURL=createGenerator-
|
|
352
|
+
export { Resolver as C, ResolvePathOptions as S, Options as _, createReactGenerator as a, Ref as b, SchemaGeneratorBuildOptions as c, OperationGenerator as d, OperationMethodResult as f, OperationSchemas as g, OperationSchema as h, ReactGenerator as i, SchemaGeneratorOptions as l, Include as m, createGenerator as n, GetSchemaGeneratorOptions as o, Exclude as p, Generator as r, SchemaGenerator as s, CoreGenerator as t, SchemaMethodResult as u, Override as v, FunctionParamsAST as w, Refs as x, PluginOas as y };
|
|
353
|
+
//# sourceMappingURL=createGenerator-B1p6Pl-d.d.ts.map
|
|
@@ -1,8 +1,40 @@
|
|
|
1
|
-
import { C as Plugin, D as
|
|
2
|
-
import { Fabric } from "@kubb/react-fabric";
|
|
1
|
+
import { C as Plugin, D as AsyncEventEmitter, O as KubbEvents, S as Output, T as ResolveNameParams, _ as contentType, b as Config, d as HttpMethod, g as SchemaObject, h as Operation, i as SchemaKeywordMapper, k as BaseGenerator, t as Schema, u as Oas, v as FileMetaBase, w as PluginFactoryOptions, x as Group, y as PluginManager } from "./SchemaMapper-Cjte6oBd.cjs";
|
|
3
2
|
import { KubbFile } from "@kubb/fabric-core/types";
|
|
3
|
+
import { Fabric } from "@kubb/react-fabric";
|
|
4
4
|
import { KubbNode } from "@kubb/react-fabric/types";
|
|
5
5
|
|
|
6
|
+
//#region ../core/src/utils/FunctionParams.d.ts
|
|
7
|
+
type FunctionParamsASTWithoutType = {
|
|
8
|
+
name?: string;
|
|
9
|
+
type?: string;
|
|
10
|
+
/**
|
|
11
|
+
* @default true
|
|
12
|
+
*/
|
|
13
|
+
required?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* @default true
|
|
16
|
+
*/
|
|
17
|
+
enabled?: boolean;
|
|
18
|
+
default?: string;
|
|
19
|
+
};
|
|
20
|
+
type FunctionParamsASTWithType = {
|
|
21
|
+
name?: never;
|
|
22
|
+
type: string;
|
|
23
|
+
/**
|
|
24
|
+
* @default true
|
|
25
|
+
*/
|
|
26
|
+
required?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* @default true
|
|
29
|
+
*/
|
|
30
|
+
enabled?: boolean;
|
|
31
|
+
default?: string;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* @deprecated
|
|
35
|
+
*/
|
|
36
|
+
type FunctionParamsAST = FunctionParamsASTWithoutType | FunctionParamsASTWithType;
|
|
37
|
+
//#endregion
|
|
6
38
|
//#region src/types.d.ts
|
|
7
39
|
type Context$2 = {
|
|
8
40
|
getOas(): Promise<Oas>;
|
|
@@ -170,7 +202,7 @@ type Context$1<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
|
170
202
|
override: Array<Override<TOptions>> | undefined;
|
|
171
203
|
contentType: contentType | undefined;
|
|
172
204
|
pluginManager: PluginManager;
|
|
173
|
-
|
|
205
|
+
events?: AsyncEventEmitter<KubbEvents>;
|
|
174
206
|
/**
|
|
175
207
|
* Current plugin
|
|
176
208
|
*/
|
|
@@ -199,7 +231,7 @@ type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
|
199
231
|
fabric: Fabric;
|
|
200
232
|
oas: Oas;
|
|
201
233
|
pluginManager: PluginManager;
|
|
202
|
-
|
|
234
|
+
events?: AsyncEventEmitter<KubbEvents>;
|
|
203
235
|
/**
|
|
204
236
|
* Current plugin
|
|
205
237
|
*/
|
|
@@ -317,5 +349,5 @@ type CoreGenerator<TOptions extends PluginFactoryOptions> = {
|
|
|
317
349
|
};
|
|
318
350
|
declare function createGenerator<TOptions extends PluginFactoryOptions>(generator: UserGenerator<TOptions>): CoreGenerator<TOptions>;
|
|
319
351
|
//#endregion
|
|
320
|
-
export { Resolver as C, ResolvePathOptions as S, Options as _, createReactGenerator as a, Ref as b, SchemaGeneratorBuildOptions as c, OperationGenerator as d, OperationMethodResult as f, OperationSchemas as g, OperationSchema as h, ReactGenerator as i, SchemaGeneratorOptions as l, Include as m, createGenerator as n, GetSchemaGeneratorOptions as o, Exclude as p, Generator as r, SchemaGenerator as s, CoreGenerator as t, SchemaMethodResult as u, Override as v, Refs as x, PluginOas as y };
|
|
321
|
-
//# sourceMappingURL=createGenerator-
|
|
352
|
+
export { Resolver as C, ResolvePathOptions as S, Options as _, createReactGenerator as a, Ref as b, SchemaGeneratorBuildOptions as c, OperationGenerator as d, OperationMethodResult as f, OperationSchemas as g, OperationSchema as h, ReactGenerator as i, SchemaGeneratorOptions as l, Include as m, createGenerator as n, GetSchemaGeneratorOptions as o, Exclude as p, Generator as r, SchemaGenerator as s, CoreGenerator as t, SchemaMethodResult as u, Override as v, FunctionParamsAST as w, Refs as x, PluginOas as y };
|
|
353
|
+
//# sourceMappingURL=createGenerator-DyVUP-Aj.d.cts.map
|
package/dist/generators.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./SchemaMapper-
|
|
2
|
-
import { a as createReactGenerator, n as createGenerator, r as Generator, t as CoreGenerator, y as PluginOas } from "./createGenerator-
|
|
1
|
+
import "./SchemaMapper-Cjte6oBd.cjs";
|
|
2
|
+
import { a as createReactGenerator, n as createGenerator, r as Generator, t as CoreGenerator, y as PluginOas } from "./createGenerator-DyVUP-Aj.cjs";
|
|
3
3
|
|
|
4
4
|
//#region src/generators/jsonGenerator.d.ts
|
|
5
5
|
declare const jsonGenerator: CoreGenerator<PluginOas>;
|
package/dist/generators.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./SchemaMapper-
|
|
2
|
-
import { a as createReactGenerator, n as createGenerator, r as Generator, t as CoreGenerator, y as PluginOas } from "./createGenerator-
|
|
1
|
+
import "./SchemaMapper-DlcrPonN.js";
|
|
2
|
+
import { a as createReactGenerator, n as createGenerator, r as Generator, t as CoreGenerator, y as PluginOas } from "./createGenerator-B1p6Pl-d.js";
|
|
3
3
|
|
|
4
4
|
//#region src/generators/jsonGenerator.d.ts
|
|
5
5
|
declare const jsonGenerator: CoreGenerator<PluginOas>;
|
package/dist/hooks.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-CbDLau6x.cjs');
|
|
2
|
-
const require_SchemaGenerator = require('./SchemaGenerator-
|
|
2
|
+
const require_SchemaGenerator = require('./SchemaGenerator-Dq-VUskF.cjs');
|
|
3
3
|
const require_SchemaMapper = require('./SchemaMapper-BN2pgCUs.cjs');
|
|
4
4
|
let __kubb_react_fabric = require("@kubb/react-fabric");
|
|
5
5
|
let __kubb_core_hooks = require("@kubb/core/hooks");
|
package/dist/hooks.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as Plugin, T as ResolveNameParams, h as Operation, t as Schema, u as Oas, v as FileMetaBase, w as PluginFactoryOptions } from "./SchemaMapper-
|
|
2
|
-
import { d as OperationGenerator, g as OperationSchemas } from "./createGenerator-
|
|
1
|
+
import { C as Plugin, T as ResolveNameParams, h as Operation, t as Schema, u as Oas, v as FileMetaBase, w as PluginFactoryOptions } from "./SchemaMapper-Cjte6oBd.cjs";
|
|
2
|
+
import { d as OperationGenerator, g as OperationSchemas } from "./createGenerator-DyVUP-Aj.cjs";
|
|
3
3
|
import { KubbFile } from "@kubb/fabric-core/types";
|
|
4
4
|
|
|
5
5
|
//#region src/hooks/useOas.d.ts
|
package/dist/hooks.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as Plugin, T as ResolveNameParams, h as Operation, t as Schema, u as Oas, v as FileMetaBase, w as PluginFactoryOptions } from "./SchemaMapper-
|
|
2
|
-
import { d as OperationGenerator, g as OperationSchemas } from "./createGenerator-
|
|
1
|
+
import { C as Plugin, T as ResolveNameParams, h as Operation, t as Schema, u as Oas, v as FileMetaBase, w as PluginFactoryOptions } from "./SchemaMapper-DlcrPonN.js";
|
|
2
|
+
import { d as OperationGenerator, g as OperationSchemas } from "./createGenerator-B1p6Pl-d.js";
|
|
3
3
|
import { KubbFile } from "@kubb/fabric-core/types";
|
|
4
4
|
|
|
5
5
|
//#region src/hooks/useOas.d.ts
|
package/dist/hooks.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as SchemaGenerator } from "./SchemaGenerator-
|
|
1
|
+
import { t as SchemaGenerator } from "./SchemaGenerator-EtUI1o9z.js";
|
|
2
2
|
import { n as schemaKeywords } from "./SchemaMapper-eCHsqfmg.js";
|
|
3
3
|
import { useApp } from "@kubb/react-fabric";
|
|
4
4
|
import { usePlugin, usePluginManager } from "@kubb/core/hooks";
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-CbDLau6x.cjs');
|
|
2
2
|
const require_generators = require('./generators--YV0NNUJ.cjs');
|
|
3
|
-
const require_SchemaGenerator = require('./SchemaGenerator-
|
|
3
|
+
const require_SchemaGenerator = require('./SchemaGenerator-Dq-VUskF.cjs');
|
|
4
4
|
const require_SchemaMapper = require('./SchemaMapper-BN2pgCUs.cjs');
|
|
5
5
|
let __kubb_core = require("@kubb/core");
|
|
6
6
|
let __kubb_core_transformers = require("@kubb/core/transformers");
|
|
@@ -213,9 +213,8 @@ var OperationGenerator = class extends __kubb_core.BaseGenerator {
|
|
|
213
213
|
const operations = await this.getOperations();
|
|
214
214
|
const generatorLimit = require_SchemaGenerator.pLimit(1);
|
|
215
215
|
const operationLimit = require_SchemaGenerator.pLimit(10);
|
|
216
|
-
this.context.
|
|
216
|
+
this.context.events?.emit("debug", {
|
|
217
217
|
date: /* @__PURE__ */ new Date(),
|
|
218
|
-
pluginName: this.context.plugin.name,
|
|
219
218
|
logs: [`Building ${operations.length} operations`, ` • Generators: ${generators.length}`]
|
|
220
219
|
});
|
|
221
220
|
const writeTasks = generators.map((generator) => generatorLimit(async () => {
|
|
@@ -345,7 +344,7 @@ const pluginOas = (0, __kubb_core.definePlugin)((options) => {
|
|
|
345
344
|
fabric: this.fabric,
|
|
346
345
|
oas,
|
|
347
346
|
pluginManager: this.pluginManager,
|
|
348
|
-
|
|
347
|
+
events: this.events,
|
|
349
348
|
plugin: this.plugin,
|
|
350
349
|
contentType,
|
|
351
350
|
include: void 0,
|
|
@@ -358,7 +357,7 @@ const pluginOas = (0, __kubb_core.definePlugin)((options) => {
|
|
|
358
357
|
fabric: this.fabric,
|
|
359
358
|
oas,
|
|
360
359
|
pluginManager: this.pluginManager,
|
|
361
|
-
|
|
360
|
+
events: this.events,
|
|
362
361
|
plugin: this.plugin,
|
|
363
362
|
contentType,
|
|
364
363
|
exclude: void 0,
|