@temporary-name/zod 1.9.3-alpha.76a5d8c6a7525b4b17df3f9565304645f0922ab3 → 1.9.3-alpha.7af249c626ccabe97d83025ab05ba3fbad2321c8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +3 -14
- package/dist/index.d.ts +3 -14
- package/dist/index.mjs +1 -56
- package/package.json +4 -11
- package/dist/zod4/index.d.mts +0 -12
- package/dist/zod4/index.d.ts +0 -12
- package/dist/zod4/index.mjs +0 -259
package/dist/index.d.mts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import * as core from 'zod/v4/core';
|
|
2
|
-
import { $ZodError, util
|
|
2
|
+
import { $ZodError, util } from 'zod/v4/core';
|
|
3
3
|
export { core };
|
|
4
4
|
export { $RefinementCtx as RefinementCtx, _endsWith as endsWith, _gt as gt, _gte as gte, _includes as includes, infer, input, _length as length, _lowercase as lowercase, _lt as lt, _lte as lte, _maxLength as maxLength, _maxSize as maxSize, _mime as mime, _minLength as minLength, _minSize as minSize, _multipleOf as multipleOf, _negative as negative, _nonnegative as nonnegative, _nonpositive as nonpositive, _normalize as normalize, output, _overwrite as overwrite, _positive as positive, _property as property, _regex as regex, _size as size, _startsWith as startsWith, _toLowerCase as toLowerCase, _toUpperCase as toUpperCase, _trim as trim, _uppercase as uppercase } from 'zod/v4/core';
|
|
5
5
|
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
6
|
-
import { CustomErrorParams, ZodType, ZodTypeDef } from 'zod/v3';
|
|
7
6
|
|
|
8
7
|
/** @deprecated Use `z.core.$ZodIssue` from `@zod/core` instead, especially if you are building a library on top of Zod. */
|
|
9
8
|
type ZodIssue = core.$ZodIssue;
|
|
@@ -133,14 +132,6 @@ interface ZodDiscriminatedUnion<Options extends readonly core.SomeType[] = reado
|
|
|
133
132
|
declare const ZodDiscriminatedUnion: core.$constructor<ZodDiscriminatedUnion>;
|
|
134
133
|
declare function discriminatedUnion<Types extends readonly [core.$ZodTypeDiscriminable, ...core.$ZodTypeDiscriminable[]], Disc extends string, K extends KrustyInternals = KrustyInternals>(discriminator: Disc, options: Types, params?: string | core.$ZodDiscriminatedUnionParams): ZodDiscriminatedUnion<Types, Disc, K>;
|
|
135
134
|
|
|
136
|
-
type CustomParams = CustomErrorParams & {
|
|
137
|
-
fatal?: boolean;
|
|
138
|
-
};
|
|
139
|
-
|
|
140
|
-
declare function blob(params?: string | CustomParams | ((input: unknown) => CustomParams)): ZodType<Blob, ZodTypeDef, Blob>;
|
|
141
|
-
|
|
142
|
-
declare function regexp(params?: string | CustomParams | ((input: unknown) => CustomParams)): ZodType<RegExp, ZodTypeDef, RegExp>;
|
|
143
|
-
|
|
144
135
|
interface KrustyInternals<GateNames extends string = string> {
|
|
145
136
|
gateNames: GateNames;
|
|
146
137
|
}
|
|
@@ -748,7 +739,5 @@ declare class SchemaClass<GateNames extends string = string, K extends KrustyInt
|
|
|
748
739
|
json(params?: string | core.$ZodCustomParams): ZodJSONSchema<K>;
|
|
749
740
|
}
|
|
750
741
|
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
export { $ZodGate, KrustyType, SchemaClass, ZodAny, ZodArray, ZodBase64, ZodBase64URL, ZodBigInt, ZodBigIntFormat, ZodBoolean, ZodCIDRv4, ZodCIDRv6, ZodCUID, ZodCUID2, ZodCatch, ZodCodec, ZodCustom, ZodCustomStringFormat, ZodDate, ZodDefault, ZodDiscriminatedUnion, ZodE164, ZodEmail, ZodEmoji, ZodEnum, ZodError, ZodFile, ZodFunction, ZodGUID, ZodGate, ZodIPv4, ZodIPv6, ZodIntersection, ZodJWT, ZodKSUID, ZodLazy, ZodLiteral, ZodMap, ZodNaN, ZodNanoID, ZodNever, ZodNonOptional, ZodNull, ZodNullable, ZodNumber, ZodNumberFormat, ZodObject, ZodOptional, ZodPipe, ZodPrefault, ZodPromise, ZodReadonly, ZodRealError, ZodRecord, ZodSet, ZodString, ZodStringFormat, ZodSuccess, ZodSymbol, ZodTemplateLiteral, ZodTransform, ZodTuple, ZodULID, ZodURL, ZodUUID, ZodUndefined, ZodUnion, ZodUnknown, ZodVoid, ZodXID, _ZodString, _default, _function, any, array, base64, base64url, bigint, blob, boolean, _catch as catch, check, cidrv4, cidrv6, codec, cuid, cuid2, custom, date, decode, decodeAsync, discriminatedUnion, e164, email, emoji, encode, encodeAsync, _enum as enum, file, float32, float64, _function as function, gate, gatingContext, guid, hash, hex, hostname, httpUrl, _instanceof as instanceof, int, int32, int64, intersection, ipv4, ipv6, isGateIssue, isGateIssueRaw, json, jwt, keyof, ksuid, lazy, literal, looseObject, map, nan, nanoid, nativeEnum, never, nonoptional, _null as null, nullable, nullish, number, object, optional, parse, parseAsync, partialRecord, pipe, prefault, preprocess, promise, readonly, record, refine, regexp, safeDecode, safeDecodeAsync, safeEncode, safeEncodeAsync, safeParse, safeParseAsync, set, strictObject, string, stringFormat, stringbool, success, superRefine, symbol, templateLiteral, transform, tuple, uint32, uint64, ulid, _undefined as undefined, union, unknown, url, uuid, uuidv4, uuidv6, uuidv7, _void as void, xid };
|
|
754
|
-
export type { $ZodGateDef, $ZodGateInternals, AnySchema, IsGateEnabled, IssueData, KrustyInternals, SafeExtendShape, ZodFloat32, ZodFloat64, ZodInt, ZodInt32, ZodIssue, ZodJSONSchema, ZodJSONSchemaInternals, ZodSafeParseError, ZodSafeParseResult, ZodSafeParseSuccess, ZodUInt32, _KrustyType, _ZodBigInt, _ZodBoolean, _ZodDate, _ZodNumber };
|
|
742
|
+
export { $ZodGate, KrustyType, SchemaClass, ZodAny, ZodArray, ZodBase64, ZodBase64URL, ZodBigInt, ZodBigIntFormat, ZodBoolean, ZodCIDRv4, ZodCIDRv6, ZodCUID, ZodCUID2, ZodCatch, ZodCodec, ZodCustom, ZodCustomStringFormat, ZodDate, ZodDefault, ZodDiscriminatedUnion, ZodE164, ZodEmail, ZodEmoji, ZodEnum, ZodError, ZodFile, ZodFunction, ZodGUID, ZodGate, ZodIPv4, ZodIPv6, ZodIntersection, ZodJWT, ZodKSUID, ZodLazy, ZodLiteral, ZodMap, ZodNaN, ZodNanoID, ZodNever, ZodNonOptional, ZodNull, ZodNullable, ZodNumber, ZodNumberFormat, ZodObject, ZodOptional, ZodPipe, ZodPrefault, ZodPromise, ZodReadonly, ZodRealError, ZodRecord, ZodSet, ZodString, ZodStringFormat, ZodSuccess, ZodSymbol, ZodTemplateLiteral, ZodTransform, ZodTuple, ZodULID, ZodURL, ZodUUID, ZodUndefined, ZodUnion, ZodUnknown, ZodVoid, ZodXID, _ZodString, _default, _function, any, array, base64, base64url, bigint, boolean, _catch as catch, check, cidrv4, cidrv6, codec, cuid, cuid2, custom, date, decode, decodeAsync, discriminatedUnion, e164, email, emoji, encode, encodeAsync, _enum as enum, file, float32, float64, _function as function, gate, gatingContext, guid, hash, hex, hostname, httpUrl, _instanceof as instanceof, int, int32, int64, intersection, ipv4, ipv6, isGateIssue, isGateIssueRaw, json, jwt, keyof, ksuid, lazy, literal, looseObject, map, nan, nanoid, nativeEnum, never, nonoptional, _null as null, nullable, nullish, number, object, optional, parse, parseAsync, partialRecord, pipe, prefault, preprocess, promise, readonly, record, refine, safeDecode, safeDecodeAsync, safeEncode, safeEncodeAsync, safeParse, safeParseAsync, set, strictObject, string, stringFormat, stringbool, success, superRefine, symbol, templateLiteral, transform, tuple, uint32, uint64, ulid, _undefined as undefined, union, unknown, url, uuid, uuidv4, uuidv6, uuidv7, _void as void, xid };
|
|
743
|
+
export type { $ZodGateDef, $ZodGateInternals, IsGateEnabled, IssueData, KrustyInternals, SafeExtendShape, ZodFloat32, ZodFloat64, ZodInt, ZodInt32, ZodIssue, ZodJSONSchema, ZodJSONSchemaInternals, ZodSafeParseError, ZodSafeParseResult, ZodSafeParseSuccess, ZodUInt32, _KrustyType, _ZodBigInt, _ZodBoolean, _ZodDate, _ZodNumber };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import * as core from 'zod/v4/core';
|
|
2
|
-
import { $ZodError, util
|
|
2
|
+
import { $ZodError, util } from 'zod/v4/core';
|
|
3
3
|
export { core };
|
|
4
4
|
export { $RefinementCtx as RefinementCtx, _endsWith as endsWith, _gt as gt, _gte as gte, _includes as includes, infer, input, _length as length, _lowercase as lowercase, _lt as lt, _lte as lte, _maxLength as maxLength, _maxSize as maxSize, _mime as mime, _minLength as minLength, _minSize as minSize, _multipleOf as multipleOf, _negative as negative, _nonnegative as nonnegative, _nonpositive as nonpositive, _normalize as normalize, output, _overwrite as overwrite, _positive as positive, _property as property, _regex as regex, _size as size, _startsWith as startsWith, _toLowerCase as toLowerCase, _toUpperCase as toUpperCase, _trim as trim, _uppercase as uppercase } from 'zod/v4/core';
|
|
5
5
|
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
6
|
-
import { CustomErrorParams, ZodType, ZodTypeDef } from 'zod/v3';
|
|
7
6
|
|
|
8
7
|
/** @deprecated Use `z.core.$ZodIssue` from `@zod/core` instead, especially if you are building a library on top of Zod. */
|
|
9
8
|
type ZodIssue = core.$ZodIssue;
|
|
@@ -133,14 +132,6 @@ interface ZodDiscriminatedUnion<Options extends readonly core.SomeType[] = reado
|
|
|
133
132
|
declare const ZodDiscriminatedUnion: core.$constructor<ZodDiscriminatedUnion>;
|
|
134
133
|
declare function discriminatedUnion<Types extends readonly [core.$ZodTypeDiscriminable, ...core.$ZodTypeDiscriminable[]], Disc extends string, K extends KrustyInternals = KrustyInternals>(discriminator: Disc, options: Types, params?: string | core.$ZodDiscriminatedUnionParams): ZodDiscriminatedUnion<Types, Disc, K>;
|
|
135
134
|
|
|
136
|
-
type CustomParams = CustomErrorParams & {
|
|
137
|
-
fatal?: boolean;
|
|
138
|
-
};
|
|
139
|
-
|
|
140
|
-
declare function blob(params?: string | CustomParams | ((input: unknown) => CustomParams)): ZodType<Blob, ZodTypeDef, Blob>;
|
|
141
|
-
|
|
142
|
-
declare function regexp(params?: string | CustomParams | ((input: unknown) => CustomParams)): ZodType<RegExp, ZodTypeDef, RegExp>;
|
|
143
|
-
|
|
144
135
|
interface KrustyInternals<GateNames extends string = string> {
|
|
145
136
|
gateNames: GateNames;
|
|
146
137
|
}
|
|
@@ -748,7 +739,5 @@ declare class SchemaClass<GateNames extends string = string, K extends KrustyInt
|
|
|
748
739
|
json(params?: string | core.$ZodCustomParams): ZodJSONSchema<K>;
|
|
749
740
|
}
|
|
750
741
|
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
export { $ZodGate, KrustyType, SchemaClass, ZodAny, ZodArray, ZodBase64, ZodBase64URL, ZodBigInt, ZodBigIntFormat, ZodBoolean, ZodCIDRv4, ZodCIDRv6, ZodCUID, ZodCUID2, ZodCatch, ZodCodec, ZodCustom, ZodCustomStringFormat, ZodDate, ZodDefault, ZodDiscriminatedUnion, ZodE164, ZodEmail, ZodEmoji, ZodEnum, ZodError, ZodFile, ZodFunction, ZodGUID, ZodGate, ZodIPv4, ZodIPv6, ZodIntersection, ZodJWT, ZodKSUID, ZodLazy, ZodLiteral, ZodMap, ZodNaN, ZodNanoID, ZodNever, ZodNonOptional, ZodNull, ZodNullable, ZodNumber, ZodNumberFormat, ZodObject, ZodOptional, ZodPipe, ZodPrefault, ZodPromise, ZodReadonly, ZodRealError, ZodRecord, ZodSet, ZodString, ZodStringFormat, ZodSuccess, ZodSymbol, ZodTemplateLiteral, ZodTransform, ZodTuple, ZodULID, ZodURL, ZodUUID, ZodUndefined, ZodUnion, ZodUnknown, ZodVoid, ZodXID, _ZodString, _default, _function, any, array, base64, base64url, bigint, blob, boolean, _catch as catch, check, cidrv4, cidrv6, codec, cuid, cuid2, custom, date, decode, decodeAsync, discriminatedUnion, e164, email, emoji, encode, encodeAsync, _enum as enum, file, float32, float64, _function as function, gate, gatingContext, guid, hash, hex, hostname, httpUrl, _instanceof as instanceof, int, int32, int64, intersection, ipv4, ipv6, isGateIssue, isGateIssueRaw, json, jwt, keyof, ksuid, lazy, literal, looseObject, map, nan, nanoid, nativeEnum, never, nonoptional, _null as null, nullable, nullish, number, object, optional, parse, parseAsync, partialRecord, pipe, prefault, preprocess, promise, readonly, record, refine, regexp, safeDecode, safeDecodeAsync, safeEncode, safeEncodeAsync, safeParse, safeParseAsync, set, strictObject, string, stringFormat, stringbool, success, superRefine, symbol, templateLiteral, transform, tuple, uint32, uint64, ulid, _undefined as undefined, union, unknown, url, uuid, uuidv4, uuidv6, uuidv7, _void as void, xid };
|
|
754
|
-
export type { $ZodGateDef, $ZodGateInternals, AnySchema, IsGateEnabled, IssueData, KrustyInternals, SafeExtendShape, ZodFloat32, ZodFloat64, ZodInt, ZodInt32, ZodIssue, ZodJSONSchema, ZodJSONSchemaInternals, ZodSafeParseError, ZodSafeParseResult, ZodSafeParseSuccess, ZodUInt32, _KrustyType, _ZodBigInt, _ZodBoolean, _ZodDate, _ZodNumber };
|
|
742
|
+
export { $ZodGate, KrustyType, SchemaClass, ZodAny, ZodArray, ZodBase64, ZodBase64URL, ZodBigInt, ZodBigIntFormat, ZodBoolean, ZodCIDRv4, ZodCIDRv6, ZodCUID, ZodCUID2, ZodCatch, ZodCodec, ZodCustom, ZodCustomStringFormat, ZodDate, ZodDefault, ZodDiscriminatedUnion, ZodE164, ZodEmail, ZodEmoji, ZodEnum, ZodError, ZodFile, ZodFunction, ZodGUID, ZodGate, ZodIPv4, ZodIPv6, ZodIntersection, ZodJWT, ZodKSUID, ZodLazy, ZodLiteral, ZodMap, ZodNaN, ZodNanoID, ZodNever, ZodNonOptional, ZodNull, ZodNullable, ZodNumber, ZodNumberFormat, ZodObject, ZodOptional, ZodPipe, ZodPrefault, ZodPromise, ZodReadonly, ZodRealError, ZodRecord, ZodSet, ZodString, ZodStringFormat, ZodSuccess, ZodSymbol, ZodTemplateLiteral, ZodTransform, ZodTuple, ZodULID, ZodURL, ZodUUID, ZodUndefined, ZodUnion, ZodUnknown, ZodVoid, ZodXID, _ZodString, _default, _function, any, array, base64, base64url, bigint, boolean, _catch as catch, check, cidrv4, cidrv6, codec, cuid, cuid2, custom, date, decode, decodeAsync, discriminatedUnion, e164, email, emoji, encode, encodeAsync, _enum as enum, file, float32, float64, _function as function, gate, gatingContext, guid, hash, hex, hostname, httpUrl, _instanceof as instanceof, int, int32, int64, intersection, ipv4, ipv6, isGateIssue, isGateIssueRaw, json, jwt, keyof, ksuid, lazy, literal, looseObject, map, nan, nanoid, nativeEnum, never, nonoptional, _null as null, nullable, nullish, number, object, optional, parse, parseAsync, partialRecord, pipe, prefault, preprocess, promise, readonly, record, refine, safeDecode, safeDecodeAsync, safeEncode, safeEncodeAsync, safeParse, safeParseAsync, set, strictObject, string, stringFormat, stringbool, success, superRefine, symbol, templateLiteral, transform, tuple, uint32, uint64, ulid, _undefined as undefined, union, unknown, url, uuid, uuidv4, uuidv6, uuidv7, _void as void, xid };
|
|
743
|
+
export type { $ZodGateDef, $ZodGateInternals, IsGateEnabled, IssueData, KrustyInternals, SafeExtendShape, ZodFloat32, ZodFloat64, ZodInt, ZodInt32, ZodIssue, ZodJSONSchema, ZodJSONSchemaInternals, ZodSafeParseError, ZodSafeParseResult, ZodSafeParseSuccess, ZodUInt32, _KrustyType, _ZodBigInt, _ZodBoolean, _ZodDate, _ZodNumber };
|
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,6 @@ import { $ZodError, util, _overwrite, _regex, _includes, _startsWith, _endsWith,
|
|
|
3
3
|
export { core };
|
|
4
4
|
export { _endsWith as endsWith, _gt as gt, _gte as gte, _includes as includes, _length as length, _lowercase as lowercase, _lt as lt, _lte as lte, _maxLength as maxLength, _maxSize as maxSize, _mime as mime, _minLength as minLength, _minSize as minSize, _multipleOf as multipleOf, _negative as negative, _nonnegative as nonnegative, _nonpositive as nonpositive, _normalize as normalize, _overwrite as overwrite, _positive as positive, _property as property, _regex as regex, _size as size, _startsWith as startsWith, _toLowerCase as toLowerCase, _toUpperCase as toUpperCase, _trim as trim, _uppercase as uppercase } from 'zod/v4/core';
|
|
5
5
|
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
6
|
-
import { custom as custom$1 } from 'zod/v3';
|
|
7
6
|
|
|
8
7
|
const initializer = (inst, issues) => {
|
|
9
8
|
$ZodError.init(inst, issues);
|
|
@@ -311,60 +310,6 @@ function looseObject(shape, params) {
|
|
|
311
310
|
});
|
|
312
311
|
}
|
|
313
312
|
|
|
314
|
-
const CUSTOM_ZOD_DEF_SYMBOL = Symbol("ORPC_CUSTOM_ZOD_DEF");
|
|
315
|
-
function setCustomZodDef(def, custom) {
|
|
316
|
-
Object.assign(def, { [CUSTOM_ZOD_DEF_SYMBOL]: custom });
|
|
317
|
-
}
|
|
318
|
-
function composeParams(defaultMessage, params) {
|
|
319
|
-
return (val) => {
|
|
320
|
-
const message = defaultMessage(val);
|
|
321
|
-
if (!params) {
|
|
322
|
-
return {
|
|
323
|
-
message
|
|
324
|
-
};
|
|
325
|
-
}
|
|
326
|
-
if (typeof params === "function") {
|
|
327
|
-
return {
|
|
328
|
-
message,
|
|
329
|
-
...params(val)
|
|
330
|
-
};
|
|
331
|
-
}
|
|
332
|
-
if (typeof params === "object") {
|
|
333
|
-
return {
|
|
334
|
-
message,
|
|
335
|
-
...params
|
|
336
|
-
};
|
|
337
|
-
}
|
|
338
|
-
return {
|
|
339
|
-
message: params
|
|
340
|
-
};
|
|
341
|
-
};
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
function blob(params) {
|
|
345
|
-
const schema = custom$1(
|
|
346
|
-
(val) => val instanceof Blob,
|
|
347
|
-
composeParams(
|
|
348
|
-
() => "Input is not a blob",
|
|
349
|
-
params
|
|
350
|
-
)
|
|
351
|
-
);
|
|
352
|
-
setCustomZodDef(schema._def, { type: "blob" });
|
|
353
|
-
return schema;
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
function regexp(params) {
|
|
357
|
-
const schema = custom$1(
|
|
358
|
-
(val) => val instanceof RegExp,
|
|
359
|
-
composeParams(
|
|
360
|
-
() => "Input is not a regexp",
|
|
361
|
-
params
|
|
362
|
-
)
|
|
363
|
-
);
|
|
364
|
-
setCustomZodDef(schema._def, { type: "regexp" });
|
|
365
|
-
return schema;
|
|
366
|
-
}
|
|
367
|
-
|
|
368
313
|
const KrustyType = /* @__PURE__ */ core.$constructor(
|
|
369
314
|
"KrustyType",
|
|
370
315
|
(inst, def) => {
|
|
@@ -1571,4 +1516,4 @@ class SchemaClass {
|
|
|
1571
1516
|
*/
|
|
1572
1517
|
}
|
|
1573
1518
|
|
|
1574
|
-
export { KrustyType, SchemaClass, ZodAny, ZodArray, ZodBase64, ZodBase64URL, ZodBigInt, ZodBigIntFormat, ZodBoolean, ZodCIDRv4, ZodCIDRv6, ZodCUID, ZodCUID2, ZodCatch, ZodCodec, ZodCustom, ZodCustomStringFormat, ZodDate, ZodDefault, ZodDiscriminatedUnion, ZodE164, ZodEmail, ZodEmoji, ZodEnum, ZodError, ZodFile, ZodFunction, ZodGUID, ZodGate, ZodIPv4, ZodIPv6, ZodIntersection, ZodJWT, ZodKSUID, ZodLazy, ZodLiteral, ZodMap, ZodNaN, ZodNanoID, ZodNever, ZodNonOptional, ZodNull, ZodNullable, ZodNumber, ZodNumberFormat, ZodObject, ZodOptional, ZodPipe, ZodPrefault, ZodPromise, ZodReadonly, ZodRealError, ZodRecord, ZodSet, ZodString, ZodStringFormat, ZodSuccess, ZodSymbol, ZodTemplateLiteral, ZodTransform, ZodTuple, ZodULID, ZodURL, ZodUUID, ZodUndefined, ZodUnion, ZodUnknown, ZodVoid, ZodXID, _ZodString, _default, _function, any, array, base64, base64url, bigint,
|
|
1519
|
+
export { KrustyType, SchemaClass, ZodAny, ZodArray, ZodBase64, ZodBase64URL, ZodBigInt, ZodBigIntFormat, ZodBoolean, ZodCIDRv4, ZodCIDRv6, ZodCUID, ZodCUID2, ZodCatch, ZodCodec, ZodCustom, ZodCustomStringFormat, ZodDate, ZodDefault, ZodDiscriminatedUnion, ZodE164, ZodEmail, ZodEmoji, ZodEnum, ZodError, ZodFile, ZodFunction, ZodGUID, ZodGate, ZodIPv4, ZodIPv6, ZodIntersection, ZodJWT, ZodKSUID, ZodLazy, ZodLiteral, ZodMap, ZodNaN, ZodNanoID, ZodNever, ZodNonOptional, ZodNull, ZodNullable, ZodNumber, ZodNumberFormat, ZodObject, ZodOptional, ZodPipe, ZodPrefault, ZodPromise, ZodReadonly, ZodRealError, ZodRecord, ZodSet, ZodString, ZodStringFormat, ZodSuccess, ZodSymbol, ZodTemplateLiteral, ZodTransform, ZodTuple, ZodULID, ZodURL, ZodUUID, ZodUndefined, ZodUnion, ZodUnknown, ZodVoid, ZodXID, _ZodString, _default, _function, any, array, base64, base64url, bigint, boolean, _catch as catch, check, cidrv4, cidrv6, codec, cuid, cuid2, custom, date, decode, decodeAsync, discriminatedUnion, e164, email, emoji, encode, encodeAsync, _enum as enum, file, float32, float64, _function as function, gate, gatingContext, guid, hash, hex, hostname, httpUrl, _instanceof as instanceof, int, int32, int64, intersection, ipv4, ipv6, isGateIssue, isGateIssueRaw, json, jwt, keyof, ksuid, lazy, literal, looseObject, map, nan, nanoid, nativeEnum, never, nonoptional, _null as null, nullable, nullish, number, object, optional, parse, parseAsync, partialRecord, pipe, prefault, preprocess, promise, readonly, record, refine, safeDecode, safeDecodeAsync, safeEncode, safeEncodeAsync, safeParse, safeParseAsync, set, strictObject, string, stringFormat, stringbool, success, superRefine, symbol, templateLiteral, transform, tuple, uint32, uint64, ulid, _undefined as undefined, union, unknown, url, uuid, uuidv4, uuidv6, uuidv7, _void as void, xid };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@temporary-name/zod",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.9.3-alpha.
|
|
4
|
+
"version": "1.9.3-alpha.7af249c626ccabe97d83025ab05ba3fbad2321c8",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://www.stainless.com/",
|
|
7
7
|
"repository": {
|
|
@@ -17,25 +17,18 @@
|
|
|
17
17
|
"types": "./dist/index.d.mts",
|
|
18
18
|
"import": "./dist/index.mjs",
|
|
19
19
|
"default": "./dist/index.mjs"
|
|
20
|
-
},
|
|
21
|
-
"./zod4": {
|
|
22
|
-
"types": "./dist/zod4/index.d.mts",
|
|
23
|
-
"import": "./dist/zod4/index.mjs",
|
|
24
|
-
"default": "./dist/zod4/index.mjs"
|
|
25
20
|
}
|
|
26
21
|
},
|
|
27
22
|
"files": [
|
|
28
23
|
"dist"
|
|
29
24
|
],
|
|
30
25
|
"peerDependencies": {
|
|
31
|
-
"@temporary-name/contract": "1.9.3-alpha.
|
|
32
|
-
"@temporary-name/server": "1.9.3-alpha.
|
|
26
|
+
"@temporary-name/contract": "1.9.3-alpha.7af249c626ccabe97d83025ab05ba3fbad2321c8",
|
|
27
|
+
"@temporary-name/server": "1.9.3-alpha.7af249c626ccabe97d83025ab05ba3fbad2321c8"
|
|
33
28
|
},
|
|
34
29
|
"dependencies": {
|
|
35
|
-
"escape-string-regexp": "^5.0.0",
|
|
36
|
-
"wildcard-match": "^5.1.3",
|
|
37
30
|
"zod": "^4.1.11",
|
|
38
|
-
"@temporary-name/shared": "1.9.3-alpha.
|
|
31
|
+
"@temporary-name/shared": "1.9.3-alpha.7af249c626ccabe97d83025ab05ba3fbad2321c8"
|
|
39
32
|
},
|
|
40
33
|
"devDependencies": {},
|
|
41
34
|
"scripts": {
|
package/dist/zod4/index.d.mts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Context } from '@temporary-name/server';
|
|
2
|
-
import { StandardHandlerPlugin, StandardHandlerOptions } from '@temporary-name/server/standard';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* @deprecated Use [Smart Coercion Plugin](https://orpc.unnoq.com/docs/openapi/plugins/smart-coercion) instead.
|
|
6
|
-
*/
|
|
7
|
-
declare class experimental_ZodSmartCoercionPlugin<TContext extends Context> implements StandardHandlerPlugin<TContext> {
|
|
8
|
-
#private;
|
|
9
|
-
init(options: StandardHandlerOptions<TContext>): void;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export { experimental_ZodSmartCoercionPlugin };
|
package/dist/zod4/index.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Context } from '@temporary-name/server';
|
|
2
|
-
import { StandardHandlerPlugin, StandardHandlerOptions } from '@temporary-name/server/standard';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* @deprecated Use [Smart Coercion Plugin](https://orpc.unnoq.com/docs/openapi/plugins/smart-coercion) instead.
|
|
6
|
-
*/
|
|
7
|
-
declare class experimental_ZodSmartCoercionPlugin<TContext extends Context> implements StandardHandlerPlugin<TContext> {
|
|
8
|
-
#private;
|
|
9
|
-
init(options: StandardHandlerOptions<TContext>): void;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export { experimental_ZodSmartCoercionPlugin };
|
package/dist/zod4/index.mjs
DELETED
|
@@ -1,259 +0,0 @@
|
|
|
1
|
-
import { isObject, guard } from '@temporary-name/shared';
|
|
2
|
-
|
|
3
|
-
class experimental_ZodSmartCoercionPlugin {
|
|
4
|
-
init(options) {
|
|
5
|
-
options.clientInterceptors ??= [];
|
|
6
|
-
options.clientInterceptors.unshift((options2) => {
|
|
7
|
-
const inputSchema = options2.procedure["~orpc"].inputSchema;
|
|
8
|
-
if (!inputSchema || inputSchema["~standard"].vendor !== "zod" || !("_zod" in inputSchema)) {
|
|
9
|
-
return options2.next();
|
|
10
|
-
}
|
|
11
|
-
const coercedInput = this.#coerce(inputSchema, options2.input);
|
|
12
|
-
return options2.next({ ...options2, input: coercedInput });
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
#coerce(schema, value) {
|
|
16
|
-
switch (schema._zod.def.type) {
|
|
17
|
-
case "number": {
|
|
18
|
-
if (typeof value === "string") {
|
|
19
|
-
return this.#stringToNumber(value);
|
|
20
|
-
}
|
|
21
|
-
return value;
|
|
22
|
-
}
|
|
23
|
-
case "bigint": {
|
|
24
|
-
if (typeof value === "string") {
|
|
25
|
-
return this.#stringToBigInt(value);
|
|
26
|
-
}
|
|
27
|
-
return value;
|
|
28
|
-
}
|
|
29
|
-
case "boolean":
|
|
30
|
-
case "success": {
|
|
31
|
-
if (typeof value === "string") {
|
|
32
|
-
return this.#stringToBoolean(value);
|
|
33
|
-
}
|
|
34
|
-
return value;
|
|
35
|
-
}
|
|
36
|
-
case "date": {
|
|
37
|
-
if (typeof value === "string") {
|
|
38
|
-
return this.#stringToDate(value);
|
|
39
|
-
}
|
|
40
|
-
return value;
|
|
41
|
-
}
|
|
42
|
-
case "literal":
|
|
43
|
-
case "enum": {
|
|
44
|
-
const literal = schema;
|
|
45
|
-
if (!literal._zod.values.has(value) && typeof value === "string") {
|
|
46
|
-
const num = this.#stringToNumber(value);
|
|
47
|
-
if (literal._zod.values.has(num)) {
|
|
48
|
-
return num;
|
|
49
|
-
}
|
|
50
|
-
const bool = this.#stringToBoolean(value);
|
|
51
|
-
if (literal._zod.values.has(bool)) {
|
|
52
|
-
return bool;
|
|
53
|
-
}
|
|
54
|
-
const bigint = this.#stringToBigInt(value);
|
|
55
|
-
if (literal._zod.values.has(bigint)) {
|
|
56
|
-
return bigint;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
return value;
|
|
60
|
-
}
|
|
61
|
-
case "array": {
|
|
62
|
-
const array = schema;
|
|
63
|
-
if (value === void 0) {
|
|
64
|
-
return [];
|
|
65
|
-
}
|
|
66
|
-
if (Array.isArray(value)) {
|
|
67
|
-
return value.map((v) => this.#coerce(array._zod.def.element, v));
|
|
68
|
-
}
|
|
69
|
-
return value;
|
|
70
|
-
}
|
|
71
|
-
case "tuple": {
|
|
72
|
-
const tuple = schema;
|
|
73
|
-
if (value === void 0) {
|
|
74
|
-
return [];
|
|
75
|
-
}
|
|
76
|
-
if (Array.isArray(value)) {
|
|
77
|
-
return value.map((v, i) => {
|
|
78
|
-
const s = tuple._zod.def.items[i] ?? tuple._zod.def.rest;
|
|
79
|
-
return s ? this.#coerce(s, v) : v;
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
return value;
|
|
83
|
-
}
|
|
84
|
-
case "set": {
|
|
85
|
-
const set = schema;
|
|
86
|
-
if (value === void 0) {
|
|
87
|
-
return /* @__PURE__ */ new Set();
|
|
88
|
-
}
|
|
89
|
-
if (Array.isArray(value)) {
|
|
90
|
-
return new Set(value.map((v) => this.#coerce(set._zod.def.valueType, v)));
|
|
91
|
-
}
|
|
92
|
-
if (value instanceof Set) {
|
|
93
|
-
return new Set(Array.from(value).map((v) => this.#coerce(set._zod.def.valueType, v)));
|
|
94
|
-
}
|
|
95
|
-
return value;
|
|
96
|
-
}
|
|
97
|
-
case "object": {
|
|
98
|
-
const object = schema;
|
|
99
|
-
if (value === void 0) {
|
|
100
|
-
return {};
|
|
101
|
-
}
|
|
102
|
-
if (isObject(value)) {
|
|
103
|
-
const newObj = {};
|
|
104
|
-
const keys = /* @__PURE__ */ new Set([...Object.keys(value), ...Object.keys(object._zod.def.shape)]);
|
|
105
|
-
for (const k of keys) {
|
|
106
|
-
const s = object._zod.def.shape[k] ?? object._zod.def.catchall;
|
|
107
|
-
newObj[k] = s ? this.#coerce(s, value[k]) : value[k];
|
|
108
|
-
}
|
|
109
|
-
return newObj;
|
|
110
|
-
}
|
|
111
|
-
return value;
|
|
112
|
-
}
|
|
113
|
-
case "record": {
|
|
114
|
-
const record = schema;
|
|
115
|
-
if (value === void 0) {
|
|
116
|
-
return {};
|
|
117
|
-
}
|
|
118
|
-
if (isObject(value)) {
|
|
119
|
-
const newObj = {};
|
|
120
|
-
for (const [k, v] of Object.entries(value)) {
|
|
121
|
-
const key = this.#coerce(record._zod.def.keyType, k);
|
|
122
|
-
const val = this.#coerce(record._zod.def.valueType, v);
|
|
123
|
-
newObj[key] = val;
|
|
124
|
-
}
|
|
125
|
-
return newObj;
|
|
126
|
-
}
|
|
127
|
-
return value;
|
|
128
|
-
}
|
|
129
|
-
case "map": {
|
|
130
|
-
const map = schema;
|
|
131
|
-
if (value === void 0) {
|
|
132
|
-
return /* @__PURE__ */ new Map();
|
|
133
|
-
}
|
|
134
|
-
if (Array.isArray(value) && value.every((i) => Array.isArray(i) && i.length <= 2)) {
|
|
135
|
-
return new Map(
|
|
136
|
-
value.map(([k, v]) => [
|
|
137
|
-
this.#coerce(map._zod.def.keyType, k),
|
|
138
|
-
this.#coerce(map._zod.def.valueType, v)
|
|
139
|
-
])
|
|
140
|
-
);
|
|
141
|
-
}
|
|
142
|
-
if (value instanceof Map) {
|
|
143
|
-
return new Map(
|
|
144
|
-
Array.from(value).map(([k, v]) => [
|
|
145
|
-
this.#coerce(map._zod.def.keyType, k),
|
|
146
|
-
this.#coerce(map._zod.def.valueType, v)
|
|
147
|
-
])
|
|
148
|
-
);
|
|
149
|
-
}
|
|
150
|
-
return value;
|
|
151
|
-
}
|
|
152
|
-
case "union": {
|
|
153
|
-
const union = schema;
|
|
154
|
-
if (union._zod.def.options.length === 1) {
|
|
155
|
-
return this.#coerce(union._zod.def.options[0], value);
|
|
156
|
-
}
|
|
157
|
-
if (isObject(value)) {
|
|
158
|
-
const discriminator = "discriminator" in union._zod.def && typeof union._zod.def.discriminator === "string" ? union._zod.def.discriminator : void 0;
|
|
159
|
-
for (const option of union._zod.def.options) {
|
|
160
|
-
if (!option._zod.propValues) {
|
|
161
|
-
continue;
|
|
162
|
-
}
|
|
163
|
-
if (discriminator !== void 0) {
|
|
164
|
-
if (option._zod.propValues[discriminator]?.has(value[discriminator])) {
|
|
165
|
-
return this.#coerce(option, value);
|
|
166
|
-
}
|
|
167
|
-
} else {
|
|
168
|
-
for (const key in option._zod.propValues) {
|
|
169
|
-
if (option._zod.propValues[key]?.has(value[key])) {
|
|
170
|
-
return this.#coerce(option, value);
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
return value;
|
|
177
|
-
}
|
|
178
|
-
case "intersection": {
|
|
179
|
-
const intersection = schema;
|
|
180
|
-
return this.#coerce(intersection._zod.def.right, this.#coerce(intersection._zod.def.left, value));
|
|
181
|
-
}
|
|
182
|
-
case "optional": {
|
|
183
|
-
const optional = schema;
|
|
184
|
-
if (value === void 0) {
|
|
185
|
-
return void 0;
|
|
186
|
-
}
|
|
187
|
-
return this.#coerce(optional._zod.def.innerType, value);
|
|
188
|
-
}
|
|
189
|
-
case "nonoptional": {
|
|
190
|
-
const nonoptional = schema;
|
|
191
|
-
return this.#coerce(nonoptional._zod.def.innerType, value);
|
|
192
|
-
}
|
|
193
|
-
case "nullable": {
|
|
194
|
-
const nullable = schema;
|
|
195
|
-
if (value === null) {
|
|
196
|
-
return null;
|
|
197
|
-
}
|
|
198
|
-
return this.#coerce(nullable._zod.def.innerType, value);
|
|
199
|
-
}
|
|
200
|
-
case "readonly": {
|
|
201
|
-
const readonly_ = schema;
|
|
202
|
-
return this.#coerce(readonly_._zod.def.innerType, value);
|
|
203
|
-
}
|
|
204
|
-
case "pipe": {
|
|
205
|
-
const pipe = schema;
|
|
206
|
-
return this.#coerce(pipe._zod.def.in, value);
|
|
207
|
-
}
|
|
208
|
-
case "default":
|
|
209
|
-
case "prefault": {
|
|
210
|
-
const default_ = schema;
|
|
211
|
-
if (value === void 0) {
|
|
212
|
-
return value;
|
|
213
|
-
}
|
|
214
|
-
return this.#coerce(default_._zod.def.innerType, value);
|
|
215
|
-
}
|
|
216
|
-
case "catch": {
|
|
217
|
-
const catch_ = schema;
|
|
218
|
-
return this.#coerce(catch_._zod.def.innerType, value);
|
|
219
|
-
}
|
|
220
|
-
case "lazy": {
|
|
221
|
-
const lazy = schema;
|
|
222
|
-
if (value !== void 0) {
|
|
223
|
-
return this.#coerce(lazy._zod.def.getter(), value);
|
|
224
|
-
}
|
|
225
|
-
return value;
|
|
226
|
-
}
|
|
227
|
-
default: {
|
|
228
|
-
schema._zod.def.type;
|
|
229
|
-
return value;
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
#stringToNumber(value) {
|
|
234
|
-
const num = Number(value);
|
|
235
|
-
return Number.isNaN(num) || num.toString() !== value ? value : num;
|
|
236
|
-
}
|
|
237
|
-
#stringToBigInt(value) {
|
|
238
|
-
return guard(() => BigInt(value)) ?? value;
|
|
239
|
-
}
|
|
240
|
-
#stringToBoolean(value) {
|
|
241
|
-
const lower = value.toLowerCase();
|
|
242
|
-
if (lower === "false" || lower === "off" || lower === "f") {
|
|
243
|
-
return false;
|
|
244
|
-
}
|
|
245
|
-
if (lower === "true" || lower === "on" || lower === "t") {
|
|
246
|
-
return true;
|
|
247
|
-
}
|
|
248
|
-
return value;
|
|
249
|
-
}
|
|
250
|
-
#stringToDate(value) {
|
|
251
|
-
const date = new Date(value);
|
|
252
|
-
if (!Number.isNaN(date.getTime()) && date.toISOString().startsWith(value)) {
|
|
253
|
-
return date;
|
|
254
|
-
}
|
|
255
|
-
return value;
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
export { experimental_ZodSmartCoercionPlugin };
|