@windrun-huaiin/backend-core 13.0.0 → 14.0.0

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.
Files changed (104) hide show
  1. package/dist/_virtual/index.js +7 -3
  2. package/dist/_virtual/index.mjs +5 -3
  3. package/dist/_virtual/index2.js +2 -6
  4. package/dist/_virtual/index2.mjs +2 -6
  5. package/dist/index.js +2 -0
  6. package/dist/index.mjs +1 -1
  7. package/dist/lib/index.js +2 -0
  8. package/dist/lib/index.mjs +1 -1
  9. package/dist/lib/upstash/qstash.d.ts.map +1 -1
  10. package/dist/lib/upstash/qstash.js +66 -62
  11. package/dist/lib/upstash/qstash.mjs +67 -63
  12. package/dist/lib/upstash/redis-counter.d.ts.map +1 -1
  13. package/dist/lib/upstash/redis-counter.js +9 -24
  14. package/dist/lib/upstash/redis-counter.mjs +10 -25
  15. package/dist/lib/upstash/redis-favorite.d.ts.map +1 -1
  16. package/dist/lib/upstash/redis-favorite.js +22 -36
  17. package/dist/lib/upstash/redis-favorite.mjs +23 -37
  18. package/dist/lib/upstash/redis-like.d.ts.map +1 -1
  19. package/dist/lib/upstash/redis-like.js +22 -36
  20. package/dist/lib/upstash/redis-like.mjs +23 -37
  21. package/dist/lib/upstash/redis-lock.d.ts.map +1 -1
  22. package/dist/lib/upstash/redis-lock.js +22 -38
  23. package/dist/lib/upstash/redis-lock.mjs +23 -39
  24. package/dist/lib/upstash/redis-structures.d.ts.map +1 -1
  25. package/dist/lib/upstash/redis-structures.js +77 -113
  26. package/dist/lib/upstash/redis-structures.mjs +78 -114
  27. package/dist/lib/upstash-config.d.ts +9 -1
  28. package/dist/lib/upstash-config.d.ts.map +1 -1
  29. package/dist/lib/upstash-config.js +221 -27
  30. package/dist/lib/upstash-config.mjs +220 -28
  31. package/dist/node_modules/.pnpm/{@upstash_qstash@2.8.4/node_modules/@upstash/qstash/chunk-RQPZUJXG.js → @upstash_qstash@2.10.1/node_modules/@upstash/qstash/chunk-35B33QW3.js} +897 -468
  32. package/dist/node_modules/.pnpm/{@upstash_qstash@2.8.4/node_modules/@upstash/qstash/chunk-RQPZUJXG.mjs → @upstash_qstash@2.10.1/node_modules/@upstash/qstash/chunk-35B33QW3.mjs} +895 -468
  33. package/dist/node_modules/.pnpm/{@upstash_redis@1.36.1/node_modules/@upstash/redis/chunk-LLI2WIYN.js → @upstash_redis@1.37.0/node_modules/@upstash/redis/chunk-IH7W44G6.js} +657 -40
  34. package/dist/node_modules/.pnpm/{@upstash_redis@1.36.1/node_modules/@upstash/redis/chunk-LLI2WIYN.mjs → @upstash_redis@1.37.0/node_modules/@upstash/redis/chunk-IH7W44G6.mjs} +657 -41
  35. package/dist/node_modules/.pnpm/{@upstash_redis@1.36.1 → @upstash_redis@1.37.0}/node_modules/@upstash/redis/nodejs.js +6 -5
  36. package/dist/node_modules/.pnpm/{@upstash_redis@1.36.1 → @upstash_redis@1.37.0}/node_modules/@upstash/redis/nodejs.mjs +2 -2
  37. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/index.js +1 -1
  38. package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/index.mjs +1 -1
  39. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/jws/flattened/verify.js +6 -6
  40. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/jwt/verify.js +1 -1
  41. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/key/import.js +2 -2
  42. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/epoch.js +3 -1
  43. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/is_disjoint.js +3 -1
  44. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/is_jwk.js +1 -1
  45. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/is_object.js +3 -1
  46. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/jwt_claims_set.js +7 -5
  47. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/secs.js +3 -1
  48. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/validate_algorithms.js +3 -1
  49. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/validate_crit.js +3 -1
  50. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/check_key_length.js +3 -1
  51. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/dsa_digest.js +3 -1
  52. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/get_named_curve.js +4 -2
  53. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/get_sign_verify_key.js +3 -1
  54. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/hmac_digest.js +3 -1
  55. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/is_key_like.js +1 -1
  56. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/is_key_object.js +3 -1
  57. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/jwk_to_key.js +3 -1
  58. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/node_key.js +6 -4
  59. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/sign.js +6 -4
  60. package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/verify.js +7 -5
  61. package/dist/prisma/prisma.d.ts +1 -1
  62. package/dist/prisma/prisma.d.ts.map +1 -1
  63. package/package.json +5 -5
  64. package/src/lib/upstash/qstash.ts +64 -62
  65. package/src/lib/upstash/redis-counter.ts +10 -26
  66. package/src/lib/upstash/redis-favorite.ts +23 -42
  67. package/src/lib/upstash/redis-like.ts +23 -42
  68. package/src/lib/upstash/redis-lock.ts +23 -49
  69. package/src/lib/upstash/redis-structures.ts +82 -131
  70. package/src/lib/upstash-config.ts +231 -24
  71. package/dist/_virtual/index3.js +0 -5
  72. package/dist/_virtual/index3.mjs +0 -3
  73. package/dist/node_modules/.pnpm/@upstash_lock@0.2.1_typescript@5.9.3/node_modules/@upstash/lock/dist/index.js +0 -191
  74. package/dist/node_modules/.pnpm/@upstash_lock@0.2.1_typescript@5.9.3/node_modules/@upstash/lock/dist/index.mjs +0 -189
  75. package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/classic/errors.js +0 -54
  76. package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/classic/errors.mjs +0 -51
  77. package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/classic/iso.js +0 -44
  78. package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/classic/iso.mjs +0 -35
  79. package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/classic/parse.js +0 -31
  80. package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/classic/parse.mjs +0 -18
  81. package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/classic/schemas.js +0 -587
  82. package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/classic/schemas.mjs +0 -527
  83. package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/api.js +0 -447
  84. package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/api.mjs +0 -399
  85. package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/checks.js +0 -245
  86. package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/checks.mjs +0 -232
  87. package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/core.js +0 -68
  88. package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/core.mjs +0 -62
  89. package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/doc.js +0 -39
  90. package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/doc.mjs +0 -37
  91. package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/errors.js +0 -80
  92. package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/errors.mjs +0 -75
  93. package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/parse.js +0 -101
  94. package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/parse.mjs +0 -86
  95. package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/regexes.js +0 -102
  96. package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/regexes.mjs +0 -76
  97. package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/registries.js +0 -56
  98. package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/registries.mjs +0 -52
  99. package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/schemas.js +0 -1205
  100. package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/schemas.mjs +0 -1157
  101. package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/util.js +0 -407
  102. package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/util.mjs +0 -374
  103. package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/versions.js +0 -9
  104. package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/versions.mjs +0 -7
