@kubb/plugin-faker 4.4.0 → 4.4.1
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 +1 -1
- package/dist/generators.d.ts +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/{types-C6bgZQkZ.d.cts → types-DRMQqYat.d.cts} +21 -135
- package/dist/{types-Bh4LPXtV.d.ts → types-Dda1jVMe.d.ts} +21 -135
- package/package.json +16 -11
package/dist/components.d.cts
CHANGED
package/dist/components.d.ts
CHANGED
package/dist/generators.d.cts
CHANGED
package/dist/generators.d.ts
CHANGED
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as UserPluginWithLifeCycle, n as PluginFaker, t as Options } from "./types-
|
|
1
|
+
import { a as UserPluginWithLifeCycle, n as PluginFaker, t as Options } from "./types-DRMQqYat.cjs";
|
|
2
2
|
|
|
3
3
|
//#region src/plugin.d.ts
|
|
4
4
|
declare const pluginFakerName = "plugin-faker";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as UserPluginWithLifeCycle, n as PluginFaker, t as Options } from "./types-
|
|
1
|
+
import { a as UserPluginWithLifeCycle, n as PluginFaker, t as Options } from "./types-Dda1jVMe.js";
|
|
2
2
|
|
|
3
3
|
//#region src/plugin.d.ts
|
|
4
4
|
declare const pluginFakerName = "plugin-faker";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { KubbFile } from "@kubb/fabric-core/types";
|
|
1
2
|
import { Fabric, FileManager } from "@kubb/react-fabric";
|
|
2
3
|
import { ConsolaInstance, LogLevel } from "consola";
|
|
3
4
|
import * as OasTypes from "oas/types";
|
|
@@ -22,121 +23,6 @@ declare abstract class BaseGenerator<TOptions = unknown, TContext = unknown> {
|
|
|
22
23
|
abstract build(...params: unknown[]): unknown;
|
|
23
24
|
}
|
|
24
25
|
//#endregion
|
|
25
|
-
//#region ../core/src/fs/types.d.ts
|
|
26
|
-
type BasePath<T extends string = string> = `${T}/`;
|
|
27
|
-
type Import = {
|
|
28
|
-
/**
|
|
29
|
-
* Import name to be used
|
|
30
|
-
* @example ["useState"]
|
|
31
|
-
* @example "React"
|
|
32
|
-
*/
|
|
33
|
-
name: string | Array<string | {
|
|
34
|
-
propertyName: string;
|
|
35
|
-
name?: string;
|
|
36
|
-
}>;
|
|
37
|
-
/**
|
|
38
|
-
* Path for the import
|
|
39
|
-
* @example '@kubb/core'
|
|
40
|
-
*/
|
|
41
|
-
path: string;
|
|
42
|
-
/**
|
|
43
|
-
* Add `type` prefix to the import, this will result in: `import type { Type } from './path'`.
|
|
44
|
-
*/
|
|
45
|
-
isTypeOnly?: boolean;
|
|
46
|
-
isNameSpace?: boolean;
|
|
47
|
-
/**
|
|
48
|
-
* When root is set it will get the path with relative getRelativePath(root, path).
|
|
49
|
-
*/
|
|
50
|
-
root?: string;
|
|
51
|
-
};
|
|
52
|
-
type Source = {
|
|
53
|
-
name?: string;
|
|
54
|
-
value?: string;
|
|
55
|
-
isTypeOnly?: boolean;
|
|
56
|
-
/**
|
|
57
|
-
* Has const or type 'export'
|
|
58
|
-
* @default false
|
|
59
|
-
*/
|
|
60
|
-
isExportable?: boolean;
|
|
61
|
-
/**
|
|
62
|
-
* When set, barrel generation will add this
|
|
63
|
-
* @default false
|
|
64
|
-
*/
|
|
65
|
-
isIndexable?: boolean;
|
|
66
|
-
};
|
|
67
|
-
type Export = {
|
|
68
|
-
/**
|
|
69
|
-
* Export name to be used.
|
|
70
|
-
* @example ["useState"]
|
|
71
|
-
* @example "React"
|
|
72
|
-
*/
|
|
73
|
-
name?: string | Array<string>;
|
|
74
|
-
/**
|
|
75
|
-
* Path for the import.
|
|
76
|
-
* @example '@kubb/core'
|
|
77
|
-
*/
|
|
78
|
-
path: string;
|
|
79
|
-
/**
|
|
80
|
-
* Add `type` prefix to the export, this will result in: `export type { Type } from './path'`.
|
|
81
|
-
*/
|
|
82
|
-
isTypeOnly?: boolean;
|
|
83
|
-
/**
|
|
84
|
-
* Make it possible to override the name, this will result in: `export * as aliasName from './path'`.
|
|
85
|
-
*/
|
|
86
|
-
asAlias?: boolean;
|
|
87
|
-
};
|
|
88
|
-
type Extname = '.ts' | '.js' | '.tsx' | '.json' | `.${string}`;
|
|
89
|
-
type Mode = 'single' | 'split';
|
|
90
|
-
/**
|
|
91
|
-
* Name to be used to dynamicly create the baseName(based on input.path)
|
|
92
|
-
* Based on UNIX basename
|
|
93
|
-
* @link https://nodejs.org/api/path.html#pathbasenamepath-suffix
|
|
94
|
-
*/
|
|
95
|
-
type BaseName = `${string}.${string}`;
|
|
96
|
-
/**
|
|
97
|
-
* Path will be full qualified path to a specified file
|
|
98
|
-
*/
|
|
99
|
-
type Path = string;
|
|
100
|
-
type AdvancedPath<T extends BaseName = BaseName> = `${BasePath}${T}`;
|
|
101
|
-
type OptionalPath = Path | undefined | null;
|
|
102
|
-
type File<TMeta extends object = object> = {
|
|
103
|
-
/**
|
|
104
|
-
* Name to be used to create the path
|
|
105
|
-
* Based on UNIX basename, `${name}.extname`
|
|
106
|
-
* @link https://nodejs.org/api/path.html#pathbasenamepath-suffix
|
|
107
|
-
*/
|
|
108
|
-
baseName: BaseName;
|
|
109
|
-
/**
|
|
110
|
-
* Path will be full qualified path to a specified file
|
|
111
|
-
*/
|
|
112
|
-
path: AdvancedPath<BaseName> | Path;
|
|
113
|
-
sources: Array<Source>;
|
|
114
|
-
imports?: Array<Import>;
|
|
115
|
-
exports?: Array<Export>;
|
|
116
|
-
/**
|
|
117
|
-
* Use extra meta, this is getting used to generate the barrel/index files.
|
|
118
|
-
*/
|
|
119
|
-
meta?: TMeta;
|
|
120
|
-
banner?: string;
|
|
121
|
-
footer?: string;
|
|
122
|
-
};
|
|
123
|
-
type ResolvedImport = Import;
|
|
124
|
-
type ResolvedExport = Export;
|
|
125
|
-
type ResolvedFile<TMeta extends object = object> = File<TMeta> & {
|
|
126
|
-
/**
|
|
127
|
-
* @default object-hash
|
|
128
|
-
*/
|
|
129
|
-
id: string;
|
|
130
|
-
/**
|
|
131
|
-
* Contains the first part of the baseName, generated based on baseName
|
|
132
|
-
* @link https://nodejs.org/api/path.html#pathformatpathobject
|
|
133
|
-
*/
|
|
134
|
-
name: string;
|
|
135
|
-
extname: Extname;
|
|
136
|
-
imports: Array<ResolvedImport>;
|
|
137
|
-
exports: Array<ResolvedExport>;
|
|
138
|
-
};
|
|
139
|
-
//#endregion
|
|
140
26
|
//#region ../core/src/utils/EventEmitter.d.ts
|
|
141
27
|
declare class EventEmitter<TEvents extends Record<string, any>> {
|
|
142
28
|
#private;
|
|
@@ -260,7 +146,7 @@ type Config<TInput = Input> = {
|
|
|
260
146
|
* Override the extension to the generated imports and exports, by default each plugin will add an extension
|
|
261
147
|
* @default { '.ts': '.ts'}
|
|
262
148
|
*/
|
|
263
|
-
extension?: Record<Extname, Extname | ''>;
|
|
149
|
+
extension?: Record<KubbFile.Extname, KubbFile.Extname | ''>;
|
|
264
150
|
/**
|
|
265
151
|
* 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`.
|
|
266
152
|
* @default 'named'
|
|
@@ -391,7 +277,7 @@ type PluginLifecycle<TOptions extends PluginFactoryOptions = PluginFactoryOption
|
|
|
391
277
|
* @type hookFirst
|
|
392
278
|
* @example ('./Pet.ts', './src/gen/') => '/src/gen/Pet.ts'
|
|
393
279
|
*/
|
|
394
|
-
resolvePath?: (this: PluginContext<TOptions>, baseName: BaseName, mode?: Mode, options?: TOptions['resolvePathOptions']) => OptionalPath;
|
|
280
|
+
resolvePath?: (this: PluginContext<TOptions>, baseName: KubbFile.BaseName, mode?: KubbFile.Mode, options?: TOptions['resolvePathOptions']) => KubbFile.OptionalPath;
|
|
395
281
|
/**
|
|
396
282
|
* Resolve to a name based on a string.
|
|
397
283
|
* Useful when converting to PascalCase or camelCase.
|
|
@@ -409,8 +295,8 @@ type PluginLifecycleHooks = keyof PluginLifecycle;
|
|
|
409
295
|
type PluginParameter<H extends PluginLifecycleHooks> = Parameters<Required<PluginLifecycle>[H]>;
|
|
410
296
|
type ResolvePathParams<TOptions = object> = {
|
|
411
297
|
pluginKey?: Plugin['key'];
|
|
412
|
-
baseName: BaseName;
|
|
413
|
-
mode?: Mode;
|
|
298
|
+
baseName: KubbFile.BaseName;
|
|
299
|
+
mode?: KubbFile.Mode;
|
|
414
300
|
/**
|
|
415
301
|
* Options to be passed to 'resolvePath' 3th parameter
|
|
416
302
|
*/
|
|
@@ -435,8 +321,8 @@ type PluginContext<TOptions extends PluginFactoryOptions = PluginFactoryOptions>
|
|
|
435
321
|
*/
|
|
436
322
|
fileManager: FileManager;
|
|
437
323
|
pluginManager: PluginManager;
|
|
438
|
-
addFile: (...file: Array<File>) => Promise<Array<ResolvedFile>>;
|
|
439
|
-
resolvePath: (params: ResolvePathParams<TOptions['resolvePathOptions']>) => OptionalPath;
|
|
324
|
+
addFile: (...file: Array<KubbFile.File>) => Promise<Array<KubbFile.ResolvedFile>>;
|
|
325
|
+
resolvePath: (params: ResolvePathParams<TOptions['resolvePathOptions']>) => KubbFile.OptionalPath;
|
|
440
326
|
resolveName: (params: ResolveNameParams) => string;
|
|
441
327
|
logger: Logger;
|
|
442
328
|
/**
|
|
@@ -515,8 +401,8 @@ type Events = {
|
|
|
515
401
|
};
|
|
516
402
|
type GetFileProps<TOptions = object> = {
|
|
517
403
|
name: string;
|
|
518
|
-
mode?: Mode;
|
|
519
|
-
extname: Extname;
|
|
404
|
+
mode?: KubbFile.Mode;
|
|
405
|
+
extname: KubbFile.Extname;
|
|
520
406
|
pluginKey: Plugin['key'];
|
|
521
407
|
options?: TOptions;
|
|
522
408
|
};
|
|
@@ -535,10 +421,10 @@ declare class PluginManager {
|
|
|
535
421
|
extname,
|
|
536
422
|
pluginKey,
|
|
537
423
|
options
|
|
538
|
-
}: GetFileProps<TOptions>): File<{
|
|
424
|
+
}: GetFileProps<TOptions>): KubbFile.File<{
|
|
539
425
|
pluginKey: Plugin['key'];
|
|
540
426
|
}>;
|
|
541
|
-
resolvePath: <TOptions = object>(params: ResolvePathParams<TOptions>) => OptionalPath;
|
|
427
|
+
resolvePath: <TOptions = object>(params: ResolvePathParams<TOptions>) => KubbFile.OptionalPath;
|
|
542
428
|
resolveName: (params: ResolveNameParams) => string;
|
|
543
429
|
/**
|
|
544
430
|
* Instead of calling `pluginManager.events.on` you can use `pluginManager.on`. This one also has better types.
|
|
@@ -711,9 +597,9 @@ type Generator<TOptions extends PluginFactoryOptions> = CoreGenerator<TOptions>
|
|
|
711
597
|
type CoreGenerator<TOptions extends PluginFactoryOptions> = {
|
|
712
598
|
name: string;
|
|
713
599
|
type: 'core';
|
|
714
|
-
operations: (props: OperationsProps<TOptions>) => Promise<File[]>;
|
|
715
|
-
operation: (props: OperationProps<TOptions>) => Promise<File[]>;
|
|
716
|
-
schema: (props: SchemaProps$1<TOptions>) => Promise<File[]>;
|
|
600
|
+
operations: (props: OperationsProps<TOptions>) => Promise<KubbFile.File[]>;
|
|
601
|
+
operation: (props: OperationProps<TOptions>) => Promise<KubbFile.File[]>;
|
|
602
|
+
schema: (props: SchemaProps$1<TOptions>) => Promise<KubbFile.File[]>;
|
|
717
603
|
};
|
|
718
604
|
//#endregion
|
|
719
605
|
//#region ../plugin-oas/src/types.d.ts
|
|
@@ -737,7 +623,7 @@ type ResolvePathOptions = {
|
|
|
737
623
|
type Ref = {
|
|
738
624
|
propertyName: string;
|
|
739
625
|
originalName: string;
|
|
740
|
-
path: OptionalPath;
|
|
626
|
+
path: KubbFile.OptionalPath;
|
|
741
627
|
pluginKey?: Plugin['key'];
|
|
742
628
|
};
|
|
743
629
|
type Refs = Record<string, Ref>;
|
|
@@ -817,7 +703,7 @@ type Context$1<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
|
817
703
|
* Current plugin
|
|
818
704
|
*/
|
|
819
705
|
plugin: Plugin<TPluginOptions>;
|
|
820
|
-
mode: Mode;
|
|
706
|
+
mode: KubbFile.Mode;
|
|
821
707
|
};
|
|
822
708
|
declare class OperationGenerator<TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TPluginOptions['resolvedOptions'], Context$1<TPluginOptions['resolvedOptions'], TPluginOptions>> {
|
|
823
709
|
#private;
|
|
@@ -831,7 +717,7 @@ declare class OperationGenerator<TPluginOptions extends PluginFactoryOptions = P
|
|
|
831
717
|
method: HttpMethod;
|
|
832
718
|
operation: Operation$1;
|
|
833
719
|
}>>;
|
|
834
|
-
build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<File<TFileMeta>>>;
|
|
720
|
+
build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
|
|
835
721
|
}
|
|
836
722
|
//#endregion
|
|
837
723
|
//#region ../plugin-oas/src/SchemaMapper.d.ts
|
|
@@ -947,7 +833,7 @@ type SchemaKeywordMapper = {
|
|
|
947
833
|
/**
|
|
948
834
|
* Full qualified path.
|
|
949
835
|
*/
|
|
950
|
-
path: OptionalPath;
|
|
836
|
+
path: KubbFile.OptionalPath;
|
|
951
837
|
/**
|
|
952
838
|
* When true `File.Import` will be used.
|
|
953
839
|
* When false a reference will be used inside the current file.
|
|
@@ -1060,7 +946,7 @@ type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
|
1060
946
|
* Current plugin
|
|
1061
947
|
*/
|
|
1062
948
|
plugin: Plugin<TPluginOptions>;
|
|
1063
|
-
mode: Mode;
|
|
949
|
+
mode: KubbFile.Mode;
|
|
1064
950
|
include?: Array<'schemas' | 'responses' | 'requestBodies'>;
|
|
1065
951
|
override: Array<Override<TOptions>> | undefined;
|
|
1066
952
|
contentType?: contentType;
|
|
@@ -1108,7 +994,7 @@ declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGe
|
|
|
1108
994
|
static findInObject<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
|
|
1109
995
|
static find<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
|
|
1110
996
|
static combineObjects(tree: Schema[] | undefined): Schema[];
|
|
1111
|
-
build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<File<TFileMeta>>>;
|
|
997
|
+
build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
|
|
1112
998
|
}
|
|
1113
999
|
//#endregion
|
|
1114
1000
|
//#region src/types.d.ts
|
|
@@ -1215,4 +1101,4 @@ type ResolvedOptions = {
|
|
|
1215
1101
|
type PluginFaker = PluginFactoryOptions<'plugin-faker', Options$1, ResolvedOptions, never, ResolvePathOptions>;
|
|
1216
1102
|
//#endregion
|
|
1217
1103
|
export { UserPluginWithLifeCycle as a, ReactGenerator as i, PluginFaker as n, Schema as r, Options$1 as t };
|
|
1218
|
-
//# sourceMappingURL=types-
|
|
1104
|
+
//# sourceMappingURL=types-DRMQqYat.d.cts.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Fabric, FileManager } from "@kubb/react-fabric";
|
|
2
|
+
import { KubbFile } from "@kubb/fabric-core/types";
|
|
2
3
|
import { ConsolaInstance, LogLevel } from "consola";
|
|
3
4
|
import * as OasTypes from "oas/types";
|
|
4
5
|
import { HttpMethods as HttpMethod, OASDocument, SchemaObject, User } from "oas/types";
|
|
@@ -22,121 +23,6 @@ declare abstract class BaseGenerator<TOptions = unknown, TContext = unknown> {
|
|
|
22
23
|
abstract build(...params: unknown[]): unknown;
|
|
23
24
|
}
|
|
24
25
|
//#endregion
|
|
25
|
-
//#region ../core/src/fs/types.d.ts
|
|
26
|
-
type BasePath<T extends string = string> = `${T}/`;
|
|
27
|
-
type Import = {
|
|
28
|
-
/**
|
|
29
|
-
* Import name to be used
|
|
30
|
-
* @example ["useState"]
|
|
31
|
-
* @example "React"
|
|
32
|
-
*/
|
|
33
|
-
name: string | Array<string | {
|
|
34
|
-
propertyName: string;
|
|
35
|
-
name?: string;
|
|
36
|
-
}>;
|
|
37
|
-
/**
|
|
38
|
-
* Path for the import
|
|
39
|
-
* @example '@kubb/core'
|
|
40
|
-
*/
|
|
41
|
-
path: string;
|
|
42
|
-
/**
|
|
43
|
-
* Add `type` prefix to the import, this will result in: `import type { Type } from './path'`.
|
|
44
|
-
*/
|
|
45
|
-
isTypeOnly?: boolean;
|
|
46
|
-
isNameSpace?: boolean;
|
|
47
|
-
/**
|
|
48
|
-
* When root is set it will get the path with relative getRelativePath(root, path).
|
|
49
|
-
*/
|
|
50
|
-
root?: string;
|
|
51
|
-
};
|
|
52
|
-
type Source = {
|
|
53
|
-
name?: string;
|
|
54
|
-
value?: string;
|
|
55
|
-
isTypeOnly?: boolean;
|
|
56
|
-
/**
|
|
57
|
-
* Has const or type 'export'
|
|
58
|
-
* @default false
|
|
59
|
-
*/
|
|
60
|
-
isExportable?: boolean;
|
|
61
|
-
/**
|
|
62
|
-
* When set, barrel generation will add this
|
|
63
|
-
* @default false
|
|
64
|
-
*/
|
|
65
|
-
isIndexable?: boolean;
|
|
66
|
-
};
|
|
67
|
-
type Export = {
|
|
68
|
-
/**
|
|
69
|
-
* Export name to be used.
|
|
70
|
-
* @example ["useState"]
|
|
71
|
-
* @example "React"
|
|
72
|
-
*/
|
|
73
|
-
name?: string | Array<string>;
|
|
74
|
-
/**
|
|
75
|
-
* Path for the import.
|
|
76
|
-
* @example '@kubb/core'
|
|
77
|
-
*/
|
|
78
|
-
path: string;
|
|
79
|
-
/**
|
|
80
|
-
* Add `type` prefix to the export, this will result in: `export type { Type } from './path'`.
|
|
81
|
-
*/
|
|
82
|
-
isTypeOnly?: boolean;
|
|
83
|
-
/**
|
|
84
|
-
* Make it possible to override the name, this will result in: `export * as aliasName from './path'`.
|
|
85
|
-
*/
|
|
86
|
-
asAlias?: boolean;
|
|
87
|
-
};
|
|
88
|
-
type Extname = '.ts' | '.js' | '.tsx' | '.json' | `.${string}`;
|
|
89
|
-
type Mode = 'single' | 'split';
|
|
90
|
-
/**
|
|
91
|
-
* Name to be used to dynamicly create the baseName(based on input.path)
|
|
92
|
-
* Based on UNIX basename
|
|
93
|
-
* @link https://nodejs.org/api/path.html#pathbasenamepath-suffix
|
|
94
|
-
*/
|
|
95
|
-
type BaseName = `${string}.${string}`;
|
|
96
|
-
/**
|
|
97
|
-
* Path will be full qualified path to a specified file
|
|
98
|
-
*/
|
|
99
|
-
type Path = string;
|
|
100
|
-
type AdvancedPath<T extends BaseName = BaseName> = `${BasePath}${T}`;
|
|
101
|
-
type OptionalPath = Path | undefined | null;
|
|
102
|
-
type File$1<TMeta extends object = object> = {
|
|
103
|
-
/**
|
|
104
|
-
* Name to be used to create the path
|
|
105
|
-
* Based on UNIX basename, `${name}.extname`
|
|
106
|
-
* @link https://nodejs.org/api/path.html#pathbasenamepath-suffix
|
|
107
|
-
*/
|
|
108
|
-
baseName: BaseName;
|
|
109
|
-
/**
|
|
110
|
-
* Path will be full qualified path to a specified file
|
|
111
|
-
*/
|
|
112
|
-
path: AdvancedPath<BaseName> | Path;
|
|
113
|
-
sources: Array<Source>;
|
|
114
|
-
imports?: Array<Import>;
|
|
115
|
-
exports?: Array<Export>;
|
|
116
|
-
/**
|
|
117
|
-
* Use extra meta, this is getting used to generate the barrel/index files.
|
|
118
|
-
*/
|
|
119
|
-
meta?: TMeta;
|
|
120
|
-
banner?: string;
|
|
121
|
-
footer?: string;
|
|
122
|
-
};
|
|
123
|
-
type ResolvedImport = Import;
|
|
124
|
-
type ResolvedExport = Export;
|
|
125
|
-
type ResolvedFile<TMeta extends object = object> = File$1<TMeta> & {
|
|
126
|
-
/**
|
|
127
|
-
* @default object-hash
|
|
128
|
-
*/
|
|
129
|
-
id: string;
|
|
130
|
-
/**
|
|
131
|
-
* Contains the first part of the baseName, generated based on baseName
|
|
132
|
-
* @link https://nodejs.org/api/path.html#pathformatpathobject
|
|
133
|
-
*/
|
|
134
|
-
name: string;
|
|
135
|
-
extname: Extname;
|
|
136
|
-
imports: Array<ResolvedImport>;
|
|
137
|
-
exports: Array<ResolvedExport>;
|
|
138
|
-
};
|
|
139
|
-
//#endregion
|
|
140
26
|
//#region ../core/src/utils/EventEmitter.d.ts
|
|
141
27
|
declare class EventEmitter<TEvents extends Record<string, any>> {
|
|
142
28
|
#private;
|
|
@@ -260,7 +146,7 @@ type Config<TInput = Input> = {
|
|
|
260
146
|
* Override the extension to the generated imports and exports, by default each plugin will add an extension
|
|
261
147
|
* @default { '.ts': '.ts'}
|
|
262
148
|
*/
|
|
263
|
-
extension?: Record<Extname, Extname | ''>;
|
|
149
|
+
extension?: Record<KubbFile.Extname, KubbFile.Extname | ''>;
|
|
264
150
|
/**
|
|
265
151
|
* 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`.
|
|
266
152
|
* @default 'named'
|
|
@@ -391,7 +277,7 @@ type PluginLifecycle<TOptions extends PluginFactoryOptions = PluginFactoryOption
|
|
|
391
277
|
* @type hookFirst
|
|
392
278
|
* @example ('./Pet.ts', './src/gen/') => '/src/gen/Pet.ts'
|
|
393
279
|
*/
|
|
394
|
-
resolvePath?: (this: PluginContext<TOptions>, baseName: BaseName, mode?: Mode, options?: TOptions['resolvePathOptions']) => OptionalPath;
|
|
280
|
+
resolvePath?: (this: PluginContext<TOptions>, baseName: KubbFile.BaseName, mode?: KubbFile.Mode, options?: TOptions['resolvePathOptions']) => KubbFile.OptionalPath;
|
|
395
281
|
/**
|
|
396
282
|
* Resolve to a name based on a string.
|
|
397
283
|
* Useful when converting to PascalCase or camelCase.
|
|
@@ -409,8 +295,8 @@ type PluginLifecycleHooks = keyof PluginLifecycle;
|
|
|
409
295
|
type PluginParameter<H extends PluginLifecycleHooks> = Parameters<Required<PluginLifecycle>[H]>;
|
|
410
296
|
type ResolvePathParams<TOptions = object> = {
|
|
411
297
|
pluginKey?: Plugin['key'];
|
|
412
|
-
baseName: BaseName;
|
|
413
|
-
mode?: Mode;
|
|
298
|
+
baseName: KubbFile.BaseName;
|
|
299
|
+
mode?: KubbFile.Mode;
|
|
414
300
|
/**
|
|
415
301
|
* Options to be passed to 'resolvePath' 3th parameter
|
|
416
302
|
*/
|
|
@@ -435,8 +321,8 @@ type PluginContext<TOptions extends PluginFactoryOptions = PluginFactoryOptions>
|
|
|
435
321
|
*/
|
|
436
322
|
fileManager: FileManager;
|
|
437
323
|
pluginManager: PluginManager;
|
|
438
|
-
addFile: (...file: Array<File
|
|
439
|
-
resolvePath: (params: ResolvePathParams<TOptions['resolvePathOptions']>) => OptionalPath;
|
|
324
|
+
addFile: (...file: Array<KubbFile.File>) => Promise<Array<KubbFile.ResolvedFile>>;
|
|
325
|
+
resolvePath: (params: ResolvePathParams<TOptions['resolvePathOptions']>) => KubbFile.OptionalPath;
|
|
440
326
|
resolveName: (params: ResolveNameParams) => string;
|
|
441
327
|
logger: Logger;
|
|
442
328
|
/**
|
|
@@ -515,8 +401,8 @@ type Events = {
|
|
|
515
401
|
};
|
|
516
402
|
type GetFileProps<TOptions = object> = {
|
|
517
403
|
name: string;
|
|
518
|
-
mode?: Mode;
|
|
519
|
-
extname: Extname;
|
|
404
|
+
mode?: KubbFile.Mode;
|
|
405
|
+
extname: KubbFile.Extname;
|
|
520
406
|
pluginKey: Plugin['key'];
|
|
521
407
|
options?: TOptions;
|
|
522
408
|
};
|
|
@@ -535,10 +421,10 @@ declare class PluginManager {
|
|
|
535
421
|
extname,
|
|
536
422
|
pluginKey,
|
|
537
423
|
options
|
|
538
|
-
}: GetFileProps<TOptions>): File
|
|
424
|
+
}: GetFileProps<TOptions>): KubbFile.File<{
|
|
539
425
|
pluginKey: Plugin['key'];
|
|
540
426
|
}>;
|
|
541
|
-
resolvePath: <TOptions = object>(params: ResolvePathParams<TOptions>) => OptionalPath;
|
|
427
|
+
resolvePath: <TOptions = object>(params: ResolvePathParams<TOptions>) => KubbFile.OptionalPath;
|
|
542
428
|
resolveName: (params: ResolveNameParams) => string;
|
|
543
429
|
/**
|
|
544
430
|
* Instead of calling `pluginManager.events.on` you can use `pluginManager.on`. This one also has better types.
|
|
@@ -711,9 +597,9 @@ type Generator<TOptions extends PluginFactoryOptions> = CoreGenerator<TOptions>
|
|
|
711
597
|
type CoreGenerator<TOptions extends PluginFactoryOptions> = {
|
|
712
598
|
name: string;
|
|
713
599
|
type: 'core';
|
|
714
|
-
operations: (props: OperationsProps<TOptions>) => Promise<File
|
|
715
|
-
operation: (props: OperationProps<TOptions>) => Promise<File
|
|
716
|
-
schema: (props: SchemaProps$1<TOptions>) => Promise<File
|
|
600
|
+
operations: (props: OperationsProps<TOptions>) => Promise<KubbFile.File[]>;
|
|
601
|
+
operation: (props: OperationProps<TOptions>) => Promise<KubbFile.File[]>;
|
|
602
|
+
schema: (props: SchemaProps$1<TOptions>) => Promise<KubbFile.File[]>;
|
|
717
603
|
};
|
|
718
604
|
//#endregion
|
|
719
605
|
//#region ../plugin-oas/src/types.d.ts
|
|
@@ -737,7 +623,7 @@ type ResolvePathOptions = {
|
|
|
737
623
|
type Ref = {
|
|
738
624
|
propertyName: string;
|
|
739
625
|
originalName: string;
|
|
740
|
-
path: OptionalPath;
|
|
626
|
+
path: KubbFile.OptionalPath;
|
|
741
627
|
pluginKey?: Plugin['key'];
|
|
742
628
|
};
|
|
743
629
|
type Refs = Record<string, Ref>;
|
|
@@ -817,7 +703,7 @@ type Context$1<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
|
817
703
|
* Current plugin
|
|
818
704
|
*/
|
|
819
705
|
plugin: Plugin<TPluginOptions>;
|
|
820
|
-
mode: Mode;
|
|
706
|
+
mode: KubbFile.Mode;
|
|
821
707
|
};
|
|
822
708
|
declare class OperationGenerator<TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TPluginOptions['resolvedOptions'], Context$1<TPluginOptions['resolvedOptions'], TPluginOptions>> {
|
|
823
709
|
#private;
|
|
@@ -831,7 +717,7 @@ declare class OperationGenerator<TPluginOptions extends PluginFactoryOptions = P
|
|
|
831
717
|
method: HttpMethod;
|
|
832
718
|
operation: Operation$1;
|
|
833
719
|
}>>;
|
|
834
|
-
build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<File
|
|
720
|
+
build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
|
|
835
721
|
}
|
|
836
722
|
//#endregion
|
|
837
723
|
//#region ../plugin-oas/src/SchemaMapper.d.ts
|
|
@@ -947,7 +833,7 @@ type SchemaKeywordMapper = {
|
|
|
947
833
|
/**
|
|
948
834
|
* Full qualified path.
|
|
949
835
|
*/
|
|
950
|
-
path: OptionalPath;
|
|
836
|
+
path: KubbFile.OptionalPath;
|
|
951
837
|
/**
|
|
952
838
|
* When true `File.Import` will be used.
|
|
953
839
|
* When false a reference will be used inside the current file.
|
|
@@ -1060,7 +946,7 @@ type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
|
1060
946
|
* Current plugin
|
|
1061
947
|
*/
|
|
1062
948
|
plugin: Plugin<TPluginOptions>;
|
|
1063
|
-
mode: Mode;
|
|
949
|
+
mode: KubbFile.Mode;
|
|
1064
950
|
include?: Array<'schemas' | 'responses' | 'requestBodies'>;
|
|
1065
951
|
override: Array<Override<TOptions>> | undefined;
|
|
1066
952
|
contentType?: contentType;
|
|
@@ -1108,7 +994,7 @@ declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGe
|
|
|
1108
994
|
static findInObject<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
|
|
1109
995
|
static find<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
|
|
1110
996
|
static combineObjects(tree: Schema[] | undefined): Schema[];
|
|
1111
|
-
build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<File
|
|
997
|
+
build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
|
|
1112
998
|
}
|
|
1113
999
|
//#endregion
|
|
1114
1000
|
//#region src/types.d.ts
|
|
@@ -1215,4 +1101,4 @@ type ResolvedOptions = {
|
|
|
1215
1101
|
type PluginFaker = PluginFactoryOptions<'plugin-faker', Options$1, ResolvedOptions, never, ResolvePathOptions>;
|
|
1216
1102
|
//#endregion
|
|
1217
1103
|
export { UserPluginWithLifeCycle as a, ReactGenerator as i, PluginFaker as n, Schema as r, Options$1 as t };
|
|
1218
|
-
//# sourceMappingURL=types-
|
|
1104
|
+
//# sourceMappingURL=types-Dda1jVMe.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/plugin-faker",
|
|
3
|
-
"version": "4.4.
|
|
3
|
+
"version": "4.4.1",
|
|
4
4
|
"description": "Faker.js data generator plugin for Kubb, creating realistic mock data from OpenAPI specifications for development and testing.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"faker",
|
|
@@ -60,20 +60,25 @@
|
|
|
60
60
|
"!/**/**.test.**",
|
|
61
61
|
"!/**/__tests__/**"
|
|
62
62
|
],
|
|
63
|
+
"size-limit": [
|
|
64
|
+
{
|
|
65
|
+
"path": "./dist/*.js",
|
|
66
|
+
"limit": "510 KiB",
|
|
67
|
+
"gzip": true
|
|
68
|
+
}
|
|
69
|
+
],
|
|
63
70
|
"dependencies": {
|
|
64
|
-
"@kubb/react-fabric": "0.2.
|
|
65
|
-
"@kubb/core": "4.4.
|
|
66
|
-
"@kubb/oas": "4.4.
|
|
67
|
-
"@kubb/plugin-oas": "4.4.
|
|
68
|
-
"@kubb/plugin-ts": "4.4.
|
|
71
|
+
"@kubb/react-fabric": "0.2.10",
|
|
72
|
+
"@kubb/core": "4.4.1",
|
|
73
|
+
"@kubb/oas": "4.4.1",
|
|
74
|
+
"@kubb/plugin-oas": "4.4.1",
|
|
75
|
+
"@kubb/plugin-ts": "4.4.1"
|
|
69
76
|
},
|
|
70
77
|
"devDependencies": {
|
|
71
|
-
"
|
|
72
|
-
"typescript": "^5.9.3",
|
|
73
|
-
"@kubb/plugin-oas": "4.4.0"
|
|
78
|
+
"@kubb/plugin-oas": "4.4.1"
|
|
74
79
|
},
|
|
75
80
|
"peerDependencies": {
|
|
76
|
-
"@kubb/react-fabric": "0.2.
|
|
81
|
+
"@kubb/react-fabric": "0.2.10"
|
|
77
82
|
},
|
|
78
83
|
"engines": {
|
|
79
84
|
"node": ">=20"
|
|
@@ -83,7 +88,7 @@
|
|
|
83
88
|
"registry": "https://registry.npmjs.org/"
|
|
84
89
|
},
|
|
85
90
|
"scripts": {
|
|
86
|
-
"build": "tsdown",
|
|
91
|
+
"build": "tsdown && size-limit",
|
|
87
92
|
"clean": "npx rimraf ./dist",
|
|
88
93
|
"lint": "bun biome lint .",
|
|
89
94
|
"lint:fix": "bun biome lint --fix --unsafe .",
|