{"_id":"@alphablue/content-client","_rev":"4-19c54b4bc819ffe1f71c0e684bdf9d04","name":"@alphablue/content-client","dist-tags":{"latest":"0.3.1"},"versions":{"0.1.0":{"name":"@alphablue/content-client","version":"0.1.0","license":"MIT","_id":"@alphablue/content-client@0.1.0","maintainers":[{"name":"lukesproxy","email":"luke@soft.pw"}],"//":"publishConfig rewrites the entry points at publish time (pnpm applies these). In the workspace the package resolves to TypeScript source; what ships is the compiled dist. Same arrangement as @alphablue/site-runtime.","dist":{"shasum":"266a1ca9ff8414196ce0fccb7d0167925d3a6b94","tarball":"https://registry.npmjs.org/@alphablue/content-client/-/content-client-0.1.0.tgz","fileCount":4,"integrity":"sha512-nNBmItssY4Ap9KCGT0UezOm6x9RbY6l/FPr9S6LYI69xsUPtd2kgvaGjrjmg+uxE4GguJZpd0u6WwB4OkwTlgQ==","signatures":[{"sig":"MEQCIG5UeRFLLHeApy5VOFrXbxsNQgXV6cUqxPlTyB8io6c8AiBeYNYwPGpcnl4+JvP85hSHy4pseLUNuMj4ZVXwwq3k1g==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":13706},"main":"./dist/index.js","type":"module","_from":"file:/var/folders/x9/t0h3hmd52hq13mvw9drwtz500000gn/T/tmp.YnJ3ULFBgx/alphablue-content-client-0.1.0.tgz","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"scripts":{"test":"vitest run","build":"tsc -p tsconfig.build.json","typecheck":"tsc --noEmit"},"_npmUser":{"name":"lukesproxy","email":"luke@soft.pw"},"_resolved":"/var/folders/x9/t0h3hmd52hq13mvw9drwtz500000gn/T/tmp.YnJ3ULFBgx/alphablue-content-client-0.1.0.tgz","_integrity":"sha512-nNBmItssY4Ap9KCGT0UezOm6x9RbY6l/FPr9S6LYI69xsUPtd2kgvaGjrjmg+uxE4GguJZpd0u6WwB4OkwTlgQ==","_npmVersion":"10.9.4","description":"Framework-agnostic client for the AlphaBlue content-api (published content + live state).","directories":{},"_nodeVersion":"22.21.1","dependencies":{"@alphablue/content-model":"0.1.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.1.10","typescript":"^5.6.0"},"_npmOperationalInternal":{"tmp":"tmp/content-client_0.1.0_1785597689727_0.4756283364688898","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@alphablue/content-client","version":"0.2.0","license":"MIT","_id":"@alphablue/content-client@0.2.0","maintainers":[{"name":"lukesproxy","email":"luke@soft.pw"}],"//":"publishConfig rewrites the entry points at publish time (pnpm applies these). In the workspace the package resolves to TypeScript source; what ships is the compiled dist. Same arrangement as @alphablue/site-runtime.","dist":{"shasum":"3407675f31c30b37e0f62b335902a2002179718c","tarball":"https://registry.npmjs.org/@alphablue/content-client/-/content-client-0.2.0.tgz","fileCount":4,"integrity":"sha512-eNa7y/BLbbdcyGptqa1F3H8HCLlagDsRdC4ZBtC+r/cobFLghijeQlS4MQp92pigPPrC5lmduAW7nYYe+FrynA==","signatures":[{"sig":"MEUCIQDt1AXVZajEMpl2y0uEXH5jhxsygUZ9L4QmSaWe2VMQQAIgEn1c/tJMs41SLebfn5SXUVc5G0mAM19hmI/mRZXtWng=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":16404},"main":"./dist/index.js","type":"module","_from":"file:alphablue-content-client-0.2.0.tgz","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"scripts":{"test":"vitest run","build":"tsc -p tsconfig.build.json","typecheck":"tsc --noEmit"},"_npmUser":{"name":"lukesproxy","email":"luke@soft.pw"},"_resolved":"/private/var/folders/x9/t0h3hmd52hq13mvw9drwtz500000gn/T/abd943989f9a4a833bb8901d38ee4863/alphablue-content-client-0.2.0.tgz","_integrity":"sha512-eNa7y/BLbbdcyGptqa1F3H8HCLlagDsRdC4ZBtC+r/cobFLghijeQlS4MQp92pigPPrC5lmduAW7nYYe+FrynA==","_npmVersion":"11.12.1","description":"Framework-agnostic client for the AlphaBlue content-api (published content + live state).","directories":{},"_nodeVersion":"26.0.0","dependencies":{"@alphablue/content-model":"^0.1.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.1.10","typescript":"^5.6.0"},"_npmOperationalInternal":{"tmp":"tmp/content-client_0.2.0_1787235627818_0.111460112574427","host":"s3://npm-registry-packages-npm-production"}},"0.3.0":{"name":"@alphablue/content-client","version":"0.3.0","license":"MIT","_id":"@alphablue/content-client@0.3.0","maintainers":[{"name":"lukesproxy","email":"luke@soft.pw"}],"//":"publishConfig rewrites the entry points at publish time (pnpm applies these). In the workspace the package resolves to TypeScript source; what ships is the compiled dist. Same arrangement as @alphablue/site-runtime.","dist":{"shasum":"fc9f3a17be814ab19869491fe26b9d449fc89418","tarball":"https://registry.npmjs.org/@alphablue/content-client/-/content-client-0.3.0.tgz","fileCount":4,"integrity":"sha512-aspjEgBwrqZ+7O7JHio5TFLplVb+qDHPJKr90T5+2O1RtUNxCBE7ITf4AFZFJh/0QQNgOk5pzfTc9QaQd0w9NQ==","signatures":[{"sig":"MEQCIHF3GDQUIv0MuStd+ikpQYmgXAlwsHTuguMC/vSRo/63AiBF9y2CzEc4v2d+WvFcIjNF0WGSNL3Ol4b/4kRKyr3jFg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEUCIQDToZrRHuU3dT1zayrl+eM58w07hWb8PNXwxggmAqYXwAIgU1LzhkSbZgbuvdwz311W1H5V0I4cF6gWlPsYkCKgvUE=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":19097},"type":"module","exports":{".":"./src/index.ts"},"gitHead":"9784ce28fd34a080fd6faa5d84fb085bfb2a7c4f","scripts":{"test":"vitest run","build":"tsc -p tsconfig.build.json","typecheck":"tsc --noEmit"},"_npmUser":{"name":"lukesproxy","email":"luke@soft.pw"},"_npmVersion":"11.12.1","description":"Framework-agnostic client for the AlphaBlue content-api (published content + live state).","directories":{},"_nodeVersion":"26.0.0","dependencies":{"@alphablue/content-model":"workspace:^"},"publishConfig":{"main":"./dist/index.js","types":"./dist/index.d.ts","access":"public","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}}},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.1.10","typescript":"^5.6.0"},"_npmOperationalInternal":{"tmp":"tmp/content-client_0.3.0_1787641056515_0.5993285971486488","host":"s3://npm-registry-packages-npm-production"}},"0.3.1":{"//":"publishConfig rewrites the entry points at publish time (pnpm applies these). In the workspace the package resolves to TypeScript source; what ships is the compiled dist. Same arrangement as @alphablue/site-runtime.","_id":"@alphablue/content-client@0.3.1","dist":{"shasum":"1d25582503e555332d0dfd8c8c9ab3f28057afbb","tarball":"https://registry.npmjs.org/@alphablue/content-client/-/content-client-0.3.1.tgz","fileCount":4,"integrity":"sha512-VqqoEop2DHYT7Z09heqPmcjNqUMsAQkesq9Fu53aQmPVQSK5fGAc6bC1xuip/ouIOTlWlXlR3Fk4ZJRlLpyzGQ==","signatures":[{"sig":"MEUCIQDf4Ol8y2G1woF53aV7Uoeby/m7BYffL5g1P0uEeC/2SQIgLFpBZ9WLe6Jbwu/YdY923kSayNpBrhm4uSaSIZisdeA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDlHj6vpfvi+TrkL1uM/y+7eto7sXBat/A25wZR/z46SgIhAKqthPDhsLsSAjJY7x7niQSMlD1a9gVzngi4HcSGFIwg"}],"unpackedSize":19041},"main":"./dist/index.js","name":"@alphablue/content-client","type":"module","_from":"file:/tmp/alphablue-npm-remediation.ZV630E/alphablue-content-client-0.3.1.tgz","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"license":"MIT","scripts":{"test":"vitest run","build":"tsc -p tsconfig.build.json","typecheck":"tsc --noEmit"},"version":"0.3.1","_npmUser":{"name":"lukesproxy","email":"luke@soft.pw"},"_resolved":"/tmp/alphablue-npm-remediation.ZV630E/alphablue-content-client-0.3.1.tgz","_integrity":"sha512-VqqoEop2DHYT7Z09heqPmcjNqUMsAQkesq9Fu53aQmPVQSK5fGAc6bC1xuip/ouIOTlWlXlR3Fk4ZJRlLpyzGQ==","_npmVersion":"10.9.4","description":"Framework-agnostic client for the AlphaBlue content-api (published content + live state).","directories":{},"maintainers":[{"name":"lukesproxy","email":"luke@soft.pw"}],"_nodeVersion":"22.21.1","dependencies":{"@alphablue/content-model":"^0.2.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.1.10","typescript":"^5.6.0"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/content-client_0.3.1_1787641266303_0.40463048040570415"}}},"time":{"created":"2026-08-01T15:21:29.514Z","modified":"2026-08-25T07:01:06.643Z","0.1.0":"2026-08-01T15:21:29.900Z","0.2.0":"2026-08-20T14:20:27.949Z","0.3.0":"2026-08-25T06:57:36.600Z","0.3.1":"2026-08-25T07:01:06.385Z"},"license":"MIT","description":"Framework-agnostic client for the AlphaBlue content-api (published content + live state).","maintainers":[{"name":"lukesproxy","email":"luke@soft.pw"}],"readme":"# @alphablue/content-client\n\nA tiny, framework-agnostic client for the AlphaBlue **content-api** — the public\nread API every customer site consumes. One client, used from every layer:\n\n- **build time** (Astro frontmatter / Node) — the SSG data source;\n- **the browser** (React islands) — runtime, for dynamic modules;\n- **a Worker** — pass a bound `fetch`.\n\nIt has no dependencies and ships types that mirror content-api's JSON exactly\n(snake_case; translatable fields as `{ value, resolved_locale }`).\n\n## Usage\n\n```ts\nimport { createContentClient, val, money } from \"@alphablue/content-client\";\n\nconst client = createContentClient({\n  baseUrl: \"https://content.alphablueth.com\",\n  siteId: \"0195da70-0000-7000-8000-000000000001\",\n});\n\n// Channel A — the aggregate a build wants in one consistent read.\nconst content = await client.content({ locale: \"en\" });\ncontent.meta && val(content.meta.business_name); // \"Content API Demo Cafe\"\ncontent.catalog.map((i) => `${val(i.name)} — ${money(i.price)}`);\ncontent.faqs.map((faq) => [faq.question, faq.answer]);\n\n// Channel A — continue an immutable feed page with its returned cursor.\nconst firstPosts = await client.posts({ limit: 50 });\nconst older = firstPosts.next_before\n  ? await client.posts({ before: firstPosts.next_before, limit: 50 })\n  : null;\n\n// Channel B — live state (short TTL). Runtime only.\nconst live = await client.live({ cache: \"no-store\" });\n\n// Published Articles — build revision bypasses a stale CDN object after publish.\nconst articles = await client.articles({\n  locale: \"en\",\n  buildRevision: \"deploy-42\",\n});\nconst article = await client.article(articles.articles[0].slug, {\n  locale: \"en\",\n  buildRevision: \"deploy-42\",\n});\n```\n\n### Two channels, one contract\n\n| Method                     | Channel        | Use                                                         |\n| -------------------------- | -------------- | ----------------------------------------------------------- |\n| `content()`                | A (published)  | build-time SSG **and** runtime islands                      |\n| `posts()`                  | A (published)  | paginating the feed                                         |\n| `live()`                   | B (live state) | runtime only — grayscale, announcement, availability        |\n| `articles()` / `article()` | A (published)  | Article list/detail for static routes, SEO, sitemap and RSS |\n\nPublish-type content (`content()`) baked at build needs a rebuild to change;\nthat is the pipeline in\n[publish-rebuild-pipeline.md](../../docs/04-products-components/website-portal/publish-rebuild-pipeline.md).\nFetched from an island instead, it updates on refresh. Live state (`live()`) is\nruntime by design.\n\n## API\n\n- `createContentClient({ baseUrl, siteId, fetch? })` → `{ content, posts, live, articles, article }`\n- `val(text)` — resolve a `{ value, resolved_locale }` field to its string\n- `money(price, { enquireLabel?, fromPrefix? })` — format satang without float math\n- `ContentApiError` — thrown on any non-2xx (`.status`, `.path`)\n\nPublished methods take `{ locale?, signal?, cache?, buildRevision? }`.\n`posts()`、`articles()`、`catalog()` 与 FAQ methods 接受 cursor paging (`before`, `limit`)；\n`before` 必须使用同一 response 的 `next_before`／`next_cursor`，因为它是绑定 published\nrevision、surface、locale 与 filter 的 opaque cursor。`live()`\nonly accepts runtime fetch controls (`signal`, `cache`). Astro customer sites\nshould consume this package through `@alphablue/astro-site/content` rather than\nadding a second direct AlphaBlue dependency.\n","readmeFilename":"README.md"}