@@ -1,527 +0,0 @@
1
- import { $constructor, $ZodEncodeError } from '../core/core.mjs';
2
- import { normalizeParams, defineLazy, extend, safeExtend, merge, pick, omit, partial, required, mergeDefs, clone, shallowClone, issue } from '../core/util.mjs';
3
- import { $ZodObjectJIT, $ZodOptional, $ZodNonOptional, $ZodString, $ZodType, $ZodEnum, $ZodNullable, $ZodUnion, $ZodIntersection, $ZodPipe, $ZodTransform, $ZodDefault, $ZodPrefault, $ZodCatch, $ZodReadonly, $ZodStringFormat, $ZodEmail, $ZodGUID, $ZodUUID, $ZodURL, $ZodEmoji, $ZodNanoID, $ZodCUID, $ZodCUID2, $ZodULID, $ZodXID, $ZodKSUID, $ZodIPv4, $ZodIPv6, $ZodCIDRv4, $ZodCIDRv6, $ZodBase64, $ZodBase64URL, $ZodE164, $ZodJWT, $ZodUnknown, $ZodNever, $ZodArray, $ZodCustom } from '../core/schemas.mjs';
4
- import { globalRegistry } from '../core/registries.mjs';
5
- import { _string, _email, _url, _jwt, _emoji, _guid, _uuid, _uuidv4, _uuidv6, _uuidv7, _nanoid, _cuid, _cuid2, _ulid, _base64, _base64url, _xid, _ksuid, _ipv4, _ipv6, _cidrv4, _cidrv6, _e164, _overwrite, _unknown, _never, _regex, _includes, _startsWith, _endsWith, _minLength, _maxLength, _length, _lowercase, _uppercase, _trim, _normalize, _toLowerCase, _toUpperCase, _refine, _superRefine, _array } from '../core/api.mjs';
6
- import { datetime, date, time, duration } from './iso.mjs';
7
- import { parse, safeParse, parseAsync, safeParseAsync, encode, decode, encodeAsync, decodeAsync, safeEncode, safeDecode, safeEncodeAsync, safeDecodeAsync } from './parse.mjs';
8
-
9
- const ZodType = /*@__PURE__*/ $constructor("ZodType", (inst, def) => {
10
- $ZodType.init(inst, def);
11
- inst.def = def;
12
- inst.type = def.type;
13
- Object.defineProperty(inst, "_def", { value: def });
14
- // base methods
15
- inst.check = (...checks) => {
16
- return inst.clone(mergeDefs(def, {
17
- checks: [
18
- ...(def.checks ?? []),
19
- ...checks.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch),
20
- ],
21
- }));
22
- };
23
- inst.clone = (def, params) => clone(inst, def, params);
24
- inst.brand = () => inst;
25
- inst.register = ((reg, meta) => {
26
- reg.add(inst, meta);
27
- return inst;
28
- });
29
- // parsing
30
- inst.parse = (data, params) => parse(inst, data, params, { callee: inst.parse });
31
- inst.safeParse = (data, params) => safeParse(inst, data, params);
32
- inst.parseAsync = async (data, params) => parseAsync(inst, data, params, { callee: inst.parseAsync });
33
- inst.safeParseAsync = async (data, params) => safeParseAsync(inst, data, params);
34
- inst.spa = inst.safeParseAsync;
35
- // encoding/decoding
36
- inst.encode = (data, params) => encode(inst, data, params);
37
- inst.decode = (data, params) => decode(inst, data, params);
38
- inst.encodeAsync = async (data, params) => encodeAsync(inst, data, params);
39
- inst.decodeAsync = async (data, params) => decodeAsync(inst, data, params);
40
- inst.safeEncode = (data, params) => safeEncode(inst, data, params);
41
- inst.safeDecode = (data, params) => safeDecode(inst, data, params);
42
- inst.safeEncodeAsync = async (data, params) => safeEncodeAsync(inst, data, params);
43
- inst.safeDecodeAsync = async (data, params) => safeDecodeAsync(inst, data, params);
44
- // refinements
45
- inst.refine = (check, params) => inst.check(refine(check, params));
46
- inst.superRefine = (refinement) => inst.check(superRefine(refinement));
47
- inst.overwrite = (fn) => inst.check(_overwrite(fn));
48
- // wrappers
49
- inst.optional = () => optional(inst);
50
- inst.nullable = () => nullable(inst);
51
- inst.nullish = () => optional(nullable(inst));
52
- inst.nonoptional = (params) => nonoptional(inst, params);
53
- inst.array = () => array(inst);
54
- inst.or = (arg) => union([inst, arg]);
55
- inst.and = (arg) => intersection(inst, arg);
56
- inst.transform = (tx) => pipe(inst, transform(tx));
57
- inst.default = (def) => _default(inst, def);
58
- inst.prefault = (def) => prefault(inst, def);
59
- // inst.coalesce = (def, params) => coalesce(inst, def, params);
60
- inst.catch = (params) => _catch(inst, params);
61
- inst.pipe = (target) => pipe(inst, target);
62
- inst.readonly = () => readonly(inst);
63
- // meta
64
- inst.describe = (description) => {
65
- const cl = inst.clone();
66
- globalRegistry.add(cl, { description });
67
- return cl;
68
- };
69
- Object.defineProperty(inst, "description", {
70
- get() {
71
- return globalRegistry.get(inst)?.description;
72
- },
73
- configurable: true,
74
- });
75
- inst.meta = (...args) => {
76
- if (args.length === 0) {
77
- return globalRegistry.get(inst);
78
- }
79
- const cl = inst.clone();
80
- globalRegistry.add(cl, args[0]);
81
- return cl;
82
- };
83
- // helpers
84
- inst.isOptional = () => inst.safeParse(undefined).success;
85
- inst.isNullable = () => inst.safeParse(null).success;
86
- return inst;
87
- });
88
- /** @internal */
89
- const _ZodString = /*@__PURE__*/ $constructor("_ZodString", (inst, def) => {
90
- $ZodString.init(inst, def);
91
- ZodType.init(inst, def);
92
- const bag = inst._zod.bag;
93
- inst.format = bag.format ?? null;
94
- inst.minLength = bag.minimum ?? null;
95
- inst.maxLength = bag.maximum ?? null;
96
- // validations
97
- inst.regex = (...args) => inst.check(_regex(...args));
98
- inst.includes = (...args) => inst.check(_includes(...args));
99
- inst.startsWith = (...args) => inst.check(_startsWith(...args));
100
- inst.endsWith = (...args) => inst.check(_endsWith(...args));
101
- inst.min = (...args) => inst.check(_minLength(...args));
102
- inst.max = (...args) => inst.check(_maxLength(...args));
103
- inst.length = (...args) => inst.check(_length(...args));
104
- inst.nonempty = (...args) => inst.check(_minLength(1, ...args));
105
- inst.lowercase = (params) => inst.check(_lowercase(params));
106
- inst.uppercase = (params) => inst.check(_uppercase(params));
107
- // transforms
108
- inst.trim = () => inst.check(_trim());
109
- inst.normalize = (...args) => inst.check(_normalize(...args));
110
- inst.toLowerCase = () => inst.check(_toLowerCase());
111
- inst.toUpperCase = () => inst.check(_toUpperCase());
112
- });
113
- const ZodString = /*@__PURE__*/ $constructor("ZodString", (inst, def) => {
114
- $ZodString.init(inst, def);
115
- _ZodString.init(inst, def);
116
- inst.email = (params) => inst.check(_email(ZodEmail, params));
117
- inst.url = (params) => inst.check(_url(ZodURL, params));
118
- inst.jwt = (params) => inst.check(_jwt(ZodJWT, params));
119
- inst.emoji = (params) => inst.check(_emoji(ZodEmoji, params));
120
- inst.guid = (params) => inst.check(_guid(ZodGUID, params));
121
- inst.uuid = (params) => inst.check(_uuid(ZodUUID, params));
122
- inst.uuidv4 = (params) => inst.check(_uuidv4(ZodUUID, params));
123
- inst.uuidv6 = (params) => inst.check(_uuidv6(ZodUUID, params));
124
- inst.uuidv7 = (params) => inst.check(_uuidv7(ZodUUID, params));
125
- inst.nanoid = (params) => inst.check(_nanoid(ZodNanoID, params));
126
- inst.guid = (params) => inst.check(_guid(ZodGUID, params));
127
- inst.cuid = (params) => inst.check(_cuid(ZodCUID, params));
128
- inst.cuid2 = (params) => inst.check(_cuid2(ZodCUID2, params));
129
- inst.ulid = (params) => inst.check(_ulid(ZodULID, params));
130
- inst.base64 = (params) => inst.check(_base64(ZodBase64, params));
131
- inst.base64url = (params) => inst.check(_base64url(ZodBase64URL, params));
132
- inst.xid = (params) => inst.check(_xid(ZodXID, params));
133
- inst.ksuid = (params) => inst.check(_ksuid(ZodKSUID, params));
134
- inst.ipv4 = (params) => inst.check(_ipv4(ZodIPv4, params));
135
- inst.ipv6 = (params) => inst.check(_ipv6(ZodIPv6, params));
136
- inst.cidrv4 = (params) => inst.check(_cidrv4(ZodCIDRv4, params));
137
- inst.cidrv6 = (params) => inst.check(_cidrv6(ZodCIDRv6, params));
138
- inst.e164 = (params) => inst.check(_e164(ZodE164, params));
139
- // iso
140
- inst.datetime = (params) => inst.check(datetime(params));
141
- inst.date = (params) => inst.check(date(params));
142
- inst.time = (params) => inst.check(time(params));
143
- inst.duration = (params) => inst.check(duration(params));
144
- });
145
- function string(params) {
146
- return _string(ZodString, params);
147
- }
148
- const ZodStringFormat = /*@__PURE__*/ $constructor("ZodStringFormat", (inst, def) => {
149
- $ZodStringFormat.init(inst, def);
150
- _ZodString.init(inst, def);
151
- });
152
- const ZodEmail = /*@__PURE__*/ $constructor("ZodEmail", (inst, def) => {
153
- // ZodStringFormat.init(inst, def);
154
- $ZodEmail.init(inst, def);
155
- ZodStringFormat.init(inst, def);
156
- });
157
- const ZodGUID = /*@__PURE__*/ $constructor("ZodGUID", (inst, def) => {
158
- // ZodStringFormat.init(inst, def);
159
- $ZodGUID.init(inst, def);
160
- ZodStringFormat.init(inst, def);
161
- });
162
- const ZodUUID = /*@__PURE__*/ $constructor("ZodUUID", (inst, def) => {
163
- // ZodStringFormat.init(inst, def);
164
- $ZodUUID.init(inst, def);
165
- ZodStringFormat.init(inst, def);
166
- });
167
- const ZodURL = /*@__PURE__*/ $constructor("ZodURL", (inst, def) => {
168
- // ZodStringFormat.init(inst, def);
169
- $ZodURL.init(inst, def);
170
- ZodStringFormat.init(inst, def);
171
- });
172
- const ZodEmoji = /*@__PURE__*/ $constructor("ZodEmoji", (inst, def) => {
173
- // ZodStringFormat.init(inst, def);
174
- $ZodEmoji.init(inst, def);
175
- ZodStringFormat.init(inst, def);
176
- });
177
- const ZodNanoID = /*@__PURE__*/ $constructor("ZodNanoID", (inst, def) => {
178
- // ZodStringFormat.init(inst, def);
179
- $ZodNanoID.init(inst, def);
180
- ZodStringFormat.init(inst, def);
181
- });
182
- const ZodCUID = /*@__PURE__*/ $constructor("ZodCUID", (inst, def) => {
183
- // ZodStringFormat.init(inst, def);
184
- $ZodCUID.init(inst, def);
185
- ZodStringFormat.init(inst, def);
186
- });
187
- const ZodCUID2 = /*@__PURE__*/ $constructor("ZodCUID2", (inst, def) => {
188
- // ZodStringFormat.init(inst, def);
189
- $ZodCUID2.init(inst, def);
190
- ZodStringFormat.init(inst, def);
191
- });
192
- const ZodULID = /*@__PURE__*/ $constructor("ZodULID", (inst, def) => {
193
- // ZodStringFormat.init(inst, def);
194
- $ZodULID.init(inst, def);
195
- ZodStringFormat.init(inst, def);
196
- });
197
- const ZodXID = /*@__PURE__*/ $constructor("ZodXID", (inst, def) => {
198
- // ZodStringFormat.init(inst, def);
199
- $ZodXID.init(inst, def);
200
- ZodStringFormat.init(inst, def);
201
- });
202
- const ZodKSUID = /*@__PURE__*/ $constructor("ZodKSUID", (inst, def) => {
203
- // ZodStringFormat.init(inst, def);
204
- $ZodKSUID.init(inst, def);
205
- ZodStringFormat.init(inst, def);
206
- });
207
- const ZodIPv4 = /*@__PURE__*/ $constructor("ZodIPv4", (inst, def) => {
208
- // ZodStringFormat.init(inst, def);
209
- $ZodIPv4.init(inst, def);
210
- ZodStringFormat.init(inst, def);
211
- });
212
- const ZodIPv6 = /*@__PURE__*/ $constructor("ZodIPv6", (inst, def) => {
213
- // ZodStringFormat.init(inst, def);
214
- $ZodIPv6.init(inst, def);
215
- ZodStringFormat.init(inst, def);
216
- });
217
- const ZodCIDRv4 = /*@__PURE__*/ $constructor("ZodCIDRv4", (inst, def) => {
218
- $ZodCIDRv4.init(inst, def);
219
- ZodStringFormat.init(inst, def);
220
- });
221
- const ZodCIDRv6 = /*@__PURE__*/ $constructor("ZodCIDRv6", (inst, def) => {
222
- $ZodCIDRv6.init(inst, def);
223
- ZodStringFormat.init(inst, def);
224
- });
225
- const ZodBase64 = /*@__PURE__*/ $constructor("ZodBase64", (inst, def) => {
226
- // ZodStringFormat.init(inst, def);
227
- $ZodBase64.init(inst, def);
228
- ZodStringFormat.init(inst, def);
229
- });
230
- const ZodBase64URL = /*@__PURE__*/ $constructor("ZodBase64URL", (inst, def) => {
231
- // ZodStringFormat.init(inst, def);
232
- $ZodBase64URL.init(inst, def);
233
- ZodStringFormat.init(inst, def);
234
- });
235
- const ZodE164 = /*@__PURE__*/ $constructor("ZodE164", (inst, def) => {
236
- // ZodStringFormat.init(inst, def);
237
- $ZodE164.init(inst, def);
238
- ZodStringFormat.init(inst, def);
239
- });
240
- const ZodJWT = /*@__PURE__*/ $constructor("ZodJWT", (inst, def) => {
241
- // ZodStringFormat.init(inst, def);
242
- $ZodJWT.init(inst, def);
243
- ZodStringFormat.init(inst, def);
244
- });
245
- const ZodUnknown = /*@__PURE__*/ $constructor("ZodUnknown", (inst, def) => {
246
- $ZodUnknown.init(inst, def);
247
- ZodType.init(inst, def);
248
- });
249
- function unknown() {
250
- return _unknown(ZodUnknown);
251
- }
252
- const ZodNever = /*@__PURE__*/ $constructor("ZodNever", (inst, def) => {
253
- $ZodNever.init(inst, def);
254
- ZodType.init(inst, def);
255
- });
256
- function never(params) {
257
- return _never(ZodNever, params);
258
- }
259
- const ZodArray = /*@__PURE__*/ $constructor("ZodArray", (inst, def) => {
260
- $ZodArray.init(inst, def);
261
- ZodType.init(inst, def);
262
- inst.element = def.element;
263
- inst.min = (minLength, params) => inst.check(_minLength(minLength, params));
264
- inst.nonempty = (params) => inst.check(_minLength(1, params));
265
- inst.max = (maxLength, params) => inst.check(_maxLength(maxLength, params));
266
- inst.length = (len, params) => inst.check(_length(len, params));
267
- inst.unwrap = () => inst.element;
268
- });
269
- function array(element, params) {
270
- return _array(ZodArray, element, params);
271
- }
272
- const ZodObject = /*@__PURE__*/ $constructor("ZodObject", (inst, def) => {
273
- $ZodObjectJIT.init(inst, def);
274
- ZodType.init(inst, def);
275
- defineLazy(inst, "shape", () => {
276
- return def.shape;
277
- });
278
- inst.keyof = () => _enum(Object.keys(inst._zod.def.shape));
279
- inst.catchall = (catchall) => inst.clone({ ...inst._zod.def, catchall: catchall });
280
- inst.passthrough = () => inst.clone({ ...inst._zod.def, catchall: unknown() });
281
- inst.loose = () => inst.clone({ ...inst._zod.def, catchall: unknown() });
282
- inst.strict = () => inst.clone({ ...inst._zod.def, catchall: never() });
283
- inst.strip = () => inst.clone({ ...inst._zod.def, catchall: undefined });
284
- inst.extend = (incoming) => {
285
- return extend(inst, incoming);
286
- };
287
- inst.safeExtend = (incoming) => {
288
- return safeExtend(inst, incoming);
289
- };
290
- inst.merge = (other) => merge(inst, other);
291
- inst.pick = (mask) => pick(inst, mask);
292
- inst.omit = (mask) => omit(inst, mask);
293
- inst.partial = (...args) => partial(ZodOptional, inst, args[0]);
294
- inst.required = (...args) => required(ZodNonOptional, inst, args[0]);
295
- });
296
- function object(shape, params) {
297
- const def = {
298
- type: "object",
299
- shape: shape ?? {},
300
- ...normalizeParams(params),
301
- };
302
- return new ZodObject(def);
303
- }
304
- const ZodUnion = /*@__PURE__*/ $constructor("ZodUnion", (inst, def) => {
305
- $ZodUnion.init(inst, def);
306
- ZodType.init(inst, def);
307
- inst.options = def.options;
308
- });
309
- function union(options, params) {
310
- return new ZodUnion({
311
- type: "union",
312
- options: options,
313
- ...normalizeParams(params),
314
- });
315
- }
316
- const ZodIntersection = /*@__PURE__*/ $constructor("ZodIntersection", (inst, def) => {
317
- $ZodIntersection.init(inst, def);
318
- ZodType.init(inst, def);
319
- });
320
- function intersection(left, right) {
321
- return new ZodIntersection({
322
- type: "intersection",
323
- left: left,
324
- right: right,
325
- });
326
- }
327
- const ZodEnum = /*@__PURE__*/ $constructor("ZodEnum", (inst, def) => {
328
- $ZodEnum.init(inst, def);
329
- ZodType.init(inst, def);
330
- inst.enum = def.entries;
331
- inst.options = Object.values(def.entries);
332
- const keys = new Set(Object.keys(def.entries));
333
- inst.extract = (values, params) => {
334
- const newEntries = {};
335
- for (const value of values) {
336
- if (keys.has(value)) {
337
- newEntries[value] = def.entries[value];
338
- }
339
- else
340
- throw new Error(`Key ${value} not found in enum`);
341
- }
342
- return new ZodEnum({
343
- ...def,
344
- checks: [],
345
- ...normalizeParams(params),
346
- entries: newEntries,
347
- });
348
- };
349
- inst.exclude = (values, params) => {
350
- const newEntries = { ...def.entries };
351
- for (const value of values) {
352
- if (keys.has(value)) {
353
- delete newEntries[value];
354
- }
355
- else
356
- throw new Error(`Key ${value} not found in enum`);
357
- }
358
- return new ZodEnum({
359
- ...def,
360
- checks: [],
361
- ...normalizeParams(params),
362
- entries: newEntries,
363
- });
364
- };
365
- });
366
- function _enum(values, params) {
367
- const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;
368
- return new ZodEnum({
369
- type: "enum",
370
- entries,
371
- ...normalizeParams(params),
372
- });
373
- }
374
- const ZodTransform = /*@__PURE__*/ $constructor("ZodTransform", (inst, def) => {
375
- $ZodTransform.init(inst, def);
376
- ZodType.init(inst, def);
377
- inst._zod.parse = (payload, _ctx) => {
378
- if (_ctx.direction === "backward") {
379
- throw new $ZodEncodeError(inst.constructor.name);
380
- }
381
- payload.addIssue = (issue$1) => {
382
- if (typeof issue$1 === "string") {
383
- payload.issues.push(issue(issue$1, payload.value, def));
384
- }
385
- else {
386
- // for Zod 3 backwards compatibility
387
- const _issue = issue$1;
388
- if (_issue.fatal)
389
- _issue.continue = false;
390
- _issue.code ?? (_issue.code = "custom");
391
- _issue.input ?? (_issue.input = payload.value);
392
- _issue.inst ?? (_issue.inst = inst);
393
- // _issue.continue ??= true;
394
- payload.issues.push(issue(_issue));
395
- }
396
- };
397
- const output = def.transform(payload.value, payload);
398
- if (output instanceof Promise) {
399
- return output.then((output) => {
400
- payload.value = output;
401
- return payload;
402
- });
403
- }
404
- payload.value = output;
405
- return payload;
406
- };
407
- });
408
- function transform(fn) {
409
- return new ZodTransform({
410
- type: "transform",
411
- transform: fn,
412
- });
413
- }
414
- const ZodOptional = /*@__PURE__*/ $constructor("ZodOptional", (inst, def) => {
415
- $ZodOptional.init(inst, def);
416
- ZodType.init(inst, def);
417
- inst.unwrap = () => inst._zod.def.innerType;
418
- });
419
- function optional(innerType) {
420
- return new ZodOptional({
421
- type: "optional",
422
- innerType: innerType,
423
- });
424
- }
425
- const ZodNullable = /*@__PURE__*/ $constructor("ZodNullable", (inst, def) => {
426
- $ZodNullable.init(inst, def);
427
- ZodType.init(inst, def);
428
- inst.unwrap = () => inst._zod.def.innerType;
429
- });
430
- function nullable(innerType) {
431
- return new ZodNullable({
432
- type: "nullable",
433
- innerType: innerType,
434
- });
435
- }
436
- const ZodDefault = /*@__PURE__*/ $constructor("ZodDefault", (inst, def) => {
437
- $ZodDefault.init(inst, def);
438
- ZodType.init(inst, def);
439
- inst.unwrap = () => inst._zod.def.innerType;
440
- inst.removeDefault = inst.unwrap;
441
- });
442
- function _default(innerType, defaultValue) {
443
- return new ZodDefault({
444
- type: "default",
445
- innerType: innerType,
446
- get defaultValue() {
447
- return typeof defaultValue === "function" ? defaultValue() : shallowClone(defaultValue);
448
- },
449
- });
450
- }
451
- const ZodPrefault = /*@__PURE__*/ $constructor("ZodPrefault", (inst, def) => {
452
- $ZodPrefault.init(inst, def);
453
- ZodType.init(inst, def);
454
- inst.unwrap = () => inst._zod.def.innerType;
455
- });
456
- function prefault(innerType, defaultValue) {
457
- return new ZodPrefault({
458
- type: "prefault",
459
- innerType: innerType,
460
- get defaultValue() {
461
- return typeof defaultValue === "function" ? defaultValue() : shallowClone(defaultValue);
462
- },
463
- });
464
- }
465
- const ZodNonOptional = /*@__PURE__*/ $constructor("ZodNonOptional", (inst, def) => {
466
- $ZodNonOptional.init(inst, def);
467
- ZodType.init(inst, def);
468
- inst.unwrap = () => inst._zod.def.innerType;
469
- });
470
- function nonoptional(innerType, params) {
471
- return new ZodNonOptional({
472
- type: "nonoptional",
473
- innerType: innerType,
474
- ...normalizeParams(params),
475
- });
476
- }
477
- const ZodCatch = /*@__PURE__*/ $constructor("ZodCatch", (inst, def) => {
478
- $ZodCatch.init(inst, def);
479
- ZodType.init(inst, def);
480
- inst.unwrap = () => inst._zod.def.innerType;
481
- inst.removeCatch = inst.unwrap;
482
- });
483
- function _catch(innerType, catchValue) {
484
- return new ZodCatch({
485
- type: "catch",
486
- innerType: innerType,
487
- catchValue: (typeof catchValue === "function" ? catchValue : () => catchValue),
488
- });
489
- }
490
- const ZodPipe = /*@__PURE__*/ $constructor("ZodPipe", (inst, def) => {
491
- $ZodPipe.init(inst, def);
492
- ZodType.init(inst, def);
493
- inst.in = def.in;
494
- inst.out = def.out;
495
- });
496
- function pipe(in_, out) {
497
- return new ZodPipe({
498
- type: "pipe",
499
- in: in_,
500
- out: out,
501
- // ...util.normalizeParams(params),
502
- });
503
- }
504
- const ZodReadonly = /*@__PURE__*/ $constructor("ZodReadonly", (inst, def) => {
505
- $ZodReadonly.init(inst, def);
506
- ZodType.init(inst, def);
507
- inst.unwrap = () => inst._zod.def.innerType;
508
- });
509
- function readonly(innerType) {
510
- return new ZodReadonly({
511
- type: "readonly",
512
- innerType: innerType,
513
- });
514
- }
515
- const ZodCustom = /*@__PURE__*/ $constructor("ZodCustom", (inst, def) => {
516
- $ZodCustom.init(inst, def);
517
- ZodType.init(inst, def);
518
- });
519
- function refine(fn, _params = {}) {
520
- return _refine(ZodCustom, fn, _params);
521
- }
522
- // superRefine
523
- function superRefine(fn) {
524
- return _superRefine(fn);
525
- }
526
-
527
- export { ZodArray, ZodBase64, ZodBase64URL, ZodCIDRv4, ZodCIDRv6, ZodCUID, ZodCUID2, ZodCatch, ZodCustom, ZodDefault, ZodE164, ZodEmail, ZodEmoji, ZodEnum, ZodGUID, ZodIPv4, ZodIPv6, ZodIntersection, ZodJWT, ZodKSUID, ZodNanoID, ZodNever, ZodNonOptional, ZodNullable, ZodObject, ZodOptional, ZodPipe, ZodPrefault, ZodReadonly, ZodString, ZodStringFormat, ZodTransform, ZodType, ZodULID, ZodURL, ZodUUID, ZodUnion, ZodUnknown, ZodXID, _ZodString, _default, array, _catch as catch, _enum as enum, intersection, never, nonoptional, nullable, object, optional, pipe, prefault, readonly, refine, string, superRefine, transform, union, unknown };