@kubb/plugin-msw 4.18.4 → 4.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { h as Operation, v as __name } from "./index-B4aM7eWh.cjs";
1
+ import { h as Operation, v as __name } from "./index-B4gKt7dm.cjs";
2
2
  import { KubbNode } from "@kubb/react-fabric/types";
3
3
 
4
4
  //#region src/components/Handlers.d.ts
@@ -1,5 +1,5 @@
1
1
  import { t as __name } from "./chunk-eQyhnF5A.js";
2
- import { h as Operation } from "./index-BabbvEEy.js";
2
+ import { h as Operation } from "./index-Cdqo2P0B.js";
3
3
  import { KubbNode } from "@kubb/react-fabric/types";
4
4
 
5
5
  //#region src/components/Handlers.d.ts
@@ -1,5 +1,5 @@
1
- import { v as __name } from "./index-B4aM7eWh.cjs";
2
- import { n as PluginMsw, r as ReactGenerator } from "./types-CE70FwIb.cjs";
1
+ import { v as __name } from "./index-B4gKt7dm.cjs";
2
+ import { n as PluginMsw, r as ReactGenerator } from "./types-BKj4cTq4.cjs";
3
3
 
4
4
  //#region src/generators/handlersGenerator.d.ts
5
5
  declare const handlersGenerator: ReactGenerator<PluginMsw>;
@@ -1,6 +1,6 @@
1
1
  import { t as __name } from "./chunk-eQyhnF5A.js";
2
- import "./index-BabbvEEy.js";
3
- import { n as PluginMsw, r as ReactGenerator } from "./types-DCYFEk92.js";
2
+ import "./index-Cdqo2P0B.js";
3
+ import { n as PluginMsw, r as ReactGenerator } from "./types-DlVj7qjw.js";
4
4
 
5
5
  //#region src/generators/handlersGenerator.d.ts
6
6
  declare const handlersGenerator: ReactGenerator<PluginMsw>;
@@ -19,16 +19,21 @@ type Operation$1 = Operation;
19
19
  type DiscriminatorObject$1 = DiscriminatorObject;
20
20
  //#endregion
21
21
  //#region ../oas/src/Oas.d.ts
