@lombard.finance/sdk 4.3.2 → 4.4.1
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/CHANGELOG.md +24 -0
- package/LICENSE +21 -0
- package/README.md +6 -6
- package/dist/api-functions/generateDepositBtcAddress/generateDepositBtcAddress.d.ts.map +1 -1
- package/dist/api-functions/getDepositBtcAddress/getDepositBtcAddress.d.ts.map +1 -1
- package/dist/api-functions/getDepositsByAddress/getDepositsByAddress.d.ts +13 -1
- package/dist/api-functions/getDepositsByAddress/getDepositsByAddress.d.ts.map +1 -1
- package/dist/api.cjs +1 -1
- package/dist/api.js +29 -29
- package/dist/bridge.cjs +1 -1
- package/dist/bridge.js +7 -7
- package/dist/btc.cjs +1 -1
- package/dist/btc.js +10 -10
- package/dist/chains/btc/actions/deposit/BtcDeposit.d.ts +7 -4
- package/dist/chains/btc/actions/deposit/BtcDeposit.d.ts.map +1 -1
- package/dist/chains/btc/actions/deposit/config/index.d.ts +16 -8
- package/dist/chains/btc/actions/deposit/config/index.d.ts.map +1 -1
- package/dist/chains/btc/actions/deposit/config/solana.d.ts +20 -0
- package/dist/chains/btc/actions/deposit/config/solana.d.ts.map +1 -0
- package/dist/chains/btc/actions/deposit/config/types.d.ts +4 -3
- package/dist/chains/btc/actions/deposit/config/types.d.ts.map +1 -1
- package/dist/chains/evm/EvmActions.d.ts +4 -4
- package/dist/chains/evm/actions/deposit/config/evm.d.ts +3 -3
- package/dist/chains/evm/actions/deposit/config/evm.d.ts.map +1 -1
- package/dist/chains/evm/actions/deposit/config/types.d.ts +1 -1
- package/dist/chains/evm/actions/deposit/config/types.d.ts.map +1 -1
- package/dist/chains/evm/actions/deposit/factory.d.ts +1 -1
- package/dist/chains/evm/actions/deposit/types.d.ts +1 -1
- package/dist/chains/evm/actions/deposit/types.d.ts.map +1 -1
- package/dist/chains/evm/actions/redeem/EvmRedeem.d.ts.map +1 -1
- package/dist/chains/evm/actions/unstake/EvmUnstake.d.ts.map +1 -1
- package/dist/chains/solana/SolanaActions.d.ts +10 -0
- package/dist/chains/solana/SolanaActions.d.ts.map +1 -1
- package/dist/chains/solana/actions/index.d.ts +1 -0
- package/dist/chains/solana/actions/index.d.ts.map +1 -1
- package/dist/chains/solana/actions/redeem/SolanaRedeem.d.ts +37 -0
- package/dist/chains/solana/actions/redeem/SolanaRedeem.d.ts.map +1 -0
- package/dist/chains/solana/actions/redeem/config/index.d.ts +8 -0
- package/dist/chains/solana/actions/redeem/config/index.d.ts.map +1 -0
- package/dist/chains/solana/actions/redeem/config/solana.d.ts +22 -0
- package/dist/chains/solana/actions/redeem/config/solana.d.ts.map +1 -0
- package/dist/chains/solana/actions/redeem/config/types.d.ts +35 -0
- package/dist/chains/solana/actions/redeem/config/types.d.ts.map +1 -0
- package/dist/chains/solana/actions/redeem/factory.d.ts +12 -0
- package/dist/chains/solana/actions/redeem/factory.d.ts.map +1 -0
- package/dist/chains/solana/actions/redeem/index.d.ts +9 -0
- package/dist/chains/solana/actions/redeem/index.d.ts.map +1 -0
- package/dist/chains/solana/actions/redeem/types.d.ts +52 -0
- package/dist/chains/solana/actions/redeem/types.d.ts.map +1 -0
- package/dist/chains/solana/utils.d.ts +15 -0
- package/dist/chains/solana/utils.d.ts.map +1 -0
- package/dist/chunks/BtcActions-BIBsbYIt.cjs +2 -0
- package/dist/chunks/BtcActions-BIBsbYIt.cjs.map +1 -0
- package/dist/chunks/{BtcActions-k-qs1uO0.js → BtcActions-Df41lbsb.js} +457 -414
- package/dist/chunks/BtcActions-Df41lbsb.js.map +1 -0
- package/dist/chunks/{EvmActions-B_dF42So.js → EvmActions-5lPqhRaM.js} +163 -173
- package/dist/chunks/EvmActions-5lPqhRaM.js.map +1 -0
- package/dist/chunks/EvmActions-BY_18gTg.cjs +2 -0
- package/dist/chunks/EvmActions-BY_18gTg.cjs.map +1 -0
- package/dist/chunks/ReferralsClient-Cmrjo9bN.cjs +2 -0
- package/dist/chunks/ReferralsClient-Cmrjo9bN.cjs.map +1 -0
- package/dist/chunks/{ReferralsClient-DbFWWtVi.js → ReferralsClient-DvEsA3II.js} +160 -160
- package/dist/chunks/ReferralsClient-DvEsA3II.js.map +1 -0
- package/dist/chunks/{api-config-CtcP3TVl.js → api-config-Dm6dR85f.js} +6 -6
- package/dist/chunks/{api-config-CtcP3TVl.js.map → api-config-Dm6dR85f.js.map} +1 -1
- package/dist/chunks/{approveLBTC-CZiZmdcX.cjs → approveLBTC-CUXEC3kw.cjs} +2 -2
- package/dist/chunks/{approveLBTC-CZiZmdcX.cjs.map → approveLBTC-CUXEC3kw.cjs.map} +1 -1
- package/dist/chunks/approveLBTC-Du2El1tW.js +26 -0
- package/dist/chunks/{approveLBTC-B5-ZWqct.js.map → approveLBTC-Du2El1tW.js.map} +1 -1
- package/dist/chunks/{array-Cev6kyLJ.js → array-DYttUPf5.js} +7 -7
- package/dist/chunks/{array-Cev6kyLJ.js.map → array-DYttUPf5.js.map} +1 -1
- package/dist/chunks/{blockchain-identifier-BzMQWh-C.cjs → blockchain-identifier-BTPGxLio.cjs} +2 -2
- package/dist/chunks/{blockchain-identifier-BzMQWh-C.cjs.map → blockchain-identifier-BTPGxLio.cjs.map} +1 -1
- package/dist/chunks/{blockchain-identifier-BmadkNtK.js → blockchain-identifier-CTVaEPpY.js} +24 -24
- package/dist/chunks/{blockchain-identifier-BmadkNtK.js.map → blockchain-identifier-CTVaEPpY.js.map} +1 -1
- package/dist/chunks/{bridge-CTsiodO1.js → bridge-DqGabhIY.js} +13 -13
- package/dist/chunks/{bridge-CTsiodO1.js.map → bridge-DqGabhIY.js.map} +1 -1
- package/dist/chunks/{bridge-BzRlY9pP.cjs → bridge-dWaKrMKm.cjs} +2 -2
- package/dist/chunks/{bridge-BzRlY9pP.cjs.map → bridge-dWaKrMKm.cjs.map} +1 -1
- package/dist/chunks/{config-hFKqUyg3.js → config-DghboRx0.js} +10 -10
- package/dist/chunks/{config-hFKqUyg3.js.map → config-DghboRx0.js.map} +1 -1
- package/dist/chunks/{config-l4ZaZw_g.cjs → config-DmCmanM_.cjs} +2 -2
- package/dist/chunks/{config-l4ZaZw_g.cjs.map → config-DmCmanM_.cjs.map} +1 -1
- package/dist/chunks/constants-D1FnS2Z8.js +6 -0
- package/dist/chunks/constants-D1FnS2Z8.js.map +1 -0
- package/dist/chunks/constants-ueShGH9R.cjs +2 -0
- package/dist/chunks/constants-ueShGH9R.cjs.map +1 -0
- package/dist/chunks/{defi-registry-BIRv_zkp.cjs → defi-registry-DDNavtO1.cjs} +2 -2
- package/dist/chunks/{defi-registry-BIRv_zkp.cjs.map → defi-registry-DDNavtO1.cjs.map} +1 -1
- package/dist/chunks/{defi-registry-wNFN3qyB.js → defi-registry-DxjjBQTV.js} +13 -13
- package/dist/chunks/{defi-registry-wNFN3qyB.js.map → defi-registry-DxjjBQTV.js.map} +1 -1
- package/dist/chunks/depositStatus-CFo5jW89.cjs +2 -0
- package/dist/chunks/depositStatus-CFo5jW89.cjs.map +1 -0
- package/dist/chunks/{depositStatus-DM7fRmbN.js → depositStatus-DTc01ZoZ.js} +63 -61
- package/dist/chunks/depositStatus-DTc01ZoZ.js.map +1 -0
- package/dist/chunks/events-6PV6NP-o.cjs +2 -0
- package/dist/chunks/events-6PV6NP-o.cjs.map +1 -0
- package/dist/chunks/{events-DdV_xi-2.js → events-BvRwXePq.js} +414 -303
- package/dist/chunks/events-BvRwXePq.js.map +1 -0
- package/dist/chunks/evm-by-btc-address-CZvE15lx.js +39 -0
- package/dist/chunks/{evm-by-btc-address-CwLiENtM.js.map → evm-by-btc-address-CZvE15lx.js.map} +1 -1
- package/dist/chunks/fee-requirements-CCNsxAvJ.js +14 -0
- package/dist/chunks/{fee-requirements-x8-8mpJ7.js.map → fee-requirements-CCNsxAvJ.js.map} +1 -1
- package/dist/chunks/get-exchange-ratio-B-xzYND1.js +20 -0
- package/dist/chunks/{get-exchange-ratio-NtnkG1kZ.js.map → get-exchange-ratio-B-xzYND1.js.map} +1 -1
- package/dist/chunks/{get-exchange-ratio-C-7DadfD.cjs → get-exchange-ratio-BEhD4gLB.cjs} +2 -2
- package/dist/chunks/{get-exchange-ratio-C-7DadfD.cjs.map → get-exchange-ratio-BEhD4gLB.cjs.map} +1 -1
- package/dist/chunks/{get-positions-summary-DkZZYbGP.cjs → get-positions-summary-Dh1QPLYO.cjs} +2 -2
- package/dist/chunks/{get-positions-summary-DkZZYbGP.cjs.map → get-positions-summary-Dh1QPLYO.cjs.map} +1 -1
- package/dist/chunks/{get-positions-summary-B_MmGHLv.js → get-positions-summary-iYshN1RQ.js} +28 -28
- package/dist/chunks/{get-positions-summary-B_MmGHLv.js.map → get-positions-summary-iYshN1RQ.js.map} +1 -1
- package/dist/chunks/{get-vault-tvl-YAXePAW3.js → get-vault-tvl-Ct_Zkg7C.js} +41 -41
- package/dist/chunks/{get-vault-tvl-YAXePAW3.js.map → get-vault-tvl-Ct_Zkg7C.js.map} +1 -1
- package/dist/chunks/{get-vault-tvl-DmTUbOY7.cjs → get-vault-tvl-D_tQIDAs.cjs} +2 -2
- package/dist/chunks/{get-vault-tvl-DmTUbOY7.cjs.map → get-vault-tvl-D_tQIDAs.cjs.map} +1 -1
- package/dist/chunks/{get-vault-withdrawals-CWcYy_sH.cjs → get-vault-withdrawals-8ALlEiAC.cjs} +2 -2
- package/dist/chunks/{get-vault-withdrawals-CWcYy_sH.cjs.map → get-vault-withdrawals-8ALlEiAC.cjs.map} +1 -1
- package/dist/chunks/get-vault-withdrawals-jk7Sv4S4.js +161 -0
- package/dist/chunks/{get-vault-withdrawals-BrpZlt6s.js.map → get-vault-withdrawals-jk7Sv4S4.js.map} +1 -1
- package/dist/chunks/{getSharesByAddress-BEgOf1C0.cjs → getSharesByAddress-D8hehnP1.cjs} +2 -2
- package/dist/chunks/{getSharesByAddress-BEgOf1C0.cjs.map → getSharesByAddress-D8hehnP1.cjs.map} +1 -1
- package/dist/chunks/{getSharesByAddress-BiruCDp6.js → getSharesByAddress-_tBaIBsw.js} +38 -38
- package/dist/chunks/{getSharesByAddress-BiruCDp6.js.map → getSharesByAddress-_tBaIBsw.js.map} +1 -1
- package/dist/chunks/getUserStakeAndBakeSignature-CSEyzgMc.cjs +2 -0
- package/dist/chunks/getUserStakeAndBakeSignature-CSEyzgMc.cjs.map +1 -0
- package/dist/chunks/getUserStakeAndBakeSignature-Su-k10ap.js +125 -0
- package/dist/chunks/getUserStakeAndBakeSignature-Su-k10ap.js.map +1 -0
- package/dist/chunks/lbtc-addresses-D8MYCdsx.js +10 -0
- package/dist/chunks/{lbtc-addresses-BLRmtR3c.js.map → lbtc-addresses-D8MYCdsx.js.map} +1 -1
- package/dist/chunks/{lbtc-addresses-xyTYV7hx.cjs → lbtc-addresses-Kil252DX.cjs} +2 -2
- package/dist/chunks/{lbtc-addresses-xyTYV7hx.cjs.map → lbtc-addresses-Kil252DX.cjs.map} +1 -1
- package/dist/chunks/numbers-CclN2Ohk.js +15 -0
- package/dist/chunks/{numbers-CM-lcmt4.js.map → numbers-CclN2Ohk.js.map} +1 -1
- package/dist/chunks/parameters-C_16L5ft.js +11 -0
- package/dist/chunks/{parameters-CDV-6Hk5.js.map → parameters-C_16L5ft.js.map} +1 -1
- package/dist/chunks/satoshi-CSoJBXc6.js +19 -0
- package/dist/chunks/{satoshi-Ch6y8aYG.js.map → satoshi-CSoJBXc6.js.map} +1 -1
- package/dist/chunks/{statusConstants-DFxMrVob.js → statusConstants-C4YNx2q0.js} +1134 -1113
- package/dist/chunks/statusConstants-C4YNx2q0.js.map +1 -0
- package/dist/chunks/statusConstants-DlM2oPfW.cjs +2 -0
- package/dist/chunks/statusConstants-DlM2oPfW.cjs.map +1 -0
- package/dist/chunks/{storeNetworkFeeSignature-BZGL2Zn_.js → storeNetworkFeeSignature-BODIpq3Y.js} +26 -26
- package/dist/chunks/{storeNetworkFeeSignature-BZGL2Zn_.js.map → storeNetworkFeeSignature-BODIpq3Y.js.map} +1 -1
- package/dist/chunks/{storeNetworkFeeSignature-D7yo6lDV.cjs → storeNetworkFeeSignature-Buk4091C.cjs} +2 -2
- package/dist/chunks/{storeNetworkFeeSignature-D7yo6lDV.cjs.map → storeNetworkFeeSignature-Buk4091C.cjs.map} +1 -1
- package/dist/chunks/time-Sa5gggPG.js +24 -0
- package/dist/chunks/{time-QPeEEEnQ.js.map → time-Sa5gggPG.js.map} +1 -1
- package/dist/chunks/{token-addresses-FKpA3uc4.js → token-addresses-D0v5cR1j.js} +174 -163
- package/dist/chunks/{token-addresses-FKpA3uc4.js.map → token-addresses-D0v5cR1j.js.map} +1 -1
- package/dist/chunks/{token-addresses-DRBecUa7.cjs → token-addresses-nzvTOi24.cjs} +2 -2
- package/dist/chunks/{token-addresses-DRBecUa7.cjs.map → token-addresses-nzvTOi24.cjs.map} +1 -1
- package/dist/chunks/{tokens-D_HeVB5p.cjs → tokens-BkvA0Gp1.cjs} +2 -2
- package/dist/chunks/{tokens-D_HeVB5p.cjs.map → tokens-BkvA0Gp1.cjs.map} +1 -1
- package/dist/chunks/{tokens-C6qZHzph.js → tokens-DgC1hfkm.js} +18 -18
- package/dist/chunks/{tokens-C6qZHzph.js.map → tokens-DgC1hfkm.js.map} +1 -1
- package/dist/chunks/{unstakeLBTC-H0zdYQa6.cjs → unstakeLBTC-CmoCaGX9.cjs} +2 -2
- package/dist/chunks/{unstakeLBTC-H0zdYQa6.cjs.map → unstakeLBTC-CmoCaGX9.cjs.map} +1 -1
- package/dist/chunks/{unstakeLBTC-DAIR9NO_.js → unstakeLBTC-DtvVbpbU.js} +50 -50
- package/dist/chunks/{unstakeLBTC-DAIR9NO_.js.map → unstakeLBTC-DtvVbpbU.js.map} +1 -1
- package/dist/chunks/{withdraw-hHueI2p7.js → withdraw-DgjuaUN3.js} +45 -45
- package/dist/chunks/{withdraw-hHueI2p7.js.map → withdraw-DgjuaUN3.js.map} +1 -1
- package/dist/chunks/{withdraw-C1fMFSwy.cjs → withdraw-i0AueZ_C.cjs} +2 -2
- package/dist/chunks/{withdraw-C1fMFSwy.cjs.map → withdraw-i0AueZ_C.cjs.map} +1 -1
- package/dist/common/constants.d.ts +1 -0
- package/dist/common/constants.d.ts.map +1 -1
- package/dist/contracts.cjs +1 -1
- package/dist/contracts.js +16 -16
- package/dist/core/assets/catalog.d.ts.map +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.js +85 -85
- package/dist/debug.js +4 -4
- package/dist/defi.cjs +1 -1
- package/dist/defi.js +10 -10
- package/dist/evm.cjs +1 -1
- package/dist/evm.js +34 -34
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +287 -283
- package/dist/index.js.map +1 -1
- package/dist/metrics.cjs +1 -1
- package/dist/metrics.js +6 -6
- package/dist/shared/deposits/depositStatus.d.ts +9 -5
- package/dist/shared/deposits/depositStatus.d.ts.map +1 -1
- package/dist/stories/arg-types.d.ts +1 -0
- package/dist/stories/arg-types.d.ts.map +1 -1
- package/dist/tokens/token-addresses.d.ts +2 -2
- package/dist/tokens/token-addresses.d.ts.map +1 -1
- package/dist/utils/chain.d.ts +7 -0
- package/dist/utils/chain.d.ts.map +1 -1
- package/dist/utils.cjs +1 -1
- package/dist/utils.js +76 -76
- package/dist/vaults.cjs +1 -1
- package/dist/vaults.js +14 -14
- package/package.json +19 -6
- package/dist/chunks/BtcActions-XbVRQEcM.cjs +0 -2
- package/dist/chunks/BtcActions-XbVRQEcM.cjs.map +0 -1
- package/dist/chunks/BtcActions-k-qs1uO0.js.map +0 -1
- package/dist/chunks/EvmActions-BVzQ3fLK.cjs +0 -2
- package/dist/chunks/EvmActions-BVzQ3fLK.cjs.map +0 -1
- package/dist/chunks/EvmActions-B_dF42So.js.map +0 -1
- package/dist/chunks/ReferralsClient-BC-1wT1q.cjs +0 -2
- package/dist/chunks/ReferralsClient-BC-1wT1q.cjs.map +0 -1
- package/dist/chunks/ReferralsClient-DbFWWtVi.js.map +0 -1
- package/dist/chunks/approveLBTC-B5-ZWqct.js +0 -26
- package/dist/chunks/constants-BBK-JNcY.cjs +0 -2
- package/dist/chunks/constants-BBK-JNcY.cjs.map +0 -1
- package/dist/chunks/constants-CuT4axsy.js +0 -5
- package/dist/chunks/constants-CuT4axsy.js.map +0 -1
- package/dist/chunks/depositStatus-C3-EgT2a.cjs +0 -2
- package/dist/chunks/depositStatus-C3-EgT2a.cjs.map +0 -1
- package/dist/chunks/depositStatus-DM7fRmbN.js.map +0 -1
- package/dist/chunks/events-DdV_xi-2.js.map +0 -1
- package/dist/chunks/events-DqIJRzJo.cjs +0 -2
- package/dist/chunks/events-DqIJRzJo.cjs.map +0 -1
- package/dist/chunks/evm-by-btc-address-CwLiENtM.js +0 -39
- package/dist/chunks/fee-requirements-x8-8mpJ7.js +0 -14
- package/dist/chunks/get-exchange-ratio-NtnkG1kZ.js +0 -20
- package/dist/chunks/get-vault-withdrawals-BrpZlt6s.js +0 -161
- package/dist/chunks/getUserStakeAndBakeSignature-BxRq2cI1.cjs +0 -2
- package/dist/chunks/getUserStakeAndBakeSignature-BxRq2cI1.cjs.map +0 -1
- package/dist/chunks/getUserStakeAndBakeSignature-NGGblnJl.js +0 -120
- package/dist/chunks/getUserStakeAndBakeSignature-NGGblnJl.js.map +0 -1
- package/dist/chunks/lbtc-addresses-BLRmtR3c.js +0 -10
- package/dist/chunks/numbers-CM-lcmt4.js +0 -15
- package/dist/chunks/parameters-CDV-6Hk5.js +0 -11
- package/dist/chunks/satoshi-Ch6y8aYG.js +0 -19
- package/dist/chunks/statusConstants-BLiNBT6s.cjs +0 -2
- package/dist/chunks/statusConstants-BLiNBT6s.cjs.map +0 -1
- package/dist/chunks/statusConstants-DFxMrVob.js.map +0 -1
- package/dist/chunks/time-QPeEEEnQ.js +0 -24
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
var Fe = Object.defineProperty;
|
|
2
|
-
var je = (
|
|
3
|
-
var I = (
|
|
4
|
-
import { r as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
2
|
+
var je = (n, e, t) => e in n ? Fe(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
|
|
3
|
+
var I = (n, e, t) => je(n, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { r as _ } from "./index-CfcQ_g3t.js";
|
|
5
|
+
import { AssetId as U } from "./defi-registry-DxjjBQTV.js";
|
|
6
|
+
import { isValidChain as He, isSolanaChain as ze, SOLANA_TESTNET_CHAIN as We, SOLANA_DEVNET_CHAIN as qe, SOLANA_MAINNET_CHAIN as Ge, isSuiChain as Ke, STARKNET_SEPOLIA_CHAIN as Ye, STARKNET_MAINNET_CHAIN as Je } from "./token-addresses-D0v5cR1j.js";
|
|
7
7
|
import * as me from "bitcoinjs-lib";
|
|
8
|
-
import {
|
|
9
|
-
const Qe = "4.
|
|
10
|
-
var et = /* @__PURE__ */ ((
|
|
8
|
+
import { MIN_STAKE_AMOUNT_BTC as Xe } from "./constants-D1FnS2Z8.js";
|
|
9
|
+
const Qe = "4.4.1", nn = "@lombard.finance/sdk", sn = typeof window < "u" && typeof window.document < "u" ? "browser" : typeof process < "u" && process.versions && process.versions.node ? "node" : "unknown";
|
|
10
|
+
var et = /* @__PURE__ */ ((n) => (n.UNKNOWN_ERROR = "unknown-error", n.INVALID_CONFIGURATION = "invalid-configuration", n.OPERATION_TIMEOUT = "operation-timeout", n.OPERATION_CANCELLED = "operation-cancelled", n))(et || {}), tt = /* @__PURE__ */ ((n) => (n.PROVIDER_MISSING = "provider-missing", n.PROVIDER_INITIALIZATION_FAILED = "provider-initialization-failed", n.PROVIDER_CALL_FAILED = "provider-call-failed", n.SIGNER_MISSING = "signer-missing", n.USER_REJECTED = "user-rejected", n.NETWORK_MISMATCH = "network-mismatch", n))(tt || {}), nt = /* @__PURE__ */ ((n) => (n.ROUTE_NOT_FOUND = "route-not-found", n.INVALID_ROUTE_DEFINITION = "invalid-route-definition", n.UNSUPPORTED_CHAIN = "unsupported-chain", n.UNSUPPORTED_ASSET = "unsupported-asset", n.INCOMPATIBLE_ROUTE = "incompatible-route", n.ENVIRONMENT_MISMATCH = "environment-mismatch", n))(nt || {}), Z = /* @__PURE__ */ ((n) => (n.INVALID_ADDRESS = "invalid-address", n.INVALID_AMOUNT = "invalid-amount", n.AMOUNT_TOO_SMALL = "amount-too-small", n.AMOUNT_TOO_LARGE = "amount-too-large", n.INSUFFICIENT_BALANCE = "insufficient-balance", n.INVALID_PARAMETER = "invalid-parameter", n.MISSING_REQUIRED_PARAMETER = "missing-required-parameter", n.INVALID_CHAIN = "invalid-chain", n.INVALID_STATE = "invalid-state", n.INVALID_ASSET = "invalid-asset", n))(Z || {}), st = /* @__PURE__ */ ((n) => (n.CONTRACT_CALL_FAILED = "contract-call-failed", n.TRANSACTION_FAILED = "transaction-failed", n.TRANSACTION_REVERTED = "transaction-reverted", n.APPROVAL_FAILED = "approval-failed", n.INSUFFICIENT_ALLOWANCE = "insufficient-allowance", n.GAS_ESTIMATION_FAILED = "gas-estimation-failed", n))(st || {}), rt = /* @__PURE__ */ ((n) => (n.INSUFFICIENT_SHARES = "withdraw-insufficient-shares", n.INVALID_AMOUNT = "withdraw-invalid-amount", n.NO_PENDING_WITHDRAWAL = "withdraw-no-pending", n.WITHDRAWAL_ALREADY_FULFILLED = "withdraw-already-fulfilled", n.WITHDRAWAL_EXPIRED = "withdraw-expired", n.WITHDRAWAL_NOT_FOUND = "withdraw-not-found", n.PROTOCOL_NOT_SUPPORTED = "withdraw-protocol-not-supported", n.INSUFFICIENT_LIQUIDITY = "withdraw-insufficient-liquidity", n))(rt || {});
|
|
11
11
|
class E extends Error {
|
|
12
|
-
constructor(t,
|
|
13
|
-
super(
|
|
12
|
+
constructor(t, s, r) {
|
|
13
|
+
super(s);
|
|
14
14
|
/** Machine-readable error code */
|
|
15
15
|
I(this, "code");
|
|
16
16
|
/** Additional metadata for debugging */
|
|
@@ -19,7 +19,7 @@ class E extends Error {
|
|
|
19
19
|
I(this, "sdkVersion", Qe);
|
|
20
20
|
/** Timestamp when error occurred */
|
|
21
21
|
I(this, "timestamp", (/* @__PURE__ */ new Date()).toISOString());
|
|
22
|
-
this.name = "LombardError", this.code = t, this.metadata =
|
|
22
|
+
this.name = "LombardError", this.code = t, this.metadata = r, Error.captureStackTrace && Error.captureStackTrace(this, E);
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
25
|
* Serialize error to JSON for logging
|
|
@@ -84,11 +84,11 @@ class E extends Error {
|
|
|
84
84
|
/**
|
|
85
85
|
* Factory: Provider missing error
|
|
86
86
|
*/
|
|
87
|
-
static providerMissing(t,
|
|
87
|
+
static providerMissing(t, s) {
|
|
88
88
|
return new E(
|
|
89
89
|
"provider-missing",
|
|
90
|
-
`${
|
|
91
|
-
{ chain: t, providerType:
|
|
90
|
+
`${s} provider not configured for chain ${t}. Please provide a provider via SDK initialization.`,
|
|
91
|
+
{ chain: t, providerType: s }
|
|
92
92
|
);
|
|
93
93
|
}
|
|
94
94
|
static moduleMissing(t) {
|
|
@@ -101,12 +101,12 @@ class E extends Error {
|
|
|
101
101
|
/**
|
|
102
102
|
* Factory: Provider call failed error
|
|
103
103
|
*/
|
|
104
|
-
static providerCallFailed(t,
|
|
105
|
-
const
|
|
104
|
+
static providerCallFailed(t, s) {
|
|
105
|
+
const r = s instanceof Error ? s.message : s;
|
|
106
106
|
return new E(
|
|
107
107
|
"provider-call-failed",
|
|
108
|
-
`Provider method ${t} failed: ${
|
|
109
|
-
{ method: t, cause:
|
|
108
|
+
`Provider method ${t} failed: ${r}`,
|
|
109
|
+
{ method: t, cause: r }
|
|
110
110
|
);
|
|
111
111
|
}
|
|
112
112
|
/**
|
|
@@ -152,19 +152,19 @@ class E extends Error {
|
|
|
152
152
|
/**
|
|
153
153
|
* Factory: Invalid parameter
|
|
154
154
|
*/
|
|
155
|
-
static invalidParameter(t,
|
|
156
|
-
return new E("invalid-parameter",
|
|
155
|
+
static invalidParameter(t, s) {
|
|
156
|
+
return new E("invalid-parameter", s, {
|
|
157
157
|
parameter: t
|
|
158
158
|
});
|
|
159
159
|
}
|
|
160
160
|
/**
|
|
161
161
|
* Factory: Invalid address
|
|
162
162
|
*/
|
|
163
|
-
static invalidAddress(t,
|
|
163
|
+
static invalidAddress(t, s) {
|
|
164
164
|
return new E(
|
|
165
165
|
"invalid-address",
|
|
166
|
-
`Invalid address format: ${t}${
|
|
167
|
-
{ address: t, chain:
|
|
166
|
+
`Invalid address format: ${t}${s ? ` for chain ${s}` : ""}`,
|
|
167
|
+
{ address: t, chain: s }
|
|
168
168
|
);
|
|
169
169
|
}
|
|
170
170
|
/**
|
|
@@ -178,21 +178,21 @@ class E extends Error {
|
|
|
178
178
|
/**
|
|
179
179
|
* Factory: Amount too small
|
|
180
180
|
*/
|
|
181
|
-
static amountTooSmall(t,
|
|
181
|
+
static amountTooSmall(t, s, r) {
|
|
182
182
|
return new E(
|
|
183
183
|
"amount-too-small",
|
|
184
|
-
`Amount ${t} is below minimum ${
|
|
185
|
-
{ amount: t, minimum:
|
|
184
|
+
`Amount ${t} is below minimum ${s} ${r}`,
|
|
185
|
+
{ amount: t, minimum: s, asset: r }
|
|
186
186
|
);
|
|
187
187
|
}
|
|
188
188
|
/**
|
|
189
189
|
* Factory: Insufficient balance
|
|
190
190
|
*/
|
|
191
|
-
static insufficientBalance(t,
|
|
191
|
+
static insufficientBalance(t, s, r) {
|
|
192
192
|
return new E(
|
|
193
193
|
"insufficient-balance",
|
|
194
|
-
`Insufficient ${
|
|
195
|
-
{ required: t, available:
|
|
194
|
+
`Insufficient ${r} balance. Required: ${t}, Available: ${s}`,
|
|
195
|
+
{ required: t, available: s, asset: r }
|
|
196
196
|
);
|
|
197
197
|
}
|
|
198
198
|
/**
|
|
@@ -208,42 +208,42 @@ class E extends Error {
|
|
|
208
208
|
/**
|
|
209
209
|
* Factory: Transaction failed
|
|
210
210
|
*/
|
|
211
|
-
static transactionFailed(t,
|
|
211
|
+
static transactionFailed(t, s) {
|
|
212
212
|
return new E(
|
|
213
213
|
"transaction-failed",
|
|
214
|
-
`Transaction failed: ${
|
|
215
|
-
{ txHash: t, reason:
|
|
214
|
+
`Transaction failed: ${s}`,
|
|
215
|
+
{ txHash: t, reason: s }
|
|
216
216
|
);
|
|
217
217
|
}
|
|
218
218
|
/**
|
|
219
219
|
* Factory: Transaction reverted
|
|
220
220
|
*/
|
|
221
|
-
static transactionReverted(t,
|
|
221
|
+
static transactionReverted(t, s) {
|
|
222
222
|
return new E(
|
|
223
223
|
"transaction-reverted",
|
|
224
|
-
`Transaction reverted${
|
|
225
|
-
{ txHash: t, revertReason:
|
|
224
|
+
`Transaction reverted${s ? `: ${s}` : ""}`,
|
|
225
|
+
{ txHash: t, revertReason: s }
|
|
226
226
|
);
|
|
227
227
|
}
|
|
228
228
|
/**
|
|
229
229
|
* Factory: Approval failed
|
|
230
230
|
*/
|
|
231
|
-
static approvalFailed(t,
|
|
231
|
+
static approvalFailed(t, s) {
|
|
232
232
|
return new E(
|
|
233
233
|
"approval-failed",
|
|
234
|
-
`Failed to approve ${t} for spender ${
|
|
235
|
-
{ token: t, spender:
|
|
234
|
+
`Failed to approve ${t} for spender ${s}`,
|
|
235
|
+
{ token: t, spender: s }
|
|
236
236
|
);
|
|
237
237
|
}
|
|
238
238
|
}
|
|
239
|
-
function
|
|
240
|
-
return
|
|
239
|
+
function at(n) {
|
|
240
|
+
return n instanceof E;
|
|
241
241
|
}
|
|
242
|
-
function pe(
|
|
243
|
-
return
|
|
244
|
-
originalError:
|
|
245
|
-
}) : new E("unknown-error", String(
|
|
246
|
-
originalValue:
|
|
242
|
+
function pe(n) {
|
|
243
|
+
return at(n) ? n : n instanceof Error ? new E("unknown-error", n.message, {
|
|
244
|
+
originalError: n.stack
|
|
245
|
+
}) : new E("unknown-error", String(n), {
|
|
246
|
+
originalValue: n
|
|
247
247
|
});
|
|
248
248
|
}
|
|
249
249
|
const p = {
|
|
@@ -258,7 +258,7 @@ const p = {
|
|
|
258
258
|
RIPPLE: "ripple",
|
|
259
259
|
DOGECOIN: "dogecoin",
|
|
260
260
|
HYPERLIQUID: "hyperliquid"
|
|
261
|
-
}, fe = ":", y = (
|
|
261
|
+
}, fe = ":", y = (n, e) => `${n}${fe}${e}`, o = {
|
|
262
262
|
// Bitcoin chains (BIP122: first 32 chars of genesis block hash in little-endian)
|
|
263
263
|
BITCOIN_MAINNET: y(
|
|
264
264
|
p.BIP122,
|
|
@@ -328,15 +328,15 @@ const p = {
|
|
|
328
328
|
// Custodial (unofficial namespace)
|
|
329
329
|
HYPERLIQUID: y(p.HYPERLIQUID, "mainnet")
|
|
330
330
|
};
|
|
331
|
-
function
|
|
331
|
+
function rn(n) {
|
|
332
332
|
return Object.keys(o).find(
|
|
333
|
-
(e) => o[e] ===
|
|
333
|
+
(e) => o[e] === n
|
|
334
334
|
) ?? "";
|
|
335
335
|
}
|
|
336
|
-
function
|
|
337
|
-
return typeof
|
|
336
|
+
function an(n) {
|
|
337
|
+
return typeof n == "string" && Object.values(o).includes(n);
|
|
338
338
|
}
|
|
339
|
-
const
|
|
339
|
+
const F = {
|
|
340
340
|
// ─────────────────────────────────────────────────────────────────────────
|
|
341
341
|
// Bitcoin
|
|
342
342
|
// ─────────────────────────────────────────────────────────────────────────
|
|
@@ -708,93 +708,98 @@ const K = {
|
|
|
708
708
|
SN_MAIN: Je,
|
|
709
709
|
SN_SEPOLIA: Ye
|
|
710
710
|
};
|
|
711
|
-
function ot(
|
|
712
|
-
return ct[
|
|
711
|
+
function ot(n) {
|
|
712
|
+
return ct[n];
|
|
713
713
|
}
|
|
714
|
-
function
|
|
715
|
-
return
|
|
714
|
+
function cn(n) {
|
|
715
|
+
return F[n];
|
|
716
716
|
}
|
|
717
|
-
function
|
|
718
|
-
return
|
|
717
|
+
function on(n) {
|
|
718
|
+
return F[n].name;
|
|
719
719
|
}
|
|
720
|
-
function
|
|
721
|
-
return
|
|
720
|
+
function dn(n) {
|
|
721
|
+
return F[n].type;
|
|
722
722
|
}
|
|
723
|
-
function
|
|
724
|
-
return
|
|
723
|
+
function un(n) {
|
|
724
|
+
return F[n].isTestnet;
|
|
725
725
|
}
|
|
726
|
-
function
|
|
727
|
-
return !
|
|
726
|
+
function ln(n) {
|
|
727
|
+
return !F[n].isTestnet;
|
|
728
728
|
}
|
|
729
|
-
function Le(
|
|
730
|
-
return
|
|
729
|
+
function Le(n) {
|
|
730
|
+
return F[n].type === "evm";
|
|
731
731
|
}
|
|
732
|
-
|
|
733
|
-
|
|
732
|
+
function fn(n, e) {
|
|
733
|
+
const { explorerUrl: t } = F[n];
|
|
734
|
+
if (t)
|
|
735
|
+
return `${t}/tx/${e}`;
|
|
736
|
+
}
|
|
737
|
+
const Q = (n) => `${n}${fe}`;
|
|
738
|
+
function hn(n) {
|
|
734
739
|
const e = Q(p.EIP155);
|
|
735
|
-
if (
|
|
736
|
-
const
|
|
737
|
-
if (He(
|
|
740
|
+
if (n.startsWith(e)) {
|
|
741
|
+
const a = Number.parseInt(n.slice(e.length), 10);
|
|
742
|
+
if (He(a)) return a;
|
|
738
743
|
throw new E(
|
|
739
744
|
Z.INVALID_CHAIN,
|
|
740
|
-
`Invalid EVM chain: ${
|
|
745
|
+
`Invalid EVM chain: ${n}`
|
|
741
746
|
);
|
|
742
747
|
}
|
|
743
748
|
const t = Q(p.SOLANA);
|
|
744
|
-
if (
|
|
745
|
-
const
|
|
749
|
+
if (n.startsWith(t)) {
|
|
750
|
+
const a = n.slice(t.length), i = `solana:${a}`;
|
|
746
751
|
if (ze(i)) return i;
|
|
747
|
-
const c = it[
|
|
752
|
+
const c = it[a];
|
|
748
753
|
if (c) return c;
|
|
749
754
|
throw new E(
|
|
750
755
|
Z.INVALID_CHAIN,
|
|
751
|
-
`Invalid Solana chain: ${
|
|
756
|
+
`Invalid Solana chain: ${n}`
|
|
752
757
|
);
|
|
753
758
|
}
|
|
754
|
-
const
|
|
755
|
-
if (
|
|
756
|
-
if (Ke(
|
|
759
|
+
const s = Q(p.SUI);
|
|
760
|
+
if (n.startsWith(s)) {
|
|
761
|
+
if (Ke(n)) return n;
|
|
757
762
|
throw new E(
|
|
758
763
|
Z.INVALID_CHAIN,
|
|
759
|
-
`Invalid Sui chain: ${
|
|
764
|
+
`Invalid Sui chain: ${n}`
|
|
760
765
|
);
|
|
761
766
|
}
|
|
762
|
-
const
|
|
763
|
-
if (
|
|
764
|
-
const
|
|
767
|
+
const r = Q(p.STARKNET);
|
|
768
|
+
if (n.startsWith(r)) {
|
|
769
|
+
const a = n.slice(r.length), i = ot(a);
|
|
765
770
|
if (i) return i;
|
|
766
771
|
throw new E(
|
|
767
772
|
Z.INVALID_CHAIN,
|
|
768
|
-
`Invalid Starknet chain: ${
|
|
773
|
+
`Invalid Starknet chain: ${n}`
|
|
769
774
|
);
|
|
770
775
|
}
|
|
771
776
|
throw new E(
|
|
772
777
|
Z.INVALID_CHAIN,
|
|
773
|
-
`Invalid chain: ${
|
|
778
|
+
`Invalid chain: ${n}`
|
|
774
779
|
);
|
|
775
780
|
}
|
|
776
|
-
function
|
|
777
|
-
return `${p.EIP155}${fe}${
|
|
781
|
+
function mn(n) {
|
|
782
|
+
return `${p.EIP155}${fe}${n}`;
|
|
778
783
|
}
|
|
779
|
-
const
|
|
784
|
+
const S = {
|
|
780
785
|
version: "1.0.0",
|
|
781
786
|
assets: {
|
|
782
787
|
// ═══════════════════════════════════════════════════════════════════════
|
|
783
788
|
// LBTC - Lombard BTC
|
|
784
789
|
// ═══════════════════════════════════════════════════════════════════════
|
|
785
|
-
[
|
|
790
|
+
[U.LBTC]: {
|
|
786
791
|
decimals: 8,
|
|
787
792
|
symbol: "LBTC",
|
|
788
793
|
name: "Lombard BTC",
|
|
789
794
|
deployments: [
|
|
790
795
|
// Production
|
|
791
796
|
{
|
|
792
|
-
env:
|
|
797
|
+
env: _.prod,
|
|
793
798
|
chain: o.ETHEREUM,
|
|
794
799
|
address: "0x8236a87084f8b84306f72007f36f2618a5634494"
|
|
795
800
|
},
|
|
796
801
|
{
|
|
797
|
-
env:
|
|
802
|
+
env: _.prod,
|
|
798
803
|
chains: [
|
|
799
804
|
o.BASE,
|
|
800
805
|
o.BSC,
|
|
@@ -811,34 +816,34 @@ const N = {
|
|
|
811
816
|
address: "0xecAc9C5F704e954931349Da37F60E39f515c11c1"
|
|
812
817
|
},
|
|
813
818
|
{
|
|
814
|
-
env:
|
|
819
|
+
env: _.prod,
|
|
815
820
|
chain: o.BOB,
|
|
816
821
|
address: "0xA45d4121b3D47719FF57a947A9d961539Ba33204"
|
|
817
822
|
},
|
|
818
823
|
{
|
|
819
|
-
env:
|
|
824
|
+
env: _.prod,
|
|
820
825
|
chain: o.SOLANA_MAINNET,
|
|
821
826
|
address: "LomP48F7bLbKyMRHHsDVt7wuHaUQvQnVVspjcbfuAek"
|
|
822
827
|
},
|
|
823
828
|
{
|
|
824
|
-
env:
|
|
829
|
+
env: _.prod,
|
|
825
830
|
chain: o.SUI_MAINNET,
|
|
826
831
|
address: "0x3e8e9423d80e1774a7ca128fccd8bf5f1f7753be658c5e645929037f7c819040"
|
|
827
832
|
},
|
|
828
833
|
{
|
|
829
|
-
env:
|
|
834
|
+
env: _.prod,
|
|
830
835
|
chain: o.STARKNET_MAINNET,
|
|
831
836
|
address: "0x036834a40984312f7f7de8d31e3f6305b325389eaeea5b1c0664b2fb936461a4",
|
|
832
837
|
assetRouter: "0x05b1886d0f844ab930fc0ee066f1655a873437f15a5d2c41ee3e884fd5299976"
|
|
833
838
|
},
|
|
834
839
|
// Testnet
|
|
835
840
|
{
|
|
836
|
-
env:
|
|
841
|
+
env: _.testnet,
|
|
837
842
|
chain: o.SEPOLIA,
|
|
838
843
|
address: "0xc47e4b3124597fdf8dd07843d4a7052f2ee80c30"
|
|
839
844
|
},
|
|
840
845
|
{
|
|
841
|
-
env:
|
|
846
|
+
env: _.testnet,
|
|
842
847
|
chains: [
|
|
843
848
|
o.AVALANCHE_FUJI,
|
|
844
849
|
o.BASE_SEPOLIA,
|
|
@@ -847,17 +852,17 @@ const N = {
|
|
|
847
852
|
address: "0x107Fc7d90484534704dD2A9e24c7BD45DB4dD1B5"
|
|
848
853
|
},
|
|
849
854
|
{
|
|
850
|
-
env:
|
|
855
|
+
env: _.testnet,
|
|
851
856
|
chain: o.SOLANA_TESTNET,
|
|
852
857
|
address: "79cscM6J9Af24TGGWcXyDf56fDLoodkyXdVy4R9aZ6C6"
|
|
853
858
|
},
|
|
854
859
|
{
|
|
855
|
-
env:
|
|
860
|
+
env: _.testnet,
|
|
856
861
|
chain: o.SUI_TESTNET,
|
|
857
862
|
address: "0x50454d0b0fbad1288a6ab74f2e8ce0905a3317870673ab7787ebcf6f322b45fa"
|
|
858
863
|
},
|
|
859
864
|
{
|
|
860
|
-
env:
|
|
865
|
+
env: _.testnet,
|
|
861
866
|
chain: o.STARKNET_SEPOLIA,
|
|
862
867
|
address: "0x00456a829ab75ba5e97534dc70d7fc617cfda244f8dcda47b11624de67c6e70c",
|
|
863
868
|
assetRouter: "0x063b7b5c8b114ebd5b9602fbd5d0ffd2cc3a598f1d91c6904cc0997cd8fea760"
|
|
@@ -865,7 +870,7 @@ const N = {
|
|
|
865
870
|
// Stage
|
|
866
871
|
// Note: Avalanche Fuji is only supported on testnet (Gastald), not stage
|
|
867
872
|
{
|
|
868
|
-
env:
|
|
873
|
+
env: _.stage,
|
|
869
874
|
chains: [
|
|
870
875
|
o.BASE_SEPOLIA,
|
|
871
876
|
o.BSC_TESTNET,
|
|
@@ -874,29 +879,34 @@ const N = {
|
|
|
874
879
|
address: "0x731eFa688F3679688cf60A3993b8658138953ED6"
|
|
875
880
|
},
|
|
876
881
|
{
|
|
877
|
-
env:
|
|
882
|
+
env: _.dev,
|
|
878
883
|
chain: o.SOLANA_DEVNET,
|
|
879
|
-
address: "
|
|
884
|
+
address: "LBTCojyVJ63rsEED2DLEGWMzSxWJyQynXE91LMLgV1J"
|
|
880
885
|
},
|
|
881
886
|
{
|
|
882
|
-
env:
|
|
887
|
+
env: _.stage,
|
|
888
|
+
chain: o.SOLANA_DEVNET,
|
|
889
|
+
address: "1btcyoWK7d99iosES4eXQGhhooCscKGigV5wHfvzueX"
|
|
890
|
+
},
|
|
891
|
+
{
|
|
892
|
+
env: _.stage,
|
|
883
893
|
chain: o.SUI_TESTNET,
|
|
884
894
|
address: "0x2d66430a27565b912f21be970e5ae1e8c0359f0b518c3235b751c75976791ce0"
|
|
885
895
|
},
|
|
886
896
|
{
|
|
887
|
-
env:
|
|
897
|
+
env: _.stage,
|
|
888
898
|
chain: o.STARKNET_SEPOLIA,
|
|
889
899
|
address: "0x00b442f5420860e937a99659326e81a97e07bfd538b3cee65b90029c9da38a5f",
|
|
890
900
|
assetRouter: "0x01d27f156092746d0d7cd9d9deec5e937f27c3c7c1c28365e9e5efac459880b3"
|
|
891
901
|
},
|
|
892
902
|
// Dev
|
|
893
903
|
{
|
|
894
|
-
env:
|
|
904
|
+
env: _.dev,
|
|
895
905
|
chain: o.SEPOLIA,
|
|
896
906
|
address: "0x93283b6B889C591893dB0dc93baD71656D5d8923"
|
|
897
907
|
},
|
|
898
908
|
{
|
|
899
|
-
env:
|
|
909
|
+
env: _.dev,
|
|
900
910
|
chains: [
|
|
901
911
|
o.AVALANCHE_FUJI,
|
|
902
912
|
o.BASE_SEPOLIA,
|
|
@@ -906,7 +916,7 @@ const N = {
|
|
|
906
916
|
address: "0xc47e4b3124597FDF8DD07843D4a7052F2eE80C30"
|
|
907
917
|
},
|
|
908
918
|
{
|
|
909
|
-
env:
|
|
919
|
+
env: _.dev,
|
|
910
920
|
chain: o.STARKNET_SEPOLIA,
|
|
911
921
|
address: "0x0723de0c550b7bfbb5051dade72966d71a08bef952c0197462a5244497eb57c1",
|
|
912
922
|
assetRouter: "0x04838a05c798dc57e01e85526979841c84f1f3c732a525cff53adb3e8bee3d24"
|
|
@@ -916,14 +926,14 @@ const N = {
|
|
|
916
926
|
// ═══════════════════════════════════════════════════════════════════════
|
|
917
927
|
// BTC.b - Lombard's Native BTC Wrapper
|
|
918
928
|
// ═══════════════════════════════════════════════════════════════════════
|
|
919
|
-
[
|
|
929
|
+
[U.BTCb]: {
|
|
920
930
|
decimals: 8,
|
|
921
931
|
symbol: "BTC.b",
|
|
922
932
|
name: "BTC.b",
|
|
923
933
|
deployments: [
|
|
924
934
|
// Production
|
|
925
935
|
{
|
|
926
|
-
env:
|
|
936
|
+
env: _.prod,
|
|
927
937
|
chains: [
|
|
928
938
|
o.KATANA,
|
|
929
939
|
o.MEGAETH,
|
|
@@ -933,19 +943,19 @@ const N = {
|
|
|
933
943
|
address: "0xB0F70C0bD6FD87dbEb7C10dC692a2a6106817072"
|
|
934
944
|
},
|
|
935
945
|
{
|
|
936
|
-
env:
|
|
946
|
+
env: _.prod,
|
|
937
947
|
chain: o.AVALANCHE,
|
|
938
948
|
address: "0x152b9d0FdC40C096757F570A51E494bd4b943E50",
|
|
939
949
|
bridgeAdapter: "0x85D1D52e11290F174444d21C2a167bEDBE36e4d2"
|
|
940
950
|
},
|
|
941
951
|
// Testnet
|
|
942
952
|
{
|
|
943
|
-
env:
|
|
953
|
+
env: _.testnet,
|
|
944
954
|
chain: o.SEPOLIA,
|
|
945
955
|
address: "0x20eA7b8ABb4B583788F1DFC738C709a2d9675681"
|
|
946
956
|
},
|
|
947
957
|
{
|
|
948
|
-
env:
|
|
958
|
+
env: _.testnet,
|
|
949
959
|
chain: o.AVALANCHE_FUJI,
|
|
950
960
|
address: "0x7FbdC44BfEBDe80C970ba622B678daB36cee31f6",
|
|
951
961
|
bridgeAdapter: "0x0A65C37d07c32E5eA8ea40495b7f249cdE26935e"
|
|
@@ -953,30 +963,40 @@ const N = {
|
|
|
953
963
|
// Stage
|
|
954
964
|
// Note: Avalanche Fuji is only supported on testnet (Gastald), not stage
|
|
955
965
|
{
|
|
956
|
-
env:
|
|
966
|
+
env: _.stage,
|
|
957
967
|
chain: o.SEPOLIA,
|
|
958
968
|
address: "0x600e4006278EB11FA1691cA0FE6C5fcfC4992d58"
|
|
959
969
|
},
|
|
970
|
+
{
|
|
971
|
+
env: _.dev,
|
|
972
|
+
chain: o.SOLANA_DEVNET,
|
|
973
|
+
address: "BTCB3ripBAut19jM8kDPVbJHb2ZdR2GcZvGZkCmFPtV8"
|
|
974
|
+
},
|
|
975
|
+
{
|
|
976
|
+
env: _.stage,
|
|
977
|
+
chain: o.SOLANA_DEVNET,
|
|
978
|
+
address: "BTCGPAHQSsS9RYcL2Z4B5z6YyAXLatNcnaEwYdczsMZw"
|
|
979
|
+
},
|
|
960
980
|
// Dev
|
|
961
981
|
{
|
|
962
|
-
env:
|
|
982
|
+
env: _.dev,
|
|
963
983
|
chain: o.SEPOLIA,
|
|
964
984
|
address: "0x195219A262423d209E126BD21cf4F4F9AA796927"
|
|
965
985
|
},
|
|
966
986
|
{
|
|
967
|
-
env:
|
|
987
|
+
env: _.dev,
|
|
968
988
|
chain: o.BSC_TESTNET,
|
|
969
989
|
address: "0xea3F66E5f2928dB9673103BfA01a2153A57a8050"
|
|
970
990
|
},
|
|
971
991
|
{
|
|
972
|
-
env:
|
|
992
|
+
env: _.dev,
|
|
973
993
|
chain: o.AVALANCHE_FUJI,
|
|
974
994
|
address: "0x7FbdC44BfEBDe80C970ba622B678daB36cee31f6",
|
|
975
995
|
bridgeAdapter: "0x0A65C37d07c32E5eA8ea40495b7f249cdE26935e"
|
|
976
996
|
},
|
|
977
997
|
// IBC
|
|
978
998
|
{
|
|
979
|
-
env:
|
|
999
|
+
env: _.ibc,
|
|
980
1000
|
chain: o.AVALANCHE_FUJI,
|
|
981
1001
|
address: "0x71ba2b8dc58e7ca1b6d81a60729e31aefa37ae02",
|
|
982
1002
|
bridgeAdapter: "0x1391f9AC408cf13214DDB71d359002658eaF9ebb"
|
|
@@ -986,31 +1006,31 @@ const N = {
|
|
|
986
1006
|
// ═══════════════════════════════════════════════════════════════════════
|
|
987
1007
|
// BTCBinance (BTCB) - Binance-Peg BTCB
|
|
988
1008
|
// ═══════════════════════════════════════════════════════════════════════
|
|
989
|
-
[
|
|
1009
|
+
[U.BTCBinance]: {
|
|
990
1010
|
decimals: 18,
|
|
991
1011
|
symbol: "BTCB",
|
|
992
1012
|
name: "Binance-Peg BTCB",
|
|
993
1013
|
deployments: [
|
|
994
1014
|
{
|
|
995
|
-
env:
|
|
1015
|
+
env: _.prod,
|
|
996
1016
|
chain: o.BSC,
|
|
997
1017
|
address: "0x7130d2a12b9bcbfae4f2634d864a1ee1ce3ead9c",
|
|
998
1018
|
publicMarketMaker: "0xE4ff44a615dF38e37cdF475833c1d57774CC9D4A"
|
|
999
1019
|
},
|
|
1000
1020
|
{
|
|
1001
|
-
env:
|
|
1021
|
+
env: _.testnet,
|
|
1002
1022
|
chain: o.BSC_TESTNET,
|
|
1003
1023
|
address: "0x7130d2a12b9bcbfae4f2634d864a1ee1ce3ead9c",
|
|
1004
1024
|
publicMarketMaker: "0x63749Acfc2527A8406E8BC8c93A80f29FDD75e27"
|
|
1005
1025
|
},
|
|
1006
1026
|
{
|
|
1007
|
-
env:
|
|
1027
|
+
env: _.stage,
|
|
1008
1028
|
chain: o.BSC_TESTNET,
|
|
1009
1029
|
address: "0x7130d2a12b9bcbfae4f2634d864a1ee1ce3ead9c",
|
|
1010
1030
|
publicMarketMaker: "0x440362b55D4a255EBA3c27C650d2dC1a91Db85bA"
|
|
1011
1031
|
},
|
|
1012
1032
|
{
|
|
1013
|
-
env:
|
|
1033
|
+
env: _.dev,
|
|
1014
1034
|
chain: o.BSC_TESTNET,
|
|
1015
1035
|
address: "0x7130d2a12b9bcbfae4f2634d864a1ee1ce3ead9c",
|
|
1016
1036
|
publicMarketMaker: "0x440362b55D4a255EBA3c27C650d2dC1a91Db85bA"
|
|
@@ -1020,13 +1040,13 @@ const N = {
|
|
|
1020
1040
|
// ═══════════════════════════════════════════════════════════════════════
|
|
1021
1041
|
// cbBTC - Coinbase Wrapped BTC
|
|
1022
1042
|
// ═══════════════════════════════════════════════════════════════════════
|
|
1023
|
-
[
|
|
1043
|
+
[U.cbBTC]: {
|
|
1024
1044
|
decimals: 8,
|
|
1025
1045
|
symbol: "cbBTC",
|
|
1026
1046
|
name: "Coinbase Wrapped BTC",
|
|
1027
1047
|
deployments: [
|
|
1028
1048
|
{
|
|
1029
|
-
env:
|
|
1049
|
+
env: _.prod,
|
|
1030
1050
|
chains: [o.ETHEREUM, o.BASE],
|
|
1031
1051
|
address: "0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf",
|
|
1032
1052
|
publicMarketMaker: "0x92c01FC0F59857c6E920EdFf1139904b2Bb74c7c"
|
|
@@ -1036,12 +1056,12 @@ const N = {
|
|
|
1036
1056
|
// ═══════════════════════════════════════════════════════════════════════
|
|
1037
1057
|
// eBTC
|
|
1038
1058
|
// ═══════════════════════════════════════════════════════════════════════
|
|
1039
|
-
[
|
|
1059
|
+
[U.eBTC]: {
|
|
1040
1060
|
decimals: 8,
|
|
1041
1061
|
symbol: "eBTC",
|
|
1042
1062
|
deployments: [
|
|
1043
1063
|
{
|
|
1044
|
-
env:
|
|
1064
|
+
env: _.prod,
|
|
1045
1065
|
chain: o.ETHEREUM,
|
|
1046
1066
|
address: "0x657e8c867d8b37dcc18fa4caead9c45eb088c642"
|
|
1047
1067
|
}
|
|
@@ -1050,12 +1070,12 @@ const N = {
|
|
|
1050
1070
|
// ═══════════════════════════════════════════════════════════════════════
|
|
1051
1071
|
// WBTC - Wrapped BTC
|
|
1052
1072
|
// ═══════════════════════════════════════════════════════════════════════
|
|
1053
|
-
[
|
|
1073
|
+
[U.WBTC]: {
|
|
1054
1074
|
decimals: 8,
|
|
1055
1075
|
symbol: "WBTC",
|
|
1056
1076
|
deployments: [
|
|
1057
1077
|
{
|
|
1058
|
-
env:
|
|
1078
|
+
env: _.prod,
|
|
1059
1079
|
chain: o.ETHEREUM,
|
|
1060
1080
|
address: "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599"
|
|
1061
1081
|
}
|
|
@@ -1064,12 +1084,12 @@ const N = {
|
|
|
1064
1084
|
// ═══════════════════════════════════════════════════════════════════════
|
|
1065
1085
|
// wBTCN - Wrapped BTCN on Corn
|
|
1066
1086
|
// ═══════════════════════════════════════════════════════════════════════
|
|
1067
|
-
[
|
|
1087
|
+
[U.WBTCN]: {
|
|
1068
1088
|
decimals: 8,
|
|
1069
1089
|
symbol: "wBTCN",
|
|
1070
1090
|
deployments: [
|
|
1071
1091
|
{
|
|
1072
|
-
env:
|
|
1092
|
+
env: _.prod,
|
|
1073
1093
|
chain: o.CORN,
|
|
1074
1094
|
address: "0xda5dDd7270381A7C2717aD10D1c0ecB19e3CDFb2"
|
|
1075
1095
|
}
|
|
@@ -1077,114 +1097,114 @@ const N = {
|
|
|
1077
1097
|
}
|
|
1078
1098
|
}
|
|
1079
1099
|
}, dt = 8;
|
|
1080
|
-
function Y(
|
|
1081
|
-
const
|
|
1082
|
-
if (
|
|
1083
|
-
return
|
|
1084
|
-
(
|
|
1100
|
+
function Y(n, e, t, s) {
|
|
1101
|
+
const r = n.assets[e];
|
|
1102
|
+
if (r)
|
|
1103
|
+
return r.deployments.find(
|
|
1104
|
+
(a) => {
|
|
1085
1105
|
var i;
|
|
1086
|
-
return
|
|
1106
|
+
return a.env === t && (a.chain === s || ((i = a.chains) == null ? void 0 : i.includes(s)));
|
|
1087
1107
|
}
|
|
1088
1108
|
);
|
|
1089
1109
|
}
|
|
1090
|
-
function
|
|
1091
|
-
var
|
|
1092
|
-
return (
|
|
1110
|
+
function pn(n, e, t, s = S) {
|
|
1111
|
+
var r;
|
|
1112
|
+
return (r = Y(s, n, e, t)) == null ? void 0 : r.address;
|
|
1093
1113
|
}
|
|
1094
|
-
function
|
|
1114
|
+
function gn(n, e = S) {
|
|
1095
1115
|
var t;
|
|
1096
|
-
return ((t = e.assets[
|
|
1116
|
+
return ((t = e.assets[n]) == null ? void 0 : t.decimals) ?? dt;
|
|
1097
1117
|
}
|
|
1098
|
-
function
|
|
1099
|
-
var
|
|
1100
|
-
return (
|
|
1118
|
+
function vn(n, e, t, s = S) {
|
|
1119
|
+
var r;
|
|
1120
|
+
return (r = Y(s, n, e, t)) == null ? void 0 : r.assetRouter;
|
|
1101
1121
|
}
|
|
1102
|
-
function
|
|
1103
|
-
var
|
|
1104
|
-
return !!((
|
|
1122
|
+
function yn(n, e, t, s = S) {
|
|
1123
|
+
var r;
|
|
1124
|
+
return !!((r = Y(s, n, e, t)) != null && r.assetRouter);
|
|
1105
1125
|
}
|
|
1106
|
-
function
|
|
1107
|
-
var
|
|
1108
|
-
return (
|
|
1126
|
+
function _n(n, e, t, s = S) {
|
|
1127
|
+
var r;
|
|
1128
|
+
return (r = Y(s, n, e, t)) == null ? void 0 : r.bridgeAdapter;
|
|
1109
1129
|
}
|
|
1110
|
-
function
|
|
1111
|
-
var
|
|
1112
|
-
return (
|
|
1130
|
+
function An(n, e, t, s = S) {
|
|
1131
|
+
var r;
|
|
1132
|
+
return (r = Y(s, n, e, t)) == null ? void 0 : r.publicMarketMaker;
|
|
1113
1133
|
}
|
|
1114
|
-
function
|
|
1115
|
-
return !!Y(
|
|
1134
|
+
function Tn(n, e, t, s = S) {
|
|
1135
|
+
return !!Y(s, n, e, t);
|
|
1116
1136
|
}
|
|
1117
|
-
function
|
|
1118
|
-
const
|
|
1119
|
-
for (const [
|
|
1137
|
+
function En(n, e, t, s = S) {
|
|
1138
|
+
const r = n.toLowerCase();
|
|
1139
|
+
for (const [a, i] of Object.entries(s.assets)) {
|
|
1120
1140
|
if (!i) continue;
|
|
1121
1141
|
if (i.deployments.find(
|
|
1122
1142
|
(u) => {
|
|
1123
1143
|
var h;
|
|
1124
|
-
return u.env === e && (u.chain === t || ((h = u.chains) == null ? void 0 : h.includes(t))) && u.address.toLowerCase() ===
|
|
1144
|
+
return u.env === e && (u.chain === t || ((h = u.chains) == null ? void 0 : h.includes(t))) && u.address.toLowerCase() === r;
|
|
1125
1145
|
}
|
|
1126
|
-
)) return
|
|
1146
|
+
)) return a;
|
|
1127
1147
|
}
|
|
1128
1148
|
}
|
|
1129
|
-
function
|
|
1130
|
-
const
|
|
1131
|
-
if (!
|
|
1132
|
-
const
|
|
1133
|
-
for (const
|
|
1134
|
-
|
|
1135
|
-
return
|
|
1149
|
+
function bn(n, e, t = S) {
|
|
1150
|
+
const s = t.assets[n];
|
|
1151
|
+
if (!s) return [];
|
|
1152
|
+
const r = [];
|
|
1153
|
+
for (const a of s.deployments)
|
|
1154
|
+
a.env === e && (a.chain && r.push(a.chain), a.chains && r.push(...a.chains));
|
|
1155
|
+
return r;
|
|
1136
1156
|
}
|
|
1137
|
-
function
|
|
1138
|
-
var
|
|
1139
|
-
const
|
|
1140
|
-
if (!
|
|
1141
|
-
const
|
|
1142
|
-
for (const i of
|
|
1143
|
-
(i.chain === e || (
|
|
1144
|
-
return Array.from(
|
|
1157
|
+
function xn(n, e, t = S) {
|
|
1158
|
+
var a;
|
|
1159
|
+
const s = t.assets[n];
|
|
1160
|
+
if (!s) return [];
|
|
1161
|
+
const r = /* @__PURE__ */ new Set();
|
|
1162
|
+
for (const i of s.deployments)
|
|
1163
|
+
(i.chain === e || (a = i.chains) != null && a.includes(e)) && r.add(i.env);
|
|
1164
|
+
return Array.from(r);
|
|
1145
1165
|
}
|
|
1146
|
-
function
|
|
1147
|
-
return Object.keys(
|
|
1166
|
+
function Nn(n = S) {
|
|
1167
|
+
return Object.keys(n.assets);
|
|
1148
1168
|
}
|
|
1149
|
-
function
|
|
1150
|
-
const t = e.assets[
|
|
1169
|
+
function Sn(n, e = S) {
|
|
1170
|
+
const t = e.assets[n];
|
|
1151
1171
|
if (!t) return [];
|
|
1152
|
-
const
|
|
1153
|
-
for (const
|
|
1154
|
-
|
|
1155
|
-
return Array.from(
|
|
1172
|
+
const s = /* @__PURE__ */ new Set();
|
|
1173
|
+
for (const r of t.deployments)
|
|
1174
|
+
r.chain && s.add(r.chain), r.chains && r.chains.forEach((a) => s.add(a));
|
|
1175
|
+
return Array.from(s);
|
|
1156
1176
|
}
|
|
1157
|
-
function ie(
|
|
1158
|
-
const
|
|
1159
|
-
if (!
|
|
1160
|
-
const
|
|
1161
|
-
for (const
|
|
1162
|
-
e.includes(
|
|
1163
|
-
return Array.from(
|
|
1177
|
+
function ie(n, e, t = S) {
|
|
1178
|
+
const s = t.assets[n];
|
|
1179
|
+
if (!s) return [];
|
|
1180
|
+
const r = /* @__PURE__ */ new Set();
|
|
1181
|
+
for (const a of s.deployments)
|
|
1182
|
+
e.includes(a.env) && (a.chain && r.add(a.chain), a.chains && a.chains.forEach((i) => r.add(i)));
|
|
1183
|
+
return Array.from(r);
|
|
1164
1184
|
}
|
|
1165
|
-
function
|
|
1166
|
-
const t = e.assets[
|
|
1185
|
+
function In(n, e = S) {
|
|
1186
|
+
const t = e.assets[n];
|
|
1167
1187
|
if (t)
|
|
1168
1188
|
return { decimals: t.decimals, symbol: t.symbol, name: t.name };
|
|
1169
1189
|
}
|
|
1170
|
-
function
|
|
1171
|
-
return ie(
|
|
1172
|
-
(
|
|
1190
|
+
function kn(n, e, t = S) {
|
|
1191
|
+
return ie(n, e, t).filter(
|
|
1192
|
+
(s) => Le(s)
|
|
1173
1193
|
);
|
|
1174
1194
|
}
|
|
1175
|
-
function ut(
|
|
1176
|
-
if (
|
|
1177
|
-
const
|
|
1178
|
-
for (let
|
|
1179
|
-
const
|
|
1180
|
-
for (const i of
|
|
1181
|
-
|
|
1182
|
-
}
|
|
1183
|
-
return Array.from(
|
|
1195
|
+
function ut(n, e, t = S) {
|
|
1196
|
+
if (n.length === 0) return [];
|
|
1197
|
+
const s = new Set(ie(n[0], e, t));
|
|
1198
|
+
for (let r = 1; r < n.length; r++) {
|
|
1199
|
+
const a = new Set(ie(n[r], e, t));
|
|
1200
|
+
for (const i of s)
|
|
1201
|
+
a.has(i) || s.delete(i);
|
|
1202
|
+
}
|
|
1203
|
+
return Array.from(s);
|
|
1184
1204
|
}
|
|
1185
|
-
function
|
|
1186
|
-
return ut(
|
|
1187
|
-
(
|
|
1205
|
+
function Cn(n, e, t = S) {
|
|
1206
|
+
return ut(n, e, t).filter(
|
|
1207
|
+
(s) => Le(s)
|
|
1188
1208
|
);
|
|
1189
1209
|
}
|
|
1190
1210
|
class lt {
|
|
@@ -1220,23 +1240,23 @@ class lt {
|
|
|
1220
1240
|
this.config = void 0;
|
|
1221
1241
|
}
|
|
1222
1242
|
}
|
|
1223
|
-
function De(
|
|
1243
|
+
function De(n, e) {
|
|
1224
1244
|
let t;
|
|
1225
1245
|
switch (e) {
|
|
1226
1246
|
case "evm":
|
|
1227
|
-
t =
|
|
1247
|
+
t = n.evm;
|
|
1228
1248
|
break;
|
|
1229
1249
|
case "bitcoin":
|
|
1230
|
-
t =
|
|
1250
|
+
t = n.bitcoin;
|
|
1231
1251
|
break;
|
|
1232
1252
|
case "solana":
|
|
1233
|
-
t =
|
|
1253
|
+
t = n.solana;
|
|
1234
1254
|
break;
|
|
1235
1255
|
case "sui":
|
|
1236
|
-
t =
|
|
1256
|
+
t = n.sui;
|
|
1237
1257
|
break;
|
|
1238
1258
|
case "starknet":
|
|
1239
|
-
t =
|
|
1259
|
+
t = n.starknet;
|
|
1240
1260
|
break;
|
|
1241
1261
|
default:
|
|
1242
1262
|
t = void 0;
|
|
@@ -1248,7 +1268,7 @@ class ft {
|
|
|
1248
1268
|
I(this, "modules", /* @__PURE__ */ new Map());
|
|
1249
1269
|
I(this, "services", /* @__PURE__ */ new Map());
|
|
1250
1270
|
I(this, "shared", /* @__PURE__ */ new Map());
|
|
1251
|
-
this.config = t, e.forEach((
|
|
1271
|
+
this.config = t, e.forEach((s) => this.modules.set(s.id, s));
|
|
1252
1272
|
}
|
|
1253
1273
|
/**
|
|
1254
1274
|
* Require a module service
|
|
@@ -1296,95 +1316,95 @@ class ft {
|
|
|
1296
1316
|
};
|
|
1297
1317
|
}
|
|
1298
1318
|
}
|
|
1299
|
-
function ht(
|
|
1319
|
+
function ht(n) {
|
|
1300
1320
|
return async (e) => {
|
|
1301
|
-
const t = De(
|
|
1321
|
+
const t = De(n.providers, e);
|
|
1302
1322
|
if (t)
|
|
1303
1323
|
return t();
|
|
1304
1324
|
};
|
|
1305
1325
|
}
|
|
1306
1326
|
const ge = /* @__PURE__ */ new WeakMap();
|
|
1307
|
-
function Pe(
|
|
1308
|
-
let e = ge.get(
|
|
1309
|
-
return e || (e = new ft(
|
|
1327
|
+
function Pe(n) {
|
|
1328
|
+
let e = ge.get(n);
|
|
1329
|
+
return e || (e = new ft(n.modules, n), ge.set(n, e)), e;
|
|
1310
1330
|
}
|
|
1311
|
-
function Be(
|
|
1331
|
+
function Be(n) {
|
|
1312
1332
|
return {
|
|
1313
|
-
env:
|
|
1314
|
-
partner: new lt(
|
|
1315
|
-
getProvider: ht(
|
|
1333
|
+
env: n.env,
|
|
1334
|
+
partner: new lt(n.partner),
|
|
1335
|
+
getProvider: ht(n),
|
|
1316
1336
|
logger: void 0
|
|
1317
1337
|
};
|
|
1318
1338
|
}
|
|
1319
|
-
function
|
|
1320
|
-
const e = Be(
|
|
1339
|
+
function wn(n) {
|
|
1340
|
+
const e = Be(n), t = Pe(n), s = t.require("btc"), r = t.require("api");
|
|
1321
1341
|
return {
|
|
1322
1342
|
...e,
|
|
1323
|
-
btc:
|
|
1324
|
-
api:
|
|
1343
|
+
btc: s,
|
|
1344
|
+
api: r,
|
|
1325
1345
|
capabilities: t
|
|
1326
1346
|
};
|
|
1327
1347
|
}
|
|
1328
|
-
function
|
|
1329
|
-
const e = Be(
|
|
1348
|
+
function On(n) {
|
|
1349
|
+
const e = Be(n), s = Pe(n).require("evm");
|
|
1330
1350
|
return {
|
|
1331
1351
|
...e,
|
|
1332
|
-
evm:
|
|
1352
|
+
evm: s
|
|
1333
1353
|
};
|
|
1334
1354
|
}
|
|
1335
|
-
const
|
|
1355
|
+
const Rn = {
|
|
1336
1356
|
IDLE: "idle",
|
|
1337
1357
|
PREPARING: "preparing",
|
|
1338
1358
|
READY: "ready",
|
|
1339
1359
|
EXECUTING: "executing",
|
|
1340
1360
|
COMPLETED: "completed",
|
|
1341
1361
|
FAILED: "failed"
|
|
1342
|
-
},
|
|
1362
|
+
}, Ln = {
|
|
1343
1363
|
IDLE: "idle",
|
|
1344
1364
|
PENDING: "pending",
|
|
1345
1365
|
COMPLETE: "complete",
|
|
1346
1366
|
FAILED: "failed"
|
|
1347
1367
|
};
|
|
1348
1368
|
var x;
|
|
1349
|
-
(function(
|
|
1350
|
-
|
|
1369
|
+
(function(n) {
|
|
1370
|
+
n.assertEqual = (r) => {
|
|
1351
1371
|
};
|
|
1352
|
-
function e(
|
|
1372
|
+
function e(r) {
|
|
1353
1373
|
}
|
|
1354
|
-
|
|
1355
|
-
function t(
|
|
1374
|
+
n.assertIs = e;
|
|
1375
|
+
function t(r) {
|
|
1356
1376
|
throw new Error();
|
|
1357
1377
|
}
|
|
1358
|
-
|
|
1359
|
-
const
|
|
1360
|
-
for (const i of
|
|
1361
|
-
|
|
1362
|
-
return
|
|
1363
|
-
},
|
|
1364
|
-
const
|
|
1365
|
-
for (const c of
|
|
1366
|
-
i[c] =
|
|
1367
|
-
return
|
|
1368
|
-
},
|
|
1369
|
-
return a
|
|
1370
|
-
}),
|
|
1371
|
-
const
|
|
1372
|
-
for (const i in
|
|
1373
|
-
Object.prototype.hasOwnProperty.call(
|
|
1374
|
-
return
|
|
1375
|
-
},
|
|
1376
|
-
for (const i of
|
|
1377
|
-
if (
|
|
1378
|
+
n.assertNever = t, n.arrayToEnum = (r) => {
|
|
1379
|
+
const a = {};
|
|
1380
|
+
for (const i of r)
|
|
1381
|
+
a[i] = i;
|
|
1382
|
+
return a;
|
|
1383
|
+
}, n.getValidEnumValues = (r) => {
|
|
1384
|
+
const a = n.objectKeys(r).filter((c) => typeof r[r[c]] != "number"), i = {};
|
|
1385
|
+
for (const c of a)
|
|
1386
|
+
i[c] = r[c];
|
|
1387
|
+
return n.objectValues(i);
|
|
1388
|
+
}, n.objectValues = (r) => n.objectKeys(r).map(function(a) {
|
|
1389
|
+
return r[a];
|
|
1390
|
+
}), n.objectKeys = typeof Object.keys == "function" ? (r) => Object.keys(r) : (r) => {
|
|
1391
|
+
const a = [];
|
|
1392
|
+
for (const i in r)
|
|
1393
|
+
Object.prototype.hasOwnProperty.call(r, i) && a.push(i);
|
|
1394
|
+
return a;
|
|
1395
|
+
}, n.find = (r, a) => {
|
|
1396
|
+
for (const i of r)
|
|
1397
|
+
if (a(i))
|
|
1378
1398
|
return i;
|
|
1379
|
-
},
|
|
1380
|
-
function
|
|
1381
|
-
return
|
|
1399
|
+
}, n.isInteger = typeof Number.isInteger == "function" ? (r) => Number.isInteger(r) : (r) => typeof r == "number" && Number.isFinite(r) && Math.floor(r) === r;
|
|
1400
|
+
function s(r, a = " | ") {
|
|
1401
|
+
return r.map((i) => typeof i == "string" ? `'${i}'` : i).join(a);
|
|
1382
1402
|
}
|
|
1383
|
-
|
|
1403
|
+
n.joinValues = s, n.jsonStringifyReplacer = (r, a) => typeof a == "bigint" ? a.toString() : a;
|
|
1384
1404
|
})(x || (x = {}));
|
|
1385
1405
|
var ve;
|
|
1386
|
-
(function(
|
|
1387
|
-
|
|
1406
|
+
(function(n) {
|
|
1407
|
+
n.mergeShapes = (e, t) => ({
|
|
1388
1408
|
...e,
|
|
1389
1409
|
...t
|
|
1390
1410
|
// second overwrites first
|
|
@@ -1411,14 +1431,14 @@ const f = x.arrayToEnum([
|
|
|
1411
1431
|
"never",
|
|
1412
1432
|
"map",
|
|
1413
1433
|
"set"
|
|
1414
|
-
]), D = (
|
|
1415
|
-
switch (typeof
|
|
1434
|
+
]), D = (n) => {
|
|
1435
|
+
switch (typeof n) {
|
|
1416
1436
|
case "undefined":
|
|
1417
1437
|
return f.undefined;
|
|
1418
1438
|
case "string":
|
|
1419
1439
|
return f.string;
|
|
1420
1440
|
case "number":
|
|
1421
|
-
return Number.isNaN(
|
|
1441
|
+
return Number.isNaN(n) ? f.nan : f.number;
|
|
1422
1442
|
case "boolean":
|
|
1423
1443
|
return f.boolean;
|
|
1424
1444
|
case "function":
|
|
@@ -1428,7 +1448,7 @@ const f = x.arrayToEnum([
|
|
|
1428
1448
|
case "symbol":
|
|
1429
1449
|
return f.symbol;
|
|
1430
1450
|
case "object":
|
|
1431
|
-
return Array.isArray(
|
|
1451
|
+
return Array.isArray(n) ? f.array : n === null ? f.null : n.then && typeof n.then == "function" && n.catch && typeof n.catch == "function" ? f.promise : typeof Map < "u" && n instanceof Map ? f.map : typeof Set < "u" && n instanceof Set ? f.set : typeof Date < "u" && n instanceof Date ? f.date : f.object;
|
|
1432
1452
|
default:
|
|
1433
1453
|
return f.unknown;
|
|
1434
1454
|
}
|
|
@@ -1455,36 +1475,36 @@ class R extends Error {
|
|
|
1455
1475
|
return this.issues;
|
|
1456
1476
|
}
|
|
1457
1477
|
constructor(e) {
|
|
1458
|
-
super(), this.issues = [], this.addIssue = (
|
|
1459
|
-
this.issues = [...this.issues,
|
|
1460
|
-
}, this.addIssues = (
|
|
1461
|
-
this.issues = [...this.issues, ...
|
|
1478
|
+
super(), this.issues = [], this.addIssue = (s) => {
|
|
1479
|
+
this.issues = [...this.issues, s];
|
|
1480
|
+
}, this.addIssues = (s = []) => {
|
|
1481
|
+
this.issues = [...this.issues, ...s];
|
|
1462
1482
|
};
|
|
1463
1483
|
const t = new.target.prototype;
|
|
1464
1484
|
Object.setPrototypeOf ? Object.setPrototypeOf(this, t) : this.__proto__ = t, this.name = "ZodError", this.issues = e;
|
|
1465
1485
|
}
|
|
1466
1486
|
format(e) {
|
|
1467
|
-
const t = e || function(
|
|
1468
|
-
return
|
|
1469
|
-
},
|
|
1470
|
-
for (const i of
|
|
1487
|
+
const t = e || function(a) {
|
|
1488
|
+
return a.message;
|
|
1489
|
+
}, s = { _errors: [] }, r = (a) => {
|
|
1490
|
+
for (const i of a.issues)
|
|
1471
1491
|
if (i.code === "invalid_union")
|
|
1472
|
-
i.unionErrors.map(
|
|
1492
|
+
i.unionErrors.map(r);
|
|
1473
1493
|
else if (i.code === "invalid_return_type")
|
|
1474
|
-
|
|
1494
|
+
r(i.returnTypeError);
|
|
1475
1495
|
else if (i.code === "invalid_arguments")
|
|
1476
|
-
|
|
1496
|
+
r(i.argumentsError);
|
|
1477
1497
|
else if (i.path.length === 0)
|
|
1478
|
-
|
|
1498
|
+
s._errors.push(t(i));
|
|
1479
1499
|
else {
|
|
1480
|
-
let c =
|
|
1500
|
+
let c = s, u = 0;
|
|
1481
1501
|
for (; u < i.path.length; ) {
|
|
1482
1502
|
const h = i.path[u];
|
|
1483
1503
|
u === i.path.length - 1 ? (c[h] = c[h] || { _errors: [] }, c[h]._errors.push(t(i))) : c[h] = c[h] || { _errors: [] }, c = c[h], u++;
|
|
1484
1504
|
}
|
|
1485
1505
|
}
|
|
1486
1506
|
};
|
|
1487
|
-
return
|
|
1507
|
+
return r(this), s;
|
|
1488
1508
|
}
|
|
1489
1509
|
static assert(e) {
|
|
1490
1510
|
if (!(e instanceof R))
|
|
@@ -1500,40 +1520,40 @@ class R extends Error {
|
|
|
1500
1520
|
return this.issues.length === 0;
|
|
1501
1521
|
}
|
|
1502
1522
|
flatten(e = (t) => t.message) {
|
|
1503
|
-
const t = {},
|
|
1504
|
-
for (const
|
|
1505
|
-
if (
|
|
1506
|
-
const
|
|
1507
|
-
t[
|
|
1523
|
+
const t = {}, s = [];
|
|
1524
|
+
for (const r of this.issues)
|
|
1525
|
+
if (r.path.length > 0) {
|
|
1526
|
+
const a = r.path[0];
|
|
1527
|
+
t[a] = t[a] || [], t[a].push(e(r));
|
|
1508
1528
|
} else
|
|
1509
|
-
|
|
1510
|
-
return { formErrors:
|
|
1529
|
+
s.push(e(r));
|
|
1530
|
+
return { formErrors: s, fieldErrors: t };
|
|
1511
1531
|
}
|
|
1512
1532
|
get formErrors() {
|
|
1513
1533
|
return this.flatten();
|
|
1514
1534
|
}
|
|
1515
1535
|
}
|
|
1516
|
-
R.create = (
|
|
1517
|
-
const ce = (
|
|
1536
|
+
R.create = (n) => new R(n);
|
|
1537
|
+
const ce = (n, e) => {
|
|
1518
1538
|
let t;
|
|
1519
|
-
switch (
|
|
1539
|
+
switch (n.code) {
|
|
1520
1540
|
case d.invalid_type:
|
|
1521
|
-
|
|
1541
|
+
n.received === f.undefined ? t = "Required" : t = `Expected ${n.expected}, received ${n.received}`;
|
|
1522
1542
|
break;
|
|
1523
1543
|
case d.invalid_literal:
|
|
1524
|
-
t = `Invalid literal value, expected ${JSON.stringify(
|
|
1544
|
+
t = `Invalid literal value, expected ${JSON.stringify(n.expected, x.jsonStringifyReplacer)}`;
|
|
1525
1545
|
break;
|
|
1526
1546
|
case d.unrecognized_keys:
|
|
1527
|
-
t = `Unrecognized key(s) in object: ${x.joinValues(
|
|
1547
|
+
t = `Unrecognized key(s) in object: ${x.joinValues(n.keys, ", ")}`;
|
|
1528
1548
|
break;
|
|
1529
1549
|
case d.invalid_union:
|
|
1530
1550
|
t = "Invalid input";
|
|
1531
1551
|
break;
|
|
1532
1552
|
case d.invalid_union_discriminator:
|
|
1533
|
-
t = `Invalid discriminator value. Expected ${x.joinValues(
|
|
1553
|
+
t = `Invalid discriminator value. Expected ${x.joinValues(n.options)}`;
|
|
1534
1554
|
break;
|
|
1535
1555
|
case d.invalid_enum_value:
|
|
1536
|
-
t = `Invalid enum value. Expected ${x.joinValues(
|
|
1556
|
+
t = `Invalid enum value. Expected ${x.joinValues(n.options)}, received '${n.received}'`;
|
|
1537
1557
|
break;
|
|
1538
1558
|
case d.invalid_arguments:
|
|
1539
1559
|
t = "Invalid function arguments";
|
|
@@ -1545,13 +1565,13 @@ const ce = (s, e) => {
|
|
|
1545
1565
|
t = "Invalid date";
|
|
1546
1566
|
break;
|
|
1547
1567
|
case d.invalid_string:
|
|
1548
|
-
typeof
|
|
1568
|
+
typeof n.validation == "object" ? "includes" in n.validation ? (t = `Invalid input: must include "${n.validation.includes}"`, typeof n.validation.position == "number" && (t = `${t} at one or more positions greater than or equal to ${n.validation.position}`)) : "startsWith" in n.validation ? t = `Invalid input: must start with "${n.validation.startsWith}"` : "endsWith" in n.validation ? t = `Invalid input: must end with "${n.validation.endsWith}"` : x.assertNever(n.validation) : n.validation !== "regex" ? t = `Invalid ${n.validation}` : t = "Invalid";
|
|
1549
1569
|
break;
|
|
1550
1570
|
case d.too_small:
|
|
1551
|
-
|
|
1571
|
+
n.type === "array" ? t = `Array must contain ${n.exact ? "exactly" : n.inclusive ? "at least" : "more than"} ${n.minimum} element(s)` : n.type === "string" ? t = `String must contain ${n.exact ? "exactly" : n.inclusive ? "at least" : "over"} ${n.minimum} character(s)` : n.type === "number" ? t = `Number must be ${n.exact ? "exactly equal to " : n.inclusive ? "greater than or equal to " : "greater than "}${n.minimum}` : n.type === "bigint" ? t = `Number must be ${n.exact ? "exactly equal to " : n.inclusive ? "greater than or equal to " : "greater than "}${n.minimum}` : n.type === "date" ? t = `Date must be ${n.exact ? "exactly equal to " : n.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(n.minimum))}` : t = "Invalid input";
|
|
1552
1572
|
break;
|
|
1553
1573
|
case d.too_big:
|
|
1554
|
-
|
|
1574
|
+
n.type === "array" ? t = `Array must contain ${n.exact ? "exactly" : n.inclusive ? "at most" : "less than"} ${n.maximum} element(s)` : n.type === "string" ? t = `String must contain ${n.exact ? "exactly" : n.inclusive ? "at most" : "under"} ${n.maximum} character(s)` : n.type === "number" ? t = `Number must be ${n.exact ? "exactly" : n.inclusive ? "less than or equal to" : "less than"} ${n.maximum}` : n.type === "bigint" ? t = `BigInt must be ${n.exact ? "exactly" : n.inclusive ? "less than or equal to" : "less than"} ${n.maximum}` : n.type === "date" ? t = `Date must be ${n.exact ? "exactly" : n.inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(Number(n.maximum))}` : t = "Invalid input";
|
|
1555
1575
|
break;
|
|
1556
1576
|
case d.custom:
|
|
1557
1577
|
t = "Invalid input";
|
|
@@ -1560,13 +1580,13 @@ const ce = (s, e) => {
|
|
|
1560
1580
|
t = "Intersection results could not be merged";
|
|
1561
1581
|
break;
|
|
1562
1582
|
case d.not_multiple_of:
|
|
1563
|
-
t = `Number must be a multiple of ${
|
|
1583
|
+
t = `Number must be a multiple of ${n.multipleOf}`;
|
|
1564
1584
|
break;
|
|
1565
1585
|
case d.not_finite:
|
|
1566
1586
|
t = "Number must be finite";
|
|
1567
1587
|
break;
|
|
1568
1588
|
default:
|
|
1569
|
-
t = e.defaultError, x.assertNever(
|
|
1589
|
+
t = e.defaultError, x.assertNever(n);
|
|
1570
1590
|
}
|
|
1571
1591
|
return { message: t };
|
|
1572
1592
|
};
|
|
@@ -1574,44 +1594,44 @@ let mt = ce;
|
|
|
1574
1594
|
function pt() {
|
|
1575
1595
|
return mt;
|
|
1576
1596
|
}
|
|
1577
|
-
const gt = (
|
|
1578
|
-
const { data: e, path: t, errorMaps:
|
|
1579
|
-
...
|
|
1580
|
-
path:
|
|
1597
|
+
const gt = (n) => {
|
|
1598
|
+
const { data: e, path: t, errorMaps: s, issueData: r } = n, a = [...t, ...r.path || []], i = {
|
|
1599
|
+
...r,
|
|
1600
|
+
path: a
|
|
1581
1601
|
};
|
|
1582
|
-
if (
|
|
1602
|
+
if (r.message !== void 0)
|
|
1583
1603
|
return {
|
|
1584
|
-
...
|
|
1585
|
-
path:
|
|
1586
|
-
message:
|
|
1604
|
+
...r,
|
|
1605
|
+
path: a,
|
|
1606
|
+
message: r.message
|
|
1587
1607
|
};
|
|
1588
1608
|
let c = "";
|
|
1589
|
-
const u =
|
|
1609
|
+
const u = s.filter((h) => !!h).slice().reverse();
|
|
1590
1610
|
for (const h of u)
|
|
1591
1611
|
c = h(i, { data: e, defaultError: c }).message;
|
|
1592
1612
|
return {
|
|
1593
|
-
...
|
|
1594
|
-
path:
|
|
1613
|
+
...r,
|
|
1614
|
+
path: a,
|
|
1595
1615
|
message: c
|
|
1596
1616
|
};
|
|
1597
1617
|
};
|
|
1598
|
-
function l(
|
|
1599
|
-
const t = pt(),
|
|
1618
|
+
function l(n, e) {
|
|
1619
|
+
const t = pt(), s = gt({
|
|
1600
1620
|
issueData: e,
|
|
1601
|
-
data:
|
|
1602
|
-
path:
|
|
1621
|
+
data: n.data,
|
|
1622
|
+
path: n.path,
|
|
1603
1623
|
errorMaps: [
|
|
1604
|
-
|
|
1624
|
+
n.common.contextualErrorMap,
|
|
1605
1625
|
// contextual error map is first priority
|
|
1606
|
-
|
|
1626
|
+
n.schemaErrorMap,
|
|
1607
1627
|
// then schema-bound map if available
|
|
1608
1628
|
t,
|
|
1609
1629
|
// then global override map
|
|
1610
1630
|
t === ce ? void 0 : ce
|
|
1611
1631
|
// then global default map
|
|
1612
|
-
].filter((
|
|
1632
|
+
].filter((r) => !!r)
|
|
1613
1633
|
});
|
|
1614
|
-
|
|
1634
|
+
n.common.issues.push(s);
|
|
1615
1635
|
}
|
|
1616
1636
|
class k {
|
|
1617
1637
|
constructor() {
|
|
@@ -1624,76 +1644,76 @@ class k {
|
|
|
1624
1644
|
this.value !== "aborted" && (this.value = "aborted");
|
|
1625
1645
|
}
|
|
1626
1646
|
static mergeArray(e, t) {
|
|
1627
|
-
const
|
|
1628
|
-
for (const
|
|
1629
|
-
if (
|
|
1647
|
+
const s = [];
|
|
1648
|
+
for (const r of t) {
|
|
1649
|
+
if (r.status === "aborted")
|
|
1630
1650
|
return g;
|
|
1631
|
-
|
|
1651
|
+
r.status === "dirty" && e.dirty(), s.push(r.value);
|
|
1632
1652
|
}
|
|
1633
|
-
return { status: e.value, value:
|
|
1653
|
+
return { status: e.value, value: s };
|
|
1634
1654
|
}
|
|
1635
1655
|
static async mergeObjectAsync(e, t) {
|
|
1636
|
-
const
|
|
1637
|
-
for (const
|
|
1638
|
-
const
|
|
1639
|
-
|
|
1640
|
-
key:
|
|
1656
|
+
const s = [];
|
|
1657
|
+
for (const r of t) {
|
|
1658
|
+
const a = await r.key, i = await r.value;
|
|
1659
|
+
s.push({
|
|
1660
|
+
key: a,
|
|
1641
1661
|
value: i
|
|
1642
1662
|
});
|
|
1643
1663
|
}
|
|
1644
|
-
return k.mergeObjectSync(e,
|
|
1664
|
+
return k.mergeObjectSync(e, s);
|
|
1645
1665
|
}
|
|
1646
1666
|
static mergeObjectSync(e, t) {
|
|
1647
|
-
const
|
|
1648
|
-
for (const
|
|
1649
|
-
const { key:
|
|
1650
|
-
if (
|
|
1667
|
+
const s = {};
|
|
1668
|
+
for (const r of t) {
|
|
1669
|
+
const { key: a, value: i } = r;
|
|
1670
|
+
if (a.status === "aborted" || i.status === "aborted")
|
|
1651
1671
|
return g;
|
|
1652
|
-
|
|
1672
|
+
a.status === "dirty" && e.dirty(), i.status === "dirty" && e.dirty(), a.value !== "__proto__" && (typeof i.value < "u" || r.alwaysSet) && (s[a.value] = i.value);
|
|
1653
1673
|
}
|
|
1654
|
-
return { status: e.value, value:
|
|
1674
|
+
return { status: e.value, value: s };
|
|
1655
1675
|
}
|
|
1656
1676
|
}
|
|
1657
1677
|
const g = Object.freeze({
|
|
1658
1678
|
status: "aborted"
|
|
1659
|
-
}), J = (
|
|
1679
|
+
}), J = (n) => ({ status: "dirty", value: n }), C = (n) => ({ status: "valid", value: n }), ye = (n) => n.status === "aborted", _e = (n) => n.status === "dirty", H = (n) => n.status === "valid", ee = (n) => typeof Promise < "u" && n instanceof Promise;
|
|
1660
1680
|
var m;
|
|
1661
|
-
(function(
|
|
1662
|
-
|
|
1681
|
+
(function(n) {
|
|
1682
|
+
n.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, n.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
|
|
1663
1683
|
})(m || (m = {}));
|
|
1664
1684
|
class M {
|
|
1665
|
-
constructor(e, t,
|
|
1666
|
-
this._cachedPath = [], this.parent = e, this.data = t, this._path =
|
|
1685
|
+
constructor(e, t, s, r) {
|
|
1686
|
+
this._cachedPath = [], this.parent = e, this.data = t, this._path = s, this._key = r;
|
|
1667
1687
|
}
|
|
1668
1688
|
get path() {
|
|
1669
1689
|
return this._cachedPath.length || (Array.isArray(this._key) ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
|
|
1670
1690
|
}
|
|
1671
1691
|
}
|
|
1672
|
-
const Ae = (
|
|
1673
|
-
if (
|
|
1692
|
+
const Ae = (n, e) => {
|
|
1693
|
+
if (H(e))
|
|
1674
1694
|
return { success: !0, data: e.value };
|
|
1675
|
-
if (!
|
|
1695
|
+
if (!n.common.issues.length)
|
|
1676
1696
|
throw new Error("Validation failed but no issues detected.");
|
|
1677
1697
|
return {
|
|
1678
1698
|
success: !1,
|
|
1679
1699
|
get error() {
|
|
1680
1700
|
if (this._error)
|
|
1681
1701
|
return this._error;
|
|
1682
|
-
const t = new R(
|
|
1702
|
+
const t = new R(n.common.issues);
|
|
1683
1703
|
return this._error = t, this._error;
|
|
1684
1704
|
}
|
|
1685
1705
|
};
|
|
1686
1706
|
};
|
|
1687
|
-
function
|
|
1688
|
-
if (!
|
|
1707
|
+
function A(n) {
|
|
1708
|
+
if (!n)
|
|
1689
1709
|
return {};
|
|
1690
|
-
const { errorMap: e, invalid_type_error: t, required_error:
|
|
1691
|
-
if (e && (t ||
|
|
1710
|
+
const { errorMap: e, invalid_type_error: t, required_error: s, description: r } = n;
|
|
1711
|
+
if (e && (t || s))
|
|
1692
1712
|
throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
|
|
1693
|
-
return e ? { errorMap: e, description:
|
|
1694
|
-
const { message: u } =
|
|
1695
|
-
return i.code === "invalid_enum_value" ? { message: u ?? c.defaultError } : typeof c.data > "u" ? { message: u ??
|
|
1696
|
-
}, description:
|
|
1713
|
+
return e ? { errorMap: e, description: r } : { errorMap: (i, c) => {
|
|
1714
|
+
const { message: u } = n;
|
|
1715
|
+
return i.code === "invalid_enum_value" ? { message: u ?? c.defaultError } : typeof c.data > "u" ? { message: u ?? s ?? c.defaultError } : i.code !== "invalid_type" ? { message: c.defaultError } : { message: u ?? t ?? c.defaultError };
|
|
1716
|
+
}, description: r };
|
|
1697
1717
|
}
|
|
1698
1718
|
class b {
|
|
1699
1719
|
get description() {
|
|
@@ -1736,13 +1756,13 @@ class b {
|
|
|
1736
1756
|
return Promise.resolve(t);
|
|
1737
1757
|
}
|
|
1738
1758
|
parse(e, t) {
|
|
1739
|
-
const
|
|
1740
|
-
if (
|
|
1741
|
-
return
|
|
1742
|
-
throw
|
|
1759
|
+
const s = this.safeParse(e, t);
|
|
1760
|
+
if (s.success)
|
|
1761
|
+
return s.data;
|
|
1762
|
+
throw s.error;
|
|
1743
1763
|
}
|
|
1744
1764
|
safeParse(e, t) {
|
|
1745
|
-
const
|
|
1765
|
+
const s = {
|
|
1746
1766
|
common: {
|
|
1747
1767
|
issues: [],
|
|
1748
1768
|
async: (t == null ? void 0 : t.async) ?? !1,
|
|
@@ -1753,11 +1773,11 @@ class b {
|
|
|
1753
1773
|
parent: null,
|
|
1754
1774
|
data: e,
|
|
1755
1775
|
parsedType: D(e)
|
|
1756
|
-
},
|
|
1757
|
-
return Ae(
|
|
1776
|
+
}, r = this._parseSync({ data: e, path: s.path, parent: s });
|
|
1777
|
+
return Ae(s, r);
|
|
1758
1778
|
}
|
|
1759
1779
|
"~validate"(e) {
|
|
1760
|
-
var
|
|
1780
|
+
var s, r;
|
|
1761
1781
|
const t = {
|
|
1762
1782
|
common: {
|
|
1763
1783
|
issues: [],
|
|
@@ -1771,32 +1791,32 @@ class b {
|
|
|
1771
1791
|
};
|
|
1772
1792
|
if (!this["~standard"].async)
|
|
1773
1793
|
try {
|
|
1774
|
-
const
|
|
1775
|
-
return
|
|
1776
|
-
value:
|
|
1794
|
+
const a = this._parseSync({ data: e, path: [], parent: t });
|
|
1795
|
+
return H(a) ? {
|
|
1796
|
+
value: a.value
|
|
1777
1797
|
} : {
|
|
1778
1798
|
issues: t.common.issues
|
|
1779
1799
|
};
|
|
1780
|
-
} catch (
|
|
1781
|
-
(
|
|
1800
|
+
} catch (a) {
|
|
1801
|
+
(r = (s = a == null ? void 0 : a.message) == null ? void 0 : s.toLowerCase()) != null && r.includes("encountered") && (this["~standard"].async = !0), t.common = {
|
|
1782
1802
|
issues: [],
|
|
1783
1803
|
async: !0
|
|
1784
1804
|
};
|
|
1785
1805
|
}
|
|
1786
|
-
return this._parseAsync({ data: e, path: [], parent: t }).then((
|
|
1787
|
-
value:
|
|
1806
|
+
return this._parseAsync({ data: e, path: [], parent: t }).then((a) => H(a) ? {
|
|
1807
|
+
value: a.value
|
|
1788
1808
|
} : {
|
|
1789
1809
|
issues: t.common.issues
|
|
1790
1810
|
});
|
|
1791
1811
|
}
|
|
1792
1812
|
async parseAsync(e, t) {
|
|
1793
|
-
const
|
|
1794
|
-
if (
|
|
1795
|
-
return
|
|
1796
|
-
throw
|
|
1813
|
+
const s = await this.safeParseAsync(e, t);
|
|
1814
|
+
if (s.success)
|
|
1815
|
+
return s.data;
|
|
1816
|
+
throw s.error;
|
|
1797
1817
|
}
|
|
1798
1818
|
async safeParseAsync(e, t) {
|
|
1799
|
-
const
|
|
1819
|
+
const s = {
|
|
1800
1820
|
common: {
|
|
1801
1821
|
issues: [],
|
|
1802
1822
|
contextualErrorMap: t == null ? void 0 : t.errorMap,
|
|
@@ -1807,24 +1827,24 @@ class b {
|
|
|
1807
1827
|
parent: null,
|
|
1808
1828
|
data: e,
|
|
1809
1829
|
parsedType: D(e)
|
|
1810
|
-
},
|
|
1811
|
-
return Ae(
|
|
1830
|
+
}, r = this._parse({ data: e, path: s.path, parent: s }), a = await (ee(r) ? r : Promise.resolve(r));
|
|
1831
|
+
return Ae(s, a);
|
|
1812
1832
|
}
|
|
1813
1833
|
refine(e, t) {
|
|
1814
|
-
const
|
|
1815
|
-
return this._refinement((
|
|
1816
|
-
const i = e(
|
|
1834
|
+
const s = (r) => typeof t == "string" || typeof t > "u" ? { message: t } : typeof t == "function" ? t(r) : t;
|
|
1835
|
+
return this._refinement((r, a) => {
|
|
1836
|
+
const i = e(r), c = () => a.addIssue({
|
|
1817
1837
|
code: d.custom,
|
|
1818
|
-
...
|
|
1838
|
+
...s(r)
|
|
1819
1839
|
});
|
|
1820
1840
|
return typeof Promise < "u" && i instanceof Promise ? i.then((u) => u ? !0 : (c(), !1)) : i ? !0 : (c(), !1);
|
|
1821
1841
|
});
|
|
1822
1842
|
}
|
|
1823
1843
|
refinement(e, t) {
|
|
1824
|
-
return this._refinement((
|
|
1844
|
+
return this._refinement((s, r) => e(s) ? !0 : (r.addIssue(typeof t == "function" ? t(s, r) : t), !1));
|
|
1825
1845
|
}
|
|
1826
1846
|
_refinement(e) {
|
|
1827
|
-
return new
|
|
1847
|
+
return new G({
|
|
1828
1848
|
schema: this,
|
|
1829
1849
|
typeName: v.ZodEffects,
|
|
1830
1850
|
effect: { type: "refinement", refinement: e }
|
|
@@ -1844,7 +1864,7 @@ class b {
|
|
|
1844
1864
|
return B.create(this, this._def);
|
|
1845
1865
|
}
|
|
1846
1866
|
nullable() {
|
|
1847
|
-
return
|
|
1867
|
+
return K.create(this, this._def);
|
|
1848
1868
|
}
|
|
1849
1869
|
nullish() {
|
|
1850
1870
|
return this.nullable().optional();
|
|
@@ -1853,17 +1873,17 @@ class b {
|
|
|
1853
1873
|
return O.create(this);
|
|
1854
1874
|
}
|
|
1855
1875
|
promise() {
|
|
1856
|
-
return
|
|
1876
|
+
return re.create(this, this._def);
|
|
1857
1877
|
}
|
|
1858
1878
|
or(e) {
|
|
1859
|
-
return
|
|
1879
|
+
return ne.create([this, e], this._def);
|
|
1860
1880
|
}
|
|
1861
1881
|
and(e) {
|
|
1862
|
-
return
|
|
1882
|
+
return se.create(this, e, this._def);
|
|
1863
1883
|
}
|
|
1864
1884
|
transform(e) {
|
|
1865
|
-
return new
|
|
1866
|
-
...
|
|
1885
|
+
return new G({
|
|
1886
|
+
...A(this._def),
|
|
1867
1887
|
schema: this,
|
|
1868
1888
|
typeName: v.ZodEffects,
|
|
1869
1889
|
effect: { type: "transform", transform: e }
|
|
@@ -1872,23 +1892,23 @@ class b {
|
|
|
1872
1892
|
default(e) {
|
|
1873
1893
|
const t = typeof e == "function" ? e : () => e;
|
|
1874
1894
|
return new de({
|
|
1875
|
-
...
|
|
1895
|
+
...A(this._def),
|
|
1876
1896
|
innerType: this,
|
|
1877
1897
|
defaultValue: t,
|
|
1878
1898
|
typeName: v.ZodDefault
|
|
1879
1899
|
});
|
|
1880
1900
|
}
|
|
1881
1901
|
brand() {
|
|
1882
|
-
return new
|
|
1902
|
+
return new Ut({
|
|
1883
1903
|
typeName: v.ZodBranded,
|
|
1884
1904
|
type: this,
|
|
1885
|
-
...
|
|
1905
|
+
...A(this._def)
|
|
1886
1906
|
});
|
|
1887
1907
|
}
|
|
1888
1908
|
catch(e) {
|
|
1889
1909
|
const t = typeof e == "function" ? e : () => e;
|
|
1890
1910
|
return new ue({
|
|
1891
|
-
...
|
|
1911
|
+
...A(this._def),
|
|
1892
1912
|
innerType: this,
|
|
1893
1913
|
catchValue: t,
|
|
1894
1914
|
typeName: v.ZodCatch
|
|
@@ -1914,202 +1934,202 @@ class b {
|
|
|
1914
1934
|
return this.safeParse(null).success;
|
|
1915
1935
|
}
|
|
1916
1936
|
}
|
|
1917
|
-
const vt = /^c[^\s-]{8,}$/i, yt = /^[0-9a-z]+$/, _t = /^[0-9A-HJKMNP-TV-Z]{26}$/i, At = /^[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, Tt = /^[a-z0-9_-]{21}$/i, Et = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, bt = /^[-+]?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)?)??$/, xt = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,
|
|
1918
|
-
let
|
|
1919
|
-
const
|
|
1920
|
-
function
|
|
1937
|
+
const vt = /^c[^\s-]{8,}$/i, yt = /^[0-9a-z]+$/, _t = /^[0-9A-HJKMNP-TV-Z]{26}$/i, At = /^[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, Tt = /^[a-z0-9_-]{21}$/i, Et = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, bt = /^[-+]?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)?)??$/, xt = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, Nt = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
1938
|
+
let ae;
|
|
1939
|
+
const St = /^(?:(?: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])$/, It = /^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/, kt = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, Ct = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, wt = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Ot = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, Me = "((\\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])))", Rt = new RegExp(`^${Me}$`);
|
|
1940
|
+
function Ve(n) {
|
|
1921
1941
|
let e = "[0-5]\\d";
|
|
1922
|
-
|
|
1923
|
-
const t =
|
|
1942
|
+
n.precision ? e = `${e}\\.\\d{${n.precision}}` : n.precision == null && (e = `${e}(\\.\\d+)?`);
|
|
1943
|
+
const t = n.precision ? "+" : "?";
|
|
1924
1944
|
return `([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`;
|
|
1925
1945
|
}
|
|
1926
|
-
function Lt(
|
|
1927
|
-
return new RegExp(`^${
|
|
1946
|
+
function Lt(n) {
|
|
1947
|
+
return new RegExp(`^${Ve(n)}$`);
|
|
1928
1948
|
}
|
|
1929
|
-
function Dt(
|
|
1930
|
-
let e = `${Me}T${
|
|
1949
|
+
function Dt(n) {
|
|
1950
|
+
let e = `${Me}T${Ve(n)}`;
|
|
1931
1951
|
const t = [];
|
|
1932
|
-
return t.push(
|
|
1952
|
+
return t.push(n.local ? "Z?" : "Z"), n.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
|
|
1933
1953
|
}
|
|
1934
|
-
function Pt(
|
|
1935
|
-
return !!((e === "v4" || !e) &&
|
|
1954
|
+
function Pt(n, e) {
|
|
1955
|
+
return !!((e === "v4" || !e) && St.test(n) || (e === "v6" || !e) && kt.test(n));
|
|
1936
1956
|
}
|
|
1937
|
-
function Bt(
|
|
1938
|
-
if (!Et.test(
|
|
1957
|
+
function Bt(n, e) {
|
|
1958
|
+
if (!Et.test(n))
|
|
1939
1959
|
return !1;
|
|
1940
1960
|
try {
|
|
1941
|
-
const [t] =
|
|
1961
|
+
const [t] = n.split(".");
|
|
1942
1962
|
if (!t)
|
|
1943
1963
|
return !1;
|
|
1944
|
-
const
|
|
1945
|
-
return !(typeof
|
|
1964
|
+
const s = t.replace(/-/g, "+").replace(/_/g, "/").padEnd(t.length + (4 - t.length % 4) % 4, "="), r = JSON.parse(atob(s));
|
|
1965
|
+
return !(typeof r != "object" || r === null || "typ" in r && (r == null ? void 0 : r.typ) !== "JWT" || !r.alg || e && r.alg !== e);
|
|
1946
1966
|
} catch {
|
|
1947
1967
|
return !1;
|
|
1948
1968
|
}
|
|
1949
1969
|
}
|
|
1950
|
-
function Mt(
|
|
1951
|
-
return !!((e === "v4" || !e) && It.test(
|
|
1970
|
+
function Mt(n, e) {
|
|
1971
|
+
return !!((e === "v4" || !e) && It.test(n) || (e === "v6" || !e) && Ct.test(n));
|
|
1952
1972
|
}
|
|
1953
1973
|
class P extends b {
|
|
1954
1974
|
_parse(e) {
|
|
1955
1975
|
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== f.string) {
|
|
1956
|
-
const
|
|
1957
|
-
return l(
|
|
1976
|
+
const a = this._getOrReturnCtx(e);
|
|
1977
|
+
return l(a, {
|
|
1958
1978
|
code: d.invalid_type,
|
|
1959
1979
|
expected: f.string,
|
|
1960
|
-
received:
|
|
1980
|
+
received: a.parsedType
|
|
1961
1981
|
}), g;
|
|
1962
1982
|
}
|
|
1963
|
-
const
|
|
1964
|
-
let
|
|
1965
|
-
for (const
|
|
1966
|
-
if (
|
|
1967
|
-
e.data.length <
|
|
1983
|
+
const s = new k();
|
|
1984
|
+
let r;
|
|
1985
|
+
for (const a of this._def.checks)
|
|
1986
|
+
if (a.kind === "min")
|
|
1987
|
+
e.data.length < a.value && (r = this._getOrReturnCtx(e, r), l(r, {
|
|
1968
1988
|
code: d.too_small,
|
|
1969
|
-
minimum:
|
|
1989
|
+
minimum: a.value,
|
|
1970
1990
|
type: "string",
|
|
1971
1991
|
inclusive: !0,
|
|
1972
1992
|
exact: !1,
|
|
1973
|
-
message:
|
|
1974
|
-
}),
|
|
1975
|
-
else if (
|
|
1976
|
-
e.data.length >
|
|
1993
|
+
message: a.message
|
|
1994
|
+
}), s.dirty());
|
|
1995
|
+
else if (a.kind === "max")
|
|
1996
|
+
e.data.length > a.value && (r = this._getOrReturnCtx(e, r), l(r, {
|
|
1977
1997
|
code: d.too_big,
|
|
1978
|
-
maximum:
|
|
1998
|
+
maximum: a.value,
|
|
1979
1999
|
type: "string",
|
|
1980
2000
|
inclusive: !0,
|
|
1981
2001
|
exact: !1,
|
|
1982
|
-
message:
|
|
1983
|
-
}),
|
|
1984
|
-
else if (
|
|
1985
|
-
const i = e.data.length >
|
|
1986
|
-
(i || c) && (
|
|
2002
|
+
message: a.message
|
|
2003
|
+
}), s.dirty());
|
|
2004
|
+
else if (a.kind === "length") {
|
|
2005
|
+
const i = e.data.length > a.value, c = e.data.length < a.value;
|
|
2006
|
+
(i || c) && (r = this._getOrReturnCtx(e, r), i ? l(r, {
|
|
1987
2007
|
code: d.too_big,
|
|
1988
|
-
maximum:
|
|
2008
|
+
maximum: a.value,
|
|
1989
2009
|
type: "string",
|
|
1990
2010
|
inclusive: !0,
|
|
1991
2011
|
exact: !0,
|
|
1992
|
-
message:
|
|
1993
|
-
}) : c && l(
|
|
2012
|
+
message: a.message
|
|
2013
|
+
}) : c && l(r, {
|
|
1994
2014
|
code: d.too_small,
|
|
1995
|
-
minimum:
|
|
2015
|
+
minimum: a.value,
|
|
1996
2016
|
type: "string",
|
|
1997
2017
|
inclusive: !0,
|
|
1998
2018
|
exact: !0,
|
|
1999
|
-
message:
|
|
2000
|
-
}),
|
|
2001
|
-
} else if (
|
|
2002
|
-
xt.test(e.data) || (
|
|
2019
|
+
message: a.message
|
|
2020
|
+
}), s.dirty());
|
|
2021
|
+
} else if (a.kind === "email")
|
|
2022
|
+
xt.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
|
|
2003
2023
|
validation: "email",
|
|
2004
2024
|
code: d.invalid_string,
|
|
2005
|
-
message:
|
|
2006
|
-
}),
|
|
2007
|
-
else if (
|
|
2008
|
-
|
|
2025
|
+
message: a.message
|
|
2026
|
+
}), s.dirty());
|
|
2027
|
+
else if (a.kind === "emoji")
|
|
2028
|
+
ae || (ae = new RegExp(Nt, "u")), ae.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
|
|
2009
2029
|
validation: "emoji",
|
|
2010
2030
|
code: d.invalid_string,
|
|
2011
|
-
message:
|
|
2012
|
-
}),
|
|
2013
|
-
else if (
|
|
2014
|
-
At.test(e.data) || (
|
|
2031
|
+
message: a.message
|
|
2032
|
+
}), s.dirty());
|
|
2033
|
+
else if (a.kind === "uuid")
|
|
2034
|
+
At.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
|
|
2015
2035
|
validation: "uuid",
|
|
2016
2036
|
code: d.invalid_string,
|
|
2017
|
-
message:
|
|
2018
|
-
}),
|
|
2019
|
-
else if (
|
|
2020
|
-
Tt.test(e.data) || (
|
|
2037
|
+
message: a.message
|
|
2038
|
+
}), s.dirty());
|
|
2039
|
+
else if (a.kind === "nanoid")
|
|
2040
|
+
Tt.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
|
|
2021
2041
|
validation: "nanoid",
|
|
2022
2042
|
code: d.invalid_string,
|
|
2023
|
-
message:
|
|
2024
|
-
}),
|
|
2025
|
-
else if (
|
|
2026
|
-
vt.test(e.data) || (
|
|
2043
|
+
message: a.message
|
|
2044
|
+
}), s.dirty());
|
|
2045
|
+
else if (a.kind === "cuid")
|
|
2046
|
+
vt.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
|
|
2027
2047
|
validation: "cuid",
|
|
2028
2048
|
code: d.invalid_string,
|
|
2029
|
-
message:
|
|
2030
|
-
}),
|
|
2031
|
-
else if (
|
|
2032
|
-
yt.test(e.data) || (
|
|
2049
|
+
message: a.message
|
|
2050
|
+
}), s.dirty());
|
|
2051
|
+
else if (a.kind === "cuid2")
|
|
2052
|
+
yt.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
|
|
2033
2053
|
validation: "cuid2",
|
|
2034
2054
|
code: d.invalid_string,
|
|
2035
|
-
message:
|
|
2036
|
-
}),
|
|
2037
|
-
else if (
|
|
2038
|
-
_t.test(e.data) || (
|
|
2055
|
+
message: a.message
|
|
2056
|
+
}), s.dirty());
|
|
2057
|
+
else if (a.kind === "ulid")
|
|
2058
|
+
_t.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
|
|
2039
2059
|
validation: "ulid",
|
|
2040
2060
|
code: d.invalid_string,
|
|
2041
|
-
message:
|
|
2042
|
-
}),
|
|
2043
|
-
else if (
|
|
2061
|
+
message: a.message
|
|
2062
|
+
}), s.dirty());
|
|
2063
|
+
else if (a.kind === "url")
|
|
2044
2064
|
try {
|
|
2045
2065
|
new URL(e.data);
|
|
2046
2066
|
} catch {
|
|
2047
|
-
|
|
2067
|
+
r = this._getOrReturnCtx(e, r), l(r, {
|
|
2048
2068
|
validation: "url",
|
|
2049
2069
|
code: d.invalid_string,
|
|
2050
|
-
message:
|
|
2051
|
-
}),
|
|
2070
|
+
message: a.message
|
|
2071
|
+
}), s.dirty();
|
|
2052
2072
|
}
|
|
2053
|
-
else
|
|
2073
|
+
else a.kind === "regex" ? (a.regex.lastIndex = 0, a.regex.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
|
|
2054
2074
|
validation: "regex",
|
|
2055
2075
|
code: d.invalid_string,
|
|
2056
|
-
message:
|
|
2057
|
-
}),
|
|
2076
|
+
message: a.message
|
|
2077
|
+
}), s.dirty())) : a.kind === "trim" ? e.data = e.data.trim() : a.kind === "includes" ? e.data.includes(a.value, a.position) || (r = this._getOrReturnCtx(e, r), l(r, {
|
|
2058
2078
|
code: d.invalid_string,
|
|
2059
|
-
validation: { includes:
|
|
2060
|
-
message:
|
|
2061
|
-
}),
|
|
2079
|
+
validation: { includes: a.value, position: a.position },
|
|
2080
|
+
message: a.message
|
|
2081
|
+
}), s.dirty()) : a.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : a.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : a.kind === "startsWith" ? e.data.startsWith(a.value) || (r = this._getOrReturnCtx(e, r), l(r, {
|
|
2062
2082
|
code: d.invalid_string,
|
|
2063
|
-
validation: { startsWith:
|
|
2064
|
-
message:
|
|
2065
|
-
}),
|
|
2083
|
+
validation: { startsWith: a.value },
|
|
2084
|
+
message: a.message
|
|
2085
|
+
}), s.dirty()) : a.kind === "endsWith" ? e.data.endsWith(a.value) || (r = this._getOrReturnCtx(e, r), l(r, {
|
|
2066
2086
|
code: d.invalid_string,
|
|
2067
|
-
validation: { endsWith:
|
|
2068
|
-
message:
|
|
2069
|
-
}),
|
|
2087
|
+
validation: { endsWith: a.value },
|
|
2088
|
+
message: a.message
|
|
2089
|
+
}), s.dirty()) : a.kind === "datetime" ? Dt(a).test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
|
|
2070
2090
|
code: d.invalid_string,
|
|
2071
2091
|
validation: "datetime",
|
|
2072
|
-
message:
|
|
2073
|
-
}),
|
|
2092
|
+
message: a.message
|
|
2093
|
+
}), s.dirty()) : a.kind === "date" ? Rt.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
|
|
2074
2094
|
code: d.invalid_string,
|
|
2075
2095
|
validation: "date",
|
|
2076
|
-
message:
|
|
2077
|
-
}),
|
|
2096
|
+
message: a.message
|
|
2097
|
+
}), s.dirty()) : a.kind === "time" ? Lt(a).test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
|
|
2078
2098
|
code: d.invalid_string,
|
|
2079
2099
|
validation: "time",
|
|
2080
|
-
message:
|
|
2081
|
-
}),
|
|
2100
|
+
message: a.message
|
|
2101
|
+
}), s.dirty()) : a.kind === "duration" ? bt.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
|
|
2082
2102
|
validation: "duration",
|
|
2083
2103
|
code: d.invalid_string,
|
|
2084
|
-
message:
|
|
2085
|
-
}),
|
|
2104
|
+
message: a.message
|
|
2105
|
+
}), s.dirty()) : a.kind === "ip" ? Pt(e.data, a.version) || (r = this._getOrReturnCtx(e, r), l(r, {
|
|
2086
2106
|
validation: "ip",
|
|
2087
2107
|
code: d.invalid_string,
|
|
2088
|
-
message:
|
|
2089
|
-
}),
|
|
2108
|
+
message: a.message
|
|
2109
|
+
}), s.dirty()) : a.kind === "jwt" ? Bt(e.data, a.alg) || (r = this._getOrReturnCtx(e, r), l(r, {
|
|
2090
2110
|
validation: "jwt",
|
|
2091
2111
|
code: d.invalid_string,
|
|
2092
|
-
message:
|
|
2093
|
-
}),
|
|
2112
|
+
message: a.message
|
|
2113
|
+
}), s.dirty()) : a.kind === "cidr" ? Mt(e.data, a.version) || (r = this._getOrReturnCtx(e, r), l(r, {
|
|
2094
2114
|
validation: "cidr",
|
|
2095
2115
|
code: d.invalid_string,
|
|
2096
|
-
message:
|
|
2097
|
-
}),
|
|
2116
|
+
message: a.message
|
|
2117
|
+
}), s.dirty()) : a.kind === "base64" ? wt.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
|
|
2098
2118
|
validation: "base64",
|
|
2099
2119
|
code: d.invalid_string,
|
|
2100
|
-
message:
|
|
2101
|
-
}),
|
|
2120
|
+
message: a.message
|
|
2121
|
+
}), s.dirty()) : a.kind === "base64url" ? Ot.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
|
|
2102
2122
|
validation: "base64url",
|
|
2103
2123
|
code: d.invalid_string,
|
|
2104
|
-
message:
|
|
2105
|
-
}),
|
|
2106
|
-
return { status:
|
|
2124
|
+
message: a.message
|
|
2125
|
+
}), s.dirty()) : x.assertNever(a);
|
|
2126
|
+
return { status: s.value, value: e.data };
|
|
2107
2127
|
}
|
|
2108
|
-
_regex(e, t,
|
|
2109
|
-
return this.refinement((
|
|
2128
|
+
_regex(e, t, s) {
|
|
2129
|
+
return this.refinement((r) => e.test(r), {
|
|
2110
2130
|
validation: t,
|
|
2111
2131
|
code: d.invalid_string,
|
|
2112
|
-
...m.errToObj(
|
|
2132
|
+
...m.errToObj(s)
|
|
2113
2133
|
});
|
|
2114
2134
|
}
|
|
2115
2135
|
_addCheck(e) {
|
|
@@ -2327,60 +2347,60 @@ class P extends b {
|
|
|
2327
2347
|
return e;
|
|
2328
2348
|
}
|
|
2329
2349
|
}
|
|
2330
|
-
P.create = (
|
|
2350
|
+
P.create = (n) => new P({
|
|
2331
2351
|
checks: [],
|
|
2332
2352
|
typeName: v.ZodString,
|
|
2333
|
-
coerce: (
|
|
2334
|
-
...
|
|
2353
|
+
coerce: (n == null ? void 0 : n.coerce) ?? !1,
|
|
2354
|
+
...A(n)
|
|
2335
2355
|
});
|
|
2336
|
-
function
|
|
2337
|
-
const t = (
|
|
2338
|
-
return
|
|
2356
|
+
function Vt(n, e) {
|
|
2357
|
+
const t = (n.toString().split(".")[1] || "").length, s = (e.toString().split(".")[1] || "").length, r = t > s ? t : s, a = Number.parseInt(n.toFixed(r).replace(".", "")), i = Number.parseInt(e.toFixed(r).replace(".", ""));
|
|
2358
|
+
return a % i / 10 ** r;
|
|
2339
2359
|
}
|
|
2340
|
-
class
|
|
2360
|
+
class z extends b {
|
|
2341
2361
|
constructor() {
|
|
2342
2362
|
super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
|
|
2343
2363
|
}
|
|
2344
2364
|
_parse(e) {
|
|
2345
2365
|
if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== f.number) {
|
|
2346
|
-
const
|
|
2347
|
-
return l(
|
|
2366
|
+
const a = this._getOrReturnCtx(e);
|
|
2367
|
+
return l(a, {
|
|
2348
2368
|
code: d.invalid_type,
|
|
2349
2369
|
expected: f.number,
|
|
2350
|
-
received:
|
|
2370
|
+
received: a.parsedType
|
|
2351
2371
|
}), g;
|
|
2352
2372
|
}
|
|
2353
|
-
let
|
|
2354
|
-
const
|
|
2355
|
-
for (const
|
|
2356
|
-
|
|
2373
|
+
let s;
|
|
2374
|
+
const r = new k();
|
|
2375
|
+
for (const a of this._def.checks)
|
|
2376
|
+
a.kind === "int" ? x.isInteger(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
2357
2377
|
code: d.invalid_type,
|
|
2358
2378
|
expected: "integer",
|
|
2359
2379
|
received: "float",
|
|
2360
|
-
message:
|
|
2361
|
-
}),
|
|
2380
|
+
message: a.message
|
|
2381
|
+
}), r.dirty()) : a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (s = this._getOrReturnCtx(e, s), l(s, {
|
|
2362
2382
|
code: d.too_small,
|
|
2363
|
-
minimum:
|
|
2383
|
+
minimum: a.value,
|
|
2364
2384
|
type: "number",
|
|
2365
|
-
inclusive:
|
|
2385
|
+
inclusive: a.inclusive,
|
|
2366
2386
|
exact: !1,
|
|
2367
|
-
message:
|
|
2368
|
-
}),
|
|
2387
|
+
message: a.message
|
|
2388
|
+
}), r.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (s = this._getOrReturnCtx(e, s), l(s, {
|
|
2369
2389
|
code: d.too_big,
|
|
2370
|
-
maximum:
|
|
2390
|
+
maximum: a.value,
|
|
2371
2391
|
type: "number",
|
|
2372
|
-
inclusive:
|
|
2392
|
+
inclusive: a.inclusive,
|
|
2373
2393
|
exact: !1,
|
|
2374
|
-
message:
|
|
2375
|
-
}),
|
|
2394
|
+
message: a.message
|
|
2395
|
+
}), r.dirty()) : a.kind === "multipleOf" ? Vt(e.data, a.value) !== 0 && (s = this._getOrReturnCtx(e, s), l(s, {
|
|
2376
2396
|
code: d.not_multiple_of,
|
|
2377
|
-
multipleOf:
|
|
2378
|
-
message:
|
|
2379
|
-
}),
|
|
2397
|
+
multipleOf: a.value,
|
|
2398
|
+
message: a.message
|
|
2399
|
+
}), r.dirty()) : a.kind === "finite" ? Number.isFinite(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
2380
2400
|
code: d.not_finite,
|
|
2381
|
-
message:
|
|
2382
|
-
}),
|
|
2383
|
-
return { status:
|
|
2401
|
+
message: a.message
|
|
2402
|
+
}), r.dirty()) : x.assertNever(a);
|
|
2403
|
+
return { status: r.value, value: e.data };
|
|
2384
2404
|
}
|
|
2385
2405
|
gte(e, t) {
|
|
2386
2406
|
return this.setLimit("min", e, !0, m.toString(t));
|
|
@@ -2394,22 +2414,22 @@ class H extends b {
|
|
|
2394
2414
|
lt(e, t) {
|
|
2395
2415
|
return this.setLimit("max", e, !1, m.toString(t));
|
|
2396
2416
|
}
|
|
2397
|
-
setLimit(e, t,
|
|
2398
|
-
return new
|
|
2417
|
+
setLimit(e, t, s, r) {
|
|
2418
|
+
return new z({
|
|
2399
2419
|
...this._def,
|
|
2400
2420
|
checks: [
|
|
2401
2421
|
...this._def.checks,
|
|
2402
2422
|
{
|
|
2403
2423
|
kind: e,
|
|
2404
2424
|
value: t,
|
|
2405
|
-
inclusive:
|
|
2406
|
-
message: m.toString(
|
|
2425
|
+
inclusive: s,
|
|
2426
|
+
message: m.toString(r)
|
|
2407
2427
|
}
|
|
2408
2428
|
]
|
|
2409
2429
|
});
|
|
2410
2430
|
}
|
|
2411
2431
|
_addCheck(e) {
|
|
2412
|
-
return new
|
|
2432
|
+
return new z({
|
|
2413
2433
|
...this._def,
|
|
2414
2434
|
checks: [...this._def.checks, e]
|
|
2415
2435
|
});
|
|
@@ -2495,21 +2515,21 @@ class H extends b {
|
|
|
2495
2515
|
}
|
|
2496
2516
|
get isFinite() {
|
|
2497
2517
|
let e = null, t = null;
|
|
2498
|
-
for (const
|
|
2499
|
-
if (
|
|
2518
|
+
for (const s of this._def.checks) {
|
|
2519
|
+
if (s.kind === "finite" || s.kind === "int" || s.kind === "multipleOf")
|
|
2500
2520
|
return !0;
|
|
2501
|
-
|
|
2521
|
+
s.kind === "min" ? (t === null || s.value > t) && (t = s.value) : s.kind === "max" && (e === null || s.value < e) && (e = s.value);
|
|
2502
2522
|
}
|
|
2503
2523
|
return Number.isFinite(t) && Number.isFinite(e);
|
|
2504
2524
|
}
|
|
2505
2525
|
}
|
|
2506
|
-
|
|
2526
|
+
z.create = (n) => new z({
|
|
2507
2527
|
checks: [],
|
|
2508
2528
|
typeName: v.ZodNumber,
|
|
2509
|
-
coerce: (
|
|
2510
|
-
...
|
|
2529
|
+
coerce: (n == null ? void 0 : n.coerce) || !1,
|
|
2530
|
+
...A(n)
|
|
2511
2531
|
});
|
|
2512
|
-
class
|
|
2532
|
+
class W extends b {
|
|
2513
2533
|
constructor() {
|
|
2514
2534
|
super(...arguments), this.min = this.gte, this.max = this.lte;
|
|
2515
2535
|
}
|
|
@@ -2522,27 +2542,27 @@ class z extends b {
|
|
|
2522
2542
|
}
|
|
2523
2543
|
if (this._getType(e) !== f.bigint)
|
|
2524
2544
|
return this._getInvalidInput(e);
|
|
2525
|
-
let
|
|
2526
|
-
const
|
|
2527
|
-
for (const
|
|
2528
|
-
|
|
2545
|
+
let s;
|
|
2546
|
+
const r = new k();
|
|
2547
|
+
for (const a of this._def.checks)
|
|
2548
|
+
a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (s = this._getOrReturnCtx(e, s), l(s, {
|
|
2529
2549
|
code: d.too_small,
|
|
2530
2550
|
type: "bigint",
|
|
2531
|
-
minimum:
|
|
2532
|
-
inclusive:
|
|
2533
|
-
message:
|
|
2534
|
-
}),
|
|
2551
|
+
minimum: a.value,
|
|
2552
|
+
inclusive: a.inclusive,
|
|
2553
|
+
message: a.message
|
|
2554
|
+
}), r.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (s = this._getOrReturnCtx(e, s), l(s, {
|
|
2535
2555
|
code: d.too_big,
|
|
2536
2556
|
type: "bigint",
|
|
2537
|
-
maximum:
|
|
2538
|
-
inclusive:
|
|
2539
|
-
message:
|
|
2540
|
-
}),
|
|
2557
|
+
maximum: a.value,
|
|
2558
|
+
inclusive: a.inclusive,
|
|
2559
|
+
message: a.message
|
|
2560
|
+
}), r.dirty()) : a.kind === "multipleOf" ? e.data % a.value !== BigInt(0) && (s = this._getOrReturnCtx(e, s), l(s, {
|
|
2541
2561
|
code: d.not_multiple_of,
|
|
2542
|
-
multipleOf:
|
|
2543
|
-
message:
|
|
2544
|
-
}),
|
|
2545
|
-
return { status:
|
|
2562
|
+
multipleOf: a.value,
|
|
2563
|
+
message: a.message
|
|
2564
|
+
}), r.dirty()) : x.assertNever(a);
|
|
2565
|
+
return { status: r.value, value: e.data };
|
|
2546
2566
|
}
|
|
2547
2567
|
_getInvalidInput(e) {
|
|
2548
2568
|
const t = this._getOrReturnCtx(e);
|
|
@@ -2564,22 +2584,22 @@ class z extends b {
|
|
|
2564
2584
|
lt(e, t) {
|
|
2565
2585
|
return this.setLimit("max", e, !1, m.toString(t));
|
|
2566
2586
|
}
|
|
2567
|
-
setLimit(e, t,
|
|
2568
|
-
return new
|
|
2587
|
+
setLimit(e, t, s, r) {
|
|
2588
|
+
return new W({
|
|
2569
2589
|
...this._def,
|
|
2570
2590
|
checks: [
|
|
2571
2591
|
...this._def.checks,
|
|
2572
2592
|
{
|
|
2573
2593
|
kind: e,
|
|
2574
2594
|
value: t,
|
|
2575
|
-
inclusive:
|
|
2576
|
-
message: m.toString(
|
|
2595
|
+
inclusive: s,
|
|
2596
|
+
message: m.toString(r)
|
|
2577
2597
|
}
|
|
2578
2598
|
]
|
|
2579
2599
|
});
|
|
2580
2600
|
}
|
|
2581
2601
|
_addCheck(e) {
|
|
2582
|
-
return new
|
|
2602
|
+
return new W({
|
|
2583
2603
|
...this._def,
|
|
2584
2604
|
checks: [...this._def.checks, e]
|
|
2585
2605
|
});
|
|
@@ -2636,66 +2656,66 @@ class z extends b {
|
|
|
2636
2656
|
return e;
|
|
2637
2657
|
}
|
|
2638
2658
|
}
|
|
2639
|
-
|
|
2659
|
+
W.create = (n) => new W({
|
|
2640
2660
|
checks: [],
|
|
2641
2661
|
typeName: v.ZodBigInt,
|
|
2642
|
-
coerce: (
|
|
2643
|
-
...
|
|
2662
|
+
coerce: (n == null ? void 0 : n.coerce) ?? !1,
|
|
2663
|
+
...A(n)
|
|
2644
2664
|
});
|
|
2645
2665
|
class Te extends b {
|
|
2646
2666
|
_parse(e) {
|
|
2647
2667
|
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== f.boolean) {
|
|
2648
|
-
const
|
|
2649
|
-
return l(
|
|
2668
|
+
const s = this._getOrReturnCtx(e);
|
|
2669
|
+
return l(s, {
|
|
2650
2670
|
code: d.invalid_type,
|
|
2651
2671
|
expected: f.boolean,
|
|
2652
|
-
received:
|
|
2672
|
+
received: s.parsedType
|
|
2653
2673
|
}), g;
|
|
2654
2674
|
}
|
|
2655
2675
|
return C(e.data);
|
|
2656
2676
|
}
|
|
2657
2677
|
}
|
|
2658
|
-
Te.create = (
|
|
2678
|
+
Te.create = (n) => new Te({
|
|
2659
2679
|
typeName: v.ZodBoolean,
|
|
2660
|
-
coerce: (
|
|
2661
|
-
...
|
|
2680
|
+
coerce: (n == null ? void 0 : n.coerce) || !1,
|
|
2681
|
+
...A(n)
|
|
2662
2682
|
});
|
|
2663
2683
|
class te extends b {
|
|
2664
2684
|
_parse(e) {
|
|
2665
2685
|
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== f.date) {
|
|
2666
|
-
const
|
|
2667
|
-
return l(
|
|
2686
|
+
const a = this._getOrReturnCtx(e);
|
|
2687
|
+
return l(a, {
|
|
2668
2688
|
code: d.invalid_type,
|
|
2669
2689
|
expected: f.date,
|
|
2670
|
-
received:
|
|
2690
|
+
received: a.parsedType
|
|
2671
2691
|
}), g;
|
|
2672
2692
|
}
|
|
2673
2693
|
if (Number.isNaN(e.data.getTime())) {
|
|
2674
|
-
const
|
|
2675
|
-
return l(
|
|
2694
|
+
const a = this._getOrReturnCtx(e);
|
|
2695
|
+
return l(a, {
|
|
2676
2696
|
code: d.invalid_date
|
|
2677
2697
|
}), g;
|
|
2678
2698
|
}
|
|
2679
|
-
const
|
|
2680
|
-
let
|
|
2681
|
-
for (const
|
|
2682
|
-
|
|
2699
|
+
const s = new k();
|
|
2700
|
+
let r;
|
|
2701
|
+
for (const a of this._def.checks)
|
|
2702
|
+
a.kind === "min" ? e.data.getTime() < a.value && (r = this._getOrReturnCtx(e, r), l(r, {
|
|
2683
2703
|
code: d.too_small,
|
|
2684
|
-
message:
|
|
2704
|
+
message: a.message,
|
|
2685
2705
|
inclusive: !0,
|
|
2686
2706
|
exact: !1,
|
|
2687
|
-
minimum:
|
|
2707
|
+
minimum: a.value,
|
|
2688
2708
|
type: "date"
|
|
2689
|
-
}),
|
|
2709
|
+
}), s.dirty()) : a.kind === "max" ? e.data.getTime() > a.value && (r = this._getOrReturnCtx(e, r), l(r, {
|
|
2690
2710
|
code: d.too_big,
|
|
2691
|
-
message:
|
|
2711
|
+
message: a.message,
|
|
2692
2712
|
inclusive: !0,
|
|
2693
2713
|
exact: !1,
|
|
2694
|
-
maximum:
|
|
2714
|
+
maximum: a.value,
|
|
2695
2715
|
type: "date"
|
|
2696
|
-
}),
|
|
2716
|
+
}), s.dirty()) : x.assertNever(a);
|
|
2697
2717
|
return {
|
|
2698
|
-
status:
|
|
2718
|
+
status: s.value,
|
|
2699
2719
|
value: new Date(e.data.getTime())
|
|
2700
2720
|
};
|
|
2701
2721
|
}
|
|
@@ -2732,64 +2752,64 @@ class te extends b {
|
|
|
2732
2752
|
return e != null ? new Date(e) : null;
|
|
2733
2753
|
}
|
|
2734
2754
|
}
|
|
2735
|
-
te.create = (
|
|
2755
|
+
te.create = (n) => new te({
|
|
2736
2756
|
checks: [],
|
|
2737
|
-
coerce: (
|
|
2757
|
+
coerce: (n == null ? void 0 : n.coerce) || !1,
|
|
2738
2758
|
typeName: v.ZodDate,
|
|
2739
|
-
...
|
|
2759
|
+
...A(n)
|
|
2740
2760
|
});
|
|
2741
2761
|
class Ee extends b {
|
|
2742
2762
|
_parse(e) {
|
|
2743
2763
|
if (this._getType(e) !== f.symbol) {
|
|
2744
|
-
const
|
|
2745
|
-
return l(
|
|
2764
|
+
const s = this._getOrReturnCtx(e);
|
|
2765
|
+
return l(s, {
|
|
2746
2766
|
code: d.invalid_type,
|
|
2747
2767
|
expected: f.symbol,
|
|
2748
|
-
received:
|
|
2768
|
+
received: s.parsedType
|
|
2749
2769
|
}), g;
|
|
2750
2770
|
}
|
|
2751
2771
|
return C(e.data);
|
|
2752
2772
|
}
|
|
2753
2773
|
}
|
|
2754
|
-
Ee.create = (
|
|
2774
|
+
Ee.create = (n) => new Ee({
|
|
2755
2775
|
typeName: v.ZodSymbol,
|
|
2756
|
-
...
|
|
2776
|
+
...A(n)
|
|
2757
2777
|
});
|
|
2758
2778
|
class be extends b {
|
|
2759
2779
|
_parse(e) {
|
|
2760
2780
|
if (this._getType(e) !== f.undefined) {
|
|
2761
|
-
const
|
|
2762
|
-
return l(
|
|
2781
|
+
const s = this._getOrReturnCtx(e);
|
|
2782
|
+
return l(s, {
|
|
2763
2783
|
code: d.invalid_type,
|
|
2764
2784
|
expected: f.undefined,
|
|
2765
|
-
received:
|
|
2785
|
+
received: s.parsedType
|
|
2766
2786
|
}), g;
|
|
2767
2787
|
}
|
|
2768
2788
|
return C(e.data);
|
|
2769
2789
|
}
|
|
2770
2790
|
}
|
|
2771
|
-
be.create = (
|
|
2791
|
+
be.create = (n) => new be({
|
|
2772
2792
|
typeName: v.ZodUndefined,
|
|
2773
|
-
...
|
|
2793
|
+
...A(n)
|
|
2774
2794
|
});
|
|
2775
2795
|
class xe extends b {
|
|
2776
2796
|
_parse(e) {
|
|
2777
2797
|
if (this._getType(e) !== f.null) {
|
|
2778
|
-
const
|
|
2779
|
-
return l(
|
|
2798
|
+
const s = this._getOrReturnCtx(e);
|
|
2799
|
+
return l(s, {
|
|
2780
2800
|
code: d.invalid_type,
|
|
2781
2801
|
expected: f.null,
|
|
2782
|
-
received:
|
|
2802
|
+
received: s.parsedType
|
|
2783
2803
|
}), g;
|
|
2784
2804
|
}
|
|
2785
2805
|
return C(e.data);
|
|
2786
2806
|
}
|
|
2787
2807
|
}
|
|
2788
|
-
xe.create = (
|
|
2808
|
+
xe.create = (n) => new xe({
|
|
2789
2809
|
typeName: v.ZodNull,
|
|
2790
|
-
...
|
|
2810
|
+
...A(n)
|
|
2791
2811
|
});
|
|
2792
|
-
class
|
|
2812
|
+
class Ne extends b {
|
|
2793
2813
|
constructor() {
|
|
2794
2814
|
super(...arguments), this._any = !0;
|
|
2795
2815
|
}
|
|
@@ -2797,11 +2817,11 @@ class Se extends b {
|
|
|
2797
2817
|
return C(e.data);
|
|
2798
2818
|
}
|
|
2799
2819
|
}
|
|
2800
|
-
|
|
2820
|
+
Ne.create = (n) => new Ne({
|
|
2801
2821
|
typeName: v.ZodAny,
|
|
2802
|
-
...
|
|
2822
|
+
...A(n)
|
|
2803
2823
|
});
|
|
2804
|
-
class
|
|
2824
|
+
class Se extends b {
|
|
2805
2825
|
constructor() {
|
|
2806
2826
|
super(...arguments), this._unknown = !0;
|
|
2807
2827
|
}
|
|
@@ -2809,11 +2829,11 @@ class Ne extends b {
|
|
|
2809
2829
|
return C(e.data);
|
|
2810
2830
|
}
|
|
2811
2831
|
}
|
|
2812
|
-
|
|
2832
|
+
Se.create = (n) => new Se({
|
|
2813
2833
|
typeName: v.ZodUnknown,
|
|
2814
|
-
...
|
|
2834
|
+
...A(n)
|
|
2815
2835
|
});
|
|
2816
|
-
class
|
|
2836
|
+
class V extends b {
|
|
2817
2837
|
_parse(e) {
|
|
2818
2838
|
const t = this._getOrReturnCtx(e);
|
|
2819
2839
|
return l(t, {
|
|
@@ -2823,66 +2843,66 @@ class U extends b {
|
|
|
2823
2843
|
}), g;
|
|
2824
2844
|
}
|
|
2825
2845
|
}
|
|
2826
|
-
|
|
2846
|
+
V.create = (n) => new V({
|
|
2827
2847
|
typeName: v.ZodNever,
|
|
2828
|
-
...
|
|
2848
|
+
...A(n)
|
|
2829
2849
|
});
|
|
2830
2850
|
class Ie extends b {
|
|
2831
2851
|
_parse(e) {
|
|
2832
2852
|
if (this._getType(e) !== f.undefined) {
|
|
2833
|
-
const
|
|
2834
|
-
return l(
|
|
2853
|
+
const s = this._getOrReturnCtx(e);
|
|
2854
|
+
return l(s, {
|
|
2835
2855
|
code: d.invalid_type,
|
|
2836
2856
|
expected: f.void,
|
|
2837
|
-
received:
|
|
2857
|
+
received: s.parsedType
|
|
2838
2858
|
}), g;
|
|
2839
2859
|
}
|
|
2840
2860
|
return C(e.data);
|
|
2841
2861
|
}
|
|
2842
2862
|
}
|
|
2843
|
-
Ie.create = (
|
|
2863
|
+
Ie.create = (n) => new Ie({
|
|
2844
2864
|
typeName: v.ZodVoid,
|
|
2845
|
-
...
|
|
2865
|
+
...A(n)
|
|
2846
2866
|
});
|
|
2847
2867
|
class O extends b {
|
|
2848
2868
|
_parse(e) {
|
|
2849
|
-
const { ctx: t, status:
|
|
2869
|
+
const { ctx: t, status: s } = this._processInputParams(e), r = this._def;
|
|
2850
2870
|
if (t.parsedType !== f.array)
|
|
2851
2871
|
return l(t, {
|
|
2852
2872
|
code: d.invalid_type,
|
|
2853
2873
|
expected: f.array,
|
|
2854
2874
|
received: t.parsedType
|
|
2855
2875
|
}), g;
|
|
2856
|
-
if (
|
|
2857
|
-
const i = t.data.length >
|
|
2876
|
+
if (r.exactLength !== null) {
|
|
2877
|
+
const i = t.data.length > r.exactLength.value, c = t.data.length < r.exactLength.value;
|
|
2858
2878
|
(i || c) && (l(t, {
|
|
2859
2879
|
code: i ? d.too_big : d.too_small,
|
|
2860
|
-
minimum: c ?
|
|
2861
|
-
maximum: i ?
|
|
2880
|
+
minimum: c ? r.exactLength.value : void 0,
|
|
2881
|
+
maximum: i ? r.exactLength.value : void 0,
|
|
2862
2882
|
type: "array",
|
|
2863
2883
|
inclusive: !0,
|
|
2864
2884
|
exact: !0,
|
|
2865
|
-
message:
|
|
2866
|
-
}),
|
|
2885
|
+
message: r.exactLength.message
|
|
2886
|
+
}), s.dirty());
|
|
2867
2887
|
}
|
|
2868
|
-
if (
|
|
2888
|
+
if (r.minLength !== null && t.data.length < r.minLength.value && (l(t, {
|
|
2869
2889
|
code: d.too_small,
|
|
2870
|
-
minimum:
|
|
2890
|
+
minimum: r.minLength.value,
|
|
2871
2891
|
type: "array",
|
|
2872
2892
|
inclusive: !0,
|
|
2873
2893
|
exact: !1,
|
|
2874
|
-
message:
|
|
2875
|
-
}),
|
|
2894
|
+
message: r.minLength.message
|
|
2895
|
+
}), s.dirty()), r.maxLength !== null && t.data.length > r.maxLength.value && (l(t, {
|
|
2876
2896
|
code: d.too_big,
|
|
2877
|
-
maximum:
|
|
2897
|
+
maximum: r.maxLength.value,
|
|
2878
2898
|
type: "array",
|
|
2879
2899
|
inclusive: !0,
|
|
2880
2900
|
exact: !1,
|
|
2881
|
-
message:
|
|
2882
|
-
}),
|
|
2883
|
-
return Promise.all([...t.data].map((i, c) =>
|
|
2884
|
-
const
|
|
2885
|
-
return k.mergeArray(
|
|
2901
|
+
message: r.maxLength.message
|
|
2902
|
+
}), s.dirty()), t.common.async)
|
|
2903
|
+
return Promise.all([...t.data].map((i, c) => r.type._parseAsync(new M(t, i, t.path, c)))).then((i) => k.mergeArray(s, i));
|
|
2904
|
+
const a = [...t.data].map((i, c) => r.type._parseSync(new M(t, i, t.path, c)));
|
|
2905
|
+
return k.mergeArray(s, a);
|
|
2886
2906
|
}
|
|
2887
2907
|
get element() {
|
|
2888
2908
|
return this._def.type;
|
|
@@ -2909,31 +2929,31 @@ class O extends b {
|
|
|
2909
2929
|
return this.min(1, e);
|
|
2910
2930
|
}
|
|
2911
2931
|
}
|
|
2912
|
-
O.create = (
|
|
2913
|
-
type:
|
|
2932
|
+
O.create = (n, e) => new O({
|
|
2933
|
+
type: n,
|
|
2914
2934
|
minLength: null,
|
|
2915
2935
|
maxLength: null,
|
|
2916
2936
|
exactLength: null,
|
|
2917
2937
|
typeName: v.ZodArray,
|
|
2918
|
-
...
|
|
2938
|
+
...A(e)
|
|
2919
2939
|
});
|
|
2920
|
-
function
|
|
2921
|
-
if (
|
|
2940
|
+
function j(n) {
|
|
2941
|
+
if (n instanceof N) {
|
|
2922
2942
|
const e = {};
|
|
2923
|
-
for (const t in
|
|
2924
|
-
const
|
|
2925
|
-
e[t] = B.create(
|
|
2943
|
+
for (const t in n.shape) {
|
|
2944
|
+
const s = n.shape[t];
|
|
2945
|
+
e[t] = B.create(j(s));
|
|
2926
2946
|
}
|
|
2927
|
-
return new
|
|
2928
|
-
...
|
|
2947
|
+
return new N({
|
|
2948
|
+
...n._def,
|
|
2929
2949
|
shape: () => e
|
|
2930
2950
|
});
|
|
2931
|
-
} else return
|
|
2932
|
-
...
|
|
2933
|
-
type:
|
|
2934
|
-
}) :
|
|
2951
|
+
} else return n instanceof O ? new O({
|
|
2952
|
+
...n._def,
|
|
2953
|
+
type: j(n.element)
|
|
2954
|
+
}) : n instanceof B ? B.create(j(n.unwrap())) : n instanceof K ? K.create(j(n.unwrap())) : n instanceof $ ? $.create(n.items.map((e) => j(e))) : n;
|
|
2935
2955
|
}
|
|
2936
|
-
class
|
|
2956
|
+
class N extends b {
|
|
2937
2957
|
constructor() {
|
|
2938
2958
|
super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
|
|
2939
2959
|
}
|
|
@@ -2952,88 +2972,88 @@ class S extends b {
|
|
|
2952
2972
|
received: h.parsedType
|
|
2953
2973
|
}), g;
|
|
2954
2974
|
}
|
|
2955
|
-
const { status:
|
|
2956
|
-
if (!(this._def.catchall instanceof
|
|
2957
|
-
for (const h in
|
|
2975
|
+
const { status: s, ctx: r } = this._processInputParams(e), { shape: a, keys: i } = this._getCached(), c = [];
|
|
2976
|
+
if (!(this._def.catchall instanceof V && this._def.unknownKeys === "strip"))
|
|
2977
|
+
for (const h in r.data)
|
|
2958
2978
|
i.includes(h) || c.push(h);
|
|
2959
2979
|
const u = [];
|
|
2960
2980
|
for (const h of i) {
|
|
2961
|
-
const
|
|
2981
|
+
const T = a[h], w = r.data[h];
|
|
2962
2982
|
u.push({
|
|
2963
2983
|
key: { status: "valid", value: h },
|
|
2964
|
-
value:
|
|
2965
|
-
alwaysSet: h in
|
|
2984
|
+
value: T._parse(new M(r, w, r.path, h)),
|
|
2985
|
+
alwaysSet: h in r.data
|
|
2966
2986
|
});
|
|
2967
2987
|
}
|
|
2968
|
-
if (this._def.catchall instanceof
|
|
2988
|
+
if (this._def.catchall instanceof V) {
|
|
2969
2989
|
const h = this._def.unknownKeys;
|
|
2970
2990
|
if (h === "passthrough")
|
|
2971
|
-
for (const
|
|
2991
|
+
for (const T of c)
|
|
2972
2992
|
u.push({
|
|
2973
|
-
key: { status: "valid", value:
|
|
2974
|
-
value: { status: "valid", value:
|
|
2993
|
+
key: { status: "valid", value: T },
|
|
2994
|
+
value: { status: "valid", value: r.data[T] }
|
|
2975
2995
|
});
|
|
2976
2996
|
else if (h === "strict")
|
|
2977
|
-
c.length > 0 && (l(
|
|
2997
|
+
c.length > 0 && (l(r, {
|
|
2978
2998
|
code: d.unrecognized_keys,
|
|
2979
2999
|
keys: c
|
|
2980
|
-
}),
|
|
3000
|
+
}), s.dirty());
|
|
2981
3001
|
else if (h !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
|
|
2982
3002
|
} else {
|
|
2983
3003
|
const h = this._def.catchall;
|
|
2984
|
-
for (const
|
|
2985
|
-
const w =
|
|
3004
|
+
for (const T of c) {
|
|
3005
|
+
const w = r.data[T];
|
|
2986
3006
|
u.push({
|
|
2987
|
-
key: { status: "valid", value:
|
|
3007
|
+
key: { status: "valid", value: T },
|
|
2988
3008
|
value: h._parse(
|
|
2989
|
-
new M(
|
|
3009
|
+
new M(r, w, r.path, T)
|
|
2990
3010
|
//, ctx.child(key), value, getParsedType(value)
|
|
2991
3011
|
),
|
|
2992
|
-
alwaysSet:
|
|
3012
|
+
alwaysSet: T in r.data
|
|
2993
3013
|
});
|
|
2994
3014
|
}
|
|
2995
3015
|
}
|
|
2996
|
-
return
|
|
3016
|
+
return r.common.async ? Promise.resolve().then(async () => {
|
|
2997
3017
|
const h = [];
|
|
2998
|
-
for (const
|
|
2999
|
-
const w = await
|
|
3018
|
+
for (const T of u) {
|
|
3019
|
+
const w = await T.key, $e = await T.value;
|
|
3000
3020
|
h.push({
|
|
3001
3021
|
key: w,
|
|
3002
3022
|
value: $e,
|
|
3003
|
-
alwaysSet:
|
|
3023
|
+
alwaysSet: T.alwaysSet
|
|
3004
3024
|
});
|
|
3005
3025
|
}
|
|
3006
3026
|
return h;
|
|
3007
|
-
}).then((h) => k.mergeObjectSync(
|
|
3027
|
+
}).then((h) => k.mergeObjectSync(s, h)) : k.mergeObjectSync(s, u);
|
|
3008
3028
|
}
|
|
3009
3029
|
get shape() {
|
|
3010
3030
|
return this._def.shape();
|
|
3011
3031
|
}
|
|
3012
3032
|
strict(e) {
|
|
3013
|
-
return m.errToObj, new
|
|
3033
|
+
return m.errToObj, new N({
|
|
3014
3034
|
...this._def,
|
|
3015
3035
|
unknownKeys: "strict",
|
|
3016
3036
|
...e !== void 0 ? {
|
|
3017
|
-
errorMap: (t,
|
|
3018
|
-
var
|
|
3019
|
-
const
|
|
3037
|
+
errorMap: (t, s) => {
|
|
3038
|
+
var a, i;
|
|
3039
|
+
const r = ((i = (a = this._def).errorMap) == null ? void 0 : i.call(a, t, s).message) ?? s.defaultError;
|
|
3020
3040
|
return t.code === "unrecognized_keys" ? {
|
|
3021
|
-
message: m.errToObj(e).message ??
|
|
3041
|
+
message: m.errToObj(e).message ?? r
|
|
3022
3042
|
} : {
|
|
3023
|
-
message:
|
|
3043
|
+
message: r
|
|
3024
3044
|
};
|
|
3025
3045
|
}
|
|
3026
3046
|
} : {}
|
|
3027
3047
|
});
|
|
3028
3048
|
}
|
|
3029
3049
|
strip() {
|
|
3030
|
-
return new
|
|
3050
|
+
return new N({
|
|
3031
3051
|
...this._def,
|
|
3032
3052
|
unknownKeys: "strip"
|
|
3033
3053
|
});
|
|
3034
3054
|
}
|
|
3035
3055
|
passthrough() {
|
|
3036
|
-
return new
|
|
3056
|
+
return new N({
|
|
3037
3057
|
...this._def,
|
|
3038
3058
|
unknownKeys: "passthrough"
|
|
3039
3059
|
});
|
|
@@ -3056,7 +3076,7 @@ class S extends b {
|
|
|
3056
3076
|
// }) as any;
|
|
3057
3077
|
// };
|
|
3058
3078
|
extend(e) {
|
|
3059
|
-
return new
|
|
3079
|
+
return new N({
|
|
3060
3080
|
...this._def,
|
|
3061
3081
|
shape: () => ({
|
|
3062
3082
|
...this._def.shape(),
|
|
@@ -3070,7 +3090,7 @@ class S extends b {
|
|
|
3070
3090
|
* upgrade if you are experiencing issues.
|
|
3071
3091
|
*/
|
|
3072
3092
|
merge(e) {
|
|
3073
|
-
return new
|
|
3093
|
+
return new N({
|
|
3074
3094
|
unknownKeys: e._def.unknownKeys,
|
|
3075
3095
|
catchall: e._def.catchall,
|
|
3076
3096
|
shape: () => ({
|
|
@@ -3140,25 +3160,25 @@ class S extends b {
|
|
|
3140
3160
|
// return merged;
|
|
3141
3161
|
// }
|
|
3142
3162
|
catchall(e) {
|
|
3143
|
-
return new
|
|
3163
|
+
return new N({
|
|
3144
3164
|
...this._def,
|
|
3145
3165
|
catchall: e
|
|
3146
3166
|
});
|
|
3147
3167
|
}
|
|
3148
3168
|
pick(e) {
|
|
3149
3169
|
const t = {};
|
|
3150
|
-
for (const
|
|
3151
|
-
e[
|
|
3152
|
-
return new
|
|
3170
|
+
for (const s of x.objectKeys(e))
|
|
3171
|
+
e[s] && this.shape[s] && (t[s] = this.shape[s]);
|
|
3172
|
+
return new N({
|
|
3153
3173
|
...this._def,
|
|
3154
3174
|
shape: () => t
|
|
3155
3175
|
});
|
|
3156
3176
|
}
|
|
3157
3177
|
omit(e) {
|
|
3158
3178
|
const t = {};
|
|
3159
|
-
for (const
|
|
3160
|
-
e[
|
|
3161
|
-
return new
|
|
3179
|
+
for (const s of x.objectKeys(this.shape))
|
|
3180
|
+
e[s] || (t[s] = this.shape[s]);
|
|
3181
|
+
return new N({
|
|
3162
3182
|
...this._def,
|
|
3163
3183
|
shape: () => t
|
|
3164
3184
|
});
|
|
@@ -3167,78 +3187,78 @@ class S extends b {
|
|
|
3167
3187
|
* @deprecated
|
|
3168
3188
|
*/
|
|
3169
3189
|
deepPartial() {
|
|
3170
|
-
return
|
|
3190
|
+
return j(this);
|
|
3171
3191
|
}
|
|
3172
3192
|
partial(e) {
|
|
3173
3193
|
const t = {};
|
|
3174
|
-
for (const
|
|
3175
|
-
const
|
|
3176
|
-
e && !e[
|
|
3194
|
+
for (const s of x.objectKeys(this.shape)) {
|
|
3195
|
+
const r = this.shape[s];
|
|
3196
|
+
e && !e[s] ? t[s] = r : t[s] = r.optional();
|
|
3177
3197
|
}
|
|
3178
|
-
return new
|
|
3198
|
+
return new N({
|
|
3179
3199
|
...this._def,
|
|
3180
3200
|
shape: () => t
|
|
3181
3201
|
});
|
|
3182
3202
|
}
|
|
3183
3203
|
required(e) {
|
|
3184
3204
|
const t = {};
|
|
3185
|
-
for (const
|
|
3186
|
-
if (e && !e[
|
|
3187
|
-
t[
|
|
3205
|
+
for (const s of x.objectKeys(this.shape))
|
|
3206
|
+
if (e && !e[s])
|
|
3207
|
+
t[s] = this.shape[s];
|
|
3188
3208
|
else {
|
|
3189
|
-
let
|
|
3190
|
-
for (;
|
|
3191
|
-
|
|
3192
|
-
t[
|
|
3209
|
+
let a = this.shape[s];
|
|
3210
|
+
for (; a instanceof B; )
|
|
3211
|
+
a = a._def.innerType;
|
|
3212
|
+
t[s] = a;
|
|
3193
3213
|
}
|
|
3194
|
-
return new
|
|
3214
|
+
return new N({
|
|
3195
3215
|
...this._def,
|
|
3196
3216
|
shape: () => t
|
|
3197
3217
|
});
|
|
3198
3218
|
}
|
|
3199
3219
|
keyof() {
|
|
3200
|
-
return
|
|
3220
|
+
return Ue(x.objectKeys(this.shape));
|
|
3201
3221
|
}
|
|
3202
3222
|
}
|
|
3203
|
-
|
|
3204
|
-
shape: () =>
|
|
3223
|
+
N.create = (n, e) => new N({
|
|
3224
|
+
shape: () => n,
|
|
3205
3225
|
unknownKeys: "strip",
|
|
3206
|
-
catchall:
|
|
3226
|
+
catchall: V.create(),
|
|
3207
3227
|
typeName: v.ZodObject,
|
|
3208
|
-
...
|
|
3228
|
+
...A(e)
|
|
3209
3229
|
});
|
|
3210
|
-
|
|
3211
|
-
shape: () =>
|
|
3230
|
+
N.strictCreate = (n, e) => new N({
|
|
3231
|
+
shape: () => n,
|
|
3212
3232
|
unknownKeys: "strict",
|
|
3213
|
-
catchall:
|
|
3233
|
+
catchall: V.create(),
|
|
3214
3234
|
typeName: v.ZodObject,
|
|
3215
|
-
...
|
|
3235
|
+
...A(e)
|
|
3216
3236
|
});
|
|
3217
|
-
|
|
3218
|
-
shape:
|
|
3237
|
+
N.lazycreate = (n, e) => new N({
|
|
3238
|
+
shape: n,
|
|
3219
3239
|
unknownKeys: "strip",
|
|
3220
|
-
catchall:
|
|
3240
|
+
catchall: V.create(),
|
|
3221
3241
|
typeName: v.ZodObject,
|
|
3222
|
-
...
|
|
3242
|
+
...A(e)
|
|
3223
3243
|
});
|
|
3224
|
-
class
|
|
3244
|
+
class ne extends b {
|
|
3225
3245
|
_parse(e) {
|
|
3226
|
-
const { ctx: t } = this._processInputParams(e),
|
|
3227
|
-
function a
|
|
3228
|
-
for (const c of
|
|
3246
|
+
const { ctx: t } = this._processInputParams(e), s = this._def.options;
|
|
3247
|
+
function r(a) {
|
|
3248
|
+
for (const c of a)
|
|
3229
3249
|
if (c.result.status === "valid")
|
|
3230
3250
|
return c.result;
|
|
3231
|
-
for (const c of
|
|
3251
|
+
for (const c of a)
|
|
3232
3252
|
if (c.result.status === "dirty")
|
|
3233
3253
|
return t.common.issues.push(...c.ctx.common.issues), c.result;
|
|
3234
|
-
const i =
|
|
3254
|
+
const i = a.map((c) => new R(c.ctx.common.issues));
|
|
3235
3255
|
return l(t, {
|
|
3236
3256
|
code: d.invalid_union,
|
|
3237
3257
|
unionErrors: i
|
|
3238
3258
|
}), g;
|
|
3239
3259
|
}
|
|
3240
3260
|
if (t.common.async)
|
|
3241
|
-
return Promise.all(
|
|
3261
|
+
return Promise.all(s.map(async (a) => {
|
|
3242
3262
|
const i = {
|
|
3243
3263
|
...t,
|
|
3244
3264
|
common: {
|
|
@@ -3248,18 +3268,18 @@ class se extends b {
|
|
|
3248
3268
|
parent: null
|
|
3249
3269
|
};
|
|
3250
3270
|
return {
|
|
3251
|
-
result: await
|
|
3271
|
+
result: await a._parseAsync({
|
|
3252
3272
|
data: t.data,
|
|
3253
3273
|
path: t.path,
|
|
3254
3274
|
parent: i
|
|
3255
3275
|
}),
|
|
3256
3276
|
ctx: i
|
|
3257
3277
|
};
|
|
3258
|
-
})).then(
|
|
3278
|
+
})).then(r);
|
|
3259
3279
|
{
|
|
3260
|
-
let
|
|
3280
|
+
let a;
|
|
3261
3281
|
const i = [];
|
|
3262
|
-
for (const u of
|
|
3282
|
+
for (const u of s) {
|
|
3263
3283
|
const h = {
|
|
3264
3284
|
...t,
|
|
3265
3285
|
common: {
|
|
@@ -3267,17 +3287,17 @@ class se extends b {
|
|
|
3267
3287
|
issues: []
|
|
3268
3288
|
},
|
|
3269
3289
|
parent: null
|
|
3270
|
-
},
|
|
3290
|
+
}, T = u._parseSync({
|
|
3271
3291
|
data: t.data,
|
|
3272
3292
|
path: t.path,
|
|
3273
3293
|
parent: h
|
|
3274
3294
|
});
|
|
3275
|
-
if (
|
|
3276
|
-
return
|
|
3277
|
-
|
|
3295
|
+
if (T.status === "valid")
|
|
3296
|
+
return T;
|
|
3297
|
+
T.status === "dirty" && !a && (a = { result: T, ctx: h }), h.common.issues.length && i.push(h.common.issues);
|
|
3278
3298
|
}
|
|
3279
|
-
if (
|
|
3280
|
-
return t.common.issues.push(...
|
|
3299
|
+
if (a)
|
|
3300
|
+
return t.common.issues.push(...a.ctx.common.issues), a.result;
|
|
3281
3301
|
const c = i.map((u) => new R(u));
|
|
3282
3302
|
return l(t, {
|
|
3283
3303
|
code: d.invalid_union,
|
|
@@ -3289,104 +3309,104 @@ class se extends b {
|
|
|
3289
3309
|
return this._def.options;
|
|
3290
3310
|
}
|
|
3291
3311
|
}
|
|
3292
|
-
|
|
3293
|
-
options:
|
|
3312
|
+
ne.create = (n, e) => new ne({
|
|
3313
|
+
options: n,
|
|
3294
3314
|
typeName: v.ZodUnion,
|
|
3295
|
-
...
|
|
3315
|
+
...A(e)
|
|
3296
3316
|
});
|
|
3297
|
-
function oe(
|
|
3298
|
-
const t = D(
|
|
3299
|
-
if (
|
|
3300
|
-
return { valid: !0, data:
|
|
3301
|
-
if (t === f.object &&
|
|
3302
|
-
const
|
|
3303
|
-
for (const c of
|
|
3304
|
-
const u = oe(
|
|
3317
|
+
function oe(n, e) {
|
|
3318
|
+
const t = D(n), s = D(e);
|
|
3319
|
+
if (n === e)
|
|
3320
|
+
return { valid: !0, data: n };
|
|
3321
|
+
if (t === f.object && s === f.object) {
|
|
3322
|
+
const r = x.objectKeys(e), a = x.objectKeys(n).filter((c) => r.indexOf(c) !== -1), i = { ...n, ...e };
|
|
3323
|
+
for (const c of a) {
|
|
3324
|
+
const u = oe(n[c], e[c]);
|
|
3305
3325
|
if (!u.valid)
|
|
3306
3326
|
return { valid: !1 };
|
|
3307
3327
|
i[c] = u.data;
|
|
3308
3328
|
}
|
|
3309
3329
|
return { valid: !0, data: i };
|
|
3310
|
-
} else if (t === f.array &&
|
|
3311
|
-
if (
|
|
3330
|
+
} else if (t === f.array && s === f.array) {
|
|
3331
|
+
if (n.length !== e.length)
|
|
3312
3332
|
return { valid: !1 };
|
|
3313
|
-
const
|
|
3314
|
-
for (let
|
|
3315
|
-
const i =
|
|
3333
|
+
const r = [];
|
|
3334
|
+
for (let a = 0; a < n.length; a++) {
|
|
3335
|
+
const i = n[a], c = e[a], u = oe(i, c);
|
|
3316
3336
|
if (!u.valid)
|
|
3317
3337
|
return { valid: !1 };
|
|
3318
|
-
|
|
3338
|
+
r.push(u.data);
|
|
3319
3339
|
}
|
|
3320
|
-
return { valid: !0, data:
|
|
3321
|
-
} else return t === f.date &&
|
|
3340
|
+
return { valid: !0, data: r };
|
|
3341
|
+
} else return t === f.date && s === f.date && +n == +e ? { valid: !0, data: n } : { valid: !1 };
|
|
3322
3342
|
}
|
|
3323
|
-
class
|
|
3343
|
+
class se extends b {
|
|
3324
3344
|
_parse(e) {
|
|
3325
|
-
const { status: t, ctx:
|
|
3326
|
-
if (ye(
|
|
3345
|
+
const { status: t, ctx: s } = this._processInputParams(e), r = (a, i) => {
|
|
3346
|
+
if (ye(a) || ye(i))
|
|
3327
3347
|
return g;
|
|
3328
|
-
const c = oe(
|
|
3329
|
-
return c.valid ? ((_e(
|
|
3348
|
+
const c = oe(a.value, i.value);
|
|
3349
|
+
return c.valid ? ((_e(a) || _e(i)) && t.dirty(), { status: t.value, value: c.data }) : (l(s, {
|
|
3330
3350
|
code: d.invalid_intersection_types
|
|
3331
3351
|
}), g);
|
|
3332
3352
|
};
|
|
3333
|
-
return
|
|
3353
|
+
return s.common.async ? Promise.all([
|
|
3334
3354
|
this._def.left._parseAsync({
|
|
3335
|
-
data:
|
|
3336
|
-
path:
|
|
3337
|
-
parent:
|
|
3355
|
+
data: s.data,
|
|
3356
|
+
path: s.path,
|
|
3357
|
+
parent: s
|
|
3338
3358
|
}),
|
|
3339
3359
|
this._def.right._parseAsync({
|
|
3340
|
-
data:
|
|
3341
|
-
path:
|
|
3342
|
-
parent:
|
|
3360
|
+
data: s.data,
|
|
3361
|
+
path: s.path,
|
|
3362
|
+
parent: s
|
|
3343
3363
|
})
|
|
3344
|
-
]).then(([
|
|
3345
|
-
data:
|
|
3346
|
-
path:
|
|
3347
|
-
parent:
|
|
3364
|
+
]).then(([a, i]) => r(a, i)) : r(this._def.left._parseSync({
|
|
3365
|
+
data: s.data,
|
|
3366
|
+
path: s.path,
|
|
3367
|
+
parent: s
|
|
3348
3368
|
}), this._def.right._parseSync({
|
|
3349
|
-
data:
|
|
3350
|
-
path:
|
|
3351
|
-
parent:
|
|
3369
|
+
data: s.data,
|
|
3370
|
+
path: s.path,
|
|
3371
|
+
parent: s
|
|
3352
3372
|
}));
|
|
3353
3373
|
}
|
|
3354
3374
|
}
|
|
3355
|
-
|
|
3356
|
-
left:
|
|
3375
|
+
se.create = (n, e, t) => new se({
|
|
3376
|
+
left: n,
|
|
3357
3377
|
right: e,
|
|
3358
3378
|
typeName: v.ZodIntersection,
|
|
3359
|
-
...
|
|
3379
|
+
...A(t)
|
|
3360
3380
|
});
|
|
3361
3381
|
class $ extends b {
|
|
3362
3382
|
_parse(e) {
|
|
3363
|
-
const { status: t, ctx:
|
|
3364
|
-
if (
|
|
3365
|
-
return l(
|
|
3383
|
+
const { status: t, ctx: s } = this._processInputParams(e);
|
|
3384
|
+
if (s.parsedType !== f.array)
|
|
3385
|
+
return l(s, {
|
|
3366
3386
|
code: d.invalid_type,
|
|
3367
3387
|
expected: f.array,
|
|
3368
|
-
received:
|
|
3388
|
+
received: s.parsedType
|
|
3369
3389
|
}), g;
|
|
3370
|
-
if (
|
|
3371
|
-
return l(
|
|
3390
|
+
if (s.data.length < this._def.items.length)
|
|
3391
|
+
return l(s, {
|
|
3372
3392
|
code: d.too_small,
|
|
3373
3393
|
minimum: this._def.items.length,
|
|
3374
3394
|
inclusive: !0,
|
|
3375
3395
|
exact: !1,
|
|
3376
3396
|
type: "array"
|
|
3377
3397
|
}), g;
|
|
3378
|
-
!this._def.rest &&
|
|
3398
|
+
!this._def.rest && s.data.length > this._def.items.length && (l(s, {
|
|
3379
3399
|
code: d.too_big,
|
|
3380
3400
|
maximum: this._def.items.length,
|
|
3381
3401
|
inclusive: !0,
|
|
3382
3402
|
exact: !1,
|
|
3383
3403
|
type: "array"
|
|
3384
3404
|
}), t.dirty());
|
|
3385
|
-
const
|
|
3405
|
+
const a = [...s.data].map((i, c) => {
|
|
3386
3406
|
const u = this._def.items[c] || this._def.rest;
|
|
3387
|
-
return u ? u._parse(new M(
|
|
3407
|
+
return u ? u._parse(new M(s, i, s.path, c)) : null;
|
|
3388
3408
|
}).filter((i) => !!i);
|
|
3389
|
-
return
|
|
3409
|
+
return s.common.async ? Promise.all(a).then((i) => k.mergeArray(t, i)) : k.mergeArray(t, a);
|
|
3390
3410
|
}
|
|
3391
3411
|
get items() {
|
|
3392
3412
|
return this._def.items;
|
|
@@ -3398,14 +3418,14 @@ class $ extends b {
|
|
|
3398
3418
|
});
|
|
3399
3419
|
}
|
|
3400
3420
|
}
|
|
3401
|
-
$.create = (
|
|
3402
|
-
if (!Array.isArray(
|
|
3421
|
+
$.create = (n, e) => {
|
|
3422
|
+
if (!Array.isArray(n))
|
|
3403
3423
|
throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
|
|
3404
3424
|
return new $({
|
|
3405
|
-
items:
|
|
3425
|
+
items: n,
|
|
3406
3426
|
typeName: v.ZodTuple,
|
|
3407
3427
|
rest: null,
|
|
3408
|
-
...
|
|
3428
|
+
...A(e)
|
|
3409
3429
|
});
|
|
3410
3430
|
};
|
|
3411
3431
|
class ke extends b {
|
|
@@ -3416,83 +3436,83 @@ class ke extends b {
|
|
|
3416
3436
|
return this._def.valueType;
|
|
3417
3437
|
}
|
|
3418
3438
|
_parse(e) {
|
|
3419
|
-
const { status: t, ctx:
|
|
3420
|
-
if (
|
|
3421
|
-
return l(
|
|
3439
|
+
const { status: t, ctx: s } = this._processInputParams(e);
|
|
3440
|
+
if (s.parsedType !== f.map)
|
|
3441
|
+
return l(s, {
|
|
3422
3442
|
code: d.invalid_type,
|
|
3423
3443
|
expected: f.map,
|
|
3424
|
-
received:
|
|
3444
|
+
received: s.parsedType
|
|
3425
3445
|
}), g;
|
|
3426
|
-
const
|
|
3427
|
-
key:
|
|
3428
|
-
value:
|
|
3446
|
+
const r = this._def.keyType, a = this._def.valueType, i = [...s.data.entries()].map(([c, u], h) => ({
|
|
3447
|
+
key: r._parse(new M(s, c, s.path, [h, "key"])),
|
|
3448
|
+
value: a._parse(new M(s, u, s.path, [h, "value"]))
|
|
3429
3449
|
}));
|
|
3430
|
-
if (
|
|
3450
|
+
if (s.common.async) {
|
|
3431
3451
|
const c = /* @__PURE__ */ new Map();
|
|
3432
3452
|
return Promise.resolve().then(async () => {
|
|
3433
3453
|
for (const u of i) {
|
|
3434
|
-
const h = await u.key,
|
|
3435
|
-
if (h.status === "aborted" ||
|
|
3454
|
+
const h = await u.key, T = await u.value;
|
|
3455
|
+
if (h.status === "aborted" || T.status === "aborted")
|
|
3436
3456
|
return g;
|
|
3437
|
-
(h.status === "dirty" ||
|
|
3457
|
+
(h.status === "dirty" || T.status === "dirty") && t.dirty(), c.set(h.value, T.value);
|
|
3438
3458
|
}
|
|
3439
3459
|
return { status: t.value, value: c };
|
|
3440
3460
|
});
|
|
3441
3461
|
} else {
|
|
3442
3462
|
const c = /* @__PURE__ */ new Map();
|
|
3443
3463
|
for (const u of i) {
|
|
3444
|
-
const h = u.key,
|
|
3445
|
-
if (h.status === "aborted" ||
|
|
3464
|
+
const h = u.key, T = u.value;
|
|
3465
|
+
if (h.status === "aborted" || T.status === "aborted")
|
|
3446
3466
|
return g;
|
|
3447
|
-
(h.status === "dirty" ||
|
|
3467
|
+
(h.status === "dirty" || T.status === "dirty") && t.dirty(), c.set(h.value, T.value);
|
|
3448
3468
|
}
|
|
3449
3469
|
return { status: t.value, value: c };
|
|
3450
3470
|
}
|
|
3451
3471
|
}
|
|
3452
3472
|
}
|
|
3453
|
-
ke.create = (
|
|
3473
|
+
ke.create = (n, e, t) => new ke({
|
|
3454
3474
|
valueType: e,
|
|
3455
|
-
keyType:
|
|
3475
|
+
keyType: n,
|
|
3456
3476
|
typeName: v.ZodMap,
|
|
3457
|
-
...
|
|
3477
|
+
...A(t)
|
|
3458
3478
|
});
|
|
3459
3479
|
class X extends b {
|
|
3460
3480
|
_parse(e) {
|
|
3461
|
-
const { status: t, ctx:
|
|
3462
|
-
if (
|
|
3463
|
-
return l(
|
|
3481
|
+
const { status: t, ctx: s } = this._processInputParams(e);
|
|
3482
|
+
if (s.parsedType !== f.set)
|
|
3483
|
+
return l(s, {
|
|
3464
3484
|
code: d.invalid_type,
|
|
3465
3485
|
expected: f.set,
|
|
3466
|
-
received:
|
|
3486
|
+
received: s.parsedType
|
|
3467
3487
|
}), g;
|
|
3468
|
-
const
|
|
3469
|
-
|
|
3488
|
+
const r = this._def;
|
|
3489
|
+
r.minSize !== null && s.data.size < r.minSize.value && (l(s, {
|
|
3470
3490
|
code: d.too_small,
|
|
3471
|
-
minimum:
|
|
3491
|
+
minimum: r.minSize.value,
|
|
3472
3492
|
type: "set",
|
|
3473
3493
|
inclusive: !0,
|
|
3474
3494
|
exact: !1,
|
|
3475
|
-
message:
|
|
3476
|
-
}), t.dirty()),
|
|
3495
|
+
message: r.minSize.message
|
|
3496
|
+
}), t.dirty()), r.maxSize !== null && s.data.size > r.maxSize.value && (l(s, {
|
|
3477
3497
|
code: d.too_big,
|
|
3478
|
-
maximum:
|
|
3498
|
+
maximum: r.maxSize.value,
|
|
3479
3499
|
type: "set",
|
|
3480
3500
|
inclusive: !0,
|
|
3481
3501
|
exact: !1,
|
|
3482
|
-
message:
|
|
3502
|
+
message: r.maxSize.message
|
|
3483
3503
|
}), t.dirty());
|
|
3484
|
-
const
|
|
3504
|
+
const a = this._def.valueType;
|
|
3485
3505
|
function i(u) {
|
|
3486
3506
|
const h = /* @__PURE__ */ new Set();
|
|
3487
|
-
for (const
|
|
3488
|
-
if (
|
|
3507
|
+
for (const T of u) {
|
|
3508
|
+
if (T.status === "aborted")
|
|
3489
3509
|
return g;
|
|
3490
|
-
|
|
3510
|
+
T.status === "dirty" && t.dirty(), h.add(T.value);
|
|
3491
3511
|
}
|
|
3492
3512
|
return { status: t.value, value: h };
|
|
3493
3513
|
}
|
|
3494
|
-
const c = [...
|
|
3495
|
-
return
|
|
3514
|
+
const c = [...s.data.values()].map((u, h) => a._parse(new M(s, u, s.path, h)));
|
|
3515
|
+
return s.common.async ? Promise.all(c).then((u) => i(u)) : i(c);
|
|
3496
3516
|
}
|
|
3497
3517
|
min(e, t) {
|
|
3498
3518
|
return new X({
|
|
@@ -3513,12 +3533,12 @@ class X extends b {
|
|
|
3513
3533
|
return this.min(1, e);
|
|
3514
3534
|
}
|
|
3515
3535
|
}
|
|
3516
|
-
X.create = (
|
|
3517
|
-
valueType:
|
|
3536
|
+
X.create = (n, e) => new X({
|
|
3537
|
+
valueType: n,
|
|
3518
3538
|
minSize: null,
|
|
3519
3539
|
maxSize: null,
|
|
3520
3540
|
typeName: v.ZodSet,
|
|
3521
|
-
...
|
|
3541
|
+
...A(e)
|
|
3522
3542
|
});
|
|
3523
3543
|
class Ce extends b {
|
|
3524
3544
|
get schema() {
|
|
@@ -3529,10 +3549,10 @@ class Ce extends b {
|
|
|
3529
3549
|
return this._def.getter()._parse({ data: t.data, path: t.path, parent: t });
|
|
3530
3550
|
}
|
|
3531
3551
|
}
|
|
3532
|
-
Ce.create = (
|
|
3533
|
-
getter:
|
|
3552
|
+
Ce.create = (n, e) => new Ce({
|
|
3553
|
+
getter: n,
|
|
3534
3554
|
typeName: v.ZodLazy,
|
|
3535
|
-
...
|
|
3555
|
+
...A(e)
|
|
3536
3556
|
});
|
|
3537
3557
|
class we extends b {
|
|
3538
3558
|
_parse(e) {
|
|
@@ -3550,34 +3570,34 @@ class we extends b {
|
|
|
3550
3570
|
return this._def.value;
|
|
3551
3571
|
}
|
|
3552
3572
|
}
|
|
3553
|
-
we.create = (
|
|
3554
|
-
value:
|
|
3573
|
+
we.create = (n, e) => new we({
|
|
3574
|
+
value: n,
|
|
3555
3575
|
typeName: v.ZodLiteral,
|
|
3556
|
-
...
|
|
3576
|
+
...A(e)
|
|
3557
3577
|
});
|
|
3558
|
-
function
|
|
3559
|
-
return new
|
|
3560
|
-
values:
|
|
3578
|
+
function Ue(n, e) {
|
|
3579
|
+
return new q({
|
|
3580
|
+
values: n,
|
|
3561
3581
|
typeName: v.ZodEnum,
|
|
3562
|
-
...
|
|
3582
|
+
...A(e)
|
|
3563
3583
|
});
|
|
3564
3584
|
}
|
|
3565
|
-
class
|
|
3585
|
+
class q extends b {
|
|
3566
3586
|
_parse(e) {
|
|
3567
3587
|
if (typeof e.data != "string") {
|
|
3568
|
-
const t = this._getOrReturnCtx(e),
|
|
3588
|
+
const t = this._getOrReturnCtx(e), s = this._def.values;
|
|
3569
3589
|
return l(t, {
|
|
3570
|
-
expected: x.joinValues(
|
|
3590
|
+
expected: x.joinValues(s),
|
|
3571
3591
|
received: t.parsedType,
|
|
3572
3592
|
code: d.invalid_type
|
|
3573
3593
|
}), g;
|
|
3574
3594
|
}
|
|
3575
3595
|
if (this._cache || (this._cache = new Set(this._def.values)), !this._cache.has(e.data)) {
|
|
3576
|
-
const t = this._getOrReturnCtx(e),
|
|
3596
|
+
const t = this._getOrReturnCtx(e), s = this._def.values;
|
|
3577
3597
|
return l(t, {
|
|
3578
3598
|
received: t.data,
|
|
3579
3599
|
code: d.invalid_enum_value,
|
|
3580
|
-
options:
|
|
3600
|
+
options: s
|
|
3581
3601
|
}), g;
|
|
3582
3602
|
}
|
|
3583
3603
|
return C(e.data);
|
|
@@ -3604,36 +3624,36 @@ class W extends b {
|
|
|
3604
3624
|
return e;
|
|
3605
3625
|
}
|
|
3606
3626
|
extract(e, t = this._def) {
|
|
3607
|
-
return
|
|
3627
|
+
return q.create(e, {
|
|
3608
3628
|
...this._def,
|
|
3609
3629
|
...t
|
|
3610
3630
|
});
|
|
3611
3631
|
}
|
|
3612
3632
|
exclude(e, t = this._def) {
|
|
3613
|
-
return
|
|
3633
|
+
return q.create(this.options.filter((s) => !e.includes(s)), {
|
|
3614
3634
|
...this._def,
|
|
3615
3635
|
...t
|
|
3616
3636
|
});
|
|
3617
3637
|
}
|
|
3618
3638
|
}
|
|
3619
|
-
|
|
3639
|
+
q.create = Ue;
|
|
3620
3640
|
class Oe extends b {
|
|
3621
3641
|
_parse(e) {
|
|
3622
|
-
const t = x.getValidEnumValues(this._def.values),
|
|
3623
|
-
if (
|
|
3624
|
-
const
|
|
3625
|
-
return l(
|
|
3626
|
-
expected: x.joinValues(
|
|
3627
|
-
received:
|
|
3642
|
+
const t = x.getValidEnumValues(this._def.values), s = this._getOrReturnCtx(e);
|
|
3643
|
+
if (s.parsedType !== f.string && s.parsedType !== f.number) {
|
|
3644
|
+
const r = x.objectValues(t);
|
|
3645
|
+
return l(s, {
|
|
3646
|
+
expected: x.joinValues(r),
|
|
3647
|
+
received: s.parsedType,
|
|
3628
3648
|
code: d.invalid_type
|
|
3629
3649
|
}), g;
|
|
3630
3650
|
}
|
|
3631
3651
|
if (this._cache || (this._cache = new Set(x.getValidEnumValues(this._def.values))), !this._cache.has(e.data)) {
|
|
3632
|
-
const
|
|
3633
|
-
return l(
|
|
3634
|
-
received:
|
|
3652
|
+
const r = x.objectValues(t);
|
|
3653
|
+
return l(s, {
|
|
3654
|
+
received: s.data,
|
|
3635
3655
|
code: d.invalid_enum_value,
|
|
3636
|
-
options:
|
|
3656
|
+
options: r
|
|
3637
3657
|
}), g;
|
|
3638
3658
|
}
|
|
3639
3659
|
return C(e.data);
|
|
@@ -3642,12 +3662,12 @@ class Oe extends b {
|
|
|
3642
3662
|
return this._def.values;
|
|
3643
3663
|
}
|
|
3644
3664
|
}
|
|
3645
|
-
Oe.create = (
|
|
3646
|
-
values:
|
|
3665
|
+
Oe.create = (n, e) => new Oe({
|
|
3666
|
+
values: n,
|
|
3647
3667
|
typeName: v.ZodNativeEnum,
|
|
3648
|
-
...
|
|
3668
|
+
...A(e)
|
|
3649
3669
|
});
|
|
3650
|
-
class
|
|
3670
|
+
class re extends b {
|
|
3651
3671
|
unwrap() {
|
|
3652
3672
|
return this._def.type;
|
|
3653
3673
|
}
|
|
@@ -3659,19 +3679,19 @@ class ae extends b {
|
|
|
3659
3679
|
expected: f.promise,
|
|
3660
3680
|
received: t.parsedType
|
|
3661
3681
|
}), g;
|
|
3662
|
-
const
|
|
3663
|
-
return C(
|
|
3682
|
+
const s = t.parsedType === f.promise ? t.data : Promise.resolve(t.data);
|
|
3683
|
+
return C(s.then((r) => this._def.type.parseAsync(r, {
|
|
3664
3684
|
path: t.path,
|
|
3665
3685
|
errorMap: t.common.contextualErrorMap
|
|
3666
3686
|
})));
|
|
3667
3687
|
}
|
|
3668
3688
|
}
|
|
3669
|
-
|
|
3670
|
-
type:
|
|
3689
|
+
re.create = (n, e) => new re({
|
|
3690
|
+
type: n,
|
|
3671
3691
|
typeName: v.ZodPromise,
|
|
3672
|
-
...
|
|
3692
|
+
...A(e)
|
|
3673
3693
|
});
|
|
3674
|
-
class
|
|
3694
|
+
class G extends b {
|
|
3675
3695
|
innerType() {
|
|
3676
3696
|
return this._def.schema;
|
|
3677
3697
|
}
|
|
@@ -3679,24 +3699,24 @@ class q extends b {
|
|
|
3679
3699
|
return this._def.schema._def.typeName === v.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
|
|
3680
3700
|
}
|
|
3681
3701
|
_parse(e) {
|
|
3682
|
-
const { status: t, ctx:
|
|
3702
|
+
const { status: t, ctx: s } = this._processInputParams(e), r = this._def.effect || null, a = {
|
|
3683
3703
|
addIssue: (i) => {
|
|
3684
|
-
l(
|
|
3704
|
+
l(s, i), i.fatal ? t.abort() : t.dirty();
|
|
3685
3705
|
},
|
|
3686
3706
|
get path() {
|
|
3687
|
-
return
|
|
3707
|
+
return s.path;
|
|
3688
3708
|
}
|
|
3689
3709
|
};
|
|
3690
|
-
if (
|
|
3691
|
-
const i =
|
|
3692
|
-
if (
|
|
3710
|
+
if (a.addIssue = a.addIssue.bind(a), r.type === "preprocess") {
|
|
3711
|
+
const i = r.transform(s.data, a);
|
|
3712
|
+
if (s.common.async)
|
|
3693
3713
|
return Promise.resolve(i).then(async (c) => {
|
|
3694
3714
|
if (t.value === "aborted")
|
|
3695
3715
|
return g;
|
|
3696
3716
|
const u = await this._def.schema._parseAsync({
|
|
3697
3717
|
data: c,
|
|
3698
|
-
path:
|
|
3699
|
-
parent:
|
|
3718
|
+
path: s.path,
|
|
3719
|
+
parent: s
|
|
3700
3720
|
});
|
|
3701
3721
|
return u.status === "aborted" ? g : u.status === "dirty" || t.value === "dirty" ? J(u.value) : u;
|
|
3702
3722
|
});
|
|
@@ -3705,63 +3725,63 @@ class q extends b {
|
|
|
3705
3725
|
return g;
|
|
3706
3726
|
const c = this._def.schema._parseSync({
|
|
3707
3727
|
data: i,
|
|
3708
|
-
path:
|
|
3709
|
-
parent:
|
|
3728
|
+
path: s.path,
|
|
3729
|
+
parent: s
|
|
3710
3730
|
});
|
|
3711
3731
|
return c.status === "aborted" ? g : c.status === "dirty" || t.value === "dirty" ? J(c.value) : c;
|
|
3712
3732
|
}
|
|
3713
3733
|
}
|
|
3714
|
-
if (
|
|
3734
|
+
if (r.type === "refinement") {
|
|
3715
3735
|
const i = (c) => {
|
|
3716
|
-
const u =
|
|
3717
|
-
if (
|
|
3736
|
+
const u = r.refinement(c, a);
|
|
3737
|
+
if (s.common.async)
|
|
3718
3738
|
return Promise.resolve(u);
|
|
3719
3739
|
if (u instanceof Promise)
|
|
3720
3740
|
throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
3721
3741
|
return c;
|
|
3722
3742
|
};
|
|
3723
|
-
if (
|
|
3743
|
+
if (s.common.async === !1) {
|
|
3724
3744
|
const c = this._def.schema._parseSync({
|
|
3725
|
-
data:
|
|
3726
|
-
path:
|
|
3727
|
-
parent:
|
|
3745
|
+
data: s.data,
|
|
3746
|
+
path: s.path,
|
|
3747
|
+
parent: s
|
|
3728
3748
|
});
|
|
3729
3749
|
return c.status === "aborted" ? g : (c.status === "dirty" && t.dirty(), i(c.value), { status: t.value, value: c.value });
|
|
3730
3750
|
} else
|
|
3731
|
-
return this._def.schema._parseAsync({ data:
|
|
3751
|
+
return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((c) => c.status === "aborted" ? g : (c.status === "dirty" && t.dirty(), i(c.value).then(() => ({ status: t.value, value: c.value }))));
|
|
3732
3752
|
}
|
|
3733
|
-
if (
|
|
3734
|
-
if (
|
|
3753
|
+
if (r.type === "transform")
|
|
3754
|
+
if (s.common.async === !1) {
|
|
3735
3755
|
const i = this._def.schema._parseSync({
|
|
3736
|
-
data:
|
|
3737
|
-
path:
|
|
3738
|
-
parent:
|
|
3756
|
+
data: s.data,
|
|
3757
|
+
path: s.path,
|
|
3758
|
+
parent: s
|
|
3739
3759
|
});
|
|
3740
|
-
if (!
|
|
3760
|
+
if (!H(i))
|
|
3741
3761
|
return g;
|
|
3742
|
-
const c =
|
|
3762
|
+
const c = r.transform(i.value, a);
|
|
3743
3763
|
if (c instanceof Promise)
|
|
3744
3764
|
throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
3745
3765
|
return { status: t.value, value: c };
|
|
3746
3766
|
} else
|
|
3747
|
-
return this._def.schema._parseAsync({ data:
|
|
3767
|
+
return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((i) => H(i) ? Promise.resolve(r.transform(i.value, a)).then((c) => ({
|
|
3748
3768
|
status: t.value,
|
|
3749
3769
|
value: c
|
|
3750
3770
|
})) : g);
|
|
3751
|
-
x.assertNever(
|
|
3771
|
+
x.assertNever(r);
|
|
3752
3772
|
}
|
|
3753
3773
|
}
|
|
3754
|
-
|
|
3755
|
-
schema:
|
|
3774
|
+
G.create = (n, e, t) => new G({
|
|
3775
|
+
schema: n,
|
|
3756
3776
|
typeName: v.ZodEffects,
|
|
3757
3777
|
effect: e,
|
|
3758
|
-
...
|
|
3778
|
+
...A(t)
|
|
3759
3779
|
});
|
|
3760
|
-
|
|
3780
|
+
G.createWithPreprocess = (n, e, t) => new G({
|
|
3761
3781
|
schema: e,
|
|
3762
|
-
effect: { type: "preprocess", transform:
|
|
3782
|
+
effect: { type: "preprocess", transform: n },
|
|
3763
3783
|
typeName: v.ZodEffects,
|
|
3764
|
-
...
|
|
3784
|
+
...A(t)
|
|
3765
3785
|
});
|
|
3766
3786
|
class B extends b {
|
|
3767
3787
|
_parse(e) {
|
|
@@ -3771,12 +3791,12 @@ class B extends b {
|
|
|
3771
3791
|
return this._def.innerType;
|
|
3772
3792
|
}
|
|
3773
3793
|
}
|
|
3774
|
-
B.create = (
|
|
3775
|
-
innerType:
|
|
3794
|
+
B.create = (n, e) => new B({
|
|
3795
|
+
innerType: n,
|
|
3776
3796
|
typeName: v.ZodOptional,
|
|
3777
|
-
...
|
|
3797
|
+
...A(e)
|
|
3778
3798
|
});
|
|
3779
|
-
class
|
|
3799
|
+
class K extends b {
|
|
3780
3800
|
_parse(e) {
|
|
3781
3801
|
return this._getType(e) === f.null ? C(null) : this._def.innerType._parse(e);
|
|
3782
3802
|
}
|
|
@@ -3784,17 +3804,17 @@ class G extends b {
|
|
|
3784
3804
|
return this._def.innerType;
|
|
3785
3805
|
}
|
|
3786
3806
|
}
|
|
3787
|
-
|
|
3788
|
-
innerType:
|
|
3807
|
+
K.create = (n, e) => new K({
|
|
3808
|
+
innerType: n,
|
|
3789
3809
|
typeName: v.ZodNullable,
|
|
3790
|
-
...
|
|
3810
|
+
...A(e)
|
|
3791
3811
|
});
|
|
3792
3812
|
class de extends b {
|
|
3793
3813
|
_parse(e) {
|
|
3794
3814
|
const { ctx: t } = this._processInputParams(e);
|
|
3795
|
-
let
|
|
3796
|
-
return t.parsedType === f.undefined && (
|
|
3797
|
-
data:
|
|
3815
|
+
let s = t.data;
|
|
3816
|
+
return t.parsedType === f.undefined && (s = this._def.defaultValue()), this._def.innerType._parse({
|
|
3817
|
+
data: s,
|
|
3798
3818
|
path: t.path,
|
|
3799
3819
|
parent: t
|
|
3800
3820
|
});
|
|
@@ -3803,42 +3823,42 @@ class de extends b {
|
|
|
3803
3823
|
return this._def.innerType;
|
|
3804
3824
|
}
|
|
3805
3825
|
}
|
|
3806
|
-
de.create = (
|
|
3807
|
-
innerType:
|
|
3826
|
+
de.create = (n, e) => new de({
|
|
3827
|
+
innerType: n,
|
|
3808
3828
|
typeName: v.ZodDefault,
|
|
3809
3829
|
defaultValue: typeof e.default == "function" ? e.default : () => e.default,
|
|
3810
|
-
...
|
|
3830
|
+
...A(e)
|
|
3811
3831
|
});
|
|
3812
3832
|
class ue extends b {
|
|
3813
3833
|
_parse(e) {
|
|
3814
|
-
const { ctx: t } = this._processInputParams(e),
|
|
3834
|
+
const { ctx: t } = this._processInputParams(e), s = {
|
|
3815
3835
|
...t,
|
|
3816
3836
|
common: {
|
|
3817
3837
|
...t.common,
|
|
3818
3838
|
issues: []
|
|
3819
3839
|
}
|
|
3820
|
-
},
|
|
3821
|
-
data:
|
|
3822
|
-
path:
|
|
3840
|
+
}, r = this._def.innerType._parse({
|
|
3841
|
+
data: s.data,
|
|
3842
|
+
path: s.path,
|
|
3823
3843
|
parent: {
|
|
3824
|
-
...
|
|
3844
|
+
...s
|
|
3825
3845
|
}
|
|
3826
3846
|
});
|
|
3827
|
-
return ee(
|
|
3847
|
+
return ee(r) ? r.then((a) => ({
|
|
3828
3848
|
status: "valid",
|
|
3829
|
-
value:
|
|
3849
|
+
value: a.status === "valid" ? a.value : this._def.catchValue({
|
|
3830
3850
|
get error() {
|
|
3831
|
-
return new R(
|
|
3851
|
+
return new R(s.common.issues);
|
|
3832
3852
|
},
|
|
3833
|
-
input:
|
|
3853
|
+
input: s.data
|
|
3834
3854
|
})
|
|
3835
3855
|
})) : {
|
|
3836
3856
|
status: "valid",
|
|
3837
|
-
value:
|
|
3857
|
+
value: r.status === "valid" ? r.value : this._def.catchValue({
|
|
3838
3858
|
get error() {
|
|
3839
|
-
return new R(
|
|
3859
|
+
return new R(s.common.issues);
|
|
3840
3860
|
},
|
|
3841
|
-
input:
|
|
3861
|
+
input: s.data
|
|
3842
3862
|
})
|
|
3843
3863
|
};
|
|
3844
3864
|
}
|
|
@@ -3846,34 +3866,34 @@ class ue extends b {
|
|
|
3846
3866
|
return this._def.innerType;
|
|
3847
3867
|
}
|
|
3848
3868
|
}
|
|
3849
|
-
ue.create = (
|
|
3850
|
-
innerType:
|
|
3869
|
+
ue.create = (n, e) => new ue({
|
|
3870
|
+
innerType: n,
|
|
3851
3871
|
typeName: v.ZodCatch,
|
|
3852
3872
|
catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
|
|
3853
|
-
...
|
|
3873
|
+
...A(e)
|
|
3854
3874
|
});
|
|
3855
3875
|
class Re extends b {
|
|
3856
3876
|
_parse(e) {
|
|
3857
3877
|
if (this._getType(e) !== f.nan) {
|
|
3858
|
-
const
|
|
3859
|
-
return l(
|
|
3878
|
+
const s = this._getOrReturnCtx(e);
|
|
3879
|
+
return l(s, {
|
|
3860
3880
|
code: d.invalid_type,
|
|
3861
3881
|
expected: f.nan,
|
|
3862
|
-
received:
|
|
3882
|
+
received: s.parsedType
|
|
3863
3883
|
}), g;
|
|
3864
3884
|
}
|
|
3865
3885
|
return { status: "valid", value: e.data };
|
|
3866
3886
|
}
|
|
3867
3887
|
}
|
|
3868
|
-
Re.create = (
|
|
3888
|
+
Re.create = (n) => new Re({
|
|
3869
3889
|
typeName: v.ZodNaN,
|
|
3870
|
-
...
|
|
3890
|
+
...A(n)
|
|
3871
3891
|
});
|
|
3872
|
-
class
|
|
3892
|
+
class Ut extends b {
|
|
3873
3893
|
_parse(e) {
|
|
3874
|
-
const { ctx: t } = this._processInputParams(e),
|
|
3894
|
+
const { ctx: t } = this._processInputParams(e), s = t.data;
|
|
3875
3895
|
return this._def.type._parse({
|
|
3876
|
-
data:
|
|
3896
|
+
data: s,
|
|
3877
3897
|
path: t.path,
|
|
3878
3898
|
parent: t
|
|
3879
3899
|
});
|
|
@@ -3884,33 +3904,33 @@ class Vt extends b {
|
|
|
3884
3904
|
}
|
|
3885
3905
|
class he extends b {
|
|
3886
3906
|
_parse(e) {
|
|
3887
|
-
const { status: t, ctx:
|
|
3888
|
-
if (
|
|
3907
|
+
const { status: t, ctx: s } = this._processInputParams(e);
|
|
3908
|
+
if (s.common.async)
|
|
3889
3909
|
return (async () => {
|
|
3890
|
-
const
|
|
3891
|
-
data:
|
|
3892
|
-
path:
|
|
3893
|
-
parent:
|
|
3910
|
+
const a = await this._def.in._parseAsync({
|
|
3911
|
+
data: s.data,
|
|
3912
|
+
path: s.path,
|
|
3913
|
+
parent: s
|
|
3894
3914
|
});
|
|
3895
|
-
return
|
|
3896
|
-
data:
|
|
3897
|
-
path:
|
|
3898
|
-
parent:
|
|
3915
|
+
return a.status === "aborted" ? g : a.status === "dirty" ? (t.dirty(), J(a.value)) : this._def.out._parseAsync({
|
|
3916
|
+
data: a.value,
|
|
3917
|
+
path: s.path,
|
|
3918
|
+
parent: s
|
|
3899
3919
|
});
|
|
3900
3920
|
})();
|
|
3901
3921
|
{
|
|
3902
|
-
const
|
|
3903
|
-
data:
|
|
3904
|
-
path:
|
|
3905
|
-
parent:
|
|
3922
|
+
const r = this._def.in._parseSync({
|
|
3923
|
+
data: s.data,
|
|
3924
|
+
path: s.path,
|
|
3925
|
+
parent: s
|
|
3906
3926
|
});
|
|
3907
|
-
return
|
|
3927
|
+
return r.status === "aborted" ? g : r.status === "dirty" ? (t.dirty(), {
|
|
3908
3928
|
status: "dirty",
|
|
3909
|
-
value:
|
|
3929
|
+
value: r.value
|
|
3910
3930
|
}) : this._def.out._parseSync({
|
|
3911
|
-
data:
|
|
3912
|
-
path:
|
|
3913
|
-
parent:
|
|
3931
|
+
data: r.value,
|
|
3932
|
+
path: s.path,
|
|
3933
|
+
parent: s
|
|
3914
3934
|
});
|
|
3915
3935
|
}
|
|
3916
3936
|
}
|
|
@@ -3924,64 +3944,64 @@ class he extends b {
|
|
|
3924
3944
|
}
|
|
3925
3945
|
class le extends b {
|
|
3926
3946
|
_parse(e) {
|
|
3927
|
-
const t = this._def.innerType._parse(e),
|
|
3928
|
-
return ee(t) ? t.then((
|
|
3947
|
+
const t = this._def.innerType._parse(e), s = (r) => (H(r) && (r.value = Object.freeze(r.value)), r);
|
|
3948
|
+
return ee(t) ? t.then((r) => s(r)) : s(t);
|
|
3929
3949
|
}
|
|
3930
3950
|
unwrap() {
|
|
3931
3951
|
return this._def.innerType;
|
|
3932
3952
|
}
|
|
3933
3953
|
}
|
|
3934
|
-
le.create = (
|
|
3935
|
-
innerType:
|
|
3954
|
+
le.create = (n, e) => new le({
|
|
3955
|
+
innerType: n,
|
|
3936
3956
|
typeName: v.ZodReadonly,
|
|
3937
|
-
...
|
|
3957
|
+
...A(e)
|
|
3938
3958
|
});
|
|
3939
3959
|
var v;
|
|
3940
|
-
(function(
|
|
3941
|
-
|
|
3960
|
+
(function(n) {
|
|
3961
|
+
n.ZodString = "ZodString", n.ZodNumber = "ZodNumber", n.ZodNaN = "ZodNaN", n.ZodBigInt = "ZodBigInt", n.ZodBoolean = "ZodBoolean", n.ZodDate = "ZodDate", n.ZodSymbol = "ZodSymbol", n.ZodUndefined = "ZodUndefined", n.ZodNull = "ZodNull", n.ZodAny = "ZodAny", n.ZodUnknown = "ZodUnknown", n.ZodNever = "ZodNever", n.ZodVoid = "ZodVoid", n.ZodArray = "ZodArray", n.ZodObject = "ZodObject", n.ZodUnion = "ZodUnion", n.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", n.ZodIntersection = "ZodIntersection", n.ZodTuple = "ZodTuple", n.ZodRecord = "ZodRecord", n.ZodMap = "ZodMap", n.ZodSet = "ZodSet", n.ZodFunction = "ZodFunction", n.ZodLazy = "ZodLazy", n.ZodLiteral = "ZodLiteral", n.ZodEnum = "ZodEnum", n.ZodEffects = "ZodEffects", n.ZodNativeEnum = "ZodNativeEnum", n.ZodOptional = "ZodOptional", n.ZodNullable = "ZodNullable", n.ZodDefault = "ZodDefault", n.ZodCatch = "ZodCatch", n.ZodPromise = "ZodPromise", n.ZodBranded = "ZodBranded", n.ZodPipeline = "ZodPipeline", n.ZodReadonly = "ZodReadonly";
|
|
3942
3962
|
})(v || (v = {}));
|
|
3943
|
-
const L = P.create, Zt =
|
|
3944
|
-
|
|
3963
|
+
const L = P.create, Zt = z.create, $t = W.create;
|
|
3964
|
+
V.create;
|
|
3945
3965
|
O.create;
|
|
3946
|
-
const Ft =
|
|
3947
|
-
|
|
3966
|
+
const Ft = N.create, jt = ne.create;
|
|
3967
|
+
se.create;
|
|
3948
3968
|
$.create;
|
|
3949
|
-
|
|
3950
|
-
|
|
3969
|
+
q.create;
|
|
3970
|
+
re.create;
|
|
3951
3971
|
B.create;
|
|
3952
|
-
|
|
3972
|
+
K.create;
|
|
3953
3973
|
function Ht() {
|
|
3954
|
-
const
|
|
3974
|
+
const n = /* @__PURE__ */ new Map();
|
|
3955
3975
|
return {
|
|
3956
3976
|
on(e, t) {
|
|
3957
|
-
let
|
|
3958
|
-
return
|
|
3959
|
-
|
|
3977
|
+
let s = n.get(e);
|
|
3978
|
+
return s || (s = /* @__PURE__ */ new Set(), n.set(e, s)), s.add(t), () => {
|
|
3979
|
+
s == null || s.delete(t), s && s.size === 0 && n.delete(e);
|
|
3960
3980
|
};
|
|
3961
3981
|
},
|
|
3962
3982
|
emit(e, ...t) {
|
|
3963
|
-
const
|
|
3964
|
-
if (!(!
|
|
3965
|
-
for (const
|
|
3983
|
+
const s = n.get(e);
|
|
3984
|
+
if (!(!s || s.size === 0))
|
|
3985
|
+
for (const r of s)
|
|
3966
3986
|
try {
|
|
3967
|
-
|
|
3968
|
-
} catch (
|
|
3987
|
+
r(...t);
|
|
3988
|
+
} catch (a) {
|
|
3969
3989
|
console.error(
|
|
3970
3990
|
`Error in event handler for "${String(e)}":`,
|
|
3971
|
-
|
|
3991
|
+
a
|
|
3972
3992
|
);
|
|
3973
3993
|
}
|
|
3974
3994
|
},
|
|
3975
3995
|
off(e, t) {
|
|
3976
|
-
const
|
|
3977
|
-
|
|
3996
|
+
const s = n.get(e);
|
|
3997
|
+
s && (s.delete(t), s.size === 0 && n.delete(e));
|
|
3978
3998
|
},
|
|
3979
3999
|
clear() {
|
|
3980
|
-
|
|
4000
|
+
n.clear();
|
|
3981
4001
|
}
|
|
3982
4002
|
};
|
|
3983
4003
|
}
|
|
3984
|
-
class
|
|
4004
|
+
class Dn {
|
|
3985
4005
|
constructor(e, t) {
|
|
3986
4006
|
/** Event emitter for this action */
|
|
3987
4007
|
I(this, "eventEmitter");
|
|
@@ -4008,25 +4028,25 @@ class Rs {
|
|
|
4008
4028
|
*
|
|
4009
4029
|
* Uses explicit switch to avoid dynamic property access (security best practice).
|
|
4010
4030
|
*/
|
|
4011
|
-
log(e, t,
|
|
4031
|
+
log(e, t, s) {
|
|
4012
4032
|
if (!this.logger) return;
|
|
4013
|
-
const
|
|
4033
|
+
const r = {
|
|
4014
4034
|
action: this.constructor.name,
|
|
4015
4035
|
status: this._status,
|
|
4016
|
-
...
|
|
4036
|
+
...s
|
|
4017
4037
|
};
|
|
4018
4038
|
switch (e) {
|
|
4019
4039
|
case "debug":
|
|
4020
|
-
this.logger.debug(t,
|
|
4040
|
+
this.logger.debug(t, r);
|
|
4021
4041
|
break;
|
|
4022
4042
|
case "info":
|
|
4023
|
-
this.logger.info(t,
|
|
4043
|
+
this.logger.info(t, r);
|
|
4024
4044
|
break;
|
|
4025
4045
|
case "warn":
|
|
4026
|
-
this.logger.warn(t,
|
|
4046
|
+
this.logger.warn(t, r);
|
|
4027
4047
|
break;
|
|
4028
4048
|
case "error":
|
|
4029
|
-
this.logger.error(t,
|
|
4049
|
+
this.logger.error(t, r);
|
|
4030
4050
|
break;
|
|
4031
4051
|
}
|
|
4032
4052
|
}
|
|
@@ -4084,11 +4104,11 @@ class Rs {
|
|
|
4084
4104
|
* @throws LombardError if current status is not in expected list
|
|
4085
4105
|
*/
|
|
4086
4106
|
assertStatus(e, t) {
|
|
4087
|
-
const
|
|
4088
|
-
if (!
|
|
4107
|
+
const s = Array.isArray(e) ? e : [e];
|
|
4108
|
+
if (!s.includes(this._status))
|
|
4089
4109
|
throw new E(
|
|
4090
4110
|
Z.INVALID_STATE,
|
|
4091
|
-
`Cannot ${t} while status is ${this._status}, allowed: ${
|
|
4111
|
+
`Cannot ${t} while status is ${this._status}, allowed: ${s.join(", ")}`
|
|
4092
4112
|
);
|
|
4093
4113
|
}
|
|
4094
4114
|
// ─────────────────────────────────────────────────────────────────────────
|
|
@@ -4188,22 +4208,22 @@ class Rs {
|
|
|
4188
4208
|
* ```
|
|
4189
4209
|
*/
|
|
4190
4210
|
async act(e, t) {
|
|
4191
|
-
const
|
|
4192
|
-
this.log("debug", `Starting ${
|
|
4211
|
+
const s = performance.now(), r = t ?? "operation";
|
|
4212
|
+
this.log("debug", `Starting ${r}`, { step: String(r) }), this.clearError(), this.setLoading(!0);
|
|
4193
4213
|
try {
|
|
4194
|
-
const
|
|
4195
|
-
return this.recordTiming(String(
|
|
4196
|
-
step: String(
|
|
4214
|
+
const a = await e(), i = performance.now() - s;
|
|
4215
|
+
return this.recordTiming(String(r), i), this.log("info", `Completed ${r}`, {
|
|
4216
|
+
step: String(r),
|
|
4197
4217
|
duration: Math.round(i)
|
|
4198
|
-
}), t !== void 0 && this.updateStatus(t),
|
|
4199
|
-
} catch (
|
|
4200
|
-
const i = performance.now() -
|
|
4201
|
-
return this.recordTiming(String(
|
|
4202
|
-
step: String(
|
|
4218
|
+
}), t !== void 0 && this.updateStatus(t), a;
|
|
4219
|
+
} catch (a) {
|
|
4220
|
+
const i = performance.now() - s, c = a instanceof E ? a : pe(a);
|
|
4221
|
+
return this.recordTiming(String(r), i), this.log("error", `Failed ${r}`, {
|
|
4222
|
+
step: String(r),
|
|
4203
4223
|
duration: Math.round(i),
|
|
4204
4224
|
errorCode: c.code,
|
|
4205
4225
|
errorMessage: c.message
|
|
4206
|
-
}), this.handleFailure(
|
|
4226
|
+
}), this.handleFailure(a);
|
|
4207
4227
|
} finally {
|
|
4208
4228
|
this.setLoading(!1);
|
|
4209
4229
|
}
|
|
@@ -4253,91 +4273,91 @@ class Rs {
|
|
|
4253
4273
|
this.eventEmitter.clear();
|
|
4254
4274
|
}
|
|
4255
4275
|
}
|
|
4256
|
-
function zt(
|
|
4257
|
-
if (!
|
|
4276
|
+
function zt(n) {
|
|
4277
|
+
if (!n || typeof n != "string")
|
|
4258
4278
|
return !1;
|
|
4259
|
-
if (
|
|
4279
|
+
if (n.startsWith("bc1") || n.startsWith("tb1"))
|
|
4260
4280
|
try {
|
|
4261
|
-
return me.address.fromBech32(
|
|
4281
|
+
return me.address.fromBech32(n), !0;
|
|
4262
4282
|
} catch {
|
|
4263
4283
|
return !1;
|
|
4264
4284
|
}
|
|
4265
4285
|
try {
|
|
4266
|
-
return me.address.fromBase58Check(
|
|
4286
|
+
return me.address.fromBase58Check(n), !0;
|
|
4267
4287
|
} catch {
|
|
4268
4288
|
return !1;
|
|
4269
4289
|
}
|
|
4270
4290
|
}
|
|
4271
|
-
function Wt(
|
|
4291
|
+
function Wt(n) {
|
|
4272
4292
|
const e = /^[1-9A-HJ-NP-Za-km-z]+$/;
|
|
4273
|
-
if (!
|
|
4293
|
+
if (!n || typeof n != "string" || !e.test(n) || n.length < 32 || n.length > 44)
|
|
4274
4294
|
return !1;
|
|
4275
4295
|
try {
|
|
4276
|
-
return qt(
|
|
4296
|
+
return qt(n).length === 32;
|
|
4277
4297
|
} catch {
|
|
4278
4298
|
return !1;
|
|
4279
4299
|
}
|
|
4280
4300
|
}
|
|
4281
|
-
function qt(
|
|
4301
|
+
function qt(n) {
|
|
4282
4302
|
const e = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz", t = {};
|
|
4283
4303
|
for (let u = 0; u < e.length; u++)
|
|
4284
4304
|
t[e[u]] = u;
|
|
4285
|
-
if (
|
|
4305
|
+
if (n.length === 0)
|
|
4286
4306
|
return new Uint8Array(0);
|
|
4287
|
-
let
|
|
4288
|
-
for (let u = 0; u <
|
|
4289
|
-
|
|
4290
|
-
const
|
|
4291
|
-
for (let u =
|
|
4292
|
-
const h = t[
|
|
4307
|
+
let s = 0;
|
|
4308
|
+
for (let u = 0; u < n.length && n[u] === "1"; u++)
|
|
4309
|
+
s++;
|
|
4310
|
+
const r = Math.ceil(n.length * Math.log(58) / Math.log(256)), a = new Uint8Array(r);
|
|
4311
|
+
for (let u = s; u < n.length; u++) {
|
|
4312
|
+
const h = t[n[u]];
|
|
4293
4313
|
if (h === void 0)
|
|
4294
|
-
throw new Error(`Invalid base58 character: ${
|
|
4295
|
-
let
|
|
4296
|
-
for (let w =
|
|
4297
|
-
|
|
4314
|
+
throw new Error(`Invalid base58 character: ${n[u]}`);
|
|
4315
|
+
let T = h;
|
|
4316
|
+
for (let w = r - 1; w >= 0; w--)
|
|
4317
|
+
T += 58 * a[w], a[w] = T % 256, T = Math.floor(T / 256);
|
|
4298
4318
|
}
|
|
4299
4319
|
let i = 0;
|
|
4300
|
-
for (; i <
|
|
4320
|
+
for (; i < a.length && a[i] === 0; )
|
|
4301
4321
|
i++;
|
|
4302
|
-
const c = new Uint8Array(
|
|
4303
|
-
return c.fill(0, 0,
|
|
4322
|
+
const c = new Uint8Array(s + (a.length - i));
|
|
4323
|
+
return c.fill(0, 0, s), c.set(a.subarray(i), s), c;
|
|
4304
4324
|
}
|
|
4305
|
-
function Ze(
|
|
4325
|
+
function Ze(n) {
|
|
4306
4326
|
const e = L({ message: "Amount is required" }).min(1, "Amount is required").refine((t) => t !== "0", {
|
|
4307
4327
|
message: "Amount must be greater than 0"
|
|
4308
4328
|
}).refine(
|
|
4309
4329
|
(t) => {
|
|
4310
|
-
const
|
|
4311
|
-
return !Number.isNaN(
|
|
4330
|
+
const s = Number.parseFloat(t);
|
|
4331
|
+
return !Number.isNaN(s) && s > 0;
|
|
4312
4332
|
},
|
|
4313
4333
|
{ message: "Invalid amount format" }
|
|
4314
4334
|
);
|
|
4315
|
-
return
|
|
4316
|
-
(t) => Number.parseFloat(t) >=
|
|
4317
|
-
{ message: `Amount must be at least ${
|
|
4335
|
+
return n !== void 0 && n > 0 ? e.refine(
|
|
4336
|
+
(t) => Number.parseFloat(t) >= n,
|
|
4337
|
+
{ message: `Amount must be at least ${n}` }
|
|
4318
4338
|
) : e;
|
|
4319
4339
|
}
|
|
4320
|
-
const Gt = Ze(), Kt = Ze(Xe),
|
|
4321
|
-
jt([$t(), Zt()]).refine((
|
|
4322
|
-
const
|
|
4340
|
+
const Gt = Ze(), Kt = Ze(Xe), Pn = Gt;
|
|
4341
|
+
jt([$t(), Zt()]).refine((n) => n > 0, { message: "Amount must be greater than 0" });
|
|
4342
|
+
const Bn = L({ message: "Address is required" }).regex(/^0x[a-fA-F0-9]{40}$/, "Invalid EVM address format"), Mn = L({ message: "Address is required" }).refine(Wt, { message: "Invalid Solana address format" }), Vn = L({ message: "Address is required" }).regex(/^0x[a-fA-F0-9]{64}$/, "Invalid Sui address format"), Un = L({ message: "Address is required" }).regex(/^0x[a-fA-F0-9]{1,64}$/, "Invalid Starknet address format"), Zn = L({ message: "Address is required" }).refine(zt, { message: "Invalid Bitcoin address format" }), Yt = L().optional();
|
|
4323
4343
|
L().regex(/^0x[a-fA-F0-9]{64}$/, "Invalid transaction hash");
|
|
4324
4344
|
Ft({
|
|
4325
4345
|
amount: Kt,
|
|
4326
4346
|
recipient: L({ message: "Recipient is required" }).min(1, "Recipient is required"),
|
|
4327
4347
|
referralCode: Yt
|
|
4328
4348
|
});
|
|
4329
|
-
function
|
|
4330
|
-
const
|
|
4331
|
-
if (!
|
|
4332
|
-
const
|
|
4333
|
-
throw
|
|
4349
|
+
function $n(n, e, t = {}) {
|
|
4350
|
+
const s = n.safeParse(e);
|
|
4351
|
+
if (!s.success) {
|
|
4352
|
+
const r = s.error.issues[0], a = r == null ? void 0 : r.path[0], i = (r == null ? void 0 : r.message) ?? "Invalid parameter";
|
|
4353
|
+
throw a === "amount" ? E.invalidAmount(i) : a === "recipient" ? E.invalidAddress(
|
|
4334
4354
|
e == null ? void 0 : e.recipient,
|
|
4335
4355
|
t.destChain
|
|
4336
|
-
) : E.invalidParameter(String(
|
|
4356
|
+
) : E.invalidParameter(String(a), i);
|
|
4337
4357
|
}
|
|
4338
|
-
return
|
|
4358
|
+
return s.data;
|
|
4339
4359
|
}
|
|
4340
|
-
const
|
|
4360
|
+
const Fn = {
|
|
4341
4361
|
/** Initial state - ready for prepare() */
|
|
4342
4362
|
IDLE: "idle",
|
|
4343
4363
|
// Authorization states (mutually exclusive - action uses one based on config)
|
|
@@ -4351,7 +4371,7 @@ const Zs = {
|
|
|
4351
4371
|
READY: "ready",
|
|
4352
4372
|
/** Deposit address generated - awaiting BTC deposit */
|
|
4353
4373
|
ADDRESS_READY: "address_ready"
|
|
4354
|
-
},
|
|
4374
|
+
}, jn = {
|
|
4355
4375
|
IDLE: "idle",
|
|
4356
4376
|
/** User needs to sign fee authorization (Ethereum/Sepolia only) */
|
|
4357
4377
|
NEEDS_FEE_AUTHORIZATION: "needs_fee_authorization",
|
|
@@ -4360,78 +4380,79 @@ const Zs = {
|
|
|
4360
4380
|
READY: "ready",
|
|
4361
4381
|
CONFIRMING: "confirming",
|
|
4362
4382
|
COMPLETED: "completed"
|
|
4363
|
-
},
|
|
4383
|
+
}, Hn = {
|
|
4364
4384
|
IDLE: "idle",
|
|
4365
4385
|
READY: "ready",
|
|
4366
4386
|
CONFIRMING: "confirming",
|
|
4367
4387
|
COMPLETED: "completed"
|
|
4368
4388
|
};
|
|
4369
4389
|
export {
|
|
4370
|
-
|
|
4371
|
-
|
|
4372
|
-
|
|
4373
|
-
|
|
4374
|
-
|
|
4375
|
-
|
|
4376
|
-
ft as
|
|
4377
|
-
|
|
4378
|
-
|
|
4379
|
-
|
|
4380
|
-
|
|
4381
|
-
|
|
4382
|
-
|
|
4383
|
-
|
|
4384
|
-
|
|
4385
|
-
|
|
4386
|
-
|
|
4387
|
-
|
|
4388
|
-
|
|
4389
|
-
|
|
4390
|
-
|
|
4391
|
-
|
|
4392
|
-
|
|
4393
|
-
|
|
4394
|
-
|
|
4395
|
-
|
|
4396
|
-
|
|
4397
|
-
|
|
4398
|
-
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
|
|
4405
|
-
|
|
4406
|
-
|
|
4407
|
-
|
|
4408
|
-
|
|
4409
|
-
|
|
4410
|
-
|
|
4411
|
-
|
|
4412
|
-
|
|
4413
|
-
|
|
4414
|
-
|
|
4415
|
-
|
|
4416
|
-
|
|
4417
|
-
|
|
4418
|
-
|
|
4419
|
-
|
|
4420
|
-
|
|
4421
|
-
|
|
4422
|
-
|
|
4423
|
-
|
|
4424
|
-
|
|
4425
|
-
|
|
4426
|
-
|
|
4427
|
-
|
|
4428
|
-
|
|
4429
|
-
|
|
4430
|
-
|
|
4431
|
-
|
|
4432
|
-
|
|
4433
|
-
|
|
4434
|
-
|
|
4435
|
-
|
|
4390
|
+
S as ASSET_CATALOG,
|
|
4391
|
+
Dn as BaseAction,
|
|
4392
|
+
Fn as BtcActionStatus,
|
|
4393
|
+
fe as CAIP2_SEPARATOR,
|
|
4394
|
+
F as CHAIN_CATALOG,
|
|
4395
|
+
p as CHAIN_PREFIXES,
|
|
4396
|
+
ft as CapabilityRegistry,
|
|
4397
|
+
o as Chain,
|
|
4398
|
+
st as ContractErrorCode,
|
|
4399
|
+
et as ErrorCode,
|
|
4400
|
+
jn as EvmOperationStatus,
|
|
4401
|
+
E as LombardError,
|
|
4402
|
+
Hn as NonEvmUnstakeStatus,
|
|
4403
|
+
lt as PartnerConfiguration,
|
|
4404
|
+
tt as ProviderErrorCode,
|
|
4405
|
+
nt as RegistryErrorCode,
|
|
4406
|
+
nn as SDK_NAME,
|
|
4407
|
+
sn as SDK_RUNTIME,
|
|
4408
|
+
Qe as SDK_VERSION,
|
|
4409
|
+
Ln as StepStatus,
|
|
4410
|
+
Rn as StrategyStatus,
|
|
4411
|
+
Z as ValidationErrorCode,
|
|
4412
|
+
rt as WithdrawErrorCode,
|
|
4413
|
+
Gt as amountSchema,
|
|
4414
|
+
Zn as bitcoinAddressSchema,
|
|
4415
|
+
Kt as btcStakeAmountSchema,
|
|
4416
|
+
rn as chainValueToKey,
|
|
4417
|
+
wn as createBtcCoreContext,
|
|
4418
|
+
On as createEvmCoreContext,
|
|
4419
|
+
Bn as evmAddressSchema,
|
|
4420
|
+
Pn as evmAmountSchema,
|
|
4421
|
+
mn as evmChainIdToChain,
|
|
4422
|
+
Sn as getAllAssetChains,
|
|
4423
|
+
pn as getAssetAddress,
|
|
4424
|
+
En as getAssetByAddress,
|
|
4425
|
+
bn as getAssetChains,
|
|
4426
|
+
ie as getAssetChainsForEnvs,
|
|
4427
|
+
gn as getAssetDecimals,
|
|
4428
|
+
xn as getAssetEnvironments,
|
|
4429
|
+
In as getAssetMetadata,
|
|
4430
|
+
vn as getAssetRouter,
|
|
4431
|
+
_n as getBridgeAdapter,
|
|
4432
|
+
cn as getChainMetadata,
|
|
4433
|
+
on as getChainName,
|
|
4434
|
+
dn as getChainType,
|
|
4435
|
+
kn as getEvmAssetChains,
|
|
4436
|
+
Cn as getEvmChainsWithAllAssets,
|
|
4437
|
+
fn as getExplorerTxUrl,
|
|
4438
|
+
De as getProviderGetter,
|
|
4439
|
+
An as getPublicMarketMaker,
|
|
4440
|
+
Nn as getSupportedAssets,
|
|
4441
|
+
Tn as isAssetDeployed,
|
|
4442
|
+
an as isChain,
|
|
4443
|
+
Le as isEvmChain,
|
|
4444
|
+
at as isLombardError,
|
|
4445
|
+
ln as isMainnet,
|
|
4446
|
+
un as isTestnet,
|
|
4447
|
+
Ft as objectType,
|
|
4448
|
+
hn as parseChainIdentifier,
|
|
4449
|
+
Yt as referralCodeSchema,
|
|
4450
|
+
Mn as solanaAddressSchema,
|
|
4451
|
+
Un as starknetAddressSchema,
|
|
4452
|
+
L as stringType,
|
|
4453
|
+
Vn as suiAddressSchema,
|
|
4454
|
+
yn as usesAssetRouter,
|
|
4455
|
+
$n as validatePrepareParams,
|
|
4456
|
+
pe as wrapError
|
|
4436
4457
|
};
|
|
4437
|
-
//# sourceMappingURL=statusConstants-
|
|
4458
|
+
//# sourceMappingURL=statusConstants-C4YNx2q0.js.map
|