cross-seed 7.0.0-21 → 7.0.0-22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/action.js +4 -6
- package/dist/action.js.map +1 -1
- package/dist/arr.js +2 -2
- package/dist/arr.js.map +1 -1
- package/dist/clients/Deluge.d.ts +1 -1
- package/dist/clients/Deluge.js +6 -6
- package/dist/clients/Deluge.js.map +1 -1
- package/dist/clients/QBittorrent.d.ts +2 -0
- package/dist/clients/QBittorrent.js +16 -15
- package/dist/clients/QBittorrent.js.map +1 -1
- package/dist/clients/RTorrent.js +26 -21
- package/dist/clients/RTorrent.js.map +1 -1
- package/dist/clients/TorrentClient.d.ts +2 -2
- package/dist/clients/TorrentClient.js +0 -2
- package/dist/clients/TorrentClient.js.map +1 -1
- package/dist/clients/Transmission.js +7 -5
- package/dist/clients/Transmission.js.map +1 -1
- package/dist/configuration.js +4 -3
- package/dist/configuration.js.map +1 -1
- package/dist/dataFiles.js +4 -4
- package/dist/dataFiles.js.map +1 -1
- package/dist/db.js +8 -4
- package/dist/db.js.map +1 -1
- package/dist/decide.js +5 -5
- package/dist/decide.js.map +1 -1
- package/dist/devLogin.js.map +1 -1
- package/dist/diff.js.map +1 -1
- package/dist/indexers.js.map +1 -1
- package/dist/inject.js +5 -5
- package/dist/inject.js.map +1 -1
- package/dist/logger.js +7 -5
- package/dist/logger.js.map +1 -1
- package/dist/migrations/09-clientAndDataSearchees.js +1 -0
- package/dist/migrations/09-clientAndDataSearchees.js.map +1 -1
- package/dist/migrations/17-api-key-settings-json.js +3 -1
- package/dist/migrations/17-api-key-settings-json.js.map +1 -1
- package/dist/migrations/migrations.d.ts +12 -5
- package/dist/migrations/migrations.js +1 -1
- package/dist/migrations/migrations.js.map +1 -1
- package/dist/parseTorrent.d.ts +1 -1
- package/dist/parseTorrent.js.map +1 -1
- package/dist/pipeline.js +10 -10
- package/dist/pipeline.js.map +1 -1
- package/dist/problems/linking.js +1 -1
- package/dist/problems/linking.js.map +1 -1
- package/dist/problems.js +2 -1
- package/dist/problems.js.map +1 -1
- package/dist/pushNotifier.js +5 -5
- package/dist/pushNotifier.js.map +1 -1
- package/dist/routes/baseApi.d.ts +8 -0
- package/dist/routes/baseApi.js +24 -50
- package/dist/routes/baseApi.js.map +1 -1
- package/dist/routes/devLogin.js +1 -0
- package/dist/routes/devLogin.js.map +1 -1
- package/dist/routes/indexerApi.js +1 -0
- package/dist/routes/indexerApi.js.map +1 -1
- package/dist/routes/staticFrontendPlugin.js +1 -0
- package/dist/routes/staticFrontendPlugin.js.map +1 -1
- package/dist/searchee.d.ts +13 -1
- package/dist/searchee.js +5 -3
- package/dist/searchee.js.map +1 -1
- package/dist/services/indexerService.js +8 -2
- package/dist/services/indexerService.js.map +1 -1
- package/dist/torrent.js +25 -19
- package/dist/torrent.js.map +1 -1
- package/dist/torznab.d.ts +2 -2
- package/dist/torznab.js +15 -14
- package/dist/torznab.js.map +1 -1
- package/dist/trpc/routers/auth.js +1 -1
- package/dist/trpc/routers/auth.js.map +1 -1
- package/dist/trpc/routers/clients.js +6 -12
- package/dist/trpc/routers/clients.js.map +1 -1
- package/dist/trpc/routers/jobs.js +1 -1
- package/dist/trpc/routers/jobs.js.map +1 -1
- package/dist/trpc/routers/logs.js +6 -5
- package/dist/trpc/routers/logs.js.map +1 -1
- package/dist/trpc/routers/settings.js +40 -17
- package/dist/trpc/routers/settings.js.map +1 -1
- package/dist/userAuth.js +1 -1
- package/dist/userAuth.js.map +1 -1
- package/dist/utils.d.ts +3 -1
- package/dist/utils.js +8 -0
- package/dist/utils.js.map +1 -1
- package/dist/webui/assets/ClientOnly-CED5mhgl.js +1 -0
- package/dist/webui/assets/{DeleteOption-dxKSbv6N.js → DeleteOption-C_dwvZJZ.js} +1 -1
- package/dist/webui/assets/{FieldInfo-FLjtPgL4.js → FieldInfo-COkGdLYk.js} +1 -1
- package/dist/webui/assets/Page-Cdp3BgLk.js +1 -0
- package/dist/webui/assets/array-field-pYvhneFJ.js +1 -0
- package/dist/webui/assets/{badge-hukNSIir.js → badge-B5DKWJgq.js} +1 -1
- package/dist/webui/assets/{button-1cIaa9Lf.js → button-CaZ-GDfE.js} +1 -1
- package/dist/webui/assets/check-pwIfPY4Z.js +1 -0
- package/dist/webui/assets/{chevron-down-CVVogpPh.js → chevron-down-CNQyUZdL.js} +1 -1
- package/dist/webui/assets/clients-S5qMvvhJ.js +1 -0
- package/dist/webui/assets/connect-BOmFXztg.js +2 -0
- package/dist/webui/assets/{debug-CEmoQ2W_.js → debug-sgTUOKd_.js} +1 -1
- package/dist/webui/assets/{directories-CNuHKfHz.js → directories-lpeuI9dw.js} +1 -1
- package/dist/webui/assets/{dist-Bbmh5Du9.js → dist-DTcPk3zL.js} +1 -1
- package/dist/webui/assets/{dist-b2njvUJz.js → dist-DpJDqDMU.js} +1 -1
- package/dist/webui/assets/{dist-DzdkRn7I.js → dist-zSohDmOx.js} +1 -1
- package/dist/webui/assets/duration-field-Bk_Qqnlj.js +1 -0
- package/dist/webui/assets/form-context-DCwZ847X.js +1 -0
- package/dist/webui/assets/general-D0zUNDCw.js +1 -0
- package/dist/webui/assets/health-dB9XUh2l.js +1 -0
- package/dist/webui/assets/index-nqUtTZMx.js +11 -0
- package/dist/webui/assets/{input-CsfmMUT5.js → input-DGmxnZJ2.js} +1 -1
- package/dist/webui/assets/{jobs-Cr1xWWzM.js → jobs-fUKQtvM8.js} +1 -1
- package/dist/webui/assets/library-CraLMam6.js +1 -0
- package/dist/webui/assets/loader-circle-DdnKPTse.js +1 -0
- package/dist/webui/assets/{logs-C1l3cu_j.js → logs-ChewkpXh.js} +1 -1
- package/dist/webui/assets/number-field-ZjXjriQK.js +1 -0
- package/dist/webui/assets/{routes-Bw2nXmFg.js → routes-DrXWE_DD.js} +1 -1
- package/dist/webui/assets/search-CmXUf5GH.js +1 -0
- package/dist/webui/assets/{select-CZn10WME.js → select-CtY5SiOV.js} +1 -1
- package/dist/webui/assets/select-field-CELReIHC.js +1 -0
- package/dist/webui/assets/settings-BA8KbdFh.js +1 -0
- package/dist/webui/assets/sidebar-DwCb7ZYM.js +5 -0
- package/dist/webui/assets/submit-button-Ev5moeev.js +1 -0
- package/dist/webui/assets/{switch-D4S9As9u.js → switch-D4iXqWRT.js} +1 -1
- package/dist/webui/assets/switch-field-DvVYQ0fF.js +1 -0
- package/dist/webui/assets/{table-B1Y18B60.js → table-Cm5CkWDw.js} +1 -1
- package/dist/webui/assets/{test-tube-CbcievIk.js → test-tube-BEJhBYxj.js} +1 -1
- package/dist/webui/assets/text-field-BF6NHHSy.js +1 -0
- package/dist/webui/assets/{trackers-ULhLxA6-.js → trackers-DbTH144L.js} +2 -2
- package/dist/webui/assets/{trash-D083IWKI.js → trash-BBrYUzLS.js} +1 -1
- package/dist/webui/assets/use-settings-form-submit-DhYXrP0h.js +129 -0
- package/dist/webui/assets/{useBaseQuery-BvrWhgOK.js → useBaseQuery-CF_kheUn.js} +1 -1
- package/dist/webui/assets/useRouter-DOlw-pQR.js +1 -0
- package/dist/webui/assets/utils-DLIw4Ti7.js +1 -0
- package/dist/webui/index.html +12 -12
- package/node_modules/@cross-seed/shared/dist/tsconfig.tsbuildinfo +1 -1
- package/node_modules/@cross-seed/shared/package.json +5 -1
- package/node_modules/zod/README.md +1 -18
- package/node_modules/zod/locales/package.json +2 -1
- package/node_modules/zod/mini/package.json +2 -1
- package/node_modules/zod/package.json +1 -1
- package/node_modules/zod/src/v3/tests/all-errors.test.ts +3 -3
- package/node_modules/zod/src/v3/tests/object.test.ts +5 -5
- package/node_modules/zod/src/v3/tests/partials.test.ts +3 -3
- package/node_modules/zod/src/v4/classic/errors.ts +2 -2
- package/node_modules/zod/src/v4/classic/external.ts +1 -0
- package/node_modules/zod/src/v4/classic/from-json-schema.ts +39 -23
- package/node_modules/zod/src/v4/classic/parse.ts +6 -6
- package/node_modules/zod/src/v4/classic/schemas.ts +414 -151
- package/node_modules/zod/src/v4/classic/tests/assignability.test.ts +6 -0
- package/node_modules/zod/src/v4/classic/tests/catch.test.ts +50 -0
- package/node_modules/zod/src/v4/classic/tests/codec.test.ts +142 -1
- package/node_modules/zod/src/v4/classic/tests/continuability.test.ts +1 -1
- package/node_modules/zod/src/v4/classic/tests/datetime.test.ts +1 -1
- package/node_modules/zod/src/v4/classic/tests/default.test.ts +44 -0
- package/node_modules/zod/src/v4/classic/tests/detached-methods.test.ts +197 -0
- package/node_modules/zod/src/v4/classic/tests/discriminated-unions.test.ts +34 -1
- package/node_modules/zod/src/v4/classic/tests/error-utils.test.ts +214 -2
- package/node_modules/zod/src/v4/classic/tests/from-json-schema.test.ts +161 -0
- package/node_modules/zod/src/v4/classic/tests/function.test.ts +6 -6
- package/node_modules/zod/src/v4/classic/tests/global-config.test.ts +39 -0
- package/node_modules/zod/src/v4/classic/tests/index.test.ts +2 -2
- package/node_modules/zod/src/v4/classic/tests/jitless-allows-eval.test.ts +46 -0
- package/node_modules/zod/src/v4/classic/tests/locales_ka.test.ts +29 -0
- package/node_modules/zod/src/v4/classic/tests/locales_ro.test.ts +24 -0
- package/node_modules/zod/src/v4/classic/tests/number.test.ts +55 -0
- package/node_modules/zod/src/v4/classic/tests/object.test.ts +83 -6
- package/node_modules/zod/src/v4/classic/tests/optional.test.ts +114 -4
- package/node_modules/zod/src/v4/classic/tests/partial.test.ts +24 -1
- package/node_modules/zod/src/v4/classic/tests/prefault.test.ts +1 -1
- package/node_modules/zod/src/v4/classic/tests/preprocess-types.test.ts +26 -0
- package/node_modules/zod/src/v4/classic/tests/preprocess.test.ts +69 -0
- package/node_modules/zod/src/v4/classic/tests/record.test.ts +85 -0
- package/node_modules/zod/src/v4/classic/tests/recursive-types.test.ts +49 -0
- package/node_modules/zod/src/v4/classic/tests/refine.test.ts +63 -0
- package/node_modules/zod/src/v4/classic/tests/string.test.ts +50 -1
- package/node_modules/zod/src/v4/classic/tests/template-literal.test.ts +4 -4
- package/node_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +150 -15
- package/node_modules/zod/src/v4/classic/tests/transform.test.ts +17 -0
- package/node_modules/zod/src/v4/classic/tests/tuple.test.ts +315 -2
- package/node_modules/zod/src/v4/classic/tests/union.test.ts +54 -0
- package/node_modules/zod/src/v4/core/api.ts +31 -6
- package/node_modules/zod/src/v4/core/checks.ts +1 -1
- package/node_modules/zod/src/v4/core/core.ts +17 -2
- package/node_modules/zod/src/v4/core/errors.ts +31 -24
- package/node_modules/zod/src/v4/core/json-schema-processors.ts +17 -18
- package/node_modules/zod/src/v4/core/parse.ts +7 -7
- package/node_modules/zod/src/v4/core/regexes.ts +8 -1
- package/node_modules/zod/src/v4/core/schemas.ts +263 -71
- package/node_modules/zod/src/v4/core/tests/locales/el.test.ts +215 -0
- package/node_modules/zod/src/v4/core/tests/locales/fr.test.ts +72 -0
- package/node_modules/zod/src/v4/core/tests/locales/hr.test.ts +163 -0
- package/node_modules/zod/src/v4/core/tests/locales/uz.test.ts +22 -0
- package/node_modules/zod/src/v4/core/tests/record-constructor.test.ts +58 -0
- package/node_modules/zod/src/v4/core/to-json-schema.ts +10 -1
- package/node_modules/zod/src/v4/core/util.ts +52 -35
- package/node_modules/zod/src/v4/core/versions.ts +2 -2
- package/node_modules/zod/src/v4/locales/el.ts +121 -0
- package/node_modules/zod/src/v4/locales/en.ts +4 -0
- package/node_modules/zod/src/v4/locales/fr.ts +24 -8
- package/node_modules/zod/src/v4/locales/hr.ts +131 -0
- package/node_modules/zod/src/v4/locales/index.ts +3 -0
- package/node_modules/zod/src/v4/locales/it.ts +1 -1
- package/node_modules/zod/src/v4/locales/ka.ts +8 -8
- package/node_modules/zod/src/v4/locales/ro.ts +129 -0
- package/node_modules/zod/src/v4/locales/uz.ts +1 -0
- package/node_modules/zod/src/v4/mini/external.ts +1 -0
- package/node_modules/zod/src/v4/mini/schemas.ts +56 -25
- package/node_modules/zod/src/v4/mini/tests/codec.test.ts +19 -0
- package/node_modules/zod/src/v4/mini/tests/index.test.ts +32 -2
- package/node_modules/zod/src/v4/mini/tests/object.test.ts +9 -9
- package/node_modules/zod/src/v4/mini/tests/recursive-types.test.ts +51 -1
- package/node_modules/zod/src/v4/mini/tests/string.test.ts +5 -0
- package/node_modules/zod/v3/package.json +2 -1
- package/node_modules/zod/v4/classic/errors.js +2 -2
- package/node_modules/zod/v4/classic/external.d.cts +1 -0
- package/node_modules/zod/v4/classic/external.d.ts +1 -0
- package/node_modules/zod/v4/classic/from-json-schema.cjs +31 -16
- package/node_modules/zod/v4/classic/from-json-schema.js +31 -16
- package/node_modules/zod/v4/classic/package.json +2 -1
- package/node_modules/zod/v4/classic/schemas.cjs +358 -119
- package/node_modules/zod/v4/classic/schemas.d.cts +42 -14
- package/node_modules/zod/v4/classic/schemas.d.ts +42 -14
- package/node_modules/zod/v4/classic/schemas.js +356 -118
- package/node_modules/zod/v4/core/api.cjs +7 -2
- package/node_modules/zod/v4/core/api.d.cts +26 -5
- package/node_modules/zod/v4/core/api.d.ts +26 -5
- package/node_modules/zod/v4/core/api.js +7 -2
- package/node_modules/zod/v4/core/checks.d.cts +1 -1
- package/node_modules/zod/v4/core/checks.d.ts +1 -1
- package/node_modules/zod/v4/core/core.cjs +3 -1
- package/node_modules/zod/v4/core/core.js +4 -2
- package/node_modules/zod/v4/core/errors.cjs +26 -23
- package/node_modules/zod/v4/core/errors.d.cts +1 -0
- package/node_modules/zod/v4/core/errors.d.ts +1 -0
- package/node_modules/zod/v4/core/errors.js +26 -23
- package/node_modules/zod/v4/core/json-schema-processors.cjs +16 -20
- package/node_modules/zod/v4/core/json-schema-processors.js +16 -20
- package/node_modules/zod/v4/core/package.json +2 -1
- package/node_modules/zod/v4/core/parse.cjs +7 -7
- package/node_modules/zod/v4/core/parse.js +7 -7
- package/node_modules/zod/v4/core/regexes.cjs +9 -3
- package/node_modules/zod/v4/core/regexes.d.cts +6 -0
- package/node_modules/zod/v4/core/regexes.d.ts +6 -0
- package/node_modules/zod/v4/core/regexes.js +7 -1
- package/node_modules/zod/v4/core/schemas.cjs +211 -65
- package/node_modules/zod/v4/core/schemas.d.cts +39 -1
- package/node_modules/zod/v4/core/schemas.d.ts +39 -1
- package/node_modules/zod/v4/core/schemas.js +210 -64
- package/node_modules/zod/v4/core/to-json-schema.cjs +12 -1
- package/node_modules/zod/v4/core/to-json-schema.js +12 -1
- package/node_modules/zod/v4/core/util.cjs +54 -30
- package/node_modules/zod/v4/core/util.d.cts +1 -0
- package/node_modules/zod/v4/core/util.d.ts +1 -0
- package/node_modules/zod/v4/core/util.js +55 -32
- package/node_modules/zod/v4/core/versions.cjs +2 -2
- package/node_modules/zod/v4/core/versions.d.cts +1 -1
- package/node_modules/zod/v4/core/versions.d.ts +1 -1
- package/node_modules/zod/v4/core/versions.js +2 -2
- package/node_modules/zod/v4/locales/el.cjs +136 -0
- package/node_modules/zod/v4/locales/el.d.cts +5 -0
- package/node_modules/zod/v4/locales/el.d.ts +4 -0
- package/node_modules/zod/v4/locales/el.js +109 -0
- package/node_modules/zod/v4/locales/en.cjs +4 -0
- package/node_modules/zod/v4/locales/en.js +4 -0
- package/node_modules/zod/v4/locales/fr.cjs +24 -7
- package/node_modules/zod/v4/locales/fr.js +24 -7
- package/node_modules/zod/v4/locales/hr.cjs +149 -0
- package/node_modules/zod/v4/locales/hr.d.cts +5 -0
- package/node_modules/zod/v4/locales/hr.d.ts +4 -0
- package/node_modules/zod/v4/locales/hr.js +122 -0
- package/node_modules/zod/v4/locales/index.cjs +8 -1
- package/node_modules/zod/v4/locales/index.d.cts +3 -0
- package/node_modules/zod/v4/locales/index.d.ts +3 -0
- package/node_modules/zod/v4/locales/index.js +3 -0
- package/node_modules/zod/v4/locales/it.cjs +1 -1
- package/node_modules/zod/v4/locales/it.js +1 -1
- package/node_modules/zod/v4/locales/ka.cjs +8 -8
- package/node_modules/zod/v4/locales/ka.js +8 -8
- package/node_modules/zod/v4/locales/package.json +2 -1
- package/node_modules/zod/v4/locales/ro.cjs +146 -0
- package/node_modules/zod/v4/locales/ro.d.cts +5 -0
- package/node_modules/zod/v4/locales/ro.d.ts +4 -0
- package/node_modules/zod/v4/locales/ro.js +119 -0
- package/node_modules/zod/v4/locales/uz.cjs +1 -0
- package/node_modules/zod/v4/locales/uz.js +1 -0
- package/node_modules/zod/v4/mini/external.d.cts +1 -0
- package/node_modules/zod/v4/mini/external.d.ts +1 -0
- package/node_modules/zod/v4/mini/package.json +2 -1
- package/node_modules/zod/v4/mini/schemas.cjs +41 -4
- package/node_modules/zod/v4/mini/schemas.d.cts +28 -10
- package/node_modules/zod/v4/mini/schemas.d.ts +28 -10
- package/node_modules/zod/v4/mini/schemas.js +40 -4
- package/node_modules/zod/v4/package.json +2 -1
- package/node_modules/zod/v4-mini/package.json +2 -1
- package/package.json +9 -9
- package/dist/webui/assets/ClientOnly-CzZIsGML.js +0 -1
- package/dist/webui/assets/Page-C7KClZ28.js +0 -1
- package/dist/webui/assets/array-field-DGB7Lbh7.js +0 -1
- package/dist/webui/assets/check-CUrWQ2C7.js +0 -1
- package/dist/webui/assets/clients-CHdgqO4r.js +0 -1
- package/dist/webui/assets/connect-Cr6Q3W8U.js +0 -2
- package/dist/webui/assets/duration-field-CnlQcr37.js +0 -1
- package/dist/webui/assets/form-context-B-ekdUc0.js +0 -1
- package/dist/webui/assets/general-Cs8dEydJ.js +0 -1
- package/dist/webui/assets/health-DugF7R6A.js +0 -1
- package/dist/webui/assets/index-DinSQfHc.js +0 -11
- package/dist/webui/assets/library-BNsctrbc.js +0 -1
- package/dist/webui/assets/loader-circle-BQbzoYGJ.js +0 -1
- package/dist/webui/assets/number-field-Ce3QdLSz.js +0 -1
- package/dist/webui/assets/search-D9W5vk_0.js +0 -1
- package/dist/webui/assets/select-field-DozTirAZ.js +0 -1
- package/dist/webui/assets/settings-BXbhXNDK.js +0 -1
- package/dist/webui/assets/sidebar-y9WJu7Jw.js +0 -5
- package/dist/webui/assets/submit-button-CBOzR0f_.js +0 -1
- package/dist/webui/assets/switch-field-2E9ctvy_.js +0 -1
- package/dist/webui/assets/text-field-DV4EP-I8.js +0 -1
- package/dist/webui/assets/use-settings-form-submit-D87nmJRy.js +0 -79
- package/dist/webui/assets/useRouterState-CZfD5Xdv.js +0 -1
- /package/dist/webui/assets/{createLucideIcon-zYRS_Hrv.js → createLucideIcon-B7JFsQMg.js} +0 -0
- /package/dist/webui/assets/{dist-DhH_lYkz.js → dist-BOuUIo52.js} +0 -0
- /package/dist/webui/assets/{react-dom-mEftaaxx.js → react-dom-BMqFzhWt.js} +0 -0
|
@@ -65,36 +65,31 @@ export const numberProcessor: Processor<schemas.$ZodNumber> = (schema, ctx, _jso
|
|
|
65
65
|
if (typeof format === "string" && format.includes("int")) json.type = "integer";
|
|
66
66
|
else json.type = "number";
|
|
67
67
|
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
// when both minimum and exclusiveMinimum exist, pick the more restrictive one
|
|
69
|
+
const exMin = typeof exclusiveMinimum === "number" && exclusiveMinimum >= (minimum ?? Number.NEGATIVE_INFINITY);
|
|
70
|
+
const exMax = typeof exclusiveMaximum === "number" && exclusiveMaximum <= (maximum ?? Number.POSITIVE_INFINITY);
|
|
71
|
+
const legacy = ctx.target === "draft-04" || ctx.target === "openapi-3.0";
|
|
72
|
+
|
|
73
|
+
if (exMin) {
|
|
74
|
+
if (legacy) {
|
|
70
75
|
json.minimum = exclusiveMinimum;
|
|
71
76
|
json.exclusiveMinimum = true;
|
|
72
77
|
} else {
|
|
73
78
|
json.exclusiveMinimum = exclusiveMinimum;
|
|
74
79
|
}
|
|
75
|
-
}
|
|
76
|
-
if (typeof minimum === "number") {
|
|
80
|
+
} else if (typeof minimum === "number") {
|
|
77
81
|
json.minimum = minimum;
|
|
78
|
-
if (typeof exclusiveMinimum === "number" && ctx.target !== "draft-04") {
|
|
79
|
-
if (exclusiveMinimum >= minimum) delete json.minimum;
|
|
80
|
-
else delete json.exclusiveMinimum;
|
|
81
|
-
}
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
if (
|
|
85
|
-
if (
|
|
84
|
+
if (exMax) {
|
|
85
|
+
if (legacy) {
|
|
86
86
|
json.maximum = exclusiveMaximum;
|
|
87
87
|
json.exclusiveMaximum = true;
|
|
88
88
|
} else {
|
|
89
89
|
json.exclusiveMaximum = exclusiveMaximum;
|
|
90
90
|
}
|
|
91
|
-
}
|
|
92
|
-
if (typeof maximum === "number") {
|
|
91
|
+
} else if (typeof maximum === "number") {
|
|
93
92
|
json.maximum = maximum;
|
|
94
|
-
if (typeof exclusiveMaximum === "number" && ctx.target !== "draft-04") {
|
|
95
|
-
if (exclusiveMaximum <= maximum) delete json.maximum;
|
|
96
|
-
else delete json.exclusiveMaximum;
|
|
97
|
-
}
|
|
98
93
|
}
|
|
99
94
|
|
|
100
95
|
if (typeof multipleOf === "number") json.multipleOf = multipleOf;
|
|
@@ -286,7 +281,10 @@ export const arrayProcessor: Processor<schemas.$ZodArray> = (schema, ctx, _json,
|
|
|
286
281
|
if (typeof maximum === "number") json.maxItems = maximum;
|
|
287
282
|
|
|
288
283
|
json.type = "array";
|
|
289
|
-
json.items = process(def.element, ctx as any, {
|
|
284
|
+
json.items = process(def.element, ctx as any, {
|
|
285
|
+
...params,
|
|
286
|
+
path: [...params.path, "items"],
|
|
287
|
+
});
|
|
290
288
|
};
|
|
291
289
|
|
|
292
290
|
export const objectProcessor: Processor<schemas.$ZodObject> = (schema, ctx, _json, params) => {
|
|
@@ -527,7 +525,8 @@ export const catchProcessor: Processor<schemas.$ZodCatch> = (schema, ctx, json,
|
|
|
527
525
|
|
|
528
526
|
export const pipeProcessor: Processor<schemas.$ZodPipe> = (schema, ctx, _json, params) => {
|
|
529
527
|
const def = schema._zod.def as schemas.$ZodPipeDef;
|
|
530
|
-
const
|
|
528
|
+
const inIsTransform = def.in._zod.traits.has("$ZodTransform");
|
|
529
|
+
const innerType = ctx.io === "input" ? (inIsTransform ? def.out : def.in) : def.out;
|
|
531
530
|
process(innerType, ctx as any, params);
|
|
532
531
|
const seen = ctx.seen.get(schema)!;
|
|
533
532
|
seen.ref = innerType;
|
|
@@ -14,7 +14,7 @@ export type $Parse = <T extends schemas.$ZodType>(
|
|
|
14
14
|
) => core.output<T>;
|
|
15
15
|
|
|
16
16
|
export const _parse: (_Err: $ZodErrorClass) => $Parse = (_Err) => (schema, value, _ctx, _params) => {
|
|
17
|
-
const ctx: schemas.ParseContextInternal = _ctx ?
|
|
17
|
+
const ctx: schemas.ParseContextInternal = _ctx ? { ..._ctx, async: false } : { async: false };
|
|
18
18
|
const result = schema._zod.run({ value, issues: [] }, ctx);
|
|
19
19
|
if (result instanceof Promise) {
|
|
20
20
|
throw new core.$ZodAsyncError();
|
|
@@ -37,7 +37,7 @@ export type $ParseAsync = <T extends schemas.$ZodType>(
|
|
|
37
37
|
) => Promise<core.output<T>>;
|
|
38
38
|
|
|
39
39
|
export const _parseAsync: (_Err: $ZodErrorClass) => $ParseAsync = (_Err) => async (schema, value, _ctx, params) => {
|
|
40
|
-
const ctx: schemas.ParseContextInternal = _ctx ?
|
|
40
|
+
const ctx: schemas.ParseContextInternal = _ctx ? { ..._ctx, async: true } : { async: true };
|
|
41
41
|
let result = schema._zod.run({ value, issues: [] }, ctx);
|
|
42
42
|
if (result instanceof Promise) result = await result;
|
|
43
43
|
if (result.issues.length) {
|
|
@@ -79,7 +79,7 @@ export type $SafeParseAsync = <T extends schemas.$ZodType>(
|
|
|
79
79
|
) => Promise<util.SafeParseResult<core.output<T>>>;
|
|
80
80
|
|
|
81
81
|
export const _safeParseAsync: (_Err: $ZodErrorClass) => $SafeParseAsync = (_Err) => async (schema, value, _ctx) => {
|
|
82
|
-
const ctx: schemas.ParseContextInternal = _ctx ?
|
|
82
|
+
const ctx: schemas.ParseContextInternal = _ctx ? { ..._ctx, async: true } : { async: true };
|
|
83
83
|
let result = schema._zod.run({ value, issues: [] }, ctx);
|
|
84
84
|
if (result instanceof Promise) result = await result;
|
|
85
85
|
|
|
@@ -101,7 +101,7 @@ export type $Encode = <T extends schemas.$ZodType>(
|
|
|
101
101
|
) => core.input<T>;
|
|
102
102
|
|
|
103
103
|
export const _encode: (_Err: $ZodErrorClass) => $Encode = (_Err) => (schema, value, _ctx) => {
|
|
104
|
-
const ctx = _ctx ?
|
|
104
|
+
const ctx = _ctx ? { ..._ctx, direction: "backward" as const } : { direction: "backward" as const };
|
|
105
105
|
return _parse(_Err)(schema, value, ctx as any) as any;
|
|
106
106
|
};
|
|
107
107
|
|
|
@@ -126,7 +126,7 @@ export type $EncodeAsync = <T extends schemas.$ZodType>(
|
|
|
126
126
|
) => Promise<core.input<T>>;
|
|
127
127
|
|
|
128
128
|
export const _encodeAsync: (_Err: $ZodErrorClass) => $EncodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
129
|
-
const ctx = _ctx ?
|
|
129
|
+
const ctx = _ctx ? { ..._ctx, direction: "backward" as const } : { direction: "backward" as const };
|
|
130
130
|
return _parseAsync(_Err)(schema, value, ctx as any) as any;
|
|
131
131
|
};
|
|
132
132
|
|
|
@@ -151,7 +151,7 @@ export type $SafeEncode = <T extends schemas.$ZodType>(
|
|
|
151
151
|
) => util.SafeParseResult<core.input<T>>;
|
|
152
152
|
|
|
153
153
|
export const _safeEncode: (_Err: $ZodErrorClass) => $SafeEncode = (_Err) => (schema, value, _ctx) => {
|
|
154
|
-
const ctx = _ctx ?
|
|
154
|
+
const ctx = _ctx ? { ..._ctx, direction: "backward" as const } : { direction: "backward" as const };
|
|
155
155
|
return _safeParse(_Err)(schema, value, ctx as any) as any;
|
|
156
156
|
};
|
|
157
157
|
|
|
@@ -176,7 +176,7 @@ export type $SafeEncodeAsync = <T extends schemas.$ZodType>(
|
|
|
176
176
|
) => Promise<util.SafeParseResult<core.input<T>>>;
|
|
177
177
|
|
|
178
178
|
export const _safeEncodeAsync: (_Err: $ZodErrorClass) => $SafeEncodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
179
|
-
const ctx = _ctx ?
|
|
179
|
+
const ctx = _ctx ? { ..._ctx, direction: "backward" as const } : { direction: "backward" as const };
|
|
180
180
|
return _safeParseAsync(_Err)(schema, value, ctx as any) as any;
|
|
181
181
|
};
|
|
182
182
|
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import * as util from "./util.js";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
5
|
+
* (timestamps embedded in the id). Use {@link cuid2} instead.
|
|
6
|
+
* See https://github.com/paralleldrive/cuid.
|
|
7
|
+
*/
|
|
8
|
+
export const cuid: RegExp = /^[cC][0-9a-z]{6,}$/;
|
|
4
9
|
export const cuid2: RegExp = /^[0-9a-z]+$/;
|
|
5
10
|
export const ulid: RegExp = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;
|
|
6
11
|
export const xid: RegExp = /^[0-9a-vA-V]{20}$/;
|
|
@@ -81,6 +86,8 @@ export const hostname: RegExp =
|
|
|
81
86
|
|
|
82
87
|
export const domain: RegExp = /^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/;
|
|
83
88
|
|
|
89
|
+
export const httpProtocol: RegExp = /^https?$/;
|
|
90
|
+
|
|
84
91
|
// https://blog.stevenlevithan.com/archives/validate-phone-number#r4-3 (regex sans spaces)
|
|
85
92
|
// E.164: leading digit must be 1-9; total digits (excluding '+') between 7-15
|
|
86
93
|
export const e164: RegExp = /^\+[1-9]\d{6,14}$/;
|