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