@kubb/plugin-msw 4.5.1 → 4.5.2
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/{types-DSnvepCr.d.ts → index-DR442nn_.d.cts} +51 -542
- package/dist/{types-C9Jm40mM.d.cts → index-DvEPuQDh.d.ts} +51 -542
- package/dist/index.cjs +4 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +5 -6
- package/dist/index.js.map +1 -1
- package/dist/types-DpAB0bEq.d.cts +511 -0
- package/dist/types-Y4PSmxId.d.ts +511 -0
- package/package.json +8 -8
- package/src/plugin.ts +5 -8
- package/dist/types-8ZXwr93_.d.cts +0 -13
- package/dist/types-D0JuaurR.d.ts +0 -13
|
@@ -1,16 +1,22 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { OASDocument, SchemaObject, User } from "oas/types";
|
|
5
|
-
import { Operation } from "oas/operation";
|
|
1
|
+
import * as OasTypes from "oas/types";
|
|
2
|
+
import { HttpMethods as HttpMethod, OASDocument, SchemaObject, User } from "oas/types";
|
|
3
|
+
import { Operation, Operation as Operation$1 } from "oas/operation";
|
|
6
4
|
import { OpenAPIV3 } from "openapi-types";
|
|
7
5
|
import * as oas_normalize_lib_types0 from "oas-normalize/lib/types";
|
|
8
6
|
import BaseOas from "oas";
|
|
9
7
|
import { KubbFile } from "@kubb/fabric-core/types";
|
|
8
|
+
import { Fabric } from "@kubb/react-fabric";
|
|
10
9
|
import { ConsolaInstance, LogLevel } from "consola";
|
|
11
10
|
|
|
11
|
+
//#region ../oas/src/types.d.ts
|
|
12
|
+
type contentType = 'application/json' | (string & {});
|
|
13
|
+
type SchemaObject$1 = OasTypes.SchemaObject & {
|
|
14
|
+
'x-nullable'?: boolean;
|
|
15
|
+
$ref?: string;
|
|
16
|
+
};
|
|
17
|
+
//#endregion
|
|
12
18
|
//#region ../oas/src/Oas.d.ts
|
|
13
|
-
type Options$
|
|
19
|
+
type Options$1 = {
|
|
14
20
|
contentType?: contentType;
|
|
15
21
|
discriminator?: 'strict' | 'inherit';
|
|
16
22
|
};
|
|
@@ -24,8 +30,8 @@ declare class Oas<const TOAS = unknown> extends BaseOas {
|
|
|
24
30
|
oas: TOAS | OASDocument | string;
|
|
25
31
|
user?: User;
|
|
26
32
|
});
|
|
27
|
-
setOptions(options: Options$
|
|
28
|
-
get options(): Options$
|
|
33
|
+
setOptions(options: Options$1): void;
|
|
34
|
+
get options(): Options$1;
|
|
29
35
|
get($ref: string): any;
|
|
30
36
|
getKey($ref: string): string | undefined;
|
|
31
37
|
set($ref: string, value: unknown): false | undefined;
|
|
@@ -103,6 +109,21 @@ type Logger = {
|
|
|
103
109
|
type PossiblePromise<T> = Promise<T> | T;
|
|
104
110
|
//#endregion
|
|
105
111
|
//#region ../core/src/types.d.ts
|
|
112
|
+
declare global {
|
|
113
|
+
namespace Kubb {
|
|
114
|
+
interface PluginContext {}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Config used in `kubb.config.ts`
|
|
119
|
+
*
|
|
120
|
+
* @example
|
|
121
|
+
* import { defineConfig } from '@kubb/core'
|
|
122
|
+
* export default defineConfig({
|
|
123
|
+
* ...
|
|
124
|
+
* })
|
|
125
|
+
*/
|
|
126
|
+
|
|
106
127
|
type InputPath = {
|
|
107
128
|
/**
|
|
108
129
|
* Specify your Swagger/OpenAPI file, either as an absolute path or a path relative to the root.
|
|
@@ -257,11 +278,8 @@ type UserPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> =
|
|
|
257
278
|
* 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.
|
|
258
279
|
*/
|
|
259
280
|
post?: Array<string>;
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
} : {
|
|
263
|
-
context: (this: TOptions['name'] extends 'core' ? null : Omit<PluginContext<TOptions>, 'addFile'>) => TOptions['context'];
|
|
264
|
-
});
|
|
281
|
+
inject?: (this: PluginContext<TOptions>, context: PluginContext<TOptions>) => TOptions['context'];
|
|
282
|
+
};
|
|
265
283
|
type UserPluginWithLifeCycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = UserPlugin<TOptions> & PluginLifecycle<TOptions>;
|
|
266
284
|
type Plugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
267
285
|
/**
|
|
@@ -287,25 +305,26 @@ type Plugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
|
287
305
|
* Options set for a specific plugin(see kubb.config.js), passthrough of options.
|
|
288
306
|
*/
|
|
289
307
|
options: TOptions['resolvedOptions'];
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
308
|
+
install: (this: PluginContext<TOptions>, context: PluginContext<TOptions>) => PossiblePromise<void>;
|
|
309
|
+
/**
|
|
310
|
+
* Define a context that can be used by other plugins, see `PluginManager' where we convert from `UserPlugin` to `Plugin`(used when calling `definePlugin`).
|
|
311
|
+
*/
|
|
312
|
+
inject: (this: PluginContext<TOptions>, context: PluginContext<TOptions>) => TOptions['context'];
|
|
313
|
+
};
|
|
295
314
|
type PluginWithLifeCycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = Plugin<TOptions> & PluginLifecycle<TOptions>;
|
|
296
315
|
type PluginLifecycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
297
316
|
/**
|
|
298
317
|
* Start of the lifecycle of a plugin.
|
|
299
318
|
* @type hookParallel
|
|
300
319
|
*/
|
|
301
|
-
|
|
320
|
+
install?: (this: PluginContext<TOptions>, context: PluginContext<TOptions>) => PossiblePromise<void>;
|
|
302
321
|
/**
|
|
303
322
|
* Resolve to a Path based on a baseName(example: `./Pet.ts`) and directory(example: `./models`).
|
|
304
323
|
* Options can als be included.
|
|
305
324
|
* @type hookFirst
|
|
306
325
|
* @example ('./Pet.ts', './src/gen/') => '/src/gen/Pet.ts'
|
|
307
326
|
*/
|
|
308
|
-
resolvePath?: (this: PluginContext<TOptions>, baseName: KubbFile.BaseName, mode?: KubbFile.Mode, options?: TOptions['resolvePathOptions']) => KubbFile.
|
|
327
|
+
resolvePath?: (this: PluginContext<TOptions>, baseName: KubbFile.BaseName, mode?: KubbFile.Mode, options?: TOptions['resolvePathOptions']) => KubbFile.Path;
|
|
309
328
|
/**
|
|
310
329
|
* Resolve to a name based on a string.
|
|
311
330
|
* Useful when converting to PascalCase or camelCase.
|
|
@@ -313,11 +332,6 @@ type PluginLifecycle<TOptions extends PluginFactoryOptions = PluginFactoryOption
|
|
|
313
332
|
* @example ('pet') => 'Pet'
|
|
314
333
|
*/
|
|
315
334
|
resolveName?: (this: PluginContext<TOptions>, name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
|
|
316
|
-
/**
|
|
317
|
-
* End of the plugin lifecycle.
|
|
318
|
-
* @type hookParallel
|
|
319
|
-
*/
|
|
320
|
-
buildEnd?: (this: PluginContext<TOptions>) => PossiblePromise<void>;
|
|
321
335
|
};
|
|
322
336
|
type PluginLifecycleHooks = keyof PluginLifecycle;
|
|
323
337
|
type PluginParameter<H extends PluginLifecycleHooks> = Parameters<Required<PluginLifecycle>[H]>;
|
|
@@ -344,24 +358,15 @@ type ResolveNameParams = {
|
|
|
344
358
|
type PluginContext<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
345
359
|
fabric: Fabric;
|
|
346
360
|
config: Config;
|
|
347
|
-
/**
|
|
348
|
-
* @deprecated
|
|
349
|
-
*/
|
|
350
|
-
fileManager: FileManager;
|
|
351
361
|
pluginManager: PluginManager;
|
|
352
|
-
addFile: (...file: Array<KubbFile.File>) => Promise<
|
|
353
|
-
resolvePath: (params: ResolvePathParams<TOptions['resolvePathOptions']>) => KubbFile.OptionalPath;
|
|
354
|
-
resolveName: (params: ResolveNameParams) => string;
|
|
362
|
+
addFile: (...file: Array<KubbFile.File>) => Promise<void>;
|
|
355
363
|
logger: Logger;
|
|
356
|
-
|
|
357
|
-
* All plugins
|
|
358
|
-
*/
|
|
359
|
-
plugins: Plugin[];
|
|
364
|
+
mode: KubbFile.Mode;
|
|
360
365
|
/**
|
|
361
366
|
* Current plugin
|
|
362
367
|
*/
|
|
363
368
|
plugin: Plugin<TOptions>;
|
|
364
|
-
};
|
|
369
|
+
} & Kubb.PluginContext;
|
|
365
370
|
/**
|
|
366
371
|
* Specify the export location for the files and define the behavior of the output
|
|
367
372
|
*/
|
|
@@ -414,7 +419,7 @@ type SafeParseResult<H extends PluginLifecycleHooks, Result = ReturnType<ParseRe
|
|
|
414
419
|
result: Result;
|
|
415
420
|
plugin: Plugin;
|
|
416
421
|
};
|
|
417
|
-
type Options
|
|
422
|
+
type Options = {
|
|
418
423
|
fabric: Fabric;
|
|
419
424
|
logger: Logger;
|
|
420
425
|
/**
|
|
@@ -436,13 +441,14 @@ type GetFileProps<TOptions = object> = {
|
|
|
436
441
|
};
|
|
437
442
|
declare class PluginManager {
|
|
438
443
|
#private;
|
|
439
|
-
readonly plugins: Set<Plugin<PluginFactoryOptions<string, object, object, any, object>>>;
|
|
440
444
|
readonly events: EventEmitter<Events>;
|
|
441
445
|
readonly config: Config;
|
|
442
446
|
readonly executed: Array<Executer>;
|
|
443
447
|
readonly logger: Logger;
|
|
444
|
-
readonly options: Options
|
|
445
|
-
constructor(config: Config, options: Options
|
|
448
|
+
readonly options: Options;
|
|
449
|
+
constructor(config: Config, options: Options);
|
|
450
|
+
getContext<TOptions extends PluginFactoryOptions>(plugin: Plugin<TOptions>): PluginContext<TOptions> & Record<string, any>;
|
|
451
|
+
get plugins(): Array<Plugin>;
|
|
446
452
|
getFile<TOptions = object>({
|
|
447
453
|
name,
|
|
448
454
|
mode,
|
|
@@ -452,7 +458,7 @@ declare class PluginManager {
|
|
|
452
458
|
}: GetFileProps<TOptions>): KubbFile.File<{
|
|
453
459
|
pluginKey: Plugin['key'];
|
|
454
460
|
}>;
|
|
455
|
-
resolvePath: <TOptions = object>(params: ResolvePathParams<TOptions>) => KubbFile.
|
|
461
|
+
resolvePath: <TOptions = object>(params: ResolvePathParams<TOptions>) => KubbFile.Path;
|
|
456
462
|
resolveName: (params: ResolveNameParams) => string;
|
|
457
463
|
/**
|
|
458
464
|
* Instead of calling `pluginManager.events.on` you can use `pluginManager.on`. This one also has better types.
|
|
@@ -540,509 +546,12 @@ declare class PluginManager {
|
|
|
540
546
|
}): Promise<void>;
|
|
541
547
|
getPluginByKey(pluginKey: Plugin['key']): Plugin | undefined;
|
|
542
548
|
getPluginsByKey(hookName: keyof PluginWithLifeCycle, pluginKey: Plugin['key']): Plugin[];
|
|
543
|
-
static getDependedPlugins<T1 extends PluginFactoryOptions, T2 extends PluginFactoryOptions = never, T3 extends PluginFactoryOptions = never, TOutput = (T3 extends never ? (T2 extends never ? [T1: Plugin<T1>] : [T1: Plugin<T1>, T2: Plugin<T2>]) : [T1: Plugin<T1>, T2: Plugin<T2>, T3: Plugin<T3>])>(plugins: Array<Plugin>, dependedPluginNames: string | string[]): TOutput;
|
|
544
|
-
static get hooks(): readonly ["buildStart", "resolvePath", "resolveName", "buildEnd"];
|
|
545
549
|
}
|
|
546
550
|
//#endregion
|
|
547
|
-
//#region ../core/src/
|
|
551
|
+
//#region ../core/src/utils/getBarrelFiles.d.ts
|
|
548
552
|
type FileMetaBase = {
|
|
549
553
|
pluginKey?: Plugin['key'];
|
|
550
554
|
};
|
|
551
555
|
//#endregion
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
pluginKey?: Plugin['key'];
|
|
555
|
-
group?: {
|
|
556
|
-
tag?: string;
|
|
557
|
-
path?: string;
|
|
558
|
-
};
|
|
559
|
-
type?: ResolveNameParams['type'];
|
|
560
|
-
};
|
|
561
|
-
/**
|
|
562
|
-
* `propertyName` is the ref name + resolved with the nameResolver
|
|
563
|
-
* @example import { Pet } from './Pet'
|
|
564
|
-
*
|
|
565
|
-
* `originalName` is the original name used(in PascalCase), only used to remove duplicates
|
|
566
|
-
*
|
|
567
|
-
* `pluginKey` can be used to override the current plugin being used, handy when you want to import a type/schema out of another plugin
|
|
568
|
-
* @example import a type(plugin-ts) for a mock file(swagger-faker)
|
|
569
|
-
*/
|
|
570
|
-
type Ref = {
|
|
571
|
-
propertyName: string;
|
|
572
|
-
originalName: string;
|
|
573
|
-
path: KubbFile.OptionalPath;
|
|
574
|
-
pluginKey?: Plugin['key'];
|
|
575
|
-
};
|
|
576
|
-
type Refs = Record<string, Ref>;
|
|
577
|
-
type OperationSchema = {
|
|
578
|
-
/**
|
|
579
|
-
* Converted name, contains already `PathParams`, `QueryParams`, ...
|
|
580
|
-
*/
|
|
581
|
-
name: string;
|
|
582
|
-
schema: SchemaObject$1;
|
|
583
|
-
operation?: Operation$1;
|
|
584
|
-
/**
|
|
585
|
-
* OperationName in PascalCase, only being used in OperationGenerator
|
|
586
|
-
*/
|
|
587
|
-
operationName: string;
|
|
588
|
-
description?: string;
|
|
589
|
-
statusCode?: number;
|
|
590
|
-
keys?: string[];
|
|
591
|
-
keysToOmit?: string[];
|
|
592
|
-
withData?: boolean;
|
|
593
|
-
};
|
|
594
|
-
type OperationSchemas = {
|
|
595
|
-
pathParams?: OperationSchema & {
|
|
596
|
-
keysToOmit?: never;
|
|
597
|
-
};
|
|
598
|
-
queryParams?: OperationSchema & {
|
|
599
|
-
keysToOmit?: never;
|
|
600
|
-
};
|
|
601
|
-
headerParams?: OperationSchema & {
|
|
602
|
-
keysToOmit?: never;
|
|
603
|
-
};
|
|
604
|
-
request?: OperationSchema;
|
|
605
|
-
response: OperationSchema;
|
|
606
|
-
responses: Array<OperationSchema>;
|
|
607
|
-
statusCodes?: Array<OperationSchema>;
|
|
608
|
-
errors?: Array<OperationSchema>;
|
|
609
|
-
};
|
|
610
|
-
type ByTag = {
|
|
611
|
-
type: 'tag';
|
|
612
|
-
pattern: string | RegExp;
|
|
613
|
-
};
|
|
614
|
-
type ByOperationId = {
|
|
615
|
-
type: 'operationId';
|
|
616
|
-
pattern: string | RegExp;
|
|
617
|
-
};
|
|
618
|
-
type ByPath = {
|
|
619
|
-
type: 'path';
|
|
620
|
-
pattern: string | RegExp;
|
|
621
|
-
};
|
|
622
|
-
type ByMethod = {
|
|
623
|
-
type: 'method';
|
|
624
|
-
pattern: HttpMethod | RegExp;
|
|
625
|
-
};
|
|
626
|
-
type BySchemaName = {
|
|
627
|
-
type: 'schemaName';
|
|
628
|
-
pattern: string | RegExp;
|
|
629
|
-
};
|
|
630
|
-
type ByContentType = {
|
|
631
|
-
type: 'contentType';
|
|
632
|
-
pattern: string | RegExp;
|
|
633
|
-
};
|
|
634
|
-
type Exclude$1 = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
|
|
635
|
-
type Include = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
|
|
636
|
-
type Override<TOptions> = (ByTag | ByOperationId | ByPath | ByMethod | BySchemaName | ByContentType) & {
|
|
637
|
-
options: Partial<TOptions>;
|
|
638
|
-
};
|
|
639
|
-
//#endregion
|
|
640
|
-
//#region ../plugin-oas/src/OperationGenerator.d.ts
|
|
641
|
-
type Context$1<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
642
|
-
fabric: Fabric;
|
|
643
|
-
oas: Oas;
|
|
644
|
-
exclude: Array<Exclude$1> | undefined;
|
|
645
|
-
include: Array<Include> | undefined;
|
|
646
|
-
override: Array<Override<TOptions>> | undefined;
|
|
647
|
-
contentType: contentType | undefined;
|
|
648
|
-
pluginManager: PluginManager;
|
|
649
|
-
/**
|
|
650
|
-
* Current plugin
|
|
651
|
-
*/
|
|
652
|
-
plugin: Plugin<TPluginOptions>;
|
|
653
|
-
mode: KubbFile.Mode;
|
|
654
|
-
};
|
|
655
|
-
declare class OperationGenerator<TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TPluginOptions['resolvedOptions'], Context$1<TPluginOptions['resolvedOptions'], TPluginOptions>> {
|
|
656
|
-
#private;
|
|
657
|
-
getSchemas(operation: Operation$1, {
|
|
658
|
-
resolveName
|
|
659
|
-
}?: {
|
|
660
|
-
resolveName?: (name: string) => string;
|
|
661
|
-
}): OperationSchemas;
|
|
662
|
-
getOperations(): Promise<Array<{
|
|
663
|
-
path: string;
|
|
664
|
-
method: HttpMethod;
|
|
665
|
-
operation: Operation$1;
|
|
666
|
-
}>>;
|
|
667
|
-
build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
|
|
668
|
-
}
|
|
669
|
-
//#endregion
|
|
670
|
-
//#region ../plugin-oas/src/SchemaMapper.d.ts
|
|
671
|
-
type SchemaKeywordMapper = {
|
|
672
|
-
object: {
|
|
673
|
-
keyword: 'object';
|
|
674
|
-
args: {
|
|
675
|
-
properties: {
|
|
676
|
-
[x: string]: Schema[];
|
|
677
|
-
};
|
|
678
|
-
additionalProperties: Schema[];
|
|
679
|
-
strict?: boolean;
|
|
680
|
-
};
|
|
681
|
-
};
|
|
682
|
-
url: {
|
|
683
|
-
keyword: 'url';
|
|
684
|
-
};
|
|
685
|
-
readOnly: {
|
|
686
|
-
keyword: 'readOnly';
|
|
687
|
-
};
|
|
688
|
-
writeOnly: {
|
|
689
|
-
keyword: 'writeOnly';
|
|
690
|
-
};
|
|
691
|
-
uuid: {
|
|
692
|
-
keyword: 'uuid';
|
|
693
|
-
};
|
|
694
|
-
email: {
|
|
695
|
-
keyword: 'email';
|
|
696
|
-
};
|
|
697
|
-
firstName: {
|
|
698
|
-
keyword: 'firstName';
|
|
699
|
-
};
|
|
700
|
-
lastName: {
|
|
701
|
-
keyword: 'lastName';
|
|
702
|
-
};
|
|
703
|
-
phone: {
|
|
704
|
-
keyword: 'phone';
|
|
705
|
-
};
|
|
706
|
-
password: {
|
|
707
|
-
keyword: 'password';
|
|
708
|
-
};
|
|
709
|
-
date: {
|
|
710
|
-
keyword: 'date';
|
|
711
|
-
args: {
|
|
712
|
-
type?: 'date' | 'string';
|
|
713
|
-
};
|
|
714
|
-
};
|
|
715
|
-
time: {
|
|
716
|
-
keyword: 'time';
|
|
717
|
-
args: {
|
|
718
|
-
type?: 'date' | 'string';
|
|
719
|
-
};
|
|
720
|
-
};
|
|
721
|
-
datetime: {
|
|
722
|
-
keyword: 'datetime';
|
|
723
|
-
args: {
|
|
724
|
-
offset?: boolean;
|
|
725
|
-
local?: boolean;
|
|
726
|
-
};
|
|
727
|
-
};
|
|
728
|
-
tuple: {
|
|
729
|
-
keyword: 'tuple';
|
|
730
|
-
args: {
|
|
731
|
-
items: Schema[];
|
|
732
|
-
min?: number;
|
|
733
|
-
max?: number;
|
|
734
|
-
rest?: Schema;
|
|
735
|
-
};
|
|
736
|
-
};
|
|
737
|
-
array: {
|
|
738
|
-
keyword: 'array';
|
|
739
|
-
args: {
|
|
740
|
-
items: Schema[];
|
|
741
|
-
min?: number;
|
|
742
|
-
max?: number;
|
|
743
|
-
unique?: boolean;
|
|
744
|
-
};
|
|
745
|
-
};
|
|
746
|
-
enum: {
|
|
747
|
-
keyword: 'enum';
|
|
748
|
-
args: {
|
|
749
|
-
name: string;
|
|
750
|
-
typeName: string;
|
|
751
|
-
asConst: boolean;
|
|
752
|
-
items: Array<{
|
|
753
|
-
name: string | number;
|
|
754
|
-
format: 'string' | 'number' | 'boolean';
|
|
755
|
-
value?: string | number | boolean;
|
|
756
|
-
}>;
|
|
757
|
-
};
|
|
758
|
-
};
|
|
759
|
-
and: {
|
|
760
|
-
keyword: 'and';
|
|
761
|
-
args: Schema[];
|
|
762
|
-
};
|
|
763
|
-
const: {
|
|
764
|
-
keyword: 'const';
|
|
765
|
-
args: {
|
|
766
|
-
name: string | number;
|
|
767
|
-
format: 'string' | 'number' | 'boolean';
|
|
768
|
-
value?: string | number | boolean;
|
|
769
|
-
};
|
|
770
|
-
};
|
|
771
|
-
union: {
|
|
772
|
-
keyword: 'union';
|
|
773
|
-
args: Schema[];
|
|
774
|
-
};
|
|
775
|
-
ref: {
|
|
776
|
-
keyword: 'ref';
|
|
777
|
-
args: {
|
|
778
|
-
name: string;
|
|
779
|
-
$ref: string;
|
|
780
|
-
/**
|
|
781
|
-
* Full qualified path.
|
|
782
|
-
*/
|
|
783
|
-
path: KubbFile.OptionalPath;
|
|
784
|
-
/**
|
|
785
|
-
* When true `File.Import` will be used.
|
|
786
|
-
* When false a reference will be used inside the current file.
|
|
787
|
-
*/
|
|
788
|
-
isImportable: boolean;
|
|
789
|
-
};
|
|
790
|
-
};
|
|
791
|
-
matches: {
|
|
792
|
-
keyword: 'matches';
|
|
793
|
-
args?: string;
|
|
794
|
-
};
|
|
795
|
-
boolean: {
|
|
796
|
-
keyword: 'boolean';
|
|
797
|
-
};
|
|
798
|
-
default: {
|
|
799
|
-
keyword: 'default';
|
|
800
|
-
args: string | number | boolean;
|
|
801
|
-
};
|
|
802
|
-
string: {
|
|
803
|
-
keyword: 'string';
|
|
804
|
-
};
|
|
805
|
-
integer: {
|
|
806
|
-
keyword: 'integer';
|
|
807
|
-
};
|
|
808
|
-
number: {
|
|
809
|
-
keyword: 'number';
|
|
810
|
-
};
|
|
811
|
-
max: {
|
|
812
|
-
keyword: 'max';
|
|
813
|
-
args: number;
|
|
814
|
-
};
|
|
815
|
-
min: {
|
|
816
|
-
keyword: 'min';
|
|
817
|
-
args: number;
|
|
818
|
-
};
|
|
819
|
-
exclusiveMaximum: {
|
|
820
|
-
keyword: 'exclusiveMaximum';
|
|
821
|
-
args: number;
|
|
822
|
-
};
|
|
823
|
-
exclusiveMinimum: {
|
|
824
|
-
keyword: 'exclusiveMinimum';
|
|
825
|
-
args: number;
|
|
826
|
-
};
|
|
827
|
-
describe: {
|
|
828
|
-
keyword: 'describe';
|
|
829
|
-
args: string;
|
|
830
|
-
};
|
|
831
|
-
example: {
|
|
832
|
-
keyword: 'example';
|
|
833
|
-
args: string;
|
|
834
|
-
};
|
|
835
|
-
deprecated: {
|
|
836
|
-
keyword: 'deprecated';
|
|
837
|
-
};
|
|
838
|
-
optional: {
|
|
839
|
-
keyword: 'optional';
|
|
840
|
-
};
|
|
841
|
-
undefined: {
|
|
842
|
-
keyword: 'undefined';
|
|
843
|
-
};
|
|
844
|
-
nullish: {
|
|
845
|
-
keyword: 'nullish';
|
|
846
|
-
};
|
|
847
|
-
nullable: {
|
|
848
|
-
keyword: 'nullable';
|
|
849
|
-
};
|
|
850
|
-
null: {
|
|
851
|
-
keyword: 'null';
|
|
852
|
-
};
|
|
853
|
-
any: {
|
|
854
|
-
keyword: 'any';
|
|
855
|
-
};
|
|
856
|
-
unknown: {
|
|
857
|
-
keyword: 'unknown';
|
|
858
|
-
};
|
|
859
|
-
void: {
|
|
860
|
-
keyword: 'void';
|
|
861
|
-
};
|
|
862
|
-
blob: {
|
|
863
|
-
keyword: 'blob';
|
|
864
|
-
};
|
|
865
|
-
schema: {
|
|
866
|
-
keyword: 'schema';
|
|
867
|
-
args: {
|
|
868
|
-
type: 'string' | 'number' | 'integer' | 'boolean' | 'array' | 'object';
|
|
869
|
-
format?: string;
|
|
870
|
-
};
|
|
871
|
-
};
|
|
872
|
-
name: {
|
|
873
|
-
keyword: 'name';
|
|
874
|
-
args: string;
|
|
875
|
-
};
|
|
876
|
-
catchall: {
|
|
877
|
-
keyword: 'catchall';
|
|
878
|
-
};
|
|
879
|
-
interface: {
|
|
880
|
-
keyword: 'interface';
|
|
881
|
-
};
|
|
882
|
-
};
|
|
883
|
-
type Schema = {
|
|
884
|
-
keyword: string;
|
|
885
|
-
} | SchemaKeywordMapper[keyof SchemaKeywordMapper];
|
|
886
|
-
//#endregion
|
|
887
|
-
//#region ../plugin-oas/src/SchemaGenerator.d.ts
|
|
888
|
-
type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
889
|
-
fabric: Fabric;
|
|
890
|
-
oas: Oas;
|
|
891
|
-
pluginManager: PluginManager;
|
|
892
|
-
/**
|
|
893
|
-
* Current plugin
|
|
894
|
-
*/
|
|
895
|
-
plugin: Plugin<TPluginOptions>;
|
|
896
|
-
mode: KubbFile.Mode;
|
|
897
|
-
include?: Array<'schemas' | 'responses' | 'requestBodies'>;
|
|
898
|
-
override: Array<Override<TOptions>> | undefined;
|
|
899
|
-
contentType?: contentType;
|
|
900
|
-
output?: string;
|
|
901
|
-
};
|
|
902
|
-
type SchemaGeneratorOptions = {
|
|
903
|
-
dateType: false | 'string' | 'stringOffset' | 'stringLocal' | 'date';
|
|
904
|
-
unknownType: 'any' | 'unknown' | 'void';
|
|
905
|
-
emptySchemaType: 'any' | 'unknown' | 'void';
|
|
906
|
-
enumType?: 'enum' | 'asConst' | 'asPascalConst' | 'constEnum' | 'literal';
|
|
907
|
-
enumSuffix?: string;
|
|
908
|
-
usedEnumNames?: Record<string, number>;
|
|
909
|
-
mapper?: Record<string, string>;
|
|
910
|
-
typed?: boolean;
|
|
911
|
-
transformers: {
|
|
912
|
-
/**
|
|
913
|
-
* Customize the names based on the type that is provided by the plugin.
|
|
914
|
-
*/
|
|
915
|
-
name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
|
|
916
|
-
/**
|
|
917
|
-
* Receive schema and name(propertName) and return FakerMeta array
|
|
918
|
-
* TODO TODO add docs
|
|
919
|
-
* @beta
|
|
920
|
-
*/
|
|
921
|
-
schema?: (schemaProps: SchemaProps$1, defaultSchemas: Schema[]) => Schema[] | undefined;
|
|
922
|
-
};
|
|
923
|
-
};
|
|
924
|
-
type SchemaProps$1 = {
|
|
925
|
-
schemaObject?: SchemaObject$1;
|
|
926
|
-
name?: string;
|
|
927
|
-
parentName?: string;
|
|
928
|
-
};
|
|
929
|
-
declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGeneratorOptions, TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TOptions, Context<TOptions, TPluginOptions>> {
|
|
930
|
-
#private;
|
|
931
|
-
refs: Refs;
|
|
932
|
-
/**
|
|
933
|
-
* Creates a type node from a given schema.
|
|
934
|
-
* Delegates to getBaseTypeFromSchema internally and
|
|
935
|
-
* optionally adds a union with null.
|
|
936
|
-
*/
|
|
937
|
-
parse(props: SchemaProps$1): Schema[];
|
|
938
|
-
static deepSearch<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): Array<SchemaKeywordMapper[T]>;
|
|
939
|
-
static find<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
|
|
940
|
-
static combineObjects(tree: Schema[] | undefined): Schema[];
|
|
941
|
-
build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
|
|
942
|
-
}
|
|
943
|
-
//#endregion
|
|
944
|
-
//#region ../plugin-oas/src/generators/createGenerator.d.ts
|
|
945
|
-
type CoreGenerator<TOptions extends PluginFactoryOptions> = {
|
|
946
|
-
name: string;
|
|
947
|
-
type: 'core';
|
|
948
|
-
operations: (props: OperationsProps<TOptions>) => Promise<KubbFile.File[]>;
|
|
949
|
-
operation: (props: OperationProps<TOptions>) => Promise<KubbFile.File[]>;
|
|
950
|
-
schema: (props: SchemaProps<TOptions>) => Promise<KubbFile.File[]>;
|
|
951
|
-
};
|
|
952
|
-
//#endregion
|
|
953
|
-
//#region ../plugin-oas/src/generators/types.d.ts
|
|
954
|
-
type OperationsProps<TOptions extends PluginFactoryOptions> = {
|
|
955
|
-
config: Config;
|
|
956
|
-
generator: Omit<OperationGenerator<TOptions>, 'build'>;
|
|
957
|
-
plugin: Plugin<TOptions>;
|
|
958
|
-
operations: Array<Operation$1>;
|
|
959
|
-
};
|
|
960
|
-
type OperationProps<TOptions extends PluginFactoryOptions> = {
|
|
961
|
-
config: Config;
|
|
962
|
-
generator: Omit<OperationGenerator<TOptions>, 'build'>;
|
|
963
|
-
plugin: Plugin<TOptions>;
|
|
964
|
-
operation: Operation$1;
|
|
965
|
-
};
|
|
966
|
-
type SchemaProps<TOptions extends PluginFactoryOptions> = {
|
|
967
|
-
config: Config;
|
|
968
|
-
generator: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions>, 'build'>;
|
|
969
|
-
plugin: Plugin<TOptions>;
|
|
970
|
-
schema: {
|
|
971
|
-
name: string;
|
|
972
|
-
tree: Array<Schema>;
|
|
973
|
-
value: SchemaObject$1;
|
|
974
|
-
};
|
|
975
|
-
};
|
|
976
|
-
type Generator<TOptions extends PluginFactoryOptions> = CoreGenerator<TOptions> | ReactGenerator<TOptions>;
|
|
977
|
-
//#endregion
|
|
978
|
-
//#region ../plugin-oas/src/generators/createReactGenerator.d.ts
|
|
979
|
-
type ReactGenerator<TOptions extends PluginFactoryOptions> = {
|
|
980
|
-
name: string;
|
|
981
|
-
type: 'react';
|
|
982
|
-
Operations: (props: OperationsProps<TOptions>) => KubbNode;
|
|
983
|
-
Operation: (props: OperationProps<TOptions>) => KubbNode;
|
|
984
|
-
Schema: (props: SchemaProps<TOptions>) => KubbNode;
|
|
985
|
-
};
|
|
986
|
-
//#endregion
|
|
987
|
-
//#region src/types.d.ts
|
|
988
|
-
type Options$1 = {
|
|
989
|
-
/**
|
|
990
|
-
* Specify the export location for the files and define the behavior of the output
|
|
991
|
-
* @default { path: 'mocks', barrelType: 'named' }
|
|
992
|
-
*/
|
|
993
|
-
output?: Output<Oas>;
|
|
994
|
-
/**
|
|
995
|
-
* Define which contentType should be used.
|
|
996
|
-
* By default, the first JSON valid mediaType will be used
|
|
997
|
-
*/
|
|
998
|
-
contentType?: contentType;
|
|
999
|
-
baseURL?: string;
|
|
1000
|
-
/**
|
|
1001
|
-
* Group the MSW mocks based on the provided name.
|
|
1002
|
-
*/
|
|
1003
|
-
group?: Group;
|
|
1004
|
-
/**
|
|
1005
|
-
* Array containing exclude parameters to exclude/skip tags/operations/methods/paths.
|
|
1006
|
-
*/
|
|
1007
|
-
exclude?: Array<Exclude$1>;
|
|
1008
|
-
/**
|
|
1009
|
-
* Array containing include parameters to include tags/operations/methods/paths.
|
|
1010
|
-
*/
|
|
1011
|
-
include?: Array<Include>;
|
|
1012
|
-
/**
|
|
1013
|
-
* Array containing override parameters to override `options` based on tags/operations/methods/paths.
|
|
1014
|
-
*/
|
|
1015
|
-
override?: Array<Override<ResolvedOptions>>;
|
|
1016
|
-
transformers?: {
|
|
1017
|
-
/**
|
|
1018
|
-
* Customize the names based on the type that is provided by the plugin.
|
|
1019
|
-
*/
|
|
1020
|
-
name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
|
|
1021
|
-
};
|
|
1022
|
-
/**
|
|
1023
|
-
* Create `handlers.ts` file with all handlers grouped by methods.
|
|
1024
|
-
* @default false
|
|
1025
|
-
*/
|
|
1026
|
-
handlers?: boolean;
|
|
1027
|
-
/**
|
|
1028
|
-
* Which parser should be used before returning the data to the `Response` of MSW.
|
|
1029
|
-
* - `'faker'` will use `@kubb/plugin-faker` to generate the data for the response
|
|
1030
|
-
* - `'data'` will use your custom data to generate the data for the response
|
|
1031
|
-
* @default 'data'
|
|
1032
|
-
*/
|
|
1033
|
-
parser?: 'data' | 'faker';
|
|
1034
|
-
/**
|
|
1035
|
-
* Define some generators next to the msw generators
|
|
1036
|
-
*/
|
|
1037
|
-
generators?: Array<Generator<PluginMsw>>;
|
|
1038
|
-
};
|
|
1039
|
-
type ResolvedOptions = {
|
|
1040
|
-
output: Output<Oas>;
|
|
1041
|
-
group: Options$1['group'];
|
|
1042
|
-
parser: NonNullable<Options$1['parser']>;
|
|
1043
|
-
baseURL: Options$1['baseURL'] | undefined;
|
|
1044
|
-
};
|
|
1045
|
-
type PluginMsw = PluginFactoryOptions<'plugin-msw', Options$1, ResolvedOptions, never, ResolvePathOptions>;
|
|
1046
|
-
//#endregion
|
|
1047
|
-
export { UserPluginWithLifeCycle as i, PluginMsw as n, ReactGenerator as r, Options$1 as t };
|
|
1048
|
-
//# sourceMappingURL=types-DSnvepCr.d.ts.map
|
|
556
|
+
export { Output as a, ResolveNameParams as c, Oas as d, HttpMethod as f, contentType as h, Group as i, UserPluginWithLifeCycle as l, SchemaObject$1 as m, PluginManager as n, Plugin as o, Operation$1 as p, Config as r, PluginFactoryOptions as s, FileMetaBase as t, BaseGenerator as u };
|
|
557
|
+
//# sourceMappingURL=index-DR442nn_.d.cts.map
|