@kubb/oas 4.11.1 → 4.11.3

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
@@ -52,13 +52,35 @@ type DebugEvent = {
52
52
  date: Date;
53
53
  logs: string[];
54
54
  fileName?: string;
55
+ /**
56
+ * Category of the debug log, used for GitHub Actions grouping
57
+ * - 'setup': Initial configuration and environment setup
58
+ * - 'plugin': Plugin installation and execution
59
+ * - 'hook': Plugin hook execution details
60
+ * - 'schema': Schema parsing and generation
61
+ * - 'file': File operations (read/write/generate)
62
+ * - 'error': Error details and stack traces
63
+ * - undefined: Generic logs (always inline)
64
+ */
65
+ category?: 'setup' | 'plugin' | 'hook' | 'schema' | 'file' | 'error';
66
+ /**
67
+ * Plugin name for grouping plugin-specific logs together
68
+ */
69
+ pluginName?: string;
70
+ /**
71
+ * Indicates if this is the start or end of a plugin's execution
72
+ * - 'start': Start of plugin execution group
73
+ * - 'end': End of plugin execution group
74
+ */
75
+ pluginGroupMarker?: 'start' | 'end';
55
76
  };
56
77
  type Events$1 = {
57
78
  start: [message: string];
58
79
  success: [message: string];
59
- error: [message: string, cause: Error];
80
+ error: [message: string, error: Error];
60
81
  warning: [message: string];
61
82
  debug: [DebugEvent];
83
+ verbose: [DebugEvent];
62
84
  info: [message: string];
63
85
  progress_start: [{
64
86
  id: string;
@@ -82,7 +104,7 @@ type Logger = {
82
104
  consola?: ConsolaInstance;
83
105
  on: EventEmitter<Events$1>['on'];
84
106
  emit: EventEmitter<Events$1>['emit'];
85
- writeLogs: () => Promise<string[]>;
107
+ writeLogs: () => Promise<void>;
86
108
  };
87
109
  //#endregion
88
110
  //#region ../core/src/utils/types.d.ts
@@ -335,14 +357,35 @@ type PluginContext<TOptions extends PluginFactoryOptions = PluginFactoryOptions>
335
357
  //#region ../core/src/PluginManager.d.ts
336
358
  type RequiredPluginLifecycle = Required<PluginLifecycle>;
337
359
  type Strategy = 'hookFirst' | 'hookForPlugin' | 'hookParallel' | 'hookSeq';
338
- type Executer<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
339
- message: string;
360
+ type ExecutingMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
340
361
  strategy: Strategy;
341
362
  hookName: H;
342
363
  plugin: Plugin;
343
364
  parameters?: unknown[] | undefined;
344
365
  output?: unknown;
345
366
  };
367
+ type ExecutedMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
368
+ duration: number;
369
+ strategy: Strategy;
370
+ hookName: H;
371
+ plugin: Plugin;
372
+ parameters?: unknown[] | undefined;
373
+ output?: unknown;
374
+ };
375
+ type ErrorMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
376
+ hookName: H;
377
+ duration: number;
378
+ strategy: Strategy;
379
+ parameters?: unknown[] | undefined;
380
+ plugin: Plugin;
381
+ };
382
+ type ProgressStartMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
383
+ hookName: H;
384
+ plugins: Array<Plugin>;
385
+ };
386
+ type ProgressStopMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
387
+ hookName: H;
388
+ };
346
389
  type ParseResult<H extends PluginLifecycleHooks> = RequiredPluginLifecycle[H];
