@kubb/plugin-msw 4.3.0 → 4.4.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.
- package/dist/chunk-DMmIE7y6.js +28 -0
- package/dist/{components-zb0hoJri.js → components-C1RVylIl.js} +3 -3
- package/dist/components-C1RVylIl.js.map +1 -0
- package/dist/{components-K3TBkxEb.cjs → components-DhZ1MTrg.cjs} +15 -15
- package/dist/components-DhZ1MTrg.cjs.map +1 -0
- package/dist/components.cjs +1 -1
- package/dist/components.d.cts +5 -4
- package/dist/components.d.ts +6 -5
- package/dist/components.js +1 -1
- package/dist/{generators-DWokU4z5.js → generators-BvLpjRZi.js} +4 -4
- package/dist/generators-BvLpjRZi.js.map +1 -0
- package/dist/{generators-DpY1JzRC.cjs → generators-CNRKORe8.cjs} +17 -17
- package/dist/generators-CNRKORe8.cjs.map +1 -0
- package/dist/generators.cjs +2 -2
- package/dist/generators.d.cts +3 -3
- package/dist/generators.d.ts +4 -4
- package/dist/generators.js +2 -2
- package/dist/index.cjs +3 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/{types-CjM44aZF.d.cts → types-BXU1IBpt.d.cts} +204 -185
- package/dist/{types-CZEZAxGw.d.ts → types-Bd9L1DM6.d.ts} +210 -191
- package/dist/{types-IbHKcY02.d.ts → types-D0JuaurR.d.ts} +1 -1
- package/package.json +9 -9
- package/src/components/Handlers.tsx +3 -2
- package/src/components/Mock.tsx +3 -2
- package/src/components/MockWithFaker.tsx +3 -2
- package/src/components/Response.tsx +3 -2
- package/src/generators/handlersGenerator.tsx +1 -1
- package/src/generators/mswGenerator.tsx +1 -1
- package/src/plugin.ts +1 -0
- package/src/types.ts +1 -1
- package/dist/components-K3TBkxEb.cjs.map +0 -1
- package/dist/components-zb0hoJri.js.map +0 -1
- package/dist/generators-DWokU4z5.js.map +0 -1
- package/dist/generators-DpY1JzRC.cjs.map +0 -1
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { a as contentType, i as SchemaObject$1, n as OasTypes, r as Operation$1, t as HttpMethod } from "./types-
|
|
1
|
+
import { a as contentType, i as SchemaObject$1, n as OasTypes, r as Operation$1, t as HttpMethod } from "./types-D0JuaurR.js";
|
|
2
|
+
import { Fabric, FileManager } from "@kubb/react-fabric";
|
|
2
3
|
import { OASDocument, SchemaObject, User } from "oas/types";
|
|
3
4
|
import { Operation } from "oas/operation";
|
|
4
5
|
import { OpenAPIV3 } from "openapi-types";
|
|
5
6
|
import * as oas_normalize_lib_types0 from "oas-normalize/lib/types";
|
|
6
7
|
import BaseOas from "oas";
|
|
8
|
+
import { KubbNode } from "@kubb/react-fabric/types";
|
|
7
9
|
import { ConsolaInstance, LogLevel } from "consola";
|
|
8
|
-
import { FileManager } from "@kubb/fabric-core";
|
|
9
10
|
|
|
10
11
|
//#region ../oas/src/Oas.d.ts
|
|
11
12
|
type Options$3 = {
|
|
@@ -40,17 +41,17 @@ declare class Oas<const TOAS = unknown> extends BaseOas {
|
|
|
40
41
|
* Abstract class that contains the building blocks for plugins to create their own Generator
|
|
41
42
|
* @link idea based on https://github.com/colinhacks/zod/blob/master/src/types.ts#L137
|
|
42
43
|
*/
|
|
43
|
-
declare abstract class BaseGenerator<TOptions
|
|
44
|
+
declare abstract class BaseGenerator<TOptions = unknown, TContext = unknown> {
|
|
44
45
|
#private;
|
|
45
|
-
constructor(options?: TOptions
|
|
46
|
-
get options(): TOptions
|
|
46
|
+
constructor(options?: TOptions, context?: TContext);
|
|
47
|
+
get options(): TOptions;
|
|
47
48
|
get context(): TContext;
|
|
48
|
-
set options(options: TOptions
|
|
49
|
+
set options(options: TOptions);
|
|
49
50
|
abstract build(...params: unknown[]): unknown;
|
|
50
51
|
}
|
|
51
52
|
//#endregion
|
|
52
53
|
//#region ../core/src/fs/types.d.ts
|
|
53
|
-
type BasePath<T
|
|
54
|
+
type BasePath<T extends string = string> = `${T}/`;
|
|
54
55
|
type Import = {
|
|
55
56
|
/**
|
|
56
57
|
* Import name to be used
|
|
@@ -124,9 +125,9 @@ type BaseName = `${string}.${string}`;
|
|
|
124
125
|
* Path will be full qualified path to a specified file
|
|
125
126
|
*/
|
|
126
127
|
type Path = string;
|
|
127
|
-
type AdvancedPath<T
|
|
128
|
+
type AdvancedPath<T extends BaseName = BaseName> = `${BasePath}${T}`;
|
|
128
129
|
type OptionalPath = Path | undefined | null;
|
|
129
|
-
type File<TMeta extends object = object> = {
|
|
130
|
+
type File$1<TMeta extends object = object> = {
|
|
130
131
|
/**
|
|
131
132
|
* Name to be used to create the path
|
|
132
133
|
* Based on UNIX basename, `${name}.extname`
|
|
@@ -149,7 +150,7 @@ type File<TMeta extends object = object> = {
|
|
|
149
150
|
};
|
|
150
151
|
type ResolvedImport = Import;
|
|
151
152
|
type ResolvedExport = Export;
|
|
152
|
-
type ResolvedFile<TMeta extends object = object> = File<TMeta> & {
|
|
153
|
+
type ResolvedFile<TMeta extends object = object> = File$1<TMeta> & {
|
|
153
154
|
/**
|
|
154
155
|
* @default object-hash
|
|
155
156
|
*/
|
|
@@ -213,7 +214,7 @@ type Logger = {
|
|
|
213
214
|
};
|
|
214
215
|
//#endregion
|
|
215
216
|
//#region ../core/src/utils/types.d.ts
|
|
216
|
-
type PossiblePromise<T
|
|
217
|
+
type PossiblePromise<T> = Promise<T> | T;
|
|
217
218
|
//#endregion
|
|
218
219
|
//#region ../core/src/types.d.ts
|
|
219
220
|
type InputPath = {
|
|
@@ -326,11 +327,11 @@ TName extends string = string,
|
|
|
326
327
|
/**
|
|
327
328
|
* Options of the plugin.
|
|
328
329
|
*/
|
|
329
|
-
TOptions
|
|
330
|
+
TOptions extends object = object,
|
|
330
331
|
/**
|
|
331
332
|
* Options of the plugin that can be used later on, see `options` inside your plugin config.
|
|
332
333
|
*/
|
|
333
|
-
TResolvedOptions extends object = TOptions
|
|
334
|
+
TResolvedOptions extends object = TOptions,
|
|
334
335
|
/**
|
|
335
336
|
* Context that you want to expose to other plugins.
|
|
336
337
|
*/
|
|
@@ -344,23 +345,23 @@ TResolvePathOptions extends object = object> = {
|
|
|
344
345
|
* Same behaviour like what has been done with `QueryKey` in `@tanstack/react-query`
|
|
345
346
|
*/
|
|
346
347
|
key: PluginKey<TName | string>;
|
|
347
|
-
options: TOptions
|
|
348
|
+
options: TOptions;
|
|
348
349
|
resolvedOptions: TResolvedOptions;
|
|
349
350
|
context: TContext;
|
|
350
351
|
resolvePathOptions: TResolvePathOptions;
|
|
351
352
|
};
|
|
352
353
|
type PluginKey<TName> = [name: TName, identifier?: string | number];
|
|
353
|
-
type UserPlugin<TOptions
|
|
354
|
+
type UserPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
354
355
|
/**
|
|
355
356
|
* Unique name used for the plugin
|
|
356
357
|
* The name of the plugin follows the format scope:foo-bar or foo-bar, adding scope: can avoid naming conflicts with other plugins.
|
|
357
358
|
* @example @kubb/typescript
|
|
358
359
|
*/
|
|
359
|
-
name: TOptions
|
|
360
|
+
name: TOptions['name'];
|
|
360
361
|
/**
|
|
361
362
|
* Options set for a specific plugin(see kubb.config.js), passthrough of options.
|
|
362
363
|
*/
|
|
363
|
-
options: TOptions
|
|
364
|
+
options: TOptions['resolvedOptions'];
|
|
364
365
|
/**
|
|
365
366
|
* 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.
|
|
366
367
|
* Can be used to validate dependent plugins.
|
|
@@ -370,23 +371,23 @@ type UserPlugin<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions>
|
|
|
370
371
|
* 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.
|
|
371
372
|
*/
|
|
372
373
|
post?: Array<string>;
|
|
373
|
-
} & (TOptions
|
|
374
|
+
} & (TOptions['context'] extends never ? {
|
|
374
375
|
context?: never;
|
|
375
376
|
} : {
|
|
376
|
-
context: (this: TOptions
|
|
377
|
+
context: (this: TOptions['name'] extends 'core' ? null : Omit<PluginContext<TOptions>, 'addFile'>) => TOptions['context'];
|
|
377
378
|
});
|
|
378
|
-
type UserPluginWithLifeCycle<TOptions
|
|
379
|
-
type Plugin<TOptions
|
|
379
|
+
type UserPluginWithLifeCycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = UserPlugin<TOptions> & PluginLifecycle<TOptions>;
|
|
380
|
+
type Plugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
380
381
|
/**
|
|
381
382
|
* Unique name used for the plugin
|
|
382
383
|
* @example @kubb/typescript
|
|
383
384
|
*/
|
|
384
|
-
name: TOptions
|
|
385
|
+
name: TOptions['name'];
|
|
385
386
|
/**
|
|
386
387
|
* Internal key used when a developer uses more than one of the same plugin
|
|
387
388
|
* @private
|
|
388
389
|
*/
|
|
389
|
-
key: TOptions
|
|
390
|
+
key: TOptions['key'];
|
|
390
391
|
/**
|
|
391
392
|
* 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.
|
|
392
393
|
* Can be used to validate dependent plugins.
|
|
@@ -399,49 +400,49 @@ type Plugin<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
|
399
400
|
/**
|
|
400
401
|
* Options set for a specific plugin(see kubb.config.js), passthrough of options.
|
|
401
402
|
*/
|
|
402
|
-
options: TOptions
|
|
403
|
-
} & (TOptions
|
|
403
|
+
options: TOptions['resolvedOptions'];
|
|
404
|
+
} & (TOptions['context'] extends never ? {
|
|
404
405
|
context?: never;
|
|
405
406
|
} : {
|
|
406
|
-
context: TOptions
|
|
407
|
+
context: TOptions['context'];
|
|
407
408
|
});
|
|
408
|
-
type PluginWithLifeCycle<TOptions
|
|
409
|
-
type PluginLifecycle<TOptions
|
|
409
|
+
type PluginWithLifeCycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = Plugin<TOptions> & PluginLifecycle<TOptions>;
|
|
410
|
+
type PluginLifecycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
410
411
|
/**
|
|
411
412
|
* Start of the lifecycle of a plugin.
|
|
412
413
|
* @type hookParallel
|
|
413
414
|
*/
|
|
414
|
-
buildStart?: (this: PluginContext<TOptions
|
|
415
|
+
buildStart?: (this: PluginContext<TOptions>, Config: Config) => PossiblePromise<void>;
|
|
415
416
|
/**
|
|
416
417
|
* Resolve to a Path based on a baseName(example: `./Pet.ts`) and directory(example: `./models`).
|
|
417
418
|
* Options can als be included.
|
|
418
419
|
* @type hookFirst
|
|
419
420
|
* @example ('./Pet.ts', './src/gen/') => '/src/gen/Pet.ts'
|
|
420
421
|
*/
|
|
421
|
-
resolvePath?: (this: PluginContext<TOptions
|
|
422
|
+
resolvePath?: (this: PluginContext<TOptions>, baseName: BaseName, mode?: Mode, options?: TOptions['resolvePathOptions']) => OptionalPath;
|
|
422
423
|
/**
|
|
423
424
|
* Resolve to a name based on a string.
|
|
424
425
|
* Useful when converting to PascalCase or camelCase.
|
|
425
426
|
* @type hookFirst
|
|
426
427
|
* @example ('pet') => 'Pet'
|
|
427
428
|
*/
|
|
428
|
-
resolveName?: (this: PluginContext<TOptions
|
|
429
|
+
resolveName?: (this: PluginContext<TOptions>, name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
|
|
429
430
|
/**
|
|
430
431
|
* End of the plugin lifecycle.
|
|
431
432
|
* @type hookParallel
|
|
432
433
|
*/
|
|
433
|
-
buildEnd?: (this: PluginContext<TOptions
|
|
434
|
+
buildEnd?: (this: PluginContext<TOptions>) => PossiblePromise<void>;
|
|
434
435
|
};
|
|
435
436
|
type PluginLifecycleHooks = keyof PluginLifecycle;
|
|
436
|
-
type PluginParameter<H
|
|
437
|
-
type ResolvePathParams<TOptions
|
|
437
|
+
type PluginParameter<H extends PluginLifecycleHooks> = Parameters<Required<PluginLifecycle>[H]>;
|
|
438
|
+
type ResolvePathParams<TOptions = object> = {
|
|
438
439
|
pluginKey?: Plugin['key'];
|
|
439
440
|
baseName: BaseName;
|
|
440
441
|
mode?: Mode;
|
|
441
442
|
/**
|
|
442
443
|
* Options to be passed to 'resolvePath' 3th parameter
|
|
443
444
|
*/
|
|
444
|
-
options?: TOptions
|
|
445
|
+
options?: TOptions;
|
|
445
446
|
};
|
|
446
447
|
type ResolveNameParams = {
|
|
447
448
|
name: string;
|
|
@@ -454,15 +455,16 @@ type ResolveNameParams = {
|
|
|
454
455
|
*/
|
|
455
456
|
type?: 'file' | 'function' | 'type' | 'const';
|
|
456
457
|
};
|
|
457
|
-
type PluginContext<TOptions
|
|
458
|
+
type PluginContext<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
459
|
+
fabric: Fabric;
|
|
458
460
|
config: Config;
|
|
459
461
|
/**
|
|
460
462
|
* @deprecated
|
|
461
463
|
*/
|
|
462
464
|
fileManager: FileManager;
|
|
463
465
|
pluginManager: PluginManager;
|
|
464
|
-
addFile: (...file: Array<File>) => Promise<Array<ResolvedFile>>;
|
|
465
|
-
resolvePath: (params: ResolvePathParams<TOptions
|
|
466
|
+
addFile: (...file: Array<File$1>) => Promise<Array<ResolvedFile>>;
|
|
467
|
+
resolvePath: (params: ResolvePathParams<TOptions['resolvePathOptions']>) => OptionalPath;
|
|
466
468
|
resolveName: (params: ResolveNameParams) => string;
|
|
467
469
|
logger: Logger;
|
|
468
470
|
/**
|
|
@@ -472,12 +474,12 @@ type PluginContext<TOptions$1 extends PluginFactoryOptions = PluginFactoryOption
|
|
|
472
474
|
/**
|
|
473
475
|
* Current plugin
|
|
474
476
|
*/
|
|
475
|
-
plugin: Plugin<TOptions
|
|
477
|
+
plugin: Plugin<TOptions>;
|
|
476
478
|
};
|
|
477
479
|
/**
|
|
478
480
|
* Specify the export location for the files and define the behavior of the output
|
|
479
481
|
*/
|
|
480
|
-
type Output<TOptions
|
|
482
|
+
type Output<TOptions> = {
|
|
481
483
|
/**
|
|
482
484
|
* Path to the output folder or file that will contain the generated code
|
|
483
485
|
*/
|
|
@@ -490,11 +492,11 @@ type Output<TOptions$1> = {
|
|
|
490
492
|
/**
|
|
491
493
|
* Add a banner text in the beginning of every file
|
|
492
494
|
*/
|
|
493
|
-
banner?: string | ((options: TOptions
|
|
495
|
+
banner?: string | ((options: TOptions) => string);
|
|
494
496
|
/**
|
|
495
497
|
* Add a footer text in the beginning of every file
|
|
496
498
|
*/
|
|
497
|
-
footer?: string | ((options: TOptions
|
|
499
|
+
footer?: string | ((options: TOptions) => string);
|
|
498
500
|
};
|
|
499
501
|
type GroupContext = {
|
|
500
502
|
group: string;
|
|
@@ -513,20 +515,21 @@ type Group = {
|
|
|
513
515
|
//#region ../core/src/PluginManager.d.ts
|
|
514
516
|
type RequiredPluginLifecycle = Required<PluginLifecycle>;
|
|
515
517
|
type Strategy = 'hookFirst' | 'hookForPlugin' | 'hookParallel' | 'hookSeq';
|
|
516
|
-
type Executer<H
|
|
518
|
+
type Executer<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
|
|
517
519
|
message: string;
|
|
518
520
|
strategy: Strategy;
|
|
519
|
-
hookName: H
|
|
521
|
+
hookName: H;
|
|
520
522
|
plugin: Plugin;
|
|
521
523
|
parameters?: unknown[] | undefined;
|
|
522
524
|
output?: unknown;
|
|
523
525
|
};
|
|
524
|
-
type ParseResult<H
|
|
525
|
-
type SafeParseResult<H
|
|
526
|
+
type ParseResult<H extends PluginLifecycleHooks> = RequiredPluginLifecycle[H];
|
|
527
|
+
type SafeParseResult<H extends PluginLifecycleHooks, Result = ReturnType<ParseResult<H>>> = {
|
|
526
528
|
result: Result;
|
|
527
529
|
plugin: Plugin;
|
|
528
530
|
};
|
|
529
531
|
type Options$2 = {
|
|
532
|
+
fabric: Fabric;
|
|
530
533
|
logger: Logger;
|
|
531
534
|
/**
|
|
532
535
|
* @default Number.POSITIVE_INFINITY
|
|
@@ -538,20 +541,16 @@ type Events = {
|
|
|
538
541
|
executed: [executer: Executer];
|
|
539
542
|
error: [error: Error];
|
|
540
543
|
};
|
|
541
|
-
type GetFileProps<TOptions
|
|
544
|
+
type GetFileProps<TOptions = object> = {
|
|
542
545
|
name: string;
|
|
543
546
|
mode?: Mode;
|
|
544
547
|
extname: Extname;
|
|
545
548
|
pluginKey: Plugin['key'];
|
|
546
|
-
options?: TOptions
|
|
549
|
+
options?: TOptions;
|
|
547
550
|
};
|
|
548
551
|
declare class PluginManager {
|
|
549
552
|
#private;
|
|
550
553
|
readonly plugins: Set<Plugin<PluginFactoryOptions<string, object, object, any, object>>>;
|
|
551
|
-
/**
|
|
552
|
-
* @deprecated do not use from pluginManager
|
|
553
|
-
*/
|
|
554
|
-
readonly fileManager: FileManager;
|
|
555
554
|
readonly events: EventEmitter<Events>;
|
|
556
555
|
readonly config: Config;
|
|
557
556
|
readonly executed: Array<Executer>;
|
|
@@ -564,7 +563,7 @@ declare class PluginManager {
|
|
|
564
563
|
extname,
|
|
565
564
|
pluginKey,
|
|
566
565
|
options
|
|
567
|
-
}: GetFileProps<TOptions>): File<{
|
|
566
|
+
}: GetFileProps<TOptions>): File$1<{
|
|
568
567
|
pluginKey: Plugin['key'];
|
|
569
568
|
}>;
|
|
570
569
|
resolvePath: <TOptions = object>(params: ResolvePathParams<TOptions>) => OptionalPath;
|
|
@@ -664,6 +663,133 @@ type FileMetaBase = {
|
|
|
664
663
|
pluginKey?: Plugin['key'];
|
|
665
664
|
};
|
|
666
665
|
//#endregion
|
|
666
|
+
//#region ../plugin-oas/src/generators/createGenerator.d.ts
|
|
667
|
+
type CoreGenerator<TOptions extends PluginFactoryOptions> = {
|
|
668
|
+
name: string;
|
|
669
|
+
type: 'core';
|
|
670
|
+
operations: (props: OperationsProps<TOptions>) => Promise<File$1[]>;
|
|
671
|
+
operation: (props: OperationProps<TOptions>) => Promise<File$1[]>;
|
|
672
|
+
schema: (props: SchemaProps<TOptions>) => Promise<File$1[]>;
|
|
673
|
+
};
|
|
674
|
+
//#endregion
|
|
675
|
+
//#region ../plugin-oas/src/types.d.ts
|
|
676
|
+
type ResolvePathOptions = {
|
|
677
|
+
pluginKey?: Plugin['key'];
|
|
678
|
+
group?: {
|
|
679
|
+
tag?: string;
|
|
680
|
+
path?: string;
|
|
681
|
+
};
|
|
682
|
+
type?: ResolveNameParams['type'];
|
|
683
|
+
};
|
|
684
|
+
/**
|
|
685
|
+
* `propertyName` is the ref name + resolved with the nameResolver
|
|
686
|
+
* @example import { Pet } from './Pet'
|
|
687
|
+
*
|
|
688
|
+
* `originalName` is the original name used(in PascalCase), only used to remove duplicates
|
|
689
|
+
*
|
|
690
|
+
* `pluginKey` can be used to override the current plugin being used, handy when you want to import a type/schema out of another plugin
|
|
691
|
+
* @example import a type(plugin-ts) for a mock file(swagger-faker)
|
|
692
|
+
*/
|
|
693
|
+
type Ref = {
|
|
694
|
+
propertyName: string;
|
|
695
|
+
originalName: string;
|
|
696
|
+
path: OptionalPath;
|
|
697
|
+
pluginKey?: Plugin['key'];
|
|
698
|
+
};
|
|
699
|
+
type Refs = Record<string, Ref>;
|
|
700
|
+
type OperationSchema = {
|
|
701
|
+
/**
|
|
702
|
+
* Converted name, contains already `PathParams`, `QueryParams`, ...
|
|
703
|
+
*/
|
|
704
|
+
name: string;
|
|
705
|
+
schema: SchemaObject$1;
|
|
706
|
+
operation?: Operation$1;
|
|
707
|
+
/**
|
|
708
|
+
* OperationName in PascalCase, only being used in OperationGenerator
|
|
709
|
+
*/
|
|
710
|
+
operationName: string;
|
|
711
|
+
description?: string;
|
|
712
|
+
statusCode?: number;
|
|
713
|
+
keys?: string[];
|
|
714
|
+
keysToOmit?: string[];
|
|
715
|
+
withData?: boolean;
|
|
716
|
+
};
|
|
717
|
+
type OperationSchemas = {
|
|
718
|
+
pathParams?: OperationSchema & {
|
|
719
|
+
keysToOmit?: never;
|
|
720
|
+
};
|
|
721
|
+
queryParams?: OperationSchema & {
|
|
722
|
+
keysToOmit?: never;
|
|
723
|
+
};
|
|
724
|
+
headerParams?: OperationSchema & {
|
|
725
|
+
keysToOmit?: never;
|
|
726
|
+
};
|
|
727
|
+
request?: OperationSchema;
|
|
728
|
+
response: OperationSchema;
|
|
729
|
+
responses: Array<OperationSchema>;
|
|
730
|
+
statusCodes?: Array<OperationSchema>;
|
|
731
|
+
errors?: Array<OperationSchema>;
|
|
732
|
+
};
|
|
733
|
+
type ByTag = {
|
|
734
|
+
type: 'tag';
|
|
735
|
+
pattern: string | RegExp;
|
|
736
|
+
};
|
|
737
|
+
type ByOperationId = {
|
|
738
|
+
type: 'operationId';
|
|
739
|
+
pattern: string | RegExp;
|
|
740
|
+
};
|
|
741
|
+
type ByPath = {
|
|
742
|
+
type: 'path';
|
|
743
|
+
pattern: string | RegExp;
|
|
744
|
+
};
|
|
745
|
+
type ByMethod = {
|
|
746
|
+
type: 'method';
|
|
747
|
+
pattern: HttpMethod | RegExp;
|
|
748
|
+
};
|
|
749
|
+
type BySchemaName = {
|
|
750
|
+
type: 'schemaName';
|
|
751
|
+
pattern: string | RegExp;
|
|
752
|
+
};
|
|
753
|
+
type ByContentType = {
|
|
754
|
+
type: 'contentType';
|
|
755
|
+
pattern: string | RegExp;
|
|
756
|
+
};
|
|
757
|
+
type Exclude$1 = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
|
|
758
|
+
type Include = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
|
|
759
|
+
type Override<TOptions> = (ByTag | ByOperationId | ByPath | ByMethod | BySchemaName | ByContentType) & {
|
|
760
|
+
options: Partial<TOptions>;
|
|
761
|
+
};
|
|
762
|
+
//#endregion
|
|
763
|
+
//#region ../plugin-oas/src/OperationGenerator.d.ts
|
|
764
|
+
type Context$1<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
765
|
+
fabric: Fabric;
|
|
766
|
+
oas: Oas;
|
|
767
|
+
exclude: Array<Exclude$1> | undefined;
|
|
768
|
+
include: Array<Include> | undefined;
|
|
769
|
+
override: Array<Override<TOptions>> | undefined;
|
|
770
|
+
contentType: contentType | undefined;
|
|
771
|
+
pluginManager: PluginManager;
|
|
772
|
+
/**
|
|
773
|
+
* Current plugin
|
|
774
|
+
*/
|
|
775
|
+
plugin: Plugin<TPluginOptions>;
|
|
776
|
+
mode: Mode;
|
|
777
|
+
};
|
|
778
|
+
declare class OperationGenerator<TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TPluginOptions['resolvedOptions'], Context$1<TPluginOptions['resolvedOptions'], TPluginOptions>> {
|
|
779
|
+
#private;
|
|
780
|
+
getSchemas(operation: Operation$1, {
|
|
781
|
+
resolveName
|
|
782
|
+
}?: {
|
|
783
|
+
resolveName?: (name: string) => string;
|
|
784
|
+
}): OperationSchemas;
|
|
785
|
+
getOperations(): Promise<Array<{
|
|
786
|
+
path: string;
|
|
787
|
+
method: HttpMethod;
|
|
788
|
+
operation: Operation$1;
|
|
789
|
+
}>>;
|
|
790
|
+
build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<File$1<TFileMeta>>>;
|
|
791
|
+
}
|
|
792
|
+
//#endregion
|
|
667
793
|
//#region ../plugin-oas/src/SchemaMapper.d.ts
|
|
668
794
|
type SchemaKeywordMapper = {
|
|
669
795
|
object: {
|
|
@@ -881,96 +1007,9 @@ type Schema = {
|
|
|
881
1007
|
keyword: string;
|
|
882
1008
|
} | SchemaKeywordMapper[keyof SchemaKeywordMapper];
|
|
883
1009
|
//#endregion
|
|
884
|
-
//#region ../plugin-oas/src/types.d.ts
|
|
885
|
-
type ResolvePathOptions = {
|
|
886
|
-
pluginKey?: Plugin['key'];
|
|
887
|
-
group?: {
|
|
888
|
-
tag?: string;
|
|
889
|
-
path?: string;
|
|
890
|
-
};
|
|
891
|
-
type?: ResolveNameParams['type'];
|
|
892
|
-
};
|
|
893
|
-
/**
|
|
894
|
-
* `propertyName` is the ref name + resolved with the nameResolver
|
|
895
|
-
* @example import { Pet } from './Pet'
|
|
896
|
-
*
|
|
897
|
-
* `originalName` is the original name used(in PascalCase), only used to remove duplicates
|
|
898
|
-
*
|
|
899
|
-
* `pluginKey` can be used to override the current plugin being used, handy when you want to import a type/schema out of another plugin
|
|
900
|
-
* @example import a type(plugin-ts) for a mock file(swagger-faker)
|
|
901
|
-
*/
|
|
902
|
-
type Ref = {
|
|
903
|
-
propertyName: string;
|
|
904
|
-
originalName: string;
|
|
905
|
-
path: OptionalPath;
|
|
906
|
-
pluginKey?: Plugin['key'];
|
|
907
|
-
};
|
|
908
|
-
type Refs = Record<string, Ref>;
|
|
909
|
-
type OperationSchema = {
|
|
910
|
-
/**
|
|
911
|
-
* Converted name, contains already `PathParams`, `QueryParams`, ...
|
|
912
|
-
*/
|
|
913
|
-
name: string;
|
|
914
|
-
schema: SchemaObject$1;
|
|
915
|
-
operation?: Operation$1;
|
|
916
|
-
/**
|
|
917
|
-
* OperationName in PascalCase, only being used in OperationGenerator
|
|
918
|
-
*/
|
|
919
|
-
operationName: string;
|
|
920
|
-
description?: string;
|
|
921
|
-
statusCode?: number;
|
|
922
|
-
keys?: string[];
|
|
923
|
-
keysToOmit?: string[];
|
|
924
|
-
withData?: boolean;
|
|
925
|
-
};
|
|
926
|
-
type OperationSchemas = {
|
|
927
|
-
pathParams?: OperationSchema & {
|
|
928
|
-
keysToOmit?: never;
|
|
929
|
-
};
|
|
930
|
-
queryParams?: OperationSchema & {
|
|
931
|
-
keysToOmit?: never;
|
|
932
|
-
};
|
|
933
|
-
headerParams?: OperationSchema & {
|
|
934
|
-
keysToOmit?: never;
|
|
935
|
-
};
|
|
936
|
-
request?: OperationSchema;
|
|
937
|
-
response: OperationSchema;
|
|
938
|
-
responses: Array<OperationSchema>;
|
|
939
|
-
statusCodes?: Array<OperationSchema>;
|
|
940
|
-
errors?: Array<OperationSchema>;
|
|
941
|
-
};
|
|
942
|
-
type ByTag = {
|
|
943
|
-
type: 'tag';
|
|
944
|
-
pattern: string | RegExp;
|
|
945
|
-
};
|
|
946
|
-
type ByOperationId = {
|
|
947
|
-
type: 'operationId';
|
|
948
|
-
pattern: string | RegExp;
|
|
949
|
-
};
|
|
950
|
-
type ByPath = {
|
|
951
|
-
type: 'path';
|
|
952
|
-
pattern: string | RegExp;
|
|
953
|
-
};
|
|
954
|
-
type ByMethod = {
|
|
955
|
-
type: 'method';
|
|
956
|
-
pattern: HttpMethod | RegExp;
|
|
957
|
-
};
|
|
958
|
-
type BySchemaName = {
|
|
959
|
-
type: 'schemaName';
|
|
960
|
-
pattern: string | RegExp;
|
|
961
|
-
};
|
|
962
|
-
type ByContentType = {
|
|
963
|
-
type: 'contentType';
|
|
964
|
-
pattern: string | RegExp;
|
|
965
|
-
};
|
|
966
|
-
type Exclude$1 = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
|
|
967
|
-
type Include = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
|
|
968
|
-
type Override<TOptions$1> = (ByTag | ByOperationId | ByPath | ByMethod | BySchemaName | ByContentType) & {
|
|
969
|
-
options: Partial<TOptions$1>;
|
|
970
|
-
};
|
|
971
|
-
//#endregion
|
|
972
1010
|
//#region ../plugin-oas/src/SchemaGenerator.d.ts
|
|
973
|
-
type Context
|
|
1011
|
+
type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
1012
|
+
fabric: Fabric;
|
|
974
1013
|
oas: Oas;
|
|
975
1014
|
pluginManager: PluginManager;
|
|
976
1015
|
/**
|
|
@@ -979,7 +1018,7 @@ type Context$1<TOptions$1, TPluginOptions extends PluginFactoryOptions> = {
|
|
|
979
1018
|
plugin: Plugin<TPluginOptions>;
|
|
980
1019
|
mode: Mode;
|
|
981
1020
|
include?: Array<'schemas' | 'responses' | 'requestBodies'>;
|
|
982
|
-
override: Array<Override<TOptions
|
|
1021
|
+
override: Array<Override<TOptions>> | undefined;
|
|
983
1022
|
contentType?: contentType;
|
|
984
1023
|
output?: string;
|
|
985
1024
|
};
|
|
@@ -1010,7 +1049,7 @@ type SchemaProps$1 = {
|
|
|
1010
1049
|
name?: string;
|
|
1011
1050
|
parentName?: string;
|
|
1012
1051
|
};
|
|
1013
|
-
declare class SchemaGenerator<TOptions
|
|
1052
|
+
declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGeneratorOptions, TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TOptions, Context<TOptions, TPluginOptions>> {
|
|
1014
1053
|
#private;
|
|
1015
1054
|
refs: Refs;
|
|
1016
1055
|
/**
|
|
@@ -1025,65 +1064,45 @@ declare class SchemaGenerator<TOptions$1 extends SchemaGeneratorOptions = Schema
|
|
|
1025
1064
|
static findInObject<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
|
|
1026
1065
|
static find<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
|
|
1027
1066
|
static combineObjects(tree: Schema[] | undefined): Schema[];
|
|
1028
|
-
build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<File<TFileMeta>>>;
|
|
1067
|
+
build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<File$1<TFileMeta>>>;
|
|
1029
1068
|
}
|
|
1030
1069
|
//#endregion
|
|
1031
|
-
//#region ../plugin-oas/src/
|
|
1032
|
-
type OperationsProps<TOptions
|
|
1033
|
-
|
|
1034
|
-
|
|
1070
|
+
//#region ../plugin-oas/src/generators/types.d.ts
|
|
1071
|
+
type OperationsProps<TOptions extends PluginFactoryOptions> = {
|
|
1072
|
+
/**
|
|
1073
|
+
* @deprecated
|
|
1074
|
+
*/
|
|
1075
|
+
instance: Omit<OperationGenerator<TOptions>, 'build'>;
|
|
1076
|
+
options: TOptions['resolvedOptions'];
|
|
1035
1077
|
operations: Array<Operation$1>;
|
|
1036
1078
|
};
|
|
1037
|
-
type OperationProps<TOptions
|
|
1038
|
-
|
|
1039
|
-
|
|
1079
|
+
type OperationProps<TOptions extends PluginFactoryOptions> = {
|
|
1080
|
+
/**
|
|
1081
|
+
* @deprecated
|
|
1082
|
+
*/
|
|
1083
|
+
instance: Omit<OperationGenerator<TOptions>, 'build'>;
|
|
1084
|
+
options: TOptions['resolvedOptions'];
|
|
1040
1085
|
operation: Operation$1;
|
|
1041
1086
|
};
|
|
1042
|
-
type SchemaProps<TOptions
|
|
1043
|
-
instance: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions
|
|
1044
|
-
options: TOptions
|
|
1087
|
+
type SchemaProps<TOptions extends PluginFactoryOptions> = {
|
|
1088
|
+
instance: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions>, 'build'>;
|
|
1089
|
+
options: TOptions['resolvedOptions'];
|
|
1045
1090
|
schema: {
|
|
1046
1091
|
name: string;
|
|
1047
1092
|
tree: Array<Schema>;
|
|
1048
1093
|
value: SchemaObject$1;
|
|
1049
1094
|
};
|
|
1050
1095
|
};
|
|
1051
|
-
type
|
|
1052
|
-
name: string;
|
|
1053
|
-
operations?: (this: GeneratorOptions<TOptions$1>, props: OperationsProps<TOptions$1>) => Promise<File[]>;
|
|
1054
|
-
operation?: (this: GeneratorOptions<TOptions$1>, props: OperationProps<TOptions$1>) => Promise<File[]>;
|
|
1055
|
-
schema?: (this: GeneratorOptions<TOptions$1>, props: SchemaProps<TOptions$1>) => Promise<File[]>;
|
|
1056
|
-
};
|
|
1057
|
-
type Generator<TOptions$1 extends PluginFactoryOptions> = GeneratorOptions<TOptions$1>;
|
|
1096
|
+
type Generator<TOptions extends PluginFactoryOptions> = CoreGenerator<TOptions> | ReactGenerator<TOptions>;
|
|
1058
1097
|
//#endregion
|
|
1059
|
-
//#region ../plugin-oas/src/
|
|
1060
|
-
type
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
pluginManager: PluginManager;
|
|
1067
|
-
/**
|
|
1068
|
-
* Current plugin
|
|
1069
|
-
*/
|
|
1070
|
-
plugin: Plugin<TPluginOptions>;
|
|
1071
|
-
mode: Mode;
|
|
1098
|
+
//#region ../plugin-oas/src/generators/createReactGenerator.d.ts
|
|
1099
|
+
type ReactGenerator<TOptions extends PluginFactoryOptions> = {
|
|
1100
|
+
name: string;
|
|
1101
|
+
type: 'react';
|
|
1102
|
+
Operations: (props: OperationsProps<TOptions>) => KubbNode;
|
|
1103
|
+
Operation: (props: OperationProps<TOptions>) => KubbNode;
|
|
1104
|
+
Schema: (props: SchemaProps<TOptions>) => KubbNode;
|
|
1072
1105
|
};
|
|
1073
|
-
declare class OperationGenerator<TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TPluginOptions['resolvedOptions'], Context<TPluginOptions['resolvedOptions'], TPluginOptions>> {
|
|
1074
|
-
#private;
|
|
1075
|
-
getSchemas(operation: Operation$1, {
|
|
1076
|
-
resolveName
|
|
1077
|
-
}?: {
|
|
1078
|
-
resolveName?: (name: string) => string;
|
|
1079
|
-
}): OperationSchemas;
|
|
1080
|
-
getOperations(): Promise<Array<{
|
|
1081
|
-
path: string;
|
|
1082
|
-
method: HttpMethod;
|
|
1083
|
-
operation: Operation$1;
|
|
1084
|
-
}>>;
|
|
1085
|
-
build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<File<TFileMeta>>>;
|
|
1086
|
-
}
|
|
1087
1106
|
//#endregion
|
|
1088
1107
|
//#region src/types.d.ts
|
|
1089
1108
|
type Options$1 = {
|
|
@@ -1145,5 +1164,5 @@ type ResolvedOptions = {
|
|
|
1145
1164
|
};
|
|
1146
1165
|
type PluginMsw = PluginFactoryOptions<'plugin-msw', Options$1, ResolvedOptions, never, ResolvePathOptions>;
|
|
1147
1166
|
//#endregion
|
|
1148
|
-
export { UserPluginWithLifeCycle as i, PluginMsw as n,
|
|
1149
|
-
//# sourceMappingURL=types-
|
|
1167
|
+
export { UserPluginWithLifeCycle as i, PluginMsw as n, ReactGenerator as r, Options$1 as t };
|
|
1168
|
+
//# sourceMappingURL=types-Bd9L1DM6.d.ts.map
|