{"_id":"@a21-lexicon/lexicon-client","name":"@a21-lexicon/lexicon-client","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@a21-lexicon/lexicon-client","version":"1.0.0","description":"Node/TypeScript client for Lexicon: pull translation JSON exports and integration API SDK.","license":"MIT","type":"module","main":"./dist/index.cjs","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"bin":{"lexicon":"bin/lexicon.js"},"scripts":{"build":"tsup","prepublishOnly":"npm run build","test":"vitest run","test:watch":"vitest","typecheck":"tsc --noEmit"},"keywords":["lexicon","translation","i18n","localization","a21"],"repository":{"type":"git","url":"git+https://github.com/A21-Center/lexicon-client-js.git"},"homepage":"https://github.com/A21-Center/lexicon-client-js#readme","bugs":{"url":"https://github.com/A21-Center/lexicon-client-js/issues"},"publishConfig":{"access":"public"},"engines":{"node":">=18"},"dependencies":{"commander":"^13.1.0"},"devDependencies":{"@types/node":"^22.13.10","tsup":"^8.4.0","typescript":"^5.8.2","vitest":"^3.0.9"},"_id":"@a21-lexicon/lexicon-client@1.0.0","gitHead":"0a95310eee8fb6302d7e1ce244997e7ae809e216","_nodeVersion":"22.15.1","_npmVersion":"10.9.2","dist":{"integrity":"sha512-IdYqcpHpytYX3xe10pBHwdDymYNZ9JEnauIP7uT8z9rj9q4mFGIvMHeJo1Tac3vkb7uPHqFY3clAGF5Q8sX0Dw==","shasum":"0bc8a8fc2213985fb4f76443c409ba909184b6de","tarball":"https://registry.npmjs.org/@a21-lexicon/lexicon-client/-/lexicon-client-1.0.0.tgz","fileCount":18,"unpackedSize":204973,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCcpUUjAiGORwxWbMKqBQV3i0lGh85MlW698rQX2nOTsQIgL0Jpy6wsWbojw9rnaP2gE4r8Wi7Ct/QpdQramBAZQZE="}]},"_npmUser":{"name":"mohameedyamini","email":"mohammedyaminipro@gmail.com"},"directories":{},"maintainers":[{"name":"mohameedyamini","email":"mohammedyaminipro@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/lexicon-client_1.0.0_1783195010727_0.4843708797835613"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-04T19:56:50.489Z","1.0.0":"2026-07-04T19:56:50.855Z","modified":"2026-07-04T19:56:51.125Z"},"maintainers":[{"name":"mohameedyamini","email":"mohammedyaminipro@gmail.com"}],"description":"Node/TypeScript client for Lexicon: pull translation JSON exports and integration API SDK.","homepage":"https://github.com/A21-Center/lexicon-client-js#readme","keywords":["lexicon","translation","i18n","localization","a21"],"repository":{"type":"git","url":"git+https://github.com/A21-Center/lexicon-client-js.git"},"bugs":{"url":"https://github.com/A21-Center/lexicon-client-js/issues"},"license":"MIT","readme":"# @a21-lexicon/lexicon-client\r\n\r\nNode/TypeScript client for **Lexicon** — pull translation JSON exports from a central Lexicon server and call the integration API from your backend.\r\n\r\n## Requirements\r\n\r\n- Node.js 18+\r\n\r\n## Install\r\n\r\n```bash\r\nnpm install @a21-lexicon/lexicon-client\r\n# or as devDependency for front-only CI pull\r\nnpm install -D @a21-lexicon/lexicon-client\r\n```\r\n\r\n## Configuration\r\n\r\nAdd to `.env` (never commit real secrets):\r\n\r\n```env\r\nLEXICON_API_URL=https://lexicon.a21.com\r\nLEXICON_CLIENT_CODE=hub\r\nLEXICON_PROJECT_CODE=hub\r\nLEXICON_CLIENT_SECRET=lex_sk_live_xxxxxxxx\r\nLEXICON_ENVIRONMENT=production\r\n```\r\n\r\nOptional manifest at project root: `lexicon.json` (no secret in this file).\r\n\r\n```bash\r\nnpx lexicon init\r\n```\r\n\r\n## Commands\r\n\r\n| Command | Description |\r\n|---------|-------------|\r\n| `npx lexicon init` | Create `lexicon.json` + append `.env.example` |\r\n| `npx lexicon status` | Check server connection and project metadata |\r\n| `npx lexicon export` | Request export bundle from server |\r\n| `npx lexicon pull` | Export + write JSON files locally |\r\n\r\nExamples:\r\n\r\n```bash\r\nnpx lexicon status\r\nnpx lexicon pull --all\r\nnpx lexicon pull --lang=fr --area=catalog --only-approved --dry-run\r\n```\r\n\r\n## SDK usage\r\n\r\n```ts\r\nimport { LexiconHttpClient, loadConfig } from '@a21-lexicon/lexicon-client';\r\n\r\nconst client = new LexiconHttpClient(loadConfig());\r\n\r\nconst status = await client.status();\r\nconst bundle = await client.export({\r\n  project_code: 'hub',\r\n  languages: ['fr'],\r\n  areas: ['catalog'],\r\n  only_approved: true,\r\n});\r\n\r\nconst translate = await client.translate({\r\n  project_code: 'hub',\r\n  area_code: 'classifications',\r\n  application: 'hub',\r\n  module: 'classifications',\r\n  entity_type: 'category',\r\n  entity_id: '123',\r\n  field_name: 'title',\r\n  source_text: 'الرسم',\r\n});\r\n```\r\n\r\n## Security\r\n\r\n- Keep `LEXICON_CLIENT_SECRET` server-side only (`.env`, CI secrets, API routes).\r\n- Never expose the secret to the browser or `VITE_*` / `NEXT_PUBLIC_*` env vars.\r\n- Rotate or revoke clients from the Lexicon admin API when compromised.\r\n\r\n## Documentation\r\n\r\nSee the Lexicon server docs:\r\n\r\n- `docs/client-package-js.md` — usage (Mode A front-only, Mode B fullstack)\r\n- `docs/publish-npm.md` — publish on npm registry\r\n- `docs/client-package.md` — PHP Laravel package\r\n- `docs/integration-api.md` — Integration API contract\r\n\r\n## Examples\r\n\r\n- `examples/front-only-vite/` — CI pull + static JSON (no backend)\r\n- `examples/nextjs-fullstack/` — API route proxy + SDK\r\n\r\n## License\r\n\r\nMIT\r\n","readmeFilename":"README.md","_rev":"1-c5521fd9c6864a3b1c731800a92e3dbd"}