@kubb/plugin-msw 4.18.3 → 4.18.5
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/components.d.cts +1 -1
- package/dist/components.d.ts +1 -1
- package/dist/generators.d.cts +2 -2
- package/dist/generators.d.ts +2 -2
- package/dist/{index-B4aM7eWh.d.cts → index-CJNbXw24.d.cts} +46 -43
- package/dist/{index-BabbvEEy.d.ts → index-CbLk6i3C.d.ts} +46 -43
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/{types-CE70FwIb.d.cts → types-B6OpXWFz.d.cts} +9 -9
- package/dist/{types-DCYFEk92.d.ts → types-DA9U9Z0N.d.ts} +9 -9
- package/package.json +7 -7
- package/src/types.ts +4 -4
package/dist/components.d.cts
CHANGED
package/dist/components.d.ts
CHANGED
package/dist/generators.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { v as __name } from "./index-
|
|
2
|
-
import { n as PluginMsw, r as ReactGenerator } from "./types-
|
|
1
|
+
import { v as __name } from "./index-CJNbXw24.cjs";
|
|
2
|
+
import { n as PluginMsw, r as ReactGenerator } from "./types-B6OpXWFz.cjs";
|
|
3
3
|
|
|
4
4
|
//#region src/generators/handlersGenerator.d.ts
|
|
5
5
|
declare const handlersGenerator: ReactGenerator<PluginMsw>;
|
package/dist/generators.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __name } from "./chunk-eQyhnF5A.js";
|
|
2
|
-
import "./index-
|
|
3
|
-
import { n as PluginMsw, r as ReactGenerator } from "./types-
|
|
2
|
+
import "./index-CbLk6i3C.js";
|
|
3
|
+
import { n as PluginMsw, r as ReactGenerator } from "./types-DA9U9Z0N.js";
|
|
4
4
|
|
|
5
5
|
//#region src/generators/handlersGenerator.d.ts
|
|
6
6
|
declare const handlersGenerator: ReactGenerator<PluginMsw>;
|
|
@@ -37,7 +37,7 @@ declare class Oas extends BaseOas {
|
|
|
37
37
|
getResponseSchema(operation: Operation$1, statusCode: string | number): SchemaObject$1;
|
|
38
38
|
getRequestSchema(operation: Operation$1): SchemaObject$1 | undefined;
|
|
39
39
|
getParametersSchema(operation: Operation$1, inKey: 'path' | 'query' | 'header'): SchemaObject$1 | null;
|
|
40
|
-
|
|
40
|
+
validate(): Promise<oas_normalize_lib_types0.ValidationResult>;
|
|
41
41
|
flattenSchema(schema: SchemaObject$1 | null): SchemaObject$1 | null;
|
|
42
42
|
}
|
|
43
43
|
//#endregion
|
|
@@ -339,7 +339,7 @@ type Config<TInput = Input> = {
|
|
|
339
339
|
input: TInput;
|
|
340
340
|
output: {
|
|
341
341
|
/**
|
|
342
|
-
* The path where all generated files
|
|
342
|
+
* The path where all generated files receives exported.
|
|
343
343
|
* This can be an absolute path or a path relative to the specified root option.
|
|
344
344
|
*/
|
|
345
345
|
path: string;
|
|
@@ -354,41 +354,39 @@ type Config<TInput = Input> = {
|
|
|
354
354
|
write?: boolean;
|
|
355
355
|
/**
|
|
356
356
|
* Specifies the formatting tool to be used.
|
|
357
|
-
*
|
|
358
|
-
*
|
|
359
|
-
*
|
|
360
|
-
* - '
|
|
361
|
-
* -
|
|
362
|
-
*
|
|
363
|
-
*
|
|
357
|
+
* - 'auto' automatically detects and uses biome or prettier (in that order of preference).
|
|
358
|
+
* - 'prettier' uses Prettier for code formatting.
|
|
359
|
+
* - 'biome' uses Biome for code formatting.
|
|
360
|
+
* - 'oxfmt' uses Oxfmt for code formatting.
|
|
361
|
+
* - false disables code formatting.
|
|
362
|
+
* @default 'prettier'
|
|
364
363
|
*/
|
|
365
364
|
format?: 'auto' | 'prettier' | 'biome' | 'oxfmt' | false;
|
|
366
365
|
/**
|
|
367
366
|
* Specifies the linter that should be used to analyze the code.
|
|
368
|
-
*
|
|
369
|
-
*
|
|
370
|
-
*
|
|
371
|
-
* - '
|
|
372
|
-
* -
|
|
373
|
-
*
|
|
374
|
-
* - 'oxlint': Represents the Oxlint tool for linting purposes.
|
|
375
|
-
*
|
|
367
|
+
* - 'auto' automatically detects and uses biome, oxlint, or eslint (in that order of preference).
|
|
368
|
+
* - 'eslint' uses ESLint for linting.
|
|
369
|
+
* - 'biome' uses Biome for linting.
|
|
370
|
+
* - 'oxlint' uses Oxlint for linting.
|
|
371
|
+
* - false disables linting.
|
|
372
|
+
* @default 'auto'
|
|
376
373
|
*/
|
|
377
374
|
lint?: 'auto' | 'eslint' | 'biome' | 'oxlint' | false;
|
|
378
375
|
/**
|
|
379
|
-
*
|
|
376
|
+
* Overrides the extension for generated imports and exports. By default, each plugin adds an extension.
|
|
380
377
|
* @default { '.ts': '.ts'}
|
|
381
378
|
*/
|
|
382
379
|
extension?: Record<KubbFile.Extname, KubbFile.Extname | ''>;
|
|
383
380
|
/**
|
|
384
|
-
*
|
|
381
|
+
* 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
382
|
* @default 'named'
|
|
386
383
|
*/
|
|
387
384
|
barrelType?: Exclude<BarrelType, 'propagate'> | false;
|
|
388
385
|
/**
|
|
389
|
-
*
|
|
390
|
-
* - 'simple'
|
|
391
|
-
* - 'full'
|
|
386
|
+
* Adds a default banner to the start of every generated file indicating it was generated by Kubb.
|
|
387
|
+
* - 'simple' adds banner with link to Kubb.
|
|
388
|
+
* - 'full' adds source, title, description, and OpenAPI version.
|
|
389
|
+
* - false disables banner generation.
|
|
392
390
|
* @default 'simple'
|
|
393
391
|
*/
|
|
394
392
|
defaultBanner?: 'simple' | 'full' | false;
|
|
@@ -401,17 +399,17 @@ type Config<TInput = Input> = {
|
|
|
401
399
|
override?: boolean;
|
|
402
400
|
};
|
|
403
401
|
/**
|
|
404
|
-
* An array of Kubb plugins that
|
|
402
|
+
* An array of Kubb plugins that used in the generation.
|
|
405
403
|
* Each plugin may include additional configurable options(defined in the plugin itself).
|
|
406
|
-
* If a plugin depends on another plugin, an error
|
|
404
|
+
* If a plugin depends on another plugin, an error is returned if the required dependency is missing. See pre for more details.
|
|
407
405
|
*/
|
|
408
406
|
plugins?: Array<Plugin>;
|
|
409
407
|
/**
|
|
410
|
-
* Hooks
|
|
408
|
+
* Hooks triggered when a specific action occurs in Kubb.
|
|
411
409
|
*/
|
|
412
410
|
hooks?: {
|
|
413
411
|
/**
|
|
414
|
-
* Hook that
|
|
412
|
+
* Hook that triggers at the end of all executions.
|
|
415
413
|
* Useful for running Prettier or ESLint to format/lint your code.
|
|
416
414
|
*/
|
|
417
415
|
done?: string | Array<string>;
|
|
@@ -440,7 +438,7 @@ TContext = any,
|
|
|
440
438
|
TResolvePathOptions extends object = object> = {
|
|
441
439
|
name: TName;
|
|
442
440
|
/**
|
|
443
|
-
* Same
|
|
441
|
+
* Same behavior like what has been done with `QueryKey` in `@tanstack/react-query`
|
|
444
442
|
*/
|
|
445
443
|
key: PluginKey<TName | string>;
|
|
446
444
|
options: TOptions;
|
|
@@ -461,12 +459,12 @@ type UserPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> =
|
|
|
461
459
|
*/
|
|
462
460
|
options: TOptions['resolvedOptions'];
|
|
463
461
|
/**
|
|
464
|
-
* Specifies the preceding plugins for the current plugin. You can pass an array of preceding plugin names, and the current plugin
|
|
462
|
+
* 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
463
|
* Can be used to validate dependent plugins.
|
|
466
464
|
*/
|
|
467
465
|
pre?: Array<string>;
|
|
468
466
|
/**
|
|
469
|
-
* Specifies the succeeding plugins for the current plugin. You can pass an array of succeeding plugin names, and the current plugin
|
|
467
|
+
* 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
468
|
*/
|
|
471
469
|
post?: Array<string>;
|
|
472
470
|
inject?: (this: PluginContext<TOptions>, context: PluginContext<TOptions>) => TOptions['context'];
|
|
@@ -484,12 +482,12 @@ type Plugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
|
484
482
|
*/
|
|
485
483
|
key: TOptions['key'];
|
|
486
484
|
/**
|
|
487
|
-
* Specifies the preceding plugins for the current plugin. You can pass an array of preceding plugin names, and the current plugin
|
|
485
|
+
* 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
486
|
* Can be used to validate dependent plugins.
|
|
489
487
|
*/
|
|
490
488
|
pre?: Array<string>;
|
|
491
489
|
/**
|
|
492
|
-
* Specifies the succeeding plugins for the current plugin. You can pass an array of succeeding plugin names, and the current plugin
|
|
490
|
+
* 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
491
|
*/
|
|
494
492
|
post?: Array<string>;
|
|
495
493
|
/**
|
|
@@ -539,10 +537,12 @@ type ResolveNameParams = {
|
|
|
539
537
|
name: string;
|
|
540
538
|
pluginKey?: Plugin['key'];
|
|
541
539
|
/**
|
|
542
|
-
*
|
|
543
|
-
*
|
|
544
|
-
*
|
|
545
|
-
*
|
|
540
|
+
* Specifies the type of entity being named.
|
|
541
|
+
* - 'file' customizes the name of the created file (uses camelCase).
|
|
542
|
+
* - 'function' customizes the exported function names (uses camelCase).
|
|
543
|
+
* - 'type' customizes TypeScript types (uses PascalCase).
|
|
544
|
+
* - 'const' customizes variable names (uses camelCase).
|
|
545
|
+
* @default undefined
|
|
546
546
|
*/
|
|
547
547
|
type?: 'file' | 'function' | 'type' | 'const';
|
|
548
548
|
};
|
|
@@ -597,11 +597,14 @@ type GroupContext = {
|
|
|
597
597
|
};
|
|
598
598
|
type Group = {
|
|
599
599
|
/**
|
|
600
|
-
*
|
|
600
|
+
* Defines the type where to group the files.
|
|
601
|
+
* - 'tag' groups files by OpenAPI tags.
|
|
602
|
+
* - 'path' groups files by OpenAPI paths.
|
|
603
|
+
* @default undefined
|
|
601
604
|
*/
|
|
602
605
|
type: 'tag' | 'path';
|
|
603
606
|
/**
|
|
604
|
-
* Return the name of a group based on the group name, this
|
|
607
|
+
* Return the name of a group based on the group name, this used for the file and name generation
|
|
605
608
|
*/
|
|
606
609
|
name?: (context: GroupContext) => string;
|
|
607
610
|
};
|
|
@@ -673,7 +676,7 @@ declare class PluginManager {
|
|
|
673
676
|
parameters: PluginParameter<H>;
|
|
674
677
|
}): Array<ReturnType<ParseResult<H>>> | null;
|
|
675
678
|
/**
|
|
676
|
-
*
|
|
679
|
+
* Returns the first non-null result.
|
|
677
680
|
*/
|
|
678
681
|
hookFirst<H extends PluginLifecycleHooks>({
|
|
679
682
|
hookName,
|
|
@@ -685,7 +688,7 @@ declare class PluginManager {
|
|
|
685
688
|
skipped?: ReadonlySet<Plugin> | null;
|
|
686
689
|
}): Promise<SafeParseResult<H>>;
|
|
687
690
|
/**
|
|
688
|
-
*
|
|
691
|
+
* Returns the first non-null result.
|
|
689
692
|
*/
|
|
690
693
|
hookFirstSync<H extends PluginLifecycleHooks>({
|
|
691
694
|
hookName,
|
|
@@ -697,15 +700,15 @@ declare class PluginManager {
|
|
|
697
700
|
skipped?: ReadonlySet<Plugin> | null;
|
|
698
701
|
}): SafeParseResult<H>;
|
|
699
702
|
/**
|
|
700
|
-
*
|
|
703
|
+
* Runs all plugins in parallel based on `this.plugin` order and `pre`/`post` settings.
|
|
701
704
|
*/
|
|
702
|
-
hookParallel<H extends PluginLifecycleHooks,
|
|
705
|
+
hookParallel<H extends PluginLifecycleHooks, TOutput = void>({
|
|
703
706
|
hookName,
|
|
704
707
|
parameters
|
|
705
708
|
}: {
|
|
706
709
|
hookName: H;
|
|
707
710
|
parameters?: Parameters<RequiredPluginLifecycle[H]> | undefined;
|
|
708
|
-
}): Promise<Awaited<
|
|
711
|
+
}): Promise<Awaited<TOutput>[]>;
|
|
709
712
|
/**
|
|
710
713
|
* Chains plugins
|
|
711
714
|
*/
|
|
@@ -726,4 +729,4 @@ type FileMetaBase = {
|
|
|
726
729
|
};
|
|
727
730
|
//#endregion
|
|
728
731
|
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-
|
|
732
|
+
//# sourceMappingURL=index-CJNbXw24.d.cts.map
|
|
@@ -36,7 +36,7 @@ declare class Oas extends BaseOas {
|
|
|
36
36
|
getResponseSchema(operation: Operation$1, statusCode: string | number): SchemaObject$1;
|
|
37
37
|
getRequestSchema(operation: Operation$1): SchemaObject$1 | undefined;
|
|
38
38
|
getParametersSchema(operation: Operation$1, inKey: 'path' | 'query' | 'header'): SchemaObject$1 | null;
|
|
39
|
-
|
|
39
|
+
validate(): Promise<oas_normalize_lib_types0.ValidationResult>;
|
|
40
40
|
flattenSchema(schema: SchemaObject$1 | null): SchemaObject$1 | null;
|
|
41
41
|
}
|
|
42
42
|
//#endregion
|
|
@@ -338,7 +338,7 @@ type Config<TInput = Input> = {
|
|
|
338
338
|
input: TInput;
|
|
339
339
|
output: {
|
|
340
340
|
/**
|
|
341
|
-
* The path where all generated files
|
|
341
|
+
* The path where all generated files receives exported.
|
|
342
342
|
* This can be an absolute path or a path relative to the specified root option.
|
|
343
343
|
*/
|
|
344
344
|
path: string;
|
|
@@ -353,41 +353,39 @@ type Config<TInput = Input> = {
|
|
|
353
353
|
write?: boolean;
|
|
354
354
|
/**
|
|
355
355
|
* Specifies the formatting tool to be used.
|
|
356
|
-
*
|
|
357
|
-
*
|
|
358
|
-
*
|
|
359
|
-
* - '
|
|
360
|
-
* -
|
|
361
|
-
*
|
|
362
|
-
*
|
|
356
|
+
* - 'auto' automatically detects and uses biome or prettier (in that order of preference).
|
|
357
|
+
* - 'prettier' uses Prettier for code formatting.
|
|
358
|
+
* - 'biome' uses Biome for code formatting.
|
|
359
|
+
* - 'oxfmt' uses Oxfmt for code formatting.
|
|
360
|
+
* - false disables code formatting.
|
|
361
|
+
* @default 'prettier'
|
|
363
362
|
*/
|
|
364
363
|
format?: 'auto' | 'prettier' | 'biome' | 'oxfmt' | false;
|
|
365
364
|
/**
|
|
366
365
|
* Specifies the linter that should be used to analyze the code.
|
|
367
|
-
*
|
|
368
|
-
*
|
|
369
|
-
*
|
|
370
|
-
* - '
|
|
371
|
-
* -
|
|
372
|
-
*
|
|
373
|
-
* - 'oxlint': Represents the Oxlint tool for linting purposes.
|
|
374
|
-
*
|
|
366
|
+
* - 'auto' automatically detects and uses biome, oxlint, or eslint (in that order of preference).
|
|
367
|
+
* - 'eslint' uses ESLint for linting.
|
|
368
|
+
* - 'biome' uses Biome for linting.
|
|
369
|
+
* - 'oxlint' uses Oxlint for linting.
|
|
370
|
+
* - false disables linting.
|
|
371
|
+
* @default 'auto'
|
|
375
372
|
*/
|
|
376
373
|
lint?: 'auto' | 'eslint' | 'biome' | 'oxlint' | false;
|
|
377
374
|
/**
|
|
378
|
-
*
|
|
375
|
+
* Overrides the extension for generated imports and exports. By default, each plugin adds an extension.
|
|
379
376
|
* @default { '.ts': '.ts'}
|
|
380
377
|
*/
|
|
381
378
|
extension?: Record<KubbFile.Extname, KubbFile.Extname | ''>;
|
|
382
379
|
/**
|
|
383
|
-
*
|
|
380
|
+
* 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
381
|
* @default 'named'
|
|
385
382
|
*/
|
|
386
383
|
barrelType?: Exclude<BarrelType, 'propagate'> | false;
|
|
387
384
|
/**
|
|
388
|
-
*
|
|
389
|
-
* - 'simple'
|
|
390
|
-
* - 'full'
|
|
385
|
+
* Adds a default banner to the start of every generated file indicating it was generated by Kubb.
|
|
386
|
+
* - 'simple' adds banner with link to Kubb.
|
|
387
|
+
* - 'full' adds source, title, description, and OpenAPI version.
|
|
388
|
+
* - false disables banner generation.
|
|
391
389
|
* @default 'simple'
|
|
392
390
|
*/
|
|
393
391
|
defaultBanner?: 'simple' | 'full' | false;
|
|
@@ -400,17 +398,17 @@ type Config<TInput = Input> = {
|
|
|
400
398
|
override?: boolean;
|
|
401
399
|
};
|
|
402
400
|
/**
|
|
403
|
-
* An array of Kubb plugins that
|
|
401
|
+
* An array of Kubb plugins that used in the generation.
|
|
404
402
|
* Each plugin may include additional configurable options(defined in the plugin itself).
|
|
405
|
-
* If a plugin depends on another plugin, an error
|
|
403
|
+
* If a plugin depends on another plugin, an error is returned if the required dependency is missing. See pre for more details.
|
|
406
404
|
*/
|
|
407
405
|
plugins?: Array<Plugin>;
|
|
408
406
|
/**
|
|
409
|
-
* Hooks
|
|
407
|
+
* Hooks triggered when a specific action occurs in Kubb.
|
|
410
408
|
*/
|
|
411
409
|
hooks?: {
|
|
412
410
|
/**
|
|
413
|
-
* Hook that
|
|
411
|
+
* Hook that triggers at the end of all executions.
|
|
414
412
|
* Useful for running Prettier or ESLint to format/lint your code.
|
|
415
413
|
*/
|
|
416
414
|
done?: string | Array<string>;
|
|
@@ -439,7 +437,7 @@ TContext = any,
|
|
|
439
437
|
TResolvePathOptions extends object = object> = {
|
|
440
438
|
name: TName;
|
|
441
439
|
/**
|
|
442
|
-
* Same
|
|
440
|
+
* Same behavior like what has been done with `QueryKey` in `@tanstack/react-query`
|
|
443
441
|
*/
|
|
444
442
|
key: PluginKey<TName | string>;
|
|
445
443
|
options: TOptions;
|
|
@@ -460,12 +458,12 @@ type UserPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> =
|
|
|
460
458
|
*/
|
|
461
459
|
options: TOptions['resolvedOptions'];
|
|
462
460
|
/**
|
|
463
|
-
* Specifies the preceding plugins for the current plugin. You can pass an array of preceding plugin names, and the current plugin
|
|
461
|
+
* 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
462
|
* Can be used to validate dependent plugins.
|
|
465
463
|
*/
|
|
466
464
|
pre?: Array<string>;
|
|
467
465
|
/**
|
|
468
|
-
* Specifies the succeeding plugins for the current plugin. You can pass an array of succeeding plugin names, and the current plugin
|
|
466
|
+
* 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
467
|
*/
|
|
470
468
|
post?: Array<string>;
|
|
471
469
|
inject?: (this: PluginContext<TOptions>, context: PluginContext<TOptions>) => TOptions['context'];
|
|
@@ -483,12 +481,12 @@ type Plugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
|
483
481
|
*/
|
|
484
482
|
key: TOptions['key'];
|
|
485
483
|
/**
|
|
486
|
-
* Specifies the preceding plugins for the current plugin. You can pass an array of preceding plugin names, and the current plugin
|
|
484
|
+
* 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
485
|
* Can be used to validate dependent plugins.
|
|
488
486
|
*/
|
|
489
487
|
pre?: Array<string>;
|
|
490
488
|
/**
|
|
491
|
-
* Specifies the succeeding plugins for the current plugin. You can pass an array of succeeding plugin names, and the current plugin
|
|
489
|
+
* 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
490
|
*/
|
|
493
491
|
post?: Array<string>;
|
|
494
492
|
/**
|
|
@@ -538,10 +536,12 @@ type ResolveNameParams = {
|
|
|
538
536
|
name: string;
|
|
539
537
|
pluginKey?: Plugin['key'];
|
|
540
538
|
/**
|
|
541
|
-
*
|
|
542
|
-
*
|
|
543
|
-
*
|
|
544
|
-
*
|
|
539
|
+
* Specifies the type of entity being named.
|
|
540
|
+
* - 'file' customizes the name of the created file (uses camelCase).
|
|
541
|
+
* - 'function' customizes the exported function names (uses camelCase).
|
|
542
|
+
* - 'type' customizes TypeScript types (uses PascalCase).
|
|
543
|
+
* - 'const' customizes variable names (uses camelCase).
|
|
544
|
+
* @default undefined
|
|
545
545
|
*/
|
|
546
546
|
type?: 'file' | 'function' | 'type' | 'const';
|
|
547
547
|
};
|
|
@@ -596,11 +596,14 @@ type GroupContext = {
|
|
|
596
596
|
};
|
|
597
597
|
type Group = {
|
|
598
598
|
/**
|
|
599
|
-
*
|
|
599
|
+
* Defines the type where to group the files.
|
|
600
|
+
* - 'tag' groups files by OpenAPI tags.
|
|
601
|
+
* - 'path' groups files by OpenAPI paths.
|
|
602
|
+
* @default undefined
|
|
600
603
|
*/
|
|
601
604
|
type: 'tag' | 'path';
|
|
602
605
|
/**
|
|
603
|
-
* Return the name of a group based on the group name, this
|
|
606
|
+
* Return the name of a group based on the group name, this used for the file and name generation
|
|
604
607
|
*/
|
|
605
608
|
name?: (context: GroupContext) => string;
|
|
606
609
|
};
|
|
@@ -672,7 +675,7 @@ declare class PluginManager {
|
|
|
672
675
|
parameters: PluginParameter<H>;
|
|
673
676
|
}): Array<ReturnType<ParseResult<H>>> | null;
|
|
674
677
|
/**
|
|
675
|
-
*
|
|
678
|
+
* Returns the first non-null result.
|
|
676
679
|
*/
|
|
677
680
|
hookFirst<H extends PluginLifecycleHooks>({
|
|
678
681
|
hookName,
|
|
@@ -684,7 +687,7 @@ declare class PluginManager {
|
|
|
684
687
|
skipped?: ReadonlySet<Plugin> | null;
|
|
685
688
|
}): Promise<SafeParseResult<H>>;
|
|
686
689
|
/**
|
|
687
|
-
*
|
|
690
|
+
* Returns the first non-null result.
|
|
688
691
|
*/
|
|
689
692
|
hookFirstSync<H extends PluginLifecycleHooks>({
|
|
690
693
|
hookName,
|
|
@@ -696,15 +699,15 @@ declare class PluginManager {
|
|
|
696
699
|
skipped?: ReadonlySet<Plugin> | null;
|
|
697
700
|
}): SafeParseResult<H>;
|
|
698
701
|
/**
|
|
699
|
-
*
|
|
702
|
+
* Runs all plugins in parallel based on `this.plugin` order and `pre`/`post` settings.
|
|
700
703
|
*/
|
|
701
|
-
hookParallel<H extends PluginLifecycleHooks,
|
|
704
|
+
hookParallel<H extends PluginLifecycleHooks, TOutput = void>({
|
|
702
705
|
hookName,
|
|
703
706
|
parameters
|
|
704
707
|
}: {
|
|
705
708
|
hookName: H;
|
|
706
709
|
parameters?: Parameters<RequiredPluginLifecycle[H]> | undefined;
|
|
707
|
-
}): Promise<Awaited<
|
|
710
|
+
}): Promise<Awaited<TOutput>[]>;
|
|
708
711
|
/**
|
|
709
712
|
* Chains plugins
|
|
710
713
|
*/
|
|
@@ -725,4 +728,4 @@ type FileMetaBase = {
|
|
|
725
728
|
};
|
|
726
729
|
//#endregion
|
|
727
730
|
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-
|
|
731
|
+
//# sourceMappingURL=index-CbLk6i3C.d.ts.map
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { l as UserPluginWithLifeCycle, v as __name } from "./index-
|
|
2
|
-
import { n as PluginMsw, t as Options } from "./types-
|
|
1
|
+
import { l as UserPluginWithLifeCycle, v as __name } from "./index-CJNbXw24.cjs";
|
|
2
|
+
import { n as PluginMsw, t as Options } from "./types-B6OpXWFz.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-
|
|
3
|
-
import { n as PluginMsw, t as Options } from "./types-
|
|
2
|
+
import { l as UserPluginWithLifeCycle } from "./index-CbLk6i3C.js";
|
|
3
|
+
import { n as PluginMsw, t as Options } from "./types-DA9U9Z0N.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-
|
|
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-CJNbXw24.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`
|
|
256
|
-
* When false a reference
|
|
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(
|
|
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
|
|
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
|
|
500
|
-
*
|
|
501
|
-
*
|
|
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-
|
|
519
|
+
//# sourceMappingURL=types-B6OpXWFz.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-
|
|
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-CbLk6i3C.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`
|
|
257
|
-
* When false a reference
|
|
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(
|
|
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
|
|
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
|
|
501
|
-
*
|
|
502
|
-
*
|
|
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-
|
|
520
|
+
//# sourceMappingURL=types-DA9U9Z0N.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/plugin-msw",
|
|
3
|
-
"version": "4.18.
|
|
3
|
+
"version": "4.18.5",
|
|
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",
|
|
@@ -73,12 +73,12 @@
|
|
|
73
73
|
}
|
|
74
74
|
],
|
|
75
75
|
"dependencies": {
|
|
76
|
-
"@kubb/react-fabric": "0.
|
|
77
|
-
"@kubb/core": "4.18.
|
|
78
|
-
"@kubb/oas": "4.18.
|
|
79
|
-
"@kubb/plugin-faker": "4.18.
|
|
80
|
-
"@kubb/plugin-oas": "4.18.
|
|
81
|
-
"@kubb/plugin-ts": "4.18.
|
|
76
|
+
"@kubb/react-fabric": "0.12.4",
|
|
77
|
+
"@kubb/core": "4.18.5",
|
|
78
|
+
"@kubb/oas": "4.18.5",
|
|
79
|
+
"@kubb/plugin-faker": "4.18.5",
|
|
80
|
+
"@kubb/plugin-oas": "4.18.5",
|
|
81
|
+
"@kubb/plugin-ts": "4.18.5"
|
|
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
|
|
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
|
|
48
|
-
*
|
|
49
|
-
*
|
|
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'
|