@axium/server 0.24.1 → 0.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/client/_app/immutable/assets/account.dAAx7bby.css +1 -0
- package/build/client/_app/immutable/assets/account.dAAx7bby.css.br +0 -0
- package/build/client/_app/immutable/assets/account.dAAx7bby.css.gz +0 -0
- package/build/client/_app/immutable/assets/list.DVGH0BeP.css +1 -0
- package/build/client/_app/immutable/assets/list.DVGH0BeP.css.br +0 -0
- package/build/client/_app/immutable/assets/list.DVGH0BeP.css.gz +0 -0
- package/build/client/_app/immutable/assets/styles.D8SZ-PeY.css +1 -0
- package/build/client/_app/immutable/assets/styles.D8SZ-PeY.css.br +2 -0
- package/build/client/_app/immutable/assets/styles.D8SZ-PeY.css.gz +0 -0
- package/build/client/_app/immutable/chunks/46qGscyh.js +2 -0
- package/build/client/_app/immutable/chunks/46qGscyh.js.br +0 -0
- package/build/client/_app/immutable/chunks/46qGscyh.js.gz +0 -0
- package/build/client/_app/immutable/chunks/B2Vkpbkw.js +2 -0
- package/build/client/_app/immutable/chunks/B2Vkpbkw.js.br +0 -0
- package/build/client/_app/immutable/chunks/B2Vkpbkw.js.gz +0 -0
- package/build/client/_app/immutable/chunks/BKixenYx.js +1 -0
- package/build/client/_app/immutable/chunks/BKixenYx.js.br +0 -0
- package/build/client/_app/immutable/chunks/BKixenYx.js.gz +0 -0
- package/build/client/_app/immutable/chunks/BLtAtlP3.js +1 -0
- package/build/client/_app/immutable/chunks/BLtAtlP3.js.br +2 -0
- package/build/client/_app/immutable/chunks/BLtAtlP3.js.gz +0 -0
- package/build/client/_app/immutable/chunks/BNTlty5m.js +1 -0
- package/build/client/_app/immutable/chunks/BNTlty5m.js.br +0 -0
- package/build/client/_app/immutable/chunks/BNTlty5m.js.gz +0 -0
- package/build/client/_app/immutable/chunks/Beh6Ec8J.js +1 -0
- package/build/client/_app/immutable/chunks/Beh6Ec8J.js.br +0 -0
- package/build/client/_app/immutable/chunks/Beh6Ec8J.js.gz +0 -0
- package/build/client/_app/immutable/chunks/BrUe-Qen.js +1 -0
- package/build/client/_app/immutable/chunks/BrUe-Qen.js.br +0 -0
- package/build/client/_app/immutable/chunks/BrUe-Qen.js.gz +0 -0
- package/build/client/_app/immutable/chunks/Bs4cD_pX.js +1 -0
- package/build/client/_app/immutable/chunks/Bs4cD_pX.js.br +0 -0
- package/build/client/_app/immutable/chunks/Bs4cD_pX.js.gz +0 -0
- package/build/client/_app/immutable/chunks/C62F-tXu.js +1 -0
- package/build/client/_app/immutable/chunks/C62F-tXu.js.br +1 -0
- package/build/client/_app/immutable/chunks/C62F-tXu.js.gz +0 -0
- package/build/client/_app/immutable/chunks/CUBtP2L9.js +23 -0
- package/build/client/_app/immutable/chunks/CUBtP2L9.js.br +0 -0
- package/build/client/_app/immutable/chunks/CUBtP2L9.js.gz +0 -0
- package/build/client/_app/immutable/chunks/Ch16TNvP.js +1 -0
- package/build/client/_app/immutable/chunks/Ch16TNvP.js.br +0 -0
- package/build/client/_app/immutable/chunks/Ch16TNvP.js.gz +0 -0
- package/build/client/_app/immutable/chunks/CoYD6HNm.js +1 -0
- package/build/client/_app/immutable/chunks/CoYD6HNm.js.br +0 -0
- package/build/client/_app/immutable/chunks/CoYD6HNm.js.gz +0 -0
- package/build/client/_app/immutable/chunks/D40Zn55h.js +1 -0
- package/build/client/_app/immutable/chunks/D40Zn55h.js.br +0 -0
- package/build/client/_app/immutable/chunks/D40Zn55h.js.gz +0 -0
- package/build/client/_app/immutable/chunks/DW7-1esk.js +21 -0
- package/build/client/_app/immutable/chunks/DW7-1esk.js.br +0 -0
- package/build/client/_app/immutable/chunks/DW7-1esk.js.gz +0 -0
- package/build/client/_app/immutable/chunks/DY4fWHx_.js +1 -0
- package/build/client/_app/immutable/chunks/DY4fWHx_.js.br +0 -0
- package/build/client/_app/immutable/chunks/DY4fWHx_.js.gz +0 -0
- package/build/client/_app/immutable/chunks/DvOBbqVY.js +1 -0
- package/build/client/_app/immutable/chunks/DvOBbqVY.js.br +0 -0
- package/build/client/_app/immutable/chunks/DvOBbqVY.js.gz +0 -0
- package/build/client/_app/immutable/chunks/DwZYWemd.js +1 -0
- package/build/client/_app/immutable/chunks/DwZYWemd.js.br +0 -0
- package/build/client/_app/immutable/chunks/DwZYWemd.js.gz +0 -0
- package/build/client/_app/immutable/chunks/Dy2Ho0cF.js +1 -0
- package/build/client/_app/immutable/chunks/Dy2Ho0cF.js.br +0 -0
- package/build/client/_app/immutable/chunks/Dy2Ho0cF.js.gz +0 -0
- package/build/client/_app/immutable/chunks/FTv0qR3w.js +1 -0
- package/build/client/_app/immutable/chunks/FTv0qR3w.js.br +0 -0
- package/build/client/_app/immutable/chunks/FTv0qR3w.js.gz +0 -0
- package/build/client/_app/immutable/chunks/NeK0YGoY.js +1 -0
- package/build/client/_app/immutable/chunks/NeK0YGoY.js.br +0 -0
- package/build/client/_app/immutable/chunks/NeK0YGoY.js.gz +0 -0
- package/build/client/_app/immutable/chunks/aArGsq9c.js +1 -0
- package/build/client/_app/immutable/chunks/aArGsq9c.js.br +0 -0
- package/build/client/_app/immutable/chunks/aArGsq9c.js.gz +0 -0
- package/build/client/_app/immutable/chunks/lH47zGKU.js +1 -0
- package/build/client/_app/immutable/chunks/lH47zGKU.js.br +0 -0
- package/build/client/_app/immutable/chunks/lH47zGKU.js.gz +0 -0
- package/build/client/_app/immutable/chunks/sMHjBQqw.js +1 -0
- package/build/client/_app/immutable/chunks/sMHjBQqw.js.br +0 -0
- package/build/client/_app/immutable/chunks/sMHjBQqw.js.gz +0 -0
- package/build/client/_app/immutable/chunks/vQfHcJV6.js +2 -0
- package/build/client/_app/immutable/chunks/vQfHcJV6.js.br +0 -0
- package/build/client/_app/immutable/chunks/vQfHcJV6.js.gz +0 -0
- package/build/client/_app/immutable/entry/app.pLVZKpSD.js +2 -0
- package/build/client/_app/immutable/entry/app.pLVZKpSD.js.br +0 -0
- package/build/client/_app/immutable/entry/app.pLVZKpSD.js.gz +0 -0
- package/build/client/_app/immutable/entry/start.CUaVsIrY.js +1 -0
- package/build/client/_app/immutable/entry/start.CUaVsIrY.js.br +2 -0
- package/build/client/_app/immutable/entry/start.CUaVsIrY.js.gz +0 -0
- package/build/client/_app/immutable/nodes/0.D7hET-Bq.js +1 -0
- package/build/client/_app/immutable/nodes/0.D7hET-Bq.js.br +0 -0
- package/build/client/_app/immutable/nodes/0.D7hET-Bq.js.gz +0 -0
- package/build/client/_app/immutable/nodes/1.BWU-JJm_.js +1 -0
- package/build/client/_app/immutable/nodes/1.BWU-JJm_.js.br +2 -0
- package/build/client/_app/immutable/nodes/1.BWU-JJm_.js.gz +0 -0
- package/build/client/_app/immutable/nodes/10.C5N2XBee.js +1 -0
- package/build/client/_app/immutable/nodes/10.C5N2XBee.js.br +0 -0
- package/build/client/_app/immutable/nodes/10.C5N2XBee.js.gz +0 -0
- package/build/client/_app/immutable/nodes/11.CerbuSAv.js +1 -0
- package/build/client/_app/immutable/nodes/11.CerbuSAv.js.br +0 -0
- package/build/client/_app/immutable/nodes/11.CerbuSAv.js.gz +0 -0
- package/build/client/_app/immutable/nodes/12.Z4B9zS78.js +1 -0
- package/build/client/_app/immutable/nodes/12.Z4B9zS78.js.br +0 -0
- package/build/client/_app/immutable/nodes/12.Z4B9zS78.js.gz +0 -0
- package/build/client/_app/immutable/nodes/13.CuICShck.js +1 -0
- package/build/client/_app/immutable/nodes/13.CuICShck.js.br +0 -0
- package/build/client/_app/immutable/nodes/13.CuICShck.js.gz +0 -0
- package/build/client/_app/immutable/nodes/14.BSEF5oaF.js +1 -0
- package/build/client/_app/immutable/nodes/14.BSEF5oaF.js.br +0 -0
- package/build/client/_app/immutable/nodes/14.BSEF5oaF.js.gz +0 -0
- package/build/client/_app/immutable/nodes/15.D1nsmo6j.js +1 -0
- package/build/client/_app/immutable/nodes/15.D1nsmo6j.js.br +0 -0
- package/build/client/_app/immutable/nodes/15.D1nsmo6j.js.gz +0 -0
- package/build/client/_app/immutable/nodes/2.DQ1JcYgz.js +1 -0
- package/build/client/_app/immutable/nodes/2.DQ1JcYgz.js.br +0 -0
- package/build/client/_app/immutable/nodes/2.DQ1JcYgz.js.gz +0 -0
- package/build/client/_app/immutable/nodes/3.BJp2JEtW.js +1 -0
- package/build/client/_app/immutable/nodes/3.BJp2JEtW.js.br +0 -0
- package/build/client/_app/immutable/nodes/3.BJp2JEtW.js.gz +0 -0
- package/build/client/_app/immutable/nodes/4.Cvn_QsIx.js +1 -0
- package/build/client/_app/immutable/nodes/4.Cvn_QsIx.js.br +0 -0
- package/build/client/_app/immutable/nodes/4.Cvn_QsIx.js.gz +0 -0
- package/build/client/_app/immutable/nodes/5.DgPP9GX3.js +1 -0
- package/build/client/_app/immutable/nodes/5.DgPP9GX3.js.br +0 -0
- package/build/client/_app/immutable/nodes/5.DgPP9GX3.js.gz +0 -0
- package/build/client/_app/immutable/nodes/6.DKIzms8i.js +2 -0
- package/build/client/_app/immutable/nodes/6.DKIzms8i.js.br +0 -0
- package/build/client/_app/immutable/nodes/6.DKIzms8i.js.gz +0 -0
- package/build/client/_app/immutable/nodes/7.3UigVXV4.js +1 -0
- package/build/client/_app/immutable/nodes/7.3UigVXV4.js.br +0 -0
- package/build/client/_app/immutable/nodes/7.3UigVXV4.js.gz +0 -0
- package/build/client/_app/immutable/nodes/8.B8s2TdNQ.js +1 -0
- package/build/client/_app/immutable/nodes/8.B8s2TdNQ.js.br +0 -0
- package/build/client/_app/immutable/nodes/8.B8s2TdNQ.js.gz +0 -0
- package/build/client/_app/immutable/nodes/9.LBMMe2kc.js +1 -0
- package/build/client/_app/immutable/nodes/9.LBMMe2kc.js.br +0 -0
- package/build/client/_app/immutable/nodes/9.LBMMe2kc.js.gz +0 -0
- package/build/client/_app/version.json +1 -1
- package/build/client/_app/version.json.br +0 -0
- package/build/client/_app/version.json.gz +0 -0
- package/build/client/styles.css +28 -0
- package/build/client/styles.css.br +0 -0
- package/build/client/styles.css.gz +0 -0
- package/build/handler.js +20 -3
- package/build/server/chunks/0-CNbALTKz.js +9 -0
- package/build/server/chunks/0-CNbALTKz.js.map +1 -0
- package/build/server/chunks/1-Dgxy393u.js +9 -0
- package/build/server/chunks/1-Dgxy393u.js.map +1 -0
- package/build/server/chunks/10-DovmbqKa.js +14 -0
- package/build/server/chunks/10-DovmbqKa.js.map +1 -0
- package/build/server/chunks/11-CRK_ubcl.js +14 -0
- package/build/server/chunks/11-CRK_ubcl.js.map +1 -0
- package/build/server/chunks/12-SbQlwMfe.js +9 -0
- package/build/server/chunks/12-SbQlwMfe.js.map +1 -0
- package/build/server/chunks/13-CbniIW7F.js +14 -0
- package/build/server/chunks/13-CbniIW7F.js.map +1 -0
- package/build/server/chunks/14-D9Vb_8Yx.js +9 -0
- package/build/server/chunks/14-D9Vb_8Yx.js.map +1 -0
- package/build/server/chunks/15-D-75Hdef.js +9 -0
- package/build/server/chunks/15-D-75Hdef.js.map +1 -0
- package/build/server/chunks/2-57exN8ae.js +14 -0
- package/build/server/chunks/2-57exN8ae.js.map +1 -0
- package/build/server/chunks/3-DNQft-pY.js +9 -0
- package/build/server/chunks/{2-CXlrhpR6.js.map → 3-DNQft-pY.js.map} +1 -1
- package/build/server/chunks/4-D9Bwp-f8.js +14 -0
- package/build/server/chunks/4-D9Bwp-f8.js.map +1 -0
- package/build/server/chunks/5-COEQwZNP.js +14 -0
- package/build/server/chunks/5-COEQwZNP.js.map +1 -0
- package/build/server/chunks/6-RT4yiDcP.js +14 -0
- package/build/server/chunks/6-RT4yiDcP.js.map +1 -0
- package/build/server/chunks/7-CVqF_r5D.js +14 -0
- package/build/server/chunks/7-CVqF_r5D.js.map +1 -0
- package/build/server/chunks/8-C5SO-sVH.js +14 -0
- package/build/server/chunks/8-C5SO-sVH.js.map +1 -0
- package/build/server/chunks/9-DoCOKtY-.js +14 -0
- package/build/server/chunks/9-DoCOKtY-.js.map +1 -0
- package/build/server/chunks/FormDialog-ZCY0chY1.js +102 -0
- package/build/server/chunks/FormDialog-ZCY0chY1.js.map +1 -0
- package/build/server/chunks/Icon-BVo9qbDf.js +30 -0
- package/build/server/chunks/Icon-BVo9qbDf.js.map +1 -0
- package/build/server/chunks/Logout-CmBZgu0j.js +46 -0
- package/build/server/chunks/Logout-CmBZgu0j.js.map +1 -0
- package/build/server/chunks/_layout.svelte-DuS006VZ.js +33 -0
- package/build/server/chunks/_layout.svelte-DuS006VZ.js.map +1 -0
- package/build/server/chunks/_page.svelte-BFVobcI7.js +14 -0
- package/build/server/chunks/_page.svelte-BFVobcI7.js.map +1 -0
- package/build/server/chunks/_page.svelte-B_cvhWJS.js +66 -0
- package/build/server/chunks/_page.svelte-B_cvhWJS.js.map +1 -0
- package/build/server/chunks/_page.svelte-BriaBR9l.js +28 -0
- package/build/server/chunks/_page.svelte-BriaBR9l.js.map +1 -0
- package/build/server/chunks/_page.svelte-BtQQzT7H.js +72 -0
- package/build/server/chunks/_page.svelte-BtQQzT7H.js.map +1 -0
- package/build/server/chunks/_page.svelte-C8D3c3yB.js +64 -0
- package/build/server/chunks/_page.svelte-C8D3c3yB.js.map +1 -0
- package/build/server/chunks/_page.svelte-CVSb9eHQ.js +24 -0
- package/build/server/chunks/_page.svelte-CVSb9eHQ.js.map +1 -0
- package/build/server/chunks/_page.svelte-CwRjZqL7.js +107 -0
- package/build/server/chunks/_page.svelte-CwRjZqL7.js.map +1 -0
- package/build/server/chunks/_page.svelte-D9A9RYjx.js +233 -0
- package/build/server/chunks/_page.svelte-D9A9RYjx.js.map +1 -0
- package/build/server/chunks/_page.svelte-DGhwqWMM.js +34 -0
- package/build/server/chunks/_page.svelte-DGhwqWMM.js.map +1 -0
- package/build/server/chunks/_page.svelte-DTvnX95_.js +75 -0
- package/build/server/chunks/_page.svelte-DTvnX95_.js.map +1 -0
- package/build/server/chunks/_page.svelte-DUfwpXfC.js +122 -0
- package/build/server/chunks/_page.svelte-DUfwpXfC.js.map +1 -0
- package/build/server/chunks/_page.svelte-DxDoD3rZ.js +37 -0
- package/build/server/chunks/_page.svelte-DxDoD3rZ.js.map +1 -0
- package/build/server/chunks/_page.svelte-VDBvShZ8.js +6 -0
- package/build/server/chunks/_page.svelte-VDBvShZ8.js.map +1 -0
- package/build/server/chunks/account-Bf_llRe2.js +446 -0
- package/build/server/chunks/account-Bf_llRe2.js.map +1 -0
- package/build/server/chunks/auth_redirect-olBYiIF2.js +24 -0
- package/build/server/chunks/auth_redirect-olBYiIF2.js.map +1 -0
- package/build/server/chunks/color-K_MR7m8s.js +14 -0
- package/build/server/chunks/color-K_MR7m8s.js.map +1 -0
- package/build/server/chunks/context-R2425nfV.js +64 -0
- package/build/server/chunks/context-R2425nfV.js.map +1 -0
- package/build/server/chunks/{error.svelte-DNQXZmIO.js → error.svelte-CkSCwrMJ.js} +7 -6
- package/build/server/chunks/error.svelte-CkSCwrMJ.js.map +1 -0
- package/build/server/chunks/index-CIEcmmdN.js +890 -0
- package/build/server/chunks/index-CIEcmmdN.js.map +1 -0
- package/build/server/chunks/{index-CvHf_GW2.js → index-Tt4zVDIZ.js} +843 -438
- package/build/server/chunks/index-Tt4zVDIZ.js.map +1 -0
- package/build/server/chunks/layout.svelte-UxsTmhKc.js +8 -0
- package/build/server/chunks/layout.svelte-UxsTmhKc.js.map +1 -0
- package/build/server/chunks/{string-DLbvtT1R.js → numbers-DL8C9q4W.js} +1 -71
- package/build/server/chunks/numbers-DL8C9q4W.js.map +1 -0
- package/build/server/chunks/{FormDialog-CB-2YGWi.js → user2-CRfK67II.js} +12 -206
- package/build/server/chunks/user2-CRfK67II.js.map +1 -0
- package/build/server/chunks/utils-h74ns7K6.js.map +1 -1
- package/build/server/index.js +2304 -1140
- package/build/server/index.js.map +1 -1
- package/build/server/manifest.js +78 -13
- package/build/server/manifest.js.map +1 -1
- package/dist/acl.d.ts +1 -2
- package/dist/acl.js +1 -1
- package/dist/api/acl.js +4 -4
- package/dist/api/admin.d.ts +1 -0
- package/dist/api/admin.js +152 -0
- package/dist/api/index.d.ts +2 -0
- package/dist/api/index.js +2 -0
- package/dist/api/metadata.js +5 -5
- package/dist/api/passkeys.js +10 -10
- package/dist/api/register.js +4 -4
- package/dist/api/session.js +5 -5
- package/dist/api/users.js +52 -49
- package/dist/audit.d.ts +8 -39
- package/dist/audit.js +13 -16
- package/dist/auth.d.ts +4 -11
- package/dist/auth.js +4 -4
- package/dist/cli.js +515 -559
- package/dist/config.d.ts +26 -16
- package/dist/config.js +65 -36
- package/dist/database.d.ts +3 -4
- package/dist/database.js +19 -18
- package/dist/internal_requests.d.ts +3 -0
- package/dist/internal_requests.js +119 -0
- package/dist/io.d.ts +0 -49
- package/dist/io.js +23 -171
- package/dist/linking.d.ts +0 -1
- package/dist/linking.js +5 -8
- package/dist/requests.d.ts +10 -6
- package/dist/requests.js +17 -15
- package/dist/routes.d.ts +6 -10
- package/dist/routes.js +7 -8
- package/dist/serve.d.ts +7 -2
- package/dist/serve.js +170 -13
- package/dist/state.js +2 -1
- package/package.json +8 -7
- package/routes/account/+page.svelte +5 -109
- package/routes/admin/+layout.svelte +56 -0
- package/routes/admin/+layout.ts +31 -0
- package/routes/admin/+page.svelte +39 -0
- package/routes/admin/+page.ts +7 -0
- package/routes/admin/audit/+page.svelte +158 -0
- package/routes/admin/audit/+page.ts +22 -0
- package/routes/admin/audit/[id]/+page.svelte +43 -0
- package/routes/admin/audit/[id]/+page.ts +9 -0
- package/routes/admin/audit/styles.css +31 -0
- package/routes/admin/config/+page.svelte +28 -0
- package/routes/admin/config/+page.ts +9 -0
- package/routes/admin/plugins/+page.svelte +23 -0
- package/routes/admin/plugins/+page.ts +7 -0
- package/routes/admin/users/+page.svelte +60 -0
- package/routes/admin/users/+page.ts +9 -0
- package/routes/admin/users/[id]/+page.svelte +108 -0
- package/routes/admin/users/[id]/+page.ts +17 -0
- package/routes/login/client/+page.svelte +72 -0
- package/routes/login/client/+page.ts +27 -0
- package/routes/tsconfig.json +1 -1
- package/svelte.config.js +4 -10
- package/{web/template.html → template.html} +1 -1
- package/{web/tsconfig.json → web.tsconfig.json} +2 -2
- package/build/client/_app/immutable/chunks/B1E1cVbi.js +0 -1
- package/build/client/_app/immutable/chunks/B1E1cVbi.js.br +0 -0
- package/build/client/_app/immutable/chunks/B1E1cVbi.js.gz +0 -0
- package/build/client/_app/immutable/chunks/CIywFg5g.js +0 -3
- package/build/client/_app/immutable/chunks/CIywFg5g.js.br +0 -0
- package/build/client/_app/immutable/chunks/CIywFg5g.js.gz +0 -0
- package/build/client/_app/immutable/chunks/D3hk2v8y.js +0 -1
- package/build/client/_app/immutable/chunks/D3hk2v8y.js.br +0 -2
- package/build/client/_app/immutable/chunks/D3hk2v8y.js.gz +0 -0
- package/build/client/_app/immutable/chunks/D4Bce_hb.js +0 -1
- package/build/client/_app/immutable/chunks/D4Bce_hb.js.br +0 -0
- package/build/client/_app/immutable/chunks/D4Bce_hb.js.gz +0 -0
- package/build/client/_app/immutable/chunks/D9TfJrfD.js +0 -1
- package/build/client/_app/immutable/chunks/D9TfJrfD.js.br +0 -0
- package/build/client/_app/immutable/chunks/D9TfJrfD.js.gz +0 -0
- package/build/client/_app/immutable/chunks/DJeR1n-B.js +0 -51
- package/build/client/_app/immutable/chunks/DJeR1n-B.js.br +0 -0
- package/build/client/_app/immutable/chunks/DJeR1n-B.js.gz +0 -0
- package/build/client/_app/immutable/chunks/DsnmJJEf.js +0 -1
- package/build/client/_app/immutable/chunks/DsnmJJEf.js.br +0 -2
- package/build/client/_app/immutable/chunks/DsnmJJEf.js.gz +0 -0
- package/build/client/_app/immutable/chunks/Dy1O3iBu.js +0 -2
- package/build/client/_app/immutable/chunks/Dy1O3iBu.js.br +0 -0
- package/build/client/_app/immutable/chunks/Dy1O3iBu.js.gz +0 -0
- package/build/client/_app/immutable/chunks/pba7IodQ.js +0 -1
- package/build/client/_app/immutable/chunks/pba7IodQ.js.br +0 -0
- package/build/client/_app/immutable/chunks/pba7IodQ.js.gz +0 -0
- package/build/client/_app/immutable/entry/app.ChtScU8h.js +0 -2
- package/build/client/_app/immutable/entry/app.ChtScU8h.js.br +0 -0
- package/build/client/_app/immutable/entry/app.ChtScU8h.js.gz +0 -0
- package/build/client/_app/immutable/entry/start.DdjgBKiR.js +0 -1
- package/build/client/_app/immutable/entry/start.DdjgBKiR.js.br +0 -2
- package/build/client/_app/immutable/entry/start.DdjgBKiR.js.gz +0 -0
- package/build/client/_app/immutable/nodes/0.DlE8ZTIF.js +0 -1
- package/build/client/_app/immutable/nodes/0.DlE8ZTIF.js.br +0 -0
- package/build/client/_app/immutable/nodes/0.DlE8ZTIF.js.gz +0 -0
- package/build/client/_app/immutable/nodes/1.DRjfV_5C.js +0 -1
- package/build/client/_app/immutable/nodes/1.DRjfV_5C.js.br +0 -0
- package/build/client/_app/immutable/nodes/1.DRjfV_5C.js.gz +0 -0
- package/build/client/_app/immutable/nodes/2.CvEpuMc7.js +0 -1
- package/build/client/_app/immutable/nodes/2.CvEpuMc7.js.br +0 -0
- package/build/client/_app/immutable/nodes/2.CvEpuMc7.js.gz +0 -0
- package/build/client/_app/immutable/nodes/3.CVudd8x2.js +0 -7
- package/build/client/_app/immutable/nodes/3.CVudd8x2.js.br +0 -0
- package/build/client/_app/immutable/nodes/3.CVudd8x2.js.gz +0 -0
- package/build/client/_app/immutable/nodes/4.Dhj0R0r7.js +0 -1
- package/build/client/_app/immutable/nodes/4.Dhj0R0r7.js.br +0 -0
- package/build/client/_app/immutable/nodes/4.Dhj0R0r7.js.gz +0 -0
- package/build/client/_app/immutable/nodes/5.CGoBaVII.js +0 -1
- package/build/client/_app/immutable/nodes/5.CGoBaVII.js.br +0 -0
- package/build/client/_app/immutable/nodes/5.CGoBaVII.js.gz +0 -0
- package/build/client/_app/immutable/nodes/6.BtB2uWXy.js +0 -1
- package/build/client/_app/immutable/nodes/6.BtB2uWXy.js.br +0 -0
- package/build/client/_app/immutable/nodes/6.BtB2uWXy.js.gz +0 -0
- package/build/server/chunks/0-DgHTujtC.js +0 -9
- package/build/server/chunks/0-DgHTujtC.js.map +0 -1
- package/build/server/chunks/1-B3zVLOO8.js +0 -9
- package/build/server/chunks/1-B3zVLOO8.js.map +0 -1
- package/build/server/chunks/2-CXlrhpR6.js +0 -9
- package/build/server/chunks/3-CGT4Ugys.js +0 -13
- package/build/server/chunks/3-CGT4Ugys.js.map +0 -1
- package/build/server/chunks/4-BscEiwUk.js +0 -9
- package/build/server/chunks/4-BscEiwUk.js.map +0 -1
- package/build/server/chunks/5-H0ePIJBE.js +0 -9
- package/build/server/chunks/5-H0ePIJBE.js.map +0 -1
- package/build/server/chunks/6-BrPpcagX.js +0 -9
- package/build/server/chunks/6-BrPpcagX.js.map +0 -1
- package/build/server/chunks/FormDialog-CB-2YGWi.js.map +0 -1
- package/build/server/chunks/Logout-LKOt-AST.js +0 -45
- package/build/server/chunks/Logout-LKOt-AST.js.map +0 -1
- package/build/server/chunks/_page.svelte-B1LK5J87.js +0 -11
- package/build/server/chunks/_page.svelte-B1LK5J87.js.map +0 -1
- package/build/server/chunks/_page.svelte-CMtkwvbP.js +0 -68
- package/build/server/chunks/_page.svelte-CMtkwvbP.js.map +0 -1
- package/build/server/chunks/_page.svelte-CbI2KxeA.js +0 -62
- package/build/server/chunks/_page.svelte-CbI2KxeA.js.map +0 -1
- package/build/server/chunks/_page.svelte-D1_WJoyP.js +0 -6
- package/build/server/chunks/_page.svelte-D1_WJoyP.js.map +0 -1
- package/build/server/chunks/_page.svelte-d01Hl2Ia.js +0 -639
- package/build/server/chunks/_page.svelte-d01Hl2Ia.js.map +0 -1
- package/build/server/chunks/error.svelte-DNQXZmIO.js.map +0 -1
- package/build/server/chunks/hooks.server-CQhG9POo.js +0 -17298
- package/build/server/chunks/hooks.server-CQhG9POo.js.map +0 -1
- package/build/server/chunks/index-CvHf_GW2.js.map +0 -1
- package/build/server/chunks/index-RTKpMYZ1.js +0 -397
- package/build/server/chunks/index-RTKpMYZ1.js.map +0 -1
- package/build/server/chunks/layout.svelte-BSvrn-4a.js +0 -8
- package/build/server/chunks/layout.svelte-BSvrn-4a.js.map +0 -1
- package/build/server/chunks/string-DLbvtT1R.js.map +0 -1
- package/dist/apps.d.ts +0 -6
- package/dist/apps.js +0 -6
- package/dist/plugins.d.ts +0 -49
- package/dist/plugins.js +0 -80
- package/dist/sveltekit.d.ts +0 -8
- package/dist/sveltekit.js +0 -60
- package/web/hooks.server.ts +0 -4
- /package/{axiumd.service → axium.service} +0 -0
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
import { c as colorHash } from './color-K_MR7m8s.js';
|
|
2
|
+
|
|
3
|
+
// SPDX-License-Identifier: LGPL-3.0-or-later
|
|
4
|
+
// Copyright (c) 2025 James Prevett
|
|
5
|
+
function capitalize(value) {
|
|
6
|
+
return (value.at(0).toUpperCase() + value.slice(1));
|
|
7
|
+
}
|
|
8
|
+
function uncapitalize(value) {
|
|
9
|
+
return (value.at(0).toLowerCase() + value.slice(1));
|
|
10
|
+
}
|
|
11
|
+
new TextEncoder();
|
|
12
|
+
new TextDecoder();
|
|
13
|
+
|
|
1
14
|
/** A special constant with type `never` */
|
|
2
15
|
function $constructor(name, initializer, params) {
|
|
3
16
|
function init(inst, def) {
|
|
@@ -48,6 +61,12 @@ class $ZodAsyncError extends Error {
|
|
|
48
61
|
super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
|
|
49
62
|
}
|
|
50
63
|
}
|
|
64
|
+
class $ZodEncodeError extends Error {
|
|
65
|
+
constructor(name) {
|
|
66
|
+
super(`Encountered unidirectional transform during encode: ${name}`);
|
|
67
|
+
this.name = "ZodEncodeError";
|
|
68
|
+
}
|
|
69
|
+
}
|
|
51
70
|
const globalConfig = {};
|
|
52
71
|
function config(newConfig) {
|
|
53
72
|
return globalConfig;
|
|
@@ -87,20 +106,33 @@ function cleanRegex(source) {
|
|
|
87
106
|
}
|
|
88
107
|
function floatSafeRemainder(val, step) {
|
|
89
108
|
const valDecCount = (val.toString().split(".")[1] || "").length;
|
|
90
|
-
const
|
|
109
|
+
const stepString = step.toString();
|
|
110
|
+
let stepDecCount = (stepString.split(".")[1] || "").length;
|
|
111
|
+
if (stepDecCount === 0 && /\d?e-\d?/.test(stepString)) {
|
|
112
|
+
const match = stepString.match(/\d?e-(\d?)/);
|
|
113
|
+
if (match?.[1]) {
|
|
114
|
+
stepDecCount = Number.parseInt(match[1]);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
91
117
|
const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
|
|
92
118
|
const valInt = Number.parseInt(val.toFixed(decCount).replace(".", ""));
|
|
93
119
|
const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));
|
|
94
120
|
return (valInt % stepInt) / 10 ** decCount;
|
|
95
121
|
}
|
|
122
|
+
const EVALUATING = Symbol("evaluating");
|
|
96
123
|
function defineLazy(object, key, getter) {
|
|
124
|
+
let value = undefined;
|
|
97
125
|
Object.defineProperty(object, key, {
|
|
98
126
|
get() {
|
|
99
|
-
{
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
127
|
+
if (value === EVALUATING) {
|
|
128
|
+
// Circular reference detected, return undefined to break the cycle
|
|
129
|
+
return undefined;
|
|
130
|
+
}
|
|
131
|
+
if (value === undefined) {
|
|
132
|
+
value = EVALUATING;
|
|
133
|
+
value = getter();
|
|
103
134
|
}
|
|
135
|
+
return value;
|
|
104
136
|
},
|
|
105
137
|
set(v) {
|
|
106
138
|
Object.defineProperty(object, key, {
|
|
@@ -120,16 +152,23 @@ function assignProp(target, prop, value) {
|
|
|
120
152
|
configurable: true,
|
|
121
153
|
});
|
|
122
154
|
}
|
|
155
|
+
function mergeDefs(...defs) {
|
|
156
|
+
const mergedDescriptors = {};
|
|
157
|
+
for (const def of defs) {
|
|
158
|
+
const descriptors = Object.getOwnPropertyDescriptors(def);
|
|
159
|
+
Object.assign(mergedDescriptors, descriptors);
|
|
160
|
+
}
|
|
161
|
+
return Object.defineProperties({}, mergedDescriptors);
|
|
162
|
+
}
|
|
123
163
|
function esc(str) {
|
|
124
164
|
return JSON.stringify(str);
|
|
125
165
|
}
|
|
126
|
-
const captureStackTrace = Error.captureStackTrace
|
|
127
|
-
? Error.captureStackTrace
|
|
128
|
-
: (..._args) => { };
|
|
166
|
+
const captureStackTrace = ("captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => { });
|
|
129
167
|
function isObject(data) {
|
|
130
168
|
return typeof data === "object" && data !== null && !Array.isArray(data);
|
|
131
169
|
}
|
|
132
170
|
const allowsEval = cached(() => {
|
|
171
|
+
// @ts-ignore
|
|
133
172
|
if (typeof navigator !== "undefined" && navigator?.userAgent?.includes("Cloudflare")) {
|
|
134
173
|
return false;
|
|
135
174
|
}
|
|
@@ -159,6 +198,13 @@ function isPlainObject(o) {
|
|
|
159
198
|
}
|
|
160
199
|
return true;
|
|
161
200
|
}
|
|
201
|
+
function shallowClone(o) {
|
|
202
|
+
if (isPlainObject(o))
|
|
203
|
+
return { ...o };
|
|
204
|
+
if (Array.isArray(o))
|
|
205
|
+
return [...o];
|
|
206
|
+
return o;
|
|
207
|
+
}
|
|
162
208
|
const propertyKeyTypes = new Set(["string", "number", "symbol"]);
|
|
163
209
|
function escapeRegex(str) {
|
|
164
210
|
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
@@ -199,44 +245,68 @@ const NUMBER_FORMAT_RANGES = {
|
|
|
199
245
|
float64: [-Number.MAX_VALUE, Number.MAX_VALUE],
|
|
200
246
|
};
|
|
201
247
|
function pick(schema, mask) {
|
|
202
|
-
const
|
|
203
|
-
const
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
248
|
+
const currDef = schema._zod.def;
|
|
249
|
+
const def = mergeDefs(schema._zod.def, {
|
|
250
|
+
get shape() {
|
|
251
|
+
const newShape = {};
|
|
252
|
+
for (const key in mask) {
|
|
253
|
+
if (!(key in currDef.shape)) {
|
|
254
|
+
throw new Error(`Unrecognized key: "${key}"`);
|
|
255
|
+
}
|
|
256
|
+
if (!mask[key])
|
|
257
|
+
continue;
|
|
258
|
+
newShape[key] = currDef.shape[key];
|
|
259
|
+
}
|
|
260
|
+
assignProp(this, "shape", newShape); // self-caching
|
|
261
|
+
return newShape;
|
|
262
|
+
},
|
|
216
263
|
checks: [],
|
|
217
264
|
});
|
|
265
|
+
return clone(schema, def);
|
|
218
266
|
}
|
|
219
267
|
function omit(schema, mask) {
|
|
220
|
-
const
|
|
221
|
-
const
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
268
|
+
const currDef = schema._zod.def;
|
|
269
|
+
const def = mergeDefs(schema._zod.def, {
|
|
270
|
+
get shape() {
|
|
271
|
+
const newShape = { ...schema._zod.def.shape };
|
|
272
|
+
for (const key in mask) {
|
|
273
|
+
if (!(key in currDef.shape)) {
|
|
274
|
+
throw new Error(`Unrecognized key: "${key}"`);
|
|
275
|
+
}
|
|
276
|
+
if (!mask[key])
|
|
277
|
+
continue;
|
|
278
|
+
delete newShape[key];
|
|
279
|
+
}
|
|
280
|
+
assignProp(this, "shape", newShape); // self-caching
|
|
281
|
+
return newShape;
|
|
282
|
+
},
|
|
233
283
|
checks: [],
|
|
234
284
|
});
|
|
285
|
+
return clone(schema, def);
|
|
235
286
|
}
|
|
236
287
|
function extend(schema, shape) {
|
|
237
288
|
if (!isPlainObject(shape)) {
|
|
238
289
|
throw new Error("Invalid input to extend: expected a plain object");
|
|
239
290
|
}
|
|
291
|
+
const checks = schema._zod.def.checks;
|
|
292
|
+
const hasChecks = checks && checks.length > 0;
|
|
293
|
+
if (hasChecks) {
|
|
294
|
+
throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");
|
|
295
|
+
}
|
|
296
|
+
const def = mergeDefs(schema._zod.def, {
|
|
297
|
+
get shape() {
|
|
298
|
+
const _shape = { ...schema._zod.def.shape, ...shape };
|
|
299
|
+
assignProp(this, "shape", _shape); // self-caching
|
|
300
|
+
return _shape;
|
|
301
|
+
},
|
|
302
|
+
checks: [],
|
|
303
|
+
});
|
|
304
|
+
return clone(schema, def);
|
|
305
|
+
}
|
|
306
|
+
function safeExtend(schema, shape) {
|
|
307
|
+
if (!isPlainObject(shape)) {
|
|
308
|
+
throw new Error("Invalid input to safeExtend: expected a plain object");
|
|
309
|
+
}
|
|
240
310
|
const def = {
|
|
241
311
|
...schema._zod.def,
|
|
242
312
|
get shape() {
|
|
@@ -244,95 +314,106 @@ function extend(schema, shape) {
|
|
|
244
314
|
assignProp(this, "shape", _shape); // self-caching
|
|
245
315
|
return _shape;
|
|
246
316
|
},
|
|
247
|
-
checks:
|
|
317
|
+
checks: schema._zod.def.checks,
|
|
248
318
|
};
|
|
249
319
|
return clone(schema, def);
|
|
250
320
|
}
|
|
251
321
|
function merge(a, b) {
|
|
252
|
-
|
|
253
|
-
...a._zod.def,
|
|
322
|
+
const def = mergeDefs(a._zod.def, {
|
|
254
323
|
get shape() {
|
|
255
324
|
const _shape = { ...a._zod.def.shape, ...b._zod.def.shape };
|
|
256
325
|
assignProp(this, "shape", _shape); // self-caching
|
|
257
326
|
return _shape;
|
|
258
327
|
},
|
|
259
|
-
catchall
|
|
328
|
+
get catchall() {
|
|
329
|
+
return b._zod.def.catchall;
|
|
330
|
+
},
|
|
260
331
|
checks: [], // delete existing checks
|
|
261
332
|
});
|
|
333
|
+
return clone(a, def);
|
|
262
334
|
}
|
|
263
335
|
function partial(Class, schema, mask) {
|
|
264
|
-
const
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
if (
|
|
269
|
-
|
|
336
|
+
const def = mergeDefs(schema._zod.def, {
|
|
337
|
+
get shape() {
|
|
338
|
+
const oldShape = schema._zod.def.shape;
|
|
339
|
+
const shape = { ...oldShape };
|
|
340
|
+
if (mask) {
|
|
341
|
+
for (const key in mask) {
|
|
342
|
+
if (!(key in oldShape)) {
|
|
343
|
+
throw new Error(`Unrecognized key: "${key}"`);
|
|
344
|
+
}
|
|
345
|
+
if (!mask[key])
|
|
346
|
+
continue;
|
|
347
|
+
// if (oldShape[key]!._zod.optin === "optional") continue;
|
|
348
|
+
shape[key] = Class
|
|
349
|
+
? new Class({
|
|
350
|
+
type: "optional",
|
|
351
|
+
innerType: oldShape[key],
|
|
352
|
+
})
|
|
353
|
+
: oldShape[key];
|
|
354
|
+
}
|
|
270
355
|
}
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
shape[key] = Class
|
|
286
|
-
? new Class({
|
|
287
|
-
type: "optional",
|
|
288
|
-
innerType: oldShape[key],
|
|
289
|
-
})
|
|
290
|
-
: oldShape[key];
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
return clone(schema, {
|
|
294
|
-
...schema._zod.def,
|
|
295
|
-
shape,
|
|
356
|
+
else {
|
|
357
|
+
for (const key in oldShape) {
|
|
358
|
+
// if (oldShape[key]!._zod.optin === "optional") continue;
|
|
359
|
+
shape[key] = Class
|
|
360
|
+
? new Class({
|
|
361
|
+
type: "optional",
|
|
362
|
+
innerType: oldShape[key],
|
|
363
|
+
})
|
|
364
|
+
: oldShape[key];
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
assignProp(this, "shape", shape); // self-caching
|
|
368
|
+
return shape;
|
|
369
|
+
},
|
|
296
370
|
checks: [],
|
|
297
371
|
});
|
|
372
|
+
return clone(schema, def);
|
|
298
373
|
}
|
|
299
374
|
function required(Class, schema, mask) {
|
|
300
|
-
const
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
if (
|
|
305
|
-
|
|
375
|
+
const def = mergeDefs(schema._zod.def, {
|
|
376
|
+
get shape() {
|
|
377
|
+
const oldShape = schema._zod.def.shape;
|
|
378
|
+
const shape = { ...oldShape };
|
|
379
|
+
if (mask) {
|
|
380
|
+
for (const key in mask) {
|
|
381
|
+
if (!(key in shape)) {
|
|
382
|
+
throw new Error(`Unrecognized key: "${key}"`);
|
|
383
|
+
}
|
|
384
|
+
if (!mask[key])
|
|
385
|
+
continue;
|
|
386
|
+
// overwrite with non-optional
|
|
387
|
+
shape[key] = new Class({
|
|
388
|
+
type: "nonoptional",
|
|
389
|
+
innerType: oldShape[key],
|
|
390
|
+
});
|
|
391
|
+
}
|
|
306
392
|
}
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
shape[key] = new Class({
|
|
320
|
-
type: "nonoptional",
|
|
321
|
-
innerType: oldShape[key],
|
|
322
|
-
});
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
return clone(schema, {
|
|
326
|
-
...schema._zod.def,
|
|
327
|
-
shape,
|
|
328
|
-
// optional: [],
|
|
393
|
+
else {
|
|
394
|
+
for (const key in oldShape) {
|
|
395
|
+
// overwrite with non-optional
|
|
396
|
+
shape[key] = new Class({
|
|
397
|
+
type: "nonoptional",
|
|
398
|
+
innerType: oldShape[key],
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
assignProp(this, "shape", shape); // self-caching
|
|
403
|
+
return shape;
|
|
404
|
+
},
|
|
329
405
|
checks: [],
|
|
330
406
|
});
|
|
407
|
+
return clone(schema, def);
|
|
331
408
|
}
|
|
409
|
+
// invalid_type | too_big | too_small | invalid_format | not_multiple_of | unrecognized_keys | invalid_union | invalid_key | invalid_element | invalid_value | custom
|
|
332
410
|
function aborted(x, startIndex = 0) {
|
|
411
|
+
if (x.aborted === true)
|
|
412
|
+
return true;
|
|
333
413
|
for (let i = startIndex; i < x.issues.length; i++) {
|
|
334
|
-
if (x.issues[i]?.continue !== true)
|
|
414
|
+
if (x.issues[i]?.continue !== true) {
|
|
335
415
|
return true;
|
|
416
|
+
}
|
|
336
417
|
}
|
|
337
418
|
return false;
|
|
338
419
|
}
|
|
@@ -396,13 +477,7 @@ const initializer$1 = (inst, def) => {
|
|
|
396
477
|
value: def,
|
|
397
478
|
enumerable: false,
|
|
398
479
|
});
|
|
399
|
-
|
|
400
|
-
get() {
|
|
401
|
-
return JSON.stringify(def, jsonStringifyReplacer, 2);
|
|
402
|
-
},
|
|
403
|
-
enumerable: true,
|
|
404
|
-
// configurable: false,
|
|
405
|
-
});
|
|
480
|
+
inst.message = JSON.stringify(def, jsonStringifyReplacer, 2);
|
|
406
481
|
Object.defineProperty(inst, "toString", {
|
|
407
482
|
value: () => inst.message,
|
|
408
483
|
enumerable: false,
|
|
@@ -424,11 +499,7 @@ function flattenError(error, mapper = (issue) => issue.message) {
|
|
|
424
499
|
}
|
|
425
500
|
return { formErrors, fieldErrors };
|
|
426
501
|
}
|
|
427
|
-
function formatError(error,
|
|
428
|
-
const mapper = _mapper ||
|
|
429
|
-
function (issue) {
|
|
430
|
-
return issue.message;
|
|
431
|
-
};
|
|
502
|
+
function formatError(error, mapper = (issue) => issue.message) {
|
|
432
503
|
const fieldErrors = { _errors: [] };
|
|
433
504
|
const processError = (error) => {
|
|
434
505
|
for (const issue of error.issues) {
|
|
@@ -498,8 +569,9 @@ function formatError(error, _mapper) {
|
|
|
498
569
|
* ✖ Invalid input: expected number
|
|
499
570
|
* ```
|
|
500
571
|
*/
|
|
501
|
-
function toDotPath(
|
|
572
|
+
function toDotPath(_path) {
|
|
502
573
|
const segs = [];
|
|
574
|
+
const path = _path.map((seg) => (typeof seg === "object" ? seg.key : seg));
|
|
503
575
|
for (const seg of path) {
|
|
504
576
|
if (typeof seg === "number")
|
|
505
577
|
segs.push(`[${seg}]`);
|
|
@@ -518,7 +590,7 @@ function toDotPath(path) {
|
|
|
518
590
|
function prettifyError(error) {
|
|
519
591
|
const lines = [];
|
|
520
592
|
// sort by path length
|
|
521
|
-
const issues = [...error.issues].sort((a, b) => a.path.length - b.path.length);
|
|
593
|
+
const issues = [...error.issues].sort((a, b) => (a.path ?? []).length - (b.path ?? []).length);
|
|
522
594
|
// Process each issue
|
|
523
595
|
for (const issue of issues) {
|
|
524
596
|
lines.push(`✖ ${issue.message}`);
|
|
@@ -583,6 +655,34 @@ const _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
|
|
|
583
655
|
: { success: true, data: result.value };
|
|
584
656
|
};
|
|
585
657
|
const safeParseAsync$1 = /* @__PURE__*/ _safeParseAsync($ZodRealError);
|
|
658
|
+
const _encode = (_Err) => (schema, value, _ctx) => {
|
|
659
|
+
const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
|
|
660
|
+
return _parse(_Err)(schema, value, ctx);
|
|
661
|
+
};
|
|
662
|
+
const _decode = (_Err) => (schema, value, _ctx) => {
|
|
663
|
+
return _parse(_Err)(schema, value, _ctx);
|
|
664
|
+
};
|
|
665
|
+
const _encodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
666
|
+
const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
|
|
667
|
+
return _parseAsync(_Err)(schema, value, ctx);
|
|
668
|
+
};
|
|
669
|
+
const _decodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
670
|
+
return _parseAsync(_Err)(schema, value, _ctx);
|
|
671
|
+
};
|
|
672
|
+
const _safeEncode = (_Err) => (schema, value, _ctx) => {
|
|
673
|
+
const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
|
|
674
|
+
return _safeParse(_Err)(schema, value, ctx);
|
|
675
|
+
};
|
|
676
|
+
const _safeDecode = (_Err) => (schema, value, _ctx) => {
|
|
677
|
+
return _safeParse(_Err)(schema, value, _ctx);
|
|
678
|
+
};
|
|
679
|
+
const _safeEncodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
680
|
+
const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
|
|
681
|
+
return _safeParseAsync(_Err)(schema, value, ctx);
|
|
682
|
+
};
|
|
683
|
+
const _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
684
|
+
return _safeParseAsync(_Err)(schema, value, _ctx);
|
|
685
|
+
};
|
|
586
686
|
|
|
587
687
|
const cuid = /^[cC][^\s-]{8,}$/;
|
|
588
688
|
const cuid2 = /^[0-9a-z]+$/;
|
|
@@ -594,12 +694,12 @@ const nanoid = /^[a-zA-Z0-9_-]{21}$/;
|
|
|
594
694
|
const duration$1 = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;
|
|
595
695
|
/** A regex for any UUID-like identifier: 8-4-4-4-12 hex pattern */
|
|
596
696
|
const guid = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/;
|
|
597
|
-
/** Returns a regex for validating an RFC 4122 UUID.
|
|
697
|
+
/** Returns a regex for validating an RFC 9562/4122 UUID.
|
|
598
698
|
*
|
|
599
699
|
* @param version Optionally specify a version 1-8. If no version is specified, all versions are supported. */
|
|
600
700
|
const uuid$1 = (version) => {
|
|
601
701
|
if (!version)
|
|
602
|
-
return /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/;
|
|
702
|
+
return /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;
|
|
603
703
|
return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${version}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`);
|
|
604
704
|
};
|
|
605
705
|
/** Practical email validation */
|
|
@@ -610,21 +710,20 @@ function emoji() {
|
|
|
610
710
|
return new RegExp(_emoji$1, "u");
|
|
611
711
|
}
|
|
612
712
|
const ipv4 = /^(?:(?: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])$/;
|
|
613
|
-
const ipv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}
|
|
713
|
+
const ipv6 = /^(([0-9a-fA-F]{1,4}:){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}|:))$/;
|
|
614
714
|
const cidrv4 = /^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/;
|
|
615
715
|
const cidrv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
|
|
616
716
|
// https://stackoverflow.com/questions/7860392/determine-if-string-is-in-base64-using-javascript
|
|
617
717
|
const base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
|
|
618
718
|
const base64url = /^[A-Za-z0-9_-]*$/;
|
|
619
719
|
// based on https://stackoverflow.com/questions/106179/regular-expression-to-match-dns-hostname-or-ip-address
|
|
620
|
-
// export const hostname: RegExp =
|
|
621
|
-
|
|
622
|
-
const hostname = /^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/;
|
|
720
|
+
// export const hostname: RegExp = /^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/;
|
|
721
|
+
const hostname = /^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/;
|
|
623
722
|
// https://blog.stevenlevithan.com/archives/validate-phone-number#r4-3 (regex sans spaces)
|
|
624
723
|
const e164 = /^\+(?:[0-9]){6,14}[0-9]$/;
|
|
625
724
|
// const dateSource = `((\\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])))`;
|
|
626
725
|
const dateSource = `(?:(?:\\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])))`;
|
|
627
|
-
const date$
|
|
726
|
+
const date$3 = /*@__PURE__*/ new RegExp(`^${dateSource}$`);
|
|
628
727
|
function timeSource(args) {
|
|
629
728
|
const hhmm = `(?:[01]\\d|2[0-3]):[0-5]\\d`;
|
|
630
729
|
const regex = typeof args.precision === "number"
|
|
@@ -645,8 +744,9 @@ function datetime$1(args) {
|
|
|
645
744
|
const opts = ["Z"];
|
|
646
745
|
if (args.local)
|
|
647
746
|
opts.push("");
|
|
747
|
+
// if (args.offset) opts.push(`([+-]\\d{2}:\\d{2})`);
|
|
648
748
|
if (args.offset)
|
|
649
|
-
opts.push(`([+-]\\d
|
|
749
|
+
opts.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);
|
|
650
750
|
const timeRegex = `${time}(?:${opts.join("|")})`;
|
|
651
751
|
return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
|
|
652
752
|
}
|
|
@@ -654,9 +754,9 @@ const string$1 = (params) => {
|
|
|
654
754
|
const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
|
|
655
755
|
return new RegExp(`^${regex}$`);
|
|
656
756
|
};
|
|
657
|
-
const integer =
|
|
658
|
-
const number$1 = /^-?\d+(?:\.\d+)
|
|
659
|
-
const boolean$1 =
|
|
757
|
+
const integer = /^-?\d+$/;
|
|
758
|
+
const number$1 = /^-?\d+(?:\.\d+)?/;
|
|
759
|
+
const boolean$1 = /^(?:true|false)$/i;
|
|
660
760
|
// regex for string with no uppercase letters
|
|
661
761
|
const lowercase = /^[^A-Z]*$/;
|
|
662
762
|
// regex for string with no lowercase letters
|
|
@@ -786,6 +886,7 @@ const $ZodCheckNumberFormat = /*@__PURE__*/ $constructor("$ZodCheckNumberFormat"
|
|
|
786
886
|
expected: origin,
|
|
787
887
|
format: def.format,
|
|
788
888
|
code: "invalid_type",
|
|
889
|
+
continue: false,
|
|
789
890
|
input,
|
|
790
891
|
inst,
|
|
791
892
|
});
|
|
@@ -1107,8 +1208,8 @@ class Doc {
|
|
|
1107
1208
|
|
|
1108
1209
|
const version = {
|
|
1109
1210
|
major: 4,
|
|
1110
|
-
minor:
|
|
1111
|
-
patch:
|
|
1211
|
+
minor: 1,
|
|
1212
|
+
patch: 12,
|
|
1112
1213
|
};
|
|
1113
1214
|
|
|
1114
1215
|
const $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def) => {
|
|
@@ -1122,7 +1223,6 @@ const $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def) => {
|
|
|
1122
1223
|
if (inst._zod.traits.has("$ZodCheck")) {
|
|
1123
1224
|
checks.unshift(inst);
|
|
1124
1225
|
}
|
|
1125
|
-
//
|
|
1126
1226
|
for (const ch of checks) {
|
|
1127
1227
|
for (const fn of ch._zod.onattach) {
|
|
1128
1228
|
fn(inst);
|
|
@@ -1179,7 +1279,47 @@ const $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def) => {
|
|
|
1179
1279
|
}
|
|
1180
1280
|
return payload;
|
|
1181
1281
|
};
|
|
1282
|
+
// const handleChecksResult = (
|
|
1283
|
+
// checkResult: ParsePayload,
|
|
1284
|
+
// originalResult: ParsePayload,
|
|
1285
|
+
// ctx: ParseContextInternal
|
|
1286
|
+
// ): util.MaybeAsync<ParsePayload> => {
|
|
1287
|
+
// // if the checks mutated the value && there are no issues, re-parse the result
|
|
1288
|
+
// if (checkResult.value !== originalResult.value && !checkResult.issues.length)
|
|
1289
|
+
// return inst._zod.parse(checkResult, ctx);
|
|
1290
|
+
// return originalResult;
|
|
1291
|
+
// };
|
|
1292
|
+
const handleCanaryResult = (canary, payload, ctx) => {
|
|
1293
|
+
// abort if the canary is aborted
|
|
1294
|
+
if (aborted(canary)) {
|
|
1295
|
+
canary.aborted = true;
|
|
1296
|
+
return canary;
|
|
1297
|
+
}
|
|
1298
|
+
// run checks first, then
|
|
1299
|
+
const checkResult = runChecks(payload, checks, ctx);
|
|
1300
|
+
if (checkResult instanceof Promise) {
|
|
1301
|
+
if (ctx.async === false)
|
|
1302
|
+
throw new $ZodAsyncError();
|
|
1303
|
+
return checkResult.then((checkResult) => inst._zod.parse(checkResult, ctx));
|
|
1304
|
+
}
|
|
1305
|
+
return inst._zod.parse(checkResult, ctx);
|
|
1306
|
+
};
|
|
1182
1307
|
inst._zod.run = (payload, ctx) => {
|
|
1308
|
+
if (ctx.skipChecks) {
|
|
1309
|
+
return inst._zod.parse(payload, ctx);
|
|
1310
|
+
}
|
|
1311
|
+
if (ctx.direction === "backward") {
|
|
1312
|
+
// run canary
|
|
1313
|
+
// initial pass (no checks)
|
|
1314
|
+
const canary = inst._zod.parse({ value: payload.value, issues: [] }, { ...ctx, skipChecks: true });
|
|
1315
|
+
if (canary instanceof Promise) {
|
|
1316
|
+
return canary.then((canary) => {
|
|
1317
|
+
return handleCanaryResult(canary, payload, ctx);
|
|
1318
|
+
});
|
|
1319
|
+
}
|
|
1320
|
+
return handleCanaryResult(canary, payload, ctx);
|
|
1321
|
+
}
|
|
1322
|
+
// forward
|
|
1183
1323
|
const result = inst._zod.parse(payload, ctx);
|
|
1184
1324
|
if (result instanceof Promise) {
|
|
1185
1325
|
if (ctx.async === false)
|
|
@@ -1261,9 +1401,10 @@ const $ZodURL = /*@__PURE__*/ $constructor("$ZodURL", (inst, def) => {
|
|
|
1261
1401
|
$ZodStringFormat.init(inst, def);
|
|
1262
1402
|
inst._zod.check = (payload) => {
|
|
1263
1403
|
try {
|
|
1264
|
-
|
|
1265
|
-
const
|
|
1266
|
-
|
|
1404
|
+
// Trim whitespace from input
|
|
1405
|
+
const trimmed = payload.value.trim();
|
|
1406
|
+
// @ts-ignore
|
|
1407
|
+
const url = new URL(trimmed);
|
|
1267
1408
|
if (def.hostname) {
|
|
1268
1409
|
def.hostname.lastIndex = 0;
|
|
1269
1410
|
if (!def.hostname.test(url.hostname)) {
|
|
@@ -1292,12 +1433,14 @@ const $ZodURL = /*@__PURE__*/ $constructor("$ZodURL", (inst, def) => {
|
|
|
1292
1433
|
});
|
|
1293
1434
|
}
|
|
1294
1435
|
}
|
|
1295
|
-
//
|
|
1296
|
-
if (
|
|
1297
|
-
|
|
1436
|
+
// Set the output value based on normalize flag
|
|
1437
|
+
if (def.normalize) {
|
|
1438
|
+
// Use normalized URL
|
|
1439
|
+
payload.value = url.href;
|
|
1298
1440
|
}
|
|
1299
1441
|
else {
|
|
1300
|
-
|
|
1442
|
+
// Preserve the original input (trimmed)
|
|
1443
|
+
payload.value = trimmed;
|
|
1301
1444
|
}
|
|
1302
1445
|
return;
|
|
1303
1446
|
}
|
|
@@ -1345,7 +1488,7 @@ const $ZodISODateTime = /*@__PURE__*/ $constructor("$ZodISODateTime", (inst, def
|
|
|
1345
1488
|
$ZodStringFormat.init(inst, def);
|
|
1346
1489
|
});
|
|
1347
1490
|
const $ZodISODate = /*@__PURE__*/ $constructor("$ZodISODate", (inst, def) => {
|
|
1348
|
-
def.pattern ?? (def.pattern = date$
|
|
1491
|
+
def.pattern ?? (def.pattern = date$3);
|
|
1349
1492
|
$ZodStringFormat.init(inst, def);
|
|
1350
1493
|
});
|
|
1351
1494
|
const $ZodISOTime = /*@__PURE__*/ $constructor("$ZodISOTime", (inst, def) => {
|
|
@@ -1373,6 +1516,7 @@ const $ZodIPv6 = /*@__PURE__*/ $constructor("$ZodIPv6", (inst, def) => {
|
|
|
1373
1516
|
});
|
|
1374
1517
|
inst._zod.check = (payload) => {
|
|
1375
1518
|
try {
|
|
1519
|
+
// @ts-ignore
|
|
1376
1520
|
new URL(`http://[${payload.value}]`);
|
|
1377
1521
|
// return;
|
|
1378
1522
|
}
|
|
@@ -1395,8 +1539,11 @@ const $ZodCIDRv6 = /*@__PURE__*/ $constructor("$ZodCIDRv6", (inst, def) => {
|
|
|
1395
1539
|
def.pattern ?? (def.pattern = cidrv6); // not used for validation
|
|
1396
1540
|
$ZodStringFormat.init(inst, def);
|
|
1397
1541
|
inst._zod.check = (payload) => {
|
|
1398
|
-
const
|
|
1542
|
+
const parts = payload.value.split("/");
|
|
1399
1543
|
try {
|
|
1544
|
+
if (parts.length !== 2)
|
|
1545
|
+
throw new Error();
|
|
1546
|
+
const [address, prefix] = parts;
|
|
1400
1547
|
if (!prefix)
|
|
1401
1548
|
throw new Error();
|
|
1402
1549
|
const prefixNum = Number(prefix);
|
|
@@ -1404,6 +1551,7 @@ const $ZodCIDRv6 = /*@__PURE__*/ $constructor("$ZodCIDRv6", (inst, def) => {
|
|
|
1404
1551
|
throw new Error();
|
|
1405
1552
|
if (prefixNum < 0 || prefixNum > 128)
|
|
1406
1553
|
throw new Error();
|
|
1554
|
+
// @ts-ignore
|
|
1407
1555
|
new URL(`http://[${address}]`);
|
|
1408
1556
|
}
|
|
1409
1557
|
catch {
|
|
@@ -1424,6 +1572,7 @@ function isValidBase64(data) {
|
|
|
1424
1572
|
if (data.length % 4 !== 0)
|
|
1425
1573
|
return false;
|
|
1426
1574
|
try {
|
|
1575
|
+
// @ts-ignore
|
|
1427
1576
|
atob(data);
|
|
1428
1577
|
return true;
|
|
1429
1578
|
}
|
|
@@ -1488,6 +1637,7 @@ function isValidJWT(token, algorithm = null) {
|
|
|
1488
1637
|
const [header] = tokensParts;
|
|
1489
1638
|
if (!header)
|
|
1490
1639
|
return false;
|
|
1640
|
+
// @ts-ignore
|
|
1491
1641
|
const parsedHeader = JSON.parse(atob(header));
|
|
1492
1642
|
if ("typ" in parsedHeader && parsedHeader?.typ !== "JWT")
|
|
1493
1643
|
return false;
|
|
@@ -1654,58 +1804,88 @@ const $ZodArray = /*@__PURE__*/ $constructor("$ZodArray", (inst, def) => {
|
|
|
1654
1804
|
return payload; //handleArrayResultsAsync(parseResults, final);
|
|
1655
1805
|
};
|
|
1656
1806
|
});
|
|
1657
|
-
function
|
|
1658
|
-
// if(isOptional)
|
|
1807
|
+
function handlePropertyResult(result, final, key, input) {
|
|
1659
1808
|
if (result.issues.length) {
|
|
1660
1809
|
final.issues.push(...prefixIssues(key, result.issues));
|
|
1661
1810
|
}
|
|
1662
|
-
|
|
1811
|
+
if (result.value === undefined) {
|
|
1812
|
+
if (key in input) {
|
|
1813
|
+
final.value[key] = undefined;
|
|
1814
|
+
}
|
|
1815
|
+
}
|
|
1816
|
+
else {
|
|
1817
|
+
final.value[key] = result.value;
|
|
1818
|
+
}
|
|
1663
1819
|
}
|
|
1664
|
-
function
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
if (
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1820
|
+
function normalizeDef(def) {
|
|
1821
|
+
const keys = Object.keys(def.shape);
|
|
1822
|
+
for (const k of keys) {
|
|
1823
|
+
if (!def.shape?.[k]?._zod?.traits?.has("$ZodType")) {
|
|
1824
|
+
throw new Error(`Invalid element at key "${k}": expected a Zod schema`);
|
|
1825
|
+
}
|
|
1826
|
+
}
|
|
1827
|
+
const okeys = optionalKeys(def.shape);
|
|
1828
|
+
return {
|
|
1829
|
+
...def,
|
|
1830
|
+
keys,
|
|
1831
|
+
keySet: new Set(keys),
|
|
1832
|
+
numKeys: keys.length,
|
|
1833
|
+
optionalKeys: new Set(okeys),
|
|
1834
|
+
};
|
|
1835
|
+
}
|
|
1836
|
+
function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
1837
|
+
const unrecognized = [];
|
|
1838
|
+
// iterate over input keys
|
|
1839
|
+
const keySet = def.keySet;
|
|
1840
|
+
const _catchall = def.catchall._zod;
|
|
1841
|
+
const t = _catchall.def.type;
|
|
1842
|
+
for (const key of Object.keys(input)) {
|
|
1843
|
+
if (keySet.has(key))
|
|
1844
|
+
continue;
|
|
1845
|
+
if (t === "never") {
|
|
1846
|
+
unrecognized.push(key);
|
|
1847
|
+
continue;
|
|
1848
|
+
}
|
|
1849
|
+
const r = _catchall.run({ value: input[key], issues: [] }, ctx);
|
|
1850
|
+
if (r instanceof Promise) {
|
|
1851
|
+
proms.push(r.then((r) => handlePropertyResult(r, payload, key, input)));
|
|
1675
1852
|
}
|
|
1676
1853
|
else {
|
|
1677
|
-
|
|
1854
|
+
handlePropertyResult(r, payload, key, input);
|
|
1678
1855
|
}
|
|
1679
1856
|
}
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
final.value[key] = result.value;
|
|
1857
|
+
if (unrecognized.length) {
|
|
1858
|
+
payload.issues.push({
|
|
1859
|
+
code: "unrecognized_keys",
|
|
1860
|
+
keys: unrecognized,
|
|
1861
|
+
input,
|
|
1862
|
+
inst,
|
|
1863
|
+
});
|
|
1688
1864
|
}
|
|
1865
|
+
if (!proms.length)
|
|
1866
|
+
return payload;
|
|
1867
|
+
return Promise.all(proms).then(() => {
|
|
1868
|
+
return payload;
|
|
1869
|
+
});
|
|
1689
1870
|
}
|
|
1690
1871
|
const $ZodObject = /*@__PURE__*/ $constructor("$ZodObject", (inst, def) => {
|
|
1691
1872
|
// requires cast because technically $ZodObject doesn't extend
|
|
1692
1873
|
$ZodType.init(inst, def);
|
|
1693
|
-
const
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
});
|
|
1874
|
+
// const sh = def.shape;
|
|
1875
|
+
const desc = Object.getOwnPropertyDescriptor(def, "shape");
|
|
1876
|
+
if (!desc?.get) {
|
|
1877
|
+
const sh = def.shape;
|
|
1878
|
+
Object.defineProperty(def, "shape", {
|
|
1879
|
+
get: () => {
|
|
1880
|
+
const newSh = { ...sh };
|
|
1881
|
+
Object.defineProperty(def, "shape", {
|
|
1882
|
+
value: newSh,
|
|
1883
|
+
});
|
|
1884
|
+
return newSh;
|
|
1885
|
+
},
|
|
1886
|
+
});
|
|
1887
|
+
}
|
|
1888
|
+
const _normalized = cached(() => normalizeDef(def));
|
|
1709
1889
|
defineLazy(inst._zod, "propValues", () => {
|
|
1710
1890
|
const shape = def.shape;
|
|
1711
1891
|
const propValues = {};
|
|
@@ -1719,6 +1899,45 @@ const $ZodObject = /*@__PURE__*/ $constructor("$ZodObject", (inst, def) => {
|
|
|
1719
1899
|
}
|
|
1720
1900
|
return propValues;
|
|
1721
1901
|
});
|
|
1902
|
+
const isObject$1 = isObject;
|
|
1903
|
+
const catchall = def.catchall;
|
|
1904
|
+
let value;
|
|
1905
|
+
inst._zod.parse = (payload, ctx) => {
|
|
1906
|
+
value ?? (value = _normalized.value);
|
|
1907
|
+
const input = payload.value;
|
|
1908
|
+
if (!isObject$1(input)) {
|
|
1909
|
+
payload.issues.push({
|
|
1910
|
+
expected: "object",
|
|
1911
|
+
code: "invalid_type",
|
|
1912
|
+
input,
|
|
1913
|
+
inst,
|
|
1914
|
+
});
|
|
1915
|
+
return payload;
|
|
1916
|
+
}
|
|
1917
|
+
payload.value = {};
|
|
1918
|
+
const proms = [];
|
|
1919
|
+
const shape = value.shape;
|
|
1920
|
+
for (const key of value.keys) {
|
|
1921
|
+
const el = shape[key];
|
|
1922
|
+
const r = el._zod.run({ value: input[key], issues: [] }, ctx);
|
|
1923
|
+
if (r instanceof Promise) {
|
|
1924
|
+
proms.push(r.then((r) => handlePropertyResult(r, payload, key, input)));
|
|
1925
|
+
}
|
|
1926
|
+
else {
|
|
1927
|
+
handlePropertyResult(r, payload, key, input);
|
|
1928
|
+
}
|
|
1929
|
+
}
|
|
1930
|
+
if (!catchall) {
|
|
1931
|
+
return proms.length ? Promise.all(proms).then(() => payload) : payload;
|
|
1932
|
+
}
|
|
1933
|
+
return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
|
|
1934
|
+
};
|
|
1935
|
+
});
|
|
1936
|
+
const $ZodObjectJIT = /*@__PURE__*/ $constructor("$ZodObjectJIT", (inst, def) => {
|
|
1937
|
+
// requires cast because technically $ZodObject doesn't extend
|
|
1938
|
+
$ZodObject.init(inst, def);
|
|
1939
|
+
const superParse = inst._zod.parse;
|
|
1940
|
+
const _normalized = cached(() => normalizeDef(def));
|
|
1722
1941
|
const generateFastpass = (shape) => {
|
|
1723
1942
|
const doc = new Doc(["shape", "payload", "ctx"]);
|
|
1724
1943
|
const normalized = _normalized.value;
|
|
@@ -1733,44 +1952,29 @@ const $ZodObject = /*@__PURE__*/ $constructor("$ZodObject", (inst, def) => {
|
|
|
1733
1952
|
ids[key] = `key_${counter++}`;
|
|
1734
1953
|
}
|
|
1735
1954
|
// A: preserve key order {
|
|
1736
|
-
doc.write(`const newResult = {}
|
|
1955
|
+
doc.write(`const newResult = {};`);
|
|
1737
1956
|
for (const key of normalized.keys) {
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
doc.write(`
|
|
1957
|
+
const id = ids[key];
|
|
1958
|
+
const k = esc(key);
|
|
1959
|
+
doc.write(`const ${id} = ${parseStr(key)};`);
|
|
1960
|
+
doc.write(`
|
|
1743
1961
|
if (${id}.issues.length) {
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
);
|
|
1962
|
+
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
1963
|
+
...iss,
|
|
1964
|
+
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
1965
|
+
})));
|
|
1966
|
+
}
|
|
1967
|
+
|
|
1968
|
+
|
|
1969
|
+
if (${id}.value === undefined) {
|
|
1970
|
+
if (${k} in input) {
|
|
1971
|
+
newResult[${k}] = undefined;
|
|
1755
1972
|
}
|
|
1756
|
-
} else if (${id}.value === undefined) {
|
|
1757
|
-
if (${k} in input) newResult[${k}] = undefined;
|
|
1758
1973
|
} else {
|
|
1759
1974
|
newResult[${k}] = ${id}.value;
|
|
1760
1975
|
}
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
else {
|
|
1764
|
-
const id = ids[key];
|
|
1765
|
-
// const id = ids[key];
|
|
1766
|
-
doc.write(`const ${id} = ${parseStr(key)};`);
|
|
1767
|
-
doc.write(`
|
|
1768
|
-
if (${id}.issues.length) payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
1769
|
-
...iss,
|
|
1770
|
-
path: iss.path ? [${esc(key)}, ...iss.path] : [${esc(key)}]
|
|
1771
|
-
})));`);
|
|
1772
|
-
doc.write(`newResult[${esc(key)}] = ${id}.value`);
|
|
1773
|
-
}
|
|
1976
|
+
|
|
1977
|
+
`);
|
|
1774
1978
|
}
|
|
1775
1979
|
doc.write(`payload.value = newResult;`);
|
|
1776
1980
|
doc.write(`return payload;`);
|
|
@@ -1796,80 +2000,16 @@ const $ZodObject = /*@__PURE__*/ $constructor("$ZodObject", (inst, def) => {
|
|
|
1796
2000
|
});
|
|
1797
2001
|
return payload;
|
|
1798
2002
|
}
|
|
1799
|
-
const proms = [];
|
|
1800
2003
|
if (jit && fastEnabled && ctx?.async === false && ctx.jitless !== true) {
|
|
1801
2004
|
// always synchronous
|
|
1802
2005
|
if (!fastpass)
|
|
1803
2006
|
fastpass = generateFastpass(def.shape);
|
|
1804
2007
|
payload = fastpass(payload, ctx);
|
|
2008
|
+
if (!catchall)
|
|
2009
|
+
return payload;
|
|
2010
|
+
return handleCatchall([], input, payload, ctx, value, inst);
|
|
1805
2011
|
}
|
|
1806
|
-
|
|
1807
|
-
payload.value = {};
|
|
1808
|
-
const shape = value.shape;
|
|
1809
|
-
for (const key of value.keys) {
|
|
1810
|
-
const el = shape[key];
|
|
1811
|
-
// do not add omitted optional keys
|
|
1812
|
-
// if (!(key in input)) {
|
|
1813
|
-
// if (optionalKeys.has(key)) continue;
|
|
1814
|
-
// payload.issues.push({
|
|
1815
|
-
// code: "invalid_type",
|
|
1816
|
-
// path: [key],
|
|
1817
|
-
// expected: "nonoptional",
|
|
1818
|
-
// note: `Missing required key: "${key}"`,
|
|
1819
|
-
// input,
|
|
1820
|
-
// inst,
|
|
1821
|
-
// });
|
|
1822
|
-
// }
|
|
1823
|
-
const r = el._zod.run({ value: input[key], issues: [] }, ctx);
|
|
1824
|
-
const isOptional = el._zod.optin === "optional" && el._zod.optout === "optional";
|
|
1825
|
-
if (r instanceof Promise) {
|
|
1826
|
-
proms.push(r.then((r) => isOptional ? handleOptionalObjectResult(r, payload, key, input) : handleObjectResult(r, payload, key)));
|
|
1827
|
-
}
|
|
1828
|
-
else if (isOptional) {
|
|
1829
|
-
handleOptionalObjectResult(r, payload, key, input);
|
|
1830
|
-
}
|
|
1831
|
-
else {
|
|
1832
|
-
handleObjectResult(r, payload, key);
|
|
1833
|
-
}
|
|
1834
|
-
}
|
|
1835
|
-
}
|
|
1836
|
-
if (!catchall) {
|
|
1837
|
-
// return payload;
|
|
1838
|
-
return proms.length ? Promise.all(proms).then(() => payload) : payload;
|
|
1839
|
-
}
|
|
1840
|
-
const unrecognized = [];
|
|
1841
|
-
// iterate over input keys
|
|
1842
|
-
const keySet = value.keySet;
|
|
1843
|
-
const _catchall = catchall._zod;
|
|
1844
|
-
const t = _catchall.def.type;
|
|
1845
|
-
for (const key of Object.keys(input)) {
|
|
1846
|
-
if (keySet.has(key))
|
|
1847
|
-
continue;
|
|
1848
|
-
if (t === "never") {
|
|
1849
|
-
unrecognized.push(key);
|
|
1850
|
-
continue;
|
|
1851
|
-
}
|
|
1852
|
-
const r = _catchall.run({ value: input[key], issues: [] }, ctx);
|
|
1853
|
-
if (r instanceof Promise) {
|
|
1854
|
-
proms.push(r.then((r) => handleObjectResult(r, payload, key)));
|
|
1855
|
-
}
|
|
1856
|
-
else {
|
|
1857
|
-
handleObjectResult(r, payload, key);
|
|
1858
|
-
}
|
|
1859
|
-
}
|
|
1860
|
-
if (unrecognized.length) {
|
|
1861
|
-
payload.issues.push({
|
|
1862
|
-
code: "unrecognized_keys",
|
|
1863
|
-
keys: unrecognized,
|
|
1864
|
-
input,
|
|
1865
|
-
inst,
|
|
1866
|
-
});
|
|
1867
|
-
}
|
|
1868
|
-
if (!proms.length)
|
|
1869
|
-
return payload;
|
|
1870
|
-
return Promise.all(proms).then(() => {
|
|
1871
|
-
return payload;
|
|
1872
|
-
});
|
|
2012
|
+
return superParse(payload, ctx);
|
|
1873
2013
|
};
|
|
1874
2014
|
});
|
|
1875
2015
|
function handleUnionResults(results, final, inst, ctx) {
|
|
@@ -1879,6 +2019,11 @@ function handleUnionResults(results, final, inst, ctx) {
|
|
|
1879
2019
|
return final;
|
|
1880
2020
|
}
|
|
1881
2021
|
}
|
|
2022
|
+
const nonaborted = results.filter((r) => !aborted(r));
|
|
2023
|
+
if (nonaborted.length === 1) {
|
|
2024
|
+
final.value = nonaborted[0].value;
|
|
2025
|
+
return nonaborted[0];
|
|
2026
|
+
}
|
|
1882
2027
|
final.issues.push({
|
|
1883
2028
|
code: "invalid_union",
|
|
1884
2029
|
input: final.value,
|
|
@@ -1904,7 +2049,12 @@ const $ZodUnion = /*@__PURE__*/ $constructor("$ZodUnion", (inst, def) => {
|
|
|
1904
2049
|
}
|
|
1905
2050
|
return undefined;
|
|
1906
2051
|
});
|
|
2052
|
+
const single = def.options.length === 1;
|
|
2053
|
+
const first = def.options[0]._zod.run;
|
|
1907
2054
|
inst._zod.parse = (payload, ctx) => {
|
|
2055
|
+
if (single) {
|
|
2056
|
+
return first(payload, ctx);
|
|
2057
|
+
}
|
|
1908
2058
|
let async = false;
|
|
1909
2059
|
const results = [];
|
|
1910
2060
|
for (const option of def.options) {
|
|
@@ -2028,10 +2178,10 @@ const $ZodTuple = /*@__PURE__*/ $constructor("$ZodTuple", (inst, def) => {
|
|
|
2028
2178
|
const tooSmall = input.length < optStart - 1;
|
|
2029
2179
|
if (tooBig || tooSmall) {
|
|
2030
2180
|
payload.issues.push({
|
|
2181
|
+
...(tooBig ? { code: "too_big", maximum: items.length } : { code: "too_small", minimum: items.length }),
|
|
2031
2182
|
input,
|
|
2032
2183
|
inst,
|
|
2033
2184
|
origin: "array",
|
|
2034
|
-
...(tooBig ? { code: "too_big", maximum: items.length } : { code: "too_small", minimum: items.length }),
|
|
2035
2185
|
});
|
|
2036
2186
|
return payload;
|
|
2037
2187
|
}
|
|
@@ -2143,8 +2293,8 @@ const $ZodRecord = /*@__PURE__*/ $constructor("$ZodRecord", (inst, def) => {
|
|
|
2143
2293
|
}
|
|
2144
2294
|
if (keyResult.issues.length) {
|
|
2145
2295
|
payload.issues.push({
|
|
2146
|
-
origin: "record",
|
|
2147
2296
|
code: "invalid_key",
|
|
2297
|
+
origin: "record",
|
|
2148
2298
|
issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
|
|
2149
2299
|
input: key,
|
|
2150
2300
|
path: [key],
|
|
@@ -2179,14 +2329,15 @@ const $ZodRecord = /*@__PURE__*/ $constructor("$ZodRecord", (inst, def) => {
|
|
|
2179
2329
|
const $ZodEnum = /*@__PURE__*/ $constructor("$ZodEnum", (inst, def) => {
|
|
2180
2330
|
$ZodType.init(inst, def);
|
|
2181
2331
|
const values = getEnumValues(def.entries);
|
|
2182
|
-
|
|
2332
|
+
const valuesSet = new Set(values);
|
|
2333
|
+
inst._zod.values = valuesSet;
|
|
2183
2334
|
inst._zod.pattern = new RegExp(`^(${values
|
|
2184
2335
|
.filter((k) => propertyKeyTypes.has(typeof k))
|
|
2185
2336
|
.map((o) => (typeof o === "string" ? escapeRegex(o) : o.toString()))
|
|
2186
2337
|
.join("|")})$`);
|
|
2187
2338
|
inst._zod.parse = (payload, _ctx) => {
|
|
2188
2339
|
const input = payload.value;
|
|
2189
|
-
if (
|
|
2340
|
+
if (valuesSet.has(input)) {
|
|
2190
2341
|
return payload;
|
|
2191
2342
|
}
|
|
2192
2343
|
payload.issues.push({
|
|
@@ -2200,9 +2351,12 @@ const $ZodEnum = /*@__PURE__*/ $constructor("$ZodEnum", (inst, def) => {
|
|
|
2200
2351
|
});
|
|
2201
2352
|
const $ZodLiteral = /*@__PURE__*/ $constructor("$ZodLiteral", (inst, def) => {
|
|
2202
2353
|
$ZodType.init(inst, def);
|
|
2354
|
+
if (def.values.length === 0) {
|
|
2355
|
+
throw new Error("Cannot create literal schema with no valid values");
|
|
2356
|
+
}
|
|
2203
2357
|
inst._zod.values = new Set(def.values);
|
|
2204
2358
|
inst._zod.pattern = new RegExp(`^(${def.values
|
|
2205
|
-
.map((o) => (typeof o === "string" ? escapeRegex(o) : o ? o.toString() : String(o)))
|
|
2359
|
+
.map((o) => (typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)))
|
|
2206
2360
|
.join("|")})$`);
|
|
2207
2361
|
inst._zod.parse = (payload, _ctx) => {
|
|
2208
2362
|
const input = payload.value;
|
|
@@ -2220,9 +2374,12 @@ const $ZodLiteral = /*@__PURE__*/ $constructor("$ZodLiteral", (inst, def) => {
|
|
|
2220
2374
|
});
|
|
2221
2375
|
const $ZodTransform = /*@__PURE__*/ $constructor("$ZodTransform", (inst, def) => {
|
|
2222
2376
|
$ZodType.init(inst, def);
|
|
2223
|
-
inst._zod.parse = (payload,
|
|
2377
|
+
inst._zod.parse = (payload, ctx) => {
|
|
2378
|
+
if (ctx.direction === "backward") {
|
|
2379
|
+
throw new $ZodEncodeError(inst.constructor.name);
|
|
2380
|
+
}
|
|
2224
2381
|
const _out = def.transform(payload.value, payload);
|
|
2225
|
-
if (
|
|
2382
|
+
if (ctx.async) {
|
|
2226
2383
|
const output = _out instanceof Promise ? _out : Promise.resolve(_out);
|
|
2227
2384
|
return output.then((output) => {
|
|
2228
2385
|
payload.value = output;
|
|
@@ -2236,6 +2393,12 @@ const $ZodTransform = /*@__PURE__*/ $constructor("$ZodTransform", (inst, def) =>
|
|
|
2236
2393
|
return payload;
|
|
2237
2394
|
};
|
|
2238
2395
|
});
|
|
2396
|
+
function handleOptionalResult(result, input) {
|
|
2397
|
+
if (result.issues.length && input === undefined) {
|
|
2398
|
+
return { issues: [], value: undefined };
|
|
2399
|
+
}
|
|
2400
|
+
return result;
|
|
2401
|
+
}
|
|
2239
2402
|
const $ZodOptional = /*@__PURE__*/ $constructor("$ZodOptional", (inst, def) => {
|
|
2240
2403
|
$ZodType.init(inst, def);
|
|
2241
2404
|
inst._zod.optin = "optional";
|
|
@@ -2249,7 +2412,10 @@ const $ZodOptional = /*@__PURE__*/ $constructor("$ZodOptional", (inst, def) => {
|
|
|
2249
2412
|
});
|
|
2250
2413
|
inst._zod.parse = (payload, ctx) => {
|
|
2251
2414
|
if (def.innerType._zod.optin === "optional") {
|
|
2252
|
-
|
|
2415
|
+
const result = def.innerType._zod.run(payload, ctx);
|
|
2416
|
+
if (result instanceof Promise)
|
|
2417
|
+
return result.then((r) => handleOptionalResult(r, payload.value));
|
|
2418
|
+
return handleOptionalResult(result, payload.value);
|
|
2253
2419
|
}
|
|
2254
2420
|
if (payload.value === undefined) {
|
|
2255
2421
|
return payload;
|
|
@@ -2269,6 +2435,7 @@ const $ZodNullable = /*@__PURE__*/ $constructor("$ZodNullable", (inst, def) => {
|
|
|
2269
2435
|
return def.innerType._zod.values ? new Set([...def.innerType._zod.values, null]) : undefined;
|
|
2270
2436
|
});
|
|
2271
2437
|
inst._zod.parse = (payload, ctx) => {
|
|
2438
|
+
// Forward direction (decode): allow null to pass through
|
|
2272
2439
|
if (payload.value === null)
|
|
2273
2440
|
return payload;
|
|
2274
2441
|
return def.innerType._zod.run(payload, ctx);
|
|
@@ -2280,13 +2447,18 @@ const $ZodDefault = /*@__PURE__*/ $constructor("$ZodDefault", (inst, def) => {
|
|
|
2280
2447
|
inst._zod.optin = "optional";
|
|
2281
2448
|
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
2282
2449
|
inst._zod.parse = (payload, ctx) => {
|
|
2450
|
+
if (ctx.direction === "backward") {
|
|
2451
|
+
return def.innerType._zod.run(payload, ctx);
|
|
2452
|
+
}
|
|
2453
|
+
// Forward direction (decode): apply defaults for undefined input
|
|
2283
2454
|
if (payload.value === undefined) {
|
|
2284
2455
|
payload.value = def.defaultValue;
|
|
2285
2456
|
/**
|
|
2286
|
-
* $ZodDefault
|
|
2457
|
+
* $ZodDefault returns the default value immediately in forward direction.
|
|
2287
2458
|
* It doesn't pass the default value into the validator ("prefault"). There's no reason to pass the default value through validation. The validity of the default is enforced by TypeScript statically. Otherwise, it's the responsibility of the user to ensure the default is valid. In the case of pipes with divergent in/out types, you can specify the default on the `in` schema of your ZodPipe to set a "prefault" for the pipe. */
|
|
2288
2459
|
return payload;
|
|
2289
2460
|
}
|
|
2461
|
+
// Forward direction: continue with default handling
|
|
2290
2462
|
const result = def.innerType._zod.run(payload, ctx);
|
|
2291
2463
|
if (result instanceof Promise) {
|
|
2292
2464
|
return result.then((result) => handleDefaultResult(result, def));
|
|
@@ -2305,6 +2477,10 @@ const $ZodPrefault = /*@__PURE__*/ $constructor("$ZodPrefault", (inst, def) => {
|
|
|
2305
2477
|
inst._zod.optin = "optional";
|
|
2306
2478
|
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
2307
2479
|
inst._zod.parse = (payload, ctx) => {
|
|
2480
|
+
if (ctx.direction === "backward") {
|
|
2481
|
+
return def.innerType._zod.run(payload, ctx);
|
|
2482
|
+
}
|
|
2483
|
+
// Forward direction (decode): apply prefault for undefined input
|
|
2308
2484
|
if (payload.value === undefined) {
|
|
2309
2485
|
payload.value = def.defaultValue;
|
|
2310
2486
|
}
|
|
@@ -2338,10 +2514,14 @@ function handleNonOptionalResult(payload, inst) {
|
|
|
2338
2514
|
}
|
|
2339
2515
|
const $ZodCatch = /*@__PURE__*/ $constructor("$ZodCatch", (inst, def) => {
|
|
2340
2516
|
$ZodType.init(inst, def);
|
|
2341
|
-
inst._zod
|
|
2517
|
+
defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
|
|
2342
2518
|
defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
|
|
2343
2519
|
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
2344
2520
|
inst._zod.parse = (payload, ctx) => {
|
|
2521
|
+
if (ctx.direction === "backward") {
|
|
2522
|
+
return def.innerType._zod.run(payload, ctx);
|
|
2523
|
+
}
|
|
2524
|
+
// Forward direction (decode): apply catch logic
|
|
2345
2525
|
const result = def.innerType._zod.run(payload, ctx);
|
|
2346
2526
|
if (result instanceof Promise) {
|
|
2347
2527
|
return result.then((result) => {
|
|
@@ -2380,18 +2560,27 @@ const $ZodPipe = /*@__PURE__*/ $constructor("$ZodPipe", (inst, def) => {
|
|
|
2380
2560
|
defineLazy(inst._zod, "optout", () => def.out._zod.optout);
|
|
2381
2561
|
defineLazy(inst._zod, "propValues", () => def.in._zod.propValues);
|
|
2382
2562
|
inst._zod.parse = (payload, ctx) => {
|
|
2563
|
+
if (ctx.direction === "backward") {
|
|
2564
|
+
const right = def.out._zod.run(payload, ctx);
|
|
2565
|
+
if (right instanceof Promise) {
|
|
2566
|
+
return right.then((right) => handlePipeResult(right, def.in, ctx));
|
|
2567
|
+
}
|
|
2568
|
+
return handlePipeResult(right, def.in, ctx);
|
|
2569
|
+
}
|
|
2383
2570
|
const left = def.in._zod.run(payload, ctx);
|
|
2384
2571
|
if (left instanceof Promise) {
|
|
2385
|
-
return left.then((left) => handlePipeResult(left, def, ctx));
|
|
2572
|
+
return left.then((left) => handlePipeResult(left, def.out, ctx));
|
|
2386
2573
|
}
|
|
2387
|
-
return handlePipeResult(left, def, ctx);
|
|
2574
|
+
return handlePipeResult(left, def.out, ctx);
|
|
2388
2575
|
};
|
|
2389
2576
|
});
|
|
2390
|
-
function handlePipeResult(left,
|
|
2391
|
-
if (
|
|
2577
|
+
function handlePipeResult(left, next, ctx) {
|
|
2578
|
+
if (left.issues.length) {
|
|
2579
|
+
// prevent further checks
|
|
2580
|
+
left.aborted = true;
|
|
2392
2581
|
return left;
|
|
2393
2582
|
}
|
|
2394
|
-
return
|
|
2583
|
+
return next._zod.run({ value: left.value, issues: left.issues }, ctx);
|
|
2395
2584
|
}
|
|
2396
2585
|
const $ZodReadonly = /*@__PURE__*/ $constructor("$ZodReadonly", (inst, def) => {
|
|
2397
2586
|
$ZodType.init(inst, def);
|
|
@@ -2400,6 +2589,9 @@ const $ZodReadonly = /*@__PURE__*/ $constructor("$ZodReadonly", (inst, def) => {
|
|
|
2400
2589
|
defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
|
|
2401
2590
|
defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
|
|
2402
2591
|
inst._zod.parse = (payload, ctx) => {
|
|
2592
|
+
if (ctx.direction === "backward") {
|
|
2593
|
+
return def.innerType._zod.run(payload, ctx);
|
|
2594
|
+
}
|
|
2403
2595
|
const result = def.innerType._zod.run(payload, ctx);
|
|
2404
2596
|
if (result instanceof Promise) {
|
|
2405
2597
|
return result.then(handleReadonlyResult);
|
|
@@ -2411,6 +2603,85 @@ function handleReadonlyResult(payload) {
|
|
|
2411
2603
|
payload.value = Object.freeze(payload.value);
|
|
2412
2604
|
return payload;
|
|
2413
2605
|
}
|
|
2606
|
+
const $ZodFunction = /*@__PURE__*/ $constructor("$ZodFunction", (inst, def) => {
|
|
2607
|
+
$ZodType.init(inst, def);
|
|
2608
|
+
inst._def = def;
|
|
2609
|
+
inst._zod.def = def;
|
|
2610
|
+
inst.implement = (func) => {
|
|
2611
|
+
if (typeof func !== "function") {
|
|
2612
|
+
throw new Error("implement() must be called with a function");
|
|
2613
|
+
}
|
|
2614
|
+
return function (...args) {
|
|
2615
|
+
const parsedArgs = inst._def.input ? parse$1(inst._def.input, args) : args;
|
|
2616
|
+
const result = Reflect.apply(func, this, parsedArgs);
|
|
2617
|
+
if (inst._def.output) {
|
|
2618
|
+
return parse$1(inst._def.output, result);
|
|
2619
|
+
}
|
|
2620
|
+
return result;
|
|
2621
|
+
};
|
|
2622
|
+
};
|
|
2623
|
+
inst.implementAsync = (func) => {
|
|
2624
|
+
if (typeof func !== "function") {
|
|
2625
|
+
throw new Error("implementAsync() must be called with a function");
|
|
2626
|
+
}
|
|
2627
|
+
return async function (...args) {
|
|
2628
|
+
const parsedArgs = inst._def.input ? await parseAsync$1(inst._def.input, args) : args;
|
|
2629
|
+
const result = await Reflect.apply(func, this, parsedArgs);
|
|
2630
|
+
if (inst._def.output) {
|
|
2631
|
+
return await parseAsync$1(inst._def.output, result);
|
|
2632
|
+
}
|
|
2633
|
+
return result;
|
|
2634
|
+
};
|
|
2635
|
+
};
|
|
2636
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
2637
|
+
if (typeof payload.value !== "function") {
|
|
2638
|
+
payload.issues.push({
|
|
2639
|
+
code: "invalid_type",
|
|
2640
|
+
expected: "function",
|
|
2641
|
+
input: payload.value,
|
|
2642
|
+
inst,
|
|
2643
|
+
});
|
|
2644
|
+
return payload;
|
|
2645
|
+
}
|
|
2646
|
+
// Check if output is a promise type to determine if we should use async implementation
|
|
2647
|
+
const hasPromiseOutput = inst._def.output && inst._def.output._zod.def.type === "promise";
|
|
2648
|
+
if (hasPromiseOutput) {
|
|
2649
|
+
payload.value = inst.implementAsync(payload.value);
|
|
2650
|
+
}
|
|
2651
|
+
else {
|
|
2652
|
+
payload.value = inst.implement(payload.value);
|
|
2653
|
+
}
|
|
2654
|
+
return payload;
|
|
2655
|
+
};
|
|
2656
|
+
inst.input = (...args) => {
|
|
2657
|
+
const F = inst.constructor;
|
|
2658
|
+
if (Array.isArray(args[0])) {
|
|
2659
|
+
return new F({
|
|
2660
|
+
type: "function",
|
|
2661
|
+
input: new $ZodTuple({
|
|
2662
|
+
type: "tuple",
|
|
2663
|
+
items: args[0],
|
|
2664
|
+
rest: args[1],
|
|
2665
|
+
}),
|
|
2666
|
+
output: inst._def.output,
|
|
2667
|
+
});
|
|
2668
|
+
}
|
|
2669
|
+
return new F({
|
|
2670
|
+
type: "function",
|
|
2671
|
+
input: args[0],
|
|
2672
|
+
output: inst._def.output,
|
|
2673
|
+
});
|
|
2674
|
+
};
|
|
2675
|
+
inst.output = (output) => {
|
|
2676
|
+
const F = inst.constructor;
|
|
2677
|
+
return new F({
|
|
2678
|
+
type: "function",
|
|
2679
|
+
input: inst._def.input,
|
|
2680
|
+
output,
|
|
2681
|
+
});
|
|
2682
|
+
};
|
|
2683
|
+
return inst;
|
|
2684
|
+
});
|
|
2414
2685
|
const $ZodCustom = /*@__PURE__*/ $constructor("$ZodCustom", (inst, def) => {
|
|
2415
2686
|
$ZodCheck.init(inst, def);
|
|
2416
2687
|
$ZodType.init(inst, def);
|
|
@@ -2445,7 +2716,7 @@ function handleRefineResult(result, payload, input, inst) {
|
|
|
2445
2716
|
|
|
2446
2717
|
class $ZodRegistry {
|
|
2447
2718
|
constructor() {
|
|
2448
|
-
this._map = new
|
|
2719
|
+
this._map = new WeakMap();
|
|
2449
2720
|
this._idmap = new Map();
|
|
2450
2721
|
}
|
|
2451
2722
|
add(schema, ..._meta) {
|
|
@@ -2460,7 +2731,7 @@ class $ZodRegistry {
|
|
|
2460
2731
|
return this;
|
|
2461
2732
|
}
|
|
2462
2733
|
clear() {
|
|
2463
|
-
this._map = new
|
|
2734
|
+
this._map = new WeakMap();
|
|
2464
2735
|
this._idmap = new Map();
|
|
2465
2736
|
return this;
|
|
2466
2737
|
}
|
|
@@ -2479,7 +2750,8 @@ class $ZodRegistry {
|
|
|
2479
2750
|
if (p) {
|
|
2480
2751
|
const pm = { ...(this.get(p) ?? {}) };
|
|
2481
2752
|
delete pm.id; // do not inherit id
|
|
2482
|
-
|
|
2753
|
+
const f = { ...pm, ...this._map.get(schema) };
|
|
2754
|
+
return Object.keys(f).length ? f : undefined;
|
|
2483
2755
|
}
|
|
2484
2756
|
return this._map.get(schema);
|
|
2485
2757
|
}
|
|
@@ -2780,6 +3052,13 @@ function _date(Class, params) {
|
|
|
2780
3052
|
...normalizeParams(params),
|
|
2781
3053
|
});
|
|
2782
3054
|
}
|
|
3055
|
+
function _coercedDate(Class, params) {
|
|
3056
|
+
return new Class({
|
|
3057
|
+
type: "date",
|
|
3058
|
+
coerce: true,
|
|
3059
|
+
...normalizeParams(params),
|
|
3060
|
+
});
|
|
3061
|
+
}
|
|
2783
3062
|
function _lt(value, params) {
|
|
2784
3063
|
return new $ZodCheckLessThan({
|
|
2785
3064
|
check: "less_than",
|
|
@@ -2919,22 +3198,6 @@ function _array(Class, element, params) {
|
|
|
2919
3198
|
...normalizeParams(params),
|
|
2920
3199
|
});
|
|
2921
3200
|
}
|
|
2922
|
-
// export function _tuple(
|
|
2923
|
-
// Class: util.SchemaClass<schemas.$ZodTuple>,
|
|
2924
|
-
// items: [],
|
|
2925
|
-
// params?: string | $ZodTupleParams
|
|
2926
|
-
// ): schemas.$ZodTuple<[], null>;
|
|
2927
|
-
function _tuple(Class, items, _paramsOrRest, _params) {
|
|
2928
|
-
const hasRest = _paramsOrRest instanceof $ZodType;
|
|
2929
|
-
const params = hasRest ? _params : _paramsOrRest;
|
|
2930
|
-
const rest = hasRest ? _paramsOrRest : null;
|
|
2931
|
-
return new Class({
|
|
2932
|
-
type: "tuple",
|
|
2933
|
-
items,
|
|
2934
|
-
rest,
|
|
2935
|
-
...normalizeParams(params),
|
|
2936
|
-
});
|
|
2937
|
-
}
|
|
2938
3201
|
function _custom(Class, fn, _params) {
|
|
2939
3202
|
const norm = normalizeParams(_params);
|
|
2940
3203
|
norm.abort ?? (norm.abort = true); // default to abort:false
|
|
@@ -2946,13 +3209,6 @@ function _custom(Class, fn, _params) {
|
|
|
2946
3209
|
});
|
|
2947
3210
|
return schema;
|
|
2948
3211
|
}
|
|
2949
|
-
// export function _refine<T>(
|
|
2950
|
-
// Class: util.SchemaClass<schemas.$ZodCustom>,
|
|
2951
|
-
// fn: (arg: NoInfer<T>) => util.MaybeAsync<unknown>,
|
|
2952
|
-
// _params: string | $ZodCustomParams = {}
|
|
2953
|
-
// ): checks.$ZodCheck<T> {
|
|
2954
|
-
// return _custom(Class, fn, _params);
|
|
2955
|
-
// }
|
|
2956
3212
|
// same as _custom but defaults to abort:false
|
|
2957
3213
|
function _refine(Class, fn, _params) {
|
|
2958
3214
|
const schema = new Class({
|
|
@@ -2963,62 +3219,35 @@ function _refine(Class, fn, _params) {
|
|
|
2963
3219
|
});
|
|
2964
3220
|
return schema;
|
|
2965
3221
|
}
|
|
2966
|
-
function
|
|
2967
|
-
const
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
truthyArray = truthyArray.map((v) => (typeof v === "string" ? v.toLowerCase() : v));
|
|
2972
|
-
falsyArray = falsyArray.map((v) => (typeof v === "string" ? v.toLowerCase() : v));
|
|
2973
|
-
}
|
|
2974
|
-
const truthySet = new Set(truthyArray);
|
|
2975
|
-
const falsySet = new Set(falsyArray);
|
|
2976
|
-
const _Pipe = Classes.Pipe ?? $ZodPipe;
|
|
2977
|
-
const _Boolean = Classes.Boolean ?? $ZodBoolean;
|
|
2978
|
-
const _String = Classes.String ?? $ZodString;
|
|
2979
|
-
const _Transform = Classes.Transform ?? $ZodTransform;
|
|
2980
|
-
const tx = new _Transform({
|
|
2981
|
-
type: "transform",
|
|
2982
|
-
transform: (input, payload) => {
|
|
2983
|
-
let data = input;
|
|
2984
|
-
if (params.case !== "sensitive")
|
|
2985
|
-
data = data.toLowerCase();
|
|
2986
|
-
if (truthySet.has(data)) {
|
|
2987
|
-
return true;
|
|
2988
|
-
}
|
|
2989
|
-
else if (falsySet.has(data)) {
|
|
2990
|
-
return false;
|
|
3222
|
+
function _superRefine(fn) {
|
|
3223
|
+
const ch = _check((payload) => {
|
|
3224
|
+
payload.addIssue = (issue$1) => {
|
|
3225
|
+
if (typeof issue$1 === "string") {
|
|
3226
|
+
payload.issues.push(issue(issue$1, payload.value, ch._zod.def));
|
|
2991
3227
|
}
|
|
2992
3228
|
else {
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3229
|
+
// for Zod 3 backwards compatibility
|
|
3230
|
+
const _issue = issue$1;
|
|
3231
|
+
if (_issue.fatal)
|
|
3232
|
+
_issue.continue = false;
|
|
3233
|
+
_issue.code ?? (_issue.code = "custom");
|
|
3234
|
+
_issue.input ?? (_issue.input = payload.value);
|
|
3235
|
+
_issue.inst ?? (_issue.inst = ch);
|
|
3236
|
+
_issue.continue ?? (_issue.continue = !ch._zod.def.abort); // abort is always undefined, so this is always true...
|
|
3237
|
+
payload.issues.push(issue(_issue));
|
|
3001
3238
|
}
|
|
3002
|
-
}
|
|
3003
|
-
|
|
3004
|
-
});
|
|
3005
|
-
// params.error;
|
|
3006
|
-
const innerPipe = new _Pipe({
|
|
3007
|
-
type: "pipe",
|
|
3008
|
-
in: new _String({ type: "string", error: params.error }),
|
|
3009
|
-
out: tx,
|
|
3010
|
-
error: params.error,
|
|
3239
|
+
};
|
|
3240
|
+
return fn(payload.value, payload);
|
|
3011
3241
|
});
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
}),
|
|
3019
|
-
error: params.error,
|
|
3242
|
+
return ch;
|
|
3243
|
+
}
|
|
3244
|
+
function _check(fn, params) {
|
|
3245
|
+
const ch = new $ZodCheck({
|
|
3246
|
+
check: "custom",
|
|
3247
|
+
...normalizeParams(params),
|
|
3020
3248
|
});
|
|
3021
|
-
|
|
3249
|
+
ch._zod.check = fn;
|
|
3250
|
+
return ch;
|
|
3022
3251
|
}
|
|
3023
3252
|
|
|
3024
3253
|
const ZodISODateTime = /*@__PURE__*/ $constructor("ZodISODateTime", (inst, def) => {
|
|
@@ -3032,7 +3261,7 @@ const ZodISODate = /*@__PURE__*/ $constructor("ZodISODate", (inst, def) => {
|
|
|
3032
3261
|
$ZodISODate.init(inst, def);
|
|
3033
3262
|
ZodStringFormat.init(inst, def);
|
|
3034
3263
|
});
|
|
3035
|
-
function date$
|
|
3264
|
+
function date$2(params) {
|
|
3036
3265
|
return _isoDate(ZodISODate, params);
|
|
3037
3266
|
}
|
|
3038
3267
|
const ZodISOTime = /*@__PURE__*/ $constructor("ZodISOTime", (inst, def) => {
|
|
@@ -3063,11 +3292,17 @@ const initializer = (inst, issues) => {
|
|
|
3063
3292
|
// enumerable: false,
|
|
3064
3293
|
},
|
|
3065
3294
|
addIssue: {
|
|
3066
|
-
value: (issue) =>
|
|
3295
|
+
value: (issue) => {
|
|
3296
|
+
inst.issues.push(issue);
|
|
3297
|
+
inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
|
|
3298
|
+
},
|
|
3067
3299
|
// enumerable: false,
|
|
3068
3300
|
},
|
|
3069
3301
|
addIssues: {
|
|
3070
|
-
value: (issues) =>
|
|
3302
|
+
value: (issues) => {
|
|
3303
|
+
inst.issues.push(...issues);
|
|
3304
|
+
inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
|
|
3305
|
+
},
|
|
3071
3306
|
// enumerable: false,
|
|
3072
3307
|
},
|
|
3073
3308
|
isEmpty: {
|
|
@@ -3093,22 +3328,29 @@ const parse = /* @__PURE__ */ _parse(ZodRealError);
|
|
|
3093
3328
|
const parseAsync = /* @__PURE__ */ _parseAsync(ZodRealError);
|
|
3094
3329
|
const safeParse = /* @__PURE__ */ _safeParse(ZodRealError);
|
|
3095
3330
|
const safeParseAsync = /* @__PURE__ */ _safeParseAsync(ZodRealError);
|
|
3331
|
+
// Codec functions
|
|
3332
|
+
const encode = /* @__PURE__ */ _encode(ZodRealError);
|
|
3333
|
+
const decode = /* @__PURE__ */ _decode(ZodRealError);
|
|
3334
|
+
const encodeAsync = /* @__PURE__ */ _encodeAsync(ZodRealError);
|
|
3335
|
+
const decodeAsync = /* @__PURE__ */ _decodeAsync(ZodRealError);
|
|
3336
|
+
const safeEncode = /* @__PURE__ */ _safeEncode(ZodRealError);
|
|
3337
|
+
const safeDecode = /* @__PURE__ */ _safeDecode(ZodRealError);
|
|
3338
|
+
const safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
|
|
3339
|
+
const safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
|
|
3096
3340
|
|
|
3097
3341
|
const ZodType = /*@__PURE__*/ $constructor("ZodType", (inst, def) => {
|
|
3098
3342
|
$ZodType.init(inst, def);
|
|
3099
3343
|
inst.def = def;
|
|
3344
|
+
inst.type = def.type;
|
|
3100
3345
|
Object.defineProperty(inst, "_def", { value: def });
|
|
3101
3346
|
// base methods
|
|
3102
3347
|
inst.check = (...checks) => {
|
|
3103
|
-
return inst.clone({
|
|
3104
|
-
...def,
|
|
3348
|
+
return inst.clone(mergeDefs(def, {
|
|
3105
3349
|
checks: [
|
|
3106
3350
|
...(def.checks ?? []),
|
|
3107
3351
|
...checks.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch),
|
|
3108
3352
|
],
|
|
3109
|
-
}
|
|
3110
|
-
// { parent: true }
|
|
3111
|
-
);
|
|
3353
|
+
}));
|
|
3112
3354
|
};
|
|
3113
3355
|
inst.clone = (def, params) => clone(inst, def, params);
|
|
3114
3356
|
inst.brand = () => inst;
|
|
@@ -3122,6 +3364,15 @@ const ZodType = /*@__PURE__*/ $constructor("ZodType", (inst, def) => {
|
|
|
3122
3364
|
inst.parseAsync = async (data, params) => parseAsync(inst, data, params, { callee: inst.parseAsync });
|
|
3123
3365
|
inst.safeParseAsync = async (data, params) => safeParseAsync(inst, data, params);
|
|
3124
3366
|
inst.spa = inst.safeParseAsync;
|
|
3367
|
+
// encoding/decoding
|
|
3368
|
+
inst.encode = (data, params) => encode(inst, data, params);
|
|
3369
|
+
inst.decode = (data, params) => decode(inst, data, params);
|
|
3370
|
+
inst.encodeAsync = async (data, params) => encodeAsync(inst, data, params);
|
|
3371
|
+
inst.decodeAsync = async (data, params) => decodeAsync(inst, data, params);
|
|
3372
|
+
inst.safeEncode = (data, params) => safeEncode(inst, data, params);
|
|
3373
|
+
inst.safeDecode = (data, params) => safeDecode(inst, data, params);
|
|
3374
|
+
inst.safeEncodeAsync = async (data, params) => safeEncodeAsync(inst, data, params);
|
|
3375
|
+
inst.safeDecodeAsync = async (data, params) => safeDecodeAsync(inst, data, params);
|
|
3125
3376
|
// refinements
|
|
3126
3377
|
inst.refine = (check, params) => inst.check(refine(check, params));
|
|
3127
3378
|
inst.superRefine = (refinement) => inst.check(superRefine(refinement));
|
|
@@ -3219,7 +3470,7 @@ const ZodString = /*@__PURE__*/ $constructor("ZodString", (inst, def) => {
|
|
|
3219
3470
|
inst.e164 = (params) => inst.check(_e164(ZodE164, params));
|
|
3220
3471
|
// iso
|
|
3221
3472
|
inst.datetime = (params) => inst.check(datetime(params));
|
|
3222
|
-
inst.date = (params) => inst.check(date$
|
|
3473
|
+
inst.date = (params) => inst.check(date$2(params));
|
|
3223
3474
|
inst.time = (params) => inst.check(time(params));
|
|
3224
3475
|
inst.duration = (params) => inst.check(duration(params));
|
|
3225
3476
|
});
|
|
@@ -3407,7 +3658,7 @@ const ZodDate = /*@__PURE__*/ $constructor("ZodDate", (inst, def) => {
|
|
|
3407
3658
|
inst.minDate = c.minimum ? new Date(c.minimum) : null;
|
|
3408
3659
|
inst.maxDate = c.maximum ? new Date(c.maximum) : null;
|
|
3409
3660
|
});
|
|
3410
|
-
function date(params) {
|
|
3661
|
+
function date$1(params) {
|
|
3411
3662
|
return _date(ZodDate, params);
|
|
3412
3663
|
}
|
|
3413
3664
|
const ZodArray = /*@__PURE__*/ $constructor("ZodArray", (inst, def) => {
|
|
@@ -3424,19 +3675,23 @@ function array(element, params) {
|
|
|
3424
3675
|
return _array(ZodArray, element, params);
|
|
3425
3676
|
}
|
|
3426
3677
|
const ZodObject = /*@__PURE__*/ $constructor("ZodObject", (inst, def) => {
|
|
3427
|
-
$
|
|
3678
|
+
$ZodObjectJIT.init(inst, def);
|
|
3428
3679
|
ZodType.init(inst, def);
|
|
3429
|
-
defineLazy(inst, "shape", () =>
|
|
3680
|
+
defineLazy(inst, "shape", () => {
|
|
3681
|
+
return def.shape;
|
|
3682
|
+
});
|
|
3430
3683
|
inst.keyof = () => _enum(Object.keys(inst._zod.def.shape));
|
|
3431
3684
|
inst.catchall = (catchall) => inst.clone({ ...inst._zod.def, catchall: catchall });
|
|
3432
3685
|
inst.passthrough = () => inst.clone({ ...inst._zod.def, catchall: unknown() });
|
|
3433
|
-
// inst.nonstrict = () => inst.clone({ ...inst._zod.def, catchall: api.unknown() });
|
|
3434
3686
|
inst.loose = () => inst.clone({ ...inst._zod.def, catchall: unknown() });
|
|
3435
3687
|
inst.strict = () => inst.clone({ ...inst._zod.def, catchall: never() });
|
|
3436
3688
|
inst.strip = () => inst.clone({ ...inst._zod.def, catchall: undefined });
|
|
3437
3689
|
inst.extend = (incoming) => {
|
|
3438
3690
|
return extend(inst, incoming);
|
|
3439
3691
|
};
|
|
3692
|
+
inst.safeExtend = (incoming) => {
|
|
3693
|
+
return safeExtend(inst, incoming);
|
|
3694
|
+
};
|
|
3440
3695
|
inst.merge = (other) => merge(inst, other);
|
|
3441
3696
|
inst.pick = (mask) => pick(inst, mask);
|
|
3442
3697
|
inst.omit = (mask) => omit(inst, mask);
|
|
@@ -3446,10 +3701,7 @@ const ZodObject = /*@__PURE__*/ $constructor("ZodObject", (inst, def) => {
|
|
|
3446
3701
|
function object(shape, params) {
|
|
3447
3702
|
const def = {
|
|
3448
3703
|
type: "object",
|
|
3449
|
-
|
|
3450
|
-
assignProp(this, "shape", { ...shape });
|
|
3451
|
-
return this.shape;
|
|
3452
|
-
},
|
|
3704
|
+
shape: shape ?? {},
|
|
3453
3705
|
...normalizeParams(params),
|
|
3454
3706
|
};
|
|
3455
3707
|
return new ZodObject(def);
|
|
@@ -3458,10 +3710,7 @@ function object(shape, params) {
|
|
|
3458
3710
|
function looseObject(shape, params) {
|
|
3459
3711
|
return new ZodObject({
|
|
3460
3712
|
type: "object",
|
|
3461
|
-
|
|
3462
|
-
assignProp(this, "shape", { ...shape });
|
|
3463
|
-
return this.shape;
|
|
3464
|
-
},
|
|
3713
|
+
shape,
|
|
3465
3714
|
catchall: unknown(),
|
|
3466
3715
|
...normalizeParams(params),
|
|
3467
3716
|
});
|
|
@@ -3489,6 +3738,25 @@ function intersection(left, right) {
|
|
|
3489
3738
|
right: right,
|
|
3490
3739
|
});
|
|
3491
3740
|
}
|
|
3741
|
+
const ZodTuple = /*@__PURE__*/ $constructor("ZodTuple", (inst, def) => {
|
|
3742
|
+
$ZodTuple.init(inst, def);
|
|
3743
|
+
ZodType.init(inst, def);
|
|
3744
|
+
inst.rest = (rest) => inst.clone({
|
|
3745
|
+
...inst._zod.def,
|
|
3746
|
+
rest: rest,
|
|
3747
|
+
});
|
|
3748
|
+
});
|
|
3749
|
+
function tuple(items, _paramsOrRest, _params) {
|
|
3750
|
+
const hasRest = _paramsOrRest instanceof $ZodType;
|
|
3751
|
+
const params = hasRest ? _params : _paramsOrRest;
|
|
3752
|
+
const rest = hasRest ? _paramsOrRest : null;
|
|
3753
|
+
return new ZodTuple({
|
|
3754
|
+
type: "tuple",
|
|
3755
|
+
items: items,
|
|
3756
|
+
rest,
|
|
3757
|
+
...normalizeParams(params),
|
|
3758
|
+
});
|
|
3759
|
+
}
|
|
3492
3760
|
const ZodRecord = /*@__PURE__*/ $constructor("ZodRecord", (inst, def) => {
|
|
3493
3761
|
$ZodRecord.init(inst, def);
|
|
3494
3762
|
ZodType.init(inst, def);
|
|
@@ -3503,15 +3771,6 @@ function record(keyType, valueType, params) {
|
|
|
3503
3771
|
...normalizeParams(params),
|
|
3504
3772
|
});
|
|
3505
3773
|
}
|
|
3506
|
-
// type alksjf = core.output<core.$ZodRecordKey>;
|
|
3507
|
-
function partialRecord(keyType, valueType, params) {
|
|
3508
|
-
return new ZodRecord({
|
|
3509
|
-
type: "record",
|
|
3510
|
-
keyType: union([keyType, never()]),
|
|
3511
|
-
valueType: valueType,
|
|
3512
|
-
...normalizeParams(params),
|
|
3513
|
-
});
|
|
3514
|
-
}
|
|
3515
3774
|
const ZodEnum = /*@__PURE__*/ $constructor("ZodEnum", (inst, def) => {
|
|
3516
3775
|
$ZodEnum.init(inst, def);
|
|
3517
3776
|
ZodType.init(inst, def);
|
|
@@ -3583,6 +3842,9 @@ const ZodTransform = /*@__PURE__*/ $constructor("ZodTransform", (inst, def) => {
|
|
|
3583
3842
|
$ZodTransform.init(inst, def);
|
|
3584
3843
|
ZodType.init(inst, def);
|
|
3585
3844
|
inst._zod.parse = (payload, _ctx) => {
|
|
3845
|
+
if (_ctx.direction === "backward") {
|
|
3846
|
+
throw new $ZodEncodeError(inst.constructor.name);
|
|
3847
|
+
}
|
|
3586
3848
|
payload.addIssue = (issue$1) => {
|
|
3587
3849
|
if (typeof issue$1 === "string") {
|
|
3588
3850
|
payload.issues.push(issue(issue$1, payload.value, def));
|
|
@@ -3595,7 +3857,7 @@ const ZodTransform = /*@__PURE__*/ $constructor("ZodTransform", (inst, def) => {
|
|
|
3595
3857
|
_issue.code ?? (_issue.code = "custom");
|
|
3596
3858
|
_issue.input ?? (_issue.input = payload.value);
|
|
3597
3859
|
_issue.inst ?? (_issue.inst = inst);
|
|
3598
|
-
|
|
3860
|
+
// _issue.continue ??= true;
|
|
3599
3861
|
payload.issues.push(issue(_issue));
|
|
3600
3862
|
}
|
|
3601
3863
|
};
|
|
@@ -3649,7 +3911,7 @@ function _default(innerType, defaultValue) {
|
|
|
3649
3911
|
type: "default",
|
|
3650
3912
|
innerType: innerType,
|
|
3651
3913
|
get defaultValue() {
|
|
3652
|
-
return typeof defaultValue === "function" ? defaultValue() : defaultValue;
|
|
3914
|
+
return typeof defaultValue === "function" ? defaultValue() : shallowClone(defaultValue);
|
|
3653
3915
|
},
|
|
3654
3916
|
});
|
|
3655
3917
|
}
|
|
@@ -3663,7 +3925,7 @@ function prefault(innerType, defaultValue) {
|
|
|
3663
3925
|
type: "prefault",
|
|
3664
3926
|
innerType: innerType,
|
|
3665
3927
|
get defaultValue() {
|
|
3666
|
-
return typeof defaultValue === "function" ? defaultValue() : defaultValue;
|
|
3928
|
+
return typeof defaultValue === "function" ? defaultValue() : shallowClone(defaultValue);
|
|
3667
3929
|
},
|
|
3668
3930
|
});
|
|
3669
3931
|
}
|
|
@@ -3709,6 +3971,7 @@ function pipe(in_, out) {
|
|
|
3709
3971
|
const ZodReadonly = /*@__PURE__*/ $constructor("ZodReadonly", (inst, def) => {
|
|
3710
3972
|
$ZodReadonly.init(inst, def);
|
|
3711
3973
|
ZodType.init(inst, def);
|
|
3974
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
3712
3975
|
});
|
|
3713
3976
|
function readonly(innerType) {
|
|
3714
3977
|
return new ZodReadonly({
|
|
@@ -3716,19 +3979,21 @@ function readonly(innerType) {
|
|
|
3716
3979
|
innerType: innerType,
|
|
3717
3980
|
});
|
|
3718
3981
|
}
|
|
3719
|
-
const
|
|
3720
|
-
$
|
|
3982
|
+
const ZodFunction = /*@__PURE__*/ $constructor("ZodFunction", (inst, def) => {
|
|
3983
|
+
$ZodFunction.init(inst, def);
|
|
3721
3984
|
ZodType.init(inst, def);
|
|
3722
3985
|
});
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3986
|
+
function _function(params) {
|
|
3987
|
+
return new ZodFunction({
|
|
3988
|
+
type: "function",
|
|
3989
|
+
input: Array.isArray(params?.input) ? tuple(params?.input) : (params?.input ?? array(unknown())),
|
|
3990
|
+
output: params?.output ?? unknown(),
|
|
3728
3991
|
});
|
|
3729
|
-
ch._zod.check = fn;
|
|
3730
|
-
return ch;
|
|
3731
3992
|
}
|
|
3993
|
+
const ZodCustom = /*@__PURE__*/ $constructor("ZodCustom", (inst, def) => {
|
|
3994
|
+
$ZodCustom.init(inst, def);
|
|
3995
|
+
ZodType.init(inst, def);
|
|
3996
|
+
});
|
|
3732
3997
|
function custom(fn, _params) {
|
|
3733
3998
|
return _custom(ZodCustom, fn ?? (() => true), _params);
|
|
3734
3999
|
}
|
|
@@ -3737,34 +4002,173 @@ function refine(fn, _params = {}) {
|
|
|
3737
4002
|
}
|
|
3738
4003
|
// superRefine
|
|
3739
4004
|
function superRefine(fn) {
|
|
3740
|
-
|
|
3741
|
-
payload.addIssue = (issue$1) => {
|
|
3742
|
-
if (typeof issue$1 === "string") {
|
|
3743
|
-
payload.issues.push(issue(issue$1, payload.value, ch._zod.def));
|
|
3744
|
-
}
|
|
3745
|
-
else {
|
|
3746
|
-
// for Zod 3 backwards compatibility
|
|
3747
|
-
const _issue = issue$1;
|
|
3748
|
-
if (_issue.fatal)
|
|
3749
|
-
_issue.continue = false;
|
|
3750
|
-
_issue.code ?? (_issue.code = "custom");
|
|
3751
|
-
_issue.input ?? (_issue.input = payload.value);
|
|
3752
|
-
_issue.inst ?? (_issue.inst = ch);
|
|
3753
|
-
_issue.continue ?? (_issue.continue = !ch._zod.def.abort);
|
|
3754
|
-
payload.issues.push(issue(_issue));
|
|
3755
|
-
}
|
|
3756
|
-
};
|
|
3757
|
-
return fn(payload.value, payload);
|
|
3758
|
-
});
|
|
3759
|
-
return ch;
|
|
4005
|
+
return _superRefine(fn);
|
|
3760
4006
|
}
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
4007
|
+
|
|
4008
|
+
function date(params) {
|
|
4009
|
+
return _coercedDate(ZodDate, params);
|
|
4010
|
+
}
|
|
4011
|
+
|
|
4012
|
+
var Permission;
|
|
4013
|
+
(function(Permission2) {
|
|
4014
|
+
Permission2[Permission2["None"] = 0] = "None";
|
|
4015
|
+
Permission2[Permission2["Read"] = 1] = "Read";
|
|
4016
|
+
Permission2[Permission2["Comment"] = 2] = "Comment";
|
|
4017
|
+
Permission2[Permission2["Edit"] = 3] = "Edit";
|
|
4018
|
+
Permission2[Permission2["Manage"] = 5] = "Manage";
|
|
4019
|
+
})(Permission || (Permission = {}));
|
|
4020
|
+
({
|
|
4021
|
+
[Permission.None]: "No Permissions",
|
|
4022
|
+
[Permission.Read]: "Reader",
|
|
4023
|
+
[Permission.Comment]: "Commenter",
|
|
4024
|
+
[Permission.Edit]: "Editor",
|
|
4025
|
+
[Permission.Manage]: "Manager"
|
|
4026
|
+
});
|
|
4027
|
+
const App = object({
|
|
4028
|
+
id: string(),
|
|
4029
|
+
name: string().optional(),
|
|
4030
|
+
image: string().optional(),
|
|
4031
|
+
icon: string().optional()
|
|
4032
|
+
});
|
|
4033
|
+
var Severity;
|
|
4034
|
+
(function(Severity2) {
|
|
4035
|
+
Severity2[Severity2["Emergency"] = 0] = "Emergency";
|
|
4036
|
+
Severity2[Severity2["Alert"] = 1] = "Alert";
|
|
4037
|
+
Severity2[Severity2["Critical"] = 2] = "Critical";
|
|
4038
|
+
Severity2[Severity2["Error"] = 3] = "Error";
|
|
4039
|
+
Severity2[Severity2["Warning"] = 4] = "Warning";
|
|
4040
|
+
Severity2[Severity2["Notice"] = 5] = "Notice";
|
|
4041
|
+
Severity2[Severity2["Info"] = 6] = "Info";
|
|
4042
|
+
Severity2[Severity2["Debug"] = 7] = "Debug";
|
|
4043
|
+
})(Severity || (Severity = {}));
|
|
4044
|
+
const severityNames = Object.keys(Severity).filter((k) => isNaN(Number(k))).map(uncapitalize);
|
|
4045
|
+
object({
|
|
4046
|
+
since: date().optional(),
|
|
4047
|
+
until: date().optional(),
|
|
4048
|
+
user: union([uuid(), literal(["null"]).transform(() => null)]).nullish(),
|
|
4049
|
+
severity: literal(severityNames).transform((v) => Severity[capitalize(v)]).optional(),
|
|
4050
|
+
source: string().optional(),
|
|
4051
|
+
tags: string().array().optional(),
|
|
4052
|
+
event: string().optional()
|
|
4053
|
+
});
|
|
4054
|
+
object({
|
|
4055
|
+
id: uuid(),
|
|
4056
|
+
userId: uuid(),
|
|
4057
|
+
expires: date(),
|
|
4058
|
+
created: date(),
|
|
4059
|
+
elevated: boolean()
|
|
4060
|
+
});
|
|
4061
|
+
const transports = ["ble", "cable", "hybrid", "internal", "nfc", "smart-card", "usb"];
|
|
4062
|
+
const authenticatorAttachment = literal(["platform", "cross-platform"]).optional();
|
|
4063
|
+
const PasskeyRegistration = object({
|
|
4064
|
+
id: string(),
|
|
4065
|
+
rawId: string(),
|
|
4066
|
+
response: object({
|
|
4067
|
+
clientDataJSON: string(),
|
|
4068
|
+
attestationObject: string(),
|
|
4069
|
+
authenticatorData: string().optional(),
|
|
4070
|
+
transports: array(_enum(transports)).optional(),
|
|
4071
|
+
publicKeyAlgorithm: number().optional(),
|
|
4072
|
+
publicKey: string().optional()
|
|
4073
|
+
}),
|
|
4074
|
+
authenticatorAttachment,
|
|
4075
|
+
clientExtensionResults: record(any(), any()),
|
|
4076
|
+
type: literal("public-key")
|
|
4077
|
+
});
|
|
4078
|
+
object({
|
|
4079
|
+
id: string(),
|
|
4080
|
+
rawId: string(),
|
|
4081
|
+
response: object({
|
|
4082
|
+
clientDataJSON: string(),
|
|
4083
|
+
authenticatorData: string(),
|
|
4084
|
+
signature: string(),
|
|
4085
|
+
userHandle: string().optional()
|
|
4086
|
+
}),
|
|
4087
|
+
authenticatorAttachment,
|
|
4088
|
+
clientExtensionResults: record(any(), any()),
|
|
4089
|
+
type: literal("public-key")
|
|
4090
|
+
});
|
|
4091
|
+
object({ name: string() }).partial();
|
|
4092
|
+
function zIs(schema, type) {
|
|
4093
|
+
return schema.def.type == type;
|
|
4094
|
+
}
|
|
4095
|
+
function zAsyncFunction(schema) {
|
|
4096
|
+
return custom((fn2) => schema.implementAsync(fn2));
|
|
4097
|
+
}
|
|
4098
|
+
looseObject({
|
|
4099
|
+
name: string(),
|
|
4100
|
+
version: string(),
|
|
4101
|
+
description: string().optional(),
|
|
4102
|
+
apps: array(App).optional(),
|
|
4103
|
+
client: object({
|
|
4104
|
+
/** CLI mixin path */
|
|
4105
|
+
cli: string().optional(),
|
|
4106
|
+
/** The path to the hooks script */
|
|
4107
|
+
hooks: string().optional()
|
|
4108
|
+
}).optional(),
|
|
4109
|
+
server: object({
|
|
4110
|
+
/** The path to the hooks script */
|
|
4111
|
+
hooks: string().optional(),
|
|
4112
|
+
http_handler: string().optional(),
|
|
4113
|
+
/** The path to the HTTP handler used by the server */
|
|
4114
|
+
routes: string().optional(),
|
|
4115
|
+
/** CLI mixin path */
|
|
4116
|
+
cli: string().optional()
|
|
4117
|
+
}).optional()
|
|
4118
|
+
});
|
|
4119
|
+
const fn = custom((data) => typeof data === "function");
|
|
4120
|
+
object({
|
|
4121
|
+
statusText: zAsyncFunction(_function({ input: [], output: string() })).optional(),
|
|
4122
|
+
db_init: fn.optional(),
|
|
4123
|
+
remove: fn.optional(),
|
|
4124
|
+
db_wipe: fn.optional(),
|
|
4125
|
+
clean: fn.optional()
|
|
4126
|
+
});
|
|
4127
|
+
const preferenceSchemas = {
|
|
4128
|
+
debug: boolean()
|
|
4129
|
+
};
|
|
4130
|
+
const preferenceDefaults = {
|
|
4131
|
+
debug: false
|
|
4132
|
+
};
|
|
4133
|
+
const preferenceLabels = {
|
|
4134
|
+
debug: "Debug mode"
|
|
4135
|
+
};
|
|
4136
|
+
const User = object({
|
|
4137
|
+
id: uuid(),
|
|
4138
|
+
name: string().min(1, "Name is required").max(255, "Name is too long"),
|
|
4139
|
+
email: email(),
|
|
4140
|
+
emailVerified: date$1().nullish(),
|
|
4141
|
+
image: url().nullish(),
|
|
4142
|
+
preferences: record(string(), any()),
|
|
4143
|
+
roles: array(string()),
|
|
4144
|
+
registeredAt: date(),
|
|
4145
|
+
isAdmin: boolean()
|
|
4146
|
+
});
|
|
4147
|
+
const UserChangeable = User.pick({
|
|
4148
|
+
name: true,
|
|
4149
|
+
email: true,
|
|
4150
|
+
image: true,
|
|
4151
|
+
preferences: true
|
|
4152
|
+
}).partial();
|
|
4153
|
+
function getUserImage(user) {
|
|
4154
|
+
if (user.image)
|
|
4155
|
+
return user.image;
|
|
4156
|
+
const color = colorHash(user.name ?? "\0");
|
|
4157
|
+
return `data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50 50" style="background-color:${color};display:flex;align-items:center;justify-content:center;">
|
|
4158
|
+
<text x="23" y="28" style="font-family:sans-serif;font-weight:bold;" fill="white">${(user.name ?? "?").replaceAll(/\W/g, "")[0]}</text>
|
|
4159
|
+
</svg>`.replaceAll(/[\t\n]/g, "");
|
|
4160
|
+
}
|
|
4161
|
+
object({
|
|
4162
|
+
name: string().min(1).max(100),
|
|
4163
|
+
email: email(),
|
|
4164
|
+
userId: uuid(),
|
|
4165
|
+
response: PasskeyRegistration
|
|
4166
|
+
});
|
|
4167
|
+
object({ type: literal(["login", "action", "client_login"]) });
|
|
4168
|
+
object({
|
|
4169
|
+
id: array(uuid()).optional(),
|
|
4170
|
+
confirm_all: boolean().optional()
|
|
4171
|
+
});
|
|
3768
4172
|
|
|
3769
4173
|
const types$1 = {
|
|
3770
4174
|
'application/prs.cww': ['cww'],
|
|
@@ -4360,6 +4764,7 @@ const types$1 = {
|
|
|
4360
4764
|
'image/prs.pti': ['pti'],
|
|
4361
4765
|
'image/vnd.adobe.photoshop': ['psd'],
|
|
4362
4766
|
'image/vnd.airzip.accelerator.azv': ['azv'],
|
|
4767
|
+
'image/vnd.blockfact.facti': ['facti'],
|
|
4363
4768
|
'image/vnd.dece.graphic': ['uvi', 'uvvi', 'uvg', 'uvvg'],
|
|
4364
4769
|
'image/vnd.djvu': ['djvu', 'djv'],
|
|
4365
4770
|
'image/vnd.dvb.subtitle': ['*sub'],
|
|
@@ -4936,5 +5341,5 @@ _Mime_extensionToType = new WeakMap(), _Mime_typeToExtension = new WeakMap(), _M
|
|
|
4936
5341
|
|
|
4937
5342
|
new Mime(types, types$1)._freeze();
|
|
4938
5343
|
|
|
4939
|
-
export { $
|
|
4940
|
-
//# sourceMappingURL=index-
|
|
5344
|
+
export { $ZodError as $, Severity as S, UserChangeable as U, preferenceLabels as a, preferenceDefaults as b, capitalize as c, string as d, email as e, prettifyError as f, getUserImage as g, object as o, preferenceSchemas as p, severityNames as s, uuid as u, zIs as z };
|
|
5345
|
+
//# sourceMappingURL=index-Tt4zVDIZ.js.map
|