@boostxyz/cli 1.1.0-alpha.37 → 1.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.
- package/dist/cli.cjs +2 -2
- package/dist/cli.js +14 -14
- package/dist/commands/seed.cjs +2 -2
- package/dist/commands/seed.js +474 -447
- package/package.json +2 -2
package/dist/commands/seed.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Tt from "node:fs/promises";
|
|
2
2
|
import Ct from "node:path";
|
|
3
|
-
import { Deployable as
|
|
4
|
-
import { B as Rt, l as Zt, p as jt, c as Mt, f as
|
|
3
|
+
import { Deployable as It, SignatureType as se, FilterType as tt, PrimitiveType as nt, StrategyType as Me, BOOST_REGISTRY_ADDRESSES as St, BoostRegistry as At, BOOST_CORE_ADDRESSES as Et, BoostCore as Nt, Roles as at, allowListFromAddress as Ot } from "@boostxyz/sdk";
|
|
4
|
+
import { B as Rt, l as Zt, p as jt, c as Mt, f as Pt, h as $t, s as Dt, r as Vt, w as Bt, m as Lt, n as zt, q as ze, t as Ut, u as Wt, x as qt, k as Ht } from "../utils-CX1JpbvX.js";
|
|
5
5
|
class Ft extends Rt {
|
|
6
6
|
constructor({ value: e }) {
|
|
7
7
|
super(`Number \`${e}\` is not a valid decimal number.`, {
|
|
@@ -9,7 +9,7 @@ class Ft extends Rt {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
|
-
function
|
|
12
|
+
function Gt(n, e) {
|
|
13
13
|
if (!/^(-?)([0-9]*)\.?([0-9]*)$/.test(n))
|
|
14
14
|
throw new Ft({ value: n });
|
|
15
15
|
let [t, a = "0"] = n.split(".");
|
|
@@ -28,10 +28,10 @@ function Jt(n, e) {
|
|
|
28
28
|
return BigInt(`${r ? "-" : ""}${t}${a}`);
|
|
29
29
|
}
|
|
30
30
|
function rt(n, e = "wei") {
|
|
31
|
-
return
|
|
31
|
+
return Gt(n, Zt[e]);
|
|
32
32
|
}
|
|
33
|
-
const
|
|
34
|
-
function
|
|
33
|
+
const Ye = "0x0000000000000000000000000000000000000000";
|
|
34
|
+
function Pe(n, e) {
|
|
35
35
|
if (n === e)
|
|
36
36
|
return !0;
|
|
37
37
|
if (n && e && typeof n == "object" && typeof e == "object") {
|
|
@@ -42,7 +42,7 @@ function Me(n, e) {
|
|
|
42
42
|
if (t = n.length, t !== e.length)
|
|
43
43
|
return !1;
|
|
44
44
|
for (a = t; a-- !== 0; )
|
|
45
|
-
if (!
|
|
45
|
+
if (!Pe(n[a], e[a]))
|
|
46
46
|
return !1;
|
|
47
47
|
return !0;
|
|
48
48
|
}
|
|
@@ -58,14 +58,14 @@ function Me(n, e) {
|
|
|
58
58
|
return !1;
|
|
59
59
|
for (a = t; a-- !== 0; ) {
|
|
60
60
|
const s = r[a];
|
|
61
|
-
if (s && !
|
|
61
|
+
if (s && !Pe(n[s], e[s]))
|
|
62
62
|
return !1;
|
|
63
63
|
}
|
|
64
64
|
return !0;
|
|
65
65
|
}
|
|
66
66
|
return n !== n && e !== e;
|
|
67
67
|
}
|
|
68
|
-
function
|
|
68
|
+
function Ne(n) {
|
|
69
69
|
const e = n.state.current, t = n.state.connections.get(e), a = t == null ? void 0 : t.accounts, r = a == null ? void 0 : a[0], s = n.chains.find((o) => o.id === (t == null ? void 0 : t.chainId)), i = n.state.status;
|
|
70
70
|
switch (i) {
|
|
71
71
|
case "connected":
|
|
@@ -122,32 +122,32 @@ function Ae(n) {
|
|
|
122
122
|
};
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
|
-
function
|
|
125
|
+
function Ue(n) {
|
|
126
126
|
return n.state.chainId;
|
|
127
127
|
}
|
|
128
|
-
function
|
|
128
|
+
function We(n, e, t) {
|
|
129
129
|
const a = n[e.name];
|
|
130
130
|
if (typeof a == "function")
|
|
131
131
|
return a;
|
|
132
132
|
const r = n[t];
|
|
133
133
|
return typeof r == "function" ? r : (s) => e(n, s);
|
|
134
134
|
}
|
|
135
|
-
const
|
|
135
|
+
const Jt = "2.13.8", Yt = () => `@wagmi/core@${Jt}`;
|
|
136
136
|
var st = function(n, e, t, a) {
|
|
137
137
|
if (t === "a" && !a) throw new TypeError("Private accessor was defined without a getter");
|
|
138
138
|
if (typeof e == "function" ? n !== e || !a : !e.has(n)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
139
139
|
return t === "m" ? a : t === "a" ? a.call(n) : a ? a.value : e.get(n);
|
|
140
|
-
},
|
|
140
|
+
}, we, it;
|
|
141
141
|
class F extends Error {
|
|
142
142
|
get docsBaseUrl() {
|
|
143
143
|
return "https://wagmi.sh/core";
|
|
144
144
|
}
|
|
145
145
|
get version() {
|
|
146
|
-
return
|
|
146
|
+
return Yt();
|
|
147
147
|
}
|
|
148
148
|
constructor(e, t = {}) {
|
|
149
149
|
var a;
|
|
150
|
-
super(),
|
|
150
|
+
super(), we.add(this), Object.defineProperty(this, "details", {
|
|
151
151
|
enumerable: !0,
|
|
152
152
|
configurable: !0,
|
|
153
153
|
writable: !0,
|
|
@@ -187,11 +187,11 @@ class F extends Error {
|
|
|
187
187
|
`), t.cause && (this.cause = t.cause), this.details = r, this.docsPath = s, this.metaMessages = t.metaMessages, this.shortMessage = e;
|
|
188
188
|
}
|
|
189
189
|
walk(e) {
|
|
190
|
-
return st(this,
|
|
190
|
+
return st(this, we, "m", it).call(this, this, e);
|
|
191
191
|
}
|
|
192
192
|
}
|
|
193
|
-
|
|
194
|
-
return t != null && t(e) ? e : e.cause ? st(this,
|
|
193
|
+
we = /* @__PURE__ */ new WeakSet(), it = function n(e, t) {
|
|
194
|
+
return t != null && t(e) ? e : e.cause ? st(this, we, "m", n).call(this, e.cause, t) : e;
|
|
195
195
|
};
|
|
196
196
|
class Qt extends F {
|
|
197
197
|
constructor() {
|
|
@@ -279,11 +279,11 @@ async function ot(n, e = {}) {
|
|
|
279
279
|
connector: s
|
|
280
280
|
});
|
|
281
281
|
const o = n.chains.find((c) => c.id === a), u = await t.connector.getProvider({ chainId: a });
|
|
282
|
-
return
|
|
282
|
+
return Pt({
|
|
283
283
|
account: i,
|
|
284
284
|
chain: o,
|
|
285
285
|
name: "Connector Client",
|
|
286
|
-
transport: (c) =>
|
|
286
|
+
transport: (c) => $t(u)({ ...c, retryCount: 0 })
|
|
287
287
|
});
|
|
288
288
|
}
|
|
289
289
|
async function $e(n, e) {
|
|
@@ -293,17 +293,17 @@ async function $e(n, e) {
|
|
|
293
293
|
chainId: a,
|
|
294
294
|
connector: r
|
|
295
295
|
})).account;
|
|
296
|
-
const o = n.getClient({ chainId: a }), u =
|
|
296
|
+
const o = n.getClient({ chainId: a }), u = We(o, Dt, "simulateContract"), { result: c, request: m } = await u({ ...s, abi: t, account: i });
|
|
297
297
|
return {
|
|
298
298
|
chainId: o.chain.id,
|
|
299
299
|
result: c,
|
|
300
300
|
request: { __mode: "prepared", ...m, chainId: a }
|
|
301
301
|
};
|
|
302
302
|
}
|
|
303
|
-
function
|
|
303
|
+
function qe(n) {
|
|
304
304
|
return n.address !== void 0 && typeof n.address == "object" ? (e, t) => {
|
|
305
305
|
var a;
|
|
306
|
-
const r =
|
|
306
|
+
const r = Ue(e), s = Ne(e), i = (t == null ? void 0 : t.chainId) ?? s.chainId ?? r;
|
|
307
307
|
return $e(e, {
|
|
308
308
|
...t,
|
|
309
309
|
...n.functionName ? { functionName: n.functionName } : {},
|
|
@@ -319,12 +319,12 @@ function We(n) {
|
|
|
319
319
|
}
|
|
320
320
|
function Qe(n, e) {
|
|
321
321
|
const { chainId: t, ...a } = e, r = n.getClient({ chainId: t });
|
|
322
|
-
return
|
|
322
|
+
return We(r, Vt, "readContract")(a);
|
|
323
323
|
}
|
|
324
324
|
function ct(n) {
|
|
325
325
|
return n.address !== void 0 && typeof n.address == "object" ? (e, t) => {
|
|
326
326
|
var a;
|
|
327
|
-
const r =
|
|
327
|
+
const r = Ue(e), s = Ne(e), i = (t == null ? void 0 : t.chainId) ?? s.chainId ?? r;
|
|
328
328
|
return Qe(e, {
|
|
329
329
|
...t,
|
|
330
330
|
...n.functionName ? { functionName: n.functionName } : {},
|
|
@@ -342,7 +342,7 @@ async function Ke(n, e) {
|
|
|
342
342
|
const { account: t, chainId: a, connector: r, __mode: s, ...i } = e;
|
|
343
343
|
let o;
|
|
344
344
|
typeof t == "object" && t.type === "local" ? o = n.getClient({ chainId: a }) : o = await ot(n, { account: t, chainId: a, connector: r });
|
|
345
|
-
const { connector: u } =
|
|
345
|
+
const { connector: u } = Ne(n);
|
|
346
346
|
let c;
|
|
347
347
|
if (s === "prepared" || u != null && u.supportsSimulation)
|
|
348
348
|
c = i;
|
|
@@ -354,16 +354,16 @@ async function Ke(n, e) {
|
|
|
354
354
|
});
|
|
355
355
|
c = m;
|
|
356
356
|
}
|
|
357
|
-
return await
|
|
357
|
+
return await We(o, Bt, "writeContract")({
|
|
358
358
|
...c,
|
|
359
359
|
...t ? { account: t } : {},
|
|
360
360
|
chain: a ? { id: a } : null
|
|
361
361
|
});
|
|
362
362
|
}
|
|
363
|
-
function
|
|
363
|
+
function He(n) {
|
|
364
364
|
return n.address !== void 0 && typeof n.address == "object" ? (e, t) => {
|
|
365
365
|
var a;
|
|
366
|
-
const r =
|
|
366
|
+
const r = Ue(e), s = Ne(e);
|
|
367
367
|
let i;
|
|
368
368
|
return t.chainId ? i = t.chainId : t.account && t.account === s.address || t.account === void 0 ? i = s.chainId : i = r, Ke(e, {
|
|
369
369
|
...t,
|
|
@@ -378,7 +378,7 @@ function qe(n) {
|
|
|
378
378
|
abi: n.abi
|
|
379
379
|
});
|
|
380
380
|
}
|
|
381
|
-
const
|
|
381
|
+
const B = [
|
|
382
382
|
{ type: "error", inputs: [], name: "AllowanceOverflow" },
|
|
383
383
|
{ type: "error", inputs: [], name: "AllowanceUnderflow" },
|
|
384
384
|
{ type: "error", inputs: [], name: "InsufficientAllowance" },
|
|
@@ -552,31 +552,31 @@ const D = [
|
|
|
552
552
|
stateMutability: "nonpayable"
|
|
553
553
|
}
|
|
554
554
|
], tn = /* @__PURE__ */ ct({
|
|
555
|
-
abi:
|
|
555
|
+
abi: B,
|
|
556
556
|
functionName: "allowance"
|
|
557
557
|
}), nn = /* @__PURE__ */ ct({
|
|
558
|
-
abi:
|
|
558
|
+
abi: B,
|
|
559
559
|
functionName: "balanceOf"
|
|
560
|
-
}), an = /* @__PURE__ */
|
|
561
|
-
abi:
|
|
560
|
+
}), an = /* @__PURE__ */ He({
|
|
561
|
+
abi: B,
|
|
562
562
|
functionName: "approve"
|
|
563
|
-
}), rn = /* @__PURE__ */
|
|
564
|
-
abi:
|
|
563
|
+
}), rn = /* @__PURE__ */ He({
|
|
564
|
+
abi: B,
|
|
565
565
|
functionName: "mint"
|
|
566
|
-
}), sn = /* @__PURE__ */
|
|
567
|
-
abi:
|
|
566
|
+
}), sn = /* @__PURE__ */ He({
|
|
567
|
+
abi: B,
|
|
568
568
|
functionName: "mintPayable"
|
|
569
|
-
}), on = /* @__PURE__ */
|
|
570
|
-
abi:
|
|
569
|
+
}), on = /* @__PURE__ */ qe({
|
|
570
|
+
abi: B,
|
|
571
571
|
functionName: "approve"
|
|
572
|
-
}), cn = /* @__PURE__ */
|
|
573
|
-
abi:
|
|
572
|
+
}), cn = /* @__PURE__ */ qe({
|
|
573
|
+
abi: B,
|
|
574
574
|
functionName: "mint"
|
|
575
|
-
}), dn = /* @__PURE__ */
|
|
576
|
-
abi:
|
|
575
|
+
}), dn = /* @__PURE__ */ qe({
|
|
576
|
+
abi: B,
|
|
577
577
|
functionName: "mintPayable"
|
|
578
578
|
}), un = "0x6080604052348015600e575f80fd5b50610e138061001c5f395ff3fe6080604052600436106100dc575f3560e01c806340c10f191161007e57806395d89b411161005857806395d89b41146102bc578063a9059cbb146102e6578063d505accf14610322578063dd62ed3e1461034a576100dc565b806340c10f191461021c57806370a08231146102445780637ecebe0014610280576100dc565b806318160ddd116100ba57806318160ddd1461016257806323b872dd1461018c578063313ce567146101c85780633644e515146101f2576100dc565b806306fdde03146100e0578063095ea7b31461010a57806317d304b014610146575b5f80fd5b3480156100eb575f80fd5b506100f4610386565b60405161010191906109bf565b60405180910390f35b348015610115575f80fd5b50610130600480360381019061012b9190610a70565b6103c3565b60405161013d9190610ac8565b60405180910390f35b610160600480360381019061015b9190610a70565b610413565b005b34801561016d575f80fd5b50610176610470565b6040516101839190610af0565b60405180910390f35b348015610197575f80fd5b506101b260048036038101906101ad9190610b09565b610481565b6040516101bf9190610ac8565b60405180910390f35b3480156101d3575f80fd5b506101dc610552565b6040516101e99190610b74565b60405180910390f35b3480156101fd575f80fd5b5061020661055a565b6040516102139190610ba5565b60405180910390f35b348015610227575f80fd5b50610242600480360381019061023d9190610a70565b6105ea565b005b34801561024f575f80fd5b5061026a60048036038101906102659190610bbe565b6105f8565b6040516102779190610af0565b60405180910390f35b34801561028b575f80fd5b506102a660048036038101906102a19190610bbe565b610611565b6040516102b39190610af0565b60405180910390f35b3480156102c7575f80fd5b506102d061062a565b6040516102dd91906109bf565b60405180910390f35b3480156102f1575f80fd5b5061030c60048036038101906103079190610a70565b610667565b6040516103199190610ac8565b60405180910390f35b34801561032d575f80fd5b5061034860048036038101906103439190610c3d565b6106f5565b005b348015610355575f80fd5b50610370600480360381019061036b9190610cda565b610891565b60405161037d9190610af0565b60405180910390f35b60606040518060400160405280600a81526020017f4d6f636b20455243323000000000000000000000000000000000000000000000815250905090565b5f82602052637f5e9f20600c52335f52816034600c2055815f52602c5160601c337f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560205fa36001905092915050565b6064816104209190610d45565b341015610462576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161045990610dbf565b60405180910390fd5b61046c82826108af565b5050565b5f6805345cdf77eb68f44c54905090565b5f61048d848484610941565b8360601b33602052637f5e9f208117600c526034600c20805460018101156104ca57808511156104c4576313be252b5f526004601cfd5b84810382555b6387a211a28317600c526020600c208054808711156104f05763f4d678b85f526004601cfd5b8681038255875f526020600c2087815401815587602052600c5160601c8660601c7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef602080a3505050505050610547848484610946565b600190509392505050565b5f6012905090565b5f8061056461094b565b90505f801b810361058157610577610386565b8051906020012090505b6040517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f81528160208201527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6604082015246606082015230608082015260a081209250505090565b6105f482826108af565b5050565b5f6387a211a2600c52815f526020600c20549050919050565b5f6338377508600c52815f526020600c20549050919050565b60606040518060400160405280600481526020017f4d4f434b00000000000000000000000000000000000000000000000000000000815250905090565b5f610673338484610941565b6387a211a2600c52335f526020600c2080548084111561069a5763f4d678b85f526004601cfd5b8381038255845f526020600c2084815401815584602052600c5160601c337fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef602080a35050506106eb338484610946565b6001905092915050565b5f6106fe61094b565b90505f801b810361071b57610711610386565b8051906020012090505b8442111561073057631a15a3cc5f526004601cfd5b6040518860601b60601c98508760601b60601c975065383775081901600e52885f526020600c2080547f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f83528360208401527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6604084015246606084015230608084015260a08320602e527f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c983528a60208401528960408401528860608401528060808401528760a084015260c08320604e526042602c205f528660ff16602052856040528460605260208060805f60015afa8b3d51146108385763ddafbaef5f526004601cfd5b80820183558a637f5e9f2060a01b17604052896034602c20558a8c7f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925602060608801a3836040525f606052505050505050505050505050565b5f81602052637f5e9f20600c52825f526034600c2054905092915050565b6108ba5f8383610941565b6805345cdf77eb68f44c54818101818110156108dd5763e5cfe9575f526004601cfd5b806805345cdf77eb68f44c556387a211a2600c52835f526020600c2083815401815583602052600c5160601c5f7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef602080a350505061093d5f8383610946565b5050565b505050565b505050565b5f90565b5f81519050919050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f601f19601f8301169050919050565b5f6109918261094f565b61099b8185610959565b93506109ab818560208601610969565b6109b481610977565b840191505092915050565b5f6020820190508181035f8301526109d78184610987565b905092915050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f610a0c826109e3565b9050919050565b610a1c81610a02565b8114610a26575f80fd5b50565b5f81359050610a3781610a13565b92915050565b5f819050919050565b610a4f81610a3d565b8114610a59575f80fd5b50565b5f81359050610a6a81610a46565b92915050565b5f8060408385031215610a8657610a856109df565b5b5f610a9385828601610a29565b9250506020610aa485828601610a5c565b9150509250929050565b5f8115159050919050565b610ac281610aae565b82525050565b5f602082019050610adb5f830184610ab9565b92915050565b610aea81610a3d565b82525050565b5f602082019050610b035f830184610ae1565b92915050565b5f805f60608486031215610b2057610b1f6109df565b5b5f610b2d86828701610a29565b9350506020610b3e86828701610a29565b9250506040610b4f86828701610a5c565b9150509250925092565b5f60ff82169050919050565b610b6e81610b59565b82525050565b5f602082019050610b875f830184610b65565b92915050565b5f819050919050565b610b9f81610b8d565b82525050565b5f602082019050610bb85f830184610b96565b92915050565b5f60208284031215610bd357610bd26109df565b5b5f610be084828501610a29565b91505092915050565b610bf281610b59565b8114610bfc575f80fd5b50565b5f81359050610c0d81610be9565b92915050565b610c1c81610b8d565b8114610c26575f80fd5b50565b5f81359050610c3781610c13565b92915050565b5f805f805f805f60e0888a031215610c5857610c576109df565b5b5f610c658a828b01610a29565b9750506020610c768a828b01610a29565b9650506040610c878a828b01610a5c565b9550506060610c988a828b01610a5c565b9450506080610ca98a828b01610bff565b93505060a0610cba8a828b01610c29565b92505060c0610ccb8a828b01610c29565b91505092959891949750929550565b5f8060408385031215610cf057610cef6109df565b5b5f610cfd85828601610a29565b9250506020610d0e85828601610a29565b9150509250929050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b5f610d4f82610a3d565b9150610d5a83610a3d565b925082610d6a57610d69610d18565b5b828204905092915050565b7f4d6f636b45524332303a2067696d6d65206d6f7265206d6f6e657921000000005f82015250565b5f610da9601c83610959565b9150610db482610d75565b602082019050919050565b5f6020820190508181035f830152610dd681610d9d565b905091905056fea2646970667358221220a588f9f821e157f856641e8171dc78ec959e3c73080238aa8696355fc5d4a5d064736f6c634300081a0033";
|
|
579
|
-
class dt extends
|
|
579
|
+
class dt extends It {
|
|
580
580
|
async balanceOf(e, t) {
|
|
581
581
|
return await nn(this._config, {
|
|
582
582
|
address: this.assertValidAddress(),
|
|
@@ -641,7 +641,7 @@ class dt extends St {
|
|
|
641
641
|
buildParameters(e = {}, t) {
|
|
642
642
|
const [, a] = this.validateDeploymentConfig(e, t);
|
|
643
643
|
return {
|
|
644
|
-
abi:
|
|
644
|
+
abi: B,
|
|
645
645
|
bytecode: un,
|
|
646
646
|
...this.optionallyAttachAccount(a.account)
|
|
647
647
|
};
|
|
@@ -728,15 +728,15 @@ var _;
|
|
|
728
728
|
}
|
|
729
729
|
n.joinValues = a, n.jsonStringifyReplacer = (r, s) => typeof s == "bigint" ? s.toString() : s;
|
|
730
730
|
})(_ || (_ = {}));
|
|
731
|
-
var
|
|
731
|
+
var De;
|
|
732
732
|
(function(n) {
|
|
733
733
|
n.mergeShapes = (e, t) => ({
|
|
734
734
|
...e,
|
|
735
735
|
...t
|
|
736
736
|
// second overwrites first
|
|
737
737
|
});
|
|
738
|
-
})(
|
|
739
|
-
const
|
|
738
|
+
})(De || (De = {}));
|
|
739
|
+
const h = _.arrayToEnum([
|
|
740
740
|
"string",
|
|
741
741
|
"nan",
|
|
742
742
|
"number",
|
|
@@ -757,26 +757,26 @@ const f = _.arrayToEnum([
|
|
|
757
757
|
"never",
|
|
758
758
|
"map",
|
|
759
759
|
"set"
|
|
760
|
-
]),
|
|
760
|
+
]), L = (n) => {
|
|
761
761
|
switch (typeof n) {
|
|
762
762
|
case "undefined":
|
|
763
|
-
return
|
|
763
|
+
return h.undefined;
|
|
764
764
|
case "string":
|
|
765
|
-
return
|
|
765
|
+
return h.string;
|
|
766
766
|
case "number":
|
|
767
|
-
return isNaN(n) ?
|
|
767
|
+
return isNaN(n) ? h.nan : h.number;
|
|
768
768
|
case "boolean":
|
|
769
|
-
return
|
|
769
|
+
return h.boolean;
|
|
770
770
|
case "function":
|
|
771
|
-
return
|
|
771
|
+
return h.function;
|
|
772
772
|
case "bigint":
|
|
773
|
-
return
|
|
773
|
+
return h.bigint;
|
|
774
774
|
case "symbol":
|
|
775
|
-
return
|
|
775
|
+
return h.symbol;
|
|
776
776
|
case "object":
|
|
777
|
-
return Array.isArray(n) ?
|
|
777
|
+
return Array.isArray(n) ? h.array : n === null ? h.null : n.then && typeof n.then == "function" && n.catch && typeof n.catch == "function" ? h.promise : typeof Map < "u" && n instanceof Map ? h.map : typeof Set < "u" && n instanceof Set ? h.set : typeof Date < "u" && n instanceof Date ? h.date : h.object;
|
|
778
778
|
default:
|
|
779
|
-
return
|
|
779
|
+
return h.unknown;
|
|
780
780
|
}
|
|
781
781
|
}, d = _.arrayToEnum([
|
|
782
782
|
"invalid_type",
|
|
@@ -796,7 +796,7 @@ const f = _.arrayToEnum([
|
|
|
796
796
|
"not_multiple_of",
|
|
797
797
|
"not_finite"
|
|
798
798
|
]), fn = (n) => JSON.stringify(n, null, 2).replace(/"([^"]+)":/g, "$1:");
|
|
799
|
-
class
|
|
799
|
+
class E extends Error {
|
|
800
800
|
constructor(e) {
|
|
801
801
|
super(), this.issues = [], this.addIssue = (a) => {
|
|
802
802
|
this.issues = [...this.issues, a];
|
|
@@ -833,7 +833,7 @@ class A extends Error {
|
|
|
833
833
|
return r(this), a;
|
|
834
834
|
}
|
|
835
835
|
static assert(e) {
|
|
836
|
-
if (!(e instanceof
|
|
836
|
+
if (!(e instanceof E))
|
|
837
837
|
throw new Error(`Not a ZodError: ${e}`);
|
|
838
838
|
}
|
|
839
839
|
toString() {
|
|
@@ -855,12 +855,12 @@ class A extends Error {
|
|
|
855
855
|
return this.flatten();
|
|
856
856
|
}
|
|
857
857
|
}
|
|
858
|
-
|
|
858
|
+
E.create = (n) => new E(n);
|
|
859
859
|
const ee = (n, e) => {
|
|
860
860
|
let t;
|
|
861
861
|
switch (n.code) {
|
|
862
862
|
case d.invalid_type:
|
|
863
|
-
n.received ===
|
|
863
|
+
n.received === h.undefined ? t = "Required" : t = `Expected ${n.expected}, received ${n.received}`;
|
|
864
864
|
break;
|
|
865
865
|
case d.invalid_literal:
|
|
866
866
|
t = `Invalid literal value, expected ${JSON.stringify(n.expected, _.jsonStringifyReplacer)}`;
|
|
@@ -916,10 +916,10 @@ let ut = ee;
|
|
|
916
916
|
function hn(n) {
|
|
917
917
|
ut = n;
|
|
918
918
|
}
|
|
919
|
-
function
|
|
919
|
+
function ke() {
|
|
920
920
|
return ut;
|
|
921
921
|
}
|
|
922
|
-
const
|
|
922
|
+
const Te = (n) => {
|
|
923
923
|
const { data: e, path: t, errorMaps: a, issueData: r } = n, s = [...t, ...r.path || []], i = {
|
|
924
924
|
...r,
|
|
925
925
|
path: s
|
|
@@ -940,8 +940,8 @@ const ke = (n) => {
|
|
|
940
940
|
message: o
|
|
941
941
|
};
|
|
942
942
|
}, pn = [];
|
|
943
|
-
function
|
|
944
|
-
const t =
|
|
943
|
+
function f(n, e) {
|
|
944
|
+
const t = ke(), a = Te({
|
|
945
945
|
issueData: e,
|
|
946
946
|
data: n.data,
|
|
947
947
|
path: n.path,
|
|
@@ -998,8 +998,8 @@ class S {
|
|
|
998
998
|
}
|
|
999
999
|
const b = Object.freeze({
|
|
1000
1000
|
status: "aborted"
|
|
1001
|
-
}), K = (n) => ({ status: "dirty", value: n }),
|
|
1002
|
-
function
|
|
1001
|
+
}), K = (n) => ({ status: "dirty", value: n }), A = (n) => ({ status: "valid", value: n }), Ve = (n) => n.status === "aborted", Be = (n) => n.status === "dirty", ie = (n) => n.status === "valid", oe = (n) => typeof Promise < "u" && n instanceof Promise;
|
|
1002
|
+
function Ce(n, e, t, a) {
|
|
1003
1003
|
if (typeof e == "function" ? n !== e || !a : !e.has(n)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
1004
1004
|
return e.get(n);
|
|
1005
1005
|
}
|
|
@@ -1030,7 +1030,7 @@ const Xe = (n, e) => {
|
|
|
1030
1030
|
get error() {
|
|
1031
1031
|
if (this._error)
|
|
1032
1032
|
return this._error;
|
|
1033
|
-
const t = new
|
|
1033
|
+
const t = new E(n.common.issues);
|
|
1034
1034
|
return this._error = t, this._error;
|
|
1035
1035
|
}
|
|
1036
1036
|
};
|
|
@@ -1055,13 +1055,13 @@ class v {
|
|
|
1055
1055
|
return this._def.description;
|
|
1056
1056
|
}
|
|
1057
1057
|
_getType(e) {
|
|
1058
|
-
return
|
|
1058
|
+
return L(e.data);
|
|
1059
1059
|
}
|
|
1060
1060
|
_getOrReturnCtx(e, t) {
|
|
1061
1061
|
return t || {
|
|
1062
1062
|
common: e.parent.common,
|
|
1063
1063
|
data: e.data,
|
|
1064
|
-
parsedType:
|
|
1064
|
+
parsedType: L(e.data),
|
|
1065
1065
|
schemaErrorMap: this._def.errorMap,
|
|
1066
1066
|
path: e.path,
|
|
1067
1067
|
parent: e.parent
|
|
@@ -1073,7 +1073,7 @@ class v {
|
|
|
1073
1073
|
ctx: {
|
|
1074
1074
|
common: e.parent.common,
|
|
1075
1075
|
data: e.data,
|
|
1076
|
-
parsedType:
|
|
1076
|
+
parsedType: L(e.data),
|
|
1077
1077
|
schemaErrorMap: this._def.errorMap,
|
|
1078
1078
|
path: e.path,
|
|
1079
1079
|
parent: e.parent
|
|
@@ -1108,7 +1108,7 @@ class v {
|
|
|
1108
1108
|
schemaErrorMap: this._def.errorMap,
|
|
1109
1109
|
parent: null,
|
|
1110
1110
|
data: e,
|
|
1111
|
-
parsedType:
|
|
1111
|
+
parsedType: L(e)
|
|
1112
1112
|
}, s = this._parseSync({ data: e, path: r.path, parent: r });
|
|
1113
1113
|
return Xe(r, s);
|
|
1114
1114
|
}
|
|
@@ -1129,7 +1129,7 @@ class v {
|
|
|
1129
1129
|
schemaErrorMap: this._def.errorMap,
|
|
1130
1130
|
parent: null,
|
|
1131
1131
|
data: e,
|
|
1132
|
-
parsedType:
|
|
1132
|
+
parsedType: L(e)
|
|
1133
1133
|
}, r = this._parse({ data: e, path: a.path, parent: a }), s = await (oe(r) ? r : Promise.resolve(r));
|
|
1134
1134
|
return Xe(a, s);
|
|
1135
1135
|
}
|
|
@@ -1160,7 +1160,7 @@ class v {
|
|
|
1160
1160
|
return Z.create(this, this._def);
|
|
1161
1161
|
}
|
|
1162
1162
|
nullable() {
|
|
1163
|
-
return
|
|
1163
|
+
return q.create(this, this._def);
|
|
1164
1164
|
}
|
|
1165
1165
|
nullish() {
|
|
1166
1166
|
return this.nullable().optional();
|
|
@@ -1195,7 +1195,7 @@ class v {
|
|
|
1195
1195
|
});
|
|
1196
1196
|
}
|
|
1197
1197
|
brand() {
|
|
1198
|
-
return new
|
|
1198
|
+
return new Fe({
|
|
1199
1199
|
typeName: y.ZodBranded,
|
|
1200
1200
|
type: this,
|
|
1201
1201
|
...g(this._def)
|
|
@@ -1231,13 +1231,13 @@ class v {
|
|
|
1231
1231
|
}
|
|
1232
1232
|
}
|
|
1233
1233
|
const mn = /^c[^\s-]{8,}$/i, yn = /^[0-9a-z]+$/, bn = /^[0-9A-HJKMNP-TV-Z]{26}$/, gn = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i, vn = /^[a-z0-9_-]{21}$/i, _n = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/, xn = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, wn = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
1234
|
-
let
|
|
1235
|
-
const kn = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, Tn = /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/, Cn = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, ft = "((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",
|
|
1234
|
+
let je;
|
|
1235
|
+
const kn = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, Tn = /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/, Cn = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, ft = "((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))", In = new RegExp(`^${ft}$`);
|
|
1236
1236
|
function ht(n) {
|
|
1237
1237
|
let e = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
|
|
1238
1238
|
return n.precision ? e = `${e}\\.\\d{${n.precision}}` : n.precision == null && (e = `${e}(\\.\\d+)?`), e;
|
|
1239
1239
|
}
|
|
1240
|
-
function
|
|
1240
|
+
function Sn(n) {
|
|
1241
1241
|
return new RegExp(`^${ht(n)}$`);
|
|
1242
1242
|
}
|
|
1243
1243
|
function pt(n) {
|
|
@@ -1245,16 +1245,16 @@ function pt(n) {
|
|
|
1245
1245
|
const t = [];
|
|
1246
1246
|
return t.push(n.local ? "Z?" : "Z"), n.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
|
|
1247
1247
|
}
|
|
1248
|
-
function
|
|
1248
|
+
function An(n, e) {
|
|
1249
1249
|
return !!((e === "v4" || !e) && kn.test(n) || (e === "v6" || !e) && Tn.test(n));
|
|
1250
1250
|
}
|
|
1251
1251
|
class N extends v {
|
|
1252
1252
|
_parse(e) {
|
|
1253
|
-
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !==
|
|
1253
|
+
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== h.string) {
|
|
1254
1254
|
const s = this._getOrReturnCtx(e);
|
|
1255
|
-
return
|
|
1255
|
+
return f(s, {
|
|
1256
1256
|
code: d.invalid_type,
|
|
1257
|
-
expected:
|
|
1257
|
+
expected: h.string,
|
|
1258
1258
|
received: s.parsedType
|
|
1259
1259
|
}), b;
|
|
1260
1260
|
}
|
|
@@ -1262,7 +1262,7 @@ class N extends v {
|
|
|
1262
1262
|
let r;
|
|
1263
1263
|
for (const s of this._def.checks)
|
|
1264
1264
|
if (s.kind === "min")
|
|
1265
|
-
e.data.length < s.value && (r = this._getOrReturnCtx(e, r),
|
|
1265
|
+
e.data.length < s.value && (r = this._getOrReturnCtx(e, r), f(r, {
|
|
1266
1266
|
code: d.too_small,
|
|
1267
1267
|
minimum: s.value,
|
|
1268
1268
|
type: "string",
|
|
@@ -1271,7 +1271,7 @@ class N extends v {
|
|
|
1271
1271
|
message: s.message
|
|
1272
1272
|
}), a.dirty());
|
|
1273
1273
|
else if (s.kind === "max")
|
|
1274
|
-
e.data.length > s.value && (r = this._getOrReturnCtx(e, r),
|
|
1274
|
+
e.data.length > s.value && (r = this._getOrReturnCtx(e, r), f(r, {
|
|
1275
1275
|
code: d.too_big,
|
|
1276
1276
|
maximum: s.value,
|
|
1277
1277
|
type: "string",
|
|
@@ -1281,14 +1281,14 @@ class N extends v {
|
|
|
1281
1281
|
}), a.dirty());
|
|
1282
1282
|
else if (s.kind === "length") {
|
|
1283
1283
|
const i = e.data.length > s.value, o = e.data.length < s.value;
|
|
1284
|
-
(i || o) && (r = this._getOrReturnCtx(e, r), i ?
|
|
1284
|
+
(i || o) && (r = this._getOrReturnCtx(e, r), i ? f(r, {
|
|
1285
1285
|
code: d.too_big,
|
|
1286
1286
|
maximum: s.value,
|
|
1287
1287
|
type: "string",
|
|
1288
1288
|
inclusive: !0,
|
|
1289
1289
|
exact: !0,
|
|
1290
1290
|
message: s.message
|
|
1291
|
-
}) : o &&
|
|
1291
|
+
}) : o && f(r, {
|
|
1292
1292
|
code: d.too_small,
|
|
1293
1293
|
minimum: s.value,
|
|
1294
1294
|
type: "string",
|
|
@@ -1297,43 +1297,43 @@ class N extends v {
|
|
|
1297
1297
|
message: s.message
|
|
1298
1298
|
}), a.dirty());
|
|
1299
1299
|
} else if (s.kind === "email")
|
|
1300
|
-
xn.test(e.data) || (r = this._getOrReturnCtx(e, r),
|
|
1300
|
+
xn.test(e.data) || (r = this._getOrReturnCtx(e, r), f(r, {
|
|
1301
1301
|
validation: "email",
|
|
1302
1302
|
code: d.invalid_string,
|
|
1303
1303
|
message: s.message
|
|
1304
1304
|
}), a.dirty());
|
|
1305
1305
|
else if (s.kind === "emoji")
|
|
1306
|
-
|
|
1306
|
+
je || (je = new RegExp(wn, "u")), je.test(e.data) || (r = this._getOrReturnCtx(e, r), f(r, {
|
|
1307
1307
|
validation: "emoji",
|
|
1308
1308
|
code: d.invalid_string,
|
|
1309
1309
|
message: s.message
|
|
1310
1310
|
}), a.dirty());
|
|
1311
1311
|
else if (s.kind === "uuid")
|
|
1312
|
-
gn.test(e.data) || (r = this._getOrReturnCtx(e, r),
|
|
1312
|
+
gn.test(e.data) || (r = this._getOrReturnCtx(e, r), f(r, {
|
|
1313
1313
|
validation: "uuid",
|
|
1314
1314
|
code: d.invalid_string,
|
|
1315
1315
|
message: s.message
|
|
1316
1316
|
}), a.dirty());
|
|
1317
1317
|
else if (s.kind === "nanoid")
|
|
1318
|
-
vn.test(e.data) || (r = this._getOrReturnCtx(e, r),
|
|
1318
|
+
vn.test(e.data) || (r = this._getOrReturnCtx(e, r), f(r, {
|
|
1319
1319
|
validation: "nanoid",
|
|
1320
1320
|
code: d.invalid_string,
|
|
1321
1321
|
message: s.message
|
|
1322
1322
|
}), a.dirty());
|
|
1323
1323
|
else if (s.kind === "cuid")
|
|
1324
|
-
mn.test(e.data) || (r = this._getOrReturnCtx(e, r),
|
|
1324
|
+
mn.test(e.data) || (r = this._getOrReturnCtx(e, r), f(r, {
|
|
1325
1325
|
validation: "cuid",
|
|
1326
1326
|
code: d.invalid_string,
|
|
1327
1327
|
message: s.message
|
|
1328
1328
|
}), a.dirty());
|
|
1329
1329
|
else if (s.kind === "cuid2")
|
|
1330
|
-
yn.test(e.data) || (r = this._getOrReturnCtx(e, r),
|
|
1330
|
+
yn.test(e.data) || (r = this._getOrReturnCtx(e, r), f(r, {
|
|
1331
1331
|
validation: "cuid2",
|
|
1332
1332
|
code: d.invalid_string,
|
|
1333
1333
|
message: s.message
|
|
1334
1334
|
}), a.dirty());
|
|
1335
1335
|
else if (s.kind === "ulid")
|
|
1336
|
-
bn.test(e.data) || (r = this._getOrReturnCtx(e, r),
|
|
1336
|
+
bn.test(e.data) || (r = this._getOrReturnCtx(e, r), f(r, {
|
|
1337
1337
|
validation: "ulid",
|
|
1338
1338
|
code: d.invalid_string,
|
|
1339
1339
|
message: s.message
|
|
@@ -1342,49 +1342,49 @@ class N extends v {
|
|
|
1342
1342
|
try {
|
|
1343
1343
|
new URL(e.data);
|
|
1344
1344
|
} catch {
|
|
1345
|
-
r = this._getOrReturnCtx(e, r),
|
|
1345
|
+
r = this._getOrReturnCtx(e, r), f(r, {
|
|
1346
1346
|
validation: "url",
|
|
1347
1347
|
code: d.invalid_string,
|
|
1348
1348
|
message: s.message
|
|
1349
1349
|
}), a.dirty();
|
|
1350
1350
|
}
|
|
1351
|
-
else s.kind === "regex" ? (s.regex.lastIndex = 0, s.regex.test(e.data) || (r = this._getOrReturnCtx(e, r),
|
|
1351
|
+
else s.kind === "regex" ? (s.regex.lastIndex = 0, s.regex.test(e.data) || (r = this._getOrReturnCtx(e, r), f(r, {
|
|
1352
1352
|
validation: "regex",
|
|
1353
1353
|
code: d.invalid_string,
|
|
1354
1354
|
message: s.message
|
|
1355
|
-
}), a.dirty())) : s.kind === "trim" ? e.data = e.data.trim() : s.kind === "includes" ? e.data.includes(s.value, s.position) || (r = this._getOrReturnCtx(e, r),
|
|
1355
|
+
}), a.dirty())) : s.kind === "trim" ? e.data = e.data.trim() : s.kind === "includes" ? e.data.includes(s.value, s.position) || (r = this._getOrReturnCtx(e, r), f(r, {
|
|
1356
1356
|
code: d.invalid_string,
|
|
1357
1357
|
validation: { includes: s.value, position: s.position },
|
|
1358
1358
|
message: s.message
|
|
1359
|
-
}), a.dirty()) : s.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : s.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : s.kind === "startsWith" ? e.data.startsWith(s.value) || (r = this._getOrReturnCtx(e, r),
|
|
1359
|
+
}), a.dirty()) : s.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : s.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : s.kind === "startsWith" ? e.data.startsWith(s.value) || (r = this._getOrReturnCtx(e, r), f(r, {
|
|
1360
1360
|
code: d.invalid_string,
|
|
1361
1361
|
validation: { startsWith: s.value },
|
|
1362
1362
|
message: s.message
|
|
1363
|
-
}), a.dirty()) : s.kind === "endsWith" ? e.data.endsWith(s.value) || (r = this._getOrReturnCtx(e, r),
|
|
1363
|
+
}), a.dirty()) : s.kind === "endsWith" ? e.data.endsWith(s.value) || (r = this._getOrReturnCtx(e, r), f(r, {
|
|
1364
1364
|
code: d.invalid_string,
|
|
1365
1365
|
validation: { endsWith: s.value },
|
|
1366
1366
|
message: s.message
|
|
1367
|
-
}), a.dirty()) : s.kind === "datetime" ? pt(s).test(e.data) || (r = this._getOrReturnCtx(e, r),
|
|
1367
|
+
}), a.dirty()) : s.kind === "datetime" ? pt(s).test(e.data) || (r = this._getOrReturnCtx(e, r), f(r, {
|
|
1368
1368
|
code: d.invalid_string,
|
|
1369
1369
|
validation: "datetime",
|
|
1370
1370
|
message: s.message
|
|
1371
|
-
}), a.dirty()) : s.kind === "date" ?
|
|
1371
|
+
}), a.dirty()) : s.kind === "date" ? In.test(e.data) || (r = this._getOrReturnCtx(e, r), f(r, {
|
|
1372
1372
|
code: d.invalid_string,
|
|
1373
1373
|
validation: "date",
|
|
1374
1374
|
message: s.message
|
|
1375
|
-
}), a.dirty()) : s.kind === "time" ?
|
|
1375
|
+
}), a.dirty()) : s.kind === "time" ? Sn(s).test(e.data) || (r = this._getOrReturnCtx(e, r), f(r, {
|
|
1376
1376
|
code: d.invalid_string,
|
|
1377
1377
|
validation: "time",
|
|
1378
1378
|
message: s.message
|
|
1379
|
-
}), a.dirty()) : s.kind === "duration" ? _n.test(e.data) || (r = this._getOrReturnCtx(e, r),
|
|
1379
|
+
}), a.dirty()) : s.kind === "duration" ? _n.test(e.data) || (r = this._getOrReturnCtx(e, r), f(r, {
|
|
1380
1380
|
validation: "duration",
|
|
1381
1381
|
code: d.invalid_string,
|
|
1382
1382
|
message: s.message
|
|
1383
|
-
}), a.dirty()) : s.kind === "ip" ?
|
|
1383
|
+
}), a.dirty()) : s.kind === "ip" ? An(e.data, s.version) || (r = this._getOrReturnCtx(e, r), f(r, {
|
|
1384
1384
|
validation: "ip",
|
|
1385
1385
|
code: d.invalid_string,
|
|
1386
1386
|
message: s.message
|
|
1387
|
-
}), a.dirty()) : s.kind === "base64" ? Cn.test(e.data) || (r = this._getOrReturnCtx(e, r),
|
|
1387
|
+
}), a.dirty()) : s.kind === "base64" ? Cn.test(e.data) || (r = this._getOrReturnCtx(e, r), f(r, {
|
|
1388
1388
|
validation: "base64",
|
|
1389
1389
|
code: d.invalid_string,
|
|
1390
1390
|
message: s.message
|
|
@@ -1606,50 +1606,50 @@ N.create = (n) => {
|
|
|
1606
1606
|
...g(n)
|
|
1607
1607
|
});
|
|
1608
1608
|
};
|
|
1609
|
-
function
|
|
1609
|
+
function En(n, e) {
|
|
1610
1610
|
const t = (n.toString().split(".")[1] || "").length, a = (e.toString().split(".")[1] || "").length, r = t > a ? t : a, s = parseInt(n.toFixed(r).replace(".", "")), i = parseInt(e.toFixed(r).replace(".", ""));
|
|
1611
1611
|
return s % i / Math.pow(10, r);
|
|
1612
1612
|
}
|
|
1613
|
-
class
|
|
1613
|
+
class z extends v {
|
|
1614
1614
|
constructor() {
|
|
1615
1615
|
super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
|
|
1616
1616
|
}
|
|
1617
1617
|
_parse(e) {
|
|
1618
|
-
if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !==
|
|
1618
|
+
if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== h.number) {
|
|
1619
1619
|
const s = this._getOrReturnCtx(e);
|
|
1620
|
-
return
|
|
1620
|
+
return f(s, {
|
|
1621
1621
|
code: d.invalid_type,
|
|
1622
|
-
expected:
|
|
1622
|
+
expected: h.number,
|
|
1623
1623
|
received: s.parsedType
|
|
1624
1624
|
}), b;
|
|
1625
1625
|
}
|
|
1626
1626
|
let a;
|
|
1627
1627
|
const r = new S();
|
|
1628
1628
|
for (const s of this._def.checks)
|
|
1629
|
-
s.kind === "int" ? _.isInteger(e.data) || (a = this._getOrReturnCtx(e, a),
|
|
1629
|
+
s.kind === "int" ? _.isInteger(e.data) || (a = this._getOrReturnCtx(e, a), f(a, {
|
|
1630
1630
|
code: d.invalid_type,
|
|
1631
1631
|
expected: "integer",
|
|
1632
1632
|
received: "float",
|
|
1633
1633
|
message: s.message
|
|
1634
|
-
}), r.dirty()) : s.kind === "min" ? (s.inclusive ? e.data < s.value : e.data <= s.value) && (a = this._getOrReturnCtx(e, a),
|
|
1634
|
+
}), r.dirty()) : s.kind === "min" ? (s.inclusive ? e.data < s.value : e.data <= s.value) && (a = this._getOrReturnCtx(e, a), f(a, {
|
|
1635
1635
|
code: d.too_small,
|
|
1636
1636
|
minimum: s.value,
|
|
1637
1637
|
type: "number",
|
|
1638
1638
|
inclusive: s.inclusive,
|
|
1639
1639
|
exact: !1,
|
|
1640
1640
|
message: s.message
|
|
1641
|
-
}), r.dirty()) : s.kind === "max" ? (s.inclusive ? e.data > s.value : e.data >= s.value) && (a = this._getOrReturnCtx(e, a),
|
|
1641
|
+
}), r.dirty()) : s.kind === "max" ? (s.inclusive ? e.data > s.value : e.data >= s.value) && (a = this._getOrReturnCtx(e, a), f(a, {
|
|
1642
1642
|
code: d.too_big,
|
|
1643
1643
|
maximum: s.value,
|
|
1644
1644
|
type: "number",
|
|
1645
1645
|
inclusive: s.inclusive,
|
|
1646
1646
|
exact: !1,
|
|
1647
1647
|
message: s.message
|
|
1648
|
-
}), r.dirty()) : s.kind === "multipleOf" ?
|
|
1648
|
+
}), r.dirty()) : s.kind === "multipleOf" ? En(e.data, s.value) !== 0 && (a = this._getOrReturnCtx(e, a), f(a, {
|
|
1649
1649
|
code: d.not_multiple_of,
|
|
1650
1650
|
multipleOf: s.value,
|
|
1651
1651
|
message: s.message
|
|
1652
|
-
}), r.dirty()) : s.kind === "finite" ? Number.isFinite(e.data) || (a = this._getOrReturnCtx(e, a),
|
|
1652
|
+
}), r.dirty()) : s.kind === "finite" ? Number.isFinite(e.data) || (a = this._getOrReturnCtx(e, a), f(a, {
|
|
1653
1653
|
code: d.not_finite,
|
|
1654
1654
|
message: s.message
|
|
1655
1655
|
}), r.dirty()) : _.assertNever(s);
|
|
@@ -1668,7 +1668,7 @@ class L extends v {
|
|
|
1668
1668
|
return this.setLimit("max", e, !1, p.toString(t));
|
|
1669
1669
|
}
|
|
1670
1670
|
setLimit(e, t, a, r) {
|
|
1671
|
-
return new
|
|
1671
|
+
return new z({
|
|
1672
1672
|
...this._def,
|
|
1673
1673
|
checks: [
|
|
1674
1674
|
...this._def.checks,
|
|
@@ -1682,7 +1682,7 @@ class L extends v {
|
|
|
1682
1682
|
});
|
|
1683
1683
|
}
|
|
1684
1684
|
_addCheck(e) {
|
|
1685
|
-
return new
|
|
1685
|
+
return new z({
|
|
1686
1686
|
...this._def,
|
|
1687
1687
|
checks: [...this._def.checks, e]
|
|
1688
1688
|
});
|
|
@@ -1776,41 +1776,41 @@ class L extends v {
|
|
|
1776
1776
|
return Number.isFinite(t) && Number.isFinite(e);
|
|
1777
1777
|
}
|
|
1778
1778
|
}
|
|
1779
|
-
|
|
1779
|
+
z.create = (n) => new z({
|
|
1780
1780
|
checks: [],
|
|
1781
1781
|
typeName: y.ZodNumber,
|
|
1782
1782
|
coerce: (n == null ? void 0 : n.coerce) || !1,
|
|
1783
1783
|
...g(n)
|
|
1784
1784
|
});
|
|
1785
|
-
class
|
|
1785
|
+
class U extends v {
|
|
1786
1786
|
constructor() {
|
|
1787
1787
|
super(...arguments), this.min = this.gte, this.max = this.lte;
|
|
1788
1788
|
}
|
|
1789
1789
|
_parse(e) {
|
|
1790
|
-
if (this._def.coerce && (e.data = BigInt(e.data)), this._getType(e) !==
|
|
1790
|
+
if (this._def.coerce && (e.data = BigInt(e.data)), this._getType(e) !== h.bigint) {
|
|
1791
1791
|
const s = this._getOrReturnCtx(e);
|
|
1792
|
-
return
|
|
1792
|
+
return f(s, {
|
|
1793
1793
|
code: d.invalid_type,
|
|
1794
|
-
expected:
|
|
1794
|
+
expected: h.bigint,
|
|
1795
1795
|
received: s.parsedType
|
|
1796
1796
|
}), b;
|
|
1797
1797
|
}
|
|
1798
1798
|
let a;
|
|
1799
1799
|
const r = new S();
|
|
1800
1800
|
for (const s of this._def.checks)
|
|
1801
|
-
s.kind === "min" ? (s.inclusive ? e.data < s.value : e.data <= s.value) && (a = this._getOrReturnCtx(e, a),
|
|
1801
|
+
s.kind === "min" ? (s.inclusive ? e.data < s.value : e.data <= s.value) && (a = this._getOrReturnCtx(e, a), f(a, {
|
|
1802
1802
|
code: d.too_small,
|
|
1803
1803
|
type: "bigint",
|
|
1804
1804
|
minimum: s.value,
|
|
1805
1805
|
inclusive: s.inclusive,
|
|
1806
1806
|
message: s.message
|
|
1807
|
-
}), r.dirty()) : s.kind === "max" ? (s.inclusive ? e.data > s.value : e.data >= s.value) && (a = this._getOrReturnCtx(e, a),
|
|
1807
|
+
}), r.dirty()) : s.kind === "max" ? (s.inclusive ? e.data > s.value : e.data >= s.value) && (a = this._getOrReturnCtx(e, a), f(a, {
|
|
1808
1808
|
code: d.too_big,
|
|
1809
1809
|
type: "bigint",
|
|
1810
1810
|
maximum: s.value,
|
|
1811
1811
|
inclusive: s.inclusive,
|
|
1812
1812
|
message: s.message
|
|
1813
|
-
}), r.dirty()) : s.kind === "multipleOf" ? e.data % s.value !== BigInt(0) && (a = this._getOrReturnCtx(e, a),
|
|
1813
|
+
}), r.dirty()) : s.kind === "multipleOf" ? e.data % s.value !== BigInt(0) && (a = this._getOrReturnCtx(e, a), f(a, {
|
|
1814
1814
|
code: d.not_multiple_of,
|
|
1815
1815
|
multipleOf: s.value,
|
|
1816
1816
|
message: s.message
|
|
@@ -1830,7 +1830,7 @@ class z extends v {
|
|
|
1830
1830
|
return this.setLimit("max", e, !1, p.toString(t));
|
|
1831
1831
|
}
|
|
1832
1832
|
setLimit(e, t, a, r) {
|
|
1833
|
-
return new
|
|
1833
|
+
return new U({
|
|
1834
1834
|
...this._def,
|
|
1835
1835
|
checks: [
|
|
1836
1836
|
...this._def.checks,
|
|
@@ -1844,7 +1844,7 @@ class z extends v {
|
|
|
1844
1844
|
});
|
|
1845
1845
|
}
|
|
1846
1846
|
_addCheck(e) {
|
|
1847
|
-
return new
|
|
1847
|
+
return new U({
|
|
1848
1848
|
...this._def,
|
|
1849
1849
|
checks: [...this._def.checks, e]
|
|
1850
1850
|
});
|
|
@@ -1901,9 +1901,9 @@ class z extends v {
|
|
|
1901
1901
|
return e;
|
|
1902
1902
|
}
|
|
1903
1903
|
}
|
|
1904
|
-
|
|
1904
|
+
U.create = (n) => {
|
|
1905
1905
|
var e;
|
|
1906
|
-
return new
|
|
1906
|
+
return new U({
|
|
1907
1907
|
checks: [],
|
|
1908
1908
|
typeName: y.ZodBigInt,
|
|
1909
1909
|
coerce: (e = n == null ? void 0 : n.coerce) !== null && e !== void 0 ? e : !1,
|
|
@@ -1912,15 +1912,15 @@ z.create = (n) => {
|
|
|
1912
1912
|
};
|
|
1913
1913
|
class ce extends v {
|
|
1914
1914
|
_parse(e) {
|
|
1915
|
-
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !==
|
|
1915
|
+
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== h.boolean) {
|
|
1916
1916
|
const a = this._getOrReturnCtx(e);
|
|
1917
|
-
return
|
|
1917
|
+
return f(a, {
|
|
1918
1918
|
code: d.invalid_type,
|
|
1919
|
-
expected:
|
|
1919
|
+
expected: h.boolean,
|
|
1920
1920
|
received: a.parsedType
|
|
1921
1921
|
}), b;
|
|
1922
1922
|
}
|
|
1923
|
-
return
|
|
1923
|
+
return A(e.data);
|
|
1924
1924
|
}
|
|
1925
1925
|
}
|
|
1926
1926
|
ce.create = (n) => new ce({
|
|
@@ -1928,33 +1928,33 @@ ce.create = (n) => new ce({
|
|
|
1928
1928
|
coerce: (n == null ? void 0 : n.coerce) || !1,
|
|
1929
1929
|
...g(n)
|
|
1930
1930
|
});
|
|
1931
|
-
class
|
|
1931
|
+
class G extends v {
|
|
1932
1932
|
_parse(e) {
|
|
1933
|
-
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !==
|
|
1933
|
+
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== h.date) {
|
|
1934
1934
|
const s = this._getOrReturnCtx(e);
|
|
1935
|
-
return
|
|
1935
|
+
return f(s, {
|
|
1936
1936
|
code: d.invalid_type,
|
|
1937
|
-
expected:
|
|
1937
|
+
expected: h.date,
|
|
1938
1938
|
received: s.parsedType
|
|
1939
1939
|
}), b;
|
|
1940
1940
|
}
|
|
1941
1941
|
if (isNaN(e.data.getTime())) {
|
|
1942
1942
|
const s = this._getOrReturnCtx(e);
|
|
1943
|
-
return
|
|
1943
|
+
return f(s, {
|
|
1944
1944
|
code: d.invalid_date
|
|
1945
1945
|
}), b;
|
|
1946
1946
|
}
|
|
1947
1947
|
const a = new S();
|
|
1948
1948
|
let r;
|
|
1949
1949
|
for (const s of this._def.checks)
|
|
1950
|
-
s.kind === "min" ? e.data.getTime() < s.value && (r = this._getOrReturnCtx(e, r),
|
|
1950
|
+
s.kind === "min" ? e.data.getTime() < s.value && (r = this._getOrReturnCtx(e, r), f(r, {
|
|
1951
1951
|
code: d.too_small,
|
|
1952
1952
|
message: s.message,
|
|
1953
1953
|
inclusive: !0,
|
|
1954
1954
|
exact: !1,
|
|
1955
1955
|
minimum: s.value,
|
|
1956
1956
|
type: "date"
|
|
1957
|
-
}), a.dirty()) : s.kind === "max" ? e.data.getTime() > s.value && (r = this._getOrReturnCtx(e, r),
|
|
1957
|
+
}), a.dirty()) : s.kind === "max" ? e.data.getTime() > s.value && (r = this._getOrReturnCtx(e, r), f(r, {
|
|
1958
1958
|
code: d.too_big,
|
|
1959
1959
|
message: s.message,
|
|
1960
1960
|
inclusive: !0,
|
|
@@ -1968,7 +1968,7 @@ class J extends v {
|
|
|
1968
1968
|
};
|
|
1969
1969
|
}
|
|
1970
1970
|
_addCheck(e) {
|
|
1971
|
-
return new
|
|
1971
|
+
return new G({
|
|
1972
1972
|
...this._def,
|
|
1973
1973
|
checks: [...this._def.checks, e]
|
|
1974
1974
|
});
|
|
@@ -2000,40 +2000,40 @@ class J extends v {
|
|
|
2000
2000
|
return e != null ? new Date(e) : null;
|
|
2001
2001
|
}
|
|
2002
2002
|
}
|
|
2003
|
-
|
|
2003
|
+
G.create = (n) => new G({
|
|
2004
2004
|
checks: [],
|
|
2005
2005
|
coerce: (n == null ? void 0 : n.coerce) || !1,
|
|
2006
2006
|
typeName: y.ZodDate,
|
|
2007
2007
|
...g(n)
|
|
2008
2008
|
});
|
|
2009
|
-
class
|
|
2009
|
+
class Ie extends v {
|
|
2010
2010
|
_parse(e) {
|
|
2011
|
-
if (this._getType(e) !==
|
|
2011
|
+
if (this._getType(e) !== h.symbol) {
|
|
2012
2012
|
const a = this._getOrReturnCtx(e);
|
|
2013
|
-
return
|
|
2013
|
+
return f(a, {
|
|
2014
2014
|
code: d.invalid_type,
|
|
2015
|
-
expected:
|
|
2015
|
+
expected: h.symbol,
|
|
2016
2016
|
received: a.parsedType
|
|
2017
2017
|
}), b;
|
|
2018
2018
|
}
|
|
2019
|
-
return
|
|
2019
|
+
return A(e.data);
|
|
2020
2020
|
}
|
|
2021
2021
|
}
|
|
2022
|
-
|
|
2022
|
+
Ie.create = (n) => new Ie({
|
|
2023
2023
|
typeName: y.ZodSymbol,
|
|
2024
2024
|
...g(n)
|
|
2025
2025
|
});
|
|
2026
2026
|
class de extends v {
|
|
2027
2027
|
_parse(e) {
|
|
2028
|
-
if (this._getType(e) !==
|
|
2028
|
+
if (this._getType(e) !== h.undefined) {
|
|
2029
2029
|
const a = this._getOrReturnCtx(e);
|
|
2030
|
-
return
|
|
2030
|
+
return f(a, {
|
|
2031
2031
|
code: d.invalid_type,
|
|
2032
|
-
expected:
|
|
2032
|
+
expected: h.undefined,
|
|
2033
2033
|
received: a.parsedType
|
|
2034
2034
|
}), b;
|
|
2035
2035
|
}
|
|
2036
|
-
return
|
|
2036
|
+
return A(e.data);
|
|
2037
2037
|
}
|
|
2038
2038
|
}
|
|
2039
2039
|
de.create = (n) => new de({
|
|
@@ -2042,15 +2042,15 @@ de.create = (n) => new de({
|
|
|
2042
2042
|
});
|
|
2043
2043
|
class ue extends v {
|
|
2044
2044
|
_parse(e) {
|
|
2045
|
-
if (this._getType(e) !==
|
|
2045
|
+
if (this._getType(e) !== h.null) {
|
|
2046
2046
|
const a = this._getOrReturnCtx(e);
|
|
2047
|
-
return
|
|
2047
|
+
return f(a, {
|
|
2048
2048
|
code: d.invalid_type,
|
|
2049
|
-
expected:
|
|
2049
|
+
expected: h.null,
|
|
2050
2050
|
received: a.parsedType
|
|
2051
2051
|
}), b;
|
|
2052
2052
|
}
|
|
2053
|
-
return
|
|
2053
|
+
return A(e.data);
|
|
2054
2054
|
}
|
|
2055
2055
|
}
|
|
2056
2056
|
ue.create = (n) => new ue({
|
|
@@ -2062,7 +2062,7 @@ class te extends v {
|
|
|
2062
2062
|
super(...arguments), this._any = !0;
|
|
2063
2063
|
}
|
|
2064
2064
|
_parse(e) {
|
|
2065
|
-
return
|
|
2065
|
+
return A(e.data);
|
|
2066
2066
|
}
|
|
2067
2067
|
}
|
|
2068
2068
|
te.create = (n) => new te({
|
|
@@ -2074,38 +2074,38 @@ class H extends v {
|
|
|
2074
2074
|
super(...arguments), this._unknown = !0;
|
|
2075
2075
|
}
|
|
2076
2076
|
_parse(e) {
|
|
2077
|
-
return
|
|
2077
|
+
return A(e.data);
|
|
2078
2078
|
}
|
|
2079
2079
|
}
|
|
2080
2080
|
H.create = (n) => new H({
|
|
2081
2081
|
typeName: y.ZodUnknown,
|
|
2082
2082
|
...g(n)
|
|
2083
2083
|
});
|
|
2084
|
-
class
|
|
2084
|
+
class V extends v {
|
|
2085
2085
|
_parse(e) {
|
|
2086
2086
|
const t = this._getOrReturnCtx(e);
|
|
2087
|
-
return
|
|
2087
|
+
return f(t, {
|
|
2088
2088
|
code: d.invalid_type,
|
|
2089
|
-
expected:
|
|
2089
|
+
expected: h.never,
|
|
2090
2090
|
received: t.parsedType
|
|
2091
2091
|
}), b;
|
|
2092
2092
|
}
|
|
2093
2093
|
}
|
|
2094
|
-
|
|
2094
|
+
V.create = (n) => new V({
|
|
2095
2095
|
typeName: y.ZodNever,
|
|
2096
2096
|
...g(n)
|
|
2097
2097
|
});
|
|
2098
2098
|
class Se extends v {
|
|
2099
2099
|
_parse(e) {
|
|
2100
|
-
if (this._getType(e) !==
|
|
2100
|
+
if (this._getType(e) !== h.undefined) {
|
|
2101
2101
|
const a = this._getOrReturnCtx(e);
|
|
2102
|
-
return
|
|
2102
|
+
return f(a, {
|
|
2103
2103
|
code: d.invalid_type,
|
|
2104
|
-
expected:
|
|
2104
|
+
expected: h.void,
|
|
2105
2105
|
received: a.parsedType
|
|
2106
2106
|
}), b;
|
|
2107
2107
|
}
|
|
2108
|
-
return
|
|
2108
|
+
return A(e.data);
|
|
2109
2109
|
}
|
|
2110
2110
|
}
|
|
2111
2111
|
Se.create = (n) => new Se({
|
|
@@ -2115,15 +2115,15 @@ Se.create = (n) => new Se({
|
|
|
2115
2115
|
class O extends v {
|
|
2116
2116
|
_parse(e) {
|
|
2117
2117
|
const { ctx: t, status: a } = this._processInputParams(e), r = this._def;
|
|
2118
|
-
if (t.parsedType !==
|
|
2119
|
-
return
|
|
2118
|
+
if (t.parsedType !== h.array)
|
|
2119
|
+
return f(t, {
|
|
2120
2120
|
code: d.invalid_type,
|
|
2121
|
-
expected:
|
|
2121
|
+
expected: h.array,
|
|
2122
2122
|
received: t.parsedType
|
|
2123
2123
|
}), b;
|
|
2124
2124
|
if (r.exactLength !== null) {
|
|
2125
2125
|
const i = t.data.length > r.exactLength.value, o = t.data.length < r.exactLength.value;
|
|
2126
|
-
(i || o) && (
|
|
2126
|
+
(i || o) && (f(t, {
|
|
2127
2127
|
code: i ? d.too_big : d.too_small,
|
|
2128
2128
|
minimum: o ? r.exactLength.value : void 0,
|
|
2129
2129
|
maximum: i ? r.exactLength.value : void 0,
|
|
@@ -2133,14 +2133,14 @@ class O extends v {
|
|
|
2133
2133
|
message: r.exactLength.message
|
|
2134
2134
|
}), a.dirty());
|
|
2135
2135
|
}
|
|
2136
|
-
if (r.minLength !== null && t.data.length < r.minLength.value && (
|
|
2136
|
+
if (r.minLength !== null && t.data.length < r.minLength.value && (f(t, {
|
|
2137
2137
|
code: d.too_small,
|
|
2138
2138
|
minimum: r.minLength.value,
|
|
2139
2139
|
type: "array",
|
|
2140
2140
|
inclusive: !0,
|
|
2141
2141
|
exact: !1,
|
|
2142
2142
|
message: r.minLength.message
|
|
2143
|
-
}), a.dirty()), r.maxLength !== null && t.data.length > r.maxLength.value && (
|
|
2143
|
+
}), a.dirty()), r.maxLength !== null && t.data.length > r.maxLength.value && (f(t, {
|
|
2144
2144
|
code: d.too_big,
|
|
2145
2145
|
maximum: r.maxLength.value,
|
|
2146
2146
|
type: "array",
|
|
@@ -2186,22 +2186,22 @@ O.create = (n, e) => new O({
|
|
|
2186
2186
|
...g(e)
|
|
2187
2187
|
});
|
|
2188
2188
|
function Q(n) {
|
|
2189
|
-
if (n instanceof
|
|
2189
|
+
if (n instanceof k) {
|
|
2190
2190
|
const e = {};
|
|
2191
2191
|
for (const t in n.shape) {
|
|
2192
2192
|
const a = n.shape[t];
|
|
2193
2193
|
e[t] = Z.create(Q(a));
|
|
2194
2194
|
}
|
|
2195
|
-
return new
|
|
2195
|
+
return new k({
|
|
2196
2196
|
...n._def,
|
|
2197
2197
|
shape: () => e
|
|
2198
2198
|
});
|
|
2199
2199
|
} else return n instanceof O ? new O({
|
|
2200
2200
|
...n._def,
|
|
2201
2201
|
type: Q(n.element)
|
|
2202
|
-
}) : n instanceof Z ? Z.create(Q(n.unwrap())) : n instanceof
|
|
2202
|
+
}) : n instanceof Z ? Z.create(Q(n.unwrap())) : n instanceof q ? q.create(Q(n.unwrap())) : n instanceof M ? M.create(n.items.map((e) => Q(e))) : n;
|
|
2203
2203
|
}
|
|
2204
|
-
class
|
|
2204
|
+
class k extends v {
|
|
2205
2205
|
constructor() {
|
|
2206
2206
|
super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
|
|
2207
2207
|
}
|
|
@@ -2212,16 +2212,16 @@ class x extends v {
|
|
|
2212
2212
|
return this._cached = { shape: e, keys: t };
|
|
2213
2213
|
}
|
|
2214
2214
|
_parse(e) {
|
|
2215
|
-
if (this._getType(e) !==
|
|
2215
|
+
if (this._getType(e) !== h.object) {
|
|
2216
2216
|
const c = this._getOrReturnCtx(e);
|
|
2217
|
-
return
|
|
2217
|
+
return f(c, {
|
|
2218
2218
|
code: d.invalid_type,
|
|
2219
|
-
expected:
|
|
2219
|
+
expected: h.object,
|
|
2220
2220
|
received: c.parsedType
|
|
2221
2221
|
}), b;
|
|
2222
2222
|
}
|
|
2223
2223
|
const { status: a, ctx: r } = this._processInputParams(e), { shape: s, keys: i } = this._getCached(), o = [];
|
|
2224
|
-
if (!(this._def.catchall instanceof
|
|
2224
|
+
if (!(this._def.catchall instanceof V && this._def.unknownKeys === "strip"))
|
|
2225
2225
|
for (const c in r.data)
|
|
2226
2226
|
i.includes(c) || o.push(c);
|
|
2227
2227
|
const u = [];
|
|
@@ -2233,7 +2233,7 @@ class x extends v {
|
|
|
2233
2233
|
alwaysSet: c in r.data
|
|
2234
2234
|
});
|
|
2235
2235
|
}
|
|
2236
|
-
if (this._def.catchall instanceof
|
|
2236
|
+
if (this._def.catchall instanceof V) {
|
|
2237
2237
|
const c = this._def.unknownKeys;
|
|
2238
2238
|
if (c === "passthrough")
|
|
2239
2239
|
for (const m of o)
|
|
@@ -2242,7 +2242,7 @@ class x extends v {
|
|
|
2242
2242
|
value: { status: "valid", value: r.data[m] }
|
|
2243
2243
|
});
|
|
2244
2244
|
else if (c === "strict")
|
|
2245
|
-
o.length > 0 && (
|
|
2245
|
+
o.length > 0 && (f(r, {
|
|
2246
2246
|
code: d.unrecognized_keys,
|
|
2247
2247
|
keys: o
|
|
2248
2248
|
}), a.dirty());
|
|
@@ -2264,10 +2264,10 @@ class x extends v {
|
|
|
2264
2264
|
return r.common.async ? Promise.resolve().then(async () => {
|
|
2265
2265
|
const c = [];
|
|
2266
2266
|
for (const m of u) {
|
|
2267
|
-
const C = await m.key,
|
|
2267
|
+
const C = await m.key, Y = await m.value;
|
|
2268
2268
|
c.push({
|
|
2269
2269
|
key: C,
|
|
2270
|
-
value:
|
|
2270
|
+
value: Y,
|
|
2271
2271
|
alwaysSet: m.alwaysSet
|
|
2272
2272
|
});
|
|
2273
2273
|
}
|
|
@@ -2278,7 +2278,7 @@ class x extends v {
|
|
|
2278
2278
|
return this._def.shape();
|
|
2279
2279
|
}
|
|
2280
2280
|
strict(e) {
|
|
2281
|
-
return p.errToObj, new
|
|
2281
|
+
return p.errToObj, new k({
|
|
2282
2282
|
...this._def,
|
|
2283
2283
|
unknownKeys: "strict",
|
|
2284
2284
|
...e !== void 0 ? {
|
|
@@ -2295,13 +2295,13 @@ class x extends v {
|
|
|
2295
2295
|
});
|
|
2296
2296
|
}
|
|
2297
2297
|
strip() {
|
|
2298
|
-
return new
|
|
2298
|
+
return new k({
|
|
2299
2299
|
...this._def,
|
|
2300
2300
|
unknownKeys: "strip"
|
|
2301
2301
|
});
|
|
2302
2302
|
}
|
|
2303
2303
|
passthrough() {
|
|
2304
|
-
return new
|
|
2304
|
+
return new k({
|
|
2305
2305
|
...this._def,
|
|
2306
2306
|
unknownKeys: "passthrough"
|
|
2307
2307
|
});
|
|
@@ -2324,7 +2324,7 @@ class x extends v {
|
|
|
2324
2324
|
// }) as any;
|
|
2325
2325
|
// };
|
|
2326
2326
|
extend(e) {
|
|
2327
|
-
return new
|
|
2327
|
+
return new k({
|
|
2328
2328
|
...this._def,
|
|
2329
2329
|
shape: () => ({
|
|
2330
2330
|
...this._def.shape(),
|
|
@@ -2338,7 +2338,7 @@ class x extends v {
|
|
|
2338
2338
|
* upgrade if you are experiencing issues.
|
|
2339
2339
|
*/
|
|
2340
2340
|
merge(e) {
|
|
2341
|
-
return new
|
|
2341
|
+
return new k({
|
|
2342
2342
|
unknownKeys: e._def.unknownKeys,
|
|
2343
2343
|
catchall: e._def.catchall,
|
|
2344
2344
|
shape: () => ({
|
|
@@ -2408,7 +2408,7 @@ class x extends v {
|
|
|
2408
2408
|
// return merged;
|
|
2409
2409
|
// }
|
|
2410
2410
|
catchall(e) {
|
|
2411
|
-
return new
|
|
2411
|
+
return new k({
|
|
2412
2412
|
...this._def,
|
|
2413
2413
|
catchall: e
|
|
2414
2414
|
});
|
|
@@ -2417,7 +2417,7 @@ class x extends v {
|
|
|
2417
2417
|
const t = {};
|
|
2418
2418
|
return _.objectKeys(e).forEach((a) => {
|
|
2419
2419
|
e[a] && this.shape[a] && (t[a] = this.shape[a]);
|
|
2420
|
-
}), new
|
|
2420
|
+
}), new k({
|
|
2421
2421
|
...this._def,
|
|
2422
2422
|
shape: () => t
|
|
2423
2423
|
});
|
|
@@ -2426,7 +2426,7 @@ class x extends v {
|
|
|
2426
2426
|
const t = {};
|
|
2427
2427
|
return _.objectKeys(this.shape).forEach((a) => {
|
|
2428
2428
|
e[a] || (t[a] = this.shape[a]);
|
|
2429
|
-
}), new
|
|
2429
|
+
}), new k({
|
|
2430
2430
|
...this._def,
|
|
2431
2431
|
shape: () => t
|
|
2432
2432
|
});
|
|
@@ -2442,7 +2442,7 @@ class x extends v {
|
|
|
2442
2442
|
return _.objectKeys(this.shape).forEach((a) => {
|
|
2443
2443
|
const r = this.shape[a];
|
|
2444
2444
|
e && !e[a] ? t[a] = r : t[a] = r.optional();
|
|
2445
|
-
}), new
|
|
2445
|
+
}), new k({
|
|
2446
2446
|
...this._def,
|
|
2447
2447
|
shape: () => t
|
|
2448
2448
|
});
|
|
@@ -2458,7 +2458,7 @@ class x extends v {
|
|
|
2458
2458
|
s = s._def.innerType;
|
|
2459
2459
|
t[a] = s;
|
|
2460
2460
|
}
|
|
2461
|
-
}), new
|
|
2461
|
+
}), new k({
|
|
2462
2462
|
...this._def,
|
|
2463
2463
|
shape: () => t
|
|
2464
2464
|
});
|
|
@@ -2467,24 +2467,24 @@ class x extends v {
|
|
|
2467
2467
|
return mt(_.objectKeys(this.shape));
|
|
2468
2468
|
}
|
|
2469
2469
|
}
|
|
2470
|
-
|
|
2470
|
+
k.create = (n, e) => new k({
|
|
2471
2471
|
shape: () => n,
|
|
2472
2472
|
unknownKeys: "strip",
|
|
2473
|
-
catchall:
|
|
2473
|
+
catchall: V.create(),
|
|
2474
2474
|
typeName: y.ZodObject,
|
|
2475
2475
|
...g(e)
|
|
2476
2476
|
});
|
|
2477
|
-
|
|
2477
|
+
k.strictCreate = (n, e) => new k({
|
|
2478
2478
|
shape: () => n,
|
|
2479
2479
|
unknownKeys: "strict",
|
|
2480
|
-
catchall:
|
|
2480
|
+
catchall: V.create(),
|
|
2481
2481
|
typeName: y.ZodObject,
|
|
2482
2482
|
...g(e)
|
|
2483
2483
|
});
|
|
2484
|
-
|
|
2484
|
+
k.lazycreate = (n, e) => new k({
|
|
2485
2485
|
shape: n,
|
|
2486
2486
|
unknownKeys: "strip",
|
|
2487
|
-
catchall:
|
|
2487
|
+
catchall: V.create(),
|
|
2488
2488
|
typeName: y.ZodObject,
|
|
2489
2489
|
...g(e)
|
|
2490
2490
|
});
|
|
@@ -2498,8 +2498,8 @@ class le extends v {
|
|
|
2498
2498
|
for (const o of s)
|
|
2499
2499
|
if (o.result.status === "dirty")
|
|
2500
2500
|
return t.common.issues.push(...o.ctx.common.issues), o.result;
|
|
2501
|
-
const i = s.map((o) => new
|
|
2502
|
-
return
|
|
2501
|
+
const i = s.map((o) => new E(o.ctx.common.issues));
|
|
2502
|
+
return f(t, {
|
|
2503
2503
|
code: d.invalid_union,
|
|
2504
2504
|
unionErrors: i
|
|
2505
2505
|
}), b;
|
|
@@ -2545,8 +2545,8 @@ class le extends v {
|
|
|
2545
2545
|
}
|
|
2546
2546
|
if (s)
|
|
2547
2547
|
return t.common.issues.push(...s.ctx.common.issues), s.result;
|
|
2548
|
-
const o = i.map((u) => new
|
|
2549
|
-
return
|
|
2548
|
+
const o = i.map((u) => new E(u));
|
|
2549
|
+
return f(t, {
|
|
2550
2550
|
code: d.invalid_union,
|
|
2551
2551
|
unionErrors: o
|
|
2552
2552
|
}), b;
|
|
@@ -2561,14 +2561,14 @@ le.create = (n, e) => new le({
|
|
|
2561
2561
|
typeName: y.ZodUnion,
|
|
2562
2562
|
...g(e)
|
|
2563
2563
|
});
|
|
2564
|
-
const
|
|
2565
|
-
class
|
|
2564
|
+
const D = (n) => n instanceof pe ? D(n.schema) : n instanceof R ? D(n.innerType()) : n instanceof me ? [n.value] : n instanceof W ? n.options : n instanceof ye ? _.objectValues(n.enum) : n instanceof be ? D(n._def.innerType) : n instanceof de ? [void 0] : n instanceof ue ? [null] : n instanceof Z ? [void 0, ...D(n.unwrap())] : n instanceof q ? [null, ...D(n.unwrap())] : n instanceof Fe || n instanceof ve ? D(n.unwrap()) : n instanceof ge ? D(n._def.innerType) : [];
|
|
2565
|
+
class Oe extends v {
|
|
2566
2566
|
_parse(e) {
|
|
2567
2567
|
const { ctx: t } = this._processInputParams(e);
|
|
2568
|
-
if (t.parsedType !==
|
|
2569
|
-
return
|
|
2568
|
+
if (t.parsedType !== h.object)
|
|
2569
|
+
return f(t, {
|
|
2570
2570
|
code: d.invalid_type,
|
|
2571
|
-
expected:
|
|
2571
|
+
expected: h.object,
|
|
2572
2572
|
received: t.parsedType
|
|
2573
2573
|
}), b;
|
|
2574
2574
|
const a = this.discriminator, r = t.data[a], s = this.optionsMap.get(r);
|
|
@@ -2580,7 +2580,7 @@ class Ne extends v {
|
|
|
2580
2580
|
data: t.data,
|
|
2581
2581
|
path: t.path,
|
|
2582
2582
|
parent: t
|
|
2583
|
-
}) : (
|
|
2583
|
+
}) : (f(t, {
|
|
2584
2584
|
code: d.invalid_union_discriminator,
|
|
2585
2585
|
options: Array.from(this.optionsMap.keys()),
|
|
2586
2586
|
path: [a]
|
|
@@ -2606,7 +2606,7 @@ class Ne extends v {
|
|
|
2606
2606
|
static create(e, t, a) {
|
|
2607
2607
|
const r = /* @__PURE__ */ new Map();
|
|
2608
2608
|
for (const s of t) {
|
|
2609
|
-
const i =
|
|
2609
|
+
const i = D(s.shape[e]);
|
|
2610
2610
|
if (!i.length)
|
|
2611
2611
|
throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);
|
|
2612
2612
|
for (const o of i) {
|
|
@@ -2615,7 +2615,7 @@ class Ne extends v {
|
|
|
2615
2615
|
r.set(o, s);
|
|
2616
2616
|
}
|
|
2617
2617
|
}
|
|
2618
|
-
return new
|
|
2618
|
+
return new Oe({
|
|
2619
2619
|
typeName: y.ZodDiscriminatedUnion,
|
|
2620
2620
|
discriminator: e,
|
|
2621
2621
|
options: t,
|
|
@@ -2624,39 +2624,39 @@ class Ne extends v {
|
|
|
2624
2624
|
});
|
|
2625
2625
|
}
|
|
2626
2626
|
}
|
|
2627
|
-
function
|
|
2628
|
-
const t =
|
|
2627
|
+
function Le(n, e) {
|
|
2628
|
+
const t = L(n), a = L(e);
|
|
2629
2629
|
if (n === e)
|
|
2630
2630
|
return { valid: !0, data: n };
|
|
2631
|
-
if (t ===
|
|
2631
|
+
if (t === h.object && a === h.object) {
|
|
2632
2632
|
const r = _.objectKeys(e), s = _.objectKeys(n).filter((o) => r.indexOf(o) !== -1), i = { ...n, ...e };
|
|
2633
2633
|
for (const o of s) {
|
|
2634
|
-
const u =
|
|
2634
|
+
const u = Le(n[o], e[o]);
|
|
2635
2635
|
if (!u.valid)
|
|
2636
2636
|
return { valid: !1 };
|
|
2637
2637
|
i[o] = u.data;
|
|
2638
2638
|
}
|
|
2639
2639
|
return { valid: !0, data: i };
|
|
2640
|
-
} else if (t ===
|
|
2640
|
+
} else if (t === h.array && a === h.array) {
|
|
2641
2641
|
if (n.length !== e.length)
|
|
2642
2642
|
return { valid: !1 };
|
|
2643
2643
|
const r = [];
|
|
2644
2644
|
for (let s = 0; s < n.length; s++) {
|
|
2645
|
-
const i = n[s], o = e[s], u =
|
|
2645
|
+
const i = n[s], o = e[s], u = Le(i, o);
|
|
2646
2646
|
if (!u.valid)
|
|
2647
2647
|
return { valid: !1 };
|
|
2648
2648
|
r.push(u.data);
|
|
2649
2649
|
}
|
|
2650
2650
|
return { valid: !0, data: r };
|
|
2651
|
-
} else return t ===
|
|
2651
|
+
} else return t === h.date && a === h.date && +n == +e ? { valid: !0, data: n } : { valid: !1 };
|
|
2652
2652
|
}
|
|
2653
2653
|
class fe extends v {
|
|
2654
2654
|
_parse(e) {
|
|
2655
2655
|
const { status: t, ctx: a } = this._processInputParams(e), r = (s, i) => {
|
|
2656
|
-
if (
|
|
2656
|
+
if (Ve(s) || Ve(i))
|
|
2657
2657
|
return b;
|
|
2658
|
-
const o =
|
|
2659
|
-
return o.valid ? ((
|
|
2658
|
+
const o = Le(s.value, i.value);
|
|
2659
|
+
return o.valid ? ((Be(s) || Be(i)) && t.dirty(), { status: t.value, value: o.data }) : (f(a, {
|
|
2660
2660
|
code: d.invalid_intersection_types
|
|
2661
2661
|
}), b);
|
|
2662
2662
|
};
|
|
@@ -2691,21 +2691,21 @@ fe.create = (n, e, t) => new fe({
|
|
|
2691
2691
|
class M extends v {
|
|
2692
2692
|
_parse(e) {
|
|
2693
2693
|
const { status: t, ctx: a } = this._processInputParams(e);
|
|
2694
|
-
if (a.parsedType !==
|
|
2695
|
-
return
|
|
2694
|
+
if (a.parsedType !== h.array)
|
|
2695
|
+
return f(a, {
|
|
2696
2696
|
code: d.invalid_type,
|
|
2697
|
-
expected:
|
|
2697
|
+
expected: h.array,
|
|
2698
2698
|
received: a.parsedType
|
|
2699
2699
|
}), b;
|
|
2700
2700
|
if (a.data.length < this._def.items.length)
|
|
2701
|
-
return
|
|
2701
|
+
return f(a, {
|
|
2702
2702
|
code: d.too_small,
|
|
2703
2703
|
minimum: this._def.items.length,
|
|
2704
2704
|
inclusive: !0,
|
|
2705
2705
|
exact: !1,
|
|
2706
2706
|
type: "array"
|
|
2707
2707
|
}), b;
|
|
2708
|
-
!this._def.rest && a.data.length > this._def.items.length && (
|
|
2708
|
+
!this._def.rest && a.data.length > this._def.items.length && (f(a, {
|
|
2709
2709
|
code: d.too_big,
|
|
2710
2710
|
maximum: this._def.items.length,
|
|
2711
2711
|
inclusive: !0,
|
|
@@ -2747,10 +2747,10 @@ class he extends v {
|
|
|
2747
2747
|
}
|
|
2748
2748
|
_parse(e) {
|
|
2749
2749
|
const { status: t, ctx: a } = this._processInputParams(e);
|
|
2750
|
-
if (a.parsedType !==
|
|
2751
|
-
return
|
|
2750
|
+
if (a.parsedType !== h.object)
|
|
2751
|
+
return f(a, {
|
|
2752
2752
|
code: d.invalid_type,
|
|
2753
|
-
expected:
|
|
2753
|
+
expected: h.object,
|
|
2754
2754
|
received: a.parsedType
|
|
2755
2755
|
}), b;
|
|
2756
2756
|
const r = [], s = this._def.keyType, i = this._def.valueType;
|
|
@@ -2779,7 +2779,7 @@ class he extends v {
|
|
|
2779
2779
|
});
|
|
2780
2780
|
}
|
|
2781
2781
|
}
|
|
2782
|
-
class
|
|
2782
|
+
class Ae extends v {
|
|
2783
2783
|
get keySchema() {
|
|
2784
2784
|
return this._def.keyType;
|
|
2785
2785
|
}
|
|
@@ -2788,10 +2788,10 @@ class Ie extends v {
|
|
|
2788
2788
|
}
|
|
2789
2789
|
_parse(e) {
|
|
2790
2790
|
const { status: t, ctx: a } = this._processInputParams(e);
|
|
2791
|
-
if (a.parsedType !==
|
|
2792
|
-
return
|
|
2791
|
+
if (a.parsedType !== h.map)
|
|
2792
|
+
return f(a, {
|
|
2793
2793
|
code: d.invalid_type,
|
|
2794
|
-
expected:
|
|
2794
|
+
expected: h.map,
|
|
2795
2795
|
received: a.parsedType
|
|
2796
2796
|
}), b;
|
|
2797
2797
|
const r = this._def.keyType, s = this._def.valueType, i = [...a.data.entries()].map(([o, u], c) => ({
|
|
@@ -2821,30 +2821,30 @@ class Ie extends v {
|
|
|
2821
2821
|
}
|
|
2822
2822
|
}
|
|
2823
2823
|
}
|
|
2824
|
-
|
|
2824
|
+
Ae.create = (n, e, t) => new Ae({
|
|
2825
2825
|
valueType: e,
|
|
2826
2826
|
keyType: n,
|
|
2827
2827
|
typeName: y.ZodMap,
|
|
2828
2828
|
...g(t)
|
|
2829
2829
|
});
|
|
2830
|
-
class
|
|
2830
|
+
class J extends v {
|
|
2831
2831
|
_parse(e) {
|
|
2832
2832
|
const { status: t, ctx: a } = this._processInputParams(e);
|
|
2833
|
-
if (a.parsedType !==
|
|
2834
|
-
return
|
|
2833
|
+
if (a.parsedType !== h.set)
|
|
2834
|
+
return f(a, {
|
|
2835
2835
|
code: d.invalid_type,
|
|
2836
|
-
expected:
|
|
2836
|
+
expected: h.set,
|
|
2837
2837
|
received: a.parsedType
|
|
2838
2838
|
}), b;
|
|
2839
2839
|
const r = this._def;
|
|
2840
|
-
r.minSize !== null && a.data.size < r.minSize.value && (
|
|
2840
|
+
r.minSize !== null && a.data.size < r.minSize.value && (f(a, {
|
|
2841
2841
|
code: d.too_small,
|
|
2842
2842
|
minimum: r.minSize.value,
|
|
2843
2843
|
type: "set",
|
|
2844
2844
|
inclusive: !0,
|
|
2845
2845
|
exact: !1,
|
|
2846
2846
|
message: r.minSize.message
|
|
2847
|
-
}), t.dirty()), r.maxSize !== null && a.data.size > r.maxSize.value && (
|
|
2847
|
+
}), t.dirty()), r.maxSize !== null && a.data.size > r.maxSize.value && (f(a, {
|
|
2848
2848
|
code: d.too_big,
|
|
2849
2849
|
maximum: r.maxSize.value,
|
|
2850
2850
|
type: "set",
|
|
@@ -2866,13 +2866,13 @@ class Y extends v {
|
|
|
2866
2866
|
return a.common.async ? Promise.all(o).then((u) => i(u)) : i(o);
|
|
2867
2867
|
}
|
|
2868
2868
|
min(e, t) {
|
|
2869
|
-
return new
|
|
2869
|
+
return new J({
|
|
2870
2870
|
...this._def,
|
|
2871
2871
|
minSize: { value: e, message: p.toString(t) }
|
|
2872
2872
|
});
|
|
2873
2873
|
}
|
|
2874
2874
|
max(e, t) {
|
|
2875
|
-
return new
|
|
2875
|
+
return new J({
|
|
2876
2876
|
...this._def,
|
|
2877
2877
|
maxSize: { value: e, message: p.toString(t) }
|
|
2878
2878
|
});
|
|
@@ -2884,7 +2884,7 @@ class Y extends v {
|
|
|
2884
2884
|
return this.min(1, e);
|
|
2885
2885
|
}
|
|
2886
2886
|
}
|
|
2887
|
-
|
|
2887
|
+
J.create = (n, e) => new J({
|
|
2888
2888
|
valueType: n,
|
|
2889
2889
|
minSize: null,
|
|
2890
2890
|
maxSize: null,
|
|
@@ -2897,20 +2897,20 @@ class X extends v {
|
|
|
2897
2897
|
}
|
|
2898
2898
|
_parse(e) {
|
|
2899
2899
|
const { ctx: t } = this._processInputParams(e);
|
|
2900
|
-
if (t.parsedType !==
|
|
2901
|
-
return
|
|
2900
|
+
if (t.parsedType !== h.function)
|
|
2901
|
+
return f(t, {
|
|
2902
2902
|
code: d.invalid_type,
|
|
2903
|
-
expected:
|
|
2903
|
+
expected: h.function,
|
|
2904
2904
|
received: t.parsedType
|
|
2905
2905
|
}), b;
|
|
2906
2906
|
function a(o, u) {
|
|
2907
|
-
return
|
|
2907
|
+
return Te({
|
|
2908
2908
|
data: o,
|
|
2909
2909
|
path: t.path,
|
|
2910
2910
|
errorMaps: [
|
|
2911
2911
|
t.common.contextualErrorMap,
|
|
2912
2912
|
t.schemaErrorMap,
|
|
2913
|
-
|
|
2913
|
+
ke(),
|
|
2914
2914
|
ee
|
|
2915
2915
|
].filter((c) => !!c),
|
|
2916
2916
|
issueData: {
|
|
@@ -2920,13 +2920,13 @@ class X extends v {
|
|
|
2920
2920
|
});
|
|
2921
2921
|
}
|
|
2922
2922
|
function r(o, u) {
|
|
2923
|
-
return
|
|
2923
|
+
return Te({
|
|
2924
2924
|
data: o,
|
|
2925
2925
|
path: t.path,
|
|
2926
2926
|
errorMaps: [
|
|
2927
2927
|
t.common.contextualErrorMap,
|
|
2928
2928
|
t.schemaErrorMap,
|
|
2929
|
-
|
|
2929
|
+
ke(),
|
|
2930
2930
|
ee
|
|
2931
2931
|
].filter((c) => !!c),
|
|
2932
2932
|
issueData: {
|
|
@@ -2938,23 +2938,23 @@ class X extends v {
|
|
|
2938
2938
|
const s = { errorMap: t.common.contextualErrorMap }, i = t.data;
|
|
2939
2939
|
if (this._def.returns instanceof ne) {
|
|
2940
2940
|
const o = this;
|
|
2941
|
-
return
|
|
2942
|
-
const c = new
|
|
2943
|
-
throw c.addIssue(a(u,
|
|
2941
|
+
return A(async function(...u) {
|
|
2942
|
+
const c = new E([]), m = await o._def.args.parseAsync(u, s).catch((I) => {
|
|
2943
|
+
throw c.addIssue(a(u, I)), c;
|
|
2944
2944
|
}), C = await Reflect.apply(i, this, m);
|
|
2945
|
-
return await o._def.returns._def.type.parseAsync(C, s).catch((
|
|
2946
|
-
throw c.addIssue(r(C,
|
|
2945
|
+
return await o._def.returns._def.type.parseAsync(C, s).catch((I) => {
|
|
2946
|
+
throw c.addIssue(r(C, I)), c;
|
|
2947
2947
|
});
|
|
2948
2948
|
});
|
|
2949
2949
|
} else {
|
|
2950
2950
|
const o = this;
|
|
2951
|
-
return
|
|
2951
|
+
return A(function(...u) {
|
|
2952
2952
|
const c = o._def.args.safeParse(u, s);
|
|
2953
2953
|
if (!c.success)
|
|
2954
|
-
throw new
|
|
2954
|
+
throw new E([a(u, c.error)]);
|
|
2955
2955
|
const m = Reflect.apply(i, this, c.data), C = o._def.returns.safeParse(m, s);
|
|
2956
2956
|
if (!C.success)
|
|
2957
|
-
throw new
|
|
2957
|
+
throw new E([r(m, C.error)]);
|
|
2958
2958
|
return C.data;
|
|
2959
2959
|
});
|
|
2960
2960
|
}
|
|
@@ -3010,7 +3010,7 @@ class me extends v {
|
|
|
3010
3010
|
_parse(e) {
|
|
3011
3011
|
if (e.data !== this._def.value) {
|
|
3012
3012
|
const t = this._getOrReturnCtx(e);
|
|
3013
|
-
return
|
|
3013
|
+
return f(t, {
|
|
3014
3014
|
received: t.data,
|
|
3015
3015
|
code: d.invalid_literal,
|
|
3016
3016
|
expected: this._def.value
|
|
@@ -3028,34 +3028,34 @@ me.create = (n, e) => new me({
|
|
|
3028
3028
|
...g(e)
|
|
3029
3029
|
});
|
|
3030
3030
|
function mt(n, e) {
|
|
3031
|
-
return new
|
|
3031
|
+
return new W({
|
|
3032
3032
|
values: n,
|
|
3033
3033
|
typeName: y.ZodEnum,
|
|
3034
3034
|
...g(e)
|
|
3035
3035
|
});
|
|
3036
3036
|
}
|
|
3037
|
-
class
|
|
3037
|
+
class W extends v {
|
|
3038
3038
|
constructor() {
|
|
3039
3039
|
super(...arguments), ae.set(this, void 0);
|
|
3040
3040
|
}
|
|
3041
3041
|
_parse(e) {
|
|
3042
3042
|
if (typeof e.data != "string") {
|
|
3043
3043
|
const t = this._getOrReturnCtx(e), a = this._def.values;
|
|
3044
|
-
return
|
|
3044
|
+
return f(t, {
|
|
3045
3045
|
expected: _.joinValues(a),
|
|
3046
3046
|
received: t.parsedType,
|
|
3047
3047
|
code: d.invalid_type
|
|
3048
3048
|
}), b;
|
|
3049
3049
|
}
|
|
3050
|
-
if (
|
|
3050
|
+
if (Ce(this, ae) || lt(this, ae, new Set(this._def.values)), !Ce(this, ae).has(e.data)) {
|
|
3051
3051
|
const t = this._getOrReturnCtx(e), a = this._def.values;
|
|
3052
|
-
return
|
|
3052
|
+
return f(t, {
|
|
3053
3053
|
received: t.data,
|
|
3054
3054
|
code: d.invalid_enum_value,
|
|
3055
3055
|
options: a
|
|
3056
3056
|
}), b;
|
|
3057
3057
|
}
|
|
3058
|
-
return
|
|
3058
|
+
return A(e.data);
|
|
3059
3059
|
}
|
|
3060
3060
|
get options() {
|
|
3061
3061
|
return this._def.values;
|
|
@@ -3079,43 +3079,43 @@ class U extends v {
|
|
|
3079
3079
|
return e;
|
|
3080
3080
|
}
|
|
3081
3081
|
extract(e, t = this._def) {
|
|
3082
|
-
return
|
|
3082
|
+
return W.create(e, {
|
|
3083
3083
|
...this._def,
|
|
3084
3084
|
...t
|
|
3085
3085
|
});
|
|
3086
3086
|
}
|
|
3087
3087
|
exclude(e, t = this._def) {
|
|
3088
|
-
return
|
|
3088
|
+
return W.create(this.options.filter((a) => !e.includes(a)), {
|
|
3089
3089
|
...this._def,
|
|
3090
3090
|
...t
|
|
3091
3091
|
});
|
|
3092
3092
|
}
|
|
3093
3093
|
}
|
|
3094
3094
|
ae = /* @__PURE__ */ new WeakMap();
|
|
3095
|
-
|
|
3095
|
+
W.create = mt;
|
|
3096
3096
|
class ye extends v {
|
|
3097
3097
|
constructor() {
|
|
3098
3098
|
super(...arguments), re.set(this, void 0);
|
|
3099
3099
|
}
|
|
3100
3100
|
_parse(e) {
|
|
3101
3101
|
const t = _.getValidEnumValues(this._def.values), a = this._getOrReturnCtx(e);
|
|
3102
|
-
if (a.parsedType !==
|
|
3102
|
+
if (a.parsedType !== h.string && a.parsedType !== h.number) {
|
|
3103
3103
|
const r = _.objectValues(t);
|
|
3104
|
-
return
|
|
3104
|
+
return f(a, {
|
|
3105
3105
|
expected: _.joinValues(r),
|
|
3106
3106
|
received: a.parsedType,
|
|
3107
3107
|
code: d.invalid_type
|
|
3108
3108
|
}), b;
|
|
3109
3109
|
}
|
|
3110
|
-
if (
|
|
3110
|
+
if (Ce(this, re) || lt(this, re, new Set(_.getValidEnumValues(this._def.values))), !Ce(this, re).has(e.data)) {
|
|
3111
3111
|
const r = _.objectValues(t);
|
|
3112
|
-
return
|
|
3112
|
+
return f(a, {
|
|
3113
3113
|
received: a.data,
|
|
3114
3114
|
code: d.invalid_enum_value,
|
|
3115
3115
|
options: r
|
|
3116
3116
|
}), b;
|
|
3117
3117
|
}
|
|
3118
|
-
return
|
|
3118
|
+
return A(e.data);
|
|
3119
3119
|
}
|
|
3120
3120
|
get enum() {
|
|
3121
3121
|
return this._def.values;
|
|
@@ -3133,14 +3133,14 @@ class ne extends v {
|
|
|
3133
3133
|
}
|
|
3134
3134
|
_parse(e) {
|
|
3135
3135
|
const { ctx: t } = this._processInputParams(e);
|
|
3136
|
-
if (t.parsedType !==
|
|
3137
|
-
return
|
|
3136
|
+
if (t.parsedType !== h.promise && t.common.async === !1)
|
|
3137
|
+
return f(t, {
|
|
3138
3138
|
code: d.invalid_type,
|
|
3139
|
-
expected:
|
|
3139
|
+
expected: h.promise,
|
|
3140
3140
|
received: t.parsedType
|
|
3141
3141
|
}), b;
|
|
3142
|
-
const a = t.parsedType ===
|
|
3143
|
-
return
|
|
3142
|
+
const a = t.parsedType === h.promise ? t.data : Promise.resolve(t.data);
|
|
3143
|
+
return A(a.then((r) => this._def.type.parseAsync(r, {
|
|
3144
3144
|
path: t.path,
|
|
3145
3145
|
errorMap: t.common.contextualErrorMap
|
|
3146
3146
|
})));
|
|
@@ -3161,7 +3161,7 @@ class R extends v {
|
|
|
3161
3161
|
_parse(e) {
|
|
3162
3162
|
const { status: t, ctx: a } = this._processInputParams(e), r = this._def.effect || null, s = {
|
|
3163
3163
|
addIssue: (i) => {
|
|
3164
|
-
|
|
3164
|
+
f(a, i), i.fatal ? t.abort() : t.dirty();
|
|
3165
3165
|
},
|
|
3166
3166
|
get path() {
|
|
3167
3167
|
return a.path;
|
|
@@ -3242,7 +3242,7 @@ R.createWithPreprocess = (n, e, t) => new R({
|
|
|
3242
3242
|
});
|
|
3243
3243
|
class Z extends v {
|
|
3244
3244
|
_parse(e) {
|
|
3245
|
-
return this._getType(e) ===
|
|
3245
|
+
return this._getType(e) === h.undefined ? A(void 0) : this._def.innerType._parse(e);
|
|
3246
3246
|
}
|
|
3247
3247
|
unwrap() {
|
|
3248
3248
|
return this._def.innerType;
|
|
@@ -3253,15 +3253,15 @@ Z.create = (n, e) => new Z({
|
|
|
3253
3253
|
typeName: y.ZodOptional,
|
|
3254
3254
|
...g(e)
|
|
3255
3255
|
});
|
|
3256
|
-
class
|
|
3256
|
+
class q extends v {
|
|
3257
3257
|
_parse(e) {
|
|
3258
|
-
return this._getType(e) ===
|
|
3258
|
+
return this._getType(e) === h.null ? A(null) : this._def.innerType._parse(e);
|
|
3259
3259
|
}
|
|
3260
3260
|
unwrap() {
|
|
3261
3261
|
return this._def.innerType;
|
|
3262
3262
|
}
|
|
3263
3263
|
}
|
|
3264
|
-
|
|
3264
|
+
q.create = (n, e) => new q({
|
|
3265
3265
|
innerType: n,
|
|
3266
3266
|
typeName: y.ZodNullable,
|
|
3267
3267
|
...g(e)
|
|
@@ -3270,7 +3270,7 @@ class be extends v {
|
|
|
3270
3270
|
_parse(e) {
|
|
3271
3271
|
const { ctx: t } = this._processInputParams(e);
|
|
3272
3272
|
let a = t.data;
|
|
3273
|
-
return t.parsedType ===
|
|
3273
|
+
return t.parsedType === h.undefined && (a = this._def.defaultValue()), this._def.innerType._parse({
|
|
3274
3274
|
data: a,
|
|
3275
3275
|
path: t.path,
|
|
3276
3276
|
parent: t
|
|
@@ -3305,7 +3305,7 @@ class ge extends v {
|
|
|
3305
3305
|
status: "valid",
|
|
3306
3306
|
value: s.status === "valid" ? s.value : this._def.catchValue({
|
|
3307
3307
|
get error() {
|
|
3308
|
-
return new
|
|
3308
|
+
return new E(a.common.issues);
|
|
3309
3309
|
},
|
|
3310
3310
|
input: a.data
|
|
3311
3311
|
})
|
|
@@ -3313,7 +3313,7 @@ class ge extends v {
|
|
|
3313
3313
|
status: "valid",
|
|
3314
3314
|
value: r.status === "valid" ? r.value : this._def.catchValue({
|
|
3315
3315
|
get error() {
|
|
3316
|
-
return new
|
|
3316
|
+
return new E(a.common.issues);
|
|
3317
3317
|
},
|
|
3318
3318
|
input: a.data
|
|
3319
3319
|
})
|
|
@@ -3331,11 +3331,11 @@ ge.create = (n, e) => new ge({
|
|
|
3331
3331
|
});
|
|
3332
3332
|
class Ee extends v {
|
|
3333
3333
|
_parse(e) {
|
|
3334
|
-
if (this._getType(e) !==
|
|
3334
|
+
if (this._getType(e) !== h.nan) {
|
|
3335
3335
|
const a = this._getOrReturnCtx(e);
|
|
3336
|
-
return
|
|
3336
|
+
return f(a, {
|
|
3337
3337
|
code: d.invalid_type,
|
|
3338
|
-
expected:
|
|
3338
|
+
expected: h.nan,
|
|
3339
3339
|
received: a.parsedType
|
|
3340
3340
|
}), b;
|
|
3341
3341
|
}
|
|
@@ -3347,7 +3347,7 @@ Ee.create = (n) => new Ee({
|
|
|
3347
3347
|
...g(n)
|
|
3348
3348
|
});
|
|
3349
3349
|
const Nn = Symbol("zod_brand");
|
|
3350
|
-
class
|
|
3350
|
+
class Fe extends v {
|
|
3351
3351
|
_parse(e) {
|
|
3352
3352
|
const { ctx: t } = this._processInputParams(e), a = t.data;
|
|
3353
3353
|
return this._def.type._parse({
|
|
@@ -3424,7 +3424,7 @@ function yt(n, e = {}, t) {
|
|
|
3424
3424
|
}) : te.create();
|
|
3425
3425
|
}
|
|
3426
3426
|
const On = {
|
|
3427
|
-
object:
|
|
3427
|
+
object: k.lazycreate
|
|
3428
3428
|
};
|
|
3429
3429
|
var y;
|
|
3430
3430
|
(function(n) {
|
|
@@ -3432,78 +3432,78 @@ var y;
|
|
|
3432
3432
|
})(y || (y = {}));
|
|
3433
3433
|
const Rn = (n, e = {
|
|
3434
3434
|
message: `Input not instance of ${n.name}`
|
|
3435
|
-
}) => yt((t) => t instanceof n, e), bt = N.create, gt =
|
|
3435
|
+
}) => yt((t) => t instanceof n, e), bt = N.create, gt = z.create, Zn = Ee.create, jn = U.create, vt = ce.create, Mn = G.create, Pn = Ie.create, $n = de.create, Dn = ue.create, Vn = te.create, Bn = H.create, Ln = V.create, zn = Se.create, Un = O.create, Wn = k.create, qn = k.strictCreate, Hn = le.create, Fn = Oe.create, Gn = fe.create, Jn = M.create, Yn = he.create, Qn = Ae.create, Kn = J.create, Xn = X.create, ea = pe.create, ta = me.create, na = W.create, aa = ye.create, ra = ne.create, et = R.create, sa = Z.create, ia = q.create, oa = R.createWithPreprocess, ca = _e.create, da = () => bt().optional(), ua = () => gt().optional(), la = () => vt().optional(), fa = {
|
|
3436
3436
|
string: (n) => N.create({ ...n, coerce: !0 }),
|
|
3437
|
-
number: (n) =>
|
|
3437
|
+
number: (n) => z.create({ ...n, coerce: !0 }),
|
|
3438
3438
|
boolean: (n) => ce.create({
|
|
3439
3439
|
...n,
|
|
3440
3440
|
coerce: !0
|
|
3441
3441
|
}),
|
|
3442
|
-
bigint: (n) =>
|
|
3443
|
-
date: (n) =>
|
|
3442
|
+
bigint: (n) => U.create({ ...n, coerce: !0 }),
|
|
3443
|
+
date: (n) => G.create({ ...n, coerce: !0 })
|
|
3444
3444
|
}, ha = b;
|
|
3445
|
-
var
|
|
3445
|
+
var l = /* @__PURE__ */ Object.freeze({
|
|
3446
3446
|
__proto__: null,
|
|
3447
3447
|
defaultErrorMap: ee,
|
|
3448
3448
|
setErrorMap: hn,
|
|
3449
|
-
getErrorMap:
|
|
3450
|
-
makeIssue:
|
|
3449
|
+
getErrorMap: ke,
|
|
3450
|
+
makeIssue: Te,
|
|
3451
3451
|
EMPTY_PATH: pn,
|
|
3452
|
-
addIssueToContext:
|
|
3452
|
+
addIssueToContext: f,
|
|
3453
3453
|
ParseStatus: S,
|
|
3454
3454
|
INVALID: b,
|
|
3455
3455
|
DIRTY: K,
|
|
3456
|
-
OK:
|
|
3457
|
-
isAborted:
|
|
3458
|
-
isDirty:
|
|
3456
|
+
OK: A,
|
|
3457
|
+
isAborted: Ve,
|
|
3458
|
+
isDirty: Be,
|
|
3459
3459
|
isValid: ie,
|
|
3460
3460
|
isAsync: oe,
|
|
3461
3461
|
get util() {
|
|
3462
3462
|
return _;
|
|
3463
3463
|
},
|
|
3464
3464
|
get objectUtil() {
|
|
3465
|
-
return
|
|
3465
|
+
return De;
|
|
3466
3466
|
},
|
|
3467
|
-
ZodParsedType:
|
|
3468
|
-
getParsedType:
|
|
3467
|
+
ZodParsedType: h,
|
|
3468
|
+
getParsedType: L,
|
|
3469
3469
|
ZodType: v,
|
|
3470
3470
|
datetimeRegex: pt,
|
|
3471
3471
|
ZodString: N,
|
|
3472
|
-
ZodNumber:
|
|
3473
|
-
ZodBigInt:
|
|
3472
|
+
ZodNumber: z,
|
|
3473
|
+
ZodBigInt: U,
|
|
3474
3474
|
ZodBoolean: ce,
|
|
3475
|
-
ZodDate:
|
|
3476
|
-
ZodSymbol:
|
|
3475
|
+
ZodDate: G,
|
|
3476
|
+
ZodSymbol: Ie,
|
|
3477
3477
|
ZodUndefined: de,
|
|
3478
3478
|
ZodNull: ue,
|
|
3479
3479
|
ZodAny: te,
|
|
3480
3480
|
ZodUnknown: H,
|
|
3481
|
-
ZodNever:
|
|
3481
|
+
ZodNever: V,
|
|
3482
3482
|
ZodVoid: Se,
|
|
3483
3483
|
ZodArray: O,
|
|
3484
|
-
ZodObject:
|
|
3484
|
+
ZodObject: k,
|
|
3485
3485
|
ZodUnion: le,
|
|
3486
|
-
ZodDiscriminatedUnion:
|
|
3486
|
+
ZodDiscriminatedUnion: Oe,
|
|
3487
3487
|
ZodIntersection: fe,
|
|
3488
3488
|
ZodTuple: M,
|
|
3489
3489
|
ZodRecord: he,
|
|
3490
|
-
ZodMap:
|
|
3491
|
-
ZodSet:
|
|
3490
|
+
ZodMap: Ae,
|
|
3491
|
+
ZodSet: J,
|
|
3492
3492
|
ZodFunction: X,
|
|
3493
3493
|
ZodLazy: pe,
|
|
3494
3494
|
ZodLiteral: me,
|
|
3495
|
-
ZodEnum:
|
|
3495
|
+
ZodEnum: W,
|
|
3496
3496
|
ZodNativeEnum: ye,
|
|
3497
3497
|
ZodPromise: ne,
|
|
3498
3498
|
ZodEffects: R,
|
|
3499
3499
|
ZodTransformer: R,
|
|
3500
3500
|
ZodOptional: Z,
|
|
3501
|
-
ZodNullable:
|
|
3501
|
+
ZodNullable: q,
|
|
3502
3502
|
ZodDefault: be,
|
|
3503
3503
|
ZodCatch: ge,
|
|
3504
3504
|
ZodNaN: Ee,
|
|
3505
3505
|
BRAND: Nn,
|
|
3506
|
-
ZodBranded:
|
|
3506
|
+
ZodBranded: Fe,
|
|
3507
3507
|
ZodPipeline: _e,
|
|
3508
3508
|
ZodReadonly: ve,
|
|
3509
3509
|
custom: yt,
|
|
@@ -3524,7 +3524,7 @@ var h = /* @__PURE__ */ Object.freeze({
|
|
|
3524
3524
|
enum: na,
|
|
3525
3525
|
function: Xn,
|
|
3526
3526
|
instanceof: Rn,
|
|
3527
|
-
intersection:
|
|
3527
|
+
intersection: Gn,
|
|
3528
3528
|
lazy: ea,
|
|
3529
3529
|
literal: ta,
|
|
3530
3530
|
map: Qn,
|
|
@@ -3542,23 +3542,23 @@ var h = /* @__PURE__ */ Object.freeze({
|
|
|
3542
3542
|
pipeline: ca,
|
|
3543
3543
|
preprocess: oa,
|
|
3544
3544
|
promise: ra,
|
|
3545
|
-
record:
|
|
3545
|
+
record: Yn,
|
|
3546
3546
|
set: Kn,
|
|
3547
3547
|
strictObject: qn,
|
|
3548
3548
|
string: bt,
|
|
3549
|
-
symbol:
|
|
3549
|
+
symbol: Pn,
|
|
3550
3550
|
transformer: et,
|
|
3551
|
-
tuple:
|
|
3552
|
-
undefined:
|
|
3551
|
+
tuple: Jn,
|
|
3552
|
+
undefined: $n,
|
|
3553
3553
|
union: Hn,
|
|
3554
3554
|
unknown: Bn,
|
|
3555
3555
|
void: zn,
|
|
3556
3556
|
NEVER: ha,
|
|
3557
3557
|
ZodIssueCode: d,
|
|
3558
3558
|
quotelessJson: fn,
|
|
3559
|
-
ZodError:
|
|
3559
|
+
ZodError: E
|
|
3560
3560
|
});
|
|
3561
|
-
const pa = "test test test test test test test test test test test junk",
|
|
3561
|
+
const pa = "test test test test test test test test test test test junk", La = async function(e, t) {
|
|
3562
3562
|
const a = t.privateKey, r = t.mnemonic ?? pa, s = t.chain || "anvil", [{ config: i, account: o }, u] = Ht({
|
|
3563
3563
|
chain: s,
|
|
3564
3564
|
rpcUrl: t.rpcUrl,
|
|
@@ -3566,208 +3566,233 @@ const pa = "test test test test test test test test test test test junk", Va = a
|
|
|
3566
3566
|
mnemonic: r
|
|
3567
3567
|
}), c = u.id;
|
|
3568
3568
|
if (e.at(0) === "generate")
|
|
3569
|
-
return
|
|
3569
|
+
return Pa({ account: o == null ? void 0 : o.address, chainId: c });
|
|
3570
3570
|
if (e.at(0) === "erc20") {
|
|
3571
3571
|
let T = new dt({ config: i, account: o }, {});
|
|
3572
3572
|
return await T.deploy(), {
|
|
3573
3573
|
erc20: T.assertValidAddress()
|
|
3574
3574
|
};
|
|
3575
3575
|
}
|
|
3576
|
-
const m =
|
|
3576
|
+
const m = St[c];
|
|
3577
3577
|
if (!m)
|
|
3578
3578
|
throw new Error(
|
|
3579
3579
|
`Unable to select a deployed BoostRegistry with chain ID ${c}`
|
|
3580
3580
|
);
|
|
3581
|
-
const C = new
|
|
3581
|
+
const C = new At({
|
|
3582
3582
|
config: i,
|
|
3583
3583
|
account: o,
|
|
3584
3584
|
address: m
|
|
3585
|
-
}),
|
|
3586
|
-
if (!
|
|
3585
|
+
}), Y = Et[c];
|
|
3586
|
+
if (!Y)
|
|
3587
3587
|
throw new Error(
|
|
3588
3588
|
`Unable to select a deployed BoostCore with chain ID ${c}`
|
|
3589
3589
|
);
|
|
3590
|
-
const
|
|
3590
|
+
const I = new Nt({
|
|
3591
3591
|
config: i,
|
|
3592
3592
|
account: o,
|
|
3593
|
-
address:
|
|
3593
|
+
address: Y
|
|
3594
3594
|
});
|
|
3595
3595
|
if (!e.length) throw new Error("No seed provided");
|
|
3596
3596
|
const _t = await Promise.all(e.map(ma));
|
|
3597
|
-
let
|
|
3598
|
-
const
|
|
3597
|
+
let Ze, Ge;
|
|
3598
|
+
const Je = [];
|
|
3599
3599
|
for (const T of _t) {
|
|
3600
|
-
let
|
|
3601
|
-
if (typeof T.budget == "string" &&
|
|
3602
|
-
|
|
3603
|
-
else if (
|
|
3604
|
-
|
|
3600
|
+
let P;
|
|
3601
|
+
if (typeof T.budget == "string" && ze(T.budget))
|
|
3602
|
+
P = I.ManagedBudget(T.budget);
|
|
3603
|
+
else if (Pe(Ge, T.budget) && Ze)
|
|
3604
|
+
P = Ze;
|
|
3605
3605
|
else {
|
|
3606
|
-
const
|
|
3606
|
+
const x = {
|
|
3607
3607
|
...T.budget,
|
|
3608
|
-
authorized: [...T.budget.authorized,
|
|
3608
|
+
authorized: [...T.budget.authorized, Y],
|
|
3609
3609
|
roles: [...T.budget.roles, at.MANAGER]
|
|
3610
3610
|
};
|
|
3611
|
-
|
|
3611
|
+
P = await C.initialize(
|
|
3612
3612
|
crypto.randomUUID(),
|
|
3613
|
-
|
|
3614
|
-
),
|
|
3613
|
+
I.ManagedBudget(x)
|
|
3614
|
+
), Ze = P, Ge = T.budget;
|
|
3615
3615
|
}
|
|
3616
|
-
const xt = T.incentives.map(async (
|
|
3617
|
-
let
|
|
3618
|
-
switch (
|
|
3616
|
+
const xt = T.incentives.map(async (x) => {
|
|
3617
|
+
let $ = 0n;
|
|
3618
|
+
switch (x.type) {
|
|
3619
3619
|
case "AllowListIncentive":
|
|
3620
|
-
return
|
|
3620
|
+
return I.AllowListIncentive(x);
|
|
3621
|
+
case "PointsIncentive":
|
|
3622
|
+
return I.PointsIncentive(x);
|
|
3621
3623
|
case "ERC20Incentive":
|
|
3622
|
-
return
|
|
3624
|
+
return x.strategy === Me.RAFFLE && ($ += x.reward), x.strategy === Me.POOL && ($ += x.reward * x.limit), x.shouldMintAndAllocate && await xe(P, $, x.asset, {
|
|
3623
3625
|
config: i,
|
|
3624
3626
|
account: o
|
|
3625
|
-
}),
|
|
3627
|
+
}), I.ERC20Incentive(x);
|
|
3626
3628
|
case "ERC20VariableCriteriaIncentive":
|
|
3627
|
-
return
|
|
3629
|
+
return $ += x.limit, x.shouldMintAndAllocate && await xe(P, $, x.asset, {
|
|
3628
3630
|
config: i,
|
|
3629
3631
|
account: o
|
|
3630
|
-
}),
|
|
3632
|
+
}), I.ERC20VariableCriteriaIncentive(x);
|
|
3631
3633
|
case "ERC20VariableIncentive":
|
|
3632
|
-
return
|
|
3634
|
+
return $ += x.limit, x.shouldMintAndAllocate && await xe(P, $, x.asset, {
|
|
3635
|
+
config: i,
|
|
3636
|
+
account: o
|
|
3637
|
+
}), I.ERC20VariableIncentive(x);
|
|
3638
|
+
case "CGDAIncentive":
|
|
3639
|
+
return $ += x.totalBudget, x.shouldMintAndAllocate && await xe(P, $, x.asset, {
|
|
3633
3640
|
config: i,
|
|
3634
3641
|
account: o
|
|
3635
|
-
}),
|
|
3642
|
+
}), I.CGDAIncentive(x);
|
|
3636
3643
|
}
|
|
3637
|
-
}), wt = await Promise.all(xt), kt = await
|
|
3644
|
+
}), wt = await Promise.all(xt), kt = await I.createBoost({
|
|
3638
3645
|
protocolFee: T.protocolFee,
|
|
3639
3646
|
maxParticipants: T.maxParticipants,
|
|
3640
|
-
budget:
|
|
3641
|
-
action:
|
|
3642
|
-
validator:
|
|
3643
|
-
allowList: await
|
|
3647
|
+
budget: P,
|
|
3648
|
+
action: I.EventAction(T.action),
|
|
3649
|
+
validator: I.SignerValidator(T.validator),
|
|
3650
|
+
allowList: await ja(T, { core: I }),
|
|
3651
|
+
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
3644
3652
|
incentives: wt
|
|
3645
3653
|
});
|
|
3646
|
-
|
|
3654
|
+
Je.push(kt.id.toString());
|
|
3647
3655
|
}
|
|
3648
3656
|
return {
|
|
3649
|
-
boostIds:
|
|
3657
|
+
boostIds: Je
|
|
3650
3658
|
};
|
|
3651
3659
|
};
|
|
3652
|
-
async function
|
|
3660
|
+
async function xe(n, e, t, a) {
|
|
3653
3661
|
if (t && e) {
|
|
3654
3662
|
let r = new dt(a, t);
|
|
3655
|
-
await
|
|
3663
|
+
await Ma(a, r, n, rt(e.toString()));
|
|
3656
3664
|
}
|
|
3657
3665
|
}
|
|
3658
3666
|
async function ma(n) {
|
|
3659
3667
|
const e = await Tt.readFile(Ct.normalize(n), {
|
|
3660
3668
|
encoding: "utf8"
|
|
3661
3669
|
});
|
|
3662
|
-
return
|
|
3670
|
+
return Za.parse(JSON.parse(e));
|
|
3663
3671
|
}
|
|
3664
|
-
const ya =
|
|
3665
|
-
code:
|
|
3672
|
+
const ya = l.custom(zt, "invalid Hex payload"), w = l.string().transform((n, e) => (/^0x[a-fA-F0-9]{40}$/.test(n) || e.addIssue({
|
|
3673
|
+
code: l.ZodIssueCode.custom,
|
|
3666
3674
|
message: `Invalid Address ${n}`
|
|
3667
|
-
}), n)).pipe(
|
|
3668
|
-
type:
|
|
3675
|
+
}), n)).pipe(l.custom(ze, "invalid eth address")), ba = l.coerce.number().min(1).max(2).transform(BigInt).pipe(l.custom()), ga = l.object({
|
|
3676
|
+
type: l.literal("ManagedBudget"),
|
|
3669
3677
|
owner: w,
|
|
3670
|
-
authorized:
|
|
3671
|
-
roles:
|
|
3678
|
+
authorized: l.array(w),
|
|
3679
|
+
roles: l.array(ba)
|
|
3672
3680
|
}).refine(
|
|
3673
3681
|
(n) => n.authorized.length === n.roles.length,
|
|
3674
3682
|
"length mismatch authorized and roles"
|
|
3675
|
-
),
|
|
3676
|
-
|
|
3683
|
+
), Re = l.custom().pipe(
|
|
3684
|
+
l.string().regex(/^(event|function) .*/, {
|
|
3677
3685
|
message: "signature must start with `event` or function`"
|
|
3678
3686
|
}).transform((n) => {
|
|
3679
3687
|
if (n.startsWith("event")) return Ut(Wt(n));
|
|
3680
3688
|
if (n.startsWith("function")) return qt(n);
|
|
3681
3689
|
throw new Error("unreachable");
|
|
3682
3690
|
})
|
|
3683
|
-
), va =
|
|
3684
|
-
signatureType:
|
|
3685
|
-
signature:
|
|
3686
|
-
fieldIndex:
|
|
3691
|
+
), va = l.object({
|
|
3692
|
+
signatureType: l.nativeEnum(se),
|
|
3693
|
+
signature: Re,
|
|
3694
|
+
fieldIndex: l.number().nonnegative(),
|
|
3687
3695
|
targetContract: w,
|
|
3688
|
-
chainid:
|
|
3689
|
-
}), _a =
|
|
3690
|
-
filterType:
|
|
3691
|
-
fieldType:
|
|
3692
|
-
fieldIndex:
|
|
3696
|
+
chainid: l.number().nonnegative()
|
|
3697
|
+
}), _a = l.object({
|
|
3698
|
+
filterType: l.nativeEnum(tt),
|
|
3699
|
+
fieldType: l.nativeEnum(nt),
|
|
3700
|
+
fieldIndex: l.number().nonnegative(),
|
|
3693
3701
|
filterData: ya
|
|
3694
|
-
}), xa =
|
|
3695
|
-
signature:
|
|
3696
|
-
signatureType:
|
|
3697
|
-
actionType:
|
|
3702
|
+
}), xa = l.object({
|
|
3703
|
+
signature: Re,
|
|
3704
|
+
signatureType: l.nativeEnum(se),
|
|
3705
|
+
actionType: l.number().optional(),
|
|
3698
3706
|
targetContract: w,
|
|
3699
|
-
chainid:
|
|
3707
|
+
chainid: l.number().nonnegative(),
|
|
3700
3708
|
actionParameter: _a
|
|
3701
|
-
}), wa =
|
|
3702
|
-
type:
|
|
3709
|
+
}), wa = l.object({
|
|
3710
|
+
type: l.literal("EventAction"),
|
|
3703
3711
|
actionClaimant: va,
|
|
3704
|
-
actionSteps:
|
|
3705
|
-
}), ka =
|
|
3706
|
-
type:
|
|
3707
|
-
signers:
|
|
3712
|
+
actionSteps: l.array(xa).max(4)
|
|
3713
|
+
}), ka = l.object({
|
|
3714
|
+
type: l.literal("SignerValidator"),
|
|
3715
|
+
signers: l.array(w),
|
|
3708
3716
|
validatorCaller: w
|
|
3709
|
-
}), Ta =
|
|
3710
|
-
type:
|
|
3717
|
+
}), Ta = l.object({
|
|
3718
|
+
type: l.literal("SimpleDenyList"),
|
|
3711
3719
|
owner: w,
|
|
3712
|
-
denied:
|
|
3713
|
-
}), Ca =
|
|
3714
|
-
type:
|
|
3720
|
+
denied: l.array(w)
|
|
3721
|
+
}), Ca = l.object({
|
|
3722
|
+
type: l.literal("SimpleAllowList"),
|
|
3715
3723
|
owner: w,
|
|
3716
|
-
allowed:
|
|
3717
|
-
}),
|
|
3718
|
-
type:
|
|
3724
|
+
allowed: l.array(w)
|
|
3725
|
+
}), Ia = l.object({
|
|
3726
|
+
type: l.literal("AllowListIncentive"),
|
|
3719
3727
|
allowList: w,
|
|
3720
|
-
limit:
|
|
3721
|
-
}),
|
|
3722
|
-
type:
|
|
3728
|
+
limit: l.coerce.bigint()
|
|
3729
|
+
}), Sa = l.object({
|
|
3730
|
+
type: l.literal("ERC20Incentive"),
|
|
3723
3731
|
asset: w,
|
|
3724
|
-
shouldMintAndAllocate:
|
|
3725
|
-
strategy:
|
|
3726
|
-
reward:
|
|
3727
|
-
limit:
|
|
3732
|
+
shouldMintAndAllocate: l.boolean().optional().default(!1),
|
|
3733
|
+
strategy: l.nativeEnum(Me),
|
|
3734
|
+
reward: l.coerce.bigint(),
|
|
3735
|
+
limit: l.coerce.bigint(),
|
|
3728
3736
|
manager: w.optional()
|
|
3729
|
-
}),
|
|
3730
|
-
type:
|
|
3737
|
+
}), Aa = l.object({
|
|
3738
|
+
type: l.literal("ERC20VariableIncentive"),
|
|
3731
3739
|
asset: w,
|
|
3732
|
-
shouldMintAndAllocate:
|
|
3733
|
-
reward:
|
|
3734
|
-
limit:
|
|
3740
|
+
shouldMintAndAllocate: l.boolean().optional().default(!1),
|
|
3741
|
+
reward: l.coerce.bigint(),
|
|
3742
|
+
limit: l.coerce.bigint(),
|
|
3735
3743
|
manager: w
|
|
3736
|
-
}),
|
|
3737
|
-
criteriaType:
|
|
3738
|
-
signature:
|
|
3739
|
-
fieldIndex:
|
|
3744
|
+
}), Ea = l.object({
|
|
3745
|
+
criteriaType: l.nativeEnum(se),
|
|
3746
|
+
signature: Re,
|
|
3747
|
+
fieldIndex: l.number().nonnegative(),
|
|
3740
3748
|
targetContract: w
|
|
3741
|
-
}), Na =
|
|
3742
|
-
type:
|
|
3749
|
+
}), Na = l.object({
|
|
3750
|
+
type: l.literal("ERC20VariableCriteriaIncentive"),
|
|
3743
3751
|
asset: w,
|
|
3744
|
-
shouldMintAndAllocate:
|
|
3745
|
-
reward:
|
|
3746
|
-
limit:
|
|
3752
|
+
shouldMintAndAllocate: l.boolean().optional().default(!1),
|
|
3753
|
+
reward: l.coerce.bigint(),
|
|
3754
|
+
limit: l.coerce.bigint(),
|
|
3747
3755
|
manager: w.optional(),
|
|
3748
|
-
criteria:
|
|
3749
|
-
}), Oa =
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
+
criteria: Ea
|
|
3757
|
+
}), Oa = l.object({
|
|
3758
|
+
type: l.literal("CGDAIncentive"),
|
|
3759
|
+
asset: w,
|
|
3760
|
+
shouldMintAndAllocate: l.boolean().optional().default(!1),
|
|
3761
|
+
initialReward: l.coerce.bigint(),
|
|
3762
|
+
rewardDecay: l.coerce.bigint(),
|
|
3763
|
+
rewardBoost: l.coerce.bigint(),
|
|
3764
|
+
totalBudget: l.coerce.bigint(),
|
|
3765
|
+
manager: w
|
|
3766
|
+
}), Ra = l.object({
|
|
3767
|
+
type: l.literal("PointsIncentive"),
|
|
3768
|
+
venue: w,
|
|
3769
|
+
selector: Re,
|
|
3770
|
+
reward: l.coerce.bigint(),
|
|
3771
|
+
limit: l.coerce.bigint()
|
|
3772
|
+
}), Za = l.object({
|
|
3773
|
+
protocolFee: l.coerce.bigint(),
|
|
3774
|
+
maxParticipants: l.coerce.bigint(),
|
|
3775
|
+
budget: l.union([w, ga]),
|
|
3776
|
+
action: l.union([w, wa]),
|
|
3777
|
+
validator: l.union([w, ka]),
|
|
3778
|
+
allowList: l.union([
|
|
3756
3779
|
w,
|
|
3757
3780
|
Ta,
|
|
3758
3781
|
Ca
|
|
3759
3782
|
]),
|
|
3760
|
-
incentives:
|
|
3761
|
-
|
|
3762
|
-
Sa,
|
|
3783
|
+
incentives: l.array(
|
|
3784
|
+
l.union([
|
|
3763
3785
|
Ia,
|
|
3786
|
+
Sa,
|
|
3764
3787
|
Na,
|
|
3765
|
-
|
|
3788
|
+
Aa,
|
|
3789
|
+
Oa,
|
|
3790
|
+
Ra
|
|
3766
3791
|
])
|
|
3767
3792
|
)
|
|
3768
3793
|
});
|
|
3769
|
-
async function
|
|
3770
|
-
if (typeof n == "string" &&
|
|
3794
|
+
async function ja({ allowList: n }, { core: e }) {
|
|
3795
|
+
if (typeof n == "string" && ze(n))
|
|
3771
3796
|
return await Ot(
|
|
3772
3797
|
//@ts-expect-error i do what i want
|
|
3773
3798
|
{ config: e._config, account: e._account },
|
|
@@ -3782,14 +3807,14 @@ async function Ra({ allowList: n }, { core: e }) {
|
|
|
3782
3807
|
throw new Error("unusupported AllowList: " + n);
|
|
3783
3808
|
}
|
|
3784
3809
|
}
|
|
3785
|
-
async function
|
|
3810
|
+
async function Ma(n, e, t, a = rt("110")) {
|
|
3786
3811
|
return await e.mint(n.account.address, a), await e.approve(t.assertValidAddress(), a), await t.allocate({
|
|
3787
3812
|
amount: a,
|
|
3788
3813
|
asset: e.assertValidAddress(),
|
|
3789
3814
|
target: n.account.address
|
|
3790
3815
|
}), { budget: t, erc20: e };
|
|
3791
3816
|
}
|
|
3792
|
-
function
|
|
3817
|
+
function Pa({
|
|
3793
3818
|
asset: n = "0xf3B2d0E4f2d8F453DBCc278b10e88b20d7f19f8D",
|
|
3794
3819
|
account: e = ln[0].account,
|
|
3795
3820
|
chainId: t
|
|
@@ -3809,7 +3834,7 @@ function ja({
|
|
|
3809
3834
|
signatureType: se.FUNC,
|
|
3810
3835
|
signature: "function mint(address to, uint256 amount)",
|
|
3811
3836
|
fieldIndex: 0,
|
|
3812
|
-
targetContract:
|
|
3837
|
+
targetContract: Ye,
|
|
3813
3838
|
chainid: t
|
|
3814
3839
|
},
|
|
3815
3840
|
actionSteps: [
|
|
@@ -3817,7 +3842,7 @@ function ja({
|
|
|
3817
3842
|
signature: "event Minted(address to, uint256 amount)",
|
|
3818
3843
|
signatureType: se.FUNC,
|
|
3819
3844
|
actionType: 0,
|
|
3820
|
-
targetContract:
|
|
3845
|
+
targetContract: Ye,
|
|
3821
3846
|
chainid: t,
|
|
3822
3847
|
actionParameter: {
|
|
3823
3848
|
filterType: tt.EQUAL,
|
|
@@ -3855,17 +3880,19 @@ export {
|
|
|
3855
3880
|
va as ActionClaimantSchema,
|
|
3856
3881
|
_a as ActionStepCriteriaSchema,
|
|
3857
3882
|
xa as ActionStepSchema,
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
|
|
3883
|
+
Ia as AllowListIncentiveSchema,
|
|
3884
|
+
Za as BoostSeedConfigSchema,
|
|
3885
|
+
Oa as CGDAIncentiveSchema,
|
|
3886
|
+
Sa as ERC20IncentiveSchema,
|
|
3861
3887
|
Na as ERC20VariableCriteriaIncentiveSchema,
|
|
3862
|
-
|
|
3888
|
+
Aa as ERC20VariableIncentiveSchema,
|
|
3863
3889
|
wa as EventActionSchema,
|
|
3864
|
-
|
|
3890
|
+
Ea as IncentiveCriteriaSchema,
|
|
3865
3891
|
ga as ManagedBudgetSchema,
|
|
3892
|
+
Ra as PointsIncentiveSchema,
|
|
3866
3893
|
ka as SignerValidatorSchema,
|
|
3867
3894
|
Ca as SimpleAllowListSchema,
|
|
3868
3895
|
Ta as SimpleDenyListSchema,
|
|
3869
|
-
|
|
3870
|
-
|
|
3896
|
+
Pa as makeSeed,
|
|
3897
|
+
La as seed
|
|
3871
3898
|
};
|