@kubb/plugin-zod 3.6.0 → 3.6.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/{chunk-I76DWSTD.cjs → chunk-7NPFNVHM.cjs} +12 -12
- package/dist/{chunk-I76DWSTD.cjs.map → chunk-7NPFNVHM.cjs.map} +1 -1
- package/dist/{chunk-YJM2VGBB.js → chunk-D5YO5ULC.js} +11 -11
- package/dist/{chunk-YJM2VGBB.js.map → chunk-D5YO5ULC.js.map} +1 -1
- package/dist/{chunk-XP7EMBLS.js → chunk-F6DEFQEU.js} +33 -32
- package/dist/chunk-F6DEFQEU.js.map +1 -0
- package/dist/{chunk-UXPJE55C.cjs → chunk-V3CWU5YT.cjs} +33 -32
- package/dist/chunk-V3CWU5YT.cjs.map +1 -0
- package/dist/components.cjs +3 -3
- package/dist/components.d.cts +1 -1
- package/dist/components.d.ts +1 -1
- package/dist/components.js +1 -1
- package/dist/generators.cjs +4 -4
- package/dist/generators.d.cts +1 -1
- package/dist/generators.d.ts +1 -1
- package/dist/generators.js +2 -2
- package/dist/index.cjs +7 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +8 -8
- package/dist/index.js.map +1 -1
- package/dist/{types-DhDFwK1h.d.cts → types-DwD5YcHZ.d.cts} +3 -3
- package/dist/{types-DhDFwK1h.d.ts → types-DwD5YcHZ.d.ts} +3 -3
- package/dist/utils.d.cts +1 -1
- package/dist/utils.d.ts +1 -1
- package/package.json +11 -11
- package/src/parser.ts +1 -0
- package/src/types.ts +1 -1
- package/src/utils/ToZod.ts +2 -1
- package/dist/chunk-UXPJE55C.cjs.map +0 -1
- package/dist/chunk-XP7EMBLS.js.map +0 -1
|
@@ -36,14 +36,15 @@ function Operations({ name, operations }) {
|
|
|
36
36
|
var zodKeywordMapper = {
|
|
37
37
|
any: () => "z.any()",
|
|
38
38
|
unknown: () => "z.unknown()",
|
|
39
|
+
void: () => "z.void()",
|
|
39
40
|
number: (coercion, min, max) => {
|
|
40
|
-
return [coercion ? "z.coerce.number()" : "z.number()", min !==
|
|
41
|
+
return [coercion ? "z.coerce.number()" : "z.number()", min !== void 0 ? `.min(${min})` : void 0, max !== void 0 ? `.max(${max})` : void 0].filter(Boolean).join("");
|
|
41
42
|
},
|
|
42
43
|
integer: (coercion, min, max) => {
|
|
43
44
|
return [
|
|
44
45
|
coercion ? "z.coerce.number().int()" : "z.number().int()",
|
|
45
|
-
min !==
|
|
46
|
-
max !==
|
|
46
|
+
min !== void 0 ? `.min(${min})` : void 0,
|
|
47
|
+
max !== void 0 ? `.max(${max})` : void 0
|
|
47
48
|
].filter(Boolean).join("");
|
|
48
49
|
},
|
|
49
50
|
object: (value) => {
|
|
@@ -52,7 +53,7 @@ var zodKeywordMapper = {
|
|
|
52
53
|
})`;
|
|
53
54
|
},
|
|
54
55
|
string: (coercion, min, max) => {
|
|
55
|
-
return [coercion ? "z.coerce.string()" : "z.string()", min !==
|
|
56
|
+
return [coercion ? "z.coerce.string()" : "z.string()", min !== void 0 ? `.min(${min})` : void 0, max !== void 0 ? `.max(${max})` : void 0].filter(Boolean).join("");
|
|
56
57
|
},
|
|
57
58
|
boolean: () => "z.boolean()",
|
|
58
59
|
undefined: () => "z.undefined()",
|
|
@@ -62,9 +63,9 @@ var zodKeywordMapper = {
|
|
|
62
63
|
array: (items = [], min, max, unique) => {
|
|
63
64
|
return [
|
|
64
65
|
`z.array(${items?.join("")})`,
|
|
65
|
-
min !==
|
|
66
|
-
max !==
|
|
67
|
-
unique ? `.refine(items => new Set(items).size === items.length, { message: "Array entries must be unique" })` :
|
|
66
|
+
min !== void 0 ? `.min(${min})` : void 0,
|
|
67
|
+
max !== void 0 ? `.max(${max})` : void 0,
|
|
68
|
+
unique ? `.refine(items => new Set(items).size === items.length, { message: "Array entries must be unique" })` : void 0
|
|
68
69
|
].filter(Boolean).join("");
|
|
69
70
|
},
|
|
70
71
|
tuple: (items = []) => `z.tuple([${items?.join(", ")}])`,
|
|
@@ -127,24 +128,24 @@ var zodKeywordMapper = {
|
|
|
127
128
|
optional: () => ".optional()",
|
|
128
129
|
matches: (value = "", coercion) => coercion ? `z.coerce.string().regex(${value})` : `z.string().regex(${value})`,
|
|
129
130
|
email: (coercion) => coercion ? "z.coerce.string().email()" : "z.string().email()",
|
|
130
|
-
firstName:
|
|
131
|
-
lastName:
|
|
132
|
-
password:
|
|
133
|
-
phone:
|
|
134
|
-
readOnly:
|
|
135
|
-
writeOnly:
|
|
131
|
+
firstName: void 0,
|
|
132
|
+
lastName: void 0,
|
|
133
|
+
password: void 0,
|
|
134
|
+
phone: void 0,
|
|
135
|
+
readOnly: void 0,
|
|
136
|
+
writeOnly: void 0,
|
|
136
137
|
ref: (value) => {
|
|
137
138
|
if (!value) {
|
|
138
|
-
return
|
|
139
|
+
return void 0;
|
|
139
140
|
}
|
|
140
141
|
return `z.lazy(() => ${value})`;
|
|
141
142
|
},
|
|
142
143
|
blob: () => "z.instanceof(File)",
|
|
143
|
-
deprecated:
|
|
144
|
-
example:
|
|
145
|
-
schema:
|
|
146
|
-
catchall: (value) => value ? `.catchall(${value})` :
|
|
147
|
-
name:
|
|
144
|
+
deprecated: void 0,
|
|
145
|
+
example: void 0,
|
|
146
|
+
schema: void 0,
|
|
147
|
+
catchall: (value) => value ? `.catchall(${value})` : void 0,
|
|
148
|
+
name: void 0
|
|
148
149
|
};
|
|
149
150
|
function sort(items) {
|
|
150
151
|
const order = [
|
|
@@ -178,7 +179,7 @@ function sort(items) {
|
|
|
178
179
|
return transformers2__default.default.orderBy(items, [(v) => order.indexOf(v.keyword)], ["asc"]);
|
|
179
180
|
}
|
|
180
181
|
var shouldCoerce = (coercion, type) => {
|
|
181
|
-
if (coercion ===
|
|
182
|
+
if (coercion === void 0) {
|
|
182
183
|
return false;
|
|
183
184
|
}
|
|
184
185
|
if (typeof coercion === "boolean") {
|
|
@@ -189,7 +190,7 @@ var shouldCoerce = (coercion, type) => {
|
|
|
189
190
|
function parse({ parent, current, siblings }, options) {
|
|
190
191
|
const value = zodKeywordMapper[current.keyword];
|
|
191
192
|
if (!value) {
|
|
192
|
-
return
|
|
193
|
+
return void 0;
|
|
193
194
|
}
|
|
194
195
|
if (pluginOas.isKeyword(current, pluginOas.schemaKeywords.union)) {
|
|
195
196
|
if (Array.isArray(current.args) && current.args.length === 1) {
|
|
@@ -262,11 +263,11 @@ function parse({ parent, current, siblings }, options) {
|
|
|
262
263
|
const baseSchemaOutput = sort(schemas).map((schema) => parse({ parent: current, current: schema, siblings: schemas }, options)).filter(Boolean).join("");
|
|
263
264
|
return `"${name}": ${options.wrapOutput ? options.wrapOutput({ output: baseSchemaOutput, schema: options.rawSchema?.properties?.[name] }) || baseSchemaOutput : baseSchemaOutput}`;
|
|
264
265
|
}).join(",\n");
|
|
265
|
-
const additionalProperties = current.args?.additionalProperties?.length ? current.args.additionalProperties.map((schema, _index, siblings2) => parse({ parent: current, current: schema, siblings: siblings2 }, options)).filter(Boolean).join("") :
|
|
266
|
+
const additionalProperties = current.args?.additionalProperties?.length ? current.args.additionalProperties.map((schema, _index, siblings2) => parse({ parent: current, current: schema, siblings: siblings2 }, options)).filter(Boolean).join("") : void 0;
|
|
266
267
|
const text = [
|
|
267
268
|
zodKeywordMapper.object(properties),
|
|
268
|
-
current.args?.strict ? zodKeywordMapper.strict() :
|
|
269
|
-
additionalProperties ? zodKeywordMapper.catchall(additionalProperties) :
|
|
269
|
+
current.args?.strict ? zodKeywordMapper.strict() : void 0,
|
|
270
|
+
additionalProperties ? zodKeywordMapper.catchall(additionalProperties) : void 0
|
|
270
271
|
].filter(Boolean);
|
|
271
272
|
return text.join("");
|
|
272
273
|
}
|
|
@@ -276,10 +277,10 @@ function parse({ parent, current, siblings }, options) {
|
|
|
276
277
|
);
|
|
277
278
|
}
|
|
278
279
|
if (pluginOas.isKeyword(current, pluginOas.schemaKeywords.const)) {
|
|
279
|
-
if (current.args.format === "number" && current.args.value !==
|
|
280
|
+
if (current.args.format === "number" && current.args.value !== void 0) {
|
|
280
281
|
return zodKeywordMapper.const(Number.parseInt(current.args.value?.toString()));
|
|
281
282
|
}
|
|
282
|
-
if (current.args.format === "boolean" && current.args.value !==
|
|
283
|
+
if (current.args.format === "boolean" && current.args.value !== void 0) {
|
|
283
284
|
return zodKeywordMapper.const(current.args.value);
|
|
284
285
|
}
|
|
285
286
|
return zodKeywordMapper.const(transformers2__default.default.stringify(current.args.value));
|
|
@@ -343,7 +344,7 @@ function parse({ parent, current, siblings }, options) {
|
|
|
343
344
|
if (current.keyword in zodKeywordMapper) {
|
|
344
345
|
return value();
|
|
345
346
|
}
|
|
346
|
-
return
|
|
347
|
+
return void 0;
|
|
347
348
|
}
|
|
348
349
|
function Zod({ name, typeName, tree, rawSchema, inferTypeName, mapper, coercion, keysToOmit, description, wrapOutput }) {
|
|
349
350
|
const hasTuple = tree.some((item) => pluginOas.isKeyword(item, pluginOas.schemaKeywords.tuple));
|
|
@@ -353,10 +354,10 @@ function Zod({ name, typeName, tree, rawSchema, inferTypeName, mapper, coercion,
|
|
|
353
354
|
}
|
|
354
355
|
return true;
|
|
355
356
|
}).map(
|
|
356
|
-
(schema, _index, siblings) => parse({ parent:
|
|
357
|
+
(schema, _index, siblings) => parse({ parent: void 0, current: schema, siblings }, { name, keysToOmit, typeName, description, mapper, coercion, wrapOutput, rawSchema })
|
|
357
358
|
).filter(Boolean).join("");
|
|
358
359
|
const suffix = output.endsWith(".nullable()") ? ".unwrap().and" : ".and";
|
|
359
|
-
const baseSchemaOutput = [output, keysToOmit?.length ? `${suffix}(z.object({ ${keysToOmit.map((key) => `${key}: z.never()`).join(",")} }))` :
|
|
360
|
+
const baseSchemaOutput = [output, keysToOmit?.length ? `${suffix}(z.object({ ${keysToOmit.map((key) => `${key}: z.never()`).join(",")} }))` : void 0].filter(Boolean).join("") || "z.undefined()";
|
|
360
361
|
const wrappedSchemaOutput = wrapOutput ? wrapOutput({ output: baseSchemaOutput, schema: rawSchema }) || baseSchemaOutput : baseSchemaOutput;
|
|
361
362
|
const finalOutput = typeName ? `${wrappedSchemaOutput} as unknown as ToZod<${typeName}>` : wrappedSchemaOutput;
|
|
362
363
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
@@ -366,7 +367,7 @@ function Zod({ name, typeName, tree, rawSchema, inferTypeName, mapper, coercion,
|
|
|
366
367
|
export: true,
|
|
367
368
|
name,
|
|
368
369
|
JSDoc: {
|
|
369
|
-
comments: [description ? `@description ${transformers2__default.default.jsStringEscape(description)}` :
|
|
370
|
+
comments: [description ? `@description ${transformers2__default.default.jsStringEscape(description)}` : void 0].filter(Boolean)
|
|
370
371
|
},
|
|
371
372
|
children: finalOutput
|
|
372
373
|
}
|
|
@@ -380,5 +381,5 @@ function Zod({ name, typeName, tree, rawSchema, inferTypeName, mapper, coercion,
|
|
|
380
381
|
|
|
381
382
|
exports.Operations = Operations;
|
|
382
383
|
exports.Zod = Zod;
|
|
383
|
-
//# sourceMappingURL=chunk-
|
|
384
|
-
//# sourceMappingURL=chunk-
|
|
384
|
+
//# sourceMappingURL=chunk-V3CWU5YT.cjs.map
|
|
385
|
+
//# sourceMappingURL=chunk-V3CWU5YT.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/Operations.tsx","../src/parser.ts","../src/components/Zod.tsx"],"names":["jsxs","Fragment","jsx","File","Const","transformers","schemaKeywords","isKeyword","siblings","value","Type"],"mappings":";;;;;;;;;;;;AAWO,SAAS,UAAW,CAAA,EAAE,IAAM,EAAA,UAAA,EAAqB,EAAA;AACtD,EAAA,MAAM,iBAAiB,UAAW,CAAA,MAAA;AAAA,IAChC,CAAC,MAAM,GAAQ,KAAA;AACb,MAAA,IAAA,CAAK,IAAI,GAAI,CAAA,SAAA,CAAU,gBAAgB,CAAA,CAAA,CAAG,IAAI,GAAI,CAAA,IAAA;AAElD,MAAO,OAAA,IAAA;AAA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AAA,EAAA,EAAK,MAAM,EAAA,IAAA,EAAC,IAAM,EAAA,aAAA,EAChB,QAAkB,EAAA,CAAA,eAAA,EAAA,IAAI,CACzB,CAAA,CAAA,EAAA;AAAA,KAEJ,EAAA;AAAA,GAEJ,EAAA,CAAA;AAEJ","file":"chunk-V3CWU5YT.cjs","sourcesContent":["import type { SchemaNames } from '@kubb/plugin-oas/hooks'\nimport { Const, File } from '@kubb/react'\n\nimport transformers from '@kubb/core/transformers'\nimport type { HttpMethod, Operation } from '@kubb/oas'\n\ntype Props = {\n name: string\n operations: Array<{ operation: Operation; data: SchemaNames }>\n}\n\nexport function Operations({ name, operations }: Props) {\n const operationsJSON = operations.reduce(\n (prev, acc) => {\n prev[`\"${acc.operation.getOperationId()}\"`] = acc.data\n\n return prev\n },\n {} as Record<string, unknown>,\n )\n\n const pathsJSON = operations.reduce(\n (prev, acc) => {\n prev[`\"${acc.operation.path}\"`] = {\n ...(prev[`\"${acc.operation.path}\"`] || ({} as Record<HttpMethod, string>)),\n [acc.operation.method]: `operations[\"${acc.operation.getOperationId()}\"]`,\n }\n\n return prev\n },\n {} as Record<string, Record<HttpMethod, string>>,\n )\n\n return (\n <>\n <File.Source name={name} isExportable isIndexable>\n <Const export name={name} asConst>\n {`{${transformers.stringifyObject(operationsJSON)}}`}\n </Const>\n </File.Source>\n <File.Source name={'paths'} isExportable isIndexable>\n <Const export name={'paths'} asConst>\n {`{${transformers.stringifyObject(pathsJSON)}}`}\n </Const>\n </File.Source>\n </>\n )\n}\n","import transformers from '@kubb/core/transformers'\nimport type { SchemaObject } from '@kubb/oas'\nimport { type SchemaKeywordMapper, type SchemaTree, isKeyword, schemaKeywords } from '@kubb/plugin-oas'\n\nimport type { Schema, SchemaKeywordBase, SchemaMapper } from '@kubb/plugin-oas'\n\nconst zodKeywordMapper = {\n any: () => 'z.any()',\n unknown: () => 'z.unknown()',\n void: () => 'z.void()',\n number: (coercion?: boolean, min?: number, max?: number) => {\n return [coercion ? 'z.coerce.number()' : 'z.number()', min !== undefined ? `.min(${min})` : undefined, max !== undefined ? `.max(${max})` : undefined]\n .filter(Boolean)\n .join('')\n },\n integer: (coercion?: boolean, min?: number, max?: number) => {\n return [\n coercion ? 'z.coerce.number().int()' : 'z.number().int()',\n min !== undefined ? `.min(${min})` : undefined,\n max !== undefined ? `.max(${max})` : undefined,\n ]\n .filter(Boolean)\n .join('')\n },\n object: (value?: string) => {\n return `z.object({\n ${value}\n })`\n },\n string: (coercion?: boolean, min?: number, max?: number) => {\n return [coercion ? 'z.coerce.string()' : 'z.string()', min !== undefined ? `.min(${min})` : undefined, max !== undefined ? `.max(${max})` : undefined]\n .filter(Boolean)\n .join('')\n },\n boolean: () => 'z.boolean()',\n undefined: () => 'z.undefined()',\n nullable: () => '.nullable()',\n null: () => 'z.null()',\n nullish: () => '.nullish()',\n array: (items: string[] = [], min?: number, max?: number, unique?: boolean) => {\n return [\n `z.array(${items?.join('')})`,\n min !== undefined ? `.min(${min})` : undefined,\n max !== undefined ? `.max(${max})` : undefined,\n unique ? `.refine(items => new Set(items).size === items.length, { message: \"Array entries must be unique\" })` : undefined,\n ]\n .filter(Boolean)\n .join('')\n },\n tuple: (items: string[] = []) => `z.tuple([${items?.join(', ')}])`,\n enum: (items: string[] = []) => `z.enum([${items?.join(', ')}])`,\n union: (items: string[] = []) => `z.union([${items?.join(', ')}])`,\n const: (value?: string | number | boolean) => `z.literal(${value ?? ''})`,\n /**\n * ISO 8601\n */\n datetime: (offset = false, local = false) => {\n if (offset) {\n return `z.string().datetime({ offset: ${offset} })`\n }\n\n if (local) {\n return `z.string().datetime({ local: ${local} })`\n }\n\n return 'z.string().datetime()'\n },\n /**\n * Type `'date'` Date\n * Type `'string'` ISO date format (YYYY-MM-DD)\n * @default ISO date format (YYYY-MM-DD)\n */\n date: (type: 'date' | 'string' = 'string', coercion?: boolean) => {\n if (type === 'string') {\n return 'z.string().date()'\n }\n\n if (coercion) {\n return 'z.coerce.date()'\n }\n\n return 'z.date()'\n },\n /**\n * Type `'date'` Date\n * Type `'string'` ISO time format (HH:mm:ss[.SSSSSS])\n * @default ISO time format (HH:mm:ss[.SSSSSS])\n */\n time: (type: 'date' | 'string' = 'string', coercion?: boolean) => {\n if (type === 'string') {\n return 'z.string().time()'\n }\n\n if (coercion) {\n return 'z.coerce.date()'\n }\n\n return 'z.date()'\n },\n uuid: (coercion?: boolean) => (coercion ? 'z.coerce.string().uuid()' : 'z.string().uuid()'),\n url: (coercion?: boolean) => (coercion ? 'z.coerce.string().url()' : 'z.string().url()'),\n strict: () => '.strict()',\n default: (value?: string | number | true | object) => {\n if (typeof value === 'object') {\n return '.default({})'\n }\n return `.default(${value ?? ''})`\n },\n and: (items: string[] = []) => items?.map((item) => `.and(${item})`).join(''),\n describe: (value = '') => `.describe(${value})`,\n min: (value?: number) => `.min(${value ?? ''})`,\n max: (value?: number) => `.max(${value ?? ''})`,\n optional: () => '.optional()',\n matches: (value = '', coercion?: boolean) => (coercion ? `z.coerce.string().regex(${value})` : `z.string().regex(${value})`),\n email: (coercion?: boolean) => (coercion ? 'z.coerce.string().email()' : 'z.string().email()'),\n firstName: undefined,\n lastName: undefined,\n password: undefined,\n phone: undefined,\n readOnly: undefined,\n writeOnly: undefined,\n ref: (value?: string) => {\n if (!value) {\n return undefined\n }\n\n return `z.lazy(() => ${value})`\n },\n blob: () => 'z.instanceof(File)',\n deprecated: undefined,\n example: undefined,\n schema: undefined,\n catchall: (value?: string) => (value ? `.catchall(${value})` : undefined),\n name: undefined,\n} satisfies SchemaMapper<string | null | undefined>\n\n/**\n * @link based on https://github.com/cellular/oazapfts/blob/7ba226ebb15374e8483cc53e7532f1663179a22c/src/codegen/generate.ts#L398\n */\n\nexport function sort(items?: Schema[]): Schema[] {\n const order: string[] = [\n schemaKeywords.string,\n schemaKeywords.datetime,\n schemaKeywords.date,\n schemaKeywords.time,\n schemaKeywords.tuple,\n schemaKeywords.number,\n schemaKeywords.object,\n schemaKeywords.enum,\n schemaKeywords.url,\n schemaKeywords.email,\n schemaKeywords.firstName,\n schemaKeywords.lastName,\n schemaKeywords.password,\n schemaKeywords.matches,\n schemaKeywords.uuid,\n schemaKeywords.min,\n schemaKeywords.max,\n schemaKeywords.default,\n schemaKeywords.describe,\n schemaKeywords.optional,\n schemaKeywords.nullable,\n schemaKeywords.nullish,\n schemaKeywords.null,\n ]\n\n if (!items) {\n return []\n }\n\n return transformers.orderBy(items, [(v) => order.indexOf(v.keyword)], ['asc'])\n}\n\nconst shouldCoerce = (coercion: ParserOptions['coercion'] | undefined, type: 'dates' | 'strings' | 'numbers'): boolean => {\n if (coercion === undefined) {\n return false\n }\n if (typeof coercion === 'boolean') {\n return coercion\n }\n\n return !!coercion[type]\n}\n\ntype ParserOptions = {\n name: string\n typeName?: string\n description?: string\n keysToOmit?: string[]\n mapper?: Record<string, string>\n coercion?: boolean | { dates?: boolean; strings?: boolean; numbers?: boolean }\n wrapOutput?: (opts: { output: string; schema: any }) => string | undefined\n rawSchema: SchemaObject\n}\n\nexport function parse({ parent, current, siblings }: SchemaTree, options: ParserOptions): string | undefined {\n const value = zodKeywordMapper[current.keyword as keyof typeof zodKeywordMapper]\n\n if (!value) {\n return undefined\n }\n\n if (isKeyword(current, schemaKeywords.union)) {\n // zod union type needs at least 2 items\n if (Array.isArray(current.args) && current.args.length === 1) {\n return parse({ parent, current: current.args[0] as Schema, siblings }, options)\n }\n if (Array.isArray(current.args) && !current.args.length) {\n return ''\n }\n\n return zodKeywordMapper.union(\n sort(current.args)\n .map((schema, _index, siblings) => parse({ parent: current, current: schema, siblings }, options))\n .filter(Boolean),\n )\n }\n\n if (isKeyword(current, schemaKeywords.and)) {\n const items = sort(current.args)\n .filter((schema: Schema) => {\n return ![schemaKeywords.optional, schemaKeywords.describe].includes(schema.keyword as typeof schemaKeywords.describe)\n })\n .map((schema: Schema, _index, siblings) => parse({ parent: current, current: schema, siblings }, options))\n .filter(Boolean)\n\n return `${items.slice(0, 1)}${zodKeywordMapper.and(items.slice(1))}`\n }\n\n if (isKeyword(current, schemaKeywords.array)) {\n return zodKeywordMapper.array(\n sort(current.args.items)\n .map((schemas, _index, siblings) => parse({ parent: current, current: schemas, siblings }, options))\n .filter(Boolean),\n current.args.min,\n current.args.max,\n current.args.unique,\n )\n }\n\n if (isKeyword(current, schemaKeywords.enum)) {\n if (current.args.asConst) {\n if (current.args.items.length === 1) {\n const child = {\n keyword: schemaKeywords.const,\n args: current.args.items[0],\n }\n return parse({ parent: current, current: child, siblings: [child] }, options)\n }\n\n return zodKeywordMapper.union(\n current.args.items\n .map((schema) => ({\n keyword: schemaKeywords.const,\n args: schema,\n }))\n .map((schema, _index, siblings) => {\n return parse({ parent: current, current: schema, siblings }, options)\n })\n .filter(Boolean),\n )\n }\n\n return zodKeywordMapper.enum(\n current.args.items.map((schema) => {\n if (schema.format === 'boolean') {\n return transformers.stringify(schema.value)\n }\n\n if (schema.format === 'number') {\n return transformers.stringify(schema.value)\n }\n return transformers.stringify(schema.value)\n }),\n )\n }\n\n if (isKeyword(current, schemaKeywords.ref)) {\n return zodKeywordMapper.ref(current.args?.name)\n }\n\n if (isKeyword(current, schemaKeywords.object)) {\n const properties = Object.entries(current.args?.properties || {})\n .filter((item) => {\n const schema = item[1]\n return schema && typeof schema.map === 'function'\n })\n .map(([name, schemas]) => {\n const nameSchema = schemas.find((schema) => schema.keyword === schemaKeywords.name) as SchemaKeywordMapper['name']\n const mappedName = nameSchema?.args || name\n\n // custom mapper(pluginOptions)\n if (options.mapper?.[mappedName]) {\n return `\"${name}\": ${options.mapper?.[mappedName]}`\n }\n\n const baseSchemaOutput = sort(schemas)\n .map((schema) => parse({ parent: current, current: schema, siblings: schemas }, options))\n .filter(Boolean)\n .join('')\n\n return `\"${name}\": ${options.wrapOutput ? options.wrapOutput({ output: baseSchemaOutput, schema: options.rawSchema?.properties?.[name] }) || baseSchemaOutput : baseSchemaOutput}`\n })\n .join(',\\n')\n\n const additionalProperties = current.args?.additionalProperties?.length\n ? current.args.additionalProperties\n .map((schema, _index, siblings) => parse({ parent: current, current: schema, siblings }, options))\n .filter(Boolean)\n .join('')\n : undefined\n\n const text = [\n zodKeywordMapper.object(properties),\n current.args?.strict ? zodKeywordMapper.strict() : undefined,\n additionalProperties ? zodKeywordMapper.catchall(additionalProperties) : undefined,\n ].filter(Boolean)\n\n return text.join('')\n }\n\n if (isKeyword(current, schemaKeywords.tuple)) {\n return zodKeywordMapper.tuple(\n current.args.items.map((schema, _index, siblings) => parse({ parent: current, current: schema, siblings }, options)).filter(Boolean),\n )\n }\n\n if (isKeyword(current, schemaKeywords.const)) {\n if (current.args.format === 'number' && current.args.value !== undefined) {\n return zodKeywordMapper.const(Number.parseInt(current.args.value?.toString()))\n }\n\n if (current.args.format === 'boolean' && current.args.value !== undefined) {\n return zodKeywordMapper.const(current.args.value)\n }\n return zodKeywordMapper.const(transformers.stringify(current.args.value))\n }\n\n if (isKeyword(current, schemaKeywords.matches)) {\n if (current.args) {\n return zodKeywordMapper.matches(transformers.toRegExpString(current.args, null), shouldCoerce(options.coercion, 'strings'))\n }\n }\n\n if (isKeyword(current, schemaKeywords.default)) {\n if (current.args) {\n return zodKeywordMapper.default(current.args)\n }\n }\n\n if (isKeyword(current, schemaKeywords.describe)) {\n if (current.args) {\n return zodKeywordMapper.describe(transformers.stringify(current.args.toString()))\n }\n }\n\n if (isKeyword(current, schemaKeywords.string)) {\n return zodKeywordMapper.string(shouldCoerce(options.coercion, 'strings'))\n }\n\n if (isKeyword(current, schemaKeywords.uuid)) {\n return zodKeywordMapper.uuid(shouldCoerce(options.coercion, 'strings'))\n }\n\n if (isKeyword(current, schemaKeywords.email)) {\n return zodKeywordMapper.email(shouldCoerce(options.coercion, 'strings'))\n }\n\n if (isKeyword(current, schemaKeywords.url)) {\n return zodKeywordMapper.url(shouldCoerce(options.coercion, 'strings'))\n }\n\n if (isKeyword(current, schemaKeywords.number)) {\n return zodKeywordMapper.number(shouldCoerce(options.coercion, 'numbers'))\n }\n\n if (isKeyword(current, schemaKeywords.integer)) {\n return zodKeywordMapper.integer(shouldCoerce(options.coercion, 'numbers'))\n }\n\n if (isKeyword(current, schemaKeywords.min)) {\n return zodKeywordMapper.min(current.args)\n }\n if (isKeyword(current, schemaKeywords.max)) {\n return zodKeywordMapper.max(current.args)\n }\n\n if (isKeyword(current, schemaKeywords.datetime)) {\n return zodKeywordMapper.datetime(current.args.offset, current.args.local)\n }\n\n if (isKeyword(current, schemaKeywords.date)) {\n return zodKeywordMapper.date(current.args.type, shouldCoerce(options.coercion, 'dates'))\n }\n\n if (isKeyword(current, schemaKeywords.time)) {\n return zodKeywordMapper.time(current.args.type, shouldCoerce(options.coercion, 'dates'))\n }\n\n if (current.keyword in zodKeywordMapper && 'args' in current) {\n const value = zodKeywordMapper[current.keyword as keyof typeof zodKeywordMapper] as (typeof zodKeywordMapper)['const']\n\n return value((current as SchemaKeywordBase<unknown>).args as any)\n }\n\n if (isKeyword(current, schemaKeywords.optional)) {\n if (siblings.some((schema) => isKeyword(schema, schemaKeywords.default))) return ''\n\n return value()\n }\n\n if (current.keyword in zodKeywordMapper) {\n return value()\n }\n\n return undefined\n}\n","import transformers from '@kubb/core/transformers'\nimport { type Schema, schemaKeywords } from '@kubb/plugin-oas'\nimport { isKeyword } from '@kubb/plugin-oas'\nimport { Const, File, Type } from '@kubb/react'\nimport * as parserZod from '../parser.ts'\nimport type { PluginZod } from '../types.ts'\nimport type { SchemaObject } from '@kubb/oas'\n\ntype Props = {\n name: string\n typeName?: string\n inferTypeName?: string\n tree: Array<Schema>\n rawSchema: SchemaObject\n description?: string\n coercion: PluginZod['resolvedOptions']['coercion']\n mapper: PluginZod['resolvedOptions']['mapper']\n keysToOmit?: string[]\n wrapOutput?: PluginZod['resolvedOptions']['wrapOutput']\n}\n\nexport function Zod({ name, typeName, tree, rawSchema, inferTypeName, mapper, coercion, keysToOmit, description, wrapOutput }: Props) {\n const hasTuple = tree.some((item) => isKeyword(item, schemaKeywords.tuple))\n\n const output = parserZod\n .sort(tree)\n .filter((item) => {\n if (hasTuple && (isKeyword(item, schemaKeywords.min) || isKeyword(item, schemaKeywords.max))) {\n return false\n }\n\n return true\n })\n .map((schema, _index, siblings) =>\n parserZod.parse({ parent: undefined, current: schema, siblings }, { name, keysToOmit, typeName, description, mapper, coercion, wrapOutput, rawSchema }),\n )\n .filter(Boolean)\n .join('')\n\n const suffix = output.endsWith('.nullable()') ? '.unwrap().and' : '.and'\n const baseSchemaOutput =\n [output, keysToOmit?.length ? `${suffix}(z.object({ ${keysToOmit.map((key) => `${key}: z.never()`).join(',')} }))` : undefined].filter(Boolean).join('') ||\n 'z.undefined()'\n const wrappedSchemaOutput = wrapOutput ? wrapOutput({ output: baseSchemaOutput, schema: rawSchema }) || baseSchemaOutput : baseSchemaOutput\n const finalOutput = typeName ? `${wrappedSchemaOutput} as unknown as ToZod<${typeName}>` : wrappedSchemaOutput\n\n return (\n <>\n <File.Source name={name} isExportable isIndexable>\n <Const\n export\n name={name}\n JSDoc={{\n comments: [description ? `@description ${transformers.jsStringEscape(description)}` : undefined].filter(Boolean),\n }}\n >\n {finalOutput}\n </Const>\n </File.Source>\n {inferTypeName && (\n <File.Source name={inferTypeName} isExportable isIndexable isTypeOnly>\n {typeName && (\n <Type export name={inferTypeName}>\n {typeName}\n </Type>\n )}\n {!typeName && (\n <Type export name={inferTypeName}>\n {`z.infer<typeof ${name}>`}\n </Type>\n )}\n </File.Source>\n )}\n </>\n )\n}\n"]}
|
package/dist/components.cjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkV3CWU5YT_cjs = require('./chunk-V3CWU5YT.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, "Operations", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function () { return
|
|
9
|
+
get: function () { return chunkV3CWU5YT_cjs.Operations; }
|
|
10
10
|
});
|
|
11
11
|
Object.defineProperty(exports, "Zod", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunkV3CWU5YT_cjs.Zod; }
|
|
14
14
|
});
|
|
15
15
|
//# sourceMappingURL=components.cjs.map
|
|
16
16
|
//# sourceMappingURL=components.cjs.map
|
package/dist/components.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SchemaNames } from '@kubb/plugin-oas/hooks';
|
|
2
2
|
import { Operation, SchemaObject } from '@kubb/oas';
|
|
3
3
|
import { Schema } from '@kubb/plugin-oas';
|
|
4
|
-
import { P as PluginZod } from './types-
|
|
4
|
+
import { P as PluginZod } from './types-DwD5YcHZ.cjs';
|
|
5
5
|
import '@kubb/core';
|
|
6
6
|
|
|
7
7
|
type Props$1 = {
|
package/dist/components.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SchemaNames } from '@kubb/plugin-oas/hooks';
|
|
2
2
|
import { Operation, SchemaObject } from '@kubb/oas';
|
|
3
3
|
import { Schema } from '@kubb/plugin-oas';
|
|
4
|
-
import { P as PluginZod } from './types-
|
|
4
|
+
import { P as PluginZod } from './types-DwD5YcHZ.js';
|
|
5
5
|
import '@kubb/core';
|
|
6
6
|
|
|
7
7
|
type Props$1 = {
|
package/dist/components.js
CHANGED
package/dist/generators.cjs
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
3
|
+
var chunk7NPFNVHM_cjs = require('./chunk-7NPFNVHM.cjs');
|
|
4
|
+
require('./chunk-V3CWU5YT.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
Object.defineProperty(exports, "operationsGenerator", {
|
|
9
9
|
enumerable: true,
|
|
10
|
-
get: function () { return
|
|
10
|
+
get: function () { return chunk7NPFNVHM_cjs.operationsGenerator; }
|
|
11
11
|
});
|
|
12
12
|
Object.defineProperty(exports, "zodGenerator", {
|
|
13
13
|
enumerable: true,
|
|
14
|
-
get: function () { return
|
|
14
|
+
get: function () { return chunk7NPFNVHM_cjs.zodGenerator; }
|
|
15
15
|
});
|
|
16
16
|
//# sourceMappingURL=generators.cjs.map
|
|
17
17
|
//# sourceMappingURL=generators.cjs.map
|
package/dist/generators.d.cts
CHANGED
package/dist/generators.d.ts
CHANGED
package/dist/generators.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { operationsGenerator, zodGenerator } from './chunk-
|
|
2
|
-
import './chunk-
|
|
1
|
+
export { operationsGenerator, zodGenerator } from './chunk-D5YO5ULC.js';
|
|
2
|
+
import './chunk-F6DEFQEU.js';
|
|
3
3
|
//# sourceMappingURL=generators.js.map
|
|
4
4
|
//# sourceMappingURL=generators.js.map
|
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
3
|
+
var chunk7NPFNVHM_cjs = require('./chunk-7NPFNVHM.cjs');
|
|
4
|
+
require('./chunk-V3CWU5YT.cjs');
|
|
5
5
|
var path = require('path');
|
|
6
6
|
var core = require('@kubb/core');
|
|
7
7
|
var transformers = require('@kubb/core/transformers');
|
|
@@ -29,8 +29,8 @@ var pluginZod = core.createPlugin((options) => {
|
|
|
29
29
|
importPath = "zod",
|
|
30
30
|
coercion = false,
|
|
31
31
|
inferred = false,
|
|
32
|
-
generators = [
|
|
33
|
-
wrapOutput =
|
|
32
|
+
generators = [chunk7NPFNVHM_cjs.zodGenerator, operations ? chunk7NPFNVHM_cjs.operationsGenerator : void 0].filter(Boolean),
|
|
33
|
+
wrapOutput = void 0,
|
|
34
34
|
contentType
|
|
35
35
|
} = options;
|
|
36
36
|
return {
|
|
@@ -52,7 +52,7 @@ var pluginZod = core.createPlugin((options) => {
|
|
|
52
52
|
group,
|
|
53
53
|
wrapOutput
|
|
54
54
|
},
|
|
55
|
-
pre: [pluginOas.pluginOasName, typed ? pluginTs.pluginTsName :
|
|
55
|
+
pre: [pluginOas.pluginOasName, typed ? pluginTs.pluginTsName : void 0].filter(Boolean),
|
|
56
56
|
resolvePath(baseName, pathMode, options2) {
|
|
57
57
|
const root = path__default.default.resolve(this.config.root, this.config.output.path);
|
|
58
58
|
const mode = pathMode ?? core.FileManager.getMode(path__default.default.resolve(root, output.path));
|
|
@@ -79,7 +79,7 @@ var pluginZod = core.createPlugin((options) => {
|
|
|
79
79
|
},
|
|
80
80
|
resolveName(name, type) {
|
|
81
81
|
let resolvedName = transformers.camelCase(name, {
|
|
82
|
-
suffix: type ? "schema" :
|
|
82
|
+
suffix: type ? "schema" : void 0,
|
|
83
83
|
isFile: type === "file"
|
|
84
84
|
});
|
|
85
85
|
if (type === "type") {
|
|
@@ -100,7 +100,7 @@ var pluginZod = core.createPlugin((options) => {
|
|
|
100
100
|
pluginManager: this.pluginManager,
|
|
101
101
|
plugin: this.plugin,
|
|
102
102
|
contentType,
|
|
103
|
-
include:
|
|
103
|
+
include: void 0,
|
|
104
104
|
override,
|
|
105
105
|
mode,
|
|
106
106
|
output: output.path
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/plugin.ts"],"names":["createPlugin","transformers","zodGenerator","operationsGenerator","pluginOasName","pluginTsName","options","path","FileManager","camelCase","pascalCase","PluginManager","SchemaGenerator","OperationGenerator"],"mappings":";;;;;;;;;;;;;;AAcO,IAAM,aAAgB,GAAA;AAEhB,IAAA,SAAA,GAAYA,iBAAwB,CAAA,CAAC,OAAY,KAAA;AAC5D,EAAM,MAAA;AAAA,IACJ,MAAS,GAAA,EAAE,IAAM,EAAA,KAAA,EAAO,YAAY,OAAQ,EAAA;AAAA,IAC5C,KAAA;AAAA,IACA,UAAU,EAAC;AAAA,IACX,OAAA;AAAA,IACA,WAAW,EAAC;AAAA,kBACZC,iBAAe,EAAC;AAAA,IAChB,QAAW,GAAA,QAAA;AAAA,IACX,WAAc,GAAA,KAAA;AAAA,IACd,KAAQ,GAAA,KAAA;AAAA,IACR,SAAS,EAAC;AAAA,IACV,UAAa,GAAA,KAAA;AAAA,IACb,UAAa,GAAA,KAAA;AAAA,IACb,QAAW,GAAA,KAAA;AAAA,IACX,QAAW,GAAA,KAAA;AAAA,IACX,UAAA,GAAa,CAACC,8BAAc,EAAA,UAAA,GAAaC,wCAAsB,
|
|
1
|
+
{"version":3,"sources":["../src/plugin.ts"],"names":["createPlugin","transformers","zodGenerator","operationsGenerator","pluginOasName","pluginTsName","options","path","FileManager","camelCase","pascalCase","PluginManager","SchemaGenerator","OperationGenerator"],"mappings":";;;;;;;;;;;;;;AAcO,IAAM,aAAgB,GAAA;AAEhB,IAAA,SAAA,GAAYA,iBAAwB,CAAA,CAAC,OAAY,KAAA;AAC5D,EAAM,MAAA;AAAA,IACJ,MAAS,GAAA,EAAE,IAAM,EAAA,KAAA,EAAO,YAAY,OAAQ,EAAA;AAAA,IAC5C,KAAA;AAAA,IACA,UAAU,EAAC;AAAA,IACX,OAAA;AAAA,IACA,WAAW,EAAC;AAAA,kBACZC,iBAAe,EAAC;AAAA,IAChB,QAAW,GAAA,QAAA;AAAA,IACX,WAAc,GAAA,KAAA;AAAA,IACd,KAAQ,GAAA,KAAA;AAAA,IACR,SAAS,EAAC;AAAA,IACV,UAAa,GAAA,KAAA;AAAA,IACb,UAAa,GAAA,KAAA;AAAA,IACb,QAAW,GAAA,KAAA;AAAA,IACX,QAAW,GAAA,KAAA;AAAA,IACX,UAAA,GAAa,CAACC,8BAAc,EAAA,UAAA,GAAaC,wCAAsB,MAAS,CAAA,CAAE,OAAO,OAAO,CAAA;AAAA,IACxF,UAAa,GAAA,MAAA;AAAA,IACb;AAAA,GACE,GAAA,OAAA;AAEJ,EAAO,OAAA;AAAA,IACL,IAAM,EAAA,aAAA;AAAA,IACN,OAAS,EAAA;AAAA,MACP,MAAA;AAAA,oBACAF,cAAA;AAAA,MACA,O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CAAA;AAAA;AACnC,GACF;AACF,CAAC","file":"index.cjs","sourcesContent":["import path from 'node:path'\n\nimport { FileManager, type Group, PluginManager, createPlugin } from '@kubb/core'\nimport { camelCase, pascalCase } from '@kubb/core/transformers'\nimport { OperationGenerator, SchemaGenerator, pluginOasName } from '@kubb/plugin-oas'\n\nimport { pluginTsName } from '@kubb/plugin-ts'\n\nimport type { Plugin } from '@kubb/core'\nimport type { PluginOas as SwaggerPluginOptions } from '@kubb/plugin-oas'\nimport { operationsGenerator } from './generators'\nimport { zodGenerator } from './generators/zodGenerator.tsx'\nimport type { PluginZod } from './types.ts'\n\nexport const pluginZodName = 'plugin-zod' satisfies PluginZod['name']\n\nexport const pluginZod = createPlugin<PluginZod>((options) => {\n const {\n output = { path: 'zod', barrelType: 'named' },\n group,\n exclude = [],\n include,\n override = [],\n transformers = {},\n dateType = 'string',\n unknownType = 'any',\n typed = false,\n mapper = {},\n operations = false,\n importPath = 'zod',\n coercion = false,\n inferred = false,\n generators = [zodGenerator, operations ? operationsGenerator : undefined].filter(Boolean),\n wrapOutput = undefined,\n contentType,\n } = options\n\n return {\n name: pluginZodName,\n options: {\n output,\n transformers,\n include,\n exclude,\n override,\n typed,\n dateType,\n unknownType,\n mapper,\n importPath,\n coercion,\n operations,\n inferred,\n group,\n wrapOutput,\n },\n pre: [pluginOasName, typed ? pluginTsName : undefined].filter(Boolean),\n resolvePath(baseName, pathMode, options) {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = pathMode ?? FileManager.getMode(path.resolve(root, output.path))\n\n if (mode === 'single') {\n /**\n * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend\n * Other plugins then need to call addOrAppend instead of just add from the fileManager class\n */\n return path.resolve(root, output.path)\n }\n\n if (group && (options?.group?.path || options?.group?.tag)) {\n const groupName: Group['name'] = group?.name\n ? group.name\n : (ctx) => {\n if (group?.type === 'path') {\n return `${ctx.group.split('/')[1]}`\n }\n return `${camelCase(ctx.group)}Controller`\n }\n\n return path.resolve(\n root,\n output.path,\n groupName({\n group: group.type === 'path' ? options.group.path! : options.group.tag!,\n }),\n baseName,\n )\n }\n\n return path.resolve(root, output.path, baseName)\n },\n resolveName(name, type) {\n let resolvedName = camelCase(name, {\n suffix: type ? 'schema' : undefined,\n isFile: type === 'file',\n })\n\n if (type === 'type') {\n resolvedName = pascalCase(resolvedName)\n }\n\n if (type) {\n return transformers?.name?.(resolvedName, type) || resolvedName\n }\n\n return resolvedName\n },\n async buildStart() {\n const [swaggerPlugin]: [Plugin<SwaggerPluginOptions>] = PluginManager.getDependedPlugins<SwaggerPluginOptions>(this.plugins, [pluginOasName])\n\n const oas = await swaggerPlugin.context.getOas()\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = FileManager.getMode(path.resolve(root, output.path))\n\n const schemaGenerator = new SchemaGenerator(this.plugin.options, {\n oas,\n pluginManager: this.pluginManager,\n plugin: this.plugin,\n contentType,\n include: undefined,\n override,\n mode,\n output: output.path,\n })\n\n const schemaFiles = await schemaGenerator.build(...generators)\n await this.addFile(...schemaFiles)\n\n const operationGenerator = new OperationGenerator(this.plugin.options, {\n oas,\n pluginManager: this.pluginManager,\n plugin: this.plugin,\n contentType,\n exclude,\n include,\n override,\n mode,\n })\n\n const operationFiles = await operationGenerator.build(...generators)\n await this.addFile(...operationFiles)\n\n const barrelFiles = await this.fileManager.getBarrelFiles({\n type: output.barrelType ?? 'named',\n root,\n output,\n files: this.fileManager.files,\n meta: {\n pluginKey: this.plugin.key,\n },\n logger: this.logger,\n })\n\n await this.addFile(...barrelFiles)\n },\n }\n})\n"]}
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { zodGenerator, operationsGenerator } from './chunk-
|
|
2
|
-
import './chunk-
|
|
1
|
+
import { zodGenerator, operationsGenerator } from './chunk-D5YO5ULC.js';
|
|
2
|
+
import './chunk-F6DEFQEU.js';
|
|
3
3
|
import path from 'node:path';
|
|
4
|
-
import { createPlugin,
|
|
4
|
+
import { createPlugin, PluginManager, FileManager } from '@kubb/core';
|
|
5
5
|
import { camelCase, pascalCase } from '@kubb/core/transformers';
|
|
6
6
|
import { pluginOasName, SchemaGenerator, OperationGenerator } from '@kubb/plugin-oas';
|
|
7
7
|
import { pluginTsName } from '@kubb/plugin-ts';
|
|
@@ -23,8 +23,8 @@ var pluginZod = createPlugin((options) => {
|
|
|
23
23
|
importPath = "zod",
|
|
24
24
|
coercion = false,
|
|
25
25
|
inferred = false,
|
|
26
|
-
generators = [zodGenerator, operations ? operationsGenerator :
|
|
27
|
-
wrapOutput =
|
|
26
|
+
generators = [zodGenerator, operations ? operationsGenerator : void 0].filter(Boolean),
|
|
27
|
+
wrapOutput = void 0,
|
|
28
28
|
contentType
|
|
29
29
|
} = options;
|
|
30
30
|
return {
|
|
@@ -46,7 +46,7 @@ var pluginZod = createPlugin((options) => {
|
|
|
46
46
|
group,
|
|
47
47
|
wrapOutput
|
|
48
48
|
},
|
|
49
|
-
pre: [pluginOasName, typed ? pluginTsName :
|
|
49
|
+
pre: [pluginOasName, typed ? pluginTsName : void 0].filter(Boolean),
|
|
50
50
|
resolvePath(baseName, pathMode, options2) {
|
|
51
51
|
const root = path.resolve(this.config.root, this.config.output.path);
|
|
52
52
|
const mode = pathMode ?? FileManager.getMode(path.resolve(root, output.path));
|
|
@@ -73,7 +73,7 @@ var pluginZod = createPlugin((options) => {
|
|
|
73
73
|
},
|
|
74
74
|
resolveName(name, type) {
|
|
75
75
|
let resolvedName = camelCase(name, {
|
|
76
|
-
suffix: type ? "schema" :
|
|
76
|
+
suffix: type ? "schema" : void 0,
|
|
77
77
|
isFile: type === "file"
|
|
78
78
|
});
|
|
79
79
|
if (type === "type") {
|
|
@@ -94,7 +94,7 @@ var pluginZod = createPlugin((options) => {
|
|
|
94
94
|
pluginManager: this.pluginManager,
|
|
95
95
|
plugin: this.plugin,
|
|
96
96
|
contentType,
|
|
97
|
-
include:
|
|
97
|
+
include: void 0,
|
|
98
98
|
override,
|
|
99
99
|
mode,
|
|
100
100
|
output: output.path
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/plugin.ts"],"names":["options"],"mappings":";;;;;;;;AAcO,IAAM,aAAgB,GAAA;AAEhB,IAAA,SAAA,GAAY,YAAwB,CAAA,CAAC,OAAY,KAAA;AAC5D,EAAM,MAAA;AAAA,IACJ,MAAS,GAAA,EAAE,IAAM,EAAA,KAAA,EAAO,YAAY,OAAQ,EAAA;AAAA,IAC5C,KAAA;AAAA,IACA,UAAU,EAAC;AAAA,IACX,OAAA;AAAA,IACA,WAAW,EAAC;AAAA,IACZ,eAAe,EAAC;AAAA,IAChB,QAAW,GAAA,QAAA;AAAA,IACX,WAAc,GAAA,KAAA;AAAA,IACd,KAAQ,GAAA,KAAA;AAAA,IACR,SAAS,EAAC;AAAA,IACV,UAAa,GAAA,KAAA;AAAA,IACb,UAAa,GAAA,KAAA;AAAA,IACb,QAAW,GAAA,KAAA;AAAA,IACX,QAAW,GAAA,KAAA;AAAA,IACX,UAAA,GAAa,CAAC,YAAc,EAAA,UAAA,GAAa,sBAAsB,
|
|
1
|
+
{"version":3,"sources":["../src/plugin.ts"],"names":["options"],"mappings":";;;;;;;;AAcO,IAAM,aAAgB,GAAA;AAEhB,IAAA,SAAA,GAAY,YAAwB,CAAA,CAAC,OAAY,KAAA;AAC5D,EAAM,MAAA;AAAA,IACJ,MAAS,GAAA,EAAE,IAAM,EAAA,KAAA,EAAO,YAAY,OAAQ,EAAA;AAAA,IAC5C,KAAA;AAAA,IACA,UAAU,EAAC;AAAA,IACX,OAAA;AAAA,IACA,WAAW,EAAC;AAAA,IACZ,eAAe,EAAC;AAAA,IAChB,QAAW,GAAA,QAAA;AAAA,IACX,WAAc,GAAA,KAAA;AAAA,IACd,KAAQ,GAAA,KAAA;AAAA,IACR,SAAS,EAAC;AAAA,IACV,UAAa,GAAA,KAAA;A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Y,cAAe,CAAA;AAAA,QACxD,IAAA,EAAM,OAAO,UAAc,IAAA,OAAA;AAAA,QAC3B,IAAA;AAAA,QACA,MAAA;AAAA,QACA,KAAA,EAAO,KAAK,WAAY,CAAA,KAAA;AAAA,QACxB,IAAM,EAAA;AAAA,UACJ,SAAA,EAAW,KAAK,MAAO,CAAA;AAAA,SACzB;AAAA,QACA,QAAQ,IAAK,CAAA;AAAA,OACd,CAAA;AAED,MAAM,MAAA,IAAA,CAAK,OAAQ,CAAA,GAAG,WAAW,CAAA;AAAA;AACnC,GACF;AACF,CAAC","file":"index.js","sourcesContent":["import path from 'node:path'\n\nimport { FileManager, type Group, PluginManager, createPlugin } from '@kubb/core'\nimport { camelCase, pascalCase } from '@kubb/core/transformers'\nimport { OperationGenerator, SchemaGenerator, pluginOasName } from '@kubb/plugin-oas'\n\nimport { pluginTsName } from '@kubb/plugin-ts'\n\nimport type { Plugin } from '@kubb/core'\nimport type { PluginOas as SwaggerPluginOptions } from '@kubb/plugin-oas'\nimport { operationsGenerator } from './generators'\nimport { zodGenerator } from './generators/zodGenerator.tsx'\nimport type { PluginZod } from './types.ts'\n\nexport const pluginZodName = 'plugin-zod' satisfies PluginZod['name']\n\nexport const pluginZod = createPlugin<PluginZod>((options) => {\n const {\n output = { path: 'zod', barrelType: 'named' },\n group,\n exclude = [],\n include,\n override = [],\n transformers = {},\n dateType = 'string',\n unknownType = 'any',\n typed = false,\n mapper = {},\n operations = false,\n importPath = 'zod',\n coercion = false,\n inferred = false,\n generators = [zodGenerator, operations ? operationsGenerator : undefined].filter(Boolean),\n wrapOutput = undefined,\n contentType,\n } = options\n\n return {\n name: pluginZodName,\n options: {\n output,\n transformers,\n include,\n exclude,\n override,\n typed,\n dateType,\n unknownType,\n mapper,\n importPath,\n coercion,\n operations,\n inferred,\n group,\n wrapOutput,\n },\n pre: [pluginOasName, typed ? pluginTsName : undefined].filter(Boolean),\n resolvePath(baseName, pathMode, options) {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = pathMode ?? FileManager.getMode(path.resolve(root, output.path))\n\n if (mode === 'single') {\n /**\n * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend\n * Other plugins then need to call addOrAppend instead of just add from the fileManager class\n */\n return path.resolve(root, output.path)\n }\n\n if (group && (options?.group?.path || options?.group?.tag)) {\n const groupName: Group['name'] = group?.name\n ? group.name\n : (ctx) => {\n if (group?.type === 'path') {\n return `${ctx.group.split('/')[1]}`\n }\n return `${camelCase(ctx.group)}Controller`\n }\n\n return path.resolve(\n root,\n output.path,\n groupName({\n group: group.type === 'path' ? options.group.path! : options.group.tag!,\n }),\n baseName,\n )\n }\n\n return path.resolve(root, output.path, baseName)\n },\n resolveName(name, type) {\n let resolvedName = camelCase(name, {\n suffix: type ? 'schema' : undefined,\n isFile: type === 'file',\n })\n\n if (type === 'type') {\n resolvedName = pascalCase(resolvedName)\n }\n\n if (type) {\n return transformers?.name?.(resolvedName, type) || resolvedName\n }\n\n return resolvedName\n },\n async buildStart() {\n const [swaggerPlugin]: [Plugin<SwaggerPluginOptions>] = PluginManager.getDependedPlugins<SwaggerPluginOptions>(this.plugins, [pluginOasName])\n\n const oas = await swaggerPlugin.context.getOas()\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = FileManager.getMode(path.resolve(root, output.path))\n\n const schemaGenerator = new SchemaGenerator(this.plugin.options, {\n oas,\n pluginManager: this.pluginManager,\n plugin: this.plugin,\n contentType,\n include: undefined,\n override,\n mode,\n output: output.path,\n })\n\n const schemaFiles = await schemaGenerator.build(...generators)\n await this.addFile(...schemaFiles)\n\n const operationGenerator = new OperationGenerator(this.plugin.options, {\n oas,\n pluginManager: this.pluginManager,\n plugin: this.plugin,\n contentType,\n exclude,\n include,\n override,\n mode,\n })\n\n const operationFiles = await operationGenerator.build(...generators)\n await this.addFile(...operationFiles)\n\n const barrelFiles = await this.fileManager.getBarrelFiles({\n type: output.barrelType ?? 'named',\n root,\n output,\n files: this.fileManager.files,\n meta: {\n pluginKey: this.plugin.key,\n },\n logger: this.logger,\n })\n\n await this.addFile(...barrelFiles)\n },\n }\n})\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Output, Group, ResolveNameParams, PluginFactoryOptions } from '@kubb/core';
|
|
2
2
|
import { Oas, contentType, SchemaObject } from '@kubb/oas';
|
|
3
|
-
import {
|
|
3
|
+
import { Exclude, Include, Override, Schema, Generator, ResolvePathOptions } from '@kubb/plugin-oas';
|
|
4
4
|
|
|
5
5
|
type Options = {
|
|
6
6
|
/**
|
|
@@ -46,7 +46,7 @@ type Options = {
|
|
|
46
46
|
* Which type to use when the Swagger/OpenAPI file is not providing more information
|
|
47
47
|
* @default 'any'
|
|
48
48
|
*/
|
|
49
|
-
unknownType?: 'any' | 'unknown';
|
|
49
|
+
unknownType?: 'any' | 'unknown' | 'void';
|
|
50
50
|
/**
|
|
51
51
|
* Use TypeScript(`@kubb/plugin-ts`) to add type annotation.
|
|
52
52
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Output, Group, ResolveNameParams, PluginFactoryOptions } from '@kubb/core';
|
|
2
2
|
import { Oas, contentType, SchemaObject } from '@kubb/oas';
|
|
3
|
-
import {
|
|
3
|
+
import { Exclude, Include, Override, Schema, Generator, ResolvePathOptions } from '@kubb/plugin-oas';
|
|
4
4
|
|
|
5
5
|
type Options = {
|
|
6
6
|
/**
|
|
@@ -46,7 +46,7 @@ type Options = {
|
|
|
46
46
|
* Which type to use when the Swagger/OpenAPI file is not providing more information
|
|
47
47
|
* @default 'any'
|
|
48
48
|
*/
|
|
49
|
-
unknownType?: 'any' | 'unknown';
|
|
49
|
+
unknownType?: 'any' | 'unknown' | 'void';
|
|
50
50
|
/**
|
|
51
51
|
* Use TypeScript(`@kubb/plugin-ts`) to add type annotation.
|
|
52
52
|
*/
|
package/dist/utils.d.cts
CHANGED
package/dist/utils.d.ts
CHANGED