{"_id":"@cyberxninja-omp/omptype","name":"@cyberxninja-omp/omptype","dist-tags":{"latest":"17.5.3"},"versions":{"17.5.3":{"type":"module","name":"@cyberxninja-omp/omptype","version":"17.5.3","description":"ArkType-compatible runtime schema validation with lazy JIT compilation","homepage":"https://omp.sh","author":{"name":"Can Boluk"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/can1357/oh-my-pi.git","directory":"packages/omptype"},"bugs":{"url":"https://github.com/can1357/oh-my-pi/issues"},"keywords":["schema","validation","arktype","jit"],"main":"./dist/js/index.js","types":"./dist/types/index.d.ts","scripts":{"check":"biome check . && bun run check:types","check:types":"tsgo -p tsconfig.json --noEmit","lint":"biome lint .","fix":"biome check --write --unsafe .","fmt":"biome format --write .","test":"bun test --parallel","bench":"bun bench/bench.ts"},"devDependencies":{"@ark/attest":"0.56.3","@ark/schema":"0.56.2","@ark/util":"0.56.2","@sinclair/typebox":"^0.34.0","@types/bun":"^1.3.14","arkregex":"0.0.8","arktype":"2.2.3"},"engines":{"node":">=20","bun":">=1.3.14"},"exports":{".":{"types":"./dist/types/index.d.ts","bun":"./src/index.ts","default":"./dist/js/index.js"},"./*":{"types":"./dist/types/*.d.ts","bun":"./src/*.ts","default":"./dist/js/*.js"},"./*.js":{"types":"./dist/types/*.d.ts","bun":"./src/*.ts","default":"./dist/js/*.js"}},"_id":"@cyberxninja-omp/omptype@17.5.3","_integrity":"sha512-laXbZQJF0pDTk/cFbnxDrJ6LGD6T0vxyiCyfnth1GjLQ+JgMndKLolAstiNrUamGCXs9AaLBncO12y60Fw/8Bw==","_resolved":"/tmp/cxn-pack-WoXY0R/cyberxninja-omp-omptype-17.5.3.tgz","_from":"file:/tmp/cxn-pack-WoXY0R/cyberxninja-omp-omptype-17.5.3.tgz","_nodeVersion":"24.3.0","_npmVersion":"11.17.0","dist":{"integrity":"sha512-laXbZQJF0pDTk/cFbnxDrJ6LGD6T0vxyiCyfnth1GjLQ+JgMndKLolAstiNrUamGCXs9AaLBncO12y60Fw/8Bw==","shasum":"3dbad284bedd81e14c0fbd50c127491ecf5d0c10","tarball":"https://registry.npmjs.org/@cyberxninja-omp/omptype/-/omptype-17.5.3.tgz","fileCount":42,"unpackedSize":827477,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIBf+7zdyblrUWybDnvXPVhCHSoorISExo/LJdjKXTqkdAiA/hhxA6vk7qFZKiIzirUKFa+yEwKYlx3Zq4PLu1VVQwg=="}]},"_npmUser":{"name":"cyberxninja","email":"jailbreaker20th@gmail.com"},"directories":{},"maintainers":[{"name":"cyberxninja","email":"jailbreaker20th@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/omptype_17.5.3_1787233023811_0.1676760907647763"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-20T13:37:03.428Z","17.5.3":"2026-08-20T13:37:03.935Z","modified":"2026-08-20T13:37:04.189Z"},"maintainers":[{"name":"cyberxninja","email":"jailbreaker20th@gmail.com"}],"description":"ArkType-compatible runtime schema validation with lazy JIT compilation","homepage":"https://omp.sh","keywords":["schema","validation","arktype","jit"],"repository":{"type":"git","url":"git+https://github.com/can1357/oh-my-pi.git","directory":"packages/omptype"},"author":{"name":"Can Boluk"},"bugs":{"url":"https://github.com/can1357/oh-my-pi/issues"},"license":"MIT","readme":"# @cyberxninja-omp/omptype\n\nFast, ArkType-compatible schema validation for JavaScript and TypeScript.\nSchemas start with a small interpreter and lazily compile after repeated use,\nkeeping construction cheap without giving up hot-path validation speed.\n\n## Installation\n\n```sh\nnpm install @cyberxninja-omp/omptype\n# or\nbun add @cyberxninja-omp/omptype\n```\n\nRuns on Node 20+ (published as compiled ESM with bundled type declarations)\nand Bun 1.3.14+ (which resolves the TypeScript source directly via the `bun`\nexport condition). No runtime dependencies.\n\n## Usage\n\n```ts\nimport { type } from \"@cyberxninja-omp/omptype\";\n\nconst Config = type({\n  name: \"string\",\n  \"retries?\": \"number.integer >= 0\",\n  enabled: \"boolean = true\",\n});\n\nconst config = Config.assert({ name: \"worker\" });\n// { name: \"worker\", enabled: true }\n\nconst result = Config({ name: 42 });\nif (result instanceof type.errors) {\n  console.error(result.summary);\n}\n```\n\nSchemas are callable and expose composition (`.or()`, `.and()`, `.array()`,\n`.pipe()`, `.narrow()`), object transforms (`.pick()`, `.omit()`, `.partial()`,\n`.required()`, `.merge()`, `.map()`), refinements, semantic comparison, error\nconfiguration, and JSON Schema emission.\n\nBuilt-in keyword modules include `type.string.email`, `type.string.uuid.v4`,\n`type.string.date.iso.parse`, `type.string.normalize.NFKC`,\n`type.number.integer`, and the parsers under `type.parse`.\n\n## Named and recursive schemas\n\n```ts\nconst models = type\n  .scope({\n    User: { name: \"string\", \"manager?\": \"User\" },\n    Users: \"User[]\",\n    PublicUser: \"Pick<User, 'name'>\",\n  })\n  .export();\n\nmodels.User.assert({ name: \"Ada\", manager: { name: \"Grace\" } });\n```\n\nScopes resolve aliases lazily, including cycles. `type.module()` exports a\nscope directly, `type.define()` preserves literal definitions, and\n`type.generic(\"<value>\", definition)` builds parameterized runtime schemas.\n\nFailed validation returns `OmpErrors`; each entry exposes `code`, `path`,\n`expected`, `actual`, `problem`, and `message`, while the aggregate exposes\n`summary` and `byPath`. `.configure()` accepts string or callback overrides for\nerror text. `.toJsonSchema()` accepts `target`, `dialect`, and `fallback`\noptions.\n\n## Compatibility adapters\n\nTypeBox-style and Zod-style builders produce native omptype schemas:\n\n```ts\nimport { Type, type Static } from \"@cyberxninja-omp/omptype/typebox\";\nimport { z } from \"@cyberxninja-omp/omptype/zod\";\n\nconst TypeBoxUser = Type.Object({ name: Type.String() });\ntype TypeBoxUser = Static<typeof TypeBoxUser>;\n\nconst ZodUser = z.object({ name: z.string() });\nconst user = ZodUser.parse({ name: \"Ada\" });\n```\n\n`@cyberxninja-omp/omptype/ark` provides the repository's ArkType compatibility facade\nand re-exports the same `type` and `scope` implementations.\n\n## Performance\n\nRun the benchmark from the repository root:\n\n```sh\nbun packages/omptype/bench/bench.ts\n```\n\nThe harness first requires every candidate to accept, reject, and transform the\nsame fixtures correctly. Compile and cold-start results use 400 unique object\nschemas and report the fastest of five repetitions. Hot validation mixes valid\nand invalid inputs after 2,000 warmup calls. The valid-only row uses each\nlibrary's public boolean path after 20,000 warmup calls.\n\nRepresentative result on an Apple M4 Max with Darwin 25.6.0 and Bun 1.3.14:\n\n| Phase                   |    omptype |           ArkType |         TypeBox |\n| ----------------------- | ---------: | ----------------: | --------------: |\n| Compile `type()`        |  **509ns** | 271.08µs (532.3×) | 27.36µs (53.7×) |\n| Compile + 2 validations | **2.18µs** | 526.46µs (241.5×) | 46.90µs (21.5×) |\n\n| Hot workload               |  omptype |         ArkType |         TypeBox |\n| -------------------------- | -------: | --------------: | --------------: |\n| `flat-small`               | **25ns** | 5.10µs (203.7×) |  1.23µs (49.2×) |\n| `enum-union`               | **27ns** | 4.92µs (185.0×) |  2.20µs (83.0×) |\n| `nested-arrays`            | **29ns** | 4.80µs (163.0×) | 3.01µs (102.2×) |\n| `strict-defaults`          | **40ns** | 4.85µs (122.1×) | 4.92µs (123.9×) |\n| `delete-extras`            | **22ns** | 4.12µs (191.6×) |  2.07µs (96.0×) |\n| `record-mixed`             | **43ns** | 4.32µs (100.4×) |  3.35µs (77.9×) |\n| `deep-message`             | **31ns** | 6.32µs (202.5×) | 5.13µs (164.5×) |\n| `nested-arrays` valid-only | **15ns** |     28ns (1.8×) |     45ns (2.9×) |\n\nLower times are better. Parenthetical values show how many times slower each\ncandidate was than omptype in this run. Results vary with hardware, runtime,\nthermal state, and dependency versions; use the command above for local\nmeasurements.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_rev":"1-aa46a5e6fce867b8692a73f7b6ab2c7f"}