zod-nest 3.2.1 → 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-KSDHVGMB.js → chunk-26E2XEJU.js} +10 -10
- package/dist/{chunk-KSDHVGMB.js.map → chunk-26E2XEJU.js.map} +1 -1
- package/dist/{chunk-T4KTFCJW.js → chunk-FKXVNCDD.js} +24 -33
- package/dist/chunk-FKXVNCDD.js.map +1 -0
- package/dist/{chunk-BAG3BDRM.mjs → chunk-LHNXO52A.mjs} +24 -33
- package/dist/chunk-LHNXO52A.mjs.map +1 -0
- package/dist/{chunk-RTWHQFNA.mjs → chunk-RAF7JGS6.mjs} +3 -3
- package/dist/{chunk-RTWHQFNA.mjs.map → chunk-RAF7JGS6.mjs.map} +1 -1
- 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 +74 -74
- package/dist/index.mjs +2 -2
- package/package.json +26 -33
- package/dist/chunk-BAG3BDRM.mjs.map +0 -1
- package/dist/chunk-T4KTFCJW.js.map +0 -1
package/dist/fastify/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../chunk-
|
|
3
|
+
var chunk26E2XEJU_js = require('../chunk-26E2XEJU.js');
|
|
4
|
+
require('../chunk-FKXVNCDD.js');
|
|
5
5
|
require('../chunk-LXRBMFWD.js');
|
|
6
6
|
var chunk4RXGLSPP_js = require('../chunk-4RXGLSPP.js');
|
|
7
7
|
|
|
@@ -11,21 +11,21 @@ var accessors = {
|
|
|
11
11
|
mimeType: /* @__PURE__ */ chunk4RXGLSPP_js.__name((file) => file.mimetype, "mimeType"),
|
|
12
12
|
fileName: /* @__PURE__ */ chunk4RXGLSPP_js.__name((file) => file.filename, "fileName")
|
|
13
13
|
};
|
|
14
|
-
var fastifyMultipartFile = /* @__PURE__ */ chunk4RXGLSPP_js.__name((options) =>
|
|
14
|
+
var fastifyMultipartFile = /* @__PURE__ */ chunk4RXGLSPP_js.__name((options) => chunk26E2XEJU_js.buildFileSchema({
|
|
15
15
|
predicate: isFastifyMultipartFile,
|
|
16
16
|
accessors,
|
|
17
17
|
options
|
|
18
18
|
}), "fastifyMultipartFile");
|
|
19
19
|
var FastifyMultipartFileSchema = fastifyMultipartFile();
|
|
20
|
-
var ZodMultipart =
|
|
20
|
+
var ZodMultipart = chunk26E2XEJU_js.createZodMultipart(chunk26E2XEJU_js.MultipartFilesIn.Body);
|
|
21
21
|
|
|
22
22
|
Object.defineProperty(exports, "MULTIPART_CONTENT_TYPE", {
|
|
23
23
|
enumerable: true,
|
|
24
|
-
get: function () { return
|
|
24
|
+
get: function () { return chunk26E2XEJU_js.MULTIPART_CONTENT_TYPE; }
|
|
25
25
|
});
|
|
26
26
|
Object.defineProperty(exports, "ZodMultipartBody", {
|
|
27
27
|
enumerable: true,
|
|
28
|
-
get: function () { return
|
|
28
|
+
get: function () { return chunk26E2XEJU_js.ZodMultipartBody; }
|
|
29
29
|
});
|
|
30
30
|
exports.FastifyMultipartFileSchema = FastifyMultipartFileSchema;
|
|
31
31
|
exports.ZodMultipart = ZodMultipart;
|
package/dist/fastify/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { createZodMultipart, MultipartFilesIn, buildFileSchema } from '../chunk-
|
|
2
|
-
export { MULTIPART_CONTENT_TYPE, ZodMultipartBody } from '../chunk-
|
|
3
|
-
import '../chunk-
|
|
1
|
+
import { createZodMultipart, MultipartFilesIn, buildFileSchema } from '../chunk-RAF7JGS6.mjs';
|
|
2
|
+
export { MULTIPART_CONTENT_TYPE, ZodMultipartBody } from '../chunk-RAF7JGS6.mjs';
|
|
3
|
+
import '../chunk-LHNXO52A.mjs';
|
|
4
4
|
import '../chunk-WI4JKXT6.mjs';
|
|
5
5
|
import { __name } from '../chunk-ZZW54ETO.mjs';
|
|
6
6
|
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkFKXVNCDD_js = require('./chunk-FKXVNCDD.js');
|
|
4
4
|
var chunk4RXGLSPP_js = require('./chunk-4RXGLSPP.js');
|
|
5
5
|
var common = require('@nestjs/common');
|
|
6
6
|
var zod = require('zod');
|
|
@@ -39,7 +39,7 @@ var buildSiblingClass = /* @__PURE__ */ chunk4RXGLSPP_js.__name((parent, schema)
|
|
|
39
39
|
}
|
|
40
40
|
static schema = schema;
|
|
41
41
|
static io = "output";
|
|
42
|
-
static [
|
|
42
|
+
static [chunkFKXVNCDD_js.ZOD_DTO_SYMBOL] = true;
|
|
43
43
|
static get id() {
|
|
44
44
|
return parent.id;
|
|
45
45
|
}
|
|
@@ -54,7 +54,7 @@ var buildSiblingClass = /* @__PURE__ */ chunk4RXGLSPP_js.__name((parent, schema)
|
|
|
54
54
|
}
|
|
55
55
|
static _OPENAPI_METADATA_FACTORY() {
|
|
56
56
|
return {
|
|
57
|
-
[
|
|
57
|
+
[chunkFKXVNCDD_js.ZOD_NEST_DTO_EXTENSION]: makeZodDtoMarker(parent.id, "output")
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
60
|
};
|
|
@@ -92,14 +92,14 @@ var resolveFallbackId = /* @__PURE__ */ chunk4RXGLSPP_js.__name((className) => {
|
|
|
92
92
|
return fallback;
|
|
93
93
|
}, "resolveFallbackId");
|
|
94
94
|
var createZodDto = /* @__PURE__ */ chunk4RXGLSPP_js.__name((schema, options) => {
|
|
95
|
-
const registry = options?.registry ??
|
|
95
|
+
const registry = options?.registry ?? chunkFKXVNCDD_js.defaultRegistry;
|
|
96
96
|
const io = "input";
|
|
97
97
|
let cachedId;
|
|
98
98
|
const ensureRegistered = /* @__PURE__ */ chunk4RXGLSPP_js.__name((className) => {
|
|
99
99
|
if (cachedId !== void 0) {
|
|
100
100
|
return cachedId;
|
|
101
101
|
}
|
|
102
|
-
const named =
|
|
102
|
+
const named = chunkFKXVNCDD_js.registerSchema(schema, registry, {
|
|
103
103
|
id: options?.id,
|
|
104
104
|
expose: options?.expose
|
|
105
105
|
});
|
|
@@ -119,7 +119,7 @@ var createZodDto = /* @__PURE__ */ chunk4RXGLSPP_js.__name((schema, options) =>
|
|
|
119
119
|
}
|
|
120
120
|
static schema = schema;
|
|
121
121
|
static io = io;
|
|
122
|
-
static [
|
|
122
|
+
static [chunkFKXVNCDD_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__ */ chunk4RXGLSPP_js.__name((schema, options) =>
|
|
|
134
134
|
}
|
|
135
135
|
static _OPENAPI_METADATA_FACTORY() {
|
|
136
136
|
return {
|
|
137
|
-
[
|
|
137
|
+
[chunkFKXVNCDD_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
|
chunk4RXGLSPP_js.__name(_ts_param, "_ts_param");
|
|
421
421
|
var isZodSchema2 = /* @__PURE__ */ chunk4RXGLSPP_js.__name((value) => value !== null && typeof value === "object" && "_zod" in value, "isZodSchema");
|
|
422
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
|
|
423
|
+
var defaultExceptionFactory = /* @__PURE__ */ chunk4RXGLSPP_js.__name((zodError, argMetadata) => new chunkFKXVNCDD_js.ZodValidationException(zodError, argMetadata), "defaultExceptionFactory");
|
|
424
424
|
exports.ZodValidationPipe = class _ZodValidationPipe {
|
|
425
425
|
static {
|
|
426
426
|
chunk4RXGLSPP_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 (!chunkFKXVNCDD_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 (chunkFKXVNCDD_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 (chunkFKXVNCDD_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 = chunkFKXVNCDD_js.isZodDto(optionSchema) ? optionSchema.name : void 0;
|
|
507
|
+
const resolvedSchema = chunkFKXVNCDD_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__ */ chunk4RXGLSPP_js.__name((schema) => {
|
|
|
560
560
|
if (cached !== void 0) {
|
|
561
561
|
return cached;
|
|
562
562
|
}
|
|
563
|
-
const namedId =
|
|
563
|
+
const namedId = chunkFKXVNCDD_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 = chunkFKXVNCDD_js.resolveAnonId(schema, chunkFKXVNCDD_js.ANON_RESPONSE_PREFIX);
|
|
570
|
+
chunkFKXVNCDD_js.registerSchema(schema, chunkFKXVNCDD_js.defaultRegistry, {
|
|
571
571
|
id: anonId,
|
|
572
572
|
anonymous: true
|
|
573
573
|
});
|
|
@@ -578,10 +578,10 @@ var schemaToOutputDto = /* @__PURE__ */ chunk4RXGLSPP_js.__name((schema) => {
|
|
|
578
578
|
return dto;
|
|
579
579
|
}, "schemaToOutputDto");
|
|
580
580
|
var toResponseDto = /* @__PURE__ */ chunk4RXGLSPP_js.__name((entry, index) => {
|
|
581
|
-
if (
|
|
581
|
+
if (chunkFKXVNCDD_js.isZodDto(entry)) {
|
|
582
582
|
return entry;
|
|
583
583
|
}
|
|
584
|
-
if (
|
|
584
|
+
if (chunkFKXVNCDD_js.isZodSchema(entry)) {
|
|
585
585
|
return schemaToOutputDto(entry);
|
|
586
586
|
}
|
|
587
587
|
const where = index === void 0 ? "@ZodResponse({ type })" : `@ZodResponse({ type }) element [${index}]`;
|
|
@@ -774,9 +774,9 @@ var ZodBody = /* @__PURE__ */ chunk4RXGLSPP_js.__name((schema, options) => {
|
|
|
774
774
|
}, "ZodBody");
|
|
775
775
|
var resolveBodySchema = /* @__PURE__ */ chunk4RXGLSPP_js.__name((schema, options) => {
|
|
776
776
|
if (options?.flatten === true) {
|
|
777
|
-
return
|
|
777
|
+
return chunkFKXVNCDD_js.flattenObjectIntersection(schema, options.registry ?? chunkFKXVNCDD_js.defaultRegistry, "@ZodBody");
|
|
778
778
|
}
|
|
779
|
-
return
|
|
779
|
+
return chunkFKXVNCDD_js.resolveSchemaRef(schema, {
|
|
780
780
|
id: options?.id,
|
|
781
781
|
registry: options?.registry,
|
|
782
782
|
deferAnonInline: true
|
|
@@ -811,27 +811,27 @@ var appendQueryMarker = /* @__PURE__ */ chunk4RXGLSPP_js.__name((dtoId, ref) =>
|
|
|
811
811
|
|
|
812
812
|
// src/decorators/zod-query.decorator.ts
|
|
813
813
|
var ZodQuery = /* @__PURE__ */ chunk4RXGLSPP_js.__name((schema, options) => {
|
|
814
|
-
if (!
|
|
815
|
-
throw new
|
|
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.`);
|
|
816
816
|
}
|
|
817
|
-
const registry = options?.registry ??
|
|
818
|
-
const id =
|
|
817
|
+
const registry = options?.registry ?? chunkFKXVNCDD_js.defaultRegistry;
|
|
818
|
+
const id = chunkFKXVNCDD_js.registerSchema(schema, registry, {
|
|
819
819
|
id: options?.id
|
|
820
820
|
});
|
|
821
821
|
if (id !== void 0) {
|
|
822
822
|
return appendQueryMarker(id, options?.ref);
|
|
823
823
|
}
|
|
824
824
|
if (options?.ref === true) {
|
|
825
|
-
throw new
|
|
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.`);
|
|
826
826
|
}
|
|
827
|
-
const expanded =
|
|
827
|
+
const expanded = chunkFKXVNCDD_js.expandObjectSchema(schema, {
|
|
828
828
|
id: options?.id,
|
|
829
829
|
registry,
|
|
830
830
|
decoratorName: "@ZodQuery"
|
|
831
831
|
});
|
|
832
832
|
return common.applyDecorators(...expanded.map(({ name, required, resolution }) => swagger.ApiQuery({
|
|
833
833
|
name,
|
|
834
|
-
schema:
|
|
834
|
+
schema: chunkFKXVNCDD_js.paramSchemaBody(resolution),
|
|
835
835
|
required
|
|
836
836
|
})));
|
|
837
837
|
}, "ZodQuery");
|
|
@@ -841,7 +841,7 @@ var API_PARAMETERS_KEY = "swagger/apiParameters";
|
|
|
841
841
|
|
|
842
842
|
// src/decorators/zod-headers.decorator.ts
|
|
843
843
|
var ZodHeaders = /* @__PURE__ */ chunk4RXGLSPP_js.__name((schema, options) => {
|
|
844
|
-
const expanded =
|
|
844
|
+
const expanded = chunkFKXVNCDD_js.expandObjectSchema(schema, {
|
|
845
845
|
id: options?.id,
|
|
846
846
|
registry: options?.registry,
|
|
847
847
|
decoratorName: "@ZodHeaders"
|
|
@@ -850,7 +850,7 @@ var ZodHeaders = /* @__PURE__ */ chunk4RXGLSPP_js.__name((schema, options) => {
|
|
|
850
850
|
name,
|
|
851
851
|
in: "header",
|
|
852
852
|
required,
|
|
853
|
-
schema:
|
|
853
|
+
schema: chunkFKXVNCDD_js.paramSchemaBody(resolution)
|
|
854
854
|
}));
|
|
855
855
|
return (_target, _propertyKey, descriptor) => {
|
|
856
856
|
const handler = descriptor.value;
|
|
@@ -867,7 +867,7 @@ var ZodHeaders = /* @__PURE__ */ chunk4RXGLSPP_js.__name((schema, options) => {
|
|
|
867
867
|
|
|
868
868
|
// src/decorators/zod-cookies.decorator.ts
|
|
869
869
|
var ZodCookies = /* @__PURE__ */ chunk4RXGLSPP_js.__name((schema, options) => {
|
|
870
|
-
const expanded =
|
|
870
|
+
const expanded = chunkFKXVNCDD_js.expandObjectSchema(schema, {
|
|
871
871
|
id: options?.id,
|
|
872
872
|
registry: options?.registry,
|
|
873
873
|
decoratorName: "@ZodCookies"
|
|
@@ -876,7 +876,7 @@ var ZodCookies = /* @__PURE__ */ chunk4RXGLSPP_js.__name((schema, options) => {
|
|
|
876
876
|
name,
|
|
877
877
|
in: "cookie",
|
|
878
878
|
required,
|
|
879
|
-
schema:
|
|
879
|
+
schema: chunkFKXVNCDD_js.paramSchemaBody(resolution)
|
|
880
880
|
}));
|
|
881
881
|
return (_target, _propertyKey, descriptor) => {
|
|
882
882
|
const handler = descriptor.value;
|
|
@@ -1045,7 +1045,7 @@ var bulkEmit = /* @__PURE__ */ chunk4RXGLSPP_js.__name((opts) => {
|
|
|
1045
1045
|
};
|
|
1046
1046
|
}, "bulkEmit");
|
|
1047
1047
|
var runPass = /* @__PURE__ */ chunk4RXGLSPP_js.__name((opts, io, knownIds) => {
|
|
1048
|
-
const built =
|
|
1048
|
+
const built = chunkFKXVNCDD_js.buildToJsonSchemaOptions({
|
|
1049
1049
|
registry: opts.registry,
|
|
1050
1050
|
io,
|
|
1051
1051
|
override: opts.override,
|
|
@@ -1152,7 +1152,7 @@ var readMarker = /* @__PURE__ */ chunk4RXGLSPP_js.__name((schema) => {
|
|
|
1152
1152
|
if (!isPlainRecord2(schema.properties)) {
|
|
1153
1153
|
return void 0;
|
|
1154
1154
|
}
|
|
1155
|
-
const marker = schema.properties[
|
|
1155
|
+
const marker = schema.properties[chunkFKXVNCDD_js.ZOD_NEST_DTO_EXTENSION];
|
|
1156
1156
|
if (!isZodDtoMarker(marker)) {
|
|
1157
1157
|
return void 0;
|
|
1158
1158
|
}
|
|
@@ -1224,10 +1224,10 @@ var collectRefFromSchema = /* @__PURE__ */ chunk4RXGLSPP_js.__name((schema, clas
|
|
|
1224
1224
|
return;
|
|
1225
1225
|
}
|
|
1226
1226
|
walkRefs(schema, (ref) => {
|
|
1227
|
-
if (!ref.startsWith(
|
|
1227
|
+
if (!ref.startsWith(chunkFKXVNCDD_js.COMPONENTS_SCHEMAS_PREFIX)) {
|
|
1228
1228
|
return void 0;
|
|
1229
1229
|
}
|
|
1230
|
-
const className = ref.slice(
|
|
1230
|
+
const className = ref.slice(chunkFKXVNCDD_js.COMPONENTS_SCHEMAS_PREFIX.length);
|
|
1231
1231
|
const renamed = classToDtoId.get(className);
|
|
1232
1232
|
if (renamed !== void 0) {
|
|
1233
1233
|
ids.add(renamed);
|
|
@@ -1263,7 +1263,7 @@ var collectRefsFromResponses = /* @__PURE__ */ chunk4RXGLSPP_js.__name((response
|
|
|
1263
1263
|
}, "collectRefsFromResponses");
|
|
1264
1264
|
|
|
1265
1265
|
// src/document/errors.ts
|
|
1266
|
-
var ZodNestDocumentError = class extends
|
|
1266
|
+
var ZodNestDocumentError = class extends chunkFKXVNCDD_js.ZodNestError {
|
|
1267
1267
|
static {
|
|
1268
1268
|
chunk4RXGLSPP_js.__name(this, "ZodNestDocumentError");
|
|
1269
1269
|
}
|
|
@@ -1283,10 +1283,10 @@ var assertNoDanglingRefs = /* @__PURE__ */ chunk4RXGLSPP_js.__name((params) => {
|
|
|
1283
1283
|
const schemas = doc.components?.schemas ?? {};
|
|
1284
1284
|
const dangling = [];
|
|
1285
1285
|
walkRefs(doc, (ref) => {
|
|
1286
|
-
if (!ref.startsWith(
|
|
1286
|
+
if (!ref.startsWith(chunkFKXVNCDD_js.COMPONENTS_SCHEMAS_PREFIX)) {
|
|
1287
1287
|
return void 0;
|
|
1288
1288
|
}
|
|
1289
|
-
const target = ref.slice(
|
|
1289
|
+
const target = ref.slice(chunkFKXVNCDD_js.COMPONENTS_SCHEMAS_PREFIX.length);
|
|
1290
1290
|
if (!(target in schemas)) {
|
|
1291
1291
|
dangling.push(ref);
|
|
1292
1292
|
}
|
|
@@ -1302,7 +1302,7 @@ ${lines.join("\n")}`, {
|
|
|
1302
1302
|
});
|
|
1303
1303
|
}, "assertNoDanglingRefs");
|
|
1304
1304
|
var hintFor = /* @__PURE__ */ chunk4RXGLSPP_js.__name((ref, collected) => {
|
|
1305
|
-
const id = ref.slice(
|
|
1305
|
+
const id = ref.slice(chunkFKXVNCDD_js.COMPONENTS_SCHEMAS_PREFIX.length);
|
|
1306
1306
|
const usedInput = collected.inputExposedIds.has(id);
|
|
1307
1307
|
const usedOutput = collected.outputExposedIds.has(id);
|
|
1308
1308
|
if (usedInput && usedOutput) {
|
|
@@ -1381,7 +1381,7 @@ var buildRefQueryParam = /* @__PURE__ */ chunk4RXGLSPP_js.__name((marker, body)
|
|
|
1381
1381
|
style: "form",
|
|
1382
1382
|
explode: true,
|
|
1383
1383
|
schema: {
|
|
1384
|
-
$ref: `${
|
|
1384
|
+
$ref: `${chunkFKXVNCDD_js.COMPONENTS_SCHEMAS_PREFIX}${marker.dtoId}`
|
|
1385
1385
|
}
|
|
1386
1386
|
};
|
|
1387
1387
|
}, "buildRefQueryParam");
|
|
@@ -1457,7 +1457,7 @@ var pruneOrphanObjectSchema = /* @__PURE__ */ chunk4RXGLSPP_js.__name((doc) => {
|
|
|
1457
1457
|
return;
|
|
1458
1458
|
}
|
|
1459
1459
|
let referenced = false;
|
|
1460
|
-
const targetRef = `${
|
|
1460
|
+
const targetRef = `${chunkFKXVNCDD_js.COMPONENTS_SCHEMAS_PREFIX}Object`;
|
|
1461
1461
|
walkRefs(doc, (ref) => {
|
|
1462
1462
|
if (ref === targetRef) {
|
|
1463
1463
|
referenced = true;
|
|
@@ -1487,10 +1487,10 @@ var closeOverRefs = /* @__PURE__ */ chunk4RXGLSPP_js.__name((seed, bodies) => {
|
|
|
1487
1487
|
continue;
|
|
1488
1488
|
}
|
|
1489
1489
|
walkRefs(body, (ref) => {
|
|
1490
|
-
if (!ref.startsWith(
|
|
1490
|
+
if (!ref.startsWith(chunkFKXVNCDD_js.COMPONENTS_SCHEMAS_PREFIX)) {
|
|
1491
1491
|
return void 0;
|
|
1492
1492
|
}
|
|
1493
|
-
const target = ref.slice(
|
|
1493
|
+
const target = ref.slice(chunkFKXVNCDD_js.COMPONENTS_SCHEMAS_PREFIX.length);
|
|
1494
1494
|
if (out.has(target)) {
|
|
1495
1495
|
return void 0;
|
|
1496
1496
|
}
|
|
@@ -1523,7 +1523,7 @@ var inlineAnonymousBodies = /* @__PURE__ */ chunk4RXGLSPP_js.__name(({ doc, regi
|
|
|
1523
1523
|
]) {
|
|
1524
1524
|
const body = schemas[key];
|
|
1525
1525
|
if (isPlainRecord4(body)) {
|
|
1526
|
-
bodyByRef.set(`${
|
|
1526
|
+
bodyByRef.set(`${chunkFKXVNCDD_js.COMPONENTS_SCHEMAS_PREFIX}${key}`, body);
|
|
1527
1527
|
}
|
|
1528
1528
|
}
|
|
1529
1529
|
}
|
|
@@ -1535,7 +1535,7 @@ var inlineAnonymousBodies = /* @__PURE__ */ chunk4RXGLSPP_js.__name(({ doc, regi
|
|
|
1535
1535
|
}
|
|
1536
1536
|
inlineRefs(doc.paths, bodyByRef);
|
|
1537
1537
|
for (const ref of bodyByRef.keys()) {
|
|
1538
|
-
delete schemas[ref.slice(
|
|
1538
|
+
delete schemas[ref.slice(chunkFKXVNCDD_js.COMPONENTS_SCHEMAS_PREFIX.length)];
|
|
1539
1539
|
}
|
|
1540
1540
|
}, "inlineAnonymousBodies");
|
|
1541
1541
|
var refsWithin = /* @__PURE__ */ chunk4RXGLSPP_js.__name((schemas, bodyByRef) => {
|
|
@@ -1673,7 +1673,7 @@ var isMarkerPlaceholder = /* @__PURE__ */ chunk4RXGLSPP_js.__name((value) => {
|
|
|
1673
1673
|
if (properties === null || typeof properties !== "object") {
|
|
1674
1674
|
return false;
|
|
1675
1675
|
}
|
|
1676
|
-
const marker = properties[
|
|
1676
|
+
const marker = properties[chunkFKXVNCDD_js.ZOD_NEST_DTO_EXTENSION];
|
|
1677
1677
|
return isZodDtoMarker(marker);
|
|
1678
1678
|
}, "isMarkerPlaceholder");
|
|
1679
1679
|
var canonicalEqual = /* @__PURE__ */ chunk4RXGLSPP_js.__name((a, b) => {
|
|
@@ -1699,7 +1699,7 @@ var decorateIfPresent = /* @__PURE__ */ chunk4RXGLSPP_js.__name((schemas, key) =
|
|
|
1699
1699
|
}
|
|
1700
1700
|
schemas[key] = {
|
|
1701
1701
|
description: `ERROR: duplicate zod-nest id <${key.replace(/Output$/, "")}>`,
|
|
1702
|
-
[
|
|
1702
|
+
[chunkFKXVNCDD_js.ZOD_NEST_ERROR_EXTENSION]: chunkFKXVNCDD_js.ZOD_NEST_ERROR_DUPLICATE_ID
|
|
1703
1703
|
};
|
|
1704
1704
|
}, "decorateIfPresent");
|
|
1705
1705
|
|
|
@@ -1733,8 +1733,8 @@ var addRefTitles = /* @__PURE__ */ chunk4RXGLSPP_js.__name((node, titleById) =>
|
|
|
1733
1733
|
return;
|
|
1734
1734
|
}
|
|
1735
1735
|
const ref = node.$ref;
|
|
1736
|
-
if (typeof ref === "string" && ref.startsWith(
|
|
1737
|
-
const title = titleById.get(ref.slice(
|
|
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));
|
|
1738
1738
|
if (title !== void 0) {
|
|
1739
1739
|
node.title = title;
|
|
1740
1740
|
}
|
|
@@ -1749,15 +1749,15 @@ var rewriteRefs = /* @__PURE__ */ chunk4RXGLSPP_js.__name((params) => {
|
|
|
1749
1749
|
const { doc, renames, divergentOutputIds } = params;
|
|
1750
1750
|
if (renames.size > 0) {
|
|
1751
1751
|
walkRefs(doc, (ref) => {
|
|
1752
|
-
if (!ref.startsWith(
|
|
1752
|
+
if (!ref.startsWith(chunkFKXVNCDD_js.COMPONENTS_SCHEMAS_PREFIX)) {
|
|
1753
1753
|
return void 0;
|
|
1754
1754
|
}
|
|
1755
|
-
const target = ref.slice(
|
|
1755
|
+
const target = ref.slice(chunkFKXVNCDD_js.COMPONENTS_SCHEMAS_PREFIX.length);
|
|
1756
1756
|
const renamed = renames.get(target);
|
|
1757
1757
|
if (renamed === void 0) {
|
|
1758
1758
|
return void 0;
|
|
1759
1759
|
}
|
|
1760
|
-
return `${
|
|
1760
|
+
return `${chunkFKXVNCDD_js.COMPONENTS_SCHEMAS_PREFIX}${renamed}`;
|
|
1761
1761
|
});
|
|
1762
1762
|
}
|
|
1763
1763
|
if (divergentOutputIds.size === 0) {
|
|
@@ -1782,14 +1782,14 @@ var rewriteResponseSubtree = /* @__PURE__ */ chunk4RXGLSPP_js.__name((pathItem,
|
|
|
1782
1782
|
continue;
|
|
1783
1783
|
}
|
|
1784
1784
|
walkRefs(responses, (ref) => {
|
|
1785
|
-
if (!ref.startsWith(
|
|
1785
|
+
if (!ref.startsWith(chunkFKXVNCDD_js.COMPONENTS_SCHEMAS_PREFIX)) {
|
|
1786
1786
|
return void 0;
|
|
1787
1787
|
}
|
|
1788
|
-
const target = ref.slice(
|
|
1788
|
+
const target = ref.slice(chunkFKXVNCDD_js.COMPONENTS_SCHEMAS_PREFIX.length);
|
|
1789
1789
|
if (!divergentOutputIds.has(target)) {
|
|
1790
1790
|
return void 0;
|
|
1791
1791
|
}
|
|
1792
|
-
return `${
|
|
1792
|
+
return `${chunkFKXVNCDD_js.COMPONENTS_SCHEMAS_PREFIX}${target}${OUTPUT_SUFFIX}`;
|
|
1793
1793
|
});
|
|
1794
1794
|
}
|
|
1795
1795
|
}, "rewriteResponseSubtree");
|
|
@@ -1831,10 +1831,10 @@ var stripMarkerFromSchema = /* @__PURE__ */ chunk4RXGLSPP_js.__name((schema) =>
|
|
|
1831
1831
|
return;
|
|
1832
1832
|
}
|
|
1833
1833
|
const props = properties;
|
|
1834
|
-
if (!(
|
|
1834
|
+
if (!(chunkFKXVNCDD_js.ZOD_NEST_DTO_EXTENSION in props)) {
|
|
1835
1835
|
return;
|
|
1836
1836
|
}
|
|
1837
|
-
delete props[
|
|
1837
|
+
delete props[chunkFKXVNCDD_js.ZOD_NEST_DTO_EXTENSION];
|
|
1838
1838
|
if (Object.keys(props).length === 0) {
|
|
1839
1839
|
delete schema.properties;
|
|
1840
1840
|
}
|
|
@@ -1857,7 +1857,7 @@ var withForcedExposure = /* @__PURE__ */ chunk4RXGLSPP_js.__name((collected, reg
|
|
|
1857
1857
|
}, "withForcedExposure");
|
|
1858
1858
|
var OPENAPI_VERSION = "3.1.0";
|
|
1859
1859
|
var applyZodNest = /* @__PURE__ */ chunk4RXGLSPP_js.__name((doc, opts = {}) => {
|
|
1860
|
-
const registry = opts.registry ??
|
|
1860
|
+
const registry = opts.registry ?? chunkFKXVNCDD_js.defaultRegistry;
|
|
1861
1861
|
const collected = collectUsage(doc, registry);
|
|
1862
1862
|
const exposed = withForcedExposure(collected, registry);
|
|
1863
1863
|
const { inputSchemas, outputSchemas } = bulkEmit({
|
|
@@ -1902,67 +1902,67 @@ var applyZodNest = /* @__PURE__ */ chunk4RXGLSPP_js.__name((doc, opts = {}) => {
|
|
|
1902
1902
|
|
|
1903
1903
|
Object.defineProperty(exports, "COMPONENTS_SCHEMAS_PREFIX", {
|
|
1904
1904
|
enumerable: true,
|
|
1905
|
-
get: function () { return
|
|
1905
|
+
get: function () { return chunkFKXVNCDD_js.COMPONENTS_SCHEMAS_PREFIX; }
|
|
1906
1906
|
});
|
|
1907
1907
|
Object.defineProperty(exports, "ZOD_DTO_SYMBOL", {
|
|
1908
1908
|
enumerable: true,
|
|
1909
|
-
get: function () { return
|
|
1909
|
+
get: function () { return chunkFKXVNCDD_js.ZOD_DTO_SYMBOL; }
|
|
1910
1910
|
});
|
|
1911
1911
|
Object.defineProperty(exports, "ZOD_NEST_DTO_EXTENSION", {
|
|
1912
1912
|
enumerable: true,
|
|
1913
|
-
get: function () { return
|
|
1913
|
+
get: function () { return chunkFKXVNCDD_js.ZOD_NEST_DTO_EXTENSION; }
|
|
1914
1914
|
});
|
|
1915
1915
|
Object.defineProperty(exports, "ZOD_NEST_ERROR_DUPLICATE_ID", {
|
|
1916
1916
|
enumerable: true,
|
|
1917
|
-
get: function () { return
|
|
1917
|
+
get: function () { return chunkFKXVNCDD_js.ZOD_NEST_ERROR_DUPLICATE_ID; }
|
|
1918
1918
|
});
|
|
1919
1919
|
Object.defineProperty(exports, "ZOD_NEST_ERROR_EXTENSION", {
|
|
1920
1920
|
enumerable: true,
|
|
1921
|
-
get: function () { return
|
|
1921
|
+
get: function () { return chunkFKXVNCDD_js.ZOD_NEST_ERROR_EXTENSION; }
|
|
1922
1922
|
});
|
|
1923
1923
|
Object.defineProperty(exports, "ZodNestError", {
|
|
1924
1924
|
enumerable: true,
|
|
1925
|
-
get: function () { return
|
|
1925
|
+
get: function () { return chunkFKXVNCDD_js.ZodNestError; }
|
|
1926
1926
|
});
|
|
1927
1927
|
Object.defineProperty(exports, "ZodNestUnrepresentableError", {
|
|
1928
1928
|
enumerable: true,
|
|
1929
|
-
get: function () { return
|
|
1929
|
+
get: function () { return chunkFKXVNCDD_js.ZodNestUnrepresentableError; }
|
|
1930
1930
|
});
|
|
1931
1931
|
Object.defineProperty(exports, "ZodValidationException", {
|
|
1932
1932
|
enumerable: true,
|
|
1933
|
-
get: function () { return
|
|
1933
|
+
get: function () { return chunkFKXVNCDD_js.ZodValidationException; }
|
|
1934
1934
|
});
|
|
1935
1935
|
Object.defineProperty(exports, "createRegistry", {
|
|
1936
1936
|
enumerable: true,
|
|
1937
|
-
get: function () { return
|
|
1937
|
+
get: function () { return chunkFKXVNCDD_js.createRegistry; }
|
|
1938
1938
|
});
|
|
1939
1939
|
Object.defineProperty(exports, "defaultRegistry", {
|
|
1940
1940
|
enumerable: true,
|
|
1941
|
-
get: function () { return
|
|
1941
|
+
get: function () { return chunkFKXVNCDD_js.defaultRegistry; }
|
|
1942
1942
|
});
|
|
1943
1943
|
Object.defineProperty(exports, "extend", {
|
|
1944
1944
|
enumerable: true,
|
|
1945
|
-
get: function () { return
|
|
1945
|
+
get: function () { return chunkFKXVNCDD_js.extend; }
|
|
1946
1946
|
});
|
|
1947
1947
|
Object.defineProperty(exports, "getLineage", {
|
|
1948
1948
|
enumerable: true,
|
|
1949
|
-
get: function () { return
|
|
1949
|
+
get: function () { return chunkFKXVNCDD_js.getLineage; }
|
|
1950
1950
|
});
|
|
1951
1951
|
Object.defineProperty(exports, "isZodDto", {
|
|
1952
1952
|
enumerable: true,
|
|
1953
|
-
get: function () { return
|
|
1953
|
+
get: function () { return chunkFKXVNCDD_js.isZodDto; }
|
|
1954
1954
|
});
|
|
1955
1955
|
Object.defineProperty(exports, "isZodSchema", {
|
|
1956
1956
|
enumerable: true,
|
|
1957
|
-
get: function () { return
|
|
1957
|
+
get: function () { return chunkFKXVNCDD_js.isZodSchema; }
|
|
1958
1958
|
});
|
|
1959
1959
|
Object.defineProperty(exports, "registerSchema", {
|
|
1960
1960
|
enumerable: true,
|
|
1961
|
-
get: function () { return
|
|
1961
|
+
get: function () { return chunkFKXVNCDD_js.registerSchema; }
|
|
1962
1962
|
});
|
|
1963
1963
|
Object.defineProperty(exports, "toOpenApi", {
|
|
1964
1964
|
enumerable: true,
|
|
1965
|
-
get: function () { return
|
|
1965
|
+
get: function () { return chunkFKXVNCDD_js.toOpenApi; }
|
|
1966
1966
|
});
|
|
1967
1967
|
Object.defineProperty(exports, "overrideJSONSchema", {
|
|
1968
1968
|
enumerable: true,
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { isZodDto, ZodNestError, ZodValidationException, defaultRegistry, ZOD_DTO_SYMBOL, ZOD_NEST_DTO_EXTENSION, flattenObjectIntersection, resolveSchemaRef, isZodObject, registerSchema, expandObjectSchema, paramSchemaBody, COMPONENTS_SCHEMAS_PREFIX, isZodSchema, buildToJsonSchemaOptions, resolveAnonId, ANON_RESPONSE_PREFIX, ZOD_NEST_ERROR_DUPLICATE_ID, ZOD_NEST_ERROR_EXTENSION } from './chunk-
|
|
2
|
-
export { COMPONENTS_SCHEMAS_PREFIX, ZOD_DTO_SYMBOL, ZOD_NEST_DTO_EXTENSION, ZOD_NEST_ERROR_DUPLICATE_ID, ZOD_NEST_ERROR_EXTENSION, ZodNestError, ZodNestUnrepresentableError, ZodValidationException, createRegistry, defaultRegistry, extend, getLineage, isZodDto, isZodSchema, registerSchema, toOpenApi } from './chunk-
|
|
1
|
+
import { isZodDto, ZodNestError, ZodValidationException, defaultRegistry, ZOD_DTO_SYMBOL, ZOD_NEST_DTO_EXTENSION, flattenObjectIntersection, resolveSchemaRef, isZodObject, registerSchema, expandObjectSchema, paramSchemaBody, COMPONENTS_SCHEMAS_PREFIX, isZodSchema, buildToJsonSchemaOptions, resolveAnonId, ANON_RESPONSE_PREFIX, ZOD_NEST_ERROR_DUPLICATE_ID, ZOD_NEST_ERROR_EXTENSION } from './chunk-LHNXO52A.mjs';
|
|
2
|
+
export { COMPONENTS_SCHEMAS_PREFIX, ZOD_DTO_SYMBOL, ZOD_NEST_DTO_EXTENSION, ZOD_NEST_ERROR_DUPLICATE_ID, ZOD_NEST_ERROR_EXTENSION, ZodNestError, ZodNestUnrepresentableError, ZodValidationException, createRegistry, defaultRegistry, extend, getLineage, isZodDto, isZodSchema, registerSchema, toOpenApi } from './chunk-LHNXO52A.mjs';
|
|
3
3
|
import { singleton, __name } from './chunk-ZZW54ETO.mjs';
|
|
4
4
|
export { overrideJSONSchema } from './chunk-ZZW54ETO.mjs';
|
|
5
5
|
import { InternalServerErrorException, HttpStatus, Injectable, Optional, Inject, Logger, RequestMethod, applyDecorators } from '@nestjs/common';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zod-nest",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.2",
|
|
4
4
|
"description": "Modern Zod v4-only NestJS + OpenAPI 3.1 integration. Successor to nestjs-zod.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Rodrigo Azevedo",
|
|
@@ -30,47 +30,40 @@
|
|
|
30
30
|
"types": "./dist/index.d.ts",
|
|
31
31
|
"exports": {
|
|
32
32
|
".": {
|
|
33
|
-
"
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
},
|
|
37
|
-
"require": {
|
|
38
|
-
"types": "./dist/index.d.ts",
|
|
39
|
-
"default": "./dist/index.js"
|
|
40
|
-
}
|
|
33
|
+
"types": "./dist/index.d.ts",
|
|
34
|
+
"import": "./dist/index.mjs",
|
|
35
|
+
"require": "./dist/index.js"
|
|
41
36
|
},
|
|
42
37
|
"./helpers": {
|
|
43
|
-
"
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
},
|
|
47
|
-
"require": {
|
|
48
|
-
"types": "./dist/helpers/index.d.ts",
|
|
49
|
-
"default": "./dist/helpers/index.js"
|
|
50
|
-
}
|
|
38
|
+
"types": "./dist/helpers/index.d.ts",
|
|
39
|
+
"import": "./dist/helpers/index.mjs",
|
|
40
|
+
"require": "./dist/helpers/index.js"
|
|
51
41
|
},
|
|
52
42
|
"./express": {
|
|
53
|
-
"
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
},
|
|
57
|
-
"require": {
|
|
58
|
-
"types": "./dist/express/index.d.ts",
|
|
59
|
-
"default": "./dist/express/index.js"
|
|
60
|
-
}
|
|
43
|
+
"types": "./dist/express/index.d.ts",
|
|
44
|
+
"import": "./dist/express/index.mjs",
|
|
45
|
+
"require": "./dist/express/index.js"
|
|
61
46
|
},
|
|
62
47
|
"./fastify": {
|
|
63
|
-
"
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
},
|
|
67
|
-
"require": {
|
|
68
|
-
"types": "./dist/fastify/index.d.ts",
|
|
69
|
-
"default": "./dist/fastify/index.js"
|
|
70
|
-
}
|
|
48
|
+
"types": "./dist/fastify/index.d.ts",
|
|
49
|
+
"import": "./dist/fastify/index.mjs",
|
|
50
|
+
"require": "./dist/fastify/index.js"
|
|
71
51
|
},
|
|
72
52
|
"./package.json": "./package.json"
|
|
73
53
|
},
|
|
54
|
+
"typesVersions": {
|
|
55
|
+
"*": {
|
|
56
|
+
"helpers": [
|
|
57
|
+
"dist/helpers/index.d.ts"
|
|
58
|
+
],
|
|
59
|
+
"express": [
|
|
60
|
+
"dist/express/index.d.ts"
|
|
61
|
+
],
|
|
62
|
+
"fastify": [
|
|
63
|
+
"dist/fastify/index.d.ts"
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
},
|
|
74
67
|
"files": [
|
|
75
68
|
"dist",
|
|
76
69
|
"LICENSE",
|