@kubb/plugin-zod 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 +2 -1
- package/dist/components.d.ts +2 -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-CENqfJvI.d.cts → types-CS916VXJ.d.ts} +22 -136
- package/dist/{types-DRKJPaUn.d.ts → types-Cd7g28dR.d.cts} +22 -136
- package/package.json +16 -10
package/dist/components.d.cts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { n as PluginZod, o as Operation, r as Schema, s as SchemaObject } from "./types-
|
|
1
|
+
import { n as PluginZod, o as Operation, r as Schema, s as SchemaObject } from "./types-Cd7g28dR.cjs";
|
|
2
|
+
import { KubbFile } from "@kubb/fabric-core/types";
|
|
2
3
|
import { KubbNode } from "@kubb/react-fabric/types";
|
|
3
4
|
|
|
4
5
|
//#region ../plugin-oas/src/hooks/useOperationManager.d.ts
|
package/dist/components.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { n as PluginZod, o as Operation, r as Schema, s as SchemaObject } from "./types-
|
|
1
|
+
import { n as PluginZod, o as Operation, r as Schema, s as SchemaObject } from "./types-CS916VXJ.js";
|
|
2
|
+
import { KubbFile } from "@kubb/fabric-core/types";
|
|
2
3
|
import { KubbNode } from "@kubb/react-fabric/types";
|
|
3
4
|
|
|
4
5
|
//#region ../plugin-oas/src/hooks/useOperationManager.d.ts
|
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 PluginZod, t as Options } from "./types-
|
|
1
|
+
import { a as UserPluginWithLifeCycle, n as PluginZod, t as Options } from "./types-Cd7g28dR.cjs";
|
|
2
2
|
|
|
3
3
|
//#region src/plugin.d.ts
|
|
4
4
|
declare const pluginZodName = "plugin-zod";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as UserPluginWithLifeCycle, n as PluginZod, t as Options } from "./types-
|
|
1
|
+
import { a as UserPluginWithLifeCycle, n as PluginZod, t as Options } from "./types-CS916VXJ.js";
|
|
2
2
|
|
|
3
3
|
//#region src/plugin.d.ts
|
|
4
4
|
declare const pluginZodName = "plugin-zod";
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { Fabric, FileManager } from "@kubb/react-fabric";
|
|
1
2
|
import * as OasTypes from "oas/types";
|
|
2
3
|
import { HttpMethods as HttpMethod, OASDocument, SchemaObject, User } from "oas/types";
|
|
3
4
|
import { Operation, Operation as Operation$1 } 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";
|
|
7
|
-
import {
|
|
8
|
+
import { KubbFile } from "@kubb/fabric-core/types";
|
|
8
9
|
import { ConsolaInstance, LogLevel } from "consola";
|
|
9
10
|
import { KubbNode } from "@kubb/react-fabric/types";
|
|
10
11
|
|
|
@@ -57,121 +58,6 @@ declare abstract class BaseGenerator<TOptions = unknown, TContext = unknown> {
|
|
|
57
58
|
abstract build(...params: unknown[]): unknown;
|
|
58
59
|
}
|
|
59
60
|
//#endregion
|
|
60
|
-
//#region ../core/src/fs/types.d.ts
|
|
61
|
-
type BasePath<T extends string = string> = `${T}/`;
|
|
62
|
-
type Import = {
|
|
63
|
-
/**
|
|
64
|
-
* Import name to be used
|
|
65
|
-
* @example ["useState"]
|
|
66
|
-
* @example "React"
|
|
67
|
-
*/
|
|
68
|
-
name: string | Array<string | {
|
|
69
|
-
propertyName: string;
|
|
70
|
-
name?: string;
|
|
71
|
-
}>;
|
|
72
|
-
/**
|
|
73
|
-
* Path for the import
|
|
74
|
-
* @example '@kubb/core'
|
|
75
|
-
*/
|
|
76
|
-
path: string;
|
|
77
|
-
/**
|
|
78
|
-
* Add `type` prefix to the import, this will result in: `import type { Type } from './path'`.
|
|
79
|
-
*/
|
|
80
|
-
isTypeOnly?: boolean;
|
|
81
|
-
isNameSpace?: boolean;
|
|
82
|
-
/**
|
|
83
|
-
* When root is set it will get the path with relative getRelativePath(root, path).
|
|
84
|
-
*/
|
|
85
|
-
root?: string;
|
|
86
|
-
};
|
|
87
|
-
type Source = {
|
|
88
|
-
name?: string;
|
|
89
|
-
value?: string;
|
|
90
|
-
isTypeOnly?: boolean;
|
|
91
|
-
/**
|
|
92
|
-
* Has const or type 'export'
|
|
93
|
-
* @default false
|
|
94
|
-
*/
|
|
95
|
-
isExportable?: boolean;
|
|
96
|
-
/**
|
|
97
|
-
* When set, barrel generation will add this
|
|
98
|
-
* @default false
|
|
99
|
-
*/
|
|
100
|
-
isIndexable?: boolean;
|
|
101
|
-
};
|
|
102
|
-
type Export = {
|
|
103
|
-
/**
|
|
104
|
-
* Export name to be used.
|
|
105
|
-
* @example ["useState"]
|
|
106
|
-
* @example "React"
|
|
107
|
-
*/
|
|
108
|
-
name?: string | Array<string>;
|
|
109
|
-
/**
|
|
110
|
-
* Path for the import.
|
|
111
|
-
* @example '@kubb/core'
|
|
112
|
-
*/
|
|
113
|
-
path: string;
|
|
114
|
-
/**
|
|
115
|
-
* Add `type` prefix to the export, this will result in: `export type { Type } from './path'`.
|
|
116
|
-
*/
|
|
117
|
-
isTypeOnly?: boolean;
|
|
118
|
-
/**
|
|
119
|
-
* Make it possible to override the name, this will result in: `export * as aliasName from './path'`.
|
|
120
|
-
*/
|
|
121
|
-
asAlias?: boolean;
|
|
122
|
-
};
|
|
123
|
-
type Extname = '.ts' | '.js' | '.tsx' | '.json' | `.${string}`;
|
|
124
|
-
type Mode = 'single' | 'split';
|
|
125
|
-
/**
|
|
126
|
-
* Name to be used to dynamicly create the baseName(based on input.path)
|
|
127
|
-
* Based on UNIX basename
|
|
128
|
-
* @link https://nodejs.org/api/path.html#pathbasenamepath-suffix
|
|
129
|
-
*/
|
|
130
|
-
type BaseName = `${string}.${string}`;
|
|
131
|
-
/**
|
|
132
|
-
* Path will be full qualified path to a specified file
|
|
133
|
-
*/
|
|
134
|
-
type Path = string;
|
|
135
|
-
type AdvancedPath<T extends BaseName = BaseName> = `${BasePath}${T}`;
|
|
136
|
-
type OptionalPath = Path | undefined | null;
|
|
137
|
-
type File<TMeta extends object = object> = {
|
|
138
|
-
/**
|
|
139
|
-
* Name to be used to create the path
|
|
140
|
-
* Based on UNIX basename, `${name}.extname`
|
|
141
|
-
* @link https://nodejs.org/api/path.html#pathbasenamepath-suffix
|
|
142
|
-
*/
|
|
143
|
-
baseName: BaseName;
|
|
144
|
-
/**
|
|
145
|
-
* Path will be full qualified path to a specified file
|
|
146
|
-
*/
|
|
147
|
-
path: AdvancedPath<BaseName> | Path;
|
|
148
|
-
sources: Array<Source>;
|
|
149
|
-
imports?: Array<Import>;
|
|
150
|
-
exports?: Array<Export>;
|
|
151
|
-
/**
|
|
152
|
-
* Use extra meta, this is getting used to generate the barrel/index files.
|
|
153
|
-
*/
|
|
154
|
-
meta?: TMeta;
|
|
155
|
-
banner?: string;
|
|
156
|
-
footer?: string;
|
|
157
|
-
};
|
|
158
|
-
type ResolvedImport = Import;
|
|
159
|
-
type ResolvedExport = Export;
|
|
160
|
-
type ResolvedFile<TMeta extends object = object> = File<TMeta> & {
|
|
161
|
-
/**
|
|
162
|
-
* @default object-hash
|
|
163
|
-
*/
|
|
164
|
-
id: string;
|
|
165
|
-
/**
|
|
166
|
-
* Contains the first part of the baseName, generated based on baseName
|
|
167
|
-
* @link https://nodejs.org/api/path.html#pathformatpathobject
|
|
168
|
-
*/
|
|
169
|
-
name: string;
|
|
170
|
-
extname: Extname;
|
|
171
|
-
imports: Array<ResolvedImport>;
|
|
172
|
-
exports: Array<ResolvedExport>;
|
|
173
|
-
};
|
|
174
|
-
//#endregion
|
|
175
61
|
//#region ../core/src/utils/EventEmitter.d.ts
|
|
176
62
|
declare class EventEmitter<TEvents extends Record<string, any>> {
|
|
177
63
|
#private;
|
|
@@ -295,7 +181,7 @@ type Config<TInput = Input> = {
|
|
|
295
181
|
* Override the extension to the generated imports and exports, by default each plugin will add an extension
|
|
296
182
|
* @default { '.ts': '.ts'}
|
|
297
183
|
*/
|
|
298
|
-
extension?: Record<Extname, Extname | ''>;
|
|
184
|
+
extension?: Record<KubbFile.Extname, KubbFile.Extname | ''>;
|
|
299
185
|
/**
|
|
300
186
|
* 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`.
|
|
301
187
|
* @default 'named'
|
|
@@ -426,7 +312,7 @@ type PluginLifecycle<TOptions extends PluginFactoryOptions = PluginFactoryOption
|
|
|
426
312
|
* @type hookFirst
|
|
427
313
|
* @example ('./Pet.ts', './src/gen/') => '/src/gen/Pet.ts'
|
|
428
314
|
*/
|
|
429
|
-
resolvePath?: (this: PluginContext<TOptions>, baseName: BaseName, mode?: Mode, options?: TOptions['resolvePathOptions']) => OptionalPath;
|
|
315
|
+
resolvePath?: (this: PluginContext<TOptions>, baseName: KubbFile.BaseName, mode?: KubbFile.Mode, options?: TOptions['resolvePathOptions']) => KubbFile.OptionalPath;
|
|
430
316
|
/**
|
|
431
317
|
* Resolve to a name based on a string.
|
|
432
318
|
* Useful when converting to PascalCase or camelCase.
|
|
@@ -444,8 +330,8 @@ type PluginLifecycleHooks = keyof PluginLifecycle;
|
|
|
444
330
|
type PluginParameter<H extends PluginLifecycleHooks> = Parameters<Required<PluginLifecycle>[H]>;
|
|
445
331
|
type ResolvePathParams<TOptions = object> = {
|
|
446
332
|
pluginKey?: Plugin['key'];
|
|
447
|
-
baseName: BaseName;
|
|
448
|
-
mode?: Mode;
|
|
333
|
+
baseName: KubbFile.BaseName;
|
|
334
|
+
mode?: KubbFile.Mode;
|
|
449
335
|
/**
|
|
450
336
|
* Options to be passed to 'resolvePath' 3th parameter
|
|
451
337
|
*/
|
|
@@ -470,8 +356,8 @@ type PluginContext<TOptions extends PluginFactoryOptions = PluginFactoryOptions>
|
|
|
470
356
|
*/
|
|
471
357
|
fileManager: FileManager;
|
|
472
358
|
pluginManager: PluginManager;
|
|
473
|
-
addFile: (...file: Array<File>) => Promise<Array<ResolvedFile>>;
|
|
474
|
-
resolvePath: (params: ResolvePathParams<TOptions['resolvePathOptions']>) => OptionalPath;
|
|
359
|
+
addFile: (...file: Array<KubbFile.File>) => Promise<Array<KubbFile.ResolvedFile>>;
|
|
360
|
+
resolvePath: (params: ResolvePathParams<TOptions['resolvePathOptions']>) => KubbFile.OptionalPath;
|
|
475
361
|
resolveName: (params: ResolveNameParams) => string;
|
|
476
362
|
logger: Logger;
|
|
477
363
|
/**
|
|
@@ -550,8 +436,8 @@ type Events = {
|
|
|
550
436
|
};
|
|
551
437
|
type GetFileProps<TOptions = object> = {
|
|
552
438
|
name: string;
|
|
553
|
-
mode?: Mode;
|
|
554
|
-
extname: Extname;
|
|
439
|
+
mode?: KubbFile.Mode;
|
|
440
|
+
extname: KubbFile.Extname;
|
|
555
441
|
pluginKey: Plugin['key'];
|
|
556
442
|
options?: TOptions;
|
|
557
443
|
};
|
|
@@ -570,10 +456,10 @@ declare class PluginManager {
|
|
|
570
456
|
extname,
|
|
571
457
|
pluginKey,
|
|
572
458
|
options
|
|
573
|
-
}: GetFileProps<TOptions>): File<{
|
|
459
|
+
}: GetFileProps<TOptions>): KubbFile.File<{
|
|
574
460
|
pluginKey: Plugin['key'];
|
|
575
461
|
}>;
|
|
576
|
-
resolvePath: <TOptions = object>(params: ResolvePathParams<TOptions>) => OptionalPath;
|
|
462
|
+
resolvePath: <TOptions = object>(params: ResolvePathParams<TOptions>) => KubbFile.OptionalPath;
|
|
577
463
|
resolveName: (params: ResolveNameParams) => string;
|
|
578
464
|
/**
|
|
579
465
|
* Instead of calling `pluginManager.events.on` you can use `pluginManager.on`. This one also has better types.
|
|
@@ -674,9 +560,9 @@ type FileMetaBase = {
|
|
|
674
560
|
type CoreGenerator<TOptions extends PluginFactoryOptions> = {
|
|
675
561
|
name: string;
|
|
676
562
|
type: 'core';
|
|
677
|
-
operations: (props: OperationsProps<TOptions>) => Promise<File[]>;
|
|
678
|
-
operation: (props: OperationProps<TOptions>) => Promise<File[]>;
|
|
679
|
-
schema: (props: SchemaProps<TOptions>) => Promise<File[]>;
|
|
563
|
+
operations: (props: OperationsProps<TOptions>) => Promise<KubbFile.File[]>;
|
|
564
|
+
operation: (props: OperationProps<TOptions>) => Promise<KubbFile.File[]>;
|
|
565
|
+
schema: (props: SchemaProps<TOptions>) => Promise<KubbFile.File[]>;
|
|
680
566
|
};
|
|
681
567
|
//#endregion
|
|
682
568
|
//#region ../plugin-oas/src/generators/createReactGenerator.d.ts
|
|
@@ -701,7 +587,7 @@ type Context$1<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
|
701
587
|
* Current plugin
|
|
702
588
|
*/
|
|
703
589
|
plugin: Plugin<TPluginOptions>;
|
|
704
|
-
mode: Mode;
|
|
590
|
+
mode: KubbFile.Mode;
|
|
705
591
|
};
|
|
706
592
|
declare class OperationGenerator<TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TPluginOptions['resolvedOptions'], Context$1<TPluginOptions['resolvedOptions'], TPluginOptions>> {
|
|
707
593
|
#private;
|
|
@@ -715,7 +601,7 @@ declare class OperationGenerator<TPluginOptions extends PluginFactoryOptions = P
|
|
|
715
601
|
method: HttpMethod;
|
|
716
602
|
operation: Operation$1;
|
|
717
603
|
}>>;
|
|
718
|
-
build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<File<TFileMeta>>>;
|
|
604
|
+
build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
|
|
719
605
|
}
|
|
720
606
|
//#endregion
|
|
721
607
|
//#region ../plugin-oas/src/SchemaMapper.d.ts
|
|
@@ -831,7 +717,7 @@ type SchemaKeywordMapper = {
|
|
|
831
717
|
/**
|
|
832
718
|
* Full qualified path.
|
|
833
719
|
*/
|
|
834
|
-
path: OptionalPath;
|
|
720
|
+
path: KubbFile.OptionalPath;
|
|
835
721
|
/**
|
|
836
722
|
* When true `File.Import` will be used.
|
|
837
723
|
* When false a reference will be used inside the current file.
|
|
@@ -944,7 +830,7 @@ type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
|
944
830
|
* Current plugin
|
|
945
831
|
*/
|
|
946
832
|
plugin: Plugin<TPluginOptions>;
|
|
947
|
-
mode: Mode;
|
|
833
|
+
mode: KubbFile.Mode;
|
|
948
834
|
include?: Array<'schemas' | 'responses' | 'requestBodies'>;
|
|
949
835
|
override: Array<Override<TOptions>> | undefined;
|
|
950
836
|
contentType?: contentType;
|
|
@@ -992,7 +878,7 @@ declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGe
|
|
|
992
878
|
static findInObject<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
|
|
993
879
|
static find<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
|
|
994
880
|
static combineObjects(tree: Schema[] | undefined): Schema[];
|
|
995
|
-
build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<File<TFileMeta>>>;
|
|
881
|
+
build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
|
|
996
882
|
}
|
|
997
883
|
//#endregion
|
|
998
884
|
//#region ../plugin-oas/src/generators/types.d.ts
|
|
@@ -1044,7 +930,7 @@ type ResolvePathOptions = {
|
|
|
1044
930
|
type Ref = {
|
|
1045
931
|
propertyName: string;
|
|
1046
932
|
originalName: string;
|
|
1047
|
-
path: OptionalPath;
|
|
933
|
+
path: KubbFile.OptionalPath;
|
|
1048
934
|
pluginKey?: Plugin['key'];
|
|
1049
935
|
};
|
|
1050
936
|
type Refs = Record<string, Ref>;
|
|
@@ -1238,4 +1124,4 @@ type ResolvedOptions = {
|
|
|
1238
1124
|
type PluginZod = PluginFactoryOptions<'plugin-zod', Options$1, ResolvedOptions, never, ResolvePathOptions>;
|
|
1239
1125
|
//#endregion
|
|
1240
1126
|
export { UserPluginWithLifeCycle as a, ReactGenerator as i, PluginZod as n, Operation$1 as o, Schema as r, SchemaObject$1 as s, Options$1 as t };
|
|
1241
|
-
//# sourceMappingURL=types-
|
|
1127
|
+
//# sourceMappingURL=types-CS916VXJ.d.ts.map
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { Fabric, FileManager } from "@kubb/react-fabric";
|
|
2
1
|
import * as OasTypes from "oas/types";
|
|
3
2
|
import { HttpMethods as HttpMethod, OASDocument, SchemaObject, User } from "oas/types";
|
|
4
3
|
import { Operation, Operation as Operation$1 } from "oas/operation";
|
|
5
4
|
import { OpenAPIV3 } from "openapi-types";
|
|
6
5
|
import * as oas_normalize_lib_types0 from "oas-normalize/lib/types";
|
|
7
6
|
import BaseOas from "oas";
|
|
7
|
+
import { KubbFile } from "@kubb/fabric-core/types";
|
|
8
|
+
import { Fabric, FileManager } from "@kubb/react-fabric";
|
|
8
9
|
import { ConsolaInstance, LogLevel } from "consola";
|
|
9
10
|
import { KubbNode } from "@kubb/react-fabric/types";
|
|
10
11
|
|
|
@@ -57,121 +58,6 @@ declare abstract class BaseGenerator<TOptions = unknown, TContext = unknown> {
|
|
|
57
58
|
abstract build(...params: unknown[]): unknown;
|
|
58
59
|
}
|
|
59
60
|
//#endregion
|
|
60
|
-
//#region ../core/src/fs/types.d.ts
|
|
61
|
-
type BasePath<T extends string = string> = `${T}/`;
|
|
62
|
-
type Import = {
|
|
63
|
-
/**
|
|
64
|
-
* Import name to be used
|
|
65
|
-
* @example ["useState"]
|
|
66
|
-
* @example "React"
|
|
67
|
-
*/
|
|
68
|
-
name: string | Array<string | {
|
|
69
|
-
propertyName: string;
|
|
70
|
-
name?: string;
|
|
71
|
-
}>;
|
|
72
|
-
/**
|
|
73
|
-
* Path for the import
|
|
74
|
-
* @example '@kubb/core'
|
|
75
|
-
*/
|
|
76
|
-
path: string;
|
|
77
|
-
/**
|
|
78
|
-
* Add `type` prefix to the import, this will result in: `import type { Type } from './path'`.
|
|
79
|
-
*/
|
|
80
|
-
isTypeOnly?: boolean;
|
|
81
|
-
isNameSpace?: boolean;
|
|
82
|
-
/**
|
|
83
|
-
* When root is set it will get the path with relative getRelativePath(root, path).
|
|
84
|
-
*/
|
|
85
|
-
root?: string;
|
|
86
|
-
};
|
|
87
|
-
type Source = {
|
|
88
|
-
name?: string;
|
|
89
|
-
value?: string;
|
|
90
|
-
isTypeOnly?: boolean;
|
|
91
|
-
/**
|
|
92
|
-
* Has const or type 'export'
|
|
93
|
-
* @default false
|
|
94
|
-
*/
|
|
95
|
-
isExportable?: boolean;
|
|
96
|
-
/**
|
|
97
|
-
* When set, barrel generation will add this
|
|
98
|
-
* @default false
|
|
99
|
-
*/
|
|
100
|
-
isIndexable?: boolean;
|
|
101
|
-
};
|
|
102
|
-
type Export = {
|
|
103
|
-
/**
|
|
104
|
-
* Export name to be used.
|
|
105
|
-
* @example ["useState"]
|
|
106
|
-
* @example "React"
|
|
107
|
-
*/
|
|
108
|
-
name?: string | Array<string>;
|
|
109
|
-
/**
|
|
110
|
-
* Path for the import.
|
|
111
|
-
* @example '@kubb/core'
|
|
112
|
-
*/
|
|
113
|
-
path: string;
|
|
114
|
-
/**
|
|
115
|
-
* Add `type` prefix to the export, this will result in: `export type { Type } from './path'`.
|
|
116
|
-
*/
|
|
117
|
-
isTypeOnly?: boolean;
|
|
118
|
-
/**
|
|
119
|
-
* Make it possible to override the name, this will result in: `export * as aliasName from './path'`.
|
|
120
|
-
*/
|
|
121
|
-
asAlias?: boolean;
|
|
122
|
-
};
|
|
123
|
-
type Extname = '.ts' | '.js' | '.tsx' | '.json' | `.${string}`;
|
|
124
|
-
type Mode = 'single' | 'split';
|
|
125
|
-
/**
|
|
126
|
-
* Name to be used to dynamicly create the baseName(based on input.path)
|
|
127
|
-
* Based on UNIX basename
|
|
128
|
-
* @link https://nodejs.org/api/path.html#pathbasenamepath-suffix
|
|
129
|
-
*/
|
|
130
|
-
type BaseName = `${string}.${string}`;
|
|
131
|
-
/**
|
|
132
|
-
* Path will be full qualified path to a specified file
|
|
133
|
-
*/
|
|
134
|
-
type Path = string;
|
|
135
|
-
type AdvancedPath<T extends BaseName = BaseName> = `${BasePath}${T}`;
|
|
136
|
-
type OptionalPath = Path | undefined | null;
|
|
137
|
-
type File$1<TMeta extends object = object> = {
|
|
138
|
-
/**
|
|
139
|
-
* Name to be used to create the path
|
|
140
|
-
* Based on UNIX basename, `${name}.extname`
|
|
141
|
-
* @link https://nodejs.org/api/path.html#pathbasenamepath-suffix
|
|
142
|
-
*/
|
|
143
|
-
baseName: BaseName;
|
|
144
|
-
/**
|
|
145
|
-
* Path will be full qualified path to a specified file
|
|
146
|
-
*/
|
|
147
|
-
path: AdvancedPath<BaseName> | Path;
|
|
148
|
-
sources: Array<Source>;
|
|
149
|
-
imports?: Array<Import>;
|
|
150
|
-
exports?: Array<Export>;
|
|
151
|
-
/**
|
|
152
|
-
* Use extra meta, this is getting used to generate the barrel/index files.
|
|
153
|
-
*/
|
|
154
|
-
meta?: TMeta;
|
|
155
|
-
banner?: string;
|
|
156
|
-
footer?: string;
|
|
157
|
-
};
|
|
158
|
-
type ResolvedImport = Import;
|
|
159
|
-
type ResolvedExport = Export;
|
|
160
|
-
type ResolvedFile<TMeta extends object = object> = File$1<TMeta> & {
|
|
161
|
-
/**
|
|
162
|
-
* @default object-hash
|
|
163
|
-
*/
|
|
164
|
-
id: string;
|
|
165
|
-
/**
|
|
166
|
-
* Contains the first part of the baseName, generated based on baseName
|
|
167
|
-
* @link https://nodejs.org/api/path.html#pathformatpathobject
|
|
168
|
-
*/
|
|
169
|
-
name: string;
|
|
170
|
-
extname: Extname;
|
|
171
|
-
imports: Array<ResolvedImport>;
|
|
172
|
-
exports: Array<ResolvedExport>;
|
|
173
|
-
};
|
|
174
|
-
//#endregion
|
|
175
61
|
//#region ../core/src/utils/EventEmitter.d.ts
|
|
176
62
|
declare class EventEmitter<TEvents extends Record<string, any>> {
|
|
177
63
|
#private;
|
|
@@ -295,7 +181,7 @@ type Config<TInput = Input> = {
|
|
|
295
181
|
* Override the extension to the generated imports and exports, by default each plugin will add an extension
|
|
296
182
|
* @default { '.ts': '.ts'}
|
|
297
183
|
*/
|
|
298
|
-
extension?: Record<Extname, Extname | ''>;
|
|
184
|
+
extension?: Record<KubbFile.Extname, KubbFile.Extname | ''>;
|
|
299
185
|
/**
|
|
300
186
|
* 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`.
|
|
301
187
|
* @default 'named'
|
|
@@ -426,7 +312,7 @@ type PluginLifecycle<TOptions extends PluginFactoryOptions = PluginFactoryOption
|
|
|
426
312
|
* @type hookFirst
|
|
427
313
|
* @example ('./Pet.ts', './src/gen/') => '/src/gen/Pet.ts'
|
|
428
314
|
*/
|
|
429
|
-
resolvePath?: (this: PluginContext<TOptions>, baseName: BaseName, mode?: Mode, options?: TOptions['resolvePathOptions']) => OptionalPath;
|
|
315
|
+
resolvePath?: (this: PluginContext<TOptions>, baseName: KubbFile.BaseName, mode?: KubbFile.Mode, options?: TOptions['resolvePathOptions']) => KubbFile.OptionalPath;
|
|
430
316
|
/**
|
|
431
317
|
* Resolve to a name based on a string.
|
|
432
318
|
* Useful when converting to PascalCase or camelCase.
|
|
@@ -444,8 +330,8 @@ type PluginLifecycleHooks = keyof PluginLifecycle;
|
|
|
444
330
|
type PluginParameter<H extends PluginLifecycleHooks> = Parameters<Required<PluginLifecycle>[H]>;
|
|
445
331
|
type ResolvePathParams<TOptions = object> = {
|
|
446
332
|
pluginKey?: Plugin['key'];
|
|
447
|
-
baseName: BaseName;
|
|
448
|
-
mode?: Mode;
|
|
333
|
+
baseName: KubbFile.BaseName;
|
|
334
|
+
mode?: KubbFile.Mode;
|
|
449
335
|
/**
|
|
450
336
|
* Options to be passed to 'resolvePath' 3th parameter
|
|
451
337
|
*/
|
|
@@ -470,8 +356,8 @@ type PluginContext<TOptions extends PluginFactoryOptions = PluginFactoryOptions>
|
|
|
470
356
|
*/
|
|
471
357
|
fileManager: FileManager;
|
|
472
358
|
pluginManager: PluginManager;
|
|
473
|
-
addFile: (...file: Array<File
|
|
474
|
-
resolvePath: (params: ResolvePathParams<TOptions['resolvePathOptions']>) => OptionalPath;
|
|
359
|
+
addFile: (...file: Array<KubbFile.File>) => Promise<Array<KubbFile.ResolvedFile>>;
|
|
360
|
+
resolvePath: (params: ResolvePathParams<TOptions['resolvePathOptions']>) => KubbFile.OptionalPath;
|
|
475
361
|
resolveName: (params: ResolveNameParams) => string;
|
|
476
362
|
logger: Logger;
|
|
477
363
|
/**
|
|
@@ -550,8 +436,8 @@ type Events = {
|
|
|
550
436
|
};
|
|
551
437
|
type GetFileProps<TOptions = object> = {
|
|
552
438
|
name: string;
|
|
553
|
-
mode?: Mode;
|
|
554
|
-
extname: Extname;
|
|
439
|
+
mode?: KubbFile.Mode;
|
|
440
|
+
extname: KubbFile.Extname;
|
|
555
441
|
pluginKey: Plugin['key'];
|
|
556
442
|
options?: TOptions;
|
|
557
443
|
};
|
|
@@ -570,10 +456,10 @@ declare class PluginManager {
|
|
|
570
456
|
extname,
|
|
571
457
|
pluginKey,
|
|
572
458
|
options
|
|
573
|
-
}: GetFileProps<TOptions>): File
|
|
459
|
+
}: GetFileProps<TOptions>): KubbFile.File<{
|
|
574
460
|
pluginKey: Plugin['key'];
|
|
575
461
|
}>;
|
|
576
|
-
resolvePath: <TOptions = object>(params: ResolvePathParams<TOptions>) => OptionalPath;
|
|
462
|
+
resolvePath: <TOptions = object>(params: ResolvePathParams<TOptions>) => KubbFile.OptionalPath;
|
|
577
463
|
resolveName: (params: ResolveNameParams) => string;
|
|
578
464
|
/**
|
|
579
465
|
* Instead of calling `pluginManager.events.on` you can use `pluginManager.on`. This one also has better types.
|
|
@@ -674,9 +560,9 @@ type FileMetaBase = {
|
|
|
674
560
|
type CoreGenerator<TOptions extends PluginFactoryOptions> = {
|
|
675
561
|
name: string;
|
|
676
562
|
type: 'core';
|
|
677
|
-
operations: (props: OperationsProps<TOptions>) => Promise<File
|
|
678
|
-
operation: (props: OperationProps<TOptions>) => Promise<File
|
|
679
|
-
schema: (props: SchemaProps<TOptions>) => Promise<File
|
|
563
|
+
operations: (props: OperationsProps<TOptions>) => Promise<KubbFile.File[]>;
|
|
564
|
+
operation: (props: OperationProps<TOptions>) => Promise<KubbFile.File[]>;
|
|
565
|
+
schema: (props: SchemaProps<TOptions>) => Promise<KubbFile.File[]>;
|
|
680
566
|
};
|
|
681
567
|
//#endregion
|
|
682
568
|
//#region ../plugin-oas/src/generators/createReactGenerator.d.ts
|
|
@@ -701,7 +587,7 @@ type Context$1<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
|
701
587
|
* Current plugin
|
|
702
588
|
*/
|
|
703
589
|
plugin: Plugin<TPluginOptions>;
|
|
704
|
-
mode: Mode;
|
|
590
|
+
mode: KubbFile.Mode;
|
|
705
591
|
};
|
|
706
592
|
declare class OperationGenerator<TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TPluginOptions['resolvedOptions'], Context$1<TPluginOptions['resolvedOptions'], TPluginOptions>> {
|
|
707
593
|
#private;
|
|
@@ -715,7 +601,7 @@ declare class OperationGenerator<TPluginOptions extends PluginFactoryOptions = P
|
|
|
715
601
|
method: HttpMethod;
|
|
716
602
|
operation: Operation$1;
|
|
717
603
|
}>>;
|
|
718
|
-
build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<File
|
|
604
|
+
build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
|
|
719
605
|
}
|
|
720
606
|
//#endregion
|
|
721
607
|
//#region ../plugin-oas/src/SchemaMapper.d.ts
|
|
@@ -831,7 +717,7 @@ type SchemaKeywordMapper = {
|
|
|
831
717
|
/**
|
|
832
718
|
* Full qualified path.
|
|
833
719
|
*/
|
|
834
|
-
path: OptionalPath;
|
|
720
|
+
path: KubbFile.OptionalPath;
|
|
835
721
|
/**
|
|
836
722
|
* When true `File.Import` will be used.
|
|
837
723
|
* When false a reference will be used inside the current file.
|
|
@@ -944,7 +830,7 @@ type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
|
944
830
|
* Current plugin
|
|
945
831
|
*/
|
|
946
832
|
plugin: Plugin<TPluginOptions>;
|
|
947
|
-
mode: Mode;
|
|
833
|
+
mode: KubbFile.Mode;
|
|
948
834
|
include?: Array<'schemas' | 'responses' | 'requestBodies'>;
|
|
949
835
|
override: Array<Override<TOptions>> | undefined;
|
|
950
836
|
contentType?: contentType;
|
|
@@ -992,7 +878,7 @@ declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGe
|
|
|
992
878
|
static findInObject<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
|
|
993
879
|
static find<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
|
|
994
880
|
static combineObjects(tree: Schema[] | undefined): Schema[];
|
|
995
|
-
build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<File
|
|
881
|
+
build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
|
|
996
882
|
}
|
|
997
883
|
//#endregion
|
|
998
884
|
//#region ../plugin-oas/src/generators/types.d.ts
|
|
@@ -1044,7 +930,7 @@ type ResolvePathOptions = {
|
|
|
1044
930
|
type Ref = {
|
|
1045
931
|
propertyName: string;
|
|
1046
932
|
originalName: string;
|
|
1047
|
-
path: OptionalPath;
|
|
933
|
+
path: KubbFile.OptionalPath;
|
|
1048
934
|
pluginKey?: Plugin['key'];
|
|
1049
935
|
};
|
|
1050
936
|
type Refs = Record<string, Ref>;
|
|
@@ -1238,4 +1124,4 @@ type ResolvedOptions = {
|
|
|
1238
1124
|
type PluginZod = PluginFactoryOptions<'plugin-zod', Options$1, ResolvedOptions, never, ResolvePathOptions>;
|
|
1239
1125
|
//#endregion
|
|
1240
1126
|
export { UserPluginWithLifeCycle as a, ReactGenerator as i, PluginZod as n, Operation$1 as o, Schema as r, SchemaObject$1 as s, Options$1 as t };
|
|
1241
|
-
//# sourceMappingURL=types-
|
|
1127
|
+
//# sourceMappingURL=types-Cd7g28dR.d.cts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/plugin-zod",
|
|
3
|
-
"version": "4.4.
|
|
3
|
+
"version": "4.4.1",
|
|
4
4
|
"description": "Zod schema generator plugin for Kubb, creating type-safe validation schemas from OpenAPI specifications for runtime data validation.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"zod",
|
|
@@ -68,22 +68,28 @@
|
|
|
68
68
|
"!/**/**.test.**",
|
|
69
69
|
"!/**/__tests__/**"
|
|
70
70
|
],
|
|
71
|
+
"size-limit": [
|
|
72
|
+
{
|
|
73
|
+
"path": "./dist/*.js",
|
|
74
|
+
"limit": "510 KiB",
|
|
75
|
+
"gzip": true
|
|
76
|
+
}
|
|
77
|
+
],
|
|
71
78
|
"dependencies": {
|
|
72
|
-
"@kubb/react-fabric": "0.2.
|
|
73
|
-
"@kubb/core": "4.4.
|
|
74
|
-
"@kubb/oas": "4.4.
|
|
75
|
-
"@kubb/plugin-oas": "4.4.
|
|
76
|
-
"@kubb/plugin-ts": "4.4.
|
|
79
|
+
"@kubb/react-fabric": "0.2.10",
|
|
80
|
+
"@kubb/core": "4.4.1",
|
|
81
|
+
"@kubb/oas": "4.4.1",
|
|
82
|
+
"@kubb/plugin-oas": "4.4.1",
|
|
83
|
+
"@kubb/plugin-ts": "4.4.1"
|
|
77
84
|
},
|
|
78
85
|
"devDependencies": {
|
|
79
86
|
"@asteasolutions/zod-to-openapi": "^8.1.0",
|
|
80
87
|
"@hono/zod-openapi": "0.19.2",
|
|
81
|
-
"tsdown": "^0.15.11",
|
|
82
88
|
"zod": "^3.25.76",
|
|
83
|
-
"@kubb/plugin-oas": "4.4.
|
|
89
|
+
"@kubb/plugin-oas": "4.4.1"
|
|
84
90
|
},
|
|
85
91
|
"peerDependencies": {
|
|
86
|
-
"@kubb/react-fabric": "0.2.
|
|
92
|
+
"@kubb/react-fabric": "0.2.10"
|
|
87
93
|
},
|
|
88
94
|
"engines": {
|
|
89
95
|
"node": ">=20"
|
|
@@ -93,7 +99,7 @@
|
|
|
93
99
|
"registry": "https://registry.npmjs.org/"
|
|
94
100
|
},
|
|
95
101
|
"scripts": {
|
|
96
|
-
"build": "tsdown",
|
|
102
|
+
"build": "tsdown && size-limit",
|
|
97
103
|
"clean": "npx rimraf ./dist",
|
|
98
104
|
"lint": "bun biome lint .",
|
|
99
105
|
"lint:fix": "bun biome lint --fix --unsafe .",
|