{"_id":"@dcsv-io/d2-i18n-abstractions","_rev":"2-5cb6825c80b50e6615303415d8717d0b","name":"@dcsv-io/d2-i18n-abstractions","dist-tags":{"latest":"0.1.2"},"versions":{"0.1.1":{"name":"@dcsv-io/d2-i18n-abstractions","version":"0.1.1","_id":"@dcsv-io/d2-i18n-abstractions@0.1.1","maintainers":[{"name":"dcsv-tristan","email":"tristan@dcsv.io"}],"dist":{"shasum":"670f4c9b17da1daa1a64105bcf9d7cd28c0ceb28","tarball":"https://registry.npmjs.org/@dcsv-io/d2-i18n-abstractions/-/d2-i18n-abstractions-0.1.1.tgz","fileCount":15,"integrity":"sha512-nX1+8GZ3ZqV+d611zd01d1ej33MW8rZ8D4/PbZ3JkTA/Vk+NMkqTVQG5oWUCyono0BAIlesTpaa43BNB5+7dgw==","signatures":[{"sig":"MEYCIQCB372c3QV+CFhT906Vl5YfyjW2yn6czCbxBgP+zFqZUQIhAO5gdk0Ts9+PJXSwUmx1K77TH1YOsAuEApeMCZUQyQDS","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":20927},"main":"./dist/index.js","type":"module","_from":"file:bundle/npm/dcsv-io-d2-i18n-abstractions-0.1.1.tgz","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"test":"vitest run","build":"tsc -b","test:coverage":"vitest run --coverage","type-check:test":"tsc -p tsconfig.test.json"},"_npmUser":{"name":"dcsv-tristan","email":"tristan@dcsv.io"},"_resolved":"/home/runner/work/D2-Public/D2-Public/bundle/npm/dcsv-io-d2-i18n-abstractions-0.1.1.tgz","_integrity":"sha512-nX1+8GZ3ZqV+d611zd01d1ej33MW8rZ8D4/PbZ3JkTA/Vk+NMkqTVQG5oWUCyono0BAIlesTpaa43BNB5+7dgw==","_npmVersion":"11.16.0","description":"<!-- Copyright (c) DCSV. Licensed under the Apache License, Version 2.0. -->","directories":{},"_nodeVersion":"24.18.0","_hasShrinkwrap":false,"devDependencies":{"vitest":"4.0.18","typescript":"5.9.3","@vitest/coverage-v8":"4.0.18"},"_npmOperationalInternal":{"tmp":"tmp/d2-i18n-abstractions_0.1.1_1784262835452_0.5720325865224953","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@dcsv-io/d2-i18n-abstractions","version":"0.1.2","type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"devDependencies":{"@vitest/coverage-v8":"4.0.18","typescript":"5.9.3","vitest":"4.0.18"},"scripts":{"build":"tsc -b","test":"vitest run","test:coverage":"vitest run --coverage","type-check:test":"tsc -p tsconfig.test.json"},"_id":"@dcsv-io/d2-i18n-abstractions@0.1.2","description":"<!-- Copyright (c) DCSV. Licensed under the Apache License, Version 2.0. -->","_integrity":"sha512-4jQmqUwNcOcqmwtENZJApKXlKdOIhaahzfCwOZ6Hby5qY71pTr1ou0LMo2O4Crsh8xlpuL9heda8O/qr7RFAUw==","_resolved":"/home/runner/work/D2-Public/D2-Public/bundle/npm/dcsv-io-d2-i18n-abstractions-0.1.2.tgz","_from":"file:bundle/npm/dcsv-io-d2-i18n-abstractions-0.1.2.tgz","_nodeVersion":"24.18.0","_npmVersion":"11.16.0","dist":{"integrity":"sha512-4jQmqUwNcOcqmwtENZJApKXlKdOIhaahzfCwOZ6Hby5qY71pTr1ou0LMo2O4Crsh8xlpuL9heda8O/qr7RFAUw==","shasum":"01a5e12665422cfa415e18bc721ab3581531dbb3","tarball":"https://registry.npmjs.org/@dcsv-io/d2-i18n-abstractions/-/d2-i18n-abstractions-0.1.2.tgz","fileCount":15,"unpackedSize":20941,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCl7OXkvm6a2me8yLHuFyNJgoSZWYe8j97Eady1XhDDfAIgO80q3+H6IP4jZwWAzzWi82tMFGXaNaPFuv2dcT9tV2A="}]},"_npmUser":{"name":"dcsv-tristan","email":"tristan@dcsv.io"},"directories":{},"maintainers":[{"name":"dcsv-tristan","email":"tristan@dcsv.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/d2-i18n-abstractions_0.1.2_1784286987192_0.21048346815974894"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-17T04:33:55.282Z","modified":"2026-07-17T11:16:27.551Z","0.1.1":"2026-07-17T04:33:55.584Z","0.1.2":"2026-07-17T11:16:27.383Z"},"description":"<!-- Copyright (c) DCSV. Licensed under the Apache License, Version 2.0. -->","maintainers":[{"name":"dcsv-tristan","email":"tristan@dcsv.io"}],"readme":"<!--\nCopyright (c) DCSV. Licensed under the Apache License, Version 2.0.\n-->\n\n# @dcsv-io/d2-i18n-abstractions\n\nFoundational, zero-dependency package that declares the i18n primitive types:\nthe `TKMessage` translation-message shape, the `tk()` factory that constructs\none, and the spec-derived `TkMessageWireShape` property-name catalog. Mirrors\n`DcsvIo.D2.I18n.Abstractions` on the .NET side — a leaf package with no outbound\ndependencies, so any package in the graph can import these primitives without\nrisking a circular dependency.\n\n## Install\n\n```bash\npnpm add @dcsv-io/d2-i18n-abstractions\n```\n\n## Public API\n\n| Export               | Purpose                                                                                                                                           |\n| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `TKMessage`          | The translation-message shape — `{ key: string; params?: Record<string, unknown> }`. Carried by `D2Result.messages` and rendered by a translator. |\n| `tk`                 | Factory constructing a `TKMessage` from a key plus optional params. Mirrors the .NET `new TKMessage(key, params)` ergonomics.                     |\n| `TkMessageWireShape` | Spec-derived JSON property-name catalog (`KEY`, `PARAMS`) for the `TKMessage` wire shape — referenced by serializers instead of inline literals.  |\n\n`TkMessageWireShape` is auto-generated from `contracts/tk-message/tk-message.spec.json`\nfrom the tk-message spec (sources committed). Do not edit `src/generated/tk-message.g.ts` by hand —\nchanges will be overwritten on the next codegen run.\n\n## Dependencies\n\nNone. Zero runtime deps — this is a foundational leaf in the dependency graph.\n\n## Usage example\n\n```ts\nimport { tk, type TKMessage } from \"@dcsv-io/d2-i18n-abstractions\";\n\nconst message: TKMessage = tk(\"common_errors_NOT_FOUND\");\n// message === { key: \"common_errors_NOT_FOUND\" }\n\nconst withParams = tk(\"common_errors_LIMIT_EXCEEDED\", { maxLength: 256 });\n// withParams === { key: \"common_errors_LIMIT_EXCEEDED\", params: { maxLength: 256 } }\n```\n\n## Why a separate package\n\n`TKMessage` is the shared currency of the result + i18n surfaces: `@dcsv-io/d2-result`\ncarries `TKMessage[]` on every `D2Result`, `@dcsv-io/d2-i18n-keys` exposes the `TK`\nconstants as `TKMessage` instances, and `@dcsv-io/d2-i18n` renders them. Placing the\ntype and its factory in a zero-dependency leaf lets all three depend on it\nwithout forming a cycle, and keeps `@dcsv-io/d2-result` focused on the result envelope\nrather than owning an i18n primitive.\n\n## Parity with .NET\n\nMirrors `DcsvIo.D2.I18n.Abstractions` — both declare `TKMessage` plus the\nspec-derived wire-shape property names, generated from the same\n`contracts/tk-message/tk-message.spec.json` source. Single spec, two emitters,\ncross-language wire drift structurally impossible.\n","readmeFilename":"README.md"}