{"_id":"@auth70/zodex-esm","_rev":"5-269848989c3d7b60392bc51838c92334","name":"@auth70/zodex-esm","dist-tags":{"latest":"4.0.1"},"versions":{"0.7.1":{"name":"@auth70/zodex-esm","version":"0.7.1","keywords":["zod","serialization","deserialization","reflection"],"license":"MIT","_id":"@auth70/zodex-esm@0.7.1","maintainers":[{"name":"miunau","email":"miunau+npm@miunau.com"}],"dist":{"shasum":"cb0c17432458c7eedf3fff64df7a2f4ecf6af711","tarball":"https://registry.npmjs.org/@auth70/zodex-esm/-/zodex-esm-0.7.1.tgz","fileCount":13,"integrity":"sha512-mbhBKX/qphS5KLlQN8bzKcuYWzfIvWqbYjsgl9AHGwqTF2xAifS6gmK8nIravKC7GWeAJQgTaa9mB9MEZeM9og==","signatures":[{"sig":"MEUCIQDhS6LCwxVqMimf8aZRU+QxJL7TVTAfR9JTQf7kmrslqAIgQNMd4ZICIKw20AbZNPHyo/Of7t5btyh7IQoRgByYEes=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":53169},"type":"module","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"f221373ee3a8b6626026d0cd70df335313b39ab0","scripts":{"build":"rm -rf dist && tsc","prepublish":"pnpm run build"},"_npmUser":{"name":"miunau","email":"miunau+npm@miunau.com"},"_npmVersion":"10.2.4","description":"Type-safe (de)serialization for Zod (esm fork of zodex with minimal deps)","directories":{},"_nodeVersion":"21.6.1","dependencies":{"zod":"^3.22.4"},"typesVersions":{"*":{".":["./dist"]}},"_hasShrinkwrap":false,"devDependencies":{"type-fest":"^4.15.0","typescript":"5.4.4"},"peerDependencies":{"zod":"^3.x"},"_npmOperationalInternal":{"tmp":"tmp/zodex-esm_0.7.1_1712293280118_0.3580589932834348","host":"s3://npm-registry-packages"}},"0.7.2":{"name":"@auth70/zodex-esm","version":"0.7.2","keywords":["zod","serialization","deserialization","reflection"],"license":"MIT","_id":"@auth70/zodex-esm@0.7.2","maintainers":[{"name":"miunau","email":"miunau+npm@miunau.com"}],"dist":{"shasum":"0780a93fd9f58720025c8f18ff7ebee3df612368","tarball":"https://registry.npmjs.org/@auth70/zodex-esm/-/zodex-esm-0.7.2.tgz","fileCount":13,"integrity":"sha512-IVo2BdzUfUY17eq7wazh9Ef3WS/0M/o8NlgBEwsJvA2z7IpszPWdN9sxKwQYrNlCotfL6BnNd2wa9qGSC1LY/Q==","signatures":[{"sig":"MEUCIQDFtSqS3aqMS7I5fl14mhVawGTrDANq44ab2LwuMcbVIwIgBlNQyhTAubgqR/YxHq6a6lVxvKUKAm2nnpK31vqjt1Q=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":53175},"type":"module","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"f221373ee3a8b6626026d0cd70df335313b39ab0","scripts":{"build":"rm -rf dist && tsc","prepublish":"pnpm run build"},"_npmUser":{"name":"miunau","email":"miunau+npm@miunau.com"},"_npmVersion":"10.2.4","description":"Type-safe (de)serialization for Zod (esm fork of zodex with minimal deps)","directories":{},"_nodeVersion":"21.6.1","dependencies":{"zod":"^3.22.4"},"typesVersions":{"*":{".":["./dist"]}},"_hasShrinkwrap":false,"devDependencies":{"type-fest":"^4.15.0","typescript":"5.4.4"},"peerDependencies":{"zod":"^3.x"},"_npmOperationalInternal":{"tmp":"tmp/zodex-esm_0.7.2_1712293431726_0.15427869904948888","host":"s3://npm-registry-packages"}},"0.7.3":{"name":"@auth70/zodex-esm","version":"0.7.3","keywords":["zod","serialization","deserialization","reflection"],"license":"MIT","_id":"@auth70/zodex-esm@0.7.3","maintainers":[{"name":"miunau","email":"miunau+npm@miunau.com"}],"dist":{"shasum":"666a21818130537d7d9ed941a0ea108fcd9aa70f","tarball":"https://registry.npmjs.org/@auth70/zodex-esm/-/zodex-esm-0.7.3.tgz","fileCount":15,"integrity":"sha512-7KfcqRYwbxGxzyco1vvHh9UfY8jzEiprLy4pEJhOS3nHZ96MszTEoffl7HIVpYnXaPaPT8yYUqTAYTM/eU3wdQ==","signatures":[{"sig":"MEYCIQCFBoTLvtvVpQ2frnOVmtvVvJi6WT9Gvag15U3oCzwfNQIhAPHNhryG36p5LoM5LwhcP60IKVOyyItVRXGf6V51S+yp","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":30355},"type":"module","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"f221373ee3a8b6626026d0cd70df335313b39ab0","scripts":{"build":"rm -rf dist && tsc","prepublish":"pnpm run build"},"_npmUser":{"name":"miunau","email":"miunau+npm@miunau.com"},"_npmVersion":"10.2.4","description":"Type-safe (de)serialization for Zod (esm fork of zodex with minimal deps)","directories":{},"_nodeVersion":"21.6.1","dependencies":{"zod":"^3.22.4"},"typesVersions":{"*":{".":["./dist"]}},"_hasShrinkwrap":false,"devDependencies":{"type-fest":"^4.15.0","typescript":"5.4.4"},"peerDependencies":{"zod":"^3.x"},"_npmOperationalInternal":{"tmp":"tmp/zodex-esm_0.7.3_1712293583962_0.05938992118591746","host":"s3://npm-registry-packages"}},"4.0.0":{"name":"@auth70/zodex-esm","version":"4.0.0","keywords":["zod","serialization","deserialization","reflection"],"author":{"name":"Gregor Weber","email":"mail@watwa.re"},"license":"MIT","_id":"@auth70/zodex-esm@4.0.0","maintainers":[{"name":"miunau","email":"miunau+npm@miunau.com"}],"dist":{"shasum":"86d6807c8bc954c724ff66154937e6f417eeb7cf","tarball":"https://registry.npmjs.org/@auth70/zodex-esm/-/zodex-esm-4.0.0.tgz","fileCount":17,"integrity":"sha512-baVmiFacihqjBy7oJjb4QlFv4G8rD/PF0bT4tDke5xkKUDqggCPJrTU5nx/M2aqRoBdkkD+HWQrUXJC57AqK6g==","signatures":[{"sig":"MEYCIQDowG3u3074PQDVV5MEiGQCaOWKjHik8YiEVopDAeEXQgIhAPXIlP9K7jn7lUybMp47gQZ90aZ56PY+60gKxFwaYNZK","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":94856},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","gitHead":"35fd23b6b82c66079cf72199b85ef836e5989320","scripts":{"test":"vitest --coverage --silent=false --reporter=basic","build":"rm -rf dist && pnpm tsc && cp src/schema.zodex.json dist/schema.zodex.json && tsup src/index.ts --format esm --legacy-output","prepublish":"pnpm run build"},"_npmUser":{"name":"miunau","email":"miunau+npm@miunau.com"},"_npmVersion":"10.9.2","description":"Type-safe (de)serialization for Zod","directories":{},"_nodeVersion":"22.13.1","dependencies":{"zod":"^3.24.1","type-fest":"^4.26.0"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.3.0","vitest":"2.0.5","prettier":"2.8.8","typescript":"5.5.4","@vitest/coverage-v8":"^2.0.5"},"peerDependencies":{"zod":"^3.x"},"_npmOperationalInternal":{"tmp":"tmp/zodex-esm_4.0.0_1749821672499_0.11945578355779585","host":"s3://npm-registry-packages-npm-production"}},"4.0.1":{"name":"@auth70/zodex-esm","version":"4.0.1","description":"Type-safe (de)serialization for Zod","type":"module","main":"dist/index.js","types":"dist/index.d.ts","keywords":["zod","serialization","deserialization","reflection"],"author":{"name":"Gregor Weber","email":"mail@watwa.re"},"license":"MIT","scripts":{"test":"vitest --coverage --silent=false --reporter=basic","build":"rm -rf dist && pnpm tsc && cp src/schema.zodex.json dist/schema.zodex.json && tsup src/index.ts --format esm --legacy-output","prepublish":"pnpm run build"},"peerDependencies":{"zod":"^3.x"},"dependencies":{"zod":"^3.25.64"},"devDependencies":{"@types/node":"^24.0.1","@vitest/coverage-v8":"^3.2.3","prettier":"3.5.3","tsup":"^8.5.0","typescript":"5.8.3","vitest":"3.2.3"},"_id":"@auth70/zodex-esm@4.0.1","gitHead":"35fd23b6b82c66079cf72199b85ef836e5989320","_nodeVersion":"22.13.1","_npmVersion":"10.9.2","dist":{"integrity":"sha512-cit6ebh+YDR2LfnNESRcLi6ivVR7VUqR0qhlPDBxAoInBcqlPIr5GpJ3l7Vee916dVbO/jxskVkMGWha1vpTfg==","shasum":"910cfa5170b3d9fe244822a4446e0c74492472f2","tarball":"https://registry.npmjs.org/@auth70/zodex-esm/-/zodex-esm-4.0.1.tgz","fileCount":17,"unpackedSize":94974,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCBNQsD+sQLisM3B8UlldqKUArz3SbxhtegvUcaJuWJnAIhAJRVhf1q0DguafjRJ5Tc8Ntkm9SgWNI/iOfI0/uwC0+g"}]},"_npmUser":{"name":"miunau","email":"miunau+npm@miunau.com"},"directories":{},"maintainers":[{"name":"miunau","email":"miunau+npm@miunau.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/zodex-esm_4.0.1_1749822060460_0.6098462455868288"},"_hasShrinkwrap":false}},"time":{"created":"2024-04-05T05:01:20.017Z","modified":"2025-06-13T13:41:00.883Z","0.7.1":"2024-04-05T05:01:20.301Z","0.7.2":"2024-04-05T05:03:51.886Z","0.7.3":"2024-04-05T05:06:24.134Z","4.0.0":"2025-06-13T13:34:32.698Z","4.0.1":"2025-06-13T13:41:00.700Z"},"author":{"name":"Gregor Weber","email":"mail@watwa.re"},"license":"MIT","keywords":["zod","serialization","deserialization","reflection"],"description":"Type-safe (de)serialization for Zod","maintainers":[{"name":"miunau","email":"miunau+npm@miunau.com"}],"readme":"# Zodex\n\nType-safe (de)serialization library for [zod](https://zod.dev/). It both serializes and simplifies types into a JSON format, in the following ways:\n\n- optional, nullable and default types are inlined into any given types itself\n\n```json\n{ \"type\": \"string\", \"defaultValue\": \"hi\" }\n```\n\n- number checks are also inlined into the type itself\n\n```json\n{ \"type\": \"number\", \"min\": 23, \"max\": 42 }\n```\n\n## Installation\n\n```sh\npnpm add zodex\n# or\nyarn add zodex\n# or\nnpm install zodex\n```\n\n## Usage\n\n```ts\nimport { z } from \"zod\";\nimport { zerialize } from \"zodex\";\n\nconst someZodType = z.discriminatedUnion(\"id\", [\n  z.object({ id: z.literal(\"a\"), count: z.number().optional() }),\n  z.object({ id: z.literal(\"b\") }),\n]);\nconst shape = zerialize(someZodType);\n```\n\nNow `typeof shape` will be\n\n```ts\ntype Shape = {\n  type: \"discriminatedUnion\";\n  discriminator: \"id\";\n  options: [\n    {\n      type: \"object\";\n      properties: {\n        id: { type: \"literal\"; value: \"a\" };\n        count: { type: \"number\"; isOptional: true };\n      };\n    },\n    { type: \"object\"; properties: { id: { type: \"literal\"; value: \"b\" } } }\n  ];\n};\n```\n\nwhich is exactly equal to its runtime value (shown in YAML for brevity, [you probably shouldn't use YAML](https://ruudvanasseldonk.com/2023/01/11/the-yaml-document-from-hell)):\n\n```yaml\ntype: \"discriminatedUnion\"\ndiscriminator: \"id\"\noptions:\n  - type: \"object\"\n    properties:\n      id:\n        type: \"literal\"\n        value: \"a\"\n      count:\n        type: \"number\"\n        isOptional: true\n  - type: \"object\"\n    properties:\n      id:\n        type: \"literal\"\n        value: \"b\"\n```\n\n## Options\n\nBoth `zerialize` and `dezerialize` accept an options object with the\nsame properties.\n\nSince Zod does not allow the specification of the names of effects\n(refinements, transforms, and preprocesses), we allow you to supply\nas options maps of names to effects so that these can be part of\nserialization and deserialization. If none of these options are\nsupplied, the effects will be omitted.\n\nProperties:\n\n- `superRefinements` - Map of name to `.superRefine()` functions\n- `transforms` - Map of name to `.transform()` functions\n- `preprocesses` - Map of name to `z.preprocess()` functions\n\n## Use of JSON References\n\nJSON references are used to represent local references. If you wish to use\nJSON references for remote (non-cyclic) references, you may do so, but you\nwill need to use a library like\n[`json-refs`](https://github.com/whitlockjc/json-refs) (with `resolveRefs`)\nto first resolve such references and then supply the object to `dezerialize`.\n\nZodex will serialize local references, including handling recursive ones. As\nwith JSON Schema, the `$defs` property may be a reasonable top-level property\nto use as storage for local references, but it receives no special treatment\nby this library (any property could be targeted by one's references).\n\nNote that if you wish to use additional properties with an item containing a\nreference, e.g., `isOptional`, you will first need to wrap the JSON reference\nwithin a single-item union such as in the following:\n\n```json\n{\n  \"type\": \"union\",\n  \"options\": [\n    {\n      \"$ref\": \"#/properties/id\"\n    }\n  ]\n}\n```\n\nNote that due to technical limitations with Zod, we are unable to allow a\nJSON reference in place of an object `properties` object. You can either\nresolve this first with another library (if it is a non-cyclic reference),\nor target the whole object or individual properties.\n\n## Roadmap\n\n- custom error messages are not included\n\n## Caveats\n\n- `brand` is not supportable and omitted\n- `lazy` and `pipeline` types are unwrapped\n- `catch` with a function can have its then-value serialized but it\n  cannot then be deserialized back into using the original function\n- Due to technical limitations, we cannot support the regular\n  `refine()`, `custom()` and `instanceof` methods (and they will be\n  ignored), but these are really just implementations of `superRefine()`\n  which is supported\n","readmeFilename":"README.md"}