{"_id":"@emagjby/strata-js","_rev":"6-83f0791f47741ad649f0b0275a551141","name":"@emagjby/strata-js","dist-tags":{"latest":"0.4.4"},"versions":{"0.3.0":{"name":"@emagjby/strata-js","version":"0.3.0","_id":"@emagjby/strata-js@0.3.0","maintainers":[{"name":"gencho","email":"emagjby@gmail.com"}],"bin":{"strata-js":"dist/cli.js"},"dist":{"shasum":"6a36c12e9fe14257f38e6349c334dba1c2f708a0","tarball":"https://registry.npmjs.org/@emagjby/strata-js/-/strata-js-0.3.0.tgz","fileCount":56,"integrity":"sha512-DO3iXJEq2Z0y0tM7IFaH2NMTER6hdqmnJeUqIfX4h1CMRa9LyhNGa06Itx3HhoNg6k0WJBC5BNm3GbDXC7uCRg==","signatures":[{"sig":"MEQCIDTJi22//H8sxmHV4Xkt9KC5Riq9etcHsCgomNPRTgzhAiB2nkD9IL1qGCftoJ2Wv3i7H02+2poNy+HwxHjC+9212w==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":84883},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","exports":{".":"./dist/index.js"},"gitHead":"3d0c17c73edf845b37e217d0e3060a4daa0c3b18","scripts":{"test":"tsx --test","build":"tsc","check":"tsc --noEmit && npm run test","prepublishOnly":"npm run build"},"_npmUser":{"name":"gencho","email":"emagjby@gmail.com"},"_npmVersion":"11.6.4","directories":{},"_nodeVersion":"25.2.1","dependencies":{"@noble/hashes":"^2.0.1"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.21.0","typescript":"^5.9.3","@types/node":"^25.0.3"},"_npmOperationalInternal":{"tmp":"tmp/strata-js_0.3.0_1767555019818_0.29669020481185204","host":"s3://npm-registry-packages-npm-production"}},"0.3.1":{"name":"@emagjby/strata-js","version":"0.3.1","_id":"@emagjby/strata-js@0.3.1","maintainers":[{"name":"gencho","email":"emagjby@gmail.com"}],"bin":{"strata-js":"dist/cli.js"},"dist":{"shasum":"390e7a3fb3636588c740ed7455c5b389688d0279","tarball":"https://registry.npmjs.org/@emagjby/strata-js/-/strata-js-0.3.1.tgz","fileCount":53,"integrity":"sha512-62OvT3d97QEmU5jbWcRcIvIdCGrxYt1Zl20J3QMSZsdiIlPmu4DexoVo1O2J2tTBL2r4ybYZoz+u72CqwQkcgQ==","signatures":[{"sig":"MEQCID/yoGICsMGwwfnGMgIsrLItkCuAM/15qbz0rYRP0qR7AiByUDXaX0Qjvscz49l13ffqNgfGav6q/5O/kzk0St/p9g==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":76287},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","exports":{".":"./dist/index.js"},"gitHead":"193d73b54f5e5073191e39306f3ee5d1842a1670","scripts":{"test":"tsx --test","build":"tsc","check":"tsc --noEmit && npm run test","prepublishOnly":"npm run build"},"_npmUser":{"name":"gencho","email":"emagjby@gmail.com"},"_npmVersion":"11.6.4","directories":{},"_nodeVersion":"25.2.1","dependencies":{"@noble/hashes":"^2.0.1"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.21.0","typescript":"^5.9.3","@types/node":"^25.0.3"},"_npmOperationalInternal":{"tmp":"tmp/strata-js_0.3.1_1767556662014_0.05213940322096544","host":"s3://npm-registry-packages-npm-production"}},"0.3.2":{"name":"@emagjby/strata-js","version":"0.3.2","_id":"@emagjby/strata-js@0.3.2","maintainers":[{"name":"gencho","email":"emagjby@gmail.com"}],"bin":{"strata-js":"dist/cli.js"},"dist":{"shasum":"f4143f331e2741508973f44e47c1b724d201cf74","tarball":"https://registry.npmjs.org/@emagjby/strata-js/-/strata-js-0.3.2.tgz","fileCount":54,"integrity":"sha512-wLY30t7H9DVouUY3k21bcppQ4Bx9x8KEH24/pGI4yfIQBZF0F834MBn9v4c9+915FlZM64jeq6bA3H6uojXAFQ==","signatures":[{"sig":"MEQCIF7W3c8am7x77IzRP2+LDKwLsIvaq51jInbp5L6FViYmAiBkgfvsy8i9yYaxo2xHo7jAqt5jChgibcQVL3rg+R3y3w==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":80725},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","exports":{".":"./dist/index.js"},"gitHead":"4cb69422022e0a2db1ef0974214b73847ff4be7e","scripts":{"test":"tsx --test","build":"tsc","check":"tsc --noEmit && npm run test","prepublishOnly":"npm run build"},"_npmUser":{"name":"gencho","email":"emagjby@gmail.com"},"_npmVersion":"11.6.2","description":"Deterministic Strata implementation for JavaScript.","directories":{},"_nodeVersion":"25.2.1","dependencies":{"@noble/hashes":"^2.0.1"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.21.0","typescript":"^5.9.3","@types/node":"^25.0.3"},"_npmOperationalInternal":{"tmp":"tmp/strata-js_0.3.2_1767992992087_0.47551239064520234","host":"s3://npm-registry-packages-npm-production"}},"0.3.3":{"name":"@emagjby/strata-js","version":"0.3.3","_id":"@emagjby/strata-js@0.3.3","maintainers":[{"name":"gencho","email":"emagjby@gmail.com"}],"bin":{"strata-js":"dist/cli.js"},"dist":{"shasum":"02167df3745e0ca6fa3f9e536e5e0a375c07f66f","tarball":"https://registry.npmjs.org/@emagjby/strata-js/-/strata-js-0.3.3.tgz","fileCount":54,"integrity":"sha512-cl9JUxCJCnHutb906l5gsS0U1ZQ/Inu0f/6tlwIgE/hs98DLpc6b8iy4KeJSbFVOBlbceIJbdTjNCEfTqbM3CA==","signatures":[{"sig":"MEUCIGguV2HNedDS1iqx59USlm6WW9Tctig+2ScEExHn/q6oAiEAzIhDC4DlsAr/0C/sH36UQjO8PRghLulRW+zPlmqdnSU=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":80983},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","exports":{".":"./dist/index.js"},"gitHead":"29a5608dacf8c7a55fb6467963ce1e65fcd242f7","scripts":{"test":"tsx --test","build":"tsc","check":"tsc --noEmit && npm run test","prepublishOnly":"npm run build"},"_npmUser":{"name":"gencho","email":"emagjby@gmail.com"},"_npmVersion":"11.6.2","description":"Deterministic Strata implementation for JavaScript.","directories":{},"_nodeVersion":"25.2.1","dependencies":{"@noble/hashes":"^2.0.1"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.21.0","typescript":"^5.9.3","@types/node":"^25.0.3"},"_npmOperationalInternal":{"tmp":"tmp/strata-js_0.3.3_1767994616728_0.33839437491249225","host":"s3://npm-registry-packages-npm-production"}},"0.4.0":{"name":"@emagjby/strata-js","version":"0.4.0","author":{"name":"Emagjby"},"license":"MIT","_id":"@emagjby/strata-js@0.4.0","maintainers":[{"name":"gencho","email":"emagjby@gmail.com"}],"bin":{"strata-js":"dist/cli.js"},"dist":{"shasum":"48eb6542e999d00cf5c4caeb126c8b3fecb241bf","tarball":"https://registry.npmjs.org/@emagjby/strata-js/-/strata-js-0.4.0.tgz","fileCount":55,"integrity":"sha512-nQSRhsHILYF4MI34VrYFgyRNfr7sb/zq+1cRCoFZDTcDDqX80EyngrOfn/A6d/v0JdT6Vv3DF+gqbbkbSxZd4g==","signatures":[{"sig":"MEYCIQCjJSExC1v4J87rkAqzW3egHXITL5LZQTO/qhIdR1Z2qwIhAMfY3klPGhS07mKPzy6uiM+shX2QIMUaHt3KeXvuD7kl","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":89601},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","exports":{".":"./dist/index.js"},"gitHead":"7b7ef9d08c3b100870d3991d876eb76191869fe9","scripts":{"test":"tsx --test","build":"tsc","check":"tsc --noEmit && npm run test","prepublishOnly":"npm run build"},"_npmUser":{"name":"gencho","email":"emagjby@gmail.com"},"_npmVersion":"11.6.2","description":"**Deterministic Strata implementation for JavaScript.**","directories":{},"_nodeVersion":"25.2.1","dependencies":{"@noble/hashes":"^2.0.1"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.21.0","typescript":"^5.9.3","@types/node":"^25.0.3"},"_npmOperationalInternal":{"tmp":"tmp/strata-js_0.4.0_1768484424275_0.768993874111485","host":"s3://npm-registry-packages-npm-production"}},"0.4.4":{"name":"@emagjby/strata-js","version":"0.4.4","type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":"./dist/index.js"},"license":"MIT","author":{"name":"Emagjby"},"bin":{"strata-js":"dist/cli.js"},"scripts":{"build":"tsc","test":"tsx --test","check":"tsc --noEmit && npm run test","prepublishOnly":"npm run build"},"devDependencies":{"@types/node":"^25.0.3","tsx":"^4.21.0","typescript":"^5.9.3"},"dependencies":{"@noble/hashes":"^2.0.1"},"gitHead":"790511f718558f0086a1b0881e2c37fca61415cd","_id":"@emagjby/strata-js@0.4.4","description":"**Deterministic Strata implementation for JavaScript.**","_nodeVersion":"25.6.1","_npmVersion":"11.9.0","dist":{"integrity":"sha512-0z1QFefX8j3ZtWqGn3XGjEeI0Z0zY0mZaOqBtAUiQYsHdxSAfI2fmBG1hnCHsK0dJ5azJG6DZYtkTHJ8DYab1g==","shasum":"a67160ee2d84136333f9c39389a3c9a73c52bc62","tarball":"https://registry.npmjs.org/@emagjby/strata-js/-/strata-js-0.4.4.tgz","fileCount":59,"unpackedSize":96757,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIHC6gcmhDT5gGsxUu5ZB1EzX+RQT4oiH/QrEL0nvhA8cAiA2bgPATCqZTDySpf1p86Gl6rCsHt1DLX3n4zkkzLRtHA=="}]},"_npmUser":{"name":"gencho","email":"emagjby@gmail.com"},"directories":{},"maintainers":[{"name":"gencho","email":"emagjby@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/strata-js_0.4.4_1772737873173_0.01793180276126516"},"_hasShrinkwrap":false}},"time":{"created":"2026-01-04T19:30:19.742Z","modified":"2026-03-05T19:11:13.499Z","0.3.0":"2026-01-04T19:30:19.983Z","0.3.1":"2026-01-04T19:57:42.194Z","0.3.2":"2026-01-09T21:09:52.222Z","0.3.3":"2026-01-09T21:36:56.874Z","0.4.0":"2026-01-15T13:40:24.434Z","0.4.4":"2026-03-05T19:11:13.371Z"},"author":{"name":"Emagjby"},"license":"MIT","description":"**Deterministic Strata implementation for JavaScript.**","maintainers":[{"name":"gencho","email":"emagjby@gmail.com"}],"readme":"# @emagjby/strata-js\n\n**Deterministic Strata implementation for JavaScript.**\n\nThis package is the **JavaScript parity implementation** of **Strata**.\n\n> Same data → same bytes → same hash.  \n> No ambiguity. No normalization. No silent coercions.\n\nIf Rust and JavaScript ever disagree, **that is a bug**.\n\n---\n\n## What is Strata?\n\nStrata is a **strict, minimal data model** with a **fully deterministic binary encoding**.\n\nIt is designed for systems where:\n\n- data integrity is non-negotiable\n- hashes must be stable forever\n- cross-language verification is required\n- ambiguity is unacceptable\n\nStrata draws a hard line between **representation** and **truth**:\n\n- `Value` is an in-memory representation\n- canonical `.scb` bytes define truth\n- hashes are computed only from canonical bytes\n\n---\n\n## What this package provides\n\nThis package provides:\n\n- Canonical encoder for Strata Core Binary (`.scb`)\n- Safe decoder with explicit error semantics\n- Parser for Strata Text (`.st`)\n- Deterministic BLAKE3 hashing\n- Deterministic formatting (`fmt`)\n- CLI tooling (mirrors Rust CLI)\n- Golden vector enforcement\n- Behavioral parity with the Rust reference implementation\n\nThis package does **not** define canonical truth.  \nThe Rust implementation does.\n\n---\n\n## Install\n\nLibrary:\n\n```bash\nnpm install @emagjby/strata-js\n```\n\nCLI:\n\n```bash\nnpm install -g @emagjby/strata-js\n```\n\n---\n\n## Quickstart (Library)\n\n### Parse `.st` → encode `.scb` → hash\n\n```js\nimport { parse, encodeValue, hashValueHex } from \"@emagjby/strata-js\";\n\nconst source = `{\n  name: \"alice\"\n  active: true\n  count: 3\n}`;\n\nconst value = parse(source);\nconst scb = encodeValue(value); // Uint8Array (canonical bytes)\n\n// Hashing is defined over canonical bytes\nconsole.log(hashValueHex(value));\n```\n\n---\n\n### Decode `.scb` bytes back into a Value\n\n```js\nimport { decodeValue, encodeValue } from \"@emagjby/strata-js\";\n\nconst originalScb = new Uint8Array([0x00]); // example only\n\nconst value = decodeValue(originalScb);\nconst roundtrippedScb = encodeValue(value);\n\n// Guaranteed: encode(decode(bytes)) === bytes\n// NOT guaranteed: decode(encode(value)) === value\nconsole.log(roundtrippedScb);\n```\n\n---\n\n### Hash an existing Value\n\n```js\nimport { parse, hashValueHex } from \"@emagjby/strata-js\";\n\nconst value = parse(\"[1, 2, 3]\");\nconsole.log(hashValueHex(value));\n```\n\n---\n\n## Constructing Values (JavaScript)\n\nThe recommended construction API is the **`Value` factory**.\n\nThe legacy alias `V` remains supported for backwards compatibility.\n\n```js\nimport { Value } from \"@emagjby/strata-js\";\n\nconst value = Value.mapOf(\n  [\"id\", Value.int(42n)],\n  [\"name\", Value.string(\"Gencho\")],\n  [\"active\", Value.bool(true)],\n  [\"skills\", Value.listOf(Value.string(\"rust\"), Value.string(\"systems\"))],\n  [\n    \"meta\",\n    Value.mapOf(\n      [\"a\", Value.int(1n)],\n      [\"a\", Value.int(2n)], // last-write-wins\n    ),\n  ],\n);\n```\n\nAvailable helpers:\n\n- `Value.null()`\n- `Value.bool(boolean)`\n- `Value.int(bigint)` **(BigInt only)**\n- `Value.string(string)`\n- `Value.bytes(Uint8Array)`\n- `Value.list(Value[])`\n- `Value.map(Iterable<[string, Value]>)`\n\nDX helpers (additive):\n\n- `Value.listOf(...Value)`\n- `Value.mapObj({ [key]: Value })`\n- `Value.mapOf(...[string, Value])`\n- `Value.bytesFrom(Uint8Array | ArrayBuffer | number[] | Iterable<number>)`\n- `Value.bytesHex(hexString)` (strict hex)\n\nDuplicate map keys resolve via **last-write-wins**.\n\n---\n\n## JavaScript Value model (important)\n\nStrata values are **not JSON** and are intentionally strict.\n\nRules:\n\n- Integers are `bigint` (JS `number` is rejected)\n- Bytes are `Uint8Array`\n- Maps are `ReadonlyMap<string, Value>`\n- No floats\n- No implicit conversions\n\nType shape (abridged):\n\n- `{ kind: \"null\" }`\n- `{ kind: \"bool\", value: boolean }`\n- `{ kind: \"int\", value: bigint }`\n- `{ kind: \"string\", value: string }`\n- `{ kind: \"bytes\", value: Uint8Array }`\n- `{ kind: \"list\", value: readonly Value[] }`\n- `{ kind: \"map\", value: ReadonlyMap<string, Value> }`\n\nIf you need JSON interoperability, you must define an **explicit mapping**.\n\n---\n\n## Canonical encoding & determinism\n\n- Encoding is fully deterministic\n- Map keys are sorted by UTF-8 byte order during encoding\n- Duplicate keys overwrite earlier entries (last-write-wins)\n- Hashing is defined over canonical `.scb` bytes\n\nIf your system needs “mostly the same bytes”, Strata is not the tool.  \nIf it needs **exactly the same bytes**, it is.\n\n---\n\n## CLI\n\nThe `strata-js` CLI mirrors the Rust CLI.\n\nCommands:\n\n- `compile` – compile `.st` → canonical `.scb`\n- `decode` – decode `.scb` for inspection\n- `hash` – compute deterministic hash\n- `fmt` – parse and pretty-print `.st` (or `.scb`)\n\n### Compile\n\n```bash\nstrata-js compile input.st output.scb\n```\n\n### Hash\n\n```bash\nstrata-js hash input.st\nstrata-js hash input.scb\n```\n\nBehavior:\n\n- `.st` is parsed and canonically encoded first\n- `.scb` bytes are hashed directly\n- Output is lowercase hex\n\n### Decode\n\n```bash\nstrata-js decode input.scb\n```\n\n### Format\n\n```bash\nstrata-js fmt input.st\nstrata-js fmt input.scb\n```\n\nFormat options:\n\n```bash\nstrata-js fmt --format pretty input.st\nstrata-js fmt --format ast input.st\n```\n\n### Exit codes\n\n- `0` success\n- `1` invalid input\n- `2` I/O failure\n- `100` internal error\n\n---\n\n## Golden vectors\n\nCorrectness is enforced using **golden vectors** shared with the Rust implementation.\n\nGolden vectors are law:\n\n- If this package disagrees with vectors, **this package is wrong**\n- Vectors are not adjusted to match buggy behavior\n\n---\n\n## What Strata does NOT do\n\nStrata intentionally does not provide:\n\n- Schemas or validation rules\n- Optional fields or defaults\n- Backward-compatible schema evolution\n- Floating point numbers\n- Streaming or framing rules\n- Compression, encryption, or authentication\n\n---\n\n## Documentation\n\nCanonical integration documentation lives in the **Integration Reference**:\n\nhttps://strata.emagjby.com/docs\n\nThis is the **single source of truth** for integrators.\n\n---\n\n## Links\n\n- Documentation: https://strata.emagjby.com/docs\n- Monorepo: https://github.com/Emagjby/Strata\n- JS source: https://github.com/Emagjby/Strata/tree/main/strata-js\n\n---\n\n## License\n\nMIT License\n\n---\n\n## Final note\n\nThis package is intentionally strict.\n\nIf convenience matters more than correctness, use something else.  \nIf correctness matters, this is the JavaScript implementation.\n","readmeFilename":"README.md"}