zod-nest 3.2.4 → 3.2.6
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-N3VWL7G7.js → chunk-BYRNJLNK.js} +31 -15
- package/dist/chunk-BYRNJLNK.js.map +1 -0
- package/dist/{chunk-KNXYA5ER.js → chunk-Q3SWJZBB.js} +3 -8
- package/dist/chunk-Q3SWJZBB.js.map +1 -0
- package/dist/{chunk-VSI3SF7S.mjs → chunk-T4H5ECKV.mjs} +27 -11
- package/dist/chunk-T4H5ECKV.mjs.map +1 -0
- package/dist/{chunk-2NVNXIOY.mjs → chunk-YRTGPVSJ.mjs} +3 -8
- package/dist/chunk-YRTGPVSJ.mjs.map +1 -0
- package/dist/express/index.js +9 -9
- package/dist/express/index.mjs +3 -3
- package/dist/fastify/index.js +6 -6
- package/dist/fastify/index.mjs +3 -3
- package/dist/index.js +90 -76
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +19 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-2NVNXIOY.mjs.map +0 -1
- package/dist/chunk-KNXYA5ER.js.map +0 -1
- package/dist/chunk-N3VWL7G7.js.map +0 -1
- package/dist/chunk-VSI3SF7S.mjs.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkQ3SWJZBB_js = require('./chunk-Q3SWJZBB.js');
|
|
4
4
|
var chunkEV5I5HGT_js = require('./chunk-EV5I5HGT.js');
|
|
5
5
|
var common = require('@nestjs/common');
|
|
6
6
|
var zod = require('zod');
|
|
@@ -39,7 +39,7 @@ var buildSiblingClass = /* @__PURE__ */ chunkEV5I5HGT_js.__name((parent, schema)
|
|
|
39
39
|
}
|
|
40
40
|
static schema = schema;
|
|
41
41
|
static io = "output";
|
|
42
|
-
static [
|
|
42
|
+
static [chunkQ3SWJZBB_js.ZOD_DTO_SYMBOL] = true;
|
|
43
43
|
static get id() {
|
|
44
44
|
return parent.id;
|
|
45
45
|
}
|
|
@@ -54,7 +54,7 @@ var buildSiblingClass = /* @__PURE__ */ chunkEV5I5HGT_js.__name((parent, schema)
|
|
|
54
54
|
}
|
|
55
55
|
static _OPENAPI_METADATA_FACTORY() {
|
|
56
56
|
return {
|
|
57
|
-
[
|
|
57
|
+
[chunkQ3SWJZBB_js.ZOD_NEST_DTO_EXTENSION]: makeZodDtoMarker(parent.id, "output")
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
60
|
};
|
|
@@ -92,14 +92,14 @@ var resolveFallbackId = /* @__PURE__ */ chunkEV5I5HGT_js.__name((className) => {
|
|
|
92
92
|
return fallback;
|
|
93
93
|
}, "resolveFallbackId");
|
|
94
94
|
var createZodDto = /* @__PURE__ */ chunkEV5I5HGT_js.__name((schema, options) => {
|
|
95
|
-
const registry = options?.registry ??
|
|
95
|
+
const registry = options?.registry ?? chunkQ3SWJZBB_js.defaultRegistry;
|
|
96
96
|
const io = "input";
|
|
97
97
|
let cachedId;
|
|
98
98
|
const ensureRegistered = /* @__PURE__ */ chunkEV5I5HGT_js.__name((className) => {
|
|
99
99
|
if (cachedId !== void 0) {
|
|
100
100
|
return cachedId;
|
|
101
101
|
}
|
|
102
|
-
const named =
|
|
102
|
+
const named = chunkQ3SWJZBB_js.registerSchema(schema, registry, {
|
|
103
103
|
id: options?.id,
|
|
104
104
|
expose: options?.expose
|
|
105
105
|
});
|
|
@@ -119,7 +119,7 @@ var createZodDto = /* @__PURE__ */ chunkEV5I5HGT_js.__name((schema, options) =>
|
|
|
119
119
|
}
|
|
120
120
|
static schema = schema;
|
|
121
121
|
static io = io;
|
|
122
|
-
static [
|
|
122
|
+
static [chunkQ3SWJZBB_js.ZOD_DTO_SYMBOL] = true;
|
|
123
123
|
static get id() {
|
|
124
124
|
return ensureRegistered(this.name);
|
|
125
125
|
}
|
|
@@ -134,7 +134,7 @@ var createZodDto = /* @__PURE__ */ chunkEV5I5HGT_js.__name((schema, options) =>
|
|
|
134
134
|
}
|
|
135
135
|
static _OPENAPI_METADATA_FACTORY() {
|
|
136
136
|
return {
|
|
137
|
-
[
|
|
137
|
+
[chunkQ3SWJZBB_js.ZOD_NEST_DTO_EXTENSION]: makeZodDtoMarker(ensureRegistered(this.name), io)
|
|
138
138
|
};
|
|
139
139
|
}
|
|
140
140
|
};
|
|
@@ -420,7 +420,7 @@ function _ts_param(paramIndex, decorator) {
|
|
|
420
420
|
chunkEV5I5HGT_js.__name(_ts_param, "_ts_param");
|
|
421
421
|
var isZodSchema2 = /* @__PURE__ */ chunkEV5I5HGT_js.__name((value) => value !== null && typeof value === "object" && "_zod" in value, "isZodSchema");
|
|
422
422
|
var isOptionsObject = /* @__PURE__ */ chunkEV5I5HGT_js.__name((value) => value !== null && typeof value === "object" && !isZodSchema2(value), "isOptionsObject");
|
|
423
|
-
var defaultExceptionFactory = /* @__PURE__ */ chunkEV5I5HGT_js.__name((zodError, argMetadata) => new
|
|
423
|
+
var defaultExceptionFactory = /* @__PURE__ */ chunkEV5I5HGT_js.__name((zodError, argMetadata) => new chunkQ3SWJZBB_js.ZodValidationException(zodError, argMetadata), "defaultExceptionFactory");
|
|
424
424
|
exports.ZodValidationPipe = class _ZodValidationPipe {
|
|
425
425
|
static {
|
|
426
426
|
chunkEV5I5HGT_js.__name(this, "ZodValidationPipe");
|
|
@@ -458,7 +458,7 @@ exports.ZodValidationPipe = class _ZodValidationPipe {
|
|
|
458
458
|
return this.explicitSchema;
|
|
459
459
|
}
|
|
460
460
|
const metatype = metadata.metatype;
|
|
461
|
-
if (!
|
|
461
|
+
if (!chunkQ3SWJZBB_js.isZodDto(metatype)) {
|
|
462
462
|
return void 0;
|
|
463
463
|
}
|
|
464
464
|
return metatype.schema;
|
|
@@ -468,7 +468,7 @@ exports.ZodValidationPipe = class _ZodValidationPipe {
|
|
|
468
468
|
return this.explicitDtoName;
|
|
469
469
|
}
|
|
470
470
|
const metatype = metadata.metatype;
|
|
471
|
-
if (
|
|
471
|
+
if (chunkQ3SWJZBB_js.isZodDto(metatype)) {
|
|
472
472
|
return metatype.name;
|
|
473
473
|
}
|
|
474
474
|
return "schema";
|
|
@@ -481,7 +481,7 @@ exports.ZodValidationPipe = class _ZodValidationPipe {
|
|
|
481
481
|
dtoName: void 0
|
|
482
482
|
};
|
|
483
483
|
}
|
|
484
|
-
if (
|
|
484
|
+
if (chunkQ3SWJZBB_js.isZodDto(arg)) {
|
|
485
485
|
return {
|
|
486
486
|
schema: arg.schema,
|
|
487
487
|
factory: void 0,
|
|
@@ -503,8 +503,8 @@ exports.ZodValidationPipe = class _ZodValidationPipe {
|
|
|
503
503
|
};
|
|
504
504
|
}
|
|
505
505
|
const optionSchema = arg.schema;
|
|
506
|
-
const dtoName =
|
|
507
|
-
const resolvedSchema =
|
|
506
|
+
const dtoName = chunkQ3SWJZBB_js.isZodDto(optionSchema) ? optionSchema.name : void 0;
|
|
507
|
+
const resolvedSchema = chunkQ3SWJZBB_js.isZodDto(optionSchema) ? optionSchema.schema : optionSchema;
|
|
508
508
|
return {
|
|
509
509
|
schema: resolvedSchema,
|
|
510
510
|
factory: arg.createValidationException,
|
|
@@ -560,14 +560,14 @@ var schemaToOutputDto = /* @__PURE__ */ chunkEV5I5HGT_js.__name((schema) => {
|
|
|
560
560
|
if (cached !== void 0) {
|
|
561
561
|
return cached;
|
|
562
562
|
}
|
|
563
|
-
const namedId =
|
|
563
|
+
const namedId = chunkQ3SWJZBB_js.registerSchema(schema);
|
|
564
564
|
if (namedId !== void 0) {
|
|
565
565
|
const dto2 = createZodDto(schema).Output;
|
|
566
566
|
responseDtoCache.set(schema, dto2);
|
|
567
567
|
return dto2;
|
|
568
568
|
}
|
|
569
|
-
const anonId =
|
|
570
|
-
|
|
569
|
+
const anonId = chunkQ3SWJZBB_js.resolveAnonId(schema, chunkQ3SWJZBB_js.ANON_RESPONSE_PREFIX);
|
|
570
|
+
chunkQ3SWJZBB_js.registerSchema(schema, chunkQ3SWJZBB_js.defaultRegistry, {
|
|
571
571
|
id: anonId,
|
|
572
572
|
anonymous: true
|
|
573
573
|
});
|
|
@@ -578,10 +578,10 @@ var schemaToOutputDto = /* @__PURE__ */ chunkEV5I5HGT_js.__name((schema) => {
|
|
|
578
578
|
return dto;
|
|
579
579
|
}, "schemaToOutputDto");
|
|
580
580
|
var toResponseDto = /* @__PURE__ */ chunkEV5I5HGT_js.__name((entry, index) => {
|
|
581
|
-
if (
|
|
581
|
+
if (chunkQ3SWJZBB_js.isZodDto(entry)) {
|
|
582
582
|
return entry;
|
|
583
583
|
}
|
|
584
|
-
if (
|
|
584
|
+
if (chunkQ3SWJZBB_js.isZodSchema(entry)) {
|
|
585
585
|
return schemaToOutputDto(entry);
|
|
586
586
|
}
|
|
587
587
|
const where = index === void 0 ? "@ZodResponse({ type })" : `@ZodResponse({ type }) element [${index}]`;
|
|
@@ -773,12 +773,17 @@ var ZodBody = /* @__PURE__ */ chunkEV5I5HGT_js.__name((schema, options) => {
|
|
|
773
773
|
});
|
|
774
774
|
}, "ZodBody");
|
|
775
775
|
var resolveBodySchema = /* @__PURE__ */ chunkEV5I5HGT_js.__name((schema, options) => {
|
|
776
|
+
const registry = options?.registry ?? chunkQ3SWJZBB_js.defaultRegistry;
|
|
776
777
|
if (options?.flatten === true) {
|
|
777
|
-
|
|
778
|
+
const merged = chunkQ3SWJZBB_js.flattenObjectIntersection(schema, registry, "@ZodBody");
|
|
779
|
+
return chunkQ3SWJZBB_js.resolveSchemaRef(merged, {
|
|
780
|
+
registry,
|
|
781
|
+
deferAnonInline: true
|
|
782
|
+
}).ref;
|
|
778
783
|
}
|
|
779
|
-
return
|
|
784
|
+
return chunkQ3SWJZBB_js.resolveSchemaRef(schema, {
|
|
780
785
|
id: options?.id,
|
|
781
|
-
registry
|
|
786
|
+
registry,
|
|
782
787
|
deferAnonInline: true
|
|
783
788
|
}).ref;
|
|
784
789
|
}, "resolveBodySchema");
|
|
@@ -811,27 +816,27 @@ var appendQueryMarker = /* @__PURE__ */ chunkEV5I5HGT_js.__name((dtoId, ref) =>
|
|
|
811
816
|
|
|
812
817
|
// src/decorators/zod-query.decorator.ts
|
|
813
818
|
var ZodQuery = /* @__PURE__ */ chunkEV5I5HGT_js.__name((schema, options) => {
|
|
814
|
-
if (!
|
|
815
|
-
throw new
|
|
819
|
+
if (!chunkQ3SWJZBB_js.isZodObject(schema)) {
|
|
820
|
+
throw new chunkQ3SWJZBB_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.`);
|
|
816
821
|
}
|
|
817
|
-
const registry = options?.registry ??
|
|
818
|
-
const id =
|
|
822
|
+
const registry = options?.registry ?? chunkQ3SWJZBB_js.defaultRegistry;
|
|
823
|
+
const id = chunkQ3SWJZBB_js.registerSchema(schema, registry, {
|
|
819
824
|
id: options?.id
|
|
820
825
|
});
|
|
821
826
|
if (id !== void 0) {
|
|
822
827
|
return appendQueryMarker(id, options?.ref);
|
|
823
828
|
}
|
|
824
829
|
if (options?.ref === true) {
|
|
825
|
-
throw new
|
|
830
|
+
throw new chunkQ3SWJZBB_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.`);
|
|
826
831
|
}
|
|
827
|
-
const expanded =
|
|
832
|
+
const expanded = chunkQ3SWJZBB_js.expandObjectSchema(schema, {
|
|
828
833
|
id: options?.id,
|
|
829
834
|
registry,
|
|
830
835
|
decoratorName: "@ZodQuery"
|
|
831
836
|
});
|
|
832
837
|
return common.applyDecorators(...expanded.map(({ name, required, resolution }) => swagger.ApiQuery({
|
|
833
838
|
name,
|
|
834
|
-
schema:
|
|
839
|
+
schema: chunkQ3SWJZBB_js.paramSchemaBody(resolution),
|
|
835
840
|
required
|
|
836
841
|
})));
|
|
837
842
|
}, "ZodQuery");
|
|
@@ -841,7 +846,7 @@ var API_PARAMETERS_KEY = "swagger/apiParameters";
|
|
|
841
846
|
|
|
842
847
|
// src/decorators/zod-headers.decorator.ts
|
|
843
848
|
var ZodHeaders = /* @__PURE__ */ chunkEV5I5HGT_js.__name((schema, options) => {
|
|
844
|
-
const expanded =
|
|
849
|
+
const expanded = chunkQ3SWJZBB_js.expandObjectSchema(schema, {
|
|
845
850
|
id: options?.id,
|
|
846
851
|
registry: options?.registry,
|
|
847
852
|
decoratorName: "@ZodHeaders"
|
|
@@ -850,7 +855,7 @@ var ZodHeaders = /* @__PURE__ */ chunkEV5I5HGT_js.__name((schema, options) => {
|
|
|
850
855
|
name,
|
|
851
856
|
in: "header",
|
|
852
857
|
required,
|
|
853
|
-
schema:
|
|
858
|
+
schema: chunkQ3SWJZBB_js.paramSchemaBody(resolution)
|
|
854
859
|
}));
|
|
855
860
|
return (_target, _propertyKey, descriptor) => {
|
|
856
861
|
const handler = descriptor.value;
|
|
@@ -867,7 +872,7 @@ var ZodHeaders = /* @__PURE__ */ chunkEV5I5HGT_js.__name((schema, options) => {
|
|
|
867
872
|
|
|
868
873
|
// src/decorators/zod-cookies.decorator.ts
|
|
869
874
|
var ZodCookies = /* @__PURE__ */ chunkEV5I5HGT_js.__name((schema, options) => {
|
|
870
|
-
const expanded =
|
|
875
|
+
const expanded = chunkQ3SWJZBB_js.expandObjectSchema(schema, {
|
|
871
876
|
id: options?.id,
|
|
872
877
|
registry: options?.registry,
|
|
873
878
|
decoratorName: "@ZodCookies"
|
|
@@ -876,7 +881,7 @@ var ZodCookies = /* @__PURE__ */ chunkEV5I5HGT_js.__name((schema, options) => {
|
|
|
876
881
|
name,
|
|
877
882
|
in: "cookie",
|
|
878
883
|
required,
|
|
879
|
-
schema:
|
|
884
|
+
schema: chunkQ3SWJZBB_js.paramSchemaBody(resolution)
|
|
880
885
|
}));
|
|
881
886
|
return (_target, _propertyKey, descriptor) => {
|
|
882
887
|
const handler = descriptor.value;
|
|
@@ -1056,7 +1061,7 @@ var scopeToKnownIds = /* @__PURE__ */ chunkEV5I5HGT_js.__name((zodRegistry, know
|
|
|
1056
1061
|
return scoped;
|
|
1057
1062
|
}, "scopeToKnownIds");
|
|
1058
1063
|
var runPass = /* @__PURE__ */ chunkEV5I5HGT_js.__name((opts, io, knownIds) => {
|
|
1059
|
-
const built =
|
|
1064
|
+
const built = chunkQ3SWJZBB_js.buildToJsonSchemaOptions({
|
|
1060
1065
|
registry: opts.registry,
|
|
1061
1066
|
io,
|
|
1062
1067
|
override: opts.override,
|
|
@@ -1084,7 +1089,16 @@ var HTTP_METHODS = [
|
|
|
1084
1089
|
"options",
|
|
1085
1090
|
"head",
|
|
1086
1091
|
"patch",
|
|
1087
|
-
"trace"
|
|
1092
|
+
"trace",
|
|
1093
|
+
"query",
|
|
1094
|
+
"search",
|
|
1095
|
+
"propfind",
|
|
1096
|
+
"proppatch",
|
|
1097
|
+
"mkcol",
|
|
1098
|
+
"copy",
|
|
1099
|
+
"move",
|
|
1100
|
+
"lock",
|
|
1101
|
+
"unlock"
|
|
1088
1102
|
];
|
|
1089
1103
|
var forEachOperation = /* @__PURE__ */ chunkEV5I5HGT_js.__name((doc, fn) => {
|
|
1090
1104
|
const paths = doc.paths;
|
|
@@ -1163,7 +1177,7 @@ var readMarker = /* @__PURE__ */ chunkEV5I5HGT_js.__name((schema) => {
|
|
|
1163
1177
|
if (!isPlainRecord2(schema.properties)) {
|
|
1164
1178
|
return void 0;
|
|
1165
1179
|
}
|
|
1166
|
-
const marker = schema.properties[
|
|
1180
|
+
const marker = schema.properties[chunkQ3SWJZBB_js.ZOD_NEST_DTO_EXTENSION];
|
|
1167
1181
|
if (!isZodDtoMarker(marker)) {
|
|
1168
1182
|
return void 0;
|
|
1169
1183
|
}
|
|
@@ -1235,10 +1249,10 @@ var collectRefFromSchema = /* @__PURE__ */ chunkEV5I5HGT_js.__name((schema, clas
|
|
|
1235
1249
|
return;
|
|
1236
1250
|
}
|
|
1237
1251
|
walkRefs(schema, (ref) => {
|
|
1238
|
-
if (!ref.startsWith(
|
|
1252
|
+
if (!ref.startsWith(chunkQ3SWJZBB_js.COMPONENTS_SCHEMAS_PREFIX)) {
|
|
1239
1253
|
return void 0;
|
|
1240
1254
|
}
|
|
1241
|
-
const className = ref.slice(
|
|
1255
|
+
const className = ref.slice(chunkQ3SWJZBB_js.COMPONENTS_SCHEMAS_PREFIX.length);
|
|
1242
1256
|
const renamed = classToDtoId.get(className);
|
|
1243
1257
|
if (renamed !== void 0) {
|
|
1244
1258
|
ids.add(renamed);
|
|
@@ -1274,7 +1288,7 @@ var collectRefsFromResponses = /* @__PURE__ */ chunkEV5I5HGT_js.__name((response
|
|
|
1274
1288
|
}, "collectRefsFromResponses");
|
|
1275
1289
|
|
|
1276
1290
|
// src/document/errors.ts
|
|
1277
|
-
var ZodNestDocumentError = class extends
|
|
1291
|
+
var ZodNestDocumentError = class extends chunkQ3SWJZBB_js.ZodNestError {
|
|
1278
1292
|
static {
|
|
1279
1293
|
chunkEV5I5HGT_js.__name(this, "ZodNestDocumentError");
|
|
1280
1294
|
}
|
|
@@ -1294,10 +1308,10 @@ var assertNoDanglingRefs = /* @__PURE__ */ chunkEV5I5HGT_js.__name((params) => {
|
|
|
1294
1308
|
const schemas = doc.components?.schemas ?? {};
|
|
1295
1309
|
const dangling = [];
|
|
1296
1310
|
walkRefs(doc, (ref) => {
|
|
1297
|
-
if (!ref.startsWith(
|
|
1311
|
+
if (!ref.startsWith(chunkQ3SWJZBB_js.COMPONENTS_SCHEMAS_PREFIX)) {
|
|
1298
1312
|
return void 0;
|
|
1299
1313
|
}
|
|
1300
|
-
const target = ref.slice(
|
|
1314
|
+
const target = ref.slice(chunkQ3SWJZBB_js.COMPONENTS_SCHEMAS_PREFIX.length);
|
|
1301
1315
|
if (!(target in schemas)) {
|
|
1302
1316
|
dangling.push(ref);
|
|
1303
1317
|
}
|
|
@@ -1313,7 +1327,7 @@ ${lines.join("\n")}`, {
|
|
|
1313
1327
|
});
|
|
1314
1328
|
}, "assertNoDanglingRefs");
|
|
1315
1329
|
var hintFor = /* @__PURE__ */ chunkEV5I5HGT_js.__name((ref, collected) => {
|
|
1316
|
-
const id = ref.slice(
|
|
1330
|
+
const id = ref.slice(chunkQ3SWJZBB_js.COMPONENTS_SCHEMAS_PREFIX.length);
|
|
1317
1331
|
const usedInput = collected.inputExposedIds.has(id);
|
|
1318
1332
|
const usedOutput = collected.outputExposedIds.has(id);
|
|
1319
1333
|
if (usedInput && usedOutput) {
|
|
@@ -1392,7 +1406,7 @@ var buildRefQueryParam = /* @__PURE__ */ chunkEV5I5HGT_js.__name((marker, body)
|
|
|
1392
1406
|
style: "form",
|
|
1393
1407
|
explode: true,
|
|
1394
1408
|
schema: {
|
|
1395
|
-
$ref: `${
|
|
1409
|
+
$ref: `${chunkQ3SWJZBB_js.COMPONENTS_SCHEMAS_PREFIX}${marker.dtoId}`
|
|
1396
1410
|
}
|
|
1397
1411
|
};
|
|
1398
1412
|
}, "buildRefQueryParam");
|
|
@@ -1468,7 +1482,7 @@ var pruneOrphanObjectSchema = /* @__PURE__ */ chunkEV5I5HGT_js.__name((doc) => {
|
|
|
1468
1482
|
return;
|
|
1469
1483
|
}
|
|
1470
1484
|
let referenced = false;
|
|
1471
|
-
const targetRef = `${
|
|
1485
|
+
const targetRef = `${chunkQ3SWJZBB_js.COMPONENTS_SCHEMAS_PREFIX}Object`;
|
|
1472
1486
|
walkRefs(doc, (ref) => {
|
|
1473
1487
|
if (ref === targetRef) {
|
|
1474
1488
|
referenced = true;
|
|
@@ -1498,10 +1512,10 @@ var closeOverRefs = /* @__PURE__ */ chunkEV5I5HGT_js.__name((seed, bodies) => {
|
|
|
1498
1512
|
continue;
|
|
1499
1513
|
}
|
|
1500
1514
|
walkRefs(body, (ref) => {
|
|
1501
|
-
if (!ref.startsWith(
|
|
1515
|
+
if (!ref.startsWith(chunkQ3SWJZBB_js.COMPONENTS_SCHEMAS_PREFIX)) {
|
|
1502
1516
|
return void 0;
|
|
1503
1517
|
}
|
|
1504
|
-
const target = ref.slice(
|
|
1518
|
+
const target = ref.slice(chunkQ3SWJZBB_js.COMPONENTS_SCHEMAS_PREFIX.length);
|
|
1505
1519
|
if (out.has(target)) {
|
|
1506
1520
|
return void 0;
|
|
1507
1521
|
}
|
|
@@ -1534,7 +1548,7 @@ var inlineAnonymousBodies = /* @__PURE__ */ chunkEV5I5HGT_js.__name(({ doc, regi
|
|
|
1534
1548
|
]) {
|
|
1535
1549
|
const body = schemas[key];
|
|
1536
1550
|
if (isPlainRecord4(body)) {
|
|
1537
|
-
bodyByRef.set(`${
|
|
1551
|
+
bodyByRef.set(`${chunkQ3SWJZBB_js.COMPONENTS_SCHEMAS_PREFIX}${key}`, body);
|
|
1538
1552
|
}
|
|
1539
1553
|
}
|
|
1540
1554
|
}
|
|
@@ -1546,7 +1560,7 @@ var inlineAnonymousBodies = /* @__PURE__ */ chunkEV5I5HGT_js.__name(({ doc, regi
|
|
|
1546
1560
|
}
|
|
1547
1561
|
inlineRefs(doc.paths, bodyByRef);
|
|
1548
1562
|
for (const ref of bodyByRef.keys()) {
|
|
1549
|
-
delete schemas[ref.slice(
|
|
1563
|
+
delete schemas[ref.slice(chunkQ3SWJZBB_js.COMPONENTS_SCHEMAS_PREFIX.length)];
|
|
1550
1564
|
}
|
|
1551
1565
|
}, "inlineAnonymousBodies");
|
|
1552
1566
|
var refsWithin = /* @__PURE__ */ chunkEV5I5HGT_js.__name((schemas, bodyByRef) => {
|
|
@@ -1684,7 +1698,7 @@ var isMarkerPlaceholder = /* @__PURE__ */ chunkEV5I5HGT_js.__name((value) => {
|
|
|
1684
1698
|
if (properties === null || typeof properties !== "object") {
|
|
1685
1699
|
return false;
|
|
1686
1700
|
}
|
|
1687
|
-
const marker = properties[
|
|
1701
|
+
const marker = properties[chunkQ3SWJZBB_js.ZOD_NEST_DTO_EXTENSION];
|
|
1688
1702
|
return isZodDtoMarker(marker);
|
|
1689
1703
|
}, "isMarkerPlaceholder");
|
|
1690
1704
|
var canonicalEqual = /* @__PURE__ */ chunkEV5I5HGT_js.__name((a, b) => {
|
|
@@ -1710,7 +1724,7 @@ var decorateIfPresent = /* @__PURE__ */ chunkEV5I5HGT_js.__name((schemas, key) =
|
|
|
1710
1724
|
}
|
|
1711
1725
|
schemas[key] = {
|
|
1712
1726
|
description: `ERROR: duplicate zod-nest id <${key.replace(/Output$/, "")}>`,
|
|
1713
|
-
[
|
|
1727
|
+
[chunkQ3SWJZBB_js.ZOD_NEST_ERROR_EXTENSION]: chunkQ3SWJZBB_js.ZOD_NEST_ERROR_DUPLICATE_ID
|
|
1714
1728
|
};
|
|
1715
1729
|
}, "decorateIfPresent");
|
|
1716
1730
|
|
|
@@ -1744,8 +1758,8 @@ var addRefTitles = /* @__PURE__ */ chunkEV5I5HGT_js.__name((node, titleById) =>
|
|
|
1744
1758
|
return;
|
|
1745
1759
|
}
|
|
1746
1760
|
const ref = node.$ref;
|
|
1747
|
-
if (typeof ref === "string" && ref.startsWith(
|
|
1748
|
-
const title = titleById.get(ref.slice(
|
|
1761
|
+
if (typeof ref === "string" && ref.startsWith(chunkQ3SWJZBB_js.COMPONENTS_SCHEMAS_PREFIX) && node.title === void 0) {
|
|
1762
|
+
const title = titleById.get(ref.slice(chunkQ3SWJZBB_js.COMPONENTS_SCHEMAS_PREFIX.length));
|
|
1749
1763
|
if (title !== void 0) {
|
|
1750
1764
|
node.title = title;
|
|
1751
1765
|
}
|
|
@@ -1760,15 +1774,15 @@ var rewriteRefs = /* @__PURE__ */ chunkEV5I5HGT_js.__name((params) => {
|
|
|
1760
1774
|
const { doc, renames, divergentOutputIds } = params;
|
|
1761
1775
|
if (renames.size > 0) {
|
|
1762
1776
|
walkRefs(doc, (ref) => {
|
|
1763
|
-
if (!ref.startsWith(
|
|
1777
|
+
if (!ref.startsWith(chunkQ3SWJZBB_js.COMPONENTS_SCHEMAS_PREFIX)) {
|
|
1764
1778
|
return void 0;
|
|
1765
1779
|
}
|
|
1766
|
-
const target = ref.slice(
|
|
1780
|
+
const target = ref.slice(chunkQ3SWJZBB_js.COMPONENTS_SCHEMAS_PREFIX.length);
|
|
1767
1781
|
const renamed = renames.get(target);
|
|
1768
1782
|
if (renamed === void 0) {
|
|
1769
1783
|
return void 0;
|
|
1770
1784
|
}
|
|
1771
|
-
return `${
|
|
1785
|
+
return `${chunkQ3SWJZBB_js.COMPONENTS_SCHEMAS_PREFIX}${renamed}`;
|
|
1772
1786
|
});
|
|
1773
1787
|
}
|
|
1774
1788
|
if (divergentOutputIds.size === 0) {
|
|
@@ -1793,14 +1807,14 @@ var rewriteResponseSubtree = /* @__PURE__ */ chunkEV5I5HGT_js.__name((pathItem,
|
|
|
1793
1807
|
continue;
|
|
1794
1808
|
}
|
|
1795
1809
|
walkRefs(responses, (ref) => {
|
|
1796
|
-
if (!ref.startsWith(
|
|
1810
|
+
if (!ref.startsWith(chunkQ3SWJZBB_js.COMPONENTS_SCHEMAS_PREFIX)) {
|
|
1797
1811
|
return void 0;
|
|
1798
1812
|
}
|
|
1799
|
-
const target = ref.slice(
|
|
1813
|
+
const target = ref.slice(chunkQ3SWJZBB_js.COMPONENTS_SCHEMAS_PREFIX.length);
|
|
1800
1814
|
if (!divergentOutputIds.has(target)) {
|
|
1801
1815
|
return void 0;
|
|
1802
1816
|
}
|
|
1803
|
-
return `${
|
|
1817
|
+
return `${chunkQ3SWJZBB_js.COMPONENTS_SCHEMAS_PREFIX}${target}${OUTPUT_SUFFIX}`;
|
|
1804
1818
|
});
|
|
1805
1819
|
}
|
|
1806
1820
|
}, "rewriteResponseSubtree");
|
|
@@ -1842,10 +1856,10 @@ var stripMarkerFromSchema = /* @__PURE__ */ chunkEV5I5HGT_js.__name((schema) =>
|
|
|
1842
1856
|
return;
|
|
1843
1857
|
}
|
|
1844
1858
|
const props = properties;
|
|
1845
|
-
if (!(
|
|
1859
|
+
if (!(chunkQ3SWJZBB_js.ZOD_NEST_DTO_EXTENSION in props)) {
|
|
1846
1860
|
return;
|
|
1847
1861
|
}
|
|
1848
|
-
delete props[
|
|
1862
|
+
delete props[chunkQ3SWJZBB_js.ZOD_NEST_DTO_EXTENSION];
|
|
1849
1863
|
if (Object.keys(props).length === 0) {
|
|
1850
1864
|
delete schema.properties;
|
|
1851
1865
|
}
|
|
@@ -1868,7 +1882,7 @@ var withForcedExposure = /* @__PURE__ */ chunkEV5I5HGT_js.__name((collected, reg
|
|
|
1868
1882
|
}, "withForcedExposure");
|
|
1869
1883
|
var OPENAPI_VERSION = "3.1.0";
|
|
1870
1884
|
var applyZodNest = /* @__PURE__ */ chunkEV5I5HGT_js.__name((doc, opts = {}) => {
|
|
1871
|
-
const registry = opts.registry ??
|
|
1885
|
+
const registry = opts.registry ?? chunkQ3SWJZBB_js.defaultRegistry;
|
|
1872
1886
|
const collected = collectUsage(doc, registry);
|
|
1873
1887
|
const exposed = withForcedExposure(collected, registry);
|
|
1874
1888
|
const { inputSchemas, outputSchemas } = bulkEmit({
|
|
@@ -1913,67 +1927,67 @@ var applyZodNest = /* @__PURE__ */ chunkEV5I5HGT_js.__name((doc, opts = {}) => {
|
|
|
1913
1927
|
|
|
1914
1928
|
Object.defineProperty(exports, "COMPONENTS_SCHEMAS_PREFIX", {
|
|
1915
1929
|
enumerable: true,
|
|
1916
|
-
get: function () { return
|
|
1930
|
+
get: function () { return chunkQ3SWJZBB_js.COMPONENTS_SCHEMAS_PREFIX; }
|
|
1917
1931
|
});
|
|
1918
1932
|
Object.defineProperty(exports, "ZOD_DTO_SYMBOL", {
|
|
1919
1933
|
enumerable: true,
|
|
1920
|
-
get: function () { return
|
|
1934
|
+
get: function () { return chunkQ3SWJZBB_js.ZOD_DTO_SYMBOL; }
|
|
1921
1935
|
});
|
|
1922
1936
|
Object.defineProperty(exports, "ZOD_NEST_DTO_EXTENSION", {
|
|
1923
1937
|
enumerable: true,
|
|
1924
|
-
get: function () { return
|
|
1938
|
+
get: function () { return chunkQ3SWJZBB_js.ZOD_NEST_DTO_EXTENSION; }
|
|
1925
1939
|
});
|
|
1926
1940
|
Object.defineProperty(exports, "ZOD_NEST_ERROR_DUPLICATE_ID", {
|
|
1927
1941
|
enumerable: true,
|
|
1928
|
-
get: function () { return
|
|
1942
|
+
get: function () { return chunkQ3SWJZBB_js.ZOD_NEST_ERROR_DUPLICATE_ID; }
|
|
1929
1943
|
});
|
|
1930
1944
|
Object.defineProperty(exports, "ZOD_NEST_ERROR_EXTENSION", {
|
|
1931
1945
|
enumerable: true,
|
|
1932
|
-
get: function () { return
|
|
1946
|
+
get: function () { return chunkQ3SWJZBB_js.ZOD_NEST_ERROR_EXTENSION; }
|
|
1933
1947
|
});
|
|
1934
1948
|
Object.defineProperty(exports, "ZodNestError", {
|
|
1935
1949
|
enumerable: true,
|
|
1936
|
-
get: function () { return
|
|
1950
|
+
get: function () { return chunkQ3SWJZBB_js.ZodNestError; }
|
|
1937
1951
|
});
|
|
1938
1952
|
Object.defineProperty(exports, "ZodNestUnrepresentableError", {
|
|
1939
1953
|
enumerable: true,
|
|
1940
|
-
get: function () { return
|
|
1954
|
+
get: function () { return chunkQ3SWJZBB_js.ZodNestUnrepresentableError; }
|
|
1941
1955
|
});
|
|
1942
1956
|
Object.defineProperty(exports, "ZodValidationException", {
|
|
1943
1957
|
enumerable: true,
|
|
1944
|
-
get: function () { return
|
|
1958
|
+
get: function () { return chunkQ3SWJZBB_js.ZodValidationException; }
|
|
1945
1959
|
});
|
|
1946
1960
|
Object.defineProperty(exports, "createRegistry", {
|
|
1947
1961
|
enumerable: true,
|
|
1948
|
-
get: function () { return
|
|
1962
|
+
get: function () { return chunkQ3SWJZBB_js.createRegistry; }
|
|
1949
1963
|
});
|
|
1950
1964
|
Object.defineProperty(exports, "defaultRegistry", {
|
|
1951
1965
|
enumerable: true,
|
|
1952
|
-
get: function () { return
|
|
1966
|
+
get: function () { return chunkQ3SWJZBB_js.defaultRegistry; }
|
|
1953
1967
|
});
|
|
1954
1968
|
Object.defineProperty(exports, "extend", {
|
|
1955
1969
|
enumerable: true,
|
|
1956
|
-
get: function () { return
|
|
1970
|
+
get: function () { return chunkQ3SWJZBB_js.extend; }
|
|
1957
1971
|
});
|
|
1958
1972
|
Object.defineProperty(exports, "getLineage", {
|
|
1959
1973
|
enumerable: true,
|
|
1960
|
-
get: function () { return
|
|
1974
|
+
get: function () { return chunkQ3SWJZBB_js.getLineage; }
|
|
1961
1975
|
});
|
|
1962
1976
|
Object.defineProperty(exports, "isZodDto", {
|
|
1963
1977
|
enumerable: true,
|
|
1964
|
-
get: function () { return
|
|
1978
|
+
get: function () { return chunkQ3SWJZBB_js.isZodDto; }
|
|
1965
1979
|
});
|
|
1966
1980
|
Object.defineProperty(exports, "isZodSchema", {
|
|
1967
1981
|
enumerable: true,
|
|
1968
|
-
get: function () { return
|
|
1982
|
+
get: function () { return chunkQ3SWJZBB_js.isZodSchema; }
|
|
1969
1983
|
});
|
|
1970
1984
|
Object.defineProperty(exports, "registerSchema", {
|
|
1971
1985
|
enumerable: true,
|
|
1972
|
-
get: function () { return
|
|
1986
|
+
get: function () { return chunkQ3SWJZBB_js.registerSchema; }
|
|
1973
1987
|
});
|
|
1974
1988
|
Object.defineProperty(exports, "toOpenApi", {
|
|
1975
1989
|
enumerable: true,
|
|
1976
|
-
get: function () { return
|
|
1990
|
+
get: function () { return chunkQ3SWJZBB_js.toOpenApi; }
|
|
1977
1991
|
});
|
|
1978
1992
|
Object.defineProperty(exports, "overrideJSONSchema", {
|
|
1979
1993
|
enumerable: true,
|