zod-nest 3.2.3 → 3.2.5
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-6FL3HR4I.js → chunk-BYRNJLNK.js} +31 -15
- package/dist/chunk-BYRNJLNK.js.map +1 -0
- package/dist/{chunk-DUQLL62I.js → chunk-Q3SWJZBB.js} +3 -8
- package/dist/chunk-Q3SWJZBB.js.map +1 -0
- package/dist/{chunk-47ML6LKE.mjs → chunk-T4H5ECKV.mjs} +27 -11
- package/dist/chunk-T4H5ECKV.mjs.map +1 -0
- package/dist/{chunk-7IPDYJNI.mjs → chunk-YRTGPVSJ.mjs} +3 -8
- package/dist/chunk-YRTGPVSJ.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 +9 -9
- package/dist/express/index.mjs +3 -3
- package/dist/fastify/index.d.mts +3 -3
- package/dist/fastify/index.d.ts +3 -3
- package/dist/fastify/index.js +6 -6
- package/dist/fastify/index.mjs +3 -3
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +92 -76
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +21 -5
- package/dist/index.mjs.map +1 -1
- package/dist/{param-decorators-Dfd2Cy08.d.mts → param-decorators-1UCi-qHq.d.mts} +1 -1
- package/dist/{param-decorators-23pStLeF.d.ts → param-decorators-CcuRJZXu.d.ts} +1 -1
- package/dist/{registry-Cs1Y0a-L.d.mts → registry-D99yMzJg.d.mts} +3 -2
- package/dist/{registry-Cs1Y0a-L.d.ts → registry-D99yMzJg.d.ts} +3 -2
- package/package.json +1 -1
- package/dist/chunk-47ML6LKE.mjs.map +0 -1
- package/dist/chunk-6FL3HR4I.js.map +0 -1
- package/dist/chunk-7IPDYJNI.mjs.map +0 -1
- package/dist/chunk-DUQLL62I.js.map +0 -1
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-YRTGPVSJ.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-YRTGPVSJ.mjs';
|
|
3
3
|
import { singleton, __name } from './chunk-MPNAA53V.mjs';
|
|
4
4
|
export { overrideJSONSchema } from './chunk-MPNAA53V.mjs';
|
|
5
5
|
import { InternalServerErrorException, HttpStatus, Injectable, Optional, Inject, Logger, RequestMethod, applyDecorators } from '@nestjs/common';
|
|
@@ -769,12 +769,17 @@ var ZodBody = /* @__PURE__ */ __name((schema, options) => {
|
|
|
769
769
|
});
|
|
770
770
|
}, "ZodBody");
|
|
771
771
|
var resolveBodySchema = /* @__PURE__ */ __name((schema, options) => {
|
|
772
|
+
const registry = options?.registry ?? defaultRegistry;
|
|
772
773
|
if (options?.flatten === true) {
|
|
773
|
-
|
|
774
|
+
const merged = flattenObjectIntersection(schema, registry, "@ZodBody");
|
|
775
|
+
return resolveSchemaRef(merged, {
|
|
776
|
+
registry,
|
|
777
|
+
deferAnonInline: true
|
|
778
|
+
}).ref;
|
|
774
779
|
}
|
|
775
780
|
return resolveSchemaRef(schema, {
|
|
776
781
|
id: options?.id,
|
|
777
|
-
registry
|
|
782
|
+
registry,
|
|
778
783
|
deferAnonInline: true
|
|
779
784
|
}).ref;
|
|
780
785
|
}, "resolveBodySchema");
|
|
@@ -1040,6 +1045,17 @@ var bulkEmit = /* @__PURE__ */ __name((opts) => {
|
|
|
1040
1045
|
outputSchemas: runPass(opts, "output", knownIds)
|
|
1041
1046
|
};
|
|
1042
1047
|
}, "bulkEmit");
|
|
1048
|
+
var scopeToKnownIds = /* @__PURE__ */ __name((zodRegistry, knownIds) => {
|
|
1049
|
+
const scoped = z.registry();
|
|
1050
|
+
for (const [id, schema] of zodRegistry._idmap) {
|
|
1051
|
+
if (knownIds.has(id)) {
|
|
1052
|
+
scoped.add(schema, {
|
|
1053
|
+
id
|
|
1054
|
+
});
|
|
1055
|
+
}
|
|
1056
|
+
}
|
|
1057
|
+
return scoped;
|
|
1058
|
+
}, "scopeToKnownIds");
|
|
1043
1059
|
var runPass = /* @__PURE__ */ __name((opts, io, knownIds) => {
|
|
1044
1060
|
const built = buildToJsonSchemaOptions({
|
|
1045
1061
|
registry: opts.registry,
|
|
@@ -1049,7 +1065,7 @@ var runPass = /* @__PURE__ */ __name((opts, io, knownIds) => {
|
|
|
1049
1065
|
reused: "inline",
|
|
1050
1066
|
uri: URI
|
|
1051
1067
|
});
|
|
1052
|
-
const raw = z.toJSONSchema(opts.registry.zodRegistry, built.options);
|
|
1068
|
+
const raw = z.toJSONSchema(scopeToKnownIds(opts.registry.zodRegistry, knownIds), built.options);
|
|
1053
1069
|
built.consumeUnrepresentable();
|
|
1054
1070
|
const filtered = /* @__PURE__ */ new Map();
|
|
1055
1071
|
for (const [id, schema] of Object.entries(raw.schemas)) {
|