22
- type Options$1 = {
22
+ type OasOptions = {
23
23
  contentType?: contentType;
24
24
  discriminator?: 'strict' | 'inherit';
25
+ /**
26
+ * Resolve name collisions when schemas from different components share the same name (case-insensitive).
27
+ * @default false
28
+ */
29
+ collisionDetection?: boolean;
25
30
  };
26
31
  declare class Oas extends BaseOas {
27
32
  #private;
28
33
  document: Document;
29
34
  constructor(document: Document);
30
- setOptions(options: Options$1): void;
31
- get options(): Options$1;
35
+ setOptions(options: OasOptions): void;
36
+ get options(): OasOptions;
32
37
  get<T = unknown>($ref: string): T | null;
33
38
  getKey($ref: string): string | undefined;
34
39
  set($ref: string, value: unknown): false | undefined;
@@ -37,8 +42,20 @@ declare class Oas extends BaseOas {
37
42
  getResponseSchema(operation: Operation$1, statusCode: string | number): SchemaObject$1;
38
43
  getRequestSchema(operation: Operation$1): SchemaObject$1 | undefined;
39
44
  getParametersSchema(operation: Operation$1, inKey: 'path' | 'query' | 'header'): SchemaObject$1 | null;
40
- valdiate(): Promise<oas_normalize_lib_types0.ValidationResult>;
45
+ validate(): Promise<oas_normalize_lib_types0.ValidationResult>;
41
46
  flattenSchema(schema: SchemaObject$1 | null): SchemaObject$1 | null;
47
+ /**
48
+ * Get schemas from OpenAPI components (schemas, responses, requestBodies).
49
+ * Returns schemas in dependency order along with name mapping for collision resolution.
50
+ */
51
+ getSchemas(options?: {
52
+ contentType?: contentType;
53
+ includes?: Array<'schemas' | 'responses' | 'requestBodies'>;
54
+ collisionDetection?: boolean;
55
+ }): {
56
+ schemas: Record<string, SchemaObject$1>;
57
+ nameMapping: Map<string, string>;
58
+ };
42
59
  }
43
60
  //#endregion
44
61
  //#region ../core/src/BaseGenerator.d.ts
@@ -339,7 +356,7 @@ type Config<TInput = Input> = {
339
356
  input: TInput;
340
357
  output: {
341
358
  /**
342
- * The path where all generated files will be exported.
359
+ * The path where all generated files receives exported.
343
360
  * This can be an absolute path or a path relative to the specified root option.
344
361
  */
345
362
  path: string;
@@ -354,41 +371,39 @@ type Config<TInput = Input> = {
354
371
  write?: boolean;
355
372
  /**
356
373
  * Specifies the formatting tool to be used.
357
- * @default prettier
358
- *
359
- * Possible values:
360
- * - 'auto': Automatically detects and uses biome or prettier (in that order of preference).
361
- * - 'prettier': Uses Prettier for code formatting.
362
- * - 'biome': Uses Biome for code formatting.
363
- *
374
+ * - 'auto' automatically detects and uses biome or prettier (in that order of preference).
375
+ * - 'prettier' uses Prettier for code formatting.
376
+ * - 'biome' uses Biome for code formatting.
377
+ * - 'oxfmt' uses Oxfmt for code formatting.
378
+ * - false disables code formatting.
379
+ * @default 'prettier'
364
380
  */
365
381
  format?: 'auto' | 'prettier' | 'biome' | 'oxfmt' | false;
366
382
  /**
367
383
  * Specifies the linter that should be used to analyze the code.
368
- * The accepted values indicate different linting tools.
369
- *
370
- * Possible values:
371
- * - 'auto': Automatically detects and uses biome, oxlint, or eslint (in that order of preference).
372
- * - 'eslint': Represents the use of ESLint, a widely used JavaScript linter.
373
- * - 'biome': Represents the Biome linter, a modern tool for code scanning.
374
- * - 'oxlint': Represents the Oxlint tool for linting purposes.
375
- *
384
+ * - 'auto' automatically detects and uses biome, oxlint, or eslint (in that order of preference).
385
+ * - 'eslint' uses ESLint for linting.
386
+ * - 'biome' uses Biome for linting.
387
+ * - 'oxlint' uses Oxlint for linting.
388
+ * - false disables linting.
389
+ * @default 'auto'
376
390
  */
377
391
  lint?: 'auto' | 'eslint' | 'biome' | 'oxlint' | false;
378
392
  /**
379
- * Override the extension to the generated imports and exports, by default each plugin will add an extension
393
+ * Overrides the extension for generated imports and exports. By default, each plugin adds an extension.
380
394
  * @default { '.ts': '.ts'}
381
395
  */
382
396
  extension?: Record<KubbFile.Extname, KubbFile.Extname | ''>;
383
397
  /**
384
- * Specify how `index.ts` files should be created. You can also disable the generation of barrel files here. While each plugin has its own `barrelType` option, this setting controls the creation of the root barrel file, such as` src/gen/index.ts`.
398
+ * Configures how `index.ts` files are created, including disabling barrel file generation. Each plugin has its own `barrelType` option; this setting controls the root barrel file (e.g., `src/gen/index.ts`).
385
399
  * @default 'named'
386
400
  */
387
401
  barrelType?: Exclude<BarrelType, 'propagate'> | false;
388
402
  /**
389
- * Add a default banner to the beginning of every generated file. This makes it clear that the file was generated by Kubb.
390
- * - 'simple': will only add banner with link to Kubb
391
- * - 'full': will add source, title, description and the OpenAPI version used
403
+ * Adds a default banner to the start of every generated file indicating it was generated by Kubb.
404
+ * - 'simple' adds banner with link to Kubb.
405
+ * - 'full' adds source, title, description, and OpenAPI version.
406
+ * - false disables banner generation.
392
407
  * @default 'simple'
393
408
  */
394
409
  defaultBanner?: 'simple' | 'full' | false;
@@ -401,17 +416,17 @@ type Config<TInput = Input> = {
401
416
  override?: boolean;
402
417
  };
403
418
  /**
404
- * An array of Kubb plugins that will be used in the generation.
419
+ * An array of Kubb plugins that used in the generation.
405
420
  * Each plugin may include additional configurable options(defined in the plugin itself).
406
- * If a plugin depends on another plugin, an error will be returned if the required dependency is missing. See pre for more details.
421
+ * If a plugin depends on another plugin, an error is returned if the required dependency is missing. See pre for more details.
407
422
  */
408
423
  plugins?: Array<Plugin>;
409
424
  /**
410
- * Hooks that will be called when a specific action is triggered in Kubb.
425
+ * Hooks triggered when a specific action occurs in Kubb.
411
426
  */
412
427
  hooks?: {
413
428
  /**
414
- * Hook that will be triggered at the end of all executions.
429
+ * Hook that triggers at the end of all executions.
415
430
  * Useful for running Prettier or ESLint to format/lint your code.
416
431
  */
417
432
  done?: string | Array<string>;
@@ -440,7 +455,7 @@ TContext = any,
440
455
  TResolvePathOptions extends object = object> = {
441
456
  name: TName;
442
457
  /**
443
- * Same behaviour like what has been done with `QueryKey` in `@tanstack/react-query`
458
+ * Same behavior like what has been done with `QueryKey` in `@tanstack/react-query`
444
459
  */
445
460
  key: PluginKey<TName | string>;
446
461
  options: TOptions;
@@ -461,12 +476,12 @@ type UserPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> =
461
476
  */
462
477
  options: TOptions['resolvedOptions'];
463
478
  /**
464
- * Specifies the preceding plugins for the current plugin. You can pass an array of preceding plugin names, and the current plugin will be executed after these plugins.
479
+ * Specifies the preceding plugins for the current plugin. You can pass an array of preceding plugin names, and the current plugin is executed after these plugins.
465
480
  * Can be used to validate dependent plugins.
466
481
  */
467
482
  pre?: Array<string>;
468
483
  /**
469
- * Specifies the succeeding plugins for the current plugin. You can pass an array of succeeding plugin names, and the current plugin will be executed before these plugins.
484
+ * Specifies the succeeding plugins for the current plugin. You can pass an array of succeeding plugin names, and the current plugin is executed before these plugins.
470
485
  */
471
486
  post?: Array<string>;
472
487
  inject?: (this: PluginContext<TOptions>, context: PluginContext<TOptions>) => TOptions['context'];
@@ -484,12 +499,12 @@ type Plugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
484
499
  */
485
500
  key: TOptions['key'];
486
501
  /**
487
- * Specifies the preceding plugins for the current plugin. You can pass an array of preceding plugin names, and the current plugin will be executed after these plugins.
502
+ * Specifies the preceding plugins for the current plugin. You can pass an array of preceding plugin names, and the current plugin is executed after these plugins.
488
503
  * Can be used to validate dependent plugins.
489
504
  */
490
505
  pre?: Array<string>;
491
506
  /**
492
- * Specifies the succeeding plugins for the current plugin. You can pass an array of succeeding plugin names, and the current plugin will be executed before these plugins.
507
+ * Specifies the succeeding plugins for the current plugin. You can pass an array of succeeding plugin names, and the current plugin is executed before these plugins.
493
508
  */
494
509
  post?: Array<string>;
495
510
  /**
@@ -539,10 +554,12 @@ type ResolveNameParams = {
539
554
  name: string;
540
555
  pluginKey?: Plugin['key'];
541
556
  /**
542
- * `file` will be used to customize the name of the created file(use of camelCase)
543
- * `function` can be used to customize the exported functions(use of camelCase)
544
- * `type` is a special type for TypeScript(use of PascalCase)
545
- * `const` can be used for variables(use of camelCase)
557
+ * Specifies the type of entity being named.
558
+ * - 'file' customizes the name of the created file (uses camelCase).
559
+ * - 'function' customizes the exported function names (uses camelCase).
560
+ * - 'type' customizes TypeScript types (uses PascalCase).
561
+ * - 'const' customizes variable names (uses camelCase).
562
+ * @default undefined
546
563
  */
547
564
  type?: 'file' | 'function' | 'type' | 'const';
548
565
  };
@@ -597,11 +614,14 @@ type GroupContext = {
597
614
  };
598
615
  type Group = {
599
616
  /**
600
- * Define a type where to group the files on
617
+ * Defines the type where to group the files.
618
+ * - 'tag' groups files by OpenAPI tags.
619
+ * - 'path' groups files by OpenAPI paths.
620
+ * @default undefined
601
621
  */
602
622
  type: 'tag' | 'path';
603
623
  /**
604
- * Return the name of a group based on the group name, this will be used for the file and name generation
624
+ * Return the name of a group based on the group name, this used for the file and name generation
605
625
  */
606
626
  name?: (context: GroupContext) => string;
607
627
  };
@@ -673,7 +693,7 @@ declare class PluginManager {
673
693
  parameters: PluginParameter<H>;
674
694
  }): Array<ReturnType<ParseResult<H>>> | null;
675
695
  /**
676
- * First non-null result stops and will return it's value.
696
+ * Returns the first non-null result.
677
697
  */
678
698
  hookFirst<H extends PluginLifecycleHooks>({
679
699
  hookName,
@@ -685,7 +705,7 @@ declare class PluginManager {
685
705
  skipped?: ReadonlySet<Plugin> | null;
686
706
  }): Promise<SafeParseResult<H>>;
687
707
  /**
688
- * First non-null result stops and will return it's value.
708
+ * Returns the first non-null result.
689
709
  */
690
710
  hookFirstSync<H extends PluginLifecycleHooks>({
691
711
  hookName,
@@ -697,15 +717,15 @@ declare class PluginManager {
697
717
  skipped?: ReadonlySet<Plugin> | null;
698
718
  }): SafeParseResult<H>;
699
719
  /**
700
- * Run all plugins in parallel(order will be based on `this.plugin` and if `pre` or `post` is set).
720
+ * Runs all plugins in parallel based on `this.plugin` order and `pre`/`post` settings.
701
721
  */
702
- hookParallel<H extends PluginLifecycleHooks, TOuput = void>({
722
+ hookParallel<H extends PluginLifecycleHooks, TOutput = void>({
703
723
  hookName,
704
724
  parameters
705
725
  }: {
706
726
  hookName: H;
707
727
  parameters?: Parameters<RequiredPluginLifecycle[H]> | undefined;
708
- }): Promise<Awaited<TOuput>[]>;
728
+ }): Promise<Awaited<TOutput>[]>;
709
729
  /**
710
730
  * Chains plugins
711
731
  */
@@ -726,4 +746,4 @@ type FileMetaBase = {
726
746
  };
727
747
  //#endregion
728
748
  export { contentType as _, Output as a, ResolveNameParams as c, KubbEvents as d, BaseGenerator as f, SchemaObject$1 as g, Operation$1 as h, Group as i, UserPluginWithLifeCycle as l, HttpMethod as m, PluginManager as n, Plugin as o, Oas as p, Config as r, PluginFactoryOptions as s, FileMetaBase as t, AsyncEventEmitter as u, __name as v };
729
- //# sourceMappingURL=index-B4aM7eWh.d.cts.map
749
+ //# sourceMappingURL=index-B4gKt7dm.d.cts.map
@@ -18,16 +18,21 @@ type Operation$1 = Operation;
18
18
  type DiscriminatorObject$1 = DiscriminatorObject;
19
19
  //#endregion
20
20
  //#region ../oas/src/Oas.d.ts
21
- type Options$1 = {
21
+ type OasOptions = {
22
22
  contentType?: contentType;
23
23
  discriminator?: 'strict' | 'inherit';
24
+ /**
25
+ * Resolve name collisions when schemas from different components share the same name (case-insensitive).
26
+ * @default false
27
+ */
28
+ collisionDetection?: boolean;
24
29
  };
25
30
  declare class Oas extends BaseOas {
26
31
  #private;
27
32
  document: Document;
28
33
  constructor(document: Document);
29
- setOptions(options: Options$1): void;
30
- get options(): Options$1;
34
+ setOptions(options: OasOptions): void;
35
+ get options(): OasOptions;
31
36
  get<T = unknown>($ref: string): T | null;
32
37
  getKey($ref: string): string | undefined;
33
38
  set($ref: string, value: unknown): false | undefined;
@@ -36,8 +41,20 @@ declare class Oas extends BaseOas {
36
41
  getResponseSchema(operation: Operation$1, statusCode: string | number): SchemaObject$1;
37
42
  getRequestSchema(operation: Operation$1): SchemaObject$1 | undefined;
38
43
  getParametersSchema(operation: Operation$1, inKey: 'path' | 'query' | 'header'): SchemaObject$1 | null;
39
- valdiate(): Promise<oas_normalize_lib_types0.ValidationResult>;
44
+ validate(): Promise<oas_normalize_lib_types0.ValidationResult>;
40
45
  flattenSchema(schema: SchemaObject$1 | null): SchemaObject$1 | null;
46
+ /**
47
+ * Get schemas from OpenAPI components (schemas, responses, requestBodies).
48
+ * Returns schemas in dependency order along with name mapping for collision resolution.
49
+ */
50
+ getSchemas(options?: {
51
+ contentType?: contentType;
52
+ includes?: Array<'schemas' | 'responses' | 'requestBodies'>;
53
+ collisionDetection?: boolean;
54
+ }): {
55
+ schemas: Record<string, SchemaObject$1>;
56
+ nameMapping: Map<string, string>;
57
+ };
41
58
  }
42
59
  //#endregion
43
60
  //#region ../core/src/BaseGenerator.d.ts
@@ -338,7 +355,7 @@ type Config<TInput = Input> = {
338
355
  input: TInput;
339
356
  output: {
340
357
  /**
341
- * The path where all generated files will be exported.
358
+ * The path where all generated files receives exported.
342
359
  * This can be an absolute path or a path relative to the specified root option.
343
360
  */
344
361
  path: string;
@@ -353,41 +370,39 @@ type Config<TInput = Input> = {
353
370
  write?: boolean;
354
371
  /**
355
372
  * Specifies the formatting tool to be used.
356
- * @default prettier
357
- *
358
- * Possible values:
359
- * - 'auto': Automatically detects and uses biome or prettier (in that order of preference).
360
- * - 'prettier': Uses Prettier for code formatting.
361
- * - 'biome': Uses Biome for code formatting.
362
- *
373
+ * - 'auto' automatically detects and uses biome or prettier (in that order of preference).
374
+ * - 'prettier' uses Prettier for code formatting.
375
+ * - 'biome' uses Biome for code formatting.
376
+ * - 'oxfmt' uses Oxfmt for code formatting.
377
+ * - false disables code formatting.
378
+ * @default 'prettier'
363
379
  */
364
380
  format?: 'auto' | 'prettier' | 'biome' | 'oxfmt' | false;
365
381
  /**
366
382
  * Specifies the linter that should be used to analyze the code.
367
- * The accepted values indicate different linting tools.
368
- *
369
- * Possible values:
370
- * - 'auto': Automatically detects and uses biome, oxlint, or eslint (in that order of preference).
371
- * - 'eslint': Represents the use of ESLint, a widely used JavaScript linter.
372
- * - 'biome': Represents the Biome linter, a modern tool for code scanning.
373
- * - 'oxlint': Represents the Oxlint tool for linting purposes.
374
- *
383
+ * - 'auto' automatically detects and uses biome, oxlint, or eslint (in that order of preference).
384
+ * - 'eslint' uses ESLint for linting.
385
+ * - 'biome' uses Biome for linting.
386
+ * - 'oxlint' uses Oxlint for linting.
387
+ * - false disables linting.
388
+ * @default 'auto'
375
389
  */
376
390
  lint?: 'auto' | 'eslint' | 'biome' | 'oxlint' | false;
377
391
  /**
378
- * Override the extension to the generated imports and exports, by default each plugin will add an extension
392
+ * Overrides the extension for generated imports and exports. By default, each plugin adds an extension.
379
393
  * @default { '.ts': '.ts'}
380
394
  */
381
395
  extension?: Record<KubbFile.Extname, KubbFile.Extname | ''>;
382
396
  /**
383
- * Specify how `index.ts` files should be created. You can also disable the generation of barrel files here. While each plugin has its own `barrelType` option, this setting controls the creation of the root barrel file, such as` src/gen/index.ts`.
397
+ * Configures how `index.ts` files are created, including disabling barrel file generation. Each plugin has its own `barrelType` option; this setting controls the root barrel file (e.g., `src/gen/index.ts`).
384
398
  * @default 'named'
385
399
  */
386
400
  barrelType?: Exclude<BarrelType, 'propagate'> | false;
387
401
  /**
388
- * Add a default banner to the beginning of every generated file. This makes it clear that the file was generated by Kubb.
389
- * - 'simple': will only add banner with link to Kubb
390
- * - 'full': will add source, title, description and the OpenAPI version used
402
+ * Adds a default banner to the start of every generated file indicating it was generated by Kubb.
403
+ * - 'simple' adds banner with link to Kubb.
404
+ * - 'full' adds source, title, description, and OpenAPI version.
405
+ * - false disables banner generation.
391
406
  * @default 'simple'
392
407
  */
393
408
  defaultBanner?: 'simple' | 'full' | false;
@@ -400,17 +415,17 @@ type Config<TInput = Input> = {
400
415
  override?: boolean;
401
416
  };
402
417
  /**
403
- * An array of Kubb plugins that will be used in the generation.
418
+ * An array of Kubb plugins that used in the generation.
404
419
  * Each plugin may include additional configurable options(defined in the plugin itself).
405
- * If a plugin depends on another plugin, an error will be returned if the required dependency is missing. See pre for more details.
420
+ * If a plugin depends on another plugin, an error is returned if the required dependency is missing. See pre for more details.
406
421
  */
407
422
  plugins?: Array<Plugin>;
408
423
  /**
409
- * Hooks that will be called when a specific action is triggered in Kubb.
424
+ * Hooks triggered when a specific action occurs in Kubb.
410
425
  */
411
426
  hooks?: {
412
427
  /**
413
- * Hook that will be triggered at the end of all executions.
428
+ * Hook that triggers at the end of all executions.
414
429
  * Useful for running Prettier or ESLint to format/lint your code.
415
430
  */
416
431
  done?: string | Array<string>;
@@ -439,7 +454,7 @@ TContext = any,
439
454
  TResolvePathOptions extends object = object> = {
440
455
  name: TName;
441
456
  /**
442
- * Same behaviour like what has been done with `QueryKey` in `@tanstack/react-query`
457
+ * Same behavior like what has been done with `QueryKey` in `@tanstack/react-query`
443
458
  */
444
459
  key: PluginKey<TName | string>;
445
460
  options: TOptions;
@@ -460,12 +475,12 @@ type UserPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> =
460
475
  */
461
476
  options: TOptions['resolvedOptions'];
462
477
  /**
463
- * Specifies the preceding plugins for the current plugin. You can pass an array of preceding plugin names, and the current plugin will be executed after these plugins.
478
+ * Specifies the preceding plugins for the current plugin. You can pass an array of preceding plugin names, and the current plugin is executed after these plugins.
464
479
  * Can be used to validate dependent plugins.
465
480
  */
466
481
  pre?: Array<string>;
467
482
  /**
468
- * Specifies the succeeding plugins for the current plugin. You can pass an array of succeeding plugin names, and the current plugin will be executed before these plugins.
483
+ * Specifies the succeeding plugins for the current plugin. You can pass an array of succeeding plugin names, and the current plugin is executed before these plugins.
469
484
  */
470
485
  post?: Array<string>;
471
486
  inject?: (this: PluginContext<TOptions>, context: PluginContext<TOptions>) => TOptions['context'];
@@ -483,12 +498,12 @@ type Plugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
483
498
  */
484
499
  key: TOptions['key'];
485
500
  /**
486
- * Specifies the preceding plugins for the current plugin. You can pass an array of preceding plugin names, and the current plugin will be executed after these plugins.
501
+ * Specifies the preceding plugins for the current plugin. You can pass an array of preceding plugin names, and the current plugin is executed after these plugins.
487
502
  * Can be used to validate dependent plugins.
488
503
  */
489
504
  pre?: Array<string>;
490
505
  /**
491
- * Specifies the succeeding plugins for the current plugin. You can pass an array of succeeding plugin names, and the current plugin will be executed before these plugins.
506
+ * Specifies the succeeding plugins for the current plugin. You can pass an array of succeeding plugin names, and the current plugin is executed before these plugins.
492
507
  */
493
508
  post?: Array<string>;
494
509
  /**
@@ -538,10 +553,12 @@ type ResolveNameParams = {
538
553
  name: string;
539
554
  pluginKey?: Plugin['key'];
540
555
  /**
541
- * `file` will be used to customize the name of the created file(use of camelCase)
542
- * `function` can be used to customize the exported functions(use of camelCase)
543
- * `type` is a special type for TypeScript(use of PascalCase)
544
- * `const` can be used for variables(use of camelCase)
556
+ * Specifies the type of entity being named.
557
+ * - 'file' customizes the name of the created file (uses camelCase).
558
+ * - 'function' customizes the exported function names (uses camelCase).
559
+ * - 'type' customizes TypeScript types (uses PascalCase).
560
+ * - 'const' customizes variable names (uses camelCase).
561
+ * @default undefined
545
562
  */
546
563
  type?: 'file' | 'function' | 'type' | 'const';
547
564
  };
@@ -596,11 +613,14 @@ type GroupContext = {
596
613
  };
597
614
  type Group = {
598
615
  /**
599
- * Define a type where to group the files on
616
+ * Defines the type where to group the files.
617
+ * - 'tag' groups files by OpenAPI tags.
618
+ * - 'path' groups files by OpenAPI paths.
619
+ * @default undefined
600
620
  */
601
621
  type: 'tag' | 'path';
602
622
  /**
603
- * Return the name of a group based on the group name, this will be used for the file and name generation
623
+ * Return the name of a group based on the group name, this used for the file and name generation
604
624
  */
605
625
  name?: (context: GroupContext) => string;
606
626
  };
@@ -672,7 +692,7 @@ declare class PluginManager {
672
692
  parameters: PluginParameter<H>;
673
693
  }): Array<ReturnType<ParseResult<H>>> | null;
674
694
  /**
675
- * First non-null result stops and will return it's value.
695
+ * Returns the first non-null result.
676
696
  */
677
697
  hookFirst<H extends PluginLifecycleHooks>({
678
698
  hookName,
@@ -684,7 +704,7 @@ declare class PluginManager {
684
704
  skipped?: ReadonlySet<Plugin> | null;
685
705
  }): Promise<SafeParseResult<H>>;
686
706
  /**
687
- * First non-null result stops and will return it's value.
707
+ * Returns the first non-null result.
688
708
  */
689
709
  hookFirstSync<H extends PluginLifecycleHooks>({
690
710
  hookName,
@@ -696,15 +716,15 @@ declare class PluginManager {
696
716
  skipped?: ReadonlySet<Plugin> | null;
697
717
  }): SafeParseResult<H>;
698
718
  /**
699
- * Run all plugins in parallel(order will be based on `this.plugin` and if `pre` or `post` is set).
719
+ * Runs all plugins in parallel based on `this.plugin` order and `pre`/`post` settings.
700
720
  */
701
- hookParallel<H extends PluginLifecycleHooks, TOuput = void>({
721
+ hookParallel<H extends PluginLifecycleHooks, TOutput = void>({
702
722
  hookName,
703
723
  parameters
704
724
  }: {
705
725
  hookName: H;
706
726
  parameters?: Parameters<RequiredPluginLifecycle[H]> | undefined;
707
- }): Promise<Awaited<TOuput>[]>;
727
+ }): Promise<Awaited<TOutput>[]>;
708
728
  /**
709
729
  * Chains plugins
710
730
  */
@@ -725,4 +745,4 @@ type FileMetaBase = {
725
745
  };
726
746
  //#endregion
727
747
  export { contentType as _, Output as a, ResolveNameParams as c, KubbEvents as d, BaseGenerator as f, SchemaObject$1 as g, Operation$1 as h, Group as i, UserPluginWithLifeCycle as l, HttpMethod as m, PluginManager as n, Plugin as o, Oas as p, Config as r, PluginFactoryOptions as s, FileMetaBase as t, AsyncEventEmitter as u };
728
- //# sourceMappingURL=index-BabbvEEy.d.ts.map
748
+ //# sourceMappingURL=index-Cdqo2P0B.d.ts.map
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { l as UserPluginWithLifeCycle, v as __name } from "./index-B4aM7eWh.cjs";
2
- import { n as PluginMsw, t as Options } from "./types-CE70FwIb.cjs";
1
+ import { l as UserPluginWithLifeCycle, v as __name } from "./index-B4gKt7dm.cjs";
2
+ import { n as PluginMsw, t as Options } from "./types-BKj4cTq4.cjs";
3
3
 
4
4
  //#region src/plugin.d.ts
5
5
  declare const pluginMswName = "plugin-msw";
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { t as __name } from "./chunk-eQyhnF5A.js";
2
- import { l as UserPluginWithLifeCycle } from "./index-BabbvEEy.js";
3
- import { n as PluginMsw, t as Options } from "./types-DCYFEk92.js";
2
+ import { l as UserPluginWithLifeCycle } from "./index-Cdqo2P0B.js";
3
+ import { n as PluginMsw, t as Options } from "./types-DlVj7qjw.js";
4
4
 
5
5
  //#region src/plugin.d.ts
6
6
  declare const pluginMswName = "plugin-msw";
@@ -1,4 +1,4 @@
1
- import { _ as contentType, a as Output, c as ResolveNameParams, d as KubbEvents, f as BaseGenerator, g as SchemaObject, h as Operation, i as Group, m as HttpMethod, n as PluginManager, o as Plugin, p as Oas, r as Config, s as PluginFactoryOptions, t as FileMetaBase, u as AsyncEventEmitter, v as __name } from "./index-B4aM7eWh.cjs";
1
+ import { _ as contentType, a as Output, c as ResolveNameParams, d as KubbEvents, f as BaseGenerator, g as SchemaObject, h as Operation, i as Group, m as HttpMethod, n as PluginManager, o as Plugin, p as Oas, r as Config, s as PluginFactoryOptions, t as FileMetaBase, u as AsyncEventEmitter, v as __name } from "./index-B4gKt7dm.cjs";
2
2
  import { KubbNode } from "@kubb/react-fabric/types";
3
3
  import { KubbFile } from "@kubb/fabric-core/types";
4
4
  import { Fabric } from "@kubb/react-fabric";
@@ -252,8 +252,8 @@ type SchemaKeywordMapper = {
252
252
  */
253
253
  path: KubbFile.Path;
254
254
  /**
255
- * When true `File.Import` will be used.
256
- * When false a reference will be used inside the current file.
255
+ * When true `File.Import` is used.
256
+ * When false a reference is used inside the current file.
257
257
  */
258
258
  isImportable: boolean;
259
259
  };
@@ -385,7 +385,7 @@ type SchemaGeneratorOptions = {
385
385
  */
386
386
  name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
387
387
  /**
388
- * Receive schema and name(propertName) and return FakerMeta array
388
+ * Receive schema and name(propertyName) and return FakerMeta array
389
389
  * TODO TODO add docs
390
390
  * @beta
391
391
  */
@@ -464,7 +464,7 @@ type Options = {
464
464
  output?: Output<Oas>;
465
465
  /**
466
466
  * Define which contentType should be used.
467
- * By default, the first JSON valid mediaType will be used
467
+ * By default, the first JSON valid mediaType is used
468
468
  */
469
469
  contentType?: contentType;
470
470
  baseURL?: string;
@@ -496,9 +496,9 @@ type Options = {
496
496
  */
497
497
  handlers?: boolean;
498
498
  /**
499
- * Which parser should be used before returning the data to the `Response` of MSW.
500
- * - `'faker'` will use `@kubb/plugin-faker` to generate the data for the response
501
- * - `'data'` will use your custom data to generate the data for the response
499
+ * Which parser should be used before returning the data to the Response of MSW.
500
+ * - 'data' uses your custom data to generate the data for the response.
501
+ * - 'faker' uses @kubb/plugin-faker to generate the data for the response.
502
502
  * @default 'data'
503
503
  */
504
504
  parser?: 'data' | 'faker';
@@ -516,4 +516,4 @@ type ResolvedOptions = {
516
516
  type PluginMsw = PluginFactoryOptions<'plugin-msw', Options, ResolvedOptions, never, ResolvePathOptions>;
517
517
  //#endregion
518
518
  export { PluginMsw as n, ReactGenerator as r, Options as t };
519
- //# sourceMappingURL=types-CE70FwIb.d.cts.map
519
+ //# sourceMappingURL=types-BKj4cTq4.d.cts.map
@@ -1,5 +1,5 @@
1
1
  import { t as __name } from "./chunk-eQyhnF5A.js";
2
- import { _ as contentType, a as Output, c as ResolveNameParams, d as KubbEvents, f as BaseGenerator, g as SchemaObject, h as Operation, i as Group, m as HttpMethod, n as PluginManager, o as Plugin, p as Oas, r as Config, s as PluginFactoryOptions, t as FileMetaBase, u as AsyncEventEmitter } from "./index-BabbvEEy.js";
2
+ import { _ as contentType, a as Output, c as ResolveNameParams, d as KubbEvents, f as BaseGenerator, g as SchemaObject, h as Operation, i as Group, m as HttpMethod, n as PluginManager, o as Plugin, p as Oas, r as Config, s as PluginFactoryOptions, t as FileMetaBase, u as AsyncEventEmitter } from "./index-Cdqo2P0B.js";
3
3
  import { Fabric } from "@kubb/react-fabric";
4
4
  import { KubbNode } from "@kubb/react-fabric/types";
5
5
  import { KubbFile } from "@kubb/fabric-core/types";
@@ -253,8 +253,8 @@ type SchemaKeywordMapper = {
253
253
  */
254
254
  path: KubbFile.Path;
255
255
  /**
256
- * When true `File.Import` will be used.
257
- * When false a reference will be used inside the current file.
256
+ * When true `File.Import` is used.
257
+ * When false a reference is used inside the current file.
258
258
  */
259
259
  isImportable: boolean;
260
260
  };
@@ -386,7 +386,7 @@ type SchemaGeneratorOptions = {
386
386
  */
387
387
  name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
388
388
  /**
389
- * Receive schema and name(propertName) and return FakerMeta array
389
+ * Receive schema and name(propertyName) and return FakerMeta array
390
390
  * TODO TODO add docs
391
391
  * @beta
392
392
  */
@@ -465,7 +465,7 @@ type Options = {
465
465
  output?: Output<Oas>;
466
466
  /**
467
467
  * Define which contentType should be used.
468
- * By default, the first JSON valid mediaType will be used
468
+ * By default, the first JSON valid mediaType is used
469
469
  */
470
470
  contentType?: contentType;
471
471
  baseURL?: string;
@@ -497,9 +497,9 @@ type Options = {
497
497
  */
498
498
  handlers?: boolean;
499
499
  /**
500
- * Which parser should be used before returning the data to the `Response` of MSW.
501
- * - `'faker'` will use `@kubb/plugin-faker` to generate the data for the response
502
- * - `'data'` will use your custom data to generate the data for the response
500
+ * Which parser should be used before returning the data to the Response of MSW.
501
+ * - 'data' uses your custom data to generate the data for the response.
502
+ * - 'faker' uses @kubb/plugin-faker to generate the data for the response.
503
503
  * @default 'data'
504
504
  */
505
505
  parser?: 'data' | 'faker';
@@ -517,4 +517,4 @@ type ResolvedOptions = {
517
517
  type PluginMsw = PluginFactoryOptions<'plugin-msw', Options, ResolvedOptions, never, ResolvePathOptions>;
518
518
  //#endregion
519
519
  export { PluginMsw as n, ReactGenerator as r, Options as t };
520
- //# sourceMappingURL=types-DCYFEk92.d.ts.map
520
+ //# sourceMappingURL=types-DlVj7qjw.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/plugin-msw",
3
- "version": "4.18.4",
3
+ "version": "4.19.0",
4
4
  "description": "Mock Service Worker (MSW) handlers generator plugin for Kubb, creating API mocks from OpenAPI specifications for frontend development and testing.",
5
5
  "keywords": [
6
6
  "msw",
@@ -74,11 +74,11 @@
74
74
  ],
75
75
  "dependencies": {
76
76
  "@kubb/react-fabric": "0.12.4",
77
- "@kubb/core": "4.18.4",
78
- "@kubb/oas": "4.18.4",
79
- "@kubb/plugin-faker": "4.18.4",
80
- "@kubb/plugin-oas": "4.18.4",
81
- "@kubb/plugin-ts": "4.18.4"
77
+ "@kubb/core": "4.19.0",
78
+ "@kubb/oas": "4.19.0",
79
+ "@kubb/plugin-faker": "4.19.0",
80
+ "@kubb/plugin-oas": "4.19.0",
81
+ "@kubb/plugin-ts": "4.19.0"
82
82
  },
83
83
  "devDependencies": {},
84
84
  "engines": {
package/src/types.ts CHANGED
@@ -12,7 +12,7 @@ export type Options = {
12
12
  output?: Output<Oas>
13
13
  /**
14
14
  * Define which contentType should be used.
15
- * By default, the first JSON valid mediaType will be used
15
+ * By default, the first JSON valid mediaType is used
16
16
  */
17
17
  contentType?: contentType
18
18
  baseURL?: string
@@ -44,9 +44,9 @@ export type Options = {
44
44
  */
45
45
  handlers?: boolean
46
46
  /**
47
- * Which parser should be used before returning the data to the `Response` of MSW.
48
- * - `'faker'` will use `@kubb/plugin-faker` to generate the data for the response
49
- * - `'data'` will use your custom data to generate the data for the response
47
+ * Which parser should be used before returning the data to the Response of MSW.
48
+ * - 'data' uses your custom data to generate the data for the response.
49
+ * - 'faker' uses @kubb/plugin-faker to generate the data for the response.
50
50
  * @default 'data'
51
51
  */
52
52
  parser?: 'data' | 'faker'