347
390
  type SafeParseResult<H extends PluginLifecycleHooks, Result = ReturnType<ParseResult<H>>> = {
348
391
  result: Result;
@@ -357,9 +400,11 @@ type Options = {
357
400
  concurrency?: number;
358
401
  };
359
402
  type Events = {
360
- executing: [executer: Executer];
361
- executed: [executer: Executer];
362
- error: [error: Error];
403
+ progress_start: [meta: ProgressStartMeta];
404
+ progress_stop: [meta: ProgressStopMeta];
405
+ executing: [meta: ExecutingMeta];
406
+ executed: [meta: ExecutedMeta];
407
+ error: [error: Error, meta: ErrorMeta];
363
408
  };
364
409
  type GetFileProps<TOptions = object> = {
365
410
  name: string;
@@ -372,8 +417,6 @@ declare class PluginManager {
372
417
  #private;
373
418
  readonly events: EventEmitter<Events>;
374
419
  readonly config: Config;
375
- readonly executed: Array<Executer>;
376
- readonly logger: Logger;
377
420
  readonly options: Options;
378
421
  constructor(config: Config, options: Options);
379
422
  getContext<TOptions extends PluginFactoryOptions>(plugin: Plugin<TOptions>): PluginContext<TOptions> & Record<string, any>;
@@ -399,13 +442,11 @@ declare class PluginManager {
399
442
  hookForPlugin<H extends PluginLifecycleHooks>({
400
443
  pluginKey,
401
444
  hookName,
402
- parameters,
403
- message
445
+ parameters
404
446
  }: {
405
447
  pluginKey: Plugin['key'];
406
448
  hookName: H;
407
449
  parameters: PluginParameter<H>;
408
- message: string;
409
450
  }): Promise<Array<ReturnType<ParseResult<H>> | null>>;
410
451
  /**
411
452
  * Run a specific hookName for plugin x.
@@ -413,13 +454,11 @@ declare class PluginManager {
413
454
  hookForPluginSync<H extends PluginLifecycleHooks>({
414
455
  pluginKey,
415
456
  hookName,
416
- parameters,
417
- message
457
+ parameters
418
458
  }: {
419
459
  pluginKey: Plugin['key'];
420
460
  hookName: H;
421
461
  parameters: PluginParameter<H>;
422
- message: string;
423
462
  }): Array<ReturnType<ParseResult<H>>> | null;
424
463
  /**
425
464
  * First non-null result stops and will return it's value.
@@ -427,13 +466,11 @@ declare class PluginManager {
427
466
  hookFirst<H extends PluginLifecycleHooks>({
428
467
  hookName,
429
468
  parameters,
430
- skipped,
431
- message
469
+ skipped
432
470
  }: {
433
471
  hookName: H;
434
472
  parameters: PluginParameter<H>;
435
473
  skipped?: ReadonlySet<Plugin> | null;
436
- message: string;
437
474
  }): Promise<SafeParseResult<H>>;
438
475
  /**
439
476
  * First non-null result stops and will return it's value.
@@ -441,37 +478,31 @@ declare class PluginManager {
441
478
  hookFirstSync<H extends PluginLifecycleHooks>({
442
479
  hookName,
443
480
  parameters,
444
- skipped,
445
- message
481
+ skipped
446
482
  }: {
447
483
  hookName: H;
448
484
  parameters: PluginParameter<H>;
449
485
  skipped?: ReadonlySet<Plugin> | null;
450
- message: string;
451
486
  }): SafeParseResult<H>;
452
487
  /**
453
488
  * Run all plugins in parallel(order will be based on `this.plugin` and if `pre` or `post` is set).
454
489
  */
455
490
  hookParallel<H extends PluginLifecycleHooks, TOuput = void>({
456
491
  hookName,
457
- parameters,
458
- message
492
+ parameters
459
493
  }: {
460
494
  hookName: H;
461
495
  parameters?: Parameters<RequiredPluginLifecycle[H]> | undefined;
462
- message: string;
463
496
  }): Promise<Awaited<TOuput>[]>;
464
497
  /**
465
498
  * Chains plugins
466
499
  */
467
500
  hookSeq<H extends PluginLifecycleHooks>({
468
501
  hookName,
469
- parameters,
470
- message
502
+ parameters
471
503
  }: {
472
504
  hookName: H;
473
505
  parameters?: PluginParameter<H>;
474
- message: string;
475
506
  }): Promise<void>;
476
507
  getPluginByKey(pluginKey: Plugin['key']): Plugin | undefined;
477
508
  getPluginsByKey(hookName: keyof PluginWithLifeCycle, pluginKey: Plugin['key']): Plugin[];
package/dist/index.d.ts CHANGED
@@ -52,13 +52,35 @@ type DebugEvent = {
52
52
  date: Date;
53
53
  logs: string[];
54
54
  fileName?: string;
55
+ /**
56
+ * Category of the debug log, used for GitHub Actions grouping
57
+ * - 'setup': Initial configuration and environment setup
58
+ * - 'plugin': Plugin installation and execution
59
+ * - 'hook': Plugin hook execution details
60
+ * - 'schema': Schema parsing and generation
61
+ * - 'file': File operations (read/write/generate)
62
+ * - 'error': Error details and stack traces
63
+ * - undefined: Generic logs (always inline)
64
+ */
65
+ category?: 'setup' | 'plugin' | 'hook' | 'schema' | 'file' | 'error';
66
+ /**
67
+ * Plugin name for grouping plugin-specific logs together
68
+ */
69
+ pluginName?: string;
70
+ /**
71
+ * Indicates if this is the start or end of a plugin's execution
72
+ * - 'start': Start of plugin execution group
73
+ * - 'end': End of plugin execution group
74
+ */
75
+ pluginGroupMarker?: 'start' | 'end';
55
76
  };
56
77
  type Events$1 = {
57
78
  start: [message: string];
58
79
  success: [message: string];
59
- error: [message: string, cause: Error];
80
+ error: [message: string, error: Error];
60
81
  warning: [message: string];
61
82
  debug: [DebugEvent];
83
+ verbose: [DebugEvent];
62
84
  info: [message: string];
63
85
  progress_start: [{
64
86
  id: string;
@@ -82,7 +104,7 @@ type Logger = {
82
104
  consola?: ConsolaInstance;
83
105
  on: EventEmitter<Events$1>['on'];
84
106
  emit: EventEmitter<Events$1>['emit'];
85
- writeLogs: () => Promise<string[]>;
107
+ writeLogs: () => Promise<void>;
86
108
  };
87
109
  //#endregion
88
110
  //#region ../core/src/utils/types.d.ts
@@ -335,14 +357,35 @@ type PluginContext<TOptions extends PluginFactoryOptions = PluginFactoryOptions>
335
357
  //#region ../core/src/PluginManager.d.ts
336
358
  type RequiredPluginLifecycle = Required<PluginLifecycle>;
337
359
  type Strategy = 'hookFirst' | 'hookForPlugin' | 'hookParallel' | 'hookSeq';
338
- type Executer<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
339
- message: string;
360
+ type ExecutingMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
340
361
  strategy: Strategy;
341
362
  hookName: H;
342
363
  plugin: Plugin;
343
364
  parameters?: unknown[] | undefined;
344
365
  output?: unknown;
345
366
  };
367
+ type ExecutedMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
368
+ duration: number;
369
+ strategy: Strategy;
370
+ hookName: H;
371
+ plugin: Plugin;
372
+ parameters?: unknown[] | undefined;
373
+ output?: unknown;
374
+ };
375
+ type ErrorMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
376
+ hookName: H;
377
+ duration: number;
378
+ strategy: Strategy;
379
+ parameters?: unknown[] | undefined;
380
+ plugin: Plugin;
381
+ };
382
+ type ProgressStartMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
383
+ hookName: H;
384
+ plugins: Array<Plugin>;
385
+ };
386
+ type ProgressStopMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
387
+ hookName: H;
388
+ };
346
389
  type ParseResult<H extends PluginLifecycleHooks> = RequiredPluginLifecycle[H];
347
390
  type SafeParseResult<H extends PluginLifecycleHooks, Result = ReturnType<ParseResult<H>>> = {
348
391
  result: Result;
@@ -357,9 +400,11 @@ type Options = {
357
400
  concurrency?: number;
358
401
  };
359
402
  type Events = {
360
- executing: [executer: Executer];
361
- executed: [executer: Executer];
362
- error: [error: Error];
403
+ progress_start: [meta: ProgressStartMeta];
404
+ progress_stop: [meta: ProgressStopMeta];
405
+ executing: [meta: ExecutingMeta];
406
+ executed: [meta: ExecutedMeta];
407
+ error: [error: Error, meta: ErrorMeta];
363
408
  };
364
409
  type GetFileProps<TOptions = object> = {
365
410
  name: string;
@@ -372,8 +417,6 @@ declare class PluginManager {
372
417
  #private;
373
418
  readonly events: EventEmitter<Events>;
374
419
  readonly config: Config;
375
- readonly executed: Array<Executer>;
376
- readonly logger: Logger;
377
420
  readonly options: Options;
378
421
  constructor(config: Config, options: Options);
379
422
  getContext<TOptions extends PluginFactoryOptions>(plugin: Plugin<TOptions>): PluginContext<TOptions> & Record<string, any>;
@@ -399,13 +442,11 @@ declare class PluginManager {
399
442
  hookForPlugin<H extends PluginLifecycleHooks>({
400
443
  pluginKey,
401
444
  hookName,
402
- parameters,
403
- message
445
+ parameters
404
446
  }: {
405
447
  pluginKey: Plugin['key'];
406
448
  hookName: H;
407
449
  parameters: PluginParameter<H>;
408
- message: string;
409
450
  }): Promise<Array<ReturnType<ParseResult<H>> | null>>;
410
451
  /**
411
452
  * Run a specific hookName for plugin x.
@@ -413,13 +454,11 @@ declare class PluginManager {
413
454
  hookForPluginSync<H extends PluginLifecycleHooks>({
414
455
  pluginKey,
415
456
  hookName,
416
- parameters,
417
- message
457
+ parameters
418
458
  }: {
419
459
  pluginKey: Plugin['key'];
420
460
  hookName: H;
421
461
  parameters: PluginParameter<H>;
422
- message: string;
423
462
  }): Array<ReturnType<ParseResult<H>>> | null;
424
463
  /**
425
464
  * First non-null result stops and will return it's value.
@@ -427,13 +466,11 @@ declare class PluginManager {
427
466
  hookFirst<H extends PluginLifecycleHooks>({
428
467
  hookName,
429
468
  parameters,
430
- skipped,
431
- message
469
+ skipped
432
470
  }: {
433
471
  hookName: H;
434
472
  parameters: PluginParameter<H>;
435
473
  skipped?: ReadonlySet<Plugin> | null;
436
- message: string;
437
474
  }): Promise<SafeParseResult<H>>;
438
475
  /**
439
476
  * First non-null result stops and will return it's value.
@@ -441,37 +478,31 @@ declare class PluginManager {
441
478
  hookFirstSync<H extends PluginLifecycleHooks>({
442
479
  hookName,
443
480
  parameters,
444
- skipped,
445
- message
481
+ skipped
446
482
  }: {
447
483
  hookName: H;
448
484
  parameters: PluginParameter<H>;
449
485
  skipped?: ReadonlySet<Plugin> | null;
450
- message: string;
451
486
  }): SafeParseResult<H>;
452
487
  /**
453
488
  * Run all plugins in parallel(order will be based on `this.plugin` and if `pre` or `post` is set).
454
489
  */
455
490
  hookParallel<H extends PluginLifecycleHooks, TOuput = void>({
456
491
  hookName,
457
- parameters,
458
- message
492
+ parameters
459
493
  }: {
460
494
  hookName: H;
461
495
  parameters?: Parameters<RequiredPluginLifecycle[H]> | undefined;
462
- message: string;
463
496
  }): Promise<Awaited<TOuput>[]>;
464
497
  /**
465
498
  * Chains plugins
466
499
  */
467
500
  hookSeq<H extends PluginLifecycleHooks>({
468
501
  hookName,
469
- parameters,
470
- message
502
+ parameters
471
503
  }: {
472
504
  hookName: H;
473
505
  parameters?: PluginParameter<H>;
474
- message: string;
475
506
  }): Promise<void>;
476
507
  getPluginByKey(pluginKey: Plugin['key']): Plugin | undefined;
477
508
  getPluginsByKey(hookName: keyof PluginWithLifeCycle, pluginKey: Plugin['key']): Plugin[];
package/dist/index.js CHANGED
@@ -4356,7 +4356,11 @@ async function parse(pathOrApi, { oasClass = Oas, canBundle = true, enablePaths
4356
4356
  ref: pathOrApi,
4357
4357
  config: await loadConfig(),
4358
4358
  base: pathOrApi
4359
- })).bundle.parsed);
4359
+ })).bundle.parsed, {
4360
+ oasClass,
4361
+ canBundle,
4362
+ enablePaths
4363
+ });
4360
4364
  const document = await new OASNormalize(pathOrApi, {
4361
4365
  enablePaths,
4362
4366
  colorizeErrors: true