@orval/zod 6.19.0 → 6.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +422 -6
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,8 +1,424 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
5
29
|
|
|
6
|
-
|
|
30
|
+
// src/index.ts
|
|
31
|
+
var src_exports = {};
|
|
32
|
+
__export(src_exports, {
|
|
33
|
+
builder: () => builder,
|
|
34
|
+
default: () => src_default,
|
|
35
|
+
generateZod: () => generateZod,
|
|
36
|
+
getZodDependencies: () => getZodDependencies
|
|
37
|
+
});
|
|
38
|
+
module.exports = __toCommonJS(src_exports);
|
|
39
|
+
var import_core = require("@orval/core");
|
|
40
|
+
var import_lodash = __toESM(require("lodash.uniq"));
|
|
41
|
+
var ZOD_DEPENDENCIES = [
|
|
42
|
+
{
|
|
43
|
+
exports: [
|
|
44
|
+
{
|
|
45
|
+
name: "z",
|
|
46
|
+
alias: "zod",
|
|
47
|
+
values: true
|
|
48
|
+
}
|
|
49
|
+
],
|
|
50
|
+
dependency: "zod"
|
|
51
|
+
}
|
|
52
|
+
];
|
|
53
|
+
var getZodDependencies = () => ZOD_DEPENDENCIES;
|
|
54
|
+
var resolveZodType = (schemaTypeValue) => {
|
|
55
|
+
switch (schemaTypeValue) {
|
|
56
|
+
case "integer":
|
|
57
|
+
return "number";
|
|
58
|
+
case "null":
|
|
59
|
+
return "mixed";
|
|
60
|
+
default:
|
|
61
|
+
return schemaTypeValue != null ? schemaTypeValue : "any";
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
var generateZodValidationSchemaDefinition = (schema, _required, name) => {
|
|
65
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
66
|
+
if (!schema)
|
|
67
|
+
return { functions: [], consts: [] };
|
|
68
|
+
const consts = [];
|
|
69
|
+
const functions = [];
|
|
70
|
+
const type = resolveZodType(schema.type);
|
|
71
|
+
const required = schema.default !== void 0 ? false : _required != null ? _required : false;
|
|
72
|
+
const nullable = (_a = schema.nullable) != null ? _a : false;
|
|
73
|
+
const min = (_e = (_d = (_c = (_b = schema.minimum) != null ? _b : schema.exclusiveMinimum) != null ? _c : schema.minLength) != null ? _d : schema.minItems) != null ? _e : void 0;
|
|
74
|
+
const max = (_i = (_h = (_g = (_f = schema.maximum) != null ? _f : schema.exclusiveMaximum) != null ? _g : schema.maxLength) != null ? _h : schema.maxItems) != null ? _i : void 0;
|
|
75
|
+
const matches = (_j = schema.pattern) != null ? _j : void 0;
|
|
76
|
+
switch (type) {
|
|
77
|
+
case "array":
|
|
78
|
+
const items = schema.items;
|
|
79
|
+
functions.push([
|
|
80
|
+
"array",
|
|
81
|
+
generateZodValidationSchemaDefinition(items, true, (0, import_core.camel)(name))
|
|
82
|
+
]);
|
|
83
|
+
break;
|
|
84
|
+
case "string": {
|
|
85
|
+
if (schema.enum && type === "string") {
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
functions.push([type, void 0]);
|
|
89
|
+
if (schema.format === "date") {
|
|
90
|
+
functions.push(["regex", "new RegExp(/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/)"]);
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
if (schema.format === "date-time") {
|
|
94
|
+
functions.push(["datetime", void 0]);
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
if (schema.format === "email") {
|
|
98
|
+
functions.push(["email", void 0]);
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
101
|
+
if (schema.format === "uri" || schema.format === "hostname") {
|
|
102
|
+
functions.push(["url", void 0]);
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
if (schema.format === "uuid") {
|
|
106
|
+
functions.push(["uuid", void 0]);
|
|
107
|
+
break;
|
|
108
|
+
}
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
111
|
+
case "object":
|
|
112
|
+
default: {
|
|
113
|
+
if (schema.allOf || schema.oneOf || schema.anyOf) {
|
|
114
|
+
const separator = schema.allOf ? "allOf" : schema.oneOf ? "oneOf" : "anyOf";
|
|
115
|
+
const schemas = (_l = (_k = schema.allOf) != null ? _k : schema.oneOf) != null ? _l : schema.anyOf;
|
|
116
|
+
functions.push([
|
|
117
|
+
separator,
|
|
118
|
+
schemas.map(
|
|
119
|
+
(schema2) => generateZodValidationSchemaDefinition(
|
|
120
|
+
schema2,
|
|
121
|
+
true,
|
|
122
|
+
(0, import_core.camel)(name)
|
|
123
|
+
)
|
|
124
|
+
)
|
|
125
|
+
]);
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
128
|
+
if (schema.properties) {
|
|
129
|
+
functions.push([
|
|
130
|
+
"object",
|
|
131
|
+
Object.keys(schema.properties).map((key) => {
|
|
132
|
+
var _a2, _b2;
|
|
133
|
+
return {
|
|
134
|
+
[key]: generateZodValidationSchemaDefinition(
|
|
135
|
+
(_a2 = schema.properties) == null ? void 0 : _a2[key],
|
|
136
|
+
(_b2 = schema.required) == null ? void 0 : _b2.includes(key),
|
|
137
|
+
(0, import_core.camel)(`${name}-${key}`)
|
|
138
|
+
)
|
|
139
|
+
};
|
|
140
|
+
}).reduce((acc, curr) => ({ ...acc, ...curr }), {})
|
|
141
|
+
]);
|
|
142
|
+
break;
|
|
143
|
+
}
|
|
144
|
+
if (schema.additionalProperties) {
|
|
145
|
+
functions.push([
|
|
146
|
+
"additionalProperties",
|
|
147
|
+
(0, import_core.isBoolean)(schema.additionalProperties) ? schema.additionalProperties : generateZodValidationSchemaDefinition(
|
|
148
|
+
schema.additionalProperties,
|
|
149
|
+
true,
|
|
150
|
+
name
|
|
151
|
+
)
|
|
152
|
+
]);
|
|
153
|
+
break;
|
|
154
|
+
}
|
|
155
|
+
functions.push([type, void 0]);
|
|
156
|
+
break;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
if (min !== void 0) {
|
|
160
|
+
if (min === 1) {
|
|
161
|
+
functions.push(["min", `${min}`]);
|
|
162
|
+
} else {
|
|
163
|
+
consts.push(`export const ${name}Min = ${min};`);
|
|
164
|
+
functions.push(["min", `${name}Min`]);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
if (max !== void 0) {
|
|
168
|
+
consts.push(`export const ${name}Max = ${max};`);
|
|
169
|
+
functions.push(["max", `${name}Max`]);
|
|
170
|
+
}
|
|
171
|
+
if (matches) {
|
|
172
|
+
const isStartWithSlash = matches.startsWith("/");
|
|
173
|
+
const isEndWithSlash = matches.endsWith("/");
|
|
174
|
+
const regexp = `new RegExp('${(0, import_core.jsStringEscape)(
|
|
175
|
+
matches.slice(isStartWithSlash ? 1 : 0, isEndWithSlash ? -1 : void 0)
|
|
176
|
+
)}')`;
|
|
177
|
+
consts.push(`export const ${name}RegExp = ${regexp};`);
|
|
178
|
+
functions.push(["regex", `${name}RegExp`]);
|
|
179
|
+
}
|
|
180
|
+
if (schema.enum && type !== "number") {
|
|
181
|
+
functions.push([
|
|
182
|
+
"enum",
|
|
183
|
+
[
|
|
184
|
+
`[${schema.enum.map((value) => (0, import_core.isString)(value) ? `'${(0, import_core.escape)(value)}'` : `${value}`).join(", ")}]`
|
|
185
|
+
]
|
|
186
|
+
]);
|
|
187
|
+
}
|
|
188
|
+
if (!required && nullable) {
|
|
189
|
+
functions.push(["nullish", void 0]);
|
|
190
|
+
} else if (nullable) {
|
|
191
|
+
functions.push(["nullable", void 0]);
|
|
192
|
+
} else if (!required) {
|
|
193
|
+
functions.push(["optional", void 0]);
|
|
194
|
+
}
|
|
195
|
+
return { functions, consts: (0, import_lodash.default)(consts) };
|
|
196
|
+
};
|
|
197
|
+
var parseZodValidationSchemaDefinition = (input) => {
|
|
198
|
+
if (!Object.keys(input).length) {
|
|
199
|
+
return { zod: "", consts: "" };
|
|
200
|
+
}
|
|
201
|
+
let consts = "";
|
|
202
|
+
const parseProperty = (property) => {
|
|
203
|
+
const [fn, args = ""] = property;
|
|
204
|
+
if (fn === "allOf") {
|
|
205
|
+
return args.reduce(
|
|
206
|
+
(acc, { functions }) => {
|
|
207
|
+
const value = functions.map(parseProperty).join("");
|
|
208
|
+
const valueWithZod = `${value.startsWith(".") ? "zod" : ""}${value}`;
|
|
209
|
+
if (!acc) {
|
|
210
|
+
acc += valueWithZod;
|
|
211
|
+
return acc;
|
|
212
|
+
}
|
|
213
|
+
acc += `.and(${valueWithZod})`;
|
|
214
|
+
return acc;
|
|
215
|
+
},
|
|
216
|
+
""
|
|
217
|
+
);
|
|
218
|
+
}
|
|
219
|
+
if (fn === "oneOf" || fn === "anyOf") {
|
|
220
|
+
return args.reduce(
|
|
221
|
+
(acc, { functions }) => {
|
|
222
|
+
const value = functions.map(parseProperty).join("");
|
|
223
|
+
const valueWithZod = `${value.startsWith(".") ? "zod" : ""}${value}`;
|
|
224
|
+
if (!acc) {
|
|
225
|
+
acc += valueWithZod;
|
|
226
|
+
return acc;
|
|
227
|
+
}
|
|
228
|
+
acc += `.or(${valueWithZod})`;
|
|
229
|
+
return acc;
|
|
230
|
+
},
|
|
231
|
+
""
|
|
232
|
+
);
|
|
233
|
+
}
|
|
234
|
+
if (fn === "additionalProperties") {
|
|
235
|
+
const value = args.functions.map(parseProperty).join("");
|
|
236
|
+
const valueWithZod = `${value.startsWith(".") ? "zod" : ""}${value}`;
|
|
237
|
+
consts += args.consts;
|
|
238
|
+
return `zod.record(zod.string(), ${valueWithZod})`;
|
|
239
|
+
}
|
|
240
|
+
if (fn === "object") {
|
|
241
|
+
const parsed = parseZodValidationSchemaDefinition(args);
|
|
242
|
+
consts += parsed.consts;
|
|
243
|
+
return ` ${parsed.zod}`;
|
|
244
|
+
}
|
|
245
|
+
if (fn === "array") {
|
|
246
|
+
const value = args.functions.map(parseProperty).join("");
|
|
247
|
+
consts += args.consts;
|
|
248
|
+
return `.array(${value.startsWith(".") ? "zod" : ""}${value})`;
|
|
249
|
+
}
|
|
250
|
+
return `.${fn}(${args})`;
|
|
251
|
+
};
|
|
252
|
+
consts += Object.entries(input).reduce((acc, [key, schema]) => {
|
|
253
|
+
return acc + schema.consts.join("\n");
|
|
254
|
+
}, "");
|
|
255
|
+
const zod = `zod.object({
|
|
256
|
+
${Object.entries(input).map(([key, schema]) => {
|
|
257
|
+
const value = schema.functions.map(parseProperty).join("");
|
|
258
|
+
return `"${key}": ${value.startsWith(".") ? "zod" : ""}${value}`;
|
|
259
|
+
}).join(",")}
|
|
260
|
+
})`;
|
|
261
|
+
return { zod, consts };
|
|
262
|
+
};
|
|
263
|
+
var deferenceScalar = (value, context) => {
|
|
264
|
+
if ((0, import_core.isObject)(value)) {
|
|
265
|
+
return deference(value, context);
|
|
266
|
+
} else if (Array.isArray(value)) {
|
|
267
|
+
return value.map((item) => deferenceScalar(item, context));
|
|
268
|
+
} else {
|
|
269
|
+
return value;
|
|
270
|
+
}
|
|
271
|
+
};
|
|
272
|
+
var deference = (schema, context) => {
|
|
273
|
+
var _a;
|
|
274
|
+
const refName = "$ref" in schema ? schema.$ref : void 0;
|
|
275
|
+
if (refName && ((_a = context.parents) == null ? void 0 : _a.includes(refName))) {
|
|
276
|
+
return {};
|
|
277
|
+
}
|
|
278
|
+
const childContext = {
|
|
279
|
+
...context,
|
|
280
|
+
...refName ? { parents: [...context.parents || [], refName] } : void 0
|
|
281
|
+
};
|
|
282
|
+
const { schema: resolvedSchema } = (0, import_core.resolveRef)(
|
|
283
|
+
schema,
|
|
284
|
+
childContext
|
|
285
|
+
);
|
|
286
|
+
return Object.entries(resolvedSchema).reduce((acc, [key, value]) => {
|
|
287
|
+
acc[key] = deferenceScalar(value, childContext);
|
|
288
|
+
return acc;
|
|
289
|
+
}, {});
|
|
290
|
+
};
|
|
291
|
+
var generateZodRoute = ({ operationName, body, verb }, { pathRoute, context }) => {
|
|
292
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
293
|
+
const spec = context.specs[context.specKey].paths[pathRoute];
|
|
294
|
+
const parameters = (_a = spec == null ? void 0 : spec[verb]) == null ? void 0 : _a.parameters;
|
|
295
|
+
const requestBody = (_b = spec == null ? void 0 : spec[verb]) == null ? void 0 : _b.requestBody;
|
|
296
|
+
const response = (_d = (_c = spec == null ? void 0 : spec[verb]) == null ? void 0 : _c.responses) == null ? void 0 : _d["200"];
|
|
297
|
+
const resolvedResponse = response ? (0, import_core.resolveRef)(response, context).schema : void 0;
|
|
298
|
+
const resolvedResponseJsonSchema = ((_f = (_e = resolvedResponse == null ? void 0 : resolvedResponse.content) == null ? void 0 : _e["application/json"]) == null ? void 0 : _f.schema) ? (0, import_core.resolveRef)(
|
|
299
|
+
resolvedResponse.content["application/json"].schema,
|
|
300
|
+
context
|
|
301
|
+
).schema : void 0;
|
|
302
|
+
const zodDefinitionsResponseProperties = (_g = resolvedResponseJsonSchema == null ? void 0 : resolvedResponseJsonSchema.properties) != null ? _g : {};
|
|
303
|
+
const zodDefinitionsResponse = Object.entries(
|
|
304
|
+
zodDefinitionsResponseProperties
|
|
305
|
+
).map(([key, response2]) => {
|
|
306
|
+
var _a2;
|
|
307
|
+
const schema = deference(response2, context);
|
|
308
|
+
return {
|
|
309
|
+
[key]: generateZodValidationSchemaDefinition(
|
|
310
|
+
schema,
|
|
311
|
+
!!((_a2 = resolvedResponseJsonSchema == null ? void 0 : resolvedResponseJsonSchema.required) == null ? void 0 : _a2.find(
|
|
312
|
+
(requiredKey) => requiredKey === key
|
|
313
|
+
)),
|
|
314
|
+
(0, import_core.camel)(`${operationName}-response-${key}`)
|
|
315
|
+
)
|
|
316
|
+
};
|
|
317
|
+
}).reduce((acc, curr) => ({ ...acc, ...curr }), {});
|
|
318
|
+
const resolvedRequestBody = requestBody ? (0, import_core.resolveRef)(requestBody, context).schema : void 0;
|
|
319
|
+
const resolvedRequestBodyJsonSchema = ((_i = (_h = resolvedRequestBody == null ? void 0 : resolvedRequestBody.content) == null ? void 0 : _h["application/json"]) == null ? void 0 : _i.schema) ? (0, import_core.resolveRef)(
|
|
320
|
+
resolvedRequestBody.content["application/json"].schema,
|
|
321
|
+
context
|
|
322
|
+
).schema : void 0;
|
|
323
|
+
const zodDefinitionsBodyProperties = (_j = resolvedRequestBodyJsonSchema == null ? void 0 : resolvedRequestBodyJsonSchema.properties) != null ? _j : {};
|
|
324
|
+
const zodDefinitionsBody = Object.entries(zodDefinitionsBodyProperties).map(([key, body2]) => {
|
|
325
|
+
var _a2;
|
|
326
|
+
const schema = deference(body2, context);
|
|
327
|
+
return {
|
|
328
|
+
[key]: generateZodValidationSchemaDefinition(
|
|
329
|
+
schema,
|
|
330
|
+
!!((_a2 = resolvedRequestBodyJsonSchema == null ? void 0 : resolvedRequestBodyJsonSchema.required) == null ? void 0 : _a2.find(
|
|
331
|
+
(requiredKey) => requiredKey === key
|
|
332
|
+
)),
|
|
333
|
+
(0, import_core.camel)(`${operationName}-body-${key}`)
|
|
334
|
+
)
|
|
335
|
+
};
|
|
336
|
+
}).reduce((acc, curr) => ({ ...acc, ...curr }), {});
|
|
337
|
+
const zodDefinitionsParameters = (parameters != null ? parameters : []).reduce(
|
|
338
|
+
(acc, val) => {
|
|
339
|
+
const { schema: parameter } = (0, import_core.resolveRef)(val, context);
|
|
340
|
+
if (!parameter.schema) {
|
|
341
|
+
return acc;
|
|
342
|
+
}
|
|
343
|
+
const schema = deference(parameter.schema, context);
|
|
344
|
+
const definition = generateZodValidationSchemaDefinition(
|
|
345
|
+
schema,
|
|
346
|
+
parameter.required,
|
|
347
|
+
(0, import_core.camel)(`${operationName}-${parameter.in}-${parameter.name}`)
|
|
348
|
+
);
|
|
349
|
+
if (parameter.in === "header") {
|
|
350
|
+
return {
|
|
351
|
+
...acc,
|
|
352
|
+
headers: { ...acc.headers, [parameter.name]: definition }
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
if (parameter.in === "query") {
|
|
356
|
+
return {
|
|
357
|
+
...acc,
|
|
358
|
+
queryParams: { ...acc.queryParams, [parameter.name]: definition }
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
if (parameter.in === "path") {
|
|
362
|
+
return {
|
|
363
|
+
...acc,
|
|
364
|
+
params: { ...acc.params, [parameter.name]: definition }
|
|
365
|
+
};
|
|
366
|
+
}
|
|
367
|
+
return acc;
|
|
368
|
+
},
|
|
369
|
+
{
|
|
370
|
+
headers: {},
|
|
371
|
+
queryParams: {},
|
|
372
|
+
params: {}
|
|
373
|
+
}
|
|
374
|
+
);
|
|
375
|
+
const inputParams = parseZodValidationSchemaDefinition(
|
|
376
|
+
zodDefinitionsParameters.params
|
|
377
|
+
);
|
|
378
|
+
const inputQueryParams = parseZodValidationSchemaDefinition(
|
|
379
|
+
zodDefinitionsParameters.queryParams
|
|
380
|
+
);
|
|
381
|
+
const inputHeaders = parseZodValidationSchemaDefinition(
|
|
382
|
+
zodDefinitionsParameters.headers
|
|
383
|
+
);
|
|
384
|
+
const inputBody = parseZodValidationSchemaDefinition(zodDefinitionsBody);
|
|
385
|
+
const inputResponse = parseZodValidationSchemaDefinition(
|
|
386
|
+
zodDefinitionsResponse
|
|
387
|
+
);
|
|
388
|
+
if (!inputParams.zod && !inputQueryParams.zod && !inputHeaders.zod && !inputBody.zod && !inputResponse.zod) {
|
|
389
|
+
return "";
|
|
390
|
+
}
|
|
391
|
+
return [
|
|
392
|
+
...inputParams.consts ? [inputParams.consts] : [],
|
|
393
|
+
...inputParams.zod ? [`export const ${operationName}Params = ${inputParams.zod}`] : [],
|
|
394
|
+
...inputQueryParams.consts ? [inputQueryParams.consts] : [],
|
|
395
|
+
...inputQueryParams.zod ? [`export const ${operationName}QueryParams = ${inputQueryParams.zod}`] : [],
|
|
396
|
+
...inputHeaders.consts ? [inputHeaders.consts] : [],
|
|
397
|
+
...inputHeaders.zod ? [`export const ${operationName}Header = ${inputHeaders.zod}`] : [],
|
|
398
|
+
...inputBody.consts ? [inputBody.consts] : [],
|
|
399
|
+
...inputBody.zod ? [`export const ${operationName}Body = ${inputBody.zod}`] : [],
|
|
400
|
+
...inputResponse.consts ? [inputResponse.consts] : [],
|
|
401
|
+
...inputResponse.zod ? [`export const ${operationName}Response = ${inputResponse.zod}`] : []
|
|
402
|
+
].join("\n\n");
|
|
403
|
+
};
|
|
404
|
+
var generateZod = (verbOptions, options) => {
|
|
405
|
+
const routeImplementation = generateZodRoute(verbOptions, options);
|
|
406
|
+
return {
|
|
407
|
+
implementation: routeImplementation ? `${routeImplementation}
|
|
7
408
|
|
|
8
|
-
|
|
409
|
+
` : "",
|
|
410
|
+
imports: []
|
|
411
|
+
};
|
|
412
|
+
};
|
|
413
|
+
var zodClientBuilder = {
|
|
414
|
+
client: generateZod,
|
|
415
|
+
dependencies: getZodDependencies
|
|
416
|
+
};
|
|
417
|
+
var builder = () => () => zodClientBuilder;
|
|
418
|
+
var src_default = builder;
|
|
419
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
420
|
+
0 && (module.exports = {
|
|
421
|
+
builder,
|
|
422
|
+
generateZod,
|
|
423
|
+
getZodDependencies
|
|
424
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orval/zod",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.20.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -8,12 +8,12 @@
|
|
|
8
8
|
"dist"
|
|
9
9
|
],
|
|
10
10
|
"scripts": {
|
|
11
|
-
"build": "tsup ./src/index.ts --target node12 --
|
|
11
|
+
"build": "tsup ./src/index.ts --target node12 --clean --dts",
|
|
12
12
|
"dev": "tsup ./src/index.ts --target node12 --clean --watch src",
|
|
13
13
|
"lint": "eslint src/**/*.ts"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@orval/core": "6.
|
|
16
|
+
"@orval/core": "6.20.0",
|
|
17
17
|
"lodash.uniq": "^4.5.0"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|