zod-nest 3.2.0 → 3.2.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-26E2XEJU.js +294 -0
- package/dist/chunk-26E2XEJU.js.map +1 -0
- package/dist/chunk-4RXGLSPP.js +73 -0
- package/dist/chunk-4RXGLSPP.js.map +1 -0
- package/dist/chunk-FKXVNCDD.js +863 -0
- package/dist/chunk-FKXVNCDD.js.map +1 -0
- package/dist/chunk-LHNXO52A.mjs +838 -0
- package/dist/chunk-LHNXO52A.mjs.map +1 -0
- package/dist/chunk-LXRBMFWD.js +103 -0
- package/dist/chunk-LXRBMFWD.js.map +1 -0
- package/dist/chunk-RAF7JGS6.mjs +286 -0
- package/dist/chunk-RAF7JGS6.mjs.map +1 -0
- package/dist/chunk-WI4JKXT6.mjs +83 -0
- package/dist/chunk-WI4JKXT6.mjs.map +1 -0
- package/dist/chunk-ZZW54ETO.mjs +67 -0
- package/dist/chunk-ZZW54ETO.mjs.map +1 -0
- package/dist/express/index.d.mts +3 -3
- package/dist/express/index.d.ts +3 -3
- package/dist/express/index.js +33 -1118
- package/dist/express/index.js.map +1 -1
- package/dist/express/index.mjs +6 -1102
- package/dist/express/index.mjs.map +1 -1
- package/dist/fastify/index.d.mts +3 -3
- package/dist/fastify/index.d.ts +3 -3
- package/dist/fastify/index.js +18 -1109
- package/dist/fastify/index.js.map +1 -1
- package/dist/fastify/index.mjs +6 -1102
- package/dist/fastify/index.mjs.map +1 -1
- package/dist/helpers/index.js +81 -122
- package/dist/helpers/index.js.map +1 -1
- package/dist/helpers/index.mjs +4 -101
- package/dist/helpers/index.mjs.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +263 -1091
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18 -895
- package/dist/index.mjs.map +1 -1
- package/dist/{param-decorators-CX1cUqfY.d.ts → param-decorators-23pStLeF.d.ts} +1 -1
- package/dist/{param-decorators-DbgygRVn.d.mts → param-decorators-Dfd2Cy08.d.mts} +1 -1
- package/dist/{registry-C9xStKa6.d.mts → registry-Cs1Y0a-L.d.mts} +1 -1
- package/dist/{registry-C9xStKa6.d.ts → registry-Cs1Y0a-L.d.ts} +1 -1
- package/package.json +26 -33
package/dist/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkFKXVNCDD_js = require('./chunk-FKXVNCDD.js');
|
|
4
|
+
var chunk4RXGLSPP_js = require('./chunk-4RXGLSPP.js');
|
|
4
5
|
var common = require('@nestjs/common');
|
|
6
|
+
var zod = require('zod');
|
|
5
7
|
var constants_js = require('@nestjs/common/constants.js');
|
|
6
8
|
var swagger = require('@nestjs/swagger');
|
|
7
9
|
var core = require('@nestjs/core');
|
|
@@ -13,718 +15,31 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
|
13
15
|
|
|
14
16
|
var stringify__default = /*#__PURE__*/_interopDefault(stringify);
|
|
15
17
|
|
|
16
|
-
var __defProp = Object.defineProperty;
|
|
17
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
18
|
-
|
|
19
|
-
// src/schema/constants.ts
|
|
20
|
-
var COMPONENTS_SCHEMAS_PREFIX = "#/components/schemas/";
|
|
21
|
-
var DEFS_PREFIX = "#/$defs/";
|
|
22
|
-
var ZOD_NEST_ERROR_EXTENSION = "x-zod-nest-error";
|
|
23
|
-
var ZOD_NEST_ERROR_DUPLICATE_ID = "duplicate-id";
|
|
24
|
-
var ZOD_NEST_DTO_EXTENSION = "x-zod-nest-dto";
|
|
25
|
-
var INNER_TYPE_WRAPPERS = /* @__PURE__ */ new Set([
|
|
26
|
-
"optional",
|
|
27
|
-
"nullable",
|
|
28
|
-
"default",
|
|
29
|
-
"prefault",
|
|
30
|
-
"catch",
|
|
31
|
-
"nonoptional",
|
|
32
|
-
"success",
|
|
33
|
-
"readonly",
|
|
34
|
-
"promise"
|
|
35
|
-
]);
|
|
36
|
-
var readId = /* @__PURE__ */ __name((schema) => {
|
|
37
|
-
const meta = zod.z.globalRegistry.get(schema);
|
|
38
|
-
if (meta === void 0) {
|
|
39
|
-
return void 0;
|
|
40
|
-
}
|
|
41
|
-
const id = meta.id;
|
|
42
|
-
return typeof id === "string" ? id : void 0;
|
|
43
|
-
}, "readId");
|
|
44
|
-
var resolveLazyTarget = /* @__PURE__ */ __name((getter) => {
|
|
45
|
-
try {
|
|
46
|
-
return [
|
|
47
|
-
getter()
|
|
48
|
-
];
|
|
49
|
-
} catch (error) {
|
|
50
|
-
if (error instanceof ReferenceError) {
|
|
51
|
-
return [];
|
|
52
|
-
}
|
|
53
|
-
throw error;
|
|
54
|
-
}
|
|
55
|
-
}, "resolveLazyTarget");
|
|
56
|
-
var collectChildren = /* @__PURE__ */ __name((schema) => {
|
|
57
|
-
const def = schema._zod.def;
|
|
58
|
-
if (def.type === "object") {
|
|
59
|
-
const out = [];
|
|
60
|
-
const shape = def.shape;
|
|
61
|
-
if (shape !== void 0) {
|
|
62
|
-
for (const value of Object.values(shape)) {
|
|
63
|
-
out.push(value);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
if (def.catchall !== void 0) {
|
|
67
|
-
out.push(def.catchall);
|
|
68
|
-
}
|
|
69
|
-
return out;
|
|
70
|
-
}
|
|
71
|
-
if (def.type === "array") {
|
|
72
|
-
return [
|
|
73
|
-
def.element
|
|
74
|
-
];
|
|
75
|
-
}
|
|
76
|
-
if (def.type === "union") {
|
|
77
|
-
return def.options.map((opt) => opt);
|
|
78
|
-
}
|
|
79
|
-
if (def.type === "intersection") {
|
|
80
|
-
return [
|
|
81
|
-
def.left,
|
|
82
|
-
def.right
|
|
83
|
-
];
|
|
84
|
-
}
|
|
85
|
-
if (def.type === "tuple") {
|
|
86
|
-
const out = def.items.map((it) => it);
|
|
87
|
-
if (def.rest !== null) {
|
|
88
|
-
out.push(def.rest);
|
|
89
|
-
}
|
|
90
|
-
return out;
|
|
91
|
-
}
|
|
92
|
-
if (def.type === "record" || def.type === "map") {
|
|
93
|
-
return [
|
|
94
|
-
def.keyType,
|
|
95
|
-
def.valueType
|
|
96
|
-
];
|
|
97
|
-
}
|
|
98
|
-
if (def.type === "set") {
|
|
99
|
-
return [
|
|
100
|
-
def.valueType
|
|
101
|
-
];
|
|
102
|
-
}
|
|
103
|
-
if (def.type === "pipe") {
|
|
104
|
-
return [
|
|
105
|
-
def.in,
|
|
106
|
-
def.out
|
|
107
|
-
];
|
|
108
|
-
}
|
|
109
|
-
if (def.type === "lazy") {
|
|
110
|
-
return resolveLazyTarget(() => def.getter());
|
|
111
|
-
}
|
|
112
|
-
if (INNER_TYPE_WRAPPERS.has(def.type)) {
|
|
113
|
-
return [
|
|
114
|
-
def.innerType
|
|
115
|
-
];
|
|
116
|
-
}
|
|
117
|
-
return [];
|
|
118
|
-
}, "collectChildren");
|
|
119
|
-
var discoverDependents = /* @__PURE__ */ __name((schema) => {
|
|
120
|
-
const visited = /* @__PURE__ */ new WeakSet();
|
|
121
|
-
const out = [];
|
|
122
|
-
const stack = [
|
|
123
|
-
schema
|
|
124
|
-
];
|
|
125
|
-
while (stack.length > 0) {
|
|
126
|
-
const current = stack.pop();
|
|
127
|
-
if (visited.has(current)) {
|
|
128
|
-
continue;
|
|
129
|
-
}
|
|
130
|
-
visited.add(current);
|
|
131
|
-
for (const child of collectChildren(current)) {
|
|
132
|
-
if (child === void 0 || visited.has(child)) {
|
|
133
|
-
continue;
|
|
134
|
-
}
|
|
135
|
-
const id = readId(child);
|
|
136
|
-
if (id !== void 0) {
|
|
137
|
-
out.push([
|
|
138
|
-
child,
|
|
139
|
-
id
|
|
140
|
-
]);
|
|
141
|
-
}
|
|
142
|
-
stack.push(child);
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
return out;
|
|
146
|
-
}, "discoverDependents");
|
|
147
|
-
|
|
148
|
-
// src/schema/registry.ts
|
|
149
|
-
var createRegistry = /* @__PURE__ */ __name(() => {
|
|
150
|
-
const seen = /* @__PURE__ */ new Map();
|
|
151
|
-
const forceExposed = /* @__PURE__ */ new Set();
|
|
152
|
-
const anonymous = /* @__PURE__ */ new Set();
|
|
153
|
-
const pendingRoots = [];
|
|
154
|
-
const recordOnce = /* @__PURE__ */ __name((schema, id) => {
|
|
155
|
-
let set = seen.get(id);
|
|
156
|
-
if (set === void 0) {
|
|
157
|
-
set = /* @__PURE__ */ new Set();
|
|
158
|
-
seen.set(id, set);
|
|
159
|
-
}
|
|
160
|
-
if (set.has(schema)) {
|
|
161
|
-
return false;
|
|
162
|
-
}
|
|
163
|
-
set.add(schema);
|
|
164
|
-
return true;
|
|
165
|
-
}, "recordOnce");
|
|
166
|
-
const flushPendingDiscovery = /* @__PURE__ */ __name(() => {
|
|
167
|
-
for (const root of pendingRoots.splice(0)) {
|
|
168
|
-
for (const [child, childId] of discoverDependents(root)) {
|
|
169
|
-
recordOnce(child, childId);
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
}, "flushPendingDiscovery");
|
|
173
|
-
return {
|
|
174
|
-
zodRegistry: zod.z.globalRegistry,
|
|
175
|
-
register: /* @__PURE__ */ __name((schema, id, flags) => {
|
|
176
|
-
if (flags?.expose === true) {
|
|
177
|
-
forceExposed.add(id);
|
|
178
|
-
}
|
|
179
|
-
if (flags?.anonymous === true) {
|
|
180
|
-
anonymous.add(id);
|
|
181
|
-
}
|
|
182
|
-
if (zod.z.globalRegistry.has(schema)) {
|
|
183
|
-
const existing = zod.z.globalRegistry.get(schema);
|
|
184
|
-
if (existing?.id !== id) {
|
|
185
|
-
zod.z.globalRegistry.add(schema, {
|
|
186
|
-
...existing ?? {},
|
|
187
|
-
id
|
|
188
|
-
});
|
|
189
|
-
}
|
|
190
|
-
} else {
|
|
191
|
-
zod.z.globalRegistry.add(schema, {
|
|
192
|
-
id
|
|
193
|
-
});
|
|
194
|
-
}
|
|
195
|
-
if (!recordOnce(schema, id)) {
|
|
196
|
-
return;
|
|
197
|
-
}
|
|
198
|
-
pendingRoots.push(schema);
|
|
199
|
-
}, "register"),
|
|
200
|
-
hasCollision: /* @__PURE__ */ __name((id) => {
|
|
201
|
-
flushPendingDiscovery();
|
|
202
|
-
const set = seen.get(id);
|
|
203
|
-
return set !== void 0 && set.size > 1;
|
|
204
|
-
}, "hasCollision"),
|
|
205
|
-
getCollisions: /* @__PURE__ */ __name(() => {
|
|
206
|
-
flushPendingDiscovery();
|
|
207
|
-
const out = /* @__PURE__ */ new Map();
|
|
208
|
-
for (const [id, set] of seen) {
|
|
209
|
-
if (set.size <= 1) {
|
|
210
|
-
continue;
|
|
211
|
-
}
|
|
212
|
-
out.set(id, set);
|
|
213
|
-
}
|
|
214
|
-
return out;
|
|
215
|
-
}, "getCollisions"),
|
|
216
|
-
ids: /* @__PURE__ */ __name(() => {
|
|
217
|
-
flushPendingDiscovery();
|
|
218
|
-
return [
|
|
219
|
-
...seen.keys()
|
|
220
|
-
];
|
|
221
|
-
}, "ids"),
|
|
222
|
-
forceExposedIds: /* @__PURE__ */ __name(() => [
|
|
223
|
-
...forceExposed
|
|
224
|
-
], "forceExposedIds"),
|
|
225
|
-
anonymousIds: /* @__PURE__ */ __name(() => [
|
|
226
|
-
...anonymous
|
|
227
|
-
], "anonymousIds")
|
|
228
|
-
};
|
|
229
|
-
}, "createRegistry");
|
|
230
|
-
var defaultRegistry = createRegistry();
|
|
231
|
-
var registerSchema = /* @__PURE__ */ __name((schema, registry = defaultRegistry, options) => {
|
|
232
|
-
const flags = {
|
|
233
|
-
expose: options?.expose,
|
|
234
|
-
anonymous: options?.anonymous
|
|
235
|
-
};
|
|
236
|
-
const explicit = options?.id;
|
|
237
|
-
if (typeof explicit === "string" && explicit !== "") {
|
|
238
|
-
registry.register(schema, explicit, flags);
|
|
239
|
-
return explicit;
|
|
240
|
-
}
|
|
241
|
-
const meta = registry.zodRegistry.get(schema);
|
|
242
|
-
const metaId = meta === void 0 ? void 0 : meta.id;
|
|
243
|
-
if (typeof metaId !== "string" || metaId === "") {
|
|
244
|
-
return void 0;
|
|
245
|
-
}
|
|
246
|
-
registry.register(schema, metaId, flags);
|
|
247
|
-
return metaId;
|
|
248
|
-
}, "registerSchema");
|
|
249
|
-
|
|
250
|
-
// src/schema/composition.ts
|
|
251
|
-
var lineageMap = /* @__PURE__ */ new WeakMap();
|
|
252
|
-
var propsMap = /* @__PURE__ */ new WeakMap();
|
|
253
|
-
var OPTIONAL_WRAPPER_TYPES = /* @__PURE__ */ new Set([
|
|
254
|
-
"optional",
|
|
255
|
-
"default"
|
|
256
|
-
]);
|
|
257
|
-
var isOptionalProp = /* @__PURE__ */ __name((propSchema) => OPTIONAL_WRAPPER_TYPES.has(propSchema._zod.def.type), "isOptionalProp");
|
|
258
|
-
var computeShapeKeys = /* @__PURE__ */ __name((schema) => {
|
|
259
|
-
const { shape } = schema;
|
|
260
|
-
const properties = Object.keys(shape);
|
|
261
|
-
const required = properties.filter((key) => {
|
|
262
|
-
const propSchema = shape[key];
|
|
263
|
-
return propSchema !== void 0 && !isOptionalProp(propSchema);
|
|
264
|
-
});
|
|
265
|
-
return {
|
|
266
|
-
properties,
|
|
267
|
-
required
|
|
268
|
-
};
|
|
269
|
-
}, "computeShapeKeys");
|
|
270
|
-
var computeOverriddenKeys = /* @__PURE__ */ __name((parent, child) => {
|
|
271
|
-
const overriddenKeys = /* @__PURE__ */ new Set();
|
|
272
|
-
for (const key of Object.keys(child.shape)) {
|
|
273
|
-
const parentProp = parent.shape[key];
|
|
274
|
-
if (parentProp !== void 0 && parentProp !== child.shape[key]) {
|
|
275
|
-
overriddenKeys.add(key);
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
return overriddenKeys;
|
|
279
|
-
}, "computeOverriddenKeys");
|
|
280
|
-
var extend = /* @__PURE__ */ __name((parent, build) => {
|
|
281
|
-
const result = build(parent);
|
|
282
|
-
lineageMap.set(result, {
|
|
283
|
-
op: "extend",
|
|
284
|
-
parent,
|
|
285
|
-
overriddenKeys: computeOverriddenKeys(parent, result)
|
|
286
|
-
});
|
|
287
|
-
if (!propsMap.has(parent)) {
|
|
288
|
-
propsMap.set(parent, computeShapeKeys(parent));
|
|
289
|
-
}
|
|
290
|
-
registerSchema(parent);
|
|
291
|
-
registerSchema(result);
|
|
292
|
-
return result;
|
|
293
|
-
}, "extend");
|
|
294
|
-
var getLineage = /* @__PURE__ */ __name((schema) => lineageMap.get(schema), "getLineage");
|
|
295
|
-
var DEFAULT_BUILD_REF = /* @__PURE__ */ __name((id) => `${DEFS_PREFIX}${id}`, "DEFAULT_BUILD_REF");
|
|
296
|
-
var createCompositionOverride = /* @__PURE__ */ __name((opts) => {
|
|
297
|
-
const { buildRef, registry } = opts;
|
|
298
|
-
return (ctx) => {
|
|
299
|
-
const { jsonSchema, zodSchema } = ctx;
|
|
300
|
-
const entry = lineageMap.get(zodSchema);
|
|
301
|
-
if (entry === void 0) {
|
|
302
|
-
return;
|
|
303
|
-
}
|
|
304
|
-
const parentCache = propsMap.get(entry.parent);
|
|
305
|
-
if (parentCache === void 0) {
|
|
306
|
-
return;
|
|
307
|
-
}
|
|
308
|
-
const parentId = registry.zodRegistry.get(entry.parent)?.id;
|
|
309
|
-
if (parentId === void 0) {
|
|
310
|
-
return;
|
|
311
|
-
}
|
|
312
|
-
registerSchema(entry.parent, registry);
|
|
313
|
-
const childProps = jsonSchema.properties ?? {};
|
|
314
|
-
const childRequired = jsonSchema.required ?? [];
|
|
315
|
-
const parentPropSet = new Set(parentCache.properties);
|
|
316
|
-
const parentReqSet = new Set(parentCache.required);
|
|
317
|
-
const deltaProps = {};
|
|
318
|
-
for (const [key, value] of Object.entries(childProps)) {
|
|
319
|
-
if (parentPropSet.has(key) && !entry.overriddenKeys.has(key)) {
|
|
320
|
-
continue;
|
|
321
|
-
}
|
|
322
|
-
deltaProps[key] = value;
|
|
323
|
-
}
|
|
324
|
-
const deltaRequired = childRequired.filter((key) => !parentReqSet.has(key) || entry.overriddenKeys.has(key));
|
|
325
|
-
const delta = {
|
|
326
|
-
type: "object",
|
|
327
|
-
properties: deltaProps
|
|
328
|
-
};
|
|
329
|
-
if (deltaRequired.length > 0) {
|
|
330
|
-
delta.required = deltaRequired;
|
|
331
|
-
}
|
|
332
|
-
delete jsonSchema.properties;
|
|
333
|
-
delete jsonSchema.required;
|
|
334
|
-
delete jsonSchema.additionalProperties;
|
|
335
|
-
jsonSchema.type = "object";
|
|
336
|
-
jsonSchema.allOf = [
|
|
337
|
-
{
|
|
338
|
-
$ref: buildRef(parentId)
|
|
339
|
-
},
|
|
340
|
-
delta
|
|
341
|
-
];
|
|
342
|
-
jsonSchema.unevaluatedProperties = false;
|
|
343
|
-
};
|
|
344
|
-
}, "createCompositionOverride");
|
|
345
|
-
|
|
346
|
-
// src/schema/custom-override.ts
|
|
347
|
-
var customOverrideMap = /* @__PURE__ */ new WeakMap();
|
|
348
|
-
var isWrapper = /* @__PURE__ */ __name((arg) => "input" in arg || "output" in arg, "isWrapper");
|
|
349
|
-
var overrideJSONSchema = /* @__PURE__ */ __name((schema, arg) => {
|
|
350
|
-
const overrideSchema = isWrapper(arg) ? {
|
|
351
|
-
...arg
|
|
352
|
-
} : {
|
|
353
|
-
input: arg,
|
|
354
|
-
output: arg
|
|
355
|
-
};
|
|
356
|
-
const schemaDescription = schema.description;
|
|
357
|
-
if (typeof schemaDescription === "string") {
|
|
358
|
-
overrideSchema.description = schemaDescription;
|
|
359
|
-
}
|
|
360
|
-
customOverrideMap.set(schema, overrideSchema);
|
|
361
|
-
return schema;
|
|
362
|
-
}, "overrideJSONSchema");
|
|
363
|
-
var peekRegistration = /* @__PURE__ */ __name((schema) => customOverrideMap.get(schema), "peekRegistration");
|
|
364
|
-
var createCustomOverride = /* @__PURE__ */ __name((io) => {
|
|
365
|
-
return ({ zodSchema, jsonSchema }) => {
|
|
366
|
-
const record = customOverrideMap.get(zodSchema);
|
|
367
|
-
if (record === void 0) {
|
|
368
|
-
return;
|
|
369
|
-
}
|
|
370
|
-
const fragment = record[io];
|
|
371
|
-
if (fragment === void 0) {
|
|
372
|
-
return;
|
|
373
|
-
}
|
|
374
|
-
for (const key of Object.keys(jsonSchema)) {
|
|
375
|
-
Reflect.deleteProperty(jsonSchema, key);
|
|
376
|
-
}
|
|
377
|
-
Object.assign(jsonSchema, fragment);
|
|
378
|
-
if (fragment.description === void 0 && record.description !== void 0) {
|
|
379
|
-
jsonSchema.description = record.description;
|
|
380
|
-
}
|
|
381
|
-
};
|
|
382
|
-
}, "createCustomOverride");
|
|
383
|
-
|
|
384
|
-
// src/schema/errors.ts
|
|
385
|
-
var ZodNestError = class extends Error {
|
|
386
|
-
static {
|
|
387
|
-
__name(this, "ZodNestError");
|
|
388
|
-
}
|
|
389
|
-
constructor(message) {
|
|
390
|
-
super(message);
|
|
391
|
-
this.name = "ZodNestError";
|
|
392
|
-
}
|
|
393
|
-
};
|
|
394
|
-
var ZodNestUnrepresentableError = class extends ZodNestError {
|
|
395
|
-
static {
|
|
396
|
-
__name(this, "ZodNestUnrepresentableError");
|
|
397
|
-
}
|
|
398
|
-
path;
|
|
399
|
-
zodType;
|
|
400
|
-
constructor(path, zodType) {
|
|
401
|
-
super(`Unrepresentable Zod schema \`${zodType}\` at ${formatPath(path)}: no override produced a JSON Schema body. Set strict: false to emit \`{}\` instead, or supply an \`override\` that handles this Zod type.`);
|
|
402
|
-
this.name = "ZodNestUnrepresentableError";
|
|
403
|
-
this.path = path;
|
|
404
|
-
this.zodType = zodType;
|
|
405
|
-
}
|
|
406
|
-
};
|
|
407
|
-
var formatPath = /* @__PURE__ */ __name((path) => {
|
|
408
|
-
if (path.length === 0) {
|
|
409
|
-
return "<root>";
|
|
410
|
-
}
|
|
411
|
-
return "/" + path.map(String).join("/");
|
|
412
|
-
}, "formatPath");
|
|
413
|
-
|
|
414
|
-
// src/schema/override.ts
|
|
415
|
-
var primitiveOverride = /* @__PURE__ */ __name(({ zodSchema, jsonSchema }) => {
|
|
416
|
-
const type = zodSchema._zod.def.type;
|
|
417
|
-
if (type === "bigint") {
|
|
418
|
-
jsonSchema.type = "integer";
|
|
419
|
-
return;
|
|
420
|
-
}
|
|
421
|
-
if (type === "date") {
|
|
422
|
-
jsonSchema.type = "string";
|
|
423
|
-
jsonSchema.format = "date-time";
|
|
424
|
-
return;
|
|
425
|
-
}
|
|
426
|
-
}, "primitiveOverride");
|
|
427
|
-
var combine = /* @__PURE__ */ __name((...overrides) => {
|
|
428
|
-
const list = [];
|
|
429
|
-
for (const candidate of overrides) {
|
|
430
|
-
if (typeof candidate !== "function") {
|
|
431
|
-
continue;
|
|
432
|
-
}
|
|
433
|
-
list.push(candidate);
|
|
434
|
-
}
|
|
435
|
-
return (ctx) => {
|
|
436
|
-
for (const o of list) {
|
|
437
|
-
o(ctx);
|
|
438
|
-
}
|
|
439
|
-
};
|
|
440
|
-
}, "combine");
|
|
441
|
-
|
|
442
|
-
// src/schema/post-process.ts
|
|
443
|
-
var rewriteRefs = /* @__PURE__ */ __name((node, rootRef) => {
|
|
444
|
-
if (Array.isArray(node)) {
|
|
445
|
-
for (const item of node) {
|
|
446
|
-
rewriteRefs(item, rootRef);
|
|
447
|
-
}
|
|
448
|
-
return;
|
|
449
|
-
}
|
|
450
|
-
if (node === null || typeof node !== "object") {
|
|
451
|
-
return;
|
|
452
|
-
}
|
|
453
|
-
const obj = node;
|
|
454
|
-
const ref = obj.$ref;
|
|
455
|
-
if (typeof ref === "string" && ref.startsWith(DEFS_PREFIX)) {
|
|
456
|
-
obj.$ref = COMPONENTS_SCHEMAS_PREFIX + ref.slice(DEFS_PREFIX.length);
|
|
457
|
-
} else if (ref === "#" && rootRef !== void 0) {
|
|
458
|
-
obj.$ref = rootRef;
|
|
459
|
-
}
|
|
460
|
-
for (const value of Object.values(obj)) {
|
|
461
|
-
rewriteRefs(value, rootRef);
|
|
462
|
-
}
|
|
463
|
-
}, "rewriteRefs");
|
|
464
|
-
var refsIn = /* @__PURE__ */ __name(function* (node) {
|
|
465
|
-
if (Array.isArray(node)) {
|
|
466
|
-
for (const item of node) {
|
|
467
|
-
yield* refsIn(item);
|
|
468
|
-
}
|
|
469
|
-
return;
|
|
470
|
-
}
|
|
471
|
-
if (node === null || typeof node !== "object") {
|
|
472
|
-
return;
|
|
473
|
-
}
|
|
474
|
-
const obj = node;
|
|
475
|
-
if (typeof obj.$ref === "string") {
|
|
476
|
-
yield obj.$ref;
|
|
477
|
-
}
|
|
478
|
-
for (const value of Object.values(obj)) {
|
|
479
|
-
yield* refsIn(value);
|
|
480
|
-
}
|
|
481
|
-
}, "refsIn");
|
|
482
|
-
var rootDefId = /* @__PURE__ */ __name((raw) => {
|
|
483
|
-
const ref = raw.$ref;
|
|
484
|
-
if (typeof ref !== "string" || !ref.startsWith(DEFS_PREFIX)) {
|
|
485
|
-
return void 0;
|
|
486
|
-
}
|
|
487
|
-
return ref.slice(DEFS_PREFIX.length);
|
|
488
|
-
}, "rootDefId");
|
|
489
|
-
var isReferenced = /* @__PURE__ */ __name((defs, id) => {
|
|
490
|
-
const ownRef = `${DEFS_PREFIX}${id}`;
|
|
491
|
-
for (const ref of refsIn(defs)) {
|
|
492
|
-
if (ref === "#" || ref === ownRef) {
|
|
493
|
-
return true;
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
|
-
return false;
|
|
497
|
-
}, "isReferenced");
|
|
498
|
-
var referencesRoot = /* @__PURE__ */ __name((raw) => {
|
|
499
|
-
for (const ref of refsIn(raw)) {
|
|
500
|
-
if (ref === "#") {
|
|
501
|
-
return true;
|
|
502
|
-
}
|
|
503
|
-
}
|
|
504
|
-
return false;
|
|
505
|
-
}, "referencesRoot");
|
|
506
|
-
var stripEnvelope = /* @__PURE__ */ __name((raw) => {
|
|
507
|
-
const root = {
|
|
508
|
-
...raw
|
|
509
|
-
};
|
|
510
|
-
delete root.$schema;
|
|
511
|
-
delete root.$defs;
|
|
512
|
-
return root;
|
|
513
|
-
}, "stripEnvelope");
|
|
514
|
-
var resolveRoot = /* @__PURE__ */ __name((raw, refs, options) => {
|
|
515
|
-
const liftedId = rootDefId(raw);
|
|
516
|
-
if (liftedId !== void 0) {
|
|
517
|
-
const body = refs.get(liftedId);
|
|
518
|
-
if (body !== void 0 && !isReferenced(raw.$defs, liftedId)) {
|
|
519
|
-
refs.delete(liftedId);
|
|
520
|
-
return {
|
|
521
|
-
schema: body,
|
|
522
|
-
rootRef: void 0
|
|
523
|
-
};
|
|
524
|
-
}
|
|
525
|
-
return {
|
|
526
|
-
schema: stripEnvelope(raw),
|
|
527
|
-
rootRef: `${COMPONENTS_SCHEMAS_PREFIX}${liftedId}`
|
|
528
|
-
};
|
|
529
|
-
}
|
|
530
|
-
const root = stripEnvelope(raw);
|
|
531
|
-
if (!referencesRoot(raw)) {
|
|
532
|
-
return {
|
|
533
|
-
schema: root,
|
|
534
|
-
rootRef: void 0
|
|
535
|
-
};
|
|
536
|
-
}
|
|
537
|
-
const rootId = options?.rootId;
|
|
538
|
-
if (rootId === void 0) {
|
|
539
|
-
if (options?.strict ?? true) {
|
|
540
|
-
throw new ZodNestError('A schema referenced from inside its own emission has no id, so the reference cannot be resolved. Add `.meta({ id: "\u2026" })` to the root schema, or set strict: false to leave the reference unresolved.');
|
|
541
|
-
}
|
|
542
|
-
return {
|
|
543
|
-
schema: root,
|
|
544
|
-
rootRef: void 0
|
|
545
|
-
};
|
|
546
|
-
}
|
|
547
|
-
refs.set(rootId, root);
|
|
548
|
-
const rootRef = `${COMPONENTS_SCHEMAS_PREFIX}${rootId}`;
|
|
549
|
-
return {
|
|
550
|
-
schema: {
|
|
551
|
-
$ref: rootRef
|
|
552
|
-
},
|
|
553
|
-
rootRef
|
|
554
|
-
};
|
|
555
|
-
}, "resolveRoot");
|
|
556
|
-
var postProcess = /* @__PURE__ */ __name((raw, options) => {
|
|
557
|
-
const refs = /* @__PURE__ */ new Map();
|
|
558
|
-
const rawDefs = raw.$defs;
|
|
559
|
-
if (rawDefs !== void 0) {
|
|
560
|
-
for (const [id, body] of Object.entries(rawDefs)) {
|
|
561
|
-
refs.set(id, body);
|
|
562
|
-
}
|
|
563
|
-
}
|
|
564
|
-
const { schema, rootRef } = resolveRoot(raw, refs, options);
|
|
565
|
-
rewriteRefs(schema, rootRef);
|
|
566
|
-
for (const body of refs.values()) {
|
|
567
|
-
rewriteRefs(body, rootRef);
|
|
568
|
-
}
|
|
569
|
-
return {
|
|
570
|
-
schema,
|
|
571
|
-
refs
|
|
572
|
-
};
|
|
573
|
-
}, "postProcess");
|
|
574
|
-
|
|
575
|
-
// src/schema/engine.ts
|
|
576
|
-
var STRICT_REQUIRES_OVERRIDE = /* @__PURE__ */ new Set([
|
|
577
|
-
"bigint",
|
|
578
|
-
"date",
|
|
579
|
-
"symbol",
|
|
580
|
-
"undefined",
|
|
581
|
-
"void",
|
|
582
|
-
"map",
|
|
583
|
-
"set",
|
|
584
|
-
"transform",
|
|
585
|
-
"nan",
|
|
586
|
-
"custom"
|
|
587
|
-
]);
|
|
588
|
-
var ANNOTATION_ONLY_KEYS = /* @__PURE__ */ new Set([
|
|
589
|
-
"title",
|
|
590
|
-
"description",
|
|
591
|
-
"deprecated",
|
|
592
|
-
"examples",
|
|
593
|
-
"default",
|
|
594
|
-
"readOnly",
|
|
595
|
-
"writeOnly",
|
|
596
|
-
"$id",
|
|
597
|
-
"$schema",
|
|
598
|
-
"$comment",
|
|
599
|
-
"id"
|
|
600
|
-
]);
|
|
601
|
-
var isStrictlyUnrepresentable = /* @__PURE__ */ __name((jsonSchema, zodSchema) => {
|
|
602
|
-
if (!STRICT_REQUIRES_OVERRIDE.has(zodSchema._zod.def.type)) {
|
|
603
|
-
return false;
|
|
604
|
-
}
|
|
605
|
-
return Object.keys(jsonSchema).every((key) => ANNOTATION_ONLY_KEYS.has(key));
|
|
606
|
-
}, "isStrictlyUnrepresentable");
|
|
607
|
-
var markPipeCoverage = /* @__PURE__ */ __name((schema, io, covered) => {
|
|
608
|
-
const def = schema._zod.def;
|
|
609
|
-
if (def.type !== "pipe" || def.in === void 0 || def.out === void 0) {
|
|
610
|
-
return;
|
|
611
|
-
}
|
|
612
|
-
const target = io === "output" ? def.out : def.in._zod.traits.has("$ZodTransform") ? def.out : def.in;
|
|
613
|
-
if (covered.has(target)) {
|
|
614
|
-
return;
|
|
615
|
-
}
|
|
616
|
-
covered.add(target);
|
|
617
|
-
markPipeCoverage(target, io, covered);
|
|
618
|
-
}, "markPipeCoverage");
|
|
619
|
-
var buildToJsonSchemaOptions = /* @__PURE__ */ __name((params) => {
|
|
620
|
-
const strict = params.strict ?? true;
|
|
621
|
-
const compositionOverride = createCompositionOverride({
|
|
622
|
-
buildRef: params.uri ?? DEFAULT_BUILD_REF,
|
|
623
|
-
registry: params.registry
|
|
624
|
-
});
|
|
625
|
-
const customOverride = createCustomOverride(params.io);
|
|
626
|
-
const merged = combine(primitiveOverride, compositionOverride, customOverride, params.override);
|
|
627
|
-
const unrepresentableHits = [];
|
|
628
|
-
const coveredByPipe = /* @__PURE__ */ new WeakSet();
|
|
629
|
-
const wrapped = /* @__PURE__ */ __name((ctx) => {
|
|
630
|
-
merged(ctx);
|
|
631
|
-
if (ctx.zodSchema._zod.def.type === "pipe") {
|
|
632
|
-
const record = peekRegistration(ctx.zodSchema);
|
|
633
|
-
if (record !== void 0 && record[params.io] !== void 0) {
|
|
634
|
-
markPipeCoverage(ctx.zodSchema, params.io, coveredByPipe);
|
|
635
|
-
}
|
|
636
|
-
}
|
|
637
|
-
if (!strict || !isStrictlyUnrepresentable(ctx.jsonSchema, ctx.zodSchema)) {
|
|
638
|
-
return;
|
|
639
|
-
}
|
|
640
|
-
unrepresentableHits.push({
|
|
641
|
-
path: [
|
|
642
|
-
...ctx.path
|
|
643
|
-
],
|
|
644
|
-
zodType: ctx.zodSchema._zod.def.type,
|
|
645
|
-
zodSchema: ctx.zodSchema
|
|
646
|
-
});
|
|
647
|
-
}, "wrapped");
|
|
648
|
-
const options = {
|
|
649
|
-
target: "draft-2020-12",
|
|
650
|
-
io: params.io,
|
|
651
|
-
unrepresentable: "any",
|
|
652
|
-
metadata: params.registry.zodRegistry,
|
|
653
|
-
override: wrapped,
|
|
654
|
-
cycles: "ref",
|
|
655
|
-
reused: params.reused
|
|
656
|
-
};
|
|
657
|
-
if (params.uri !== void 0) {
|
|
658
|
-
options.uri = params.uri;
|
|
659
|
-
}
|
|
660
|
-
return {
|
|
661
|
-
options,
|
|
662
|
-
consumeUnrepresentable: /* @__PURE__ */ __name(() => {
|
|
663
|
-
const firstHit = unrepresentableHits.find((hit) => !coveredByPipe.has(hit.zodSchema));
|
|
664
|
-
if (firstHit !== void 0) {
|
|
665
|
-
throw new ZodNestUnrepresentableError(firstHit.path, firstHit.zodType);
|
|
666
|
-
}
|
|
667
|
-
}, "consumeUnrepresentable")
|
|
668
|
-
};
|
|
669
|
-
}, "buildToJsonSchemaOptions");
|
|
670
|
-
var resolveRootId = /* @__PURE__ */ __name((schema, registry) => {
|
|
671
|
-
const id = registry.zodRegistry.get(schema)?.id;
|
|
672
|
-
return typeof id === "string" && id !== "" ? id : void 0;
|
|
673
|
-
}, "resolveRootId");
|
|
674
|
-
var toOpenApi = /* @__PURE__ */ __name((schema, opts) => {
|
|
675
|
-
const built = buildToJsonSchemaOptions({
|
|
676
|
-
registry: opts.registry,
|
|
677
|
-
io: opts.io,
|
|
678
|
-
override: opts.override,
|
|
679
|
-
strict: opts.strict,
|
|
680
|
-
reused: "inline"
|
|
681
|
-
});
|
|
682
|
-
const raw = zod.z.toJSONSchema(schema, built.options);
|
|
683
|
-
built.consumeUnrepresentable();
|
|
684
|
-
const result = postProcess(raw, {
|
|
685
|
-
rootId: resolveRootId(schema, opts.registry),
|
|
686
|
-
strict: opts.strict
|
|
687
|
-
});
|
|
688
|
-
for (const [id] of opts.registry.getCollisions()) {
|
|
689
|
-
if (!result.refs.has(id)) {
|
|
690
|
-
continue;
|
|
691
|
-
}
|
|
692
|
-
result.refs.set(id, {
|
|
693
|
-
description: `ERROR: duplicate zod-nest id <${id}>`,
|
|
694
|
-
[ZOD_NEST_ERROR_EXTENSION]: ZOD_NEST_ERROR_DUPLICATE_ID
|
|
695
|
-
});
|
|
696
|
-
}
|
|
697
|
-
return result;
|
|
698
|
-
}, "toOpenApi");
|
|
699
|
-
|
|
700
18
|
// src/dto/marker.ts
|
|
701
|
-
var makeZodDtoMarker = /* @__PURE__ */ __name((dtoId, io) => ({
|
|
702
|
-
type: /* @__PURE__ */ __name(() => Object, "type"),
|
|
19
|
+
var makeZodDtoMarker = /* @__PURE__ */ chunk4RXGLSPP_js.__name((dtoId, io) => ({
|
|
20
|
+
type: /* @__PURE__ */ chunk4RXGLSPP_js.__name(() => Object, "type"),
|
|
703
21
|
required: false,
|
|
704
22
|
__zodNestDto: true,
|
|
705
23
|
dtoId,
|
|
706
24
|
io
|
|
707
25
|
}), "makeZodDtoMarker");
|
|
708
|
-
var isZodDtoMarker = /* @__PURE__ */ __name((value) => {
|
|
26
|
+
var isZodDtoMarker = /* @__PURE__ */ chunk4RXGLSPP_js.__name((value) => {
|
|
709
27
|
if (value === null || typeof value !== "object") {
|
|
710
28
|
return false;
|
|
711
29
|
}
|
|
712
30
|
return value.__zodNestDto === true;
|
|
713
31
|
}, "isZodDtoMarker");
|
|
714
32
|
|
|
715
|
-
// src/dto/symbols.ts
|
|
716
|
-
var ZOD_DTO_SYMBOL = /* @__PURE__ */ Symbol.for("zod-nest.dto");
|
|
717
|
-
|
|
718
33
|
// src/dto/output-dto.ts
|
|
719
|
-
var outputCache = /* @__PURE__ */ new WeakMap();
|
|
720
|
-
var buildSiblingClass = /* @__PURE__ */ __name((parent, schema) => {
|
|
34
|
+
var outputCache = chunk4RXGLSPP_js.singleton("output-dto-cache", () => /* @__PURE__ */ new WeakMap());
|
|
35
|
+
var buildSiblingClass = /* @__PURE__ */ chunk4RXGLSPP_js.__name((parent, schema) => {
|
|
721
36
|
const SiblingClass = class {
|
|
722
37
|
static {
|
|
723
|
-
__name(this, "SiblingClass");
|
|
38
|
+
chunk4RXGLSPP_js.__name(this, "SiblingClass");
|
|
724
39
|
}
|
|
725
40
|
static schema = schema;
|
|
726
41
|
static io = "output";
|
|
727
|
-
static [ZOD_DTO_SYMBOL] = true;
|
|
42
|
+
static [chunkFKXVNCDD_js.ZOD_DTO_SYMBOL] = true;
|
|
728
43
|
static get id() {
|
|
729
44
|
return parent.id;
|
|
730
45
|
}
|
|
@@ -739,17 +54,17 @@ var buildSiblingClass = /* @__PURE__ */ __name((parent, schema) => {
|
|
|
739
54
|
}
|
|
740
55
|
static _OPENAPI_METADATA_FACTORY() {
|
|
741
56
|
return {
|
|
742
|
-
[ZOD_NEST_DTO_EXTENSION]: makeZodDtoMarker(parent.id, "output")
|
|
57
|
+
[chunkFKXVNCDD_js.ZOD_NEST_DTO_EXTENSION]: makeZodDtoMarker(parent.id, "output")
|
|
743
58
|
};
|
|
744
59
|
}
|
|
745
60
|
};
|
|
746
61
|
Object.defineProperty(SiblingClass, "name", {
|
|
747
|
-
get: /* @__PURE__ */ __name(() => parent.id, "get"),
|
|
62
|
+
get: /* @__PURE__ */ chunk4RXGLSPP_js.__name(() => parent.id, "get"),
|
|
748
63
|
configurable: true
|
|
749
64
|
});
|
|
750
65
|
return SiblingClass;
|
|
751
66
|
}, "buildSiblingClass");
|
|
752
|
-
var resolveOutput = /* @__PURE__ */ __name((parent, schema) => {
|
|
67
|
+
var resolveOutput = /* @__PURE__ */ chunk4RXGLSPP_js.__name((parent, schema) => {
|
|
753
68
|
const cached = outputCache.get(parent);
|
|
754
69
|
if (cached !== void 0) {
|
|
755
70
|
return cached;
|
|
@@ -760,29 +75,31 @@ var resolveOutput = /* @__PURE__ */ __name((parent, schema) => {
|
|
|
760
75
|
}, "resolveOutput");
|
|
761
76
|
|
|
762
77
|
// src/dto/create-zod-dto.ts
|
|
763
|
-
var
|
|
764
|
-
|
|
765
|
-
|
|
78
|
+
var anonState = chunk4RXGLSPP_js.singleton("anon-dto-state", () => ({
|
|
79
|
+
counter: 0,
|
|
80
|
+
warned: false
|
|
81
|
+
}));
|
|
82
|
+
var resolveFallbackId = /* @__PURE__ */ chunk4RXGLSPP_js.__name((className) => {
|
|
766
83
|
if (className !== "" && className.length > 1) {
|
|
767
84
|
return className;
|
|
768
85
|
}
|
|
769
|
-
|
|
770
|
-
const fallback = `_AnonZodDto_${
|
|
771
|
-
if (!
|
|
772
|
-
|
|
86
|
+
anonState.counter += 1;
|
|
87
|
+
const fallback = `_AnonZodDto_${anonState.counter}`;
|
|
88
|
+
if (!anonState.warned) {
|
|
89
|
+
anonState.warned = true;
|
|
773
90
|
console.warn(`[zod-nest] Could not resolve a DTO id from class name (got "${className}"). Using "${fallback}". Set an explicit id via \`schema.meta({ id: 'Foo' })\` (preferred) or \`createZodDto(schema, { id: 'Foo' })\` \u2014 important under minification, where class names become single mangled characters.`);
|
|
774
91
|
}
|
|
775
92
|
return fallback;
|
|
776
93
|
}, "resolveFallbackId");
|
|
777
|
-
var createZodDto = /* @__PURE__ */ __name((schema, options) => {
|
|
778
|
-
const registry = options?.registry ?? defaultRegistry;
|
|
94
|
+
var createZodDto = /* @__PURE__ */ chunk4RXGLSPP_js.__name((schema, options) => {
|
|
95
|
+
const registry = options?.registry ?? chunkFKXVNCDD_js.defaultRegistry;
|
|
779
96
|
const io = "input";
|
|
780
97
|
let cachedId;
|
|
781
|
-
const ensureRegistered = /* @__PURE__ */ __name((className) => {
|
|
98
|
+
const ensureRegistered = /* @__PURE__ */ chunk4RXGLSPP_js.__name((className) => {
|
|
782
99
|
if (cachedId !== void 0) {
|
|
783
100
|
return cachedId;
|
|
784
101
|
}
|
|
785
|
-
const named = registerSchema(schema, registry, {
|
|
102
|
+
const named = chunkFKXVNCDD_js.registerSchema(schema, registry, {
|
|
786
103
|
id: options?.id,
|
|
787
104
|
expose: options?.expose
|
|
788
105
|
});
|
|
@@ -798,11 +115,11 @@ var createZodDto = /* @__PURE__ */ __name((schema, options) => {
|
|
|
798
115
|
}, "ensureRegistered");
|
|
799
116
|
const ZodDtoBase = class {
|
|
800
117
|
static {
|
|
801
|
-
__name(this, "ZodDtoBase");
|
|
118
|
+
chunk4RXGLSPP_js.__name(this, "ZodDtoBase");
|
|
802
119
|
}
|
|
803
120
|
static schema = schema;
|
|
804
121
|
static io = io;
|
|
805
|
-
static [ZOD_DTO_SYMBOL] = true;
|
|
122
|
+
static [chunkFKXVNCDD_js.ZOD_DTO_SYMBOL] = true;
|
|
806
123
|
static get id() {
|
|
807
124
|
return ensureRegistered(this.name);
|
|
808
125
|
}
|
|
@@ -817,17 +134,15 @@ var createZodDto = /* @__PURE__ */ __name((schema, options) => {
|
|
|
817
134
|
}
|
|
818
135
|
static _OPENAPI_METADATA_FACTORY() {
|
|
819
136
|
return {
|
|
820
|
-
[ZOD_NEST_DTO_EXTENSION]: makeZodDtoMarker(ensureRegistered(this.name), io)
|
|
137
|
+
[chunkFKXVNCDD_js.ZOD_NEST_DTO_EXTENSION]: makeZodDtoMarker(ensureRegistered(this.name), io)
|
|
821
138
|
};
|
|
822
139
|
}
|
|
823
140
|
};
|
|
824
141
|
return ZodDtoBase;
|
|
825
142
|
}, "createZodDto");
|
|
826
|
-
var isZodDto = /* @__PURE__ */ __name((value) => typeof value === "function" && value[ZOD_DTO_SYMBOL] === true, "isZodDto");
|
|
827
|
-
var isZodSchema = /* @__PURE__ */ __name((value) => value instanceof zod.z.ZodType, "isZodSchema");
|
|
828
143
|
var ZodSerializationException = class extends common.InternalServerErrorException {
|
|
829
144
|
static {
|
|
830
|
-
__name(this, "ZodSerializationException");
|
|
145
|
+
chunk4RXGLSPP_js.__name(this, "ZodSerializationException");
|
|
831
146
|
}
|
|
832
147
|
zodError;
|
|
833
148
|
executionContext;
|
|
@@ -842,32 +157,14 @@ var ZodSerializationException = class extends common.InternalServerErrorExceptio
|
|
|
842
157
|
this.executionContext = executionContext;
|
|
843
158
|
}
|
|
844
159
|
};
|
|
845
|
-
var ZodValidationException = class extends common.BadRequestException {
|
|
846
|
-
static {
|
|
847
|
-
__name(this, "ZodValidationException");
|
|
848
|
-
}
|
|
849
|
-
zodError;
|
|
850
|
-
argMetadata;
|
|
851
|
-
constructor(zodError, argMetadata) {
|
|
852
|
-
super({
|
|
853
|
-
statusCode: common.HttpStatus.BAD_REQUEST,
|
|
854
|
-
message: "Validation failed",
|
|
855
|
-
errors: zod.z.treeifyError(zodError)
|
|
856
|
-
}, {
|
|
857
|
-
cause: zodError
|
|
858
|
-
});
|
|
859
|
-
this.zodError = zodError;
|
|
860
|
-
this.argMetadata = argMetadata;
|
|
861
|
-
}
|
|
862
|
-
};
|
|
863
160
|
var DEFAULT_LOGGER_CONTEXT = "ZodValidation";
|
|
864
161
|
var REDACTED = "[REDACTED]";
|
|
865
162
|
var PREVIEW_RESERVE_BYTES = 100;
|
|
866
|
-
var noopLogValidationFailure = /* @__PURE__ */ __name(() => {
|
|
163
|
+
var noopLogValidationFailure = /* @__PURE__ */ chunk4RXGLSPP_js.__name(() => {
|
|
867
164
|
}, "noopLogValidationFailure");
|
|
868
|
-
var isPlainRecord = /* @__PURE__ */ __name((value) => value !== null && typeof value === "object" && !Array.isArray(value), "isPlainRecord");
|
|
165
|
+
var isPlainRecord = /* @__PURE__ */ chunk4RXGLSPP_js.__name((value) => value !== null && typeof value === "object" && !Array.isArray(value), "isPlainRecord");
|
|
869
166
|
var CIRCULAR = "[CIRCULAR]";
|
|
870
|
-
var redactValue = /* @__PURE__ */ __name((value, redactSet, seen = /* @__PURE__ */ new WeakSet()) => {
|
|
167
|
+
var redactValue = /* @__PURE__ */ chunk4RXGLSPP_js.__name((value, redactSet, seen = /* @__PURE__ */ new WeakSet()) => {
|
|
871
168
|
if (Array.isArray(value)) {
|
|
872
169
|
if (seen.has(value)) {
|
|
873
170
|
return CIRCULAR;
|
|
@@ -892,7 +189,7 @@ var redactValue = /* @__PURE__ */ __name((value, redactSet, seen = /* @__PURE__
|
|
|
892
189
|
}
|
|
893
190
|
return out;
|
|
894
191
|
}, "redactValue");
|
|
895
|
-
var capLoggedValue = /* @__PURE__ */ __name((value, maxBytes) => {
|
|
192
|
+
var capLoggedValue = /* @__PURE__ */ chunk4RXGLSPP_js.__name((value, maxBytes) => {
|
|
896
193
|
let serialized;
|
|
897
194
|
try {
|
|
898
195
|
serialized = JSON.stringify(value);
|
|
@@ -917,9 +214,9 @@ var capLoggedValue = /* @__PURE__ */ __name((value, maxBytes) => {
|
|
|
917
214
|
_preview: serialized.slice(0, previewBudget)
|
|
918
215
|
};
|
|
919
216
|
}, "capLoggedValue");
|
|
920
|
-
var loggerContextFor = /* @__PURE__ */ __name((side) => side === "output" ? "ZodSerializerInterceptor" : "ZodValidationPipe", "loggerContextFor");
|
|
921
|
-
var messageFor = /* @__PURE__ */ __name((side) => side === "output" ? "Response validation failed" : "Request validation failed", "messageFor");
|
|
922
|
-
var createValidationLogger = /* @__PURE__ */ __name((opts) => {
|
|
217
|
+
var loggerContextFor = /* @__PURE__ */ chunk4RXGLSPP_js.__name((side) => side === "output" ? "ZodSerializerInterceptor" : "ZodValidationPipe", "loggerContextFor");
|
|
218
|
+
var messageFor = /* @__PURE__ */ chunk4RXGLSPP_js.__name((side) => side === "output" ? "Response validation failed" : "Request validation failed", "messageFor");
|
|
219
|
+
var createValidationLogger = /* @__PURE__ */ chunk4RXGLSPP_js.__name((opts) => {
|
|
923
220
|
const redactSet = new Set(opts.redactKeys.map((key) => key.toLowerCase()));
|
|
924
221
|
const { logger } = opts;
|
|
925
222
|
return (err, value, ctx) => {
|
|
@@ -960,12 +257,12 @@ var DEFAULT_STREAM_CONTENT_TYPES = [
|
|
|
960
257
|
"video/*"
|
|
961
258
|
];
|
|
962
259
|
var PREFIX_WILDCARD_SUFFIX = "/*";
|
|
963
|
-
var normalizeContentType = /* @__PURE__ */ __name((contentType) => {
|
|
260
|
+
var normalizeContentType = /* @__PURE__ */ chunk4RXGLSPP_js.__name((contentType) => {
|
|
964
261
|
const semicolonIndex = contentType.indexOf(";");
|
|
965
262
|
const mediaType = semicolonIndex === -1 ? contentType : contentType.slice(0, semicolonIndex);
|
|
966
263
|
return mediaType.trim().toLowerCase();
|
|
967
264
|
}, "normalizeContentType");
|
|
968
|
-
var normalizeStreamMatcher = /* @__PURE__ */ __name((contentTypes) => {
|
|
265
|
+
var normalizeStreamMatcher = /* @__PURE__ */ chunk4RXGLSPP_js.__name((contentTypes) => {
|
|
969
266
|
const exact = /* @__PURE__ */ new Set();
|
|
970
267
|
const prefixes = [];
|
|
971
268
|
for (const entry of contentTypes) {
|
|
@@ -986,7 +283,7 @@ var normalizeStreamMatcher = /* @__PURE__ */ __name((contentTypes) => {
|
|
|
986
283
|
};
|
|
987
284
|
}, "normalizeStreamMatcher");
|
|
988
285
|
var DEFAULT_STREAM_MATCHER = normalizeStreamMatcher(DEFAULT_STREAM_CONTENT_TYPES);
|
|
989
|
-
var matchesStream = /* @__PURE__ */ __name((contentType, matcher) => {
|
|
286
|
+
var matchesStream = /* @__PURE__ */ chunk4RXGLSPP_js.__name((contentType, matcher) => {
|
|
990
287
|
const normalized = normalizeContentType(contentType);
|
|
991
288
|
if (matcher.exact.has(normalized)) {
|
|
992
289
|
return true;
|
|
@@ -998,13 +295,13 @@ var matchesStream = /* @__PURE__ */ __name((contentType, matcher) => {
|
|
|
998
295
|
}
|
|
999
296
|
return false;
|
|
1000
297
|
}, "matchesStream");
|
|
1001
|
-
var isHeaderEntry = /* @__PURE__ */ __name((value) => {
|
|
298
|
+
var isHeaderEntry = /* @__PURE__ */ chunk4RXGLSPP_js.__name((value) => {
|
|
1002
299
|
if (value === null || typeof value !== "object") {
|
|
1003
300
|
return false;
|
|
1004
301
|
}
|
|
1005
302
|
return "name" in value && typeof value.name === "string";
|
|
1006
303
|
}, "isHeaderEntry");
|
|
1007
|
-
var headerContentType = /* @__PURE__ */ __name((handler) => {
|
|
304
|
+
var headerContentType = /* @__PURE__ */ chunk4RXGLSPP_js.__name((handler) => {
|
|
1008
305
|
const headers = Reflect.getMetadata(constants_js.HEADERS_METADATA, handler);
|
|
1009
306
|
if (!Array.isArray(headers)) {
|
|
1010
307
|
return void 0;
|
|
@@ -1023,7 +320,7 @@ var headerContentType = /* @__PURE__ */ __name((handler) => {
|
|
|
1023
320
|
}
|
|
1024
321
|
return void 0;
|
|
1025
322
|
}, "headerContentType");
|
|
1026
|
-
var resolveContentType = /* @__PURE__ */ __name((variant, handler, matcher) => {
|
|
323
|
+
var resolveContentType = /* @__PURE__ */ chunk4RXGLSPP_js.__name((variant, handler, matcher) => {
|
|
1027
324
|
if (variant.contentType !== void 0) {
|
|
1028
325
|
return variant.contentType;
|
|
1029
326
|
}
|
|
@@ -1033,7 +330,7 @@ var resolveContentType = /* @__PURE__ */ __name((variant, handler, matcher) => {
|
|
|
1033
330
|
}
|
|
1034
331
|
return DEFAULT_CONTENT_TYPE;
|
|
1035
332
|
}, "resolveContentType");
|
|
1036
|
-
var isStreamResponse = /* @__PURE__ */ __name((variant, handler, matcher) => {
|
|
333
|
+
var isStreamResponse = /* @__PURE__ */ chunk4RXGLSPP_js.__name((variant, handler, matcher) => {
|
|
1037
334
|
if (variant.stream !== void 0) {
|
|
1038
335
|
return variant.stream;
|
|
1039
336
|
}
|
|
@@ -1059,7 +356,7 @@ var DEFAULT_REDACT_KEYS = [
|
|
|
1059
356
|
];
|
|
1060
357
|
var DEFAULT_MAX_LOGGED_VALUE_BYTES = 4096;
|
|
1061
358
|
var ZOD_NEST_OPTIONS = /* @__PURE__ */ Symbol("zod-nest.options");
|
|
1062
|
-
var resolveLogFlags = /* @__PURE__ */ __name((validationLogs) => {
|
|
359
|
+
var resolveLogFlags = /* @__PURE__ */ chunk4RXGLSPP_js.__name((validationLogs) => {
|
|
1063
360
|
if (typeof validationLogs === "boolean") {
|
|
1064
361
|
return {
|
|
1065
362
|
input: validationLogs,
|
|
@@ -1071,7 +368,7 @@ var resolveLogFlags = /* @__PURE__ */ __name((validationLogs) => {
|
|
|
1071
368
|
output: validationLogs?.output ?? false
|
|
1072
369
|
};
|
|
1073
370
|
}, "resolveLogFlags");
|
|
1074
|
-
var normalizeZodNestOptions = /* @__PURE__ */ __name((opts) => {
|
|
371
|
+
var normalizeZodNestOptions = /* @__PURE__ */ chunk4RXGLSPP_js.__name((opts) => {
|
|
1075
372
|
const flags = resolveLogFlags(opts?.validationLogs);
|
|
1076
373
|
const redactKeys = opts?.redactKeys ?? DEFAULT_REDACT_KEYS;
|
|
1077
374
|
const maxLoggedValueBytes = opts?.maxLoggedValueBytes ?? DEFAULT_MAX_LOGGED_VALUE_BYTES;
|
|
@@ -1108,25 +405,25 @@ function _ts_decorate(decorators, target, key, desc) {
|
|
|
1108
405
|
}
|
|
1109
406
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1110
407
|
}
|
|
1111
|
-
__name(_ts_decorate, "_ts_decorate");
|
|
408
|
+
chunk4RXGLSPP_js.__name(_ts_decorate, "_ts_decorate");
|
|
1112
409
|
function _ts_metadata(metadataKey, metadataValue) {
|
|
1113
410
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
1114
411
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
1115
412
|
}
|
|
1116
413
|
}
|
|
1117
|
-
__name(_ts_metadata, "_ts_metadata");
|
|
414
|
+
chunk4RXGLSPP_js.__name(_ts_metadata, "_ts_metadata");
|
|
1118
415
|
function _ts_param(paramIndex, decorator) {
|
|
1119
416
|
return function(target, key) {
|
|
1120
417
|
decorator(target, key, paramIndex);
|
|
1121
418
|
};
|
|
1122
419
|
}
|
|
1123
|
-
__name(_ts_param, "_ts_param");
|
|
1124
|
-
var isZodSchema2 = /* @__PURE__ */ __name((value) => value !== null && typeof value === "object" && "_zod" in value, "isZodSchema");
|
|
1125
|
-
var isOptionsObject = /* @__PURE__ */ __name((value) => value !== null && typeof value === "object" && !isZodSchema2(value), "isOptionsObject");
|
|
1126
|
-
var defaultExceptionFactory = /* @__PURE__ */ __name((zodError, argMetadata) => new ZodValidationException(zodError, argMetadata), "defaultExceptionFactory");
|
|
420
|
+
chunk4RXGLSPP_js.__name(_ts_param, "_ts_param");
|
|
421
|
+
var isZodSchema2 = /* @__PURE__ */ chunk4RXGLSPP_js.__name((value) => value !== null && typeof value === "object" && "_zod" in value, "isZodSchema");
|
|
422
|
+
var isOptionsObject = /* @__PURE__ */ chunk4RXGLSPP_js.__name((value) => value !== null && typeof value === "object" && !isZodSchema2(value), "isOptionsObject");
|
|
423
|
+
var defaultExceptionFactory = /* @__PURE__ */ chunk4RXGLSPP_js.__name((zodError, argMetadata) => new chunkFKXVNCDD_js.ZodValidationException(zodError, argMetadata), "defaultExceptionFactory");
|
|
1127
424
|
exports.ZodValidationPipe = class _ZodValidationPipe {
|
|
1128
425
|
static {
|
|
1129
|
-
__name(this, "ZodValidationPipe");
|
|
426
|
+
chunk4RXGLSPP_js.__name(this, "ZodValidationPipe");
|
|
1130
427
|
}
|
|
1131
428
|
explicitSchema;
|
|
1132
429
|
explicitDtoName;
|
|
@@ -1161,7 +458,7 @@ exports.ZodValidationPipe = class _ZodValidationPipe {
|
|
|
1161
458
|
return this.explicitSchema;
|
|
1162
459
|
}
|
|
1163
460
|
const metatype = metadata.metatype;
|
|
1164
|
-
if (!isZodDto(metatype)) {
|
|
461
|
+
if (!chunkFKXVNCDD_js.isZodDto(metatype)) {
|
|
1165
462
|
return void 0;
|
|
1166
463
|
}
|
|
1167
464
|
return metatype.schema;
|
|
@@ -1171,7 +468,7 @@ exports.ZodValidationPipe = class _ZodValidationPipe {
|
|
|
1171
468
|
return this.explicitDtoName;
|
|
1172
469
|
}
|
|
1173
470
|
const metatype = metadata.metatype;
|
|
1174
|
-
if (isZodDto(metatype)) {
|
|
471
|
+
if (chunkFKXVNCDD_js.isZodDto(metatype)) {
|
|
1175
472
|
return metatype.name;
|
|
1176
473
|
}
|
|
1177
474
|
return "schema";
|
|
@@ -1184,7 +481,7 @@ exports.ZodValidationPipe = class _ZodValidationPipe {
|
|
|
1184
481
|
dtoName: void 0
|
|
1185
482
|
};
|
|
1186
483
|
}
|
|
1187
|
-
if (isZodDto(arg)) {
|
|
484
|
+
if (chunkFKXVNCDD_js.isZodDto(arg)) {
|
|
1188
485
|
return {
|
|
1189
486
|
schema: arg.schema,
|
|
1190
487
|
factory: void 0,
|
|
@@ -1206,8 +503,8 @@ exports.ZodValidationPipe = class _ZodValidationPipe {
|
|
|
1206
503
|
};
|
|
1207
504
|
}
|
|
1208
505
|
const optionSchema = arg.schema;
|
|
1209
|
-
const dtoName = isZodDto(optionSchema) ? optionSchema.name : void 0;
|
|
1210
|
-
const resolvedSchema = isZodDto(optionSchema) ? optionSchema.schema : optionSchema;
|
|
506
|
+
const dtoName = chunkFKXVNCDD_js.isZodDto(optionSchema) ? optionSchema.name : void 0;
|
|
507
|
+
const resolvedSchema = chunkFKXVNCDD_js.isZodDto(optionSchema) ? optionSchema.schema : optionSchema;
|
|
1211
508
|
return {
|
|
1212
509
|
schema: resolvedSchema,
|
|
1213
510
|
factory: arg.createValidationException,
|
|
@@ -1228,7 +525,7 @@ exports.ZodValidationPipe = _ts_decorate([
|
|
|
1228
525
|
], exports.ZodValidationPipe);
|
|
1229
526
|
var POST_DEFAULT_STATUS = 201;
|
|
1230
527
|
var GENERIC_DEFAULT_STATUS = 200;
|
|
1231
|
-
var defaultStatusFor = /* @__PURE__ */ __name((handler) => {
|
|
528
|
+
var defaultStatusFor = /* @__PURE__ */ chunk4RXGLSPP_js.__name((handler) => {
|
|
1232
529
|
const httpCode = Reflect.getMetadata(constants_js.HTTP_CODE_METADATA, handler);
|
|
1233
530
|
if (typeof httpCode === "number") {
|
|
1234
531
|
return httpCode;
|
|
@@ -1239,7 +536,7 @@ var defaultStatusFor = /* @__PURE__ */ __name((handler) => {
|
|
|
1239
536
|
}
|
|
1240
537
|
return GENERIC_DEFAULT_STATUS;
|
|
1241
538
|
}, "defaultStatusFor");
|
|
1242
|
-
var resolveEffectiveStatus = /* @__PURE__ */ __name((variant, handler) => {
|
|
539
|
+
var resolveEffectiveStatus = /* @__PURE__ */ chunk4RXGLSPP_js.__name((variant, handler) => {
|
|
1243
540
|
if (variant.status !== void 0) {
|
|
1244
541
|
return variant.status;
|
|
1245
542
|
}
|
|
@@ -1248,7 +545,7 @@ var resolveEffectiveStatus = /* @__PURE__ */ __name((variant, handler) => {
|
|
|
1248
545
|
|
|
1249
546
|
// src/response/metadata.ts
|
|
1250
547
|
var ZOD_RESPONSES_METADATA_KEY = /* @__PURE__ */ Symbol.for("zod-nest.responses");
|
|
1251
|
-
var appendResponseVariant = /* @__PURE__ */ __name((handler, variant) => {
|
|
548
|
+
var appendResponseVariant = /* @__PURE__ */ chunk4RXGLSPP_js.__name((handler, variant) => {
|
|
1252
549
|
const existing = Reflect.getMetadata(ZOD_RESPONSES_METADATA_KEY, handler) ?? [];
|
|
1253
550
|
Reflect.defineMetadata(ZOD_RESPONSES_METADATA_KEY, [
|
|
1254
551
|
variant,
|
|
@@ -1256,37 +553,21 @@ var appendResponseVariant = /* @__PURE__ */ __name((handler, variant) => {
|
|
|
1256
553
|
], handler);
|
|
1257
554
|
}, "appendResponseVariant");
|
|
1258
555
|
|
|
1259
|
-
// src/schema/anon-id.ts
|
|
1260
|
-
var ANON_RESPONSE_PREFIX = "_AnonResponseSchema_";
|
|
1261
|
-
var ANON_BODY_PREFIX = "_AnonBodySchema_";
|
|
1262
|
-
var anonIdCache = /* @__PURE__ */ new WeakMap();
|
|
1263
|
-
var counter = 0;
|
|
1264
|
-
var resolveAnonId = /* @__PURE__ */ __name((schema, prefix) => {
|
|
1265
|
-
const cached = anonIdCache.get(schema);
|
|
1266
|
-
if (cached !== void 0) {
|
|
1267
|
-
return cached;
|
|
1268
|
-
}
|
|
1269
|
-
counter += 1;
|
|
1270
|
-
const id = `${prefix}${counter}`;
|
|
1271
|
-
anonIdCache.set(schema, id);
|
|
1272
|
-
return id;
|
|
1273
|
-
}, "resolveAnonId");
|
|
1274
|
-
|
|
1275
556
|
// src/response/normalize-type.ts
|
|
1276
|
-
var responseDtoCache = /* @__PURE__ */ new WeakMap();
|
|
1277
|
-
var schemaToOutputDto = /* @__PURE__ */ __name((schema) => {
|
|
557
|
+
var responseDtoCache = chunk4RXGLSPP_js.singleton("response-dto-cache", () => /* @__PURE__ */ new WeakMap());
|
|
558
|
+
var schemaToOutputDto = /* @__PURE__ */ chunk4RXGLSPP_js.__name((schema) => {
|
|
1278
559
|
const cached = responseDtoCache.get(schema);
|
|
1279
560
|
if (cached !== void 0) {
|
|
1280
561
|
return cached;
|
|
1281
562
|
}
|
|
1282
|
-
const namedId = registerSchema(schema);
|
|
563
|
+
const namedId = chunkFKXVNCDD_js.registerSchema(schema);
|
|
1283
564
|
if (namedId !== void 0) {
|
|
1284
565
|
const dto2 = createZodDto(schema).Output;
|
|
1285
566
|
responseDtoCache.set(schema, dto2);
|
|
1286
567
|
return dto2;
|
|
1287
568
|
}
|
|
1288
|
-
const anonId = resolveAnonId(schema, ANON_RESPONSE_PREFIX);
|
|
1289
|
-
registerSchema(schema, defaultRegistry, {
|
|
569
|
+
const anonId = chunkFKXVNCDD_js.resolveAnonId(schema, chunkFKXVNCDD_js.ANON_RESPONSE_PREFIX);
|
|
570
|
+
chunkFKXVNCDD_js.registerSchema(schema, chunkFKXVNCDD_js.defaultRegistry, {
|
|
1290
571
|
id: anonId,
|
|
1291
572
|
anonymous: true
|
|
1292
573
|
});
|
|
@@ -1296,17 +577,17 @@ var schemaToOutputDto = /* @__PURE__ */ __name((schema) => {
|
|
|
1296
577
|
responseDtoCache.set(schema, dto);
|
|
1297
578
|
return dto;
|
|
1298
579
|
}, "schemaToOutputDto");
|
|
1299
|
-
var toResponseDto = /* @__PURE__ */ __name((entry, index) => {
|
|
1300
|
-
if (isZodDto(entry)) {
|
|
580
|
+
var toResponseDto = /* @__PURE__ */ chunk4RXGLSPP_js.__name((entry, index) => {
|
|
581
|
+
if (chunkFKXVNCDD_js.isZodDto(entry)) {
|
|
1301
582
|
return entry;
|
|
1302
583
|
}
|
|
1303
|
-
if (isZodSchema(entry)) {
|
|
584
|
+
if (chunkFKXVNCDD_js.isZodSchema(entry)) {
|
|
1304
585
|
return schemaToOutputDto(entry);
|
|
1305
586
|
}
|
|
1306
587
|
const where = index === void 0 ? "@ZodResponse({ type })" : `@ZodResponse({ type }) element [${index}]`;
|
|
1307
588
|
throw new TypeError(`[zod-nest] ${where} must be a zod-nest DTO class (from createZodDto), a Zod schema, or a non-empty array of those.`);
|
|
1308
589
|
}, "toResponseDto");
|
|
1309
|
-
var extractDescriptionFields = /* @__PURE__ */ __name((desc) => {
|
|
590
|
+
var extractDescriptionFields = /* @__PURE__ */ chunk4RXGLSPP_js.__name((desc) => {
|
|
1310
591
|
if (desc === void 0) {
|
|
1311
592
|
return {};
|
|
1312
593
|
}
|
|
@@ -1326,21 +607,21 @@ var extractDescriptionFields = /* @__PURE__ */ __name((desc) => {
|
|
|
1326
607
|
}
|
|
1327
608
|
return out;
|
|
1328
609
|
}, "extractDescriptionFields");
|
|
1329
|
-
var asDtoFunction = /* @__PURE__ */ __name((dto) => dto, "asDtoFunction");
|
|
1330
|
-
var buildApiResponseOptions = /* @__PURE__ */ __name((base, body) => {
|
|
610
|
+
var asDtoFunction = /* @__PURE__ */ chunk4RXGLSPP_js.__name((dto) => dto, "asDtoFunction");
|
|
611
|
+
var buildApiResponseOptions = /* @__PURE__ */ chunk4RXGLSPP_js.__name((base, body) => {
|
|
1331
612
|
return {
|
|
1332
613
|
...base,
|
|
1333
614
|
...body
|
|
1334
615
|
};
|
|
1335
616
|
}, "buildApiResponseOptions");
|
|
1336
|
-
var buildTupleSchema = /* @__PURE__ */ __name((dtos) => ({
|
|
617
|
+
var buildTupleSchema = /* @__PURE__ */ chunk4RXGLSPP_js.__name((dtos) => ({
|
|
1337
618
|
type: "array",
|
|
1338
619
|
prefixItems: dtos.map((d) => ({
|
|
1339
620
|
$ref: swagger.getSchemaPath(asDtoFunction(d))
|
|
1340
621
|
})),
|
|
1341
622
|
items: false
|
|
1342
623
|
}), "buildTupleSchema");
|
|
1343
|
-
var buildContentResponseOptions = /* @__PURE__ */ __name((base, contentType, schema) => {
|
|
624
|
+
var buildContentResponseOptions = /* @__PURE__ */ chunk4RXGLSPP_js.__name((base, contentType, schema) => {
|
|
1344
625
|
return {
|
|
1345
626
|
...base,
|
|
1346
627
|
content: {
|
|
@@ -1350,7 +631,7 @@ var buildContentResponseOptions = /* @__PURE__ */ __name((base, contentType, sch
|
|
|
1350
631
|
}
|
|
1351
632
|
};
|
|
1352
633
|
}, "buildContentResponseOptions");
|
|
1353
|
-
var applyCustomContentResponse = /* @__PURE__ */ __name((variant, base, contentType, target, propertyKey, descriptor) => {
|
|
634
|
+
var applyCustomContentResponse = /* @__PURE__ */ chunk4RXGLSPP_js.__name((variant, base, contentType, target, propertyKey, descriptor) => {
|
|
1354
635
|
if (variant.kind === "single") {
|
|
1355
636
|
const dto = variant.dto;
|
|
1356
637
|
swagger.ApiExtraModels(asDtoFunction(dto))(target, propertyKey, descriptor);
|
|
@@ -1375,7 +656,7 @@ var applyCustomContentResponse = /* @__PURE__ */ __name((variant, base, contentT
|
|
|
1375
656
|
}
|
|
1376
657
|
swagger.ApiResponse(buildContentResponseOptions(base, contentType, buildTupleSchema(dtos)))(target, propertyKey, descriptor);
|
|
1377
658
|
}, "applyCustomContentResponse");
|
|
1378
|
-
var applySwaggerResponseDecorator = /* @__PURE__ */ __name((variant, effectiveStatus, effectiveContentType, target, propertyKey, descriptor) => {
|
|
659
|
+
var applySwaggerResponseDecorator = /* @__PURE__ */ chunk4RXGLSPP_js.__name((variant, effectiveStatus, effectiveContentType, target, propertyKey, descriptor) => {
|
|
1379
660
|
const base = {
|
|
1380
661
|
status: effectiveStatus,
|
|
1381
662
|
...extractDescriptionFields(variant.description)
|
|
@@ -1408,7 +689,7 @@ var applySwaggerResponseDecorator = /* @__PURE__ */ __name((variant, effectiveSt
|
|
|
1408
689
|
}, "applySwaggerResponseDecorator");
|
|
1409
690
|
|
|
1410
691
|
// src/decorators/zod-response.decorator.ts
|
|
1411
|
-
var buildArrayKind = /* @__PURE__ */ __name((entries) => {
|
|
692
|
+
var buildArrayKind = /* @__PURE__ */ chunk4RXGLSPP_js.__name((entries) => {
|
|
1412
693
|
const [headEntry, ...restEntries] = entries;
|
|
1413
694
|
const head = toResponseDto(headEntry, 0);
|
|
1414
695
|
const rest = restEntries.map((entry, index) => toResponseDto(entry, index + 1));
|
|
@@ -1434,7 +715,7 @@ var buildArrayKind = /* @__PURE__ */ __name((entries) => {
|
|
|
1434
715
|
validationSchema: zod.z.tuple(tupleSchemas)
|
|
1435
716
|
};
|
|
1436
717
|
}, "buildArrayKind");
|
|
1437
|
-
var buildKind = /* @__PURE__ */ __name((type) => {
|
|
718
|
+
var buildKind = /* @__PURE__ */ chunk4RXGLSPP_js.__name((type) => {
|
|
1438
719
|
if (Array.isArray(type)) {
|
|
1439
720
|
if (type.length === 0) {
|
|
1440
721
|
throw new TypeError("[zod-nest] @ZodResponse({ type: [] }) is invalid \u2014 provide at least one DTO or schema.");
|
|
@@ -1448,13 +729,13 @@ var buildKind = /* @__PURE__ */ __name((type) => {
|
|
|
1448
729
|
validationSchema: dto.schema
|
|
1449
730
|
};
|
|
1450
731
|
}, "buildKind");
|
|
1451
|
-
var normaliseStatus = /* @__PURE__ */ __name((status) => {
|
|
732
|
+
var normaliseStatus = /* @__PURE__ */ chunk4RXGLSPP_js.__name((status) => {
|
|
1452
733
|
if (status === "default") {
|
|
1453
734
|
return void 0;
|
|
1454
735
|
}
|
|
1455
736
|
return status;
|
|
1456
737
|
}, "normaliseStatus");
|
|
1457
|
-
var ZodResponse = /* @__PURE__ */ __name((opts) => {
|
|
738
|
+
var ZodResponse = /* @__PURE__ */ chunk4RXGLSPP_js.__name((opts) => {
|
|
1458
739
|
const built = buildKind(opts.type);
|
|
1459
740
|
const status = normaliseStatus(opts.status);
|
|
1460
741
|
return (target, propertyKey, descriptor) => {
|
|
@@ -1481,167 +762,7 @@ var ZodResponse = /* @__PURE__ */ __name((opts) => {
|
|
|
1481
762
|
});
|
|
1482
763
|
};
|
|
1483
764
|
}, "ZodResponse");
|
|
1484
|
-
|
|
1485
|
-
// src/decorators/internal/zod-schema-ref.ts
|
|
1486
|
-
function resolveSchemaRef(schema, options) {
|
|
1487
|
-
const registry = options?.registry ?? defaultRegistry;
|
|
1488
|
-
const id = registerSchema(schema, registry, {
|
|
1489
|
-
id: options?.id
|
|
1490
|
-
});
|
|
1491
|
-
if (id !== void 0) {
|
|
1492
|
-
return {
|
|
1493
|
-
kind: "ref",
|
|
1494
|
-
ref: {
|
|
1495
|
-
$ref: `${COMPONENTS_SCHEMAS_PREFIX}${id}`
|
|
1496
|
-
}
|
|
1497
|
-
};
|
|
1498
|
-
}
|
|
1499
|
-
if (options?.deferAnonInline === true) {
|
|
1500
|
-
const anonId = resolveAnonId(schema, ANON_BODY_PREFIX);
|
|
1501
|
-
registerSchema(schema, registry, {
|
|
1502
|
-
id: anonId,
|
|
1503
|
-
anonymous: true
|
|
1504
|
-
});
|
|
1505
|
-
return {
|
|
1506
|
-
kind: "ref",
|
|
1507
|
-
ref: {
|
|
1508
|
-
$ref: `${COMPONENTS_SCHEMAS_PREFIX}${anonId}`
|
|
1509
|
-
}
|
|
1510
|
-
};
|
|
1511
|
-
}
|
|
1512
|
-
for (const [child, childId] of discoverDependents(schema)) {
|
|
1513
|
-
registry.register(child, childId);
|
|
1514
|
-
}
|
|
1515
|
-
const { schema: body } = toOpenApi(schema, {
|
|
1516
|
-
io: "input",
|
|
1517
|
-
registry
|
|
1518
|
-
});
|
|
1519
|
-
return {
|
|
1520
|
-
kind: "inline",
|
|
1521
|
-
schema: body
|
|
1522
|
-
};
|
|
1523
|
-
}
|
|
1524
|
-
__name(resolveSchemaRef, "resolveSchemaRef");
|
|
1525
|
-
|
|
1526
|
-
// src/decorators/internal/zod-param-expand.ts
|
|
1527
|
-
var isZodObject = /* @__PURE__ */ __name((schema) => schema._zod.def.type === "object", "isZodObject");
|
|
1528
|
-
var expandObjectSchema = /* @__PURE__ */ __name((schema, options) => {
|
|
1529
|
-
if (!isZodObject(schema)) {
|
|
1530
|
-
throw new ZodNestError(`${options.decoratorName} requires a \`z.object({...})\` schema (got \`${schema._zod.def.type}\`). Each property of the object becomes one OpenAPI parameter. For non-object body shapes (intersections, unions, primitives), use \`@ZodBody\` instead.`);
|
|
1531
|
-
}
|
|
1532
|
-
const registry = options.registry ?? defaultRegistry;
|
|
1533
|
-
registerSchema(schema, registry, {
|
|
1534
|
-
id: options.id
|
|
1535
|
-
});
|
|
1536
|
-
const result = [];
|
|
1537
|
-
for (const [name, propSchema] of Object.entries(schema.shape)) {
|
|
1538
|
-
const resolution = resolveSchemaRef(propSchema, {
|
|
1539
|
-
registry
|
|
1540
|
-
});
|
|
1541
|
-
const required = options.forceRequired === true || !isOptionalProp(propSchema);
|
|
1542
|
-
result.push({
|
|
1543
|
-
name,
|
|
1544
|
-
required,
|
|
1545
|
-
resolution
|
|
1546
|
-
});
|
|
1547
|
-
}
|
|
1548
|
-
return result;
|
|
1549
|
-
}, "expandObjectSchema");
|
|
1550
|
-
var paramSchemaBody = /* @__PURE__ */ __name((resolution) => resolution.kind === "ref" ? resolution.ref : resolution.schema, "paramSchemaBody");
|
|
1551
|
-
|
|
1552
|
-
// src/decorators/internal/flatten-intersection.ts
|
|
1553
|
-
var intersectionArms = /* @__PURE__ */ __name((schema) => {
|
|
1554
|
-
if (schema._zod.def.type !== "intersection") {
|
|
1555
|
-
return null;
|
|
1556
|
-
}
|
|
1557
|
-
const def = schema._zod.def;
|
|
1558
|
-
return {
|
|
1559
|
-
left: def.left,
|
|
1560
|
-
right: def.right
|
|
1561
|
-
};
|
|
1562
|
-
}, "intersectionArms");
|
|
1563
|
-
var unionOptions = /* @__PURE__ */ __name((schema) => {
|
|
1564
|
-
if (schema._zod.def.type !== "union") {
|
|
1565
|
-
return null;
|
|
1566
|
-
}
|
|
1567
|
-
const def = schema._zod.def;
|
|
1568
|
-
return def.options;
|
|
1569
|
-
}, "unionOptions");
|
|
1570
|
-
var collectObjectShapes = /* @__PURE__ */ __name((schema) => {
|
|
1571
|
-
if (isZodObject(schema)) {
|
|
1572
|
-
return {
|
|
1573
|
-
shapes: [
|
|
1574
|
-
schema.shape
|
|
1575
|
-
],
|
|
1576
|
-
unionCrossed: false
|
|
1577
|
-
};
|
|
1578
|
-
}
|
|
1579
|
-
const options = unionOptions(schema);
|
|
1580
|
-
if (options !== null) {
|
|
1581
|
-
const allShapes = [];
|
|
1582
|
-
for (const variant of options) {
|
|
1583
|
-
const variantResult = collectObjectShapes(variant);
|
|
1584
|
-
if (variantResult === null) {
|
|
1585
|
-
return null;
|
|
1586
|
-
}
|
|
1587
|
-
allShapes.push(...variantResult.shapes);
|
|
1588
|
-
}
|
|
1589
|
-
return {
|
|
1590
|
-
shapes: allShapes,
|
|
1591
|
-
unionCrossed: true
|
|
1592
|
-
};
|
|
1593
|
-
}
|
|
1594
|
-
const arms = intersectionArms(schema);
|
|
1595
|
-
if (arms === null) {
|
|
1596
|
-
return null;
|
|
1597
|
-
}
|
|
1598
|
-
const left = collectObjectShapes(arms.left);
|
|
1599
|
-
if (left === null) {
|
|
1600
|
-
return null;
|
|
1601
|
-
}
|
|
1602
|
-
const right = collectObjectShapes(arms.right);
|
|
1603
|
-
if (right === null) {
|
|
1604
|
-
return null;
|
|
1605
|
-
}
|
|
1606
|
-
return {
|
|
1607
|
-
shapes: [
|
|
1608
|
-
...left.shapes,
|
|
1609
|
-
...right.shapes
|
|
1610
|
-
],
|
|
1611
|
-
unionCrossed: left.unionCrossed || right.unionCrossed
|
|
1612
|
-
};
|
|
1613
|
-
}, "collectObjectShapes");
|
|
1614
|
-
var flattenObjectIntersection = /* @__PURE__ */ __name((schema, registry, decoratorName) => {
|
|
1615
|
-
const collected = collectObjectShapes(schema);
|
|
1616
|
-
if (collected === null) {
|
|
1617
|
-
throw new ZodNestError(`${decoratorName} \`flatten: true\` requires every leaf of the schema to be a \`z.object({...})\` \u2014 intersections and unions of objects are supported, but primitives, tuples, transforms, and other non-object leaves are not. Drop \`flatten: true\` to emit the original schema with its composition intact.`);
|
|
1618
|
-
}
|
|
1619
|
-
const mergedShape = {};
|
|
1620
|
-
for (const shape of collected.shapes) {
|
|
1621
|
-
Object.assign(mergedShape, shape);
|
|
1622
|
-
}
|
|
1623
|
-
if (collected.unionCrossed) {
|
|
1624
|
-
for (const key of Object.keys(mergedShape)) {
|
|
1625
|
-
const value = mergedShape[key];
|
|
1626
|
-
if (value !== void 0) {
|
|
1627
|
-
mergedShape[key] = value.optional();
|
|
1628
|
-
}
|
|
1629
|
-
}
|
|
1630
|
-
}
|
|
1631
|
-
const merged = zod.z.object(mergedShape);
|
|
1632
|
-
registerSchema(schema, registry);
|
|
1633
|
-
for (const [child, childId] of discoverDependents(schema)) {
|
|
1634
|
-
registry.register(child, childId);
|
|
1635
|
-
}
|
|
1636
|
-
const { schema: body } = toOpenApi(merged, {
|
|
1637
|
-
io: "input",
|
|
1638
|
-
registry
|
|
1639
|
-
});
|
|
1640
|
-
return body;
|
|
1641
|
-
}, "flattenObjectIntersection");
|
|
1642
|
-
|
|
1643
|
-
// src/decorators/zod-body.decorator.ts
|
|
1644
|
-
var ZodBody = /* @__PURE__ */ __name((schema, options) => {
|
|
765
|
+
var ZodBody = /* @__PURE__ */ chunk4RXGLSPP_js.__name((schema, options) => {
|
|
1645
766
|
const apiBodySchema = resolveBodySchema(schema, options);
|
|
1646
767
|
return swagger.ApiBody({
|
|
1647
768
|
schema: apiBodySchema,
|
|
@@ -1651,11 +772,11 @@ var ZodBody = /* @__PURE__ */ __name((schema, options) => {
|
|
|
1651
772
|
required: options?.required ?? true
|
|
1652
773
|
});
|
|
1653
774
|
}, "ZodBody");
|
|
1654
|
-
var resolveBodySchema = /* @__PURE__ */ __name((schema, options) => {
|
|
775
|
+
var resolveBodySchema = /* @__PURE__ */ chunk4RXGLSPP_js.__name((schema, options) => {
|
|
1655
776
|
if (options?.flatten === true) {
|
|
1656
|
-
return flattenObjectIntersection(schema, options.registry ?? defaultRegistry, "@ZodBody");
|
|
777
|
+
return chunkFKXVNCDD_js.flattenObjectIntersection(schema, options.registry ?? chunkFKXVNCDD_js.defaultRegistry, "@ZodBody");
|
|
1657
778
|
}
|
|
1658
|
-
return resolveSchemaRef(schema, {
|
|
779
|
+
return chunkFKXVNCDD_js.resolveSchemaRef(schema, {
|
|
1659
780
|
id: options?.id,
|
|
1660
781
|
registry: options?.registry,
|
|
1661
782
|
deferAnonInline: true
|
|
@@ -1664,7 +785,7 @@ var resolveBodySchema = /* @__PURE__ */ __name((schema, options) => {
|
|
|
1664
785
|
|
|
1665
786
|
// src/decorators/internal/query-marker.ts
|
|
1666
787
|
var API_PARAMETERS_METADATA_KEY = "swagger/apiParameters";
|
|
1667
|
-
var appendQueryMarker = /* @__PURE__ */ __name((dtoId, ref) => (_target, _propertyKey, descriptor) => {
|
|
788
|
+
var appendQueryMarker = /* @__PURE__ */ chunk4RXGLSPP_js.__name((dtoId, ref) => (_target, _propertyKey, descriptor) => {
|
|
1668
789
|
const method = descriptor.value;
|
|
1669
790
|
if (typeof method !== "function") {
|
|
1670
791
|
return descriptor;
|
|
@@ -1689,28 +810,28 @@ var appendQueryMarker = /* @__PURE__ */ __name((dtoId, ref) => (_target, _proper
|
|
|
1689
810
|
}, "appendQueryMarker");
|
|
1690
811
|
|
|
1691
812
|
// src/decorators/zod-query.decorator.ts
|
|
1692
|
-
var ZodQuery = /* @__PURE__ */ __name((schema, options) => {
|
|
1693
|
-
if (!isZodObject(schema)) {
|
|
1694
|
-
throw new ZodNestError(`@ZodQuery requires a \`z.object({...})\` schema (got \`${schema._zod.def.type}\`). Each property of the object becomes one OpenAPI parameter. For non-object body shapes (intersections, unions, primitives), use \`@ZodBody\` instead.`);
|
|
813
|
+
var ZodQuery = /* @__PURE__ */ chunk4RXGLSPP_js.__name((schema, options) => {
|
|
814
|
+
if (!chunkFKXVNCDD_js.isZodObject(schema)) {
|
|
815
|
+
throw new chunkFKXVNCDD_js.ZodNestError(`@ZodQuery requires a \`z.object({...})\` schema (got \`${schema._zod.def.type}\`). Each property of the object becomes one OpenAPI parameter. For non-object body shapes (intersections, unions, primitives), use \`@ZodBody\` instead.`);
|
|
1695
816
|
}
|
|
1696
|
-
const registry = options?.registry ?? defaultRegistry;
|
|
1697
|
-
const id = registerSchema(schema, registry, {
|
|
817
|
+
const registry = options?.registry ?? chunkFKXVNCDD_js.defaultRegistry;
|
|
818
|
+
const id = chunkFKXVNCDD_js.registerSchema(schema, registry, {
|
|
1698
819
|
id: options?.id
|
|
1699
820
|
});
|
|
1700
821
|
if (id !== void 0) {
|
|
1701
822
|
return appendQueryMarker(id, options?.ref);
|
|
1702
823
|
}
|
|
1703
824
|
if (options?.ref === true) {
|
|
1704
|
-
throw new ZodNestError(`@ZodQuery({ ref: true }) requires a named schema \u2014 there is no component to \`$ref\`. Name the schema via \`.meta({ id: 'Foo' })\` or pass the \`id\` option, or drop \`ref\` to expand per property.`);
|
|
825
|
+
throw new chunkFKXVNCDD_js.ZodNestError(`@ZodQuery({ ref: true }) requires a named schema \u2014 there is no component to \`$ref\`. Name the schema via \`.meta({ id: 'Foo' })\` or pass the \`id\` option, or drop \`ref\` to expand per property.`);
|
|
1705
826
|
}
|
|
1706
|
-
const expanded = expandObjectSchema(schema, {
|
|
827
|
+
const expanded = chunkFKXVNCDD_js.expandObjectSchema(schema, {
|
|
1707
828
|
id: options?.id,
|
|
1708
829
|
registry,
|
|
1709
830
|
decoratorName: "@ZodQuery"
|
|
1710
831
|
});
|
|
1711
832
|
return common.applyDecorators(...expanded.map(({ name, required, resolution }) => swagger.ApiQuery({
|
|
1712
833
|
name,
|
|
1713
|
-
schema: paramSchemaBody(resolution),
|
|
834
|
+
schema: chunkFKXVNCDD_js.paramSchemaBody(resolution),
|
|
1714
835
|
required
|
|
1715
836
|
})));
|
|
1716
837
|
}, "ZodQuery");
|
|
@@ -1719,8 +840,8 @@ var ZodQuery = /* @__PURE__ */ __name((schema, options) => {
|
|
|
1719
840
|
var API_PARAMETERS_KEY = "swagger/apiParameters";
|
|
1720
841
|
|
|
1721
842
|
// src/decorators/zod-headers.decorator.ts
|
|
1722
|
-
var ZodHeaders = /* @__PURE__ */ __name((schema, options) => {
|
|
1723
|
-
const expanded = expandObjectSchema(schema, {
|
|
843
|
+
var ZodHeaders = /* @__PURE__ */ chunk4RXGLSPP_js.__name((schema, options) => {
|
|
844
|
+
const expanded = chunkFKXVNCDD_js.expandObjectSchema(schema, {
|
|
1724
845
|
id: options?.id,
|
|
1725
846
|
registry: options?.registry,
|
|
1726
847
|
decoratorName: "@ZodHeaders"
|
|
@@ -1729,7 +850,7 @@ var ZodHeaders = /* @__PURE__ */ __name((schema, options) => {
|
|
|
1729
850
|
name,
|
|
1730
851
|
in: "header",
|
|
1731
852
|
required,
|
|
1732
|
-
schema: paramSchemaBody(resolution)
|
|
853
|
+
schema: chunkFKXVNCDD_js.paramSchemaBody(resolution)
|
|
1733
854
|
}));
|
|
1734
855
|
return (_target, _propertyKey, descriptor) => {
|
|
1735
856
|
const handler = descriptor.value;
|
|
@@ -1745,8 +866,8 @@ var ZodHeaders = /* @__PURE__ */ __name((schema, options) => {
|
|
|
1745
866
|
}, "ZodHeaders");
|
|
1746
867
|
|
|
1747
868
|
// src/decorators/zod-cookies.decorator.ts
|
|
1748
|
-
var ZodCookies = /* @__PURE__ */ __name((schema, options) => {
|
|
1749
|
-
const expanded = expandObjectSchema(schema, {
|
|
869
|
+
var ZodCookies = /* @__PURE__ */ chunk4RXGLSPP_js.__name((schema, options) => {
|
|
870
|
+
const expanded = chunkFKXVNCDD_js.expandObjectSchema(schema, {
|
|
1750
871
|
id: options?.id,
|
|
1751
872
|
registry: options?.registry,
|
|
1752
873
|
decoratorName: "@ZodCookies"
|
|
@@ -1755,7 +876,7 @@ var ZodCookies = /* @__PURE__ */ __name((schema, options) => {
|
|
|
1755
876
|
name,
|
|
1756
877
|
in: "cookie",
|
|
1757
878
|
required,
|
|
1758
|
-
schema: paramSchemaBody(resolution)
|
|
879
|
+
schema: chunkFKXVNCDD_js.paramSchemaBody(resolution)
|
|
1759
880
|
}));
|
|
1760
881
|
return (_target, _propertyKey, descriptor) => {
|
|
1761
882
|
const handler = descriptor.value;
|
|
@@ -1782,30 +903,30 @@ function _ts_decorate2(decorators, target, key, desc) {
|
|
|
1782
903
|
}
|
|
1783
904
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1784
905
|
}
|
|
1785
|
-
__name(_ts_decorate2, "_ts_decorate");
|
|
906
|
+
chunk4RXGLSPP_js.__name(_ts_decorate2, "_ts_decorate");
|
|
1786
907
|
function _ts_metadata2(metadataKey, metadataValue) {
|
|
1787
908
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
1788
909
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
1789
910
|
}
|
|
1790
911
|
}
|
|
1791
|
-
__name(_ts_metadata2, "_ts_metadata");
|
|
912
|
+
chunk4RXGLSPP_js.__name(_ts_metadata2, "_ts_metadata");
|
|
1792
913
|
function _ts_param2(paramIndex, decorator) {
|
|
1793
914
|
return function(target, key) {
|
|
1794
915
|
decorator(target, key, paramIndex);
|
|
1795
916
|
};
|
|
1796
917
|
}
|
|
1797
|
-
__name(_ts_param2, "_ts_param");
|
|
1798
|
-
var defaultSerializationFactory = /* @__PURE__ */ __name((err, ctx) => new ZodSerializationException(err, ctx), "defaultSerializationFactory");
|
|
1799
|
-
var formatDtoLabel = /* @__PURE__ */ __name((variant) => {
|
|
918
|
+
chunk4RXGLSPP_js.__name(_ts_param2, "_ts_param");
|
|
919
|
+
var defaultSerializationFactory = /* @__PURE__ */ chunk4RXGLSPP_js.__name((err, ctx) => new ZodSerializationException(err, ctx), "defaultSerializationFactory");
|
|
920
|
+
var formatDtoLabel = /* @__PURE__ */ chunk4RXGLSPP_js.__name((variant) => {
|
|
1800
921
|
if (variant.kind === "single") {
|
|
1801
922
|
return variant.dto.id;
|
|
1802
923
|
}
|
|
1803
924
|
const dtos = variant.dto;
|
|
1804
925
|
return `[${dtos.map((d) => d.id).join(", ")}]`;
|
|
1805
926
|
}, "formatDtoLabel");
|
|
1806
|
-
var formatHandlerLabel = /* @__PURE__ */ __name((context) => `${context.getClass().name}.${context.getHandler().name}`, "formatHandlerLabel");
|
|
1807
|
-
var matchesWildcard = /* @__PURE__ */ __name((wildcard, status) => wildcard.charCodeAt(0) - 48 === Math.floor(status / 100), "matchesWildcard");
|
|
1808
|
-
var selectVariant = /* @__PURE__ */ __name((variants, status, handler) => {
|
|
927
|
+
var formatHandlerLabel = /* @__PURE__ */ chunk4RXGLSPP_js.__name((context) => `${context.getClass().name}.${context.getHandler().name}`, "formatHandlerLabel");
|
|
928
|
+
var matchesWildcard = /* @__PURE__ */ chunk4RXGLSPP_js.__name((wildcard, status) => wildcard.charCodeAt(0) - 48 === Math.floor(status / 100), "matchesWildcard");
|
|
929
|
+
var selectVariant = /* @__PURE__ */ chunk4RXGLSPP_js.__name((variants, status, handler) => {
|
|
1809
930
|
for (const variant of variants) {
|
|
1810
931
|
const effective = resolveEffectiveStatus(variant, handler);
|
|
1811
932
|
if (typeof effective === "number" && effective === status) {
|
|
@@ -1822,7 +943,7 @@ var selectVariant = /* @__PURE__ */ __name((variants, status, handler) => {
|
|
|
1822
943
|
}, "selectVariant");
|
|
1823
944
|
exports.ZodSerializerInterceptor = class ZodSerializerInterceptor {
|
|
1824
945
|
static {
|
|
1825
|
-
__name(this, "ZodSerializerInterceptor");
|
|
946
|
+
chunk4RXGLSPP_js.__name(this, "ZodSerializerInterceptor");
|
|
1826
947
|
}
|
|
1827
948
|
reflector;
|
|
1828
949
|
logOutputFailure;
|
|
@@ -1888,7 +1009,7 @@ exports.ZodSerializerInterceptor = _ts_decorate2([
|
|
|
1888
1009
|
], exports.ZodSerializerInterceptor);
|
|
1889
1010
|
var ZodNestModule = class _ZodNestModule {
|
|
1890
1011
|
static {
|
|
1891
|
-
__name(this, "ZodNestModule");
|
|
1012
|
+
chunk4RXGLSPP_js.__name(this, "ZodNestModule");
|
|
1892
1013
|
}
|
|
1893
1014
|
static forRoot(options) {
|
|
1894
1015
|
const normalized = normalizeZodNestOptions(options);
|
|
@@ -1915,16 +1036,16 @@ var ZodNestModule = class _ZodNestModule {
|
|
|
1915
1036
|
};
|
|
1916
1037
|
}
|
|
1917
1038
|
};
|
|
1918
|
-
var URI = /* @__PURE__ */ __name((id) => `#/components/schemas/${id}`, "URI");
|
|
1919
|
-
var bulkEmit = /* @__PURE__ */ __name((opts) => {
|
|
1039
|
+
var URI = /* @__PURE__ */ chunk4RXGLSPP_js.__name((id) => `#/components/schemas/${id}`, "URI");
|
|
1040
|
+
var bulkEmit = /* @__PURE__ */ chunk4RXGLSPP_js.__name((opts) => {
|
|
1920
1041
|
const knownIds = new Set(opts.registry.ids());
|
|
1921
1042
|
return {
|
|
1922
1043
|
inputSchemas: runPass(opts, "input", knownIds),
|
|
1923
1044
|
outputSchemas: runPass(opts, "output", knownIds)
|
|
1924
1045
|
};
|
|
1925
1046
|
}, "bulkEmit");
|
|
1926
|
-
var runPass = /* @__PURE__ */ __name((opts, io, knownIds) => {
|
|
1927
|
-
const built = buildToJsonSchemaOptions({
|
|
1047
|
+
var runPass = /* @__PURE__ */ chunk4RXGLSPP_js.__name((opts, io, knownIds) => {
|
|
1048
|
+
const built = chunkFKXVNCDD_js.buildToJsonSchemaOptions({
|
|
1928
1049
|
registry: opts.registry,
|
|
1929
1050
|
io,
|
|
1930
1051
|
override: opts.override,
|
|
@@ -1954,7 +1075,7 @@ var HTTP_METHODS = [
|
|
|
1954
1075
|
"patch",
|
|
1955
1076
|
"trace"
|
|
1956
1077
|
];
|
|
1957
|
-
var forEachOperation = /* @__PURE__ */ __name((doc, fn) => {
|
|
1078
|
+
var forEachOperation = /* @__PURE__ */ chunk4RXGLSPP_js.__name((doc, fn) => {
|
|
1958
1079
|
const paths = doc.paths;
|
|
1959
1080
|
if (paths === null || typeof paths !== "object") {
|
|
1960
1081
|
return;
|
|
@@ -1975,7 +1096,7 @@ var forEachOperation = /* @__PURE__ */ __name((doc, fn) => {
|
|
|
1975
1096
|
}, "forEachOperation");
|
|
1976
1097
|
|
|
1977
1098
|
// src/document/walk-refs.ts
|
|
1978
|
-
var walkRefs = /* @__PURE__ */ __name((node, visit) => {
|
|
1099
|
+
var walkRefs = /* @__PURE__ */ chunk4RXGLSPP_js.__name((node, visit) => {
|
|
1979
1100
|
if (node === null || typeof node !== "object") {
|
|
1980
1101
|
return;
|
|
1981
1102
|
}
|
|
@@ -2000,8 +1121,8 @@ var walkRefs = /* @__PURE__ */ __name((node, visit) => {
|
|
|
2000
1121
|
}, "walkRefs");
|
|
2001
1122
|
|
|
2002
1123
|
// src/document/collect-usage.ts
|
|
2003
|
-
var isPlainRecord2 = /* @__PURE__ */ __name((value) => value !== null && typeof value === "object" && !Array.isArray(value), "isPlainRecord");
|
|
2004
|
-
var collectUsage = /* @__PURE__ */ __name((doc, registry) => {
|
|
1124
|
+
var isPlainRecord2 = /* @__PURE__ */ chunk4RXGLSPP_js.__name((value) => value !== null && typeof value === "object" && !Array.isArray(value), "isPlainRecord");
|
|
1125
|
+
var collectUsage = /* @__PURE__ */ chunk4RXGLSPP_js.__name((doc, registry) => {
|
|
2005
1126
|
const classToDtoId = buildClassToDtoIdMap(doc);
|
|
2006
1127
|
const knownIds = new Set(registry.ids());
|
|
2007
1128
|
const inputExposedIds = collectInputExposedIds(doc, classToDtoId, knownIds);
|
|
@@ -2012,7 +1133,7 @@ var collectUsage = /* @__PURE__ */ __name((doc, registry) => {
|
|
|
2012
1133
|
classToDtoId
|
|
2013
1134
|
};
|
|
2014
1135
|
}, "collectUsage");
|
|
2015
|
-
var buildClassToDtoIdMap = /* @__PURE__ */ __name((doc) => {
|
|
1136
|
+
var buildClassToDtoIdMap = /* @__PURE__ */ chunk4RXGLSPP_js.__name((doc) => {
|
|
2016
1137
|
const map = /* @__PURE__ */ new Map();
|
|
2017
1138
|
const schemas = doc.components?.schemas ?? {};
|
|
2018
1139
|
for (const [className, schema] of Object.entries(schemas)) {
|
|
@@ -2024,14 +1145,14 @@ var buildClassToDtoIdMap = /* @__PURE__ */ __name((doc) => {
|
|
|
2024
1145
|
}
|
|
2025
1146
|
return map;
|
|
2026
1147
|
}, "buildClassToDtoIdMap");
|
|
2027
|
-
var readMarker = /* @__PURE__ */ __name((schema) => {
|
|
1148
|
+
var readMarker = /* @__PURE__ */ chunk4RXGLSPP_js.__name((schema) => {
|
|
2028
1149
|
if (!isPlainRecord2(schema)) {
|
|
2029
1150
|
return void 0;
|
|
2030
1151
|
}
|
|
2031
1152
|
if (!isPlainRecord2(schema.properties)) {
|
|
2032
1153
|
return void 0;
|
|
2033
1154
|
}
|
|
2034
|
-
const marker = schema.properties[ZOD_NEST_DTO_EXTENSION];
|
|
1155
|
+
const marker = schema.properties[chunkFKXVNCDD_js.ZOD_NEST_DTO_EXTENSION];
|
|
2035
1156
|
if (!isZodDtoMarker(marker)) {
|
|
2036
1157
|
return void 0;
|
|
2037
1158
|
}
|
|
@@ -2039,7 +1160,7 @@ var readMarker = /* @__PURE__ */ __name((schema) => {
|
|
|
2039
1160
|
dtoId: marker.dtoId
|
|
2040
1161
|
};
|
|
2041
1162
|
}, "readMarker");
|
|
2042
|
-
var collectInputExposedIds = /* @__PURE__ */ __name((doc, classToDtoId, knownIds) => {
|
|
1163
|
+
var collectInputExposedIds = /* @__PURE__ */ chunk4RXGLSPP_js.__name((doc, classToDtoId, knownIds) => {
|
|
2043
1164
|
const ids = /* @__PURE__ */ new Set();
|
|
2044
1165
|
const paths = doc.paths ?? {};
|
|
2045
1166
|
for (const pathItem of Object.values(paths)) {
|
|
@@ -2052,7 +1173,7 @@ var collectInputExposedIds = /* @__PURE__ */ __name((doc, classToDtoId, knownIds
|
|
|
2052
1173
|
}
|
|
2053
1174
|
return ids;
|
|
2054
1175
|
}, "collectInputExposedIds");
|
|
2055
|
-
var operationsOf = /* @__PURE__ */ __name((pathItem) => {
|
|
1176
|
+
var operationsOf = /* @__PURE__ */ chunk4RXGLSPP_js.__name((pathItem) => {
|
|
2056
1177
|
const out = [];
|
|
2057
1178
|
for (const method of HTTP_METHODS) {
|
|
2058
1179
|
const op = pathItem[method];
|
|
@@ -2062,7 +1183,7 @@ var operationsOf = /* @__PURE__ */ __name((pathItem) => {
|
|
|
2062
1183
|
}
|
|
2063
1184
|
return out;
|
|
2064
1185
|
}, "operationsOf");
|
|
2065
|
-
var collectRefsFromOperation = /* @__PURE__ */ __name((operation, classToDtoId, knownIds, ids) => {
|
|
1186
|
+
var collectRefsFromOperation = /* @__PURE__ */ chunk4RXGLSPP_js.__name((operation, classToDtoId, knownIds, ids) => {
|
|
2066
1187
|
if (isPlainRecord2(operation.requestBody)) {
|
|
2067
1188
|
collectRefsFromContent(operation.requestBody.content, classToDtoId, knownIds, ids);
|
|
2068
1189
|
}
|
|
@@ -2077,7 +1198,7 @@ var collectRefsFromOperation = /* @__PURE__ */ __name((operation, classToDtoId,
|
|
|
2077
1198
|
}
|
|
2078
1199
|
}
|
|
2079
1200
|
}, "collectRefsFromOperation");
|
|
2080
|
-
var collectIdFromMarkerParam = /* @__PURE__ */ __name((param, ids) => {
|
|
1201
|
+
var collectIdFromMarkerParam = /* @__PURE__ */ chunk4RXGLSPP_js.__name((param, ids) => {
|
|
2081
1202
|
if (param.__zodNestDto !== true) {
|
|
2082
1203
|
return;
|
|
2083
1204
|
}
|
|
@@ -2087,7 +1208,7 @@ var collectIdFromMarkerParam = /* @__PURE__ */ __name((param, ids) => {
|
|
|
2087
1208
|
}
|
|
2088
1209
|
ids.add(dtoId);
|
|
2089
1210
|
}, "collectIdFromMarkerParam");
|
|
2090
|
-
var collectRefsFromContent = /* @__PURE__ */ __name((content, classToDtoId, knownIds, ids) => {
|
|
1211
|
+
var collectRefsFromContent = /* @__PURE__ */ chunk4RXGLSPP_js.__name((content, classToDtoId, knownIds, ids) => {
|
|
2091
1212
|
if (!isPlainRecord2(content)) {
|
|
2092
1213
|
return;
|
|
2093
1214
|
}
|
|
@@ -2098,15 +1219,15 @@ var collectRefsFromContent = /* @__PURE__ */ __name((content, classToDtoId, know
|
|
|
2098
1219
|
collectRefFromSchema(mediaType.schema, classToDtoId, knownIds, ids);
|
|
2099
1220
|
}
|
|
2100
1221
|
}, "collectRefsFromContent");
|
|
2101
|
-
var collectRefFromSchema = /* @__PURE__ */ __name((schema, classToDtoId, knownIds, ids) => {
|
|
1222
|
+
var collectRefFromSchema = /* @__PURE__ */ chunk4RXGLSPP_js.__name((schema, classToDtoId, knownIds, ids) => {
|
|
2102
1223
|
if (!isPlainRecord2(schema)) {
|
|
2103
1224
|
return;
|
|
2104
1225
|
}
|
|
2105
1226
|
walkRefs(schema, (ref) => {
|
|
2106
|
-
if (!ref.startsWith(COMPONENTS_SCHEMAS_PREFIX)) {
|
|
1227
|
+
if (!ref.startsWith(chunkFKXVNCDD_js.COMPONENTS_SCHEMAS_PREFIX)) {
|
|
2107
1228
|
return void 0;
|
|
2108
1229
|
}
|
|
2109
|
-
const className = ref.slice(COMPONENTS_SCHEMAS_PREFIX.length);
|
|
1230
|
+
const className = ref.slice(chunkFKXVNCDD_js.COMPONENTS_SCHEMAS_PREFIX.length);
|
|
2110
1231
|
const renamed = classToDtoId.get(className);
|
|
2111
1232
|
if (renamed !== void 0) {
|
|
2112
1233
|
ids.add(renamed);
|
|
@@ -2116,7 +1237,7 @@ var collectRefFromSchema = /* @__PURE__ */ __name((schema, classToDtoId, knownId
|
|
|
2116
1237
|
return void 0;
|
|
2117
1238
|
});
|
|
2118
1239
|
}, "collectRefFromSchema");
|
|
2119
|
-
var collectOutputExposedIds = /* @__PURE__ */ __name((doc, classToDtoId, knownIds) => {
|
|
1240
|
+
var collectOutputExposedIds = /* @__PURE__ */ chunk4RXGLSPP_js.__name((doc, classToDtoId, knownIds) => {
|
|
2120
1241
|
const ids = /* @__PURE__ */ new Set();
|
|
2121
1242
|
const paths = doc.paths ?? {};
|
|
2122
1243
|
for (const pathItem of Object.values(paths)) {
|
|
@@ -2129,7 +1250,7 @@ var collectOutputExposedIds = /* @__PURE__ */ __name((doc, classToDtoId, knownId
|
|
|
2129
1250
|
}
|
|
2130
1251
|
return ids;
|
|
2131
1252
|
}, "collectOutputExposedIds");
|
|
2132
|
-
var collectRefsFromResponses = /* @__PURE__ */ __name((responses, classToDtoId, knownIds, ids) => {
|
|
1253
|
+
var collectRefsFromResponses = /* @__PURE__ */ chunk4RXGLSPP_js.__name((responses, classToDtoId, knownIds, ids) => {
|
|
2133
1254
|
if (!isPlainRecord2(responses)) {
|
|
2134
1255
|
return;
|
|
2135
1256
|
}
|
|
@@ -2142,9 +1263,9 @@ var collectRefsFromResponses = /* @__PURE__ */ __name((responses, classToDtoId,
|
|
|
2142
1263
|
}, "collectRefsFromResponses");
|
|
2143
1264
|
|
|
2144
1265
|
// src/document/errors.ts
|
|
2145
|
-
var ZodNestDocumentError = class extends ZodNestError {
|
|
1266
|
+
var ZodNestDocumentError = class extends chunkFKXVNCDD_js.ZodNestError {
|
|
2146
1267
|
static {
|
|
2147
|
-
__name(this, "ZodNestDocumentError");
|
|
1268
|
+
chunk4RXGLSPP_js.__name(this, "ZodNestDocumentError");
|
|
2148
1269
|
}
|
|
2149
1270
|
code;
|
|
2150
1271
|
details;
|
|
@@ -2157,15 +1278,15 @@ var ZodNestDocumentError = class extends ZodNestError {
|
|
|
2157
1278
|
};
|
|
2158
1279
|
|
|
2159
1280
|
// src/document/dangling-refs.ts
|
|
2160
|
-
var assertNoDanglingRefs = /* @__PURE__ */ __name((params) => {
|
|
1281
|
+
var assertNoDanglingRefs = /* @__PURE__ */ chunk4RXGLSPP_js.__name((params) => {
|
|
2161
1282
|
const { doc, collected } = params;
|
|
2162
1283
|
const schemas = doc.components?.schemas ?? {};
|
|
2163
1284
|
const dangling = [];
|
|
2164
1285
|
walkRefs(doc, (ref) => {
|
|
2165
|
-
if (!ref.startsWith(COMPONENTS_SCHEMAS_PREFIX)) {
|
|
1286
|
+
if (!ref.startsWith(chunkFKXVNCDD_js.COMPONENTS_SCHEMAS_PREFIX)) {
|
|
2166
1287
|
return void 0;
|
|
2167
1288
|
}
|
|
2168
|
-
const target = ref.slice(COMPONENTS_SCHEMAS_PREFIX.length);
|
|
1289
|
+
const target = ref.slice(chunkFKXVNCDD_js.COMPONENTS_SCHEMAS_PREFIX.length);
|
|
2169
1290
|
if (!(target in schemas)) {
|
|
2170
1291
|
dangling.push(ref);
|
|
2171
1292
|
}
|
|
@@ -2180,8 +1301,8 @@ ${lines.join("\n")}`, {
|
|
|
2180
1301
|
dangling
|
|
2181
1302
|
});
|
|
2182
1303
|
}, "assertNoDanglingRefs");
|
|
2183
|
-
var hintFor = /* @__PURE__ */ __name((ref, collected) => {
|
|
2184
|
-
const id = ref.slice(COMPONENTS_SCHEMAS_PREFIX.length);
|
|
1304
|
+
var hintFor = /* @__PURE__ */ chunk4RXGLSPP_js.__name((ref, collected) => {
|
|
1305
|
+
const id = ref.slice(chunkFKXVNCDD_js.COMPONENTS_SCHEMAS_PREFIX.length);
|
|
2185
1306
|
const usedInput = collected.inputExposedIds.has(id);
|
|
2186
1307
|
const usedOutput = collected.outputExposedIds.has(id);
|
|
2187
1308
|
if (usedInput && usedOutput) {
|
|
@@ -2197,8 +1318,8 @@ var hintFor = /* @__PURE__ */ __name((ref, collected) => {
|
|
|
2197
1318
|
}, "hintFor");
|
|
2198
1319
|
|
|
2199
1320
|
// src/document/expand-param-markers.ts
|
|
2200
|
-
var isPlainRecord3 = /* @__PURE__ */ __name((value) => value !== null && typeof value === "object" && !Array.isArray(value), "isPlainRecord");
|
|
2201
|
-
var expandParamMarkers = /* @__PURE__ */ __name((params) => {
|
|
1321
|
+
var isPlainRecord3 = /* @__PURE__ */ chunk4RXGLSPP_js.__name((value) => value !== null && typeof value === "object" && !Array.isArray(value), "isPlainRecord");
|
|
1322
|
+
var expandParamMarkers = /* @__PURE__ */ chunk4RXGLSPP_js.__name((params) => {
|
|
2202
1323
|
const { doc, inputSchemas, outputSchemas } = params;
|
|
2203
1324
|
const queryParamStyle = params.queryParamStyle ?? "expand";
|
|
2204
1325
|
const schemas = doc.components?.schemas;
|
|
@@ -2224,7 +1345,7 @@ var expandParamMarkers = /* @__PURE__ */ __name((params) => {
|
|
|
2224
1345
|
pruneOrphanObjectSchema(doc);
|
|
2225
1346
|
}
|
|
2226
1347
|
}, "expandParamMarkers");
|
|
2227
|
-
var expandParameterList = /* @__PURE__ */ __name((parameters, context) => {
|
|
1348
|
+
var expandParameterList = /* @__PURE__ */ chunk4RXGLSPP_js.__name((parameters, context) => {
|
|
2228
1349
|
let result;
|
|
2229
1350
|
for (let i = 0; i < parameters.length; i++) {
|
|
2230
1351
|
const param = parameters[i];
|
|
@@ -2242,7 +1363,7 @@ var expandParameterList = /* @__PURE__ */ __name((parameters, context) => {
|
|
|
2242
1363
|
}
|
|
2243
1364
|
return result ?? parameters;
|
|
2244
1365
|
}, "expandParameterList");
|
|
2245
|
-
var resolveMarker = /* @__PURE__ */ __name((marker, body, context) => {
|
|
1366
|
+
var resolveMarker = /* @__PURE__ */ chunk4RXGLSPP_js.__name((marker, body, context) => {
|
|
2246
1367
|
const useRef = marker.ref ?? context.queryParamStyle === "ref";
|
|
2247
1368
|
if (marker.in === "query" && useRef && context.componentIds.has(marker.dtoId)) {
|
|
2248
1369
|
return [
|
|
@@ -2251,7 +1372,7 @@ var resolveMarker = /* @__PURE__ */ __name((marker, body, context) => {
|
|
|
2251
1372
|
}
|
|
2252
1373
|
return expandOne(marker, body);
|
|
2253
1374
|
}, "resolveMarker");
|
|
2254
|
-
var buildRefQueryParam = /* @__PURE__ */ __name((marker, body) => {
|
|
1375
|
+
var buildRefQueryParam = /* @__PURE__ */ chunk4RXGLSPP_js.__name((marker, body) => {
|
|
2255
1376
|
const required = isPlainRecord3(body) && Array.isArray(body.required) && body.required.length > 0;
|
|
2256
1377
|
return {
|
|
2257
1378
|
name: marker.dtoId,
|
|
@@ -2260,11 +1381,11 @@ var buildRefQueryParam = /* @__PURE__ */ __name((marker, body) => {
|
|
|
2260
1381
|
style: "form",
|
|
2261
1382
|
explode: true,
|
|
2262
1383
|
schema: {
|
|
2263
|
-
$ref: `${COMPONENTS_SCHEMAS_PREFIX}${marker.dtoId}`
|
|
1384
|
+
$ref: `${chunkFKXVNCDD_js.COMPONENTS_SCHEMAS_PREFIX}${marker.dtoId}`
|
|
2264
1385
|
}
|
|
2265
1386
|
};
|
|
2266
1387
|
}, "buildRefQueryParam");
|
|
2267
|
-
var readMarker2 = /* @__PURE__ */ __name((value) => {
|
|
1388
|
+
var readMarker2 = /* @__PURE__ */ chunk4RXGLSPP_js.__name((value) => {
|
|
2268
1389
|
if (!isPlainRecord3(value)) {
|
|
2269
1390
|
return void 0;
|
|
2270
1391
|
}
|
|
@@ -2285,7 +1406,7 @@ var readMarker2 = /* @__PURE__ */ __name((value) => {
|
|
|
2285
1406
|
}
|
|
2286
1407
|
return value;
|
|
2287
1408
|
}, "readMarker");
|
|
2288
|
-
var expandOne = /* @__PURE__ */ __name((marker, body) => {
|
|
1409
|
+
var expandOne = /* @__PURE__ */ chunk4RXGLSPP_js.__name((marker, body) => {
|
|
2289
1410
|
if (!isPlainRecord3(body) || !isPlainRecord3(body.properties)) {
|
|
2290
1411
|
throw new ZodNestDocumentError("UNEXPANDABLE_PARAM_DTO", `Cannot expand \`@${capitalize(marker.in)}() x: ${marker.dtoId}\` \u2014 the DTO's schema is not an object with \`properties\`. Non-body parameter DTOs must be object schemas; arrays, unions, primitives, etc. cannot be split into individual parameters. Use \`@Body()\` for non-object DTOs, or restructure the schema as an object whose fields become the params.`, {
|
|
2291
1412
|
dtoId: marker.dtoId,
|
|
@@ -2304,7 +1425,7 @@ var expandOne = /* @__PURE__ */ __name((marker, body) => {
|
|
|
2304
1425
|
}
|
|
2305
1426
|
return out;
|
|
2306
1427
|
}, "expandOne");
|
|
2307
|
-
var collectRequired = /* @__PURE__ */ __name((value) => {
|
|
1428
|
+
var collectRequired = /* @__PURE__ */ chunk4RXGLSPP_js.__name((value) => {
|
|
2308
1429
|
if (!Array.isArray(value)) {
|
|
2309
1430
|
return /* @__PURE__ */ new Set();
|
|
2310
1431
|
}
|
|
@@ -2316,7 +1437,7 @@ var collectRequired = /* @__PURE__ */ __name((value) => {
|
|
|
2316
1437
|
}
|
|
2317
1438
|
return out;
|
|
2318
1439
|
}, "collectRequired");
|
|
2319
|
-
var buildParameter = /* @__PURE__ */ __name((marker, name, schema, required) => {
|
|
1440
|
+
var buildParameter = /* @__PURE__ */ chunk4RXGLSPP_js.__name((marker, name, schema, required) => {
|
|
2320
1441
|
let effectiveRequired = required;
|
|
2321
1442
|
if (marker.in === "path" && !effectiveRequired) {
|
|
2322
1443
|
console.warn(`[zod-nest] Path parameter \`${name}\` on DTO \`${marker.dtoId}\` is marked optional in the Zod schema; OpenAPI 3.1 requires path parameters to be required. Coercing \`required: true\` so the emitted document is spec-valid. Fix by removing \`.optional()\` / \`.nullish()\` from the field, or by switching the decorator to @Query() / @Headers() if the field is genuinely optional.`);
|
|
@@ -2329,14 +1450,14 @@ var buildParameter = /* @__PURE__ */ __name((marker, name, schema, required) =>
|
|
|
2329
1450
|
schema
|
|
2330
1451
|
};
|
|
2331
1452
|
}, "buildParameter");
|
|
2332
|
-
var capitalize = /* @__PURE__ */ __name((value) => value.charAt(0).toUpperCase() + value.slice(1), "capitalize");
|
|
2333
|
-
var pruneOrphanObjectSchema = /* @__PURE__ */ __name((doc) => {
|
|
1453
|
+
var capitalize = /* @__PURE__ */ chunk4RXGLSPP_js.__name((value) => value.charAt(0).toUpperCase() + value.slice(1), "capitalize");
|
|
1454
|
+
var pruneOrphanObjectSchema = /* @__PURE__ */ chunk4RXGLSPP_js.__name((doc) => {
|
|
2334
1455
|
const schemas = doc.components?.schemas;
|
|
2335
1456
|
if (schemas === void 0 || !Object.prototype.hasOwnProperty.call(schemas, "Object")) {
|
|
2336
1457
|
return;
|
|
2337
1458
|
}
|
|
2338
1459
|
let referenced = false;
|
|
2339
|
-
const targetRef = `${COMPONENTS_SCHEMAS_PREFIX}Object`;
|
|
1460
|
+
const targetRef = `${chunkFKXVNCDD_js.COMPONENTS_SCHEMAS_PREFIX}Object`;
|
|
2340
1461
|
walkRefs(doc, (ref) => {
|
|
2341
1462
|
if (ref === targetRef) {
|
|
2342
1463
|
referenced = true;
|
|
@@ -2349,12 +1470,12 @@ var pruneOrphanObjectSchema = /* @__PURE__ */ __name((doc) => {
|
|
|
2349
1470
|
}, "pruneOrphanObjectSchema");
|
|
2350
1471
|
|
|
2351
1472
|
// src/document/expose-closure.ts
|
|
2352
|
-
var extendExposureViaRefs = /* @__PURE__ */ __name((collected, inputSchemas, outputSchemas) => ({
|
|
1473
|
+
var extendExposureViaRefs = /* @__PURE__ */ chunk4RXGLSPP_js.__name((collected, inputSchemas, outputSchemas) => ({
|
|
2353
1474
|
...collected,
|
|
2354
1475
|
inputExposedIds: closeOverRefs(collected.inputExposedIds, inputSchemas),
|
|
2355
1476
|
outputExposedIds: closeOverRefs(collected.outputExposedIds, outputSchemas)
|
|
2356
1477
|
}), "extendExposureViaRefs");
|
|
2357
|
-
var closeOverRefs = /* @__PURE__ */ __name((seed, bodies) => {
|
|
1478
|
+
var closeOverRefs = /* @__PURE__ */ chunk4RXGLSPP_js.__name((seed, bodies) => {
|
|
2358
1479
|
const out = new Set(seed);
|
|
2359
1480
|
const queue = [
|
|
2360
1481
|
...seed
|
|
@@ -2366,10 +1487,10 @@ var closeOverRefs = /* @__PURE__ */ __name((seed, bodies) => {
|
|
|
2366
1487
|
continue;
|
|
2367
1488
|
}
|
|
2368
1489
|
walkRefs(body, (ref) => {
|
|
2369
|
-
if (!ref.startsWith(COMPONENTS_SCHEMAS_PREFIX)) {
|
|
1490
|
+
if (!ref.startsWith(chunkFKXVNCDD_js.COMPONENTS_SCHEMAS_PREFIX)) {
|
|
2370
1491
|
return void 0;
|
|
2371
1492
|
}
|
|
2372
|
-
const target = ref.slice(COMPONENTS_SCHEMAS_PREFIX.length);
|
|
1493
|
+
const target = ref.slice(chunkFKXVNCDD_js.COMPONENTS_SCHEMAS_PREFIX.length);
|
|
2373
1494
|
if (out.has(target)) {
|
|
2374
1495
|
return void 0;
|
|
2375
1496
|
}
|
|
@@ -2385,7 +1506,7 @@ var closeOverRefs = /* @__PURE__ */ __name((seed, bodies) => {
|
|
|
2385
1506
|
var OUTPUT_SUFFIX = "Output";
|
|
2386
1507
|
|
|
2387
1508
|
// src/document/inline-anon.ts
|
|
2388
|
-
var inlineAnonymousBodies = /* @__PURE__ */ __name(({ doc, registry }) => {
|
|
1509
|
+
var inlineAnonymousBodies = /* @__PURE__ */ chunk4RXGLSPP_js.__name(({ doc, registry }) => {
|
|
2389
1510
|
const anonIds = registry.anonymousIds();
|
|
2390
1511
|
if (anonIds.length === 0) {
|
|
2391
1512
|
return;
|
|
@@ -2402,7 +1523,7 @@ var inlineAnonymousBodies = /* @__PURE__ */ __name(({ doc, registry }) => {
|
|
|
2402
1523
|
]) {
|
|
2403
1524
|
const body = schemas[key];
|
|
2404
1525
|
if (isPlainRecord4(body)) {
|
|
2405
|
-
bodyByRef.set(`${COMPONENTS_SCHEMAS_PREFIX}${key}`, body);
|
|
1526
|
+
bodyByRef.set(`${chunkFKXVNCDD_js.COMPONENTS_SCHEMAS_PREFIX}${key}`, body);
|
|
2406
1527
|
}
|
|
2407
1528
|
}
|
|
2408
1529
|
}
|
|
@@ -2414,10 +1535,10 @@ var inlineAnonymousBodies = /* @__PURE__ */ __name(({ doc, registry }) => {
|
|
|
2414
1535
|
}
|
|
2415
1536
|
inlineRefs(doc.paths, bodyByRef);
|
|
2416
1537
|
for (const ref of bodyByRef.keys()) {
|
|
2417
|
-
delete schemas[ref.slice(COMPONENTS_SCHEMAS_PREFIX.length)];
|
|
1538
|
+
delete schemas[ref.slice(chunkFKXVNCDD_js.COMPONENTS_SCHEMAS_PREFIX.length)];
|
|
2418
1539
|
}
|
|
2419
1540
|
}, "inlineAnonymousBodies");
|
|
2420
|
-
var refsWithin = /* @__PURE__ */ __name((schemas, bodyByRef) => {
|
|
1541
|
+
var refsWithin = /* @__PURE__ */ chunk4RXGLSPP_js.__name((schemas, bodyByRef) => {
|
|
2421
1542
|
const found = /* @__PURE__ */ new Set();
|
|
2422
1543
|
walkRefs(schemas, (ref) => {
|
|
2423
1544
|
if (bodyByRef.has(ref)) {
|
|
@@ -2427,8 +1548,8 @@ var refsWithin = /* @__PURE__ */ __name((schemas, bodyByRef) => {
|
|
|
2427
1548
|
});
|
|
2428
1549
|
return found;
|
|
2429
1550
|
}, "refsWithin");
|
|
2430
|
-
var isPlainRecord4 = /* @__PURE__ */ __name((value) => value !== null && typeof value === "object" && !Array.isArray(value), "isPlainRecord");
|
|
2431
|
-
var inlineRefs = /* @__PURE__ */ __name((node, bodyByRef) => {
|
|
1551
|
+
var isPlainRecord4 = /* @__PURE__ */ chunk4RXGLSPP_js.__name((value) => value !== null && typeof value === "object" && !Array.isArray(value), "isPlainRecord");
|
|
1552
|
+
var inlineRefs = /* @__PURE__ */ chunk4RXGLSPP_js.__name((node, bodyByRef) => {
|
|
2432
1553
|
if (Array.isArray(node)) {
|
|
2433
1554
|
for (const item of node) {
|
|
2434
1555
|
inlineRefs(item, bodyByRef);
|
|
@@ -2453,7 +1574,7 @@ var inlineRefs = /* @__PURE__ */ __name((node, bodyByRef) => {
|
|
|
2453
1574
|
inlineRefs(value, bodyByRef);
|
|
2454
1575
|
}
|
|
2455
1576
|
}, "inlineRefs");
|
|
2456
|
-
var mergeSchemas = /* @__PURE__ */ __name((params) => {
|
|
1577
|
+
var mergeSchemas = /* @__PURE__ */ chunk4RXGLSPP_js.__name((params) => {
|
|
2457
1578
|
const { doc, inputSchemas, outputSchemas, collected, collisions } = params;
|
|
2458
1579
|
const schemas = ensureComponentsSchemas(doc);
|
|
2459
1580
|
const renames = /* @__PURE__ */ new Map();
|
|
@@ -2488,14 +1609,14 @@ var mergeSchemas = /* @__PURE__ */ __name((params) => {
|
|
|
2488
1609
|
renames
|
|
2489
1610
|
};
|
|
2490
1611
|
}, "mergeSchemas");
|
|
2491
|
-
var ensureComponentsSchemas = /* @__PURE__ */ __name((doc) => {
|
|
1612
|
+
var ensureComponentsSchemas = /* @__PURE__ */ chunk4RXGLSPP_js.__name((doc) => {
|
|
2492
1613
|
const components = doc.components ?? {};
|
|
2493
1614
|
doc.components = components;
|
|
2494
1615
|
const schemas = components.schemas ?? {};
|
|
2495
1616
|
components.schemas = schemas;
|
|
2496
1617
|
return schemas;
|
|
2497
1618
|
}, "ensureComponentsSchemas");
|
|
2498
|
-
var applyTruthTable = /* @__PURE__ */ __name((params) => {
|
|
1619
|
+
var applyTruthTable = /* @__PURE__ */ chunk4RXGLSPP_js.__name((params) => {
|
|
2499
1620
|
const { schemas, id, inputExposed, outputExposed, inputBody, outputBody } = params;
|
|
2500
1621
|
const { divergentOutputIds, foreignKeys } = params;
|
|
2501
1622
|
if (inputExposed && !outputExposed) {
|
|
@@ -2514,7 +1635,7 @@ var applyTruthTable = /* @__PURE__ */ __name((params) => {
|
|
|
2514
1635
|
writeOrThrowAmbiguous(schemas, `${id}${OUTPUT_SUFFIX}`, outputBody, foreignKeys);
|
|
2515
1636
|
divergentOutputIds.add(id);
|
|
2516
1637
|
}, "applyTruthTable");
|
|
2517
|
-
var collectForeignKeys = /* @__PURE__ */ __name((schemas) => {
|
|
1638
|
+
var collectForeignKeys = /* @__PURE__ */ chunk4RXGLSPP_js.__name((schemas) => {
|
|
2518
1639
|
const foreign = /* @__PURE__ */ new Set();
|
|
2519
1640
|
for (const [key, body] of Object.entries(schemas)) {
|
|
2520
1641
|
if (!isMarkerPlaceholder(body)) {
|
|
@@ -2523,7 +1644,7 @@ var collectForeignKeys = /* @__PURE__ */ __name((schemas) => {
|
|
|
2523
1644
|
}
|
|
2524
1645
|
return foreign;
|
|
2525
1646
|
}, "collectForeignKeys");
|
|
2526
|
-
var writeOrThrowAmbiguous = /* @__PURE__ */ __name((schemas, key, body, foreignKeys) => {
|
|
1647
|
+
var writeOrThrowAmbiguous = /* @__PURE__ */ chunk4RXGLSPP_js.__name((schemas, key, body, foreignKeys) => {
|
|
2527
1648
|
if (body === void 0) {
|
|
2528
1649
|
return;
|
|
2529
1650
|
}
|
|
@@ -2538,13 +1659,13 @@ var writeOrThrowAmbiguous = /* @__PURE__ */ __name((schemas, key, body, foreignK
|
|
|
2538
1659
|
preexisting
|
|
2539
1660
|
});
|
|
2540
1661
|
}, "writeOrThrowAmbiguous");
|
|
2541
|
-
var ambiguousRenameHint = /* @__PURE__ */ __name((key, preexisting) => {
|
|
1662
|
+
var ambiguousRenameHint = /* @__PURE__ */ chunk4RXGLSPP_js.__name((key, preexisting) => {
|
|
2542
1663
|
if (preexisting) {
|
|
2543
1664
|
return `\`${key}\` was already populated before zod-nest emitted anything. On NestJS 12+ the usual cause is the native Standard Schema path \u2014 \`@Body({ schema })\`, \`@Query({ schema })\` or \`@ApiResponse({ standardSchema })\` \u2014 which makes @nestjs/swagger emit the component itself, in its OpenAPI 3.0 shape. Route the schema through \`createZodDto\` / \`@ZodBody\` / \`@ZodResponse\` instead, or drop \`applyZodNest\` and let Nest own the whole document. A hand-authored component or a doc pre-pass under the same name does this too.`;
|
|
2544
1665
|
}
|
|
2545
1666
|
return "Two registered ids resolved to the same key \u2014 most often an `<Id>Output` sibling from a diverging input/output schema colliding with a DTO explicitly registered as `<Id>Output`. Rename one of them, or set a distinct `options.id`.";
|
|
2546
1667
|
}, "ambiguousRenameHint");
|
|
2547
|
-
var isMarkerPlaceholder = /* @__PURE__ */ __name((value) => {
|
|
1668
|
+
var isMarkerPlaceholder = /* @__PURE__ */ chunk4RXGLSPP_js.__name((value) => {
|
|
2548
1669
|
if (value === null || typeof value !== "object") {
|
|
2549
1670
|
return false;
|
|
2550
1671
|
}
|
|
@@ -2552,10 +1673,10 @@ var isMarkerPlaceholder = /* @__PURE__ */ __name((value) => {
|
|
|
2552
1673
|
if (properties === null || typeof properties !== "object") {
|
|
2553
1674
|
return false;
|
|
2554
1675
|
}
|
|
2555
|
-
const marker = properties[ZOD_NEST_DTO_EXTENSION];
|
|
1676
|
+
const marker = properties[chunkFKXVNCDD_js.ZOD_NEST_DTO_EXTENSION];
|
|
2556
1677
|
return isZodDtoMarker(marker);
|
|
2557
1678
|
}, "isMarkerPlaceholder");
|
|
2558
|
-
var canonicalEqual = /* @__PURE__ */ __name((a, b) => {
|
|
1679
|
+
var canonicalEqual = /* @__PURE__ */ chunk4RXGLSPP_js.__name((a, b) => {
|
|
2559
1680
|
if (a === b) {
|
|
2560
1681
|
return true;
|
|
2561
1682
|
}
|
|
@@ -2564,7 +1685,7 @@ var canonicalEqual = /* @__PURE__ */ __name((a, b) => {
|
|
|
2564
1685
|
}
|
|
2565
1686
|
return stringify__default.default(a) === stringify__default.default(b);
|
|
2566
1687
|
}, "canonicalEqual");
|
|
2567
|
-
var applyCollisionDecoration = /* @__PURE__ */ __name((schemas, collisions, divergentOutputIds) => {
|
|
1688
|
+
var applyCollisionDecoration = /* @__PURE__ */ chunk4RXGLSPP_js.__name((schemas, collisions, divergentOutputIds) => {
|
|
2568
1689
|
for (const [id] of collisions) {
|
|
2569
1690
|
decorateIfPresent(schemas, id);
|
|
2570
1691
|
if (divergentOutputIds.has(id)) {
|
|
@@ -2572,18 +1693,18 @@ var applyCollisionDecoration = /* @__PURE__ */ __name((schemas, collisions, dive
|
|
|
2572
1693
|
}
|
|
2573
1694
|
}
|
|
2574
1695
|
}, "applyCollisionDecoration");
|
|
2575
|
-
var decorateIfPresent = /* @__PURE__ */ __name((schemas, key) => {
|
|
1696
|
+
var decorateIfPresent = /* @__PURE__ */ chunk4RXGLSPP_js.__name((schemas, key) => {
|
|
2576
1697
|
if (!(key in schemas)) {
|
|
2577
1698
|
return;
|
|
2578
1699
|
}
|
|
2579
1700
|
schemas[key] = {
|
|
2580
1701
|
description: `ERROR: duplicate zod-nest id <${key.replace(/Output$/, "")}>`,
|
|
2581
|
-
[ZOD_NEST_ERROR_EXTENSION]: ZOD_NEST_ERROR_DUPLICATE_ID
|
|
1702
|
+
[chunkFKXVNCDD_js.ZOD_NEST_ERROR_EXTENSION]: chunkFKXVNCDD_js.ZOD_NEST_ERROR_DUPLICATE_ID
|
|
2582
1703
|
};
|
|
2583
1704
|
}, "decorateIfPresent");
|
|
2584
1705
|
|
|
2585
1706
|
// src/document/ref-titles.ts
|
|
2586
|
-
var applyRefTitles = /* @__PURE__ */ __name((doc) => {
|
|
1707
|
+
var applyRefTitles = /* @__PURE__ */ chunk4RXGLSPP_js.__name((doc) => {
|
|
2587
1708
|
const schemas = doc.components?.schemas;
|
|
2588
1709
|
if (schemas === void 0) {
|
|
2589
1710
|
return;
|
|
@@ -2600,8 +1721,8 @@ var applyRefTitles = /* @__PURE__ */ __name((doc) => {
|
|
|
2600
1721
|
addRefTitles(doc.paths, titleById);
|
|
2601
1722
|
addRefTitles(schemas, titleById);
|
|
2602
1723
|
}, "applyRefTitles");
|
|
2603
|
-
var isPlainRecord5 = /* @__PURE__ */ __name((value) => value !== null && typeof value === "object" && !Array.isArray(value), "isPlainRecord");
|
|
2604
|
-
var addRefTitles = /* @__PURE__ */ __name((node, titleById) => {
|
|
1724
|
+
var isPlainRecord5 = /* @__PURE__ */ chunk4RXGLSPP_js.__name((value) => value !== null && typeof value === "object" && !Array.isArray(value), "isPlainRecord");
|
|
1725
|
+
var addRefTitles = /* @__PURE__ */ chunk4RXGLSPP_js.__name((node, titleById) => {
|
|
2605
1726
|
if (Array.isArray(node)) {
|
|
2606
1727
|
for (const item of node) {
|
|
2607
1728
|
addRefTitles(item, titleById);
|
|
@@ -2612,8 +1733,8 @@ var addRefTitles = /* @__PURE__ */ __name((node, titleById) => {
|
|
|
2612
1733
|
return;
|
|
2613
1734
|
}
|
|
2614
1735
|
const ref = node.$ref;
|
|
2615
|
-
if (typeof ref === "string" && ref.startsWith(COMPONENTS_SCHEMAS_PREFIX) && node.title === void 0) {
|
|
2616
|
-
const title = titleById.get(ref.slice(COMPONENTS_SCHEMAS_PREFIX.length));
|
|
1736
|
+
if (typeof ref === "string" && ref.startsWith(chunkFKXVNCDD_js.COMPONENTS_SCHEMAS_PREFIX) && node.title === void 0) {
|
|
1737
|
+
const title = titleById.get(ref.slice(chunkFKXVNCDD_js.COMPONENTS_SCHEMAS_PREFIX.length));
|
|
2617
1738
|
if (title !== void 0) {
|
|
2618
1739
|
node.title = title;
|
|
2619
1740
|
}
|
|
@@ -2624,19 +1745,19 @@ var addRefTitles = /* @__PURE__ */ __name((node, titleById) => {
|
|
|
2624
1745
|
}, "addRefTitles");
|
|
2625
1746
|
|
|
2626
1747
|
// src/document/rewrite-refs.ts
|
|
2627
|
-
var
|
|
1748
|
+
var rewriteRefs = /* @__PURE__ */ chunk4RXGLSPP_js.__name((params) => {
|
|
2628
1749
|
const { doc, renames, divergentOutputIds } = params;
|
|
2629
1750
|
if (renames.size > 0) {
|
|
2630
1751
|
walkRefs(doc, (ref) => {
|
|
2631
|
-
if (!ref.startsWith(COMPONENTS_SCHEMAS_PREFIX)) {
|
|
1752
|
+
if (!ref.startsWith(chunkFKXVNCDD_js.COMPONENTS_SCHEMAS_PREFIX)) {
|
|
2632
1753
|
return void 0;
|
|
2633
1754
|
}
|
|
2634
|
-
const target = ref.slice(COMPONENTS_SCHEMAS_PREFIX.length);
|
|
1755
|
+
const target = ref.slice(chunkFKXVNCDD_js.COMPONENTS_SCHEMAS_PREFIX.length);
|
|
2635
1756
|
const renamed = renames.get(target);
|
|
2636
1757
|
if (renamed === void 0) {
|
|
2637
1758
|
return void 0;
|
|
2638
1759
|
}
|
|
2639
|
-
return `${COMPONENTS_SCHEMAS_PREFIX}${renamed}`;
|
|
1760
|
+
return `${chunkFKXVNCDD_js.COMPONENTS_SCHEMAS_PREFIX}${renamed}`;
|
|
2640
1761
|
});
|
|
2641
1762
|
}
|
|
2642
1763
|
if (divergentOutputIds.size === 0) {
|
|
@@ -2650,7 +1771,7 @@ var rewriteRefs2 = /* @__PURE__ */ __name((params) => {
|
|
|
2650
1771
|
rewriteResponseSubtree(pathItem, divergentOutputIds);
|
|
2651
1772
|
}
|
|
2652
1773
|
}, "rewriteRefs");
|
|
2653
|
-
var rewriteResponseSubtree = /* @__PURE__ */ __name((pathItem, divergentOutputIds) => {
|
|
1774
|
+
var rewriteResponseSubtree = /* @__PURE__ */ chunk4RXGLSPP_js.__name((pathItem, divergentOutputIds) => {
|
|
2654
1775
|
for (const method of HTTP_METHODS) {
|
|
2655
1776
|
const op = pathItem[method];
|
|
2656
1777
|
if (op === null || typeof op !== "object") {
|
|
@@ -2661,20 +1782,20 @@ var rewriteResponseSubtree = /* @__PURE__ */ __name((pathItem, divergentOutputId
|
|
|
2661
1782
|
continue;
|
|
2662
1783
|
}
|
|
2663
1784
|
walkRefs(responses, (ref) => {
|
|
2664
|
-
if (!ref.startsWith(COMPONENTS_SCHEMAS_PREFIX)) {
|
|
1785
|
+
if (!ref.startsWith(chunkFKXVNCDD_js.COMPONENTS_SCHEMAS_PREFIX)) {
|
|
2665
1786
|
return void 0;
|
|
2666
1787
|
}
|
|
2667
|
-
const target = ref.slice(COMPONENTS_SCHEMAS_PREFIX.length);
|
|
1788
|
+
const target = ref.slice(chunkFKXVNCDD_js.COMPONENTS_SCHEMAS_PREFIX.length);
|
|
2668
1789
|
if (!divergentOutputIds.has(target)) {
|
|
2669
1790
|
return void 0;
|
|
2670
1791
|
}
|
|
2671
|
-
return `${COMPONENTS_SCHEMAS_PREFIX}${target}${OUTPUT_SUFFIX}`;
|
|
1792
|
+
return `${chunkFKXVNCDD_js.COMPONENTS_SCHEMAS_PREFIX}${target}${OUTPUT_SUFFIX}`;
|
|
2672
1793
|
});
|
|
2673
1794
|
}
|
|
2674
1795
|
}, "rewriteResponseSubtree");
|
|
2675
1796
|
|
|
2676
1797
|
// src/document/strip-markers.ts
|
|
2677
|
-
var stripMarkers = /* @__PURE__ */ __name((doc) => {
|
|
1798
|
+
var stripMarkers = /* @__PURE__ */ chunk4RXGLSPP_js.__name((doc) => {
|
|
2678
1799
|
const schemas = doc.components?.schemas;
|
|
2679
1800
|
if (schemas !== void 0) {
|
|
2680
1801
|
for (const schema of Object.values(schemas)) {
|
|
@@ -2684,7 +1805,7 @@ var stripMarkers = /* @__PURE__ */ __name((doc) => {
|
|
|
2684
1805
|
}
|
|
2685
1806
|
stripMarkerParameters(doc);
|
|
2686
1807
|
}, "stripMarkers");
|
|
2687
|
-
var dropJsonSchemaMetadata = /* @__PURE__ */ __name((schema) => {
|
|
1808
|
+
var dropJsonSchemaMetadata = /* @__PURE__ */ chunk4RXGLSPP_js.__name((schema) => {
|
|
2688
1809
|
if (schema === null || typeof schema !== "object") {
|
|
2689
1810
|
return;
|
|
2690
1811
|
}
|
|
@@ -2692,7 +1813,7 @@ var dropJsonSchemaMetadata = /* @__PURE__ */ __name((schema) => {
|
|
|
2692
1813
|
delete body.$schema;
|
|
2693
1814
|
delete body.$id;
|
|
2694
1815
|
}, "dropJsonSchemaMetadata");
|
|
2695
|
-
var stripMarkerParameters = /* @__PURE__ */ __name((doc) => {
|
|
1816
|
+
var stripMarkerParameters = /* @__PURE__ */ chunk4RXGLSPP_js.__name((doc) => {
|
|
2696
1817
|
forEachOperation(doc, (op) => {
|
|
2697
1818
|
const parameters = op.parameters;
|
|
2698
1819
|
if (!Array.isArray(parameters)) {
|
|
@@ -2701,7 +1822,7 @@ var stripMarkerParameters = /* @__PURE__ */ __name((doc) => {
|
|
|
2701
1822
|
op.parameters = parameters.filter((param) => !isZodDtoMarker(param));
|
|
2702
1823
|
});
|
|
2703
1824
|
}, "stripMarkerParameters");
|
|
2704
|
-
var stripMarkerFromSchema = /* @__PURE__ */ __name((schema) => {
|
|
1825
|
+
var stripMarkerFromSchema = /* @__PURE__ */ chunk4RXGLSPP_js.__name((schema) => {
|
|
2705
1826
|
if (schema === null || typeof schema !== "object") {
|
|
2706
1827
|
return;
|
|
2707
1828
|
}
|
|
@@ -2710,17 +1831,17 @@ var stripMarkerFromSchema = /* @__PURE__ */ __name((schema) => {
|
|
|
2710
1831
|
return;
|
|
2711
1832
|
}
|
|
2712
1833
|
const props = properties;
|
|
2713
|
-
if (!(ZOD_NEST_DTO_EXTENSION in props)) {
|
|
1834
|
+
if (!(chunkFKXVNCDD_js.ZOD_NEST_DTO_EXTENSION in props)) {
|
|
2714
1835
|
return;
|
|
2715
1836
|
}
|
|
2716
|
-
delete props[ZOD_NEST_DTO_EXTENSION];
|
|
1837
|
+
delete props[chunkFKXVNCDD_js.ZOD_NEST_DTO_EXTENSION];
|
|
2717
1838
|
if (Object.keys(props).length === 0) {
|
|
2718
1839
|
delete schema.properties;
|
|
2719
1840
|
}
|
|
2720
1841
|
}, "stripMarkerFromSchema");
|
|
2721
1842
|
|
|
2722
1843
|
// src/document/apply-zod-nest.ts
|
|
2723
|
-
var withForcedExposure = /* @__PURE__ */ __name((collected, registry) => {
|
|
1844
|
+
var withForcedExposure = /* @__PURE__ */ chunk4RXGLSPP_js.__name((collected, registry) => {
|
|
2724
1845
|
const forced = registry.forceExposedIds();
|
|
2725
1846
|
if (forced.length === 0) {
|
|
2726
1847
|
return collected;
|
|
@@ -2735,8 +1856,8 @@ var withForcedExposure = /* @__PURE__ */ __name((collected, registry) => {
|
|
|
2735
1856
|
};
|
|
2736
1857
|
}, "withForcedExposure");
|
|
2737
1858
|
var OPENAPI_VERSION = "3.1.0";
|
|
2738
|
-
var applyZodNest = /* @__PURE__ */ __name((doc, opts = {}) => {
|
|
2739
|
-
const registry = opts.registry ?? defaultRegistry;
|
|
1859
|
+
var applyZodNest = /* @__PURE__ */ chunk4RXGLSPP_js.__name((doc, opts = {}) => {
|
|
1860
|
+
const registry = opts.registry ?? chunkFKXVNCDD_js.defaultRegistry;
|
|
2740
1861
|
const collected = collectUsage(doc, registry);
|
|
2741
1862
|
const exposed = withForcedExposure(collected, registry);
|
|
2742
1863
|
const { inputSchemas, outputSchemas } = bulkEmit({
|
|
@@ -2758,7 +1879,7 @@ var applyZodNest = /* @__PURE__ */ __name((doc, opts = {}) => {
|
|
|
2758
1879
|
outputSchemas,
|
|
2759
1880
|
queryParamStyle: opts.queryParamStyle
|
|
2760
1881
|
});
|
|
2761
|
-
|
|
1882
|
+
rewriteRefs({
|
|
2762
1883
|
doc,
|
|
2763
1884
|
renames,
|
|
2764
1885
|
divergentOutputIds
|
|
@@ -2779,41 +1900,92 @@ var applyZodNest = /* @__PURE__ */ __name((doc, opts = {}) => {
|
|
|
2779
1900
|
return doc;
|
|
2780
1901
|
}, "applyZodNest");
|
|
2781
1902
|
|
|
2782
|
-
exports
|
|
1903
|
+
Object.defineProperty(exports, "COMPONENTS_SCHEMAS_PREFIX", {
|
|
1904
|
+
enumerable: true,
|
|
1905
|
+
get: function () { return chunkFKXVNCDD_js.COMPONENTS_SCHEMAS_PREFIX; }
|
|
1906
|
+
});
|
|
1907
|
+
Object.defineProperty(exports, "ZOD_DTO_SYMBOL", {
|
|
1908
|
+
enumerable: true,
|
|
1909
|
+
get: function () { return chunkFKXVNCDD_js.ZOD_DTO_SYMBOL; }
|
|
1910
|
+
});
|
|
1911
|
+
Object.defineProperty(exports, "ZOD_NEST_DTO_EXTENSION", {
|
|
1912
|
+
enumerable: true,
|
|
1913
|
+
get: function () { return chunkFKXVNCDD_js.ZOD_NEST_DTO_EXTENSION; }
|
|
1914
|
+
});
|
|
1915
|
+
Object.defineProperty(exports, "ZOD_NEST_ERROR_DUPLICATE_ID", {
|
|
1916
|
+
enumerable: true,
|
|
1917
|
+
get: function () { return chunkFKXVNCDD_js.ZOD_NEST_ERROR_DUPLICATE_ID; }
|
|
1918
|
+
});
|
|
1919
|
+
Object.defineProperty(exports, "ZOD_NEST_ERROR_EXTENSION", {
|
|
1920
|
+
enumerable: true,
|
|
1921
|
+
get: function () { return chunkFKXVNCDD_js.ZOD_NEST_ERROR_EXTENSION; }
|
|
1922
|
+
});
|
|
1923
|
+
Object.defineProperty(exports, "ZodNestError", {
|
|
1924
|
+
enumerable: true,
|
|
1925
|
+
get: function () { return chunkFKXVNCDD_js.ZodNestError; }
|
|
1926
|
+
});
|
|
1927
|
+
Object.defineProperty(exports, "ZodNestUnrepresentableError", {
|
|
1928
|
+
enumerable: true,
|
|
1929
|
+
get: function () { return chunkFKXVNCDD_js.ZodNestUnrepresentableError; }
|
|
1930
|
+
});
|
|
1931
|
+
Object.defineProperty(exports, "ZodValidationException", {
|
|
1932
|
+
enumerable: true,
|
|
1933
|
+
get: function () { return chunkFKXVNCDD_js.ZodValidationException; }
|
|
1934
|
+
});
|
|
1935
|
+
Object.defineProperty(exports, "createRegistry", {
|
|
1936
|
+
enumerable: true,
|
|
1937
|
+
get: function () { return chunkFKXVNCDD_js.createRegistry; }
|
|
1938
|
+
});
|
|
1939
|
+
Object.defineProperty(exports, "defaultRegistry", {
|
|
1940
|
+
enumerable: true,
|
|
1941
|
+
get: function () { return chunkFKXVNCDD_js.defaultRegistry; }
|
|
1942
|
+
});
|
|
1943
|
+
Object.defineProperty(exports, "extend", {
|
|
1944
|
+
enumerable: true,
|
|
1945
|
+
get: function () { return chunkFKXVNCDD_js.extend; }
|
|
1946
|
+
});
|
|
1947
|
+
Object.defineProperty(exports, "getLineage", {
|
|
1948
|
+
enumerable: true,
|
|
1949
|
+
get: function () { return chunkFKXVNCDD_js.getLineage; }
|
|
1950
|
+
});
|
|
1951
|
+
Object.defineProperty(exports, "isZodDto", {
|
|
1952
|
+
enumerable: true,
|
|
1953
|
+
get: function () { return chunkFKXVNCDD_js.isZodDto; }
|
|
1954
|
+
});
|
|
1955
|
+
Object.defineProperty(exports, "isZodSchema", {
|
|
1956
|
+
enumerable: true,
|
|
1957
|
+
get: function () { return chunkFKXVNCDD_js.isZodSchema; }
|
|
1958
|
+
});
|
|
1959
|
+
Object.defineProperty(exports, "registerSchema", {
|
|
1960
|
+
enumerable: true,
|
|
1961
|
+
get: function () { return chunkFKXVNCDD_js.registerSchema; }
|
|
1962
|
+
});
|
|
1963
|
+
Object.defineProperty(exports, "toOpenApi", {
|
|
1964
|
+
enumerable: true,
|
|
1965
|
+
get: function () { return chunkFKXVNCDD_js.toOpenApi; }
|
|
1966
|
+
});
|
|
1967
|
+
Object.defineProperty(exports, "overrideJSONSchema", {
|
|
1968
|
+
enumerable: true,
|
|
1969
|
+
get: function () { return chunk4RXGLSPP_js.overrideJSONSchema; }
|
|
1970
|
+
});
|
|
2783
1971
|
exports.DEFAULT_MAX_LOGGED_VALUE_BYTES = DEFAULT_MAX_LOGGED_VALUE_BYTES;
|
|
2784
1972
|
exports.DEFAULT_REDACT_KEYS = DEFAULT_REDACT_KEYS;
|
|
2785
1973
|
exports.DEFAULT_STREAM_CONTENT_TYPES = DEFAULT_STREAM_CONTENT_TYPES;
|
|
2786
|
-
exports.ZOD_DTO_SYMBOL = ZOD_DTO_SYMBOL;
|
|
2787
|
-
exports.ZOD_NEST_DTO_EXTENSION = ZOD_NEST_DTO_EXTENSION;
|
|
2788
|
-
exports.ZOD_NEST_ERROR_DUPLICATE_ID = ZOD_NEST_ERROR_DUPLICATE_ID;
|
|
2789
|
-
exports.ZOD_NEST_ERROR_EXTENSION = ZOD_NEST_ERROR_EXTENSION;
|
|
2790
1974
|
exports.ZOD_NEST_OPTIONS = ZOD_NEST_OPTIONS;
|
|
2791
1975
|
exports.ZOD_RESPONSES_METADATA_KEY = ZOD_RESPONSES_METADATA_KEY;
|
|
2792
1976
|
exports.ZodBody = ZodBody;
|
|
2793
1977
|
exports.ZodCookies = ZodCookies;
|
|
2794
1978
|
exports.ZodHeaders = ZodHeaders;
|
|
2795
1979
|
exports.ZodNestDocumentError = ZodNestDocumentError;
|
|
2796
|
-
exports.ZodNestError = ZodNestError;
|
|
2797
1980
|
exports.ZodNestModule = ZodNestModule;
|
|
2798
|
-
exports.ZodNestUnrepresentableError = ZodNestUnrepresentableError;
|
|
2799
1981
|
exports.ZodQuery = ZodQuery;
|
|
2800
1982
|
exports.ZodResponse = ZodResponse;
|
|
2801
1983
|
exports.ZodSerializationException = ZodSerializationException;
|
|
2802
|
-
exports.ZodValidationException = ZodValidationException;
|
|
2803
1984
|
exports.applyZodNest = applyZodNest;
|
|
2804
|
-
exports.createRegistry = createRegistry;
|
|
2805
1985
|
exports.createZodDto = createZodDto;
|
|
2806
|
-
exports.defaultRegistry = defaultRegistry;
|
|
2807
1986
|
exports.defaultStatusFor = defaultStatusFor;
|
|
2808
|
-
exports.extend = extend;
|
|
2809
|
-
exports.getLineage = getLineage;
|
|
2810
|
-
exports.isZodDto = isZodDto;
|
|
2811
1987
|
exports.isZodDtoMarker = isZodDtoMarker;
|
|
2812
|
-
exports.isZodSchema = isZodSchema;
|
|
2813
1988
|
exports.makeZodDtoMarker = makeZodDtoMarker;
|
|
2814
|
-
exports.overrideJSONSchema = overrideJSONSchema;
|
|
2815
|
-
exports.registerSchema = registerSchema;
|
|
2816
1989
|
exports.resolveEffectiveStatus = resolveEffectiveStatus;
|
|
2817
|
-
exports.toOpenApi = toOpenApi;
|
|
2818
1990
|
//# sourceMappingURL=index.js.map
|
|
2819
1991
|
//# sourceMappingURL=index.js.map
|