{"_id":"@deepseek-ai/schemastery","_rev":"6051671-6a7d770c094bd47e64a9aa18","dist-tags":{"latest":"3.18.1","next":"3.18.1-rc.4"},"name":"@deepseek-ai/schemastery","time":{"created":"2026-08-13T07:49:32.415Z","modified":"2026-08-13T07:49:34.790Z","3.18.1-rc.1":"2026-08-10T19:01:54.985Z","3.18.1":"2026-08-13T07:49:23.159Z","3.18.1-rc.4":"2026-08-12T22:14:57.645Z"},"versions":{"3.18.1-rc.1":{"name":"@deepseek-ai/schemastery","version":"3.18.1-rc.1","author":{"name":"Shigma","email":"shigma10826@gmail.com"},"license":"MIT","_id":"@deepseek-ai/schemastery@3.18.1-rc.1","maintainers":[{"name":"imccyu","email":"imccyu@gmail.com"},{"name":"tianyicui-deepseek","email":"tianyi@deepseek.com"}],"homepage":"https://github.com/deepseek-ai/deepseek-harness#readme","bugs":{"url":"https://github.com/deepseek-ai/deepseek-harness/issues"},"dist":{"shasum":"674c6c0670f180ce2144f389bb714047224d3347","tarball":"https://registry.npmmirror.com/@deepseek-ai/schemastery/-/schemastery-3.18.1-rc.1.tgz","fileCount":8,"integrity":"sha512-gilia4mY6S/j6oFYsn4x2Ve9K6QfvzTgqJntkty0wFsKjTYHQ6e2WDvXLMw48t75WRBhpLt+ZpFm3GHmTWkNMw==","signatures":[{"sig":"MEUCICx4aCN0WOn+0SkFMZju6RbkP4qkLgnoMCdbr7CstMV1AiEAsXrgZBqX6WzXmEjpXU31PJt8Z6+UL/YO+HXEg48HGhw=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":108035,"size":25109},"main":"lib/index.cjs","type":"module","_from":"file:/home/runner/work/deepseek-harness/deepseek-harness/dist/npm-vendor/deepseek-ai-schemastery-3.18.1-rc.1.tgz","types":"lib/types/index.d.ts","module":"lib/index.mjs","exports":{".":{"types":"./lib/types/index.d.ts","import":"./lib/index.mjs","require":"./lib/index.cjs"},"./src/*":"./src/*","./package.json":"./package.json"},"_npmUser":{"name":"imccyu","email":"imccyu@gmail.com"},"_resolved":"/home/runner/work/deepseek-harness/deepseek-harness/dist/npm-vendor/deepseek-ai-schemastery-3.18.1-rc.1.tgz","_integrity":"sha512-gilia4mY6S/j6oFYsn4x2Ve9K6QfvzTgqJntkty0wFsKjTYHQ6e2WDvXLMw48t75WRBhpLt+ZpFm3GHmTWkNMw==","repository":{"url":"git+https://github.com/deepseek-ai/deepseek-harness.git","type":"git","directory":"vendor/schemastery"},"_npmVersion":"11.16.0","description":"Type driven schema validator","directories":{},"_nodeVersion":"24.18.0","dependencies":{"@deepseek-ai/cosmokit":"^1.8.2-rc.1","@standard-schema/spec":"^1.1.0"},"publishConfig":{"access":"restricted"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/schemastery_3.18.1-rc.1_1786388514838_0.5696096390328829","host":"s3://npm-registry-packages-npm-production"},"_cnpmcore_publish_time":"2026-08-10T19:01:54.985Z","publish_time":1786388514985,"_source_registry_name":"default"},"3.18.1":{"name":"@deepseek-ai/schemastery","description":"Type driven schema validator","version":"3.18.1","publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/deepseek-ai/deepseek-harness.git","directory":"vendor/schemastery"},"type":"module","main":"lib/index.cjs","module":"lib/index.mjs","types":"lib/types/index.d.ts","exports":{".":{"types":"./lib/types/index.d.ts","import":"./lib/index.mjs","require":"./lib/index.cjs"},"./src/*":"./src/*","./package.json":"./package.json"},"author":{"name":"Shigma","email":"shigma10826@gmail.com"},"license":"MIT","dependencies":{"@standard-schema/spec":"^1.1.0","@deepseek-ai/cosmokit":"^1.8.2"},"_id":"@deepseek-ai/schemastery@3.18.1","bugs":{"url":"https://github.com/deepseek-ai/deepseek-harness/issues"},"homepage":"https://github.com/deepseek-ai/deepseek-harness#readme","_integrity":"sha512-Qn0FCSwCQnpnj6SB31I6i2sIKgKWnkbJM8O0EU91Gv2UsYVvtZTl6IA0sCwk2e2MZf5S8w5hpq9QkeVvK9qwxg==","_resolved":"/home/runner/work/deepseek-harness/deepseek-harness/dist/npm-vendor/deepseek-ai-schemastery-3.18.1.tgz","_from":"file:/home/runner/work/deepseek-harness/deepseek-harness/dist/npm-vendor/deepseek-ai-schemastery-3.18.1.tgz","_nodeVersion":"24.19.0","_npmVersion":"11.17.0","dist":{"integrity":"sha512-Qn0FCSwCQnpnj6SB31I6i2sIKgKWnkbJM8O0EU91Gv2UsYVvtZTl6IA0sCwk2e2MZf5S8w5hpq9QkeVvK9qwxg==","shasum":"b5a37462550431408c94fb0fc31fd8a2a5471576","tarball":"https://registry.npmmirror.com/@deepseek-ai/schemastery/-/schemastery-3.18.1.tgz","fileCount":8,"unpackedSize":108021,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDiDY040T+cakC5XLybi7F3CR0rxB4x6FzJmfsEr35hFwIhALT6D5SMk+Nt07JGAY/2lsEqP7V5L1sXcwikjjrT/etm"}],"size":25098},"_npmUser":{"name":"imccyu","email":"imccyu@gmail.com"},"directories":{},"maintainers":[{"name":"imccyu","email":"imccyu@gmail.com"},{"name":"tianyicui-deepseek","email":"tianyi@deepseek.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/schemastery_3.18.1_1786607363013_0.2954208158781828"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2026-08-13T07:49:23.159Z","publish_time":1786607363159,"_source_registry_name":"default"},"3.18.1-rc.4":{"name":"@deepseek-ai/schemastery","version":"3.18.1-rc.4","author":{"name":"Shigma","email":"shigma10826@gmail.com"},"license":"MIT","_id":"@deepseek-ai/schemastery@3.18.1-rc.4","maintainers":[{"name":"imccyu","email":"imccyu@gmail.com"},{"name":"tianyicui-deepseek","email":"tianyi@deepseek.com"}],"homepage":"https://github.com/deepseek-ai/deepseek-harness#readme","bugs":{"url":"https://github.com/deepseek-ai/deepseek-harness/issues"},"dist":{"shasum":"5428ee611f9515f632874de5576d48c577594de8","tarball":"https://registry.npmmirror.com/@deepseek-ai/schemastery/-/schemastery-3.18.1-rc.4.tgz","fileCount":8,"integrity":"sha512-ZcaEjf3Mh0WN7Zlfm+syfff5dIFjy17lxXGsCcmwEtdQMjVsaRDGFX0yFZYSy7YsF5gx+d7FhFaQPVJIh/Zrlg==","signatures":[{"sig":"MEUCID/2Rio2N54ywcYLi0LyxdXmNUSbfsgmKCKh9i2mFz9qAiEApAerTD4wzugKhHu8wwSQG1mzkMlkyAulN0+ZF5KDox4=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":108035,"size":25109},"main":"lib/index.cjs","type":"module","_from":"file:/home/runner/work/deepseek-harness/deepseek-harness/dist/npm-vendor/deepseek-ai-schemastery-3.18.1-rc.4.tgz","types":"lib/types/index.d.ts","module":"lib/index.mjs","exports":{".":{"types":"./lib/types/index.d.ts","import":"./lib/index.mjs","require":"./lib/index.cjs"},"./src/*":"./src/*","./package.json":"./package.json"},"_npmUser":{"name":"imccyu","email":"imccyu@gmail.com"},"_resolved":"/home/runner/work/deepseek-harness/deepseek-harness/dist/npm-vendor/deepseek-ai-schemastery-3.18.1-rc.4.tgz","_integrity":"sha512-ZcaEjf3Mh0WN7Zlfm+syfff5dIFjy17lxXGsCcmwEtdQMjVsaRDGFX0yFZYSy7YsF5gx+d7FhFaQPVJIh/Zrlg==","repository":{"url":"git+https://github.com/deepseek-ai/deepseek-harness.git","type":"git","directory":"vendor/schemastery"},"_npmVersion":"11.17.0","description":"Type driven schema validator","directories":{},"_nodeVersion":"24.19.0","dependencies":{"@deepseek-ai/cosmokit":"^1.8.2-rc.4","@standard-schema/spec":"^1.1.0"},"publishConfig":{"access":"restricted"},"_hasShrinkwrap":false,"readmeFilename":"README.md","_npmOperationalInternal":{"tmp":"tmp/schemastery_3.18.1-rc.4_1786572897495_0.36126400403696035","host":"s3://npm-registry-packages-npm-production"},"_cnpmcore_publish_time":"2026-08-12T22:14:57.645Z","publish_time":1786572897645,"_source_registry_name":"default"}},"author":{"name":"Shigma","email":"shigma10826@gmail.com"},"bugs":{"url":"https://github.com/deepseek-ai/deepseek-harness/issues"},"description":"Type driven schema validator","homepage":"https://github.com/deepseek-ai/deepseek-harness#readme","license":"MIT","maintainers":[{"name":"tianyicui-deepseek","email":"tianyi@deepseek.com"},{"name":"imccyu","email":"imccyu@gmail.com"}],"readme":"# Schemastery\n\n[![Codecov](https://img.shields.io/codecov/c/github/shigma/schemastery?style=flat-square)](https://codecov.io/gh/shigma/schemastery)\n[![downloads](https://img.shields.io/npm/dm/schemastery?style=flat-square)](https://www.npmjs.com/package/schemastery)\n[![npm](https://img.shields.io/npm/v/schemastery?style=flat-square)](https://www.npmjs.com/package/schemastery)\n[![GitHub](https://img.shields.io/github/license/shigma/schemastery?style=flat-square)](https://github.com/shigma/schemastery/blob/master/LICENSE)\n\nType Driven Schema Validator.\n\n## Features\n\n- **Lightweight.** Much smaller than other validation libraries.\n- **Easy to use.** You can use any schema as a function or constructor directly.\n- **Powerful.** Schemastery supports some advanced types such as `union`, `intersect` and `transform`.\n- **Extensible.** You can create your own schema types via `Schema.extend()`.\n- **Serializable.** Schema objects can be serialized into JSON and then be hydrated in another environment.\n\n## Basic Examples\n\n### use as validator (JavaScript)\n\n```js\nconst Schema = require('schemastery')\n\nconst validate = Schema.number().default(10)\n\nvalidate(0)     // 0\nvalidate(null)  // 10\nvalidate('')    // TypeError\n```\n\n### use as constructor (TypeScript)\n\n```ts\nimport Schema from 'schemastery'\n\ninterface Config {\n  foo: Record<string, string>\n  bar: string[]\n}\n\nconst Config = Schema.object({\n  foo: Schema.dict(Schema.string()).default({}),\n  bar: Schema.array(Schema.string()).default([]),\n})\n\n// config is an instance of Config\n// in this case, that is { foo: {}, bar: [] }\nconst config = new Config()\n```\n\n## General Types\n\n### Schema.any()\n\nAssert that the value is of any type.\n\n```js\nconst validate = Schema.any()\n\nvalidate()            // undefined\nvalidate(0)           // 0\nvalidate({})          // {}\n```\n\n### Schema.never()\n\nAssert that the value is nullable.\n\n```js\nconst validate = Schema.never()\n\nvalidate()            // undefined\nvalidate(0)           // TypeError\nvalidate({})          // TypeError\n```\n\n### Schema.const(value)\n\nAssert that the value is equal to the given constant.\n\n```js\nconst validate = Schema.const(10)\n\nvalidate(10)          // 10\nvalidate(0)           // TypeError\n```\n\n### Schema.number()\n\nAssert that the value is a number.\n\n```js\nconst validate = Schema.number()\n\nvalidate()            // undefined\nvalidate(1)           // 1\nvalidate('')          // TypeError\n```\n\n### Schema.string()\n\nAssert that the value is a string.\n\n```js\nconst validate = Schema.string()\n\nvalidate()            // undefined\nvalidate(0)           // TypeError\nvalidate('foo')       // 'foo'\n```\n\n### Schema.boolean()\n\nAssert that the value is a boolean.\n\n```js\nconst validate = Schema.boolean()\n\nvalidate()            // undefined\nvalidate(0)           // TypeError\nvalidate(true)        // true\n```\n\n### Schema.is(constructor)\n\nAssert that the value is an instance of the given constructor.\n\n```js\nconst validate = Schema.is(RegExp)\n\nvalidate()            // undefined\nvalidate(/foo/)       // /foo/\nvalidate('foo')       // TypeError\n```\n\n### Schema.array(inner)\n\nAssert that the value is an array of `inner`. The default value will be `[]` if not specified.\n\n```js\nconst validate = Schema.array(Schema.number())\n\nvalidate()                  // []\nvalidate(0)                 // TypeError\nvalidate([0, 1])            // [0, 1]\nvalidate([0, '1'])          // TypeError\n```\n\n### Schema.dict(inner)\n\nAssert that the value is a dictionary of `inner`. The default value will be `{}` if not specified.\n\n```js\nconst validate = Schema.dict(Schema.number())\n\nvalidate()                  // {}\nvalidate(0)                 // TypeError\nvalidate({ a: 0, b: 1 })    // { a: 0, b: 1 }\nvalidate({ a: 0, b: '1' })  // TypeError\n```\n\n### Schema.tuple(list)\n\nAssert that the value is a tuple whose each element is of corresponding subtype. The default value will be `[]` if not specified.\n\n```js\nconst validate = Schema.tuple([\n  Schema.number(),\n  Schema.string(),\n])\n\nvalidate()                  // []\nvalidate([0])               // { a: 0 }\nvalidate([0, 1])            // TypeError\nvalidate([0, '1'])          // [0, '1']\n```\n\n### Schema.object(dict)\n\nAssert that the value is an object whose each property is of corresponding subtype. The default value will be `{}` if not specified.\n\n```js\nconst validate = Schema.object({\n  a: Schema.number(),\n  b: Schema.string(),\n})\n\nvalidate()                  // {}\nvalidate({ a: 0 })          // { a: 0 }\nvalidate({ a: 0, b: 1 })    // TypeError\nvalidate({ a: 0, b: '1' })  // { a: 0, b: '1' }\n```\n\n### Schema.union(list)\n\nAssert that the value is one of the specified types.\n\n```js\nconst validate = Schema.union([\n  Schema.number(),\n  Schema.string(),\n])\n\nvalidate()                  // undefined\nvalidate(0)                 // 0\nvalidate('1')               // '1'\nvalidate(true)              // TypeError\n```\n\n### Schema.intersect(list)\n\nAssert that the value should match each specified type.\n\n```js\nconst validate = Schema.intersect([\n  Schema.object({ a: Schema.string().required() }),\n  Schema.object({ b: Schema.number().default(0) }),\n])\n\nvalidate()                  // TypeError\nvalidate({ a: '' })         // { a: '', b: 0 }\nvalidate({ a: '', b: 1 })   // { a: '', b: 1 }\nvalidate({ a: '', b: '2' }) // TypeError\n```\n\n### Schema.transform(inner, callback)\n\nAssert that the value is of the specified subtype and then transformed by `callback`.\n\n```js\nconst validate = Schema.transform(Schema.number().default(0), n => n + 1)\n\nvalidate()                  // 1\nvalidate('0')               // TypeError\nvalidate(10)                // 11\n```\n\n## Instance Methods\n\nNote: `default` and `required` are mutually exclusive.\n\n### schema.required()\n\nAssert that the value is not nullable.\n\n### schema.default(value)\n\nSet the fallback value when nullable.\n\n### schema.description(text)\n\nSet the description of the schema.\n\n### schema.simplify(value)\n\nNormalize a value by removing parts that are equal to schema defaults. This is\nuseful when storing user configuration and keeping persisted files compact.\n\n```js\nconst Config = Schema.object({\n  foo: Schema.string().default(''),\n  bar: Schema.number().default(0),\n})\n\nConfig.simplify({ foo: '', bar: 1 }) // { bar: 1 }\n```\n\n## Validation Options\n\nAll schemas are callable. The second argument accepts validation options:\n\n```js\nconst Config = Schema.object({\n  foo: Schema.number(),\n})\n\nConfig({ foo: '1' }, { autofix: true }) // {}\n```\n\n- `autofix`: remove invalid object properties where possible.\n- `ignore`: skip validation for selected values and schema nodes.\n- `path`: provide an initial path for nested validation errors.\n\n## Shorthand Syntax\n\nSome shorthand syntax is available for inner types.\n\n- `undefined` -> `Schema.any()`\n- `String` -> `Schema.string()`\n- `Number` -> `Schema.number()`\n- `Boolean` -> `Schema.boolean()`\n- `1` -> `Schema.const(1)` (only for primitive types)\n- `Date` -> `Schema.is(Date)`\n\n```js\nSchema.array(String)        // Schema.array(Schema.string())\nSchema.dict(RegExp)         // Schema.dict(Schema.is(RegExp))\nSchema.union([1, 2])        // Schema.union([Schema.const(1), Schema.const(2)])\n```\n\nYou can also use `Schema.from()` to get the inferred schema from a shorthand value.\n\n```js\nSchema.from()               // Schema.any()\nSchema.from(Date)           // Schema.is(Date)\nSchema.from('foo')          // Schema.const('foo')\n```\n\n## Advanced Examples\n\nHere are some examples which demonstrate how to define advanced types.\n\n### Enumeration\n\n```js\nconst Enum = Schema.union(['red', 'blue'])\n\nEnum('red')                 // 'red'\nEnum('blue')                // 'blue'\nEnum('green')               // TypeError\n```\n\n### ToString\n\n```js\nconst ToString = Schema.transform(Schema.any(), v => String(v))\n\nToString('')                // ''\nToString(0)                 // '0'\nToString({})                // '{}'\n```\n\n### Listable\n\n```js\nconst Listable = Schema.union([\n  Schema.array(Number),\n  Schema.transform(Number, n => [n]),\n]).default([])\n\nListable()                  // []\nListable(0)                 // [0]\nListable([1, 2])            // [1, 2]\n```\n\n### Alias\n\n```js\nconst Config = Schema.dict(Number, Schema.union([\n  'foo',\n  Schema.transform('bar', () => 'foo'),\n]))\n\nConfig({ foo: 1 })          // { foo: 1 }\nConfig({ bar: 2 })          // { foo: 2 }\nConfig({ bar: '3' })        // TypeError\n```\n\n## Extensibility\n\nCustom schema types are registered with `Schema.extend(type, resolve)`. A\nresolver receives the input value, schema node, validation options, and a strict\nflag. Return `[value]` for accepted input, or `[value, adapted]` when the caller\nshould write an adapted value back to the source object.\n\n```js\nSchema.extend('trimmed', (data, schema, options) => {\n  if (typeof data !== 'string') {\n    throw new Schema.ValidationError(`expected string but got ${data}`, options)\n  }\n  return [data.trim()]\n})\n```\n\n## Serializability\n\n```js\nconst schema1 = Schema.object({\n  foo: Schema.string(),\n  bar: Schema.number(),\n})\n\n// should have the same effect as schema1\nconst schema2 = new Schema(JSON.parse(JSON.stringify(schema1)))\n```\n\nSchemastery also exposes the Standard Schema `~standard` property, so compatible\ntools can validate values without depending on Schemastery-specific APIs.\n","repository":{"type":"git","url":"git+https://github.com/deepseek-ai/deepseek-harness.git","directory":"vendor/schemastery"},"_source_registry_name":"default"}