{"_id":"@anmollabs/dynamically-client","name":"@anmollabs/dynamically-client","dist-tags":{"latest":"0.0.1"},"versions":{"0.0.1":{"name":"@anmollabs/dynamically-client","version":"0.0.1","description":"Framework-agnostic TypeScript SDK for the Dynamically headless content API. Includes a Next.js helper.","license":"MIT","type":"module","keywords":["cms","headless-cms","content","dynamically","next.js","sdk"],"homepage":"https://github.com/Anmol1377/dynamically#readme","bugs":{"url":"https://github.com/Anmol1377/dynamically/issues"},"repository":{"type":"git","url":"git+https://github.com/Anmol1377/dynamically.git","directory":"packages/client"},"engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"},"./next":{"types":"./dist/next.d.ts","import":"./dist/next.js","require":"./dist/next.cjs"}},"devDependencies":{"@types/node":"^20.16.13","tsup":"^8.3.0","typescript":"^5.6.3"},"publishConfig":{"access":"public"},"scripts":{"build":"tsup"},"main":"./dist/index.cjs","module":"./dist/index.js","types":"./dist/index.d.ts","_id":"@anmollabs/dynamically-client@0.0.1","_integrity":"sha512-u79NDsDxbC0/8wFyP2xVYCgpvm37w4Ewsoli1Qq3CeJf8oVzBY+y2GfyUxzBHhQTuPej3V8JhQgpNMkF5npdfQ==","_resolved":"/private/var/folders/y1/z9k418293blffpn0j_yp4jh80000gn/T/7dffad6e4e791500538df579d31ba341/anmollabs-dynamically-client-0.0.1.tgz","_from":"file:anmollabs-dynamically-client-0.0.1.tgz","_nodeVersion":"22.22.0","_npmVersion":"10.9.4","dist":{"integrity":"sha512-u79NDsDxbC0/8wFyP2xVYCgpvm37w4Ewsoli1Qq3CeJf8oVzBY+y2GfyUxzBHhQTuPej3V8JhQgpNMkF5npdfQ==","shasum":"01ec4ea3034d276b6e711bdda62ef56114b229d6","tarball":"https://registry.npmjs.org/@anmollabs/dynamically-client/-/dynamically-client-0.0.1.tgz","fileCount":18,"unpackedSize":45490,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDAgpH15r2bymjFQ0eXG1Jn1pCkfxQwHDouo7qR6dFS6QIhAKvMFr6ekz9gboH6tLInr1TEF33oPXO1xhx4Hm7+aKI7"}]},"_npmUser":{"name":"anmol1377","email":"anmolkumar3634@gmail.com"},"directories":{},"maintainers":[{"name":"anmol1377","email":"anmolkumar3634@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/dynamically-client_0.0.1_1777529225755_0.6159963899147138"},"_hasShrinkwrap":false}},"time":{"created":"2026-04-30T06:07:05.608Z","0.0.1":"2026-04-30T06:07:05.920Z","modified":"2026-04-30T06:07:06.182Z"},"maintainers":[{"name":"anmol1377","email":"anmolkumar3634@gmail.com"}],"description":"Framework-agnostic TypeScript SDK for the Dynamically headless content API. Includes a Next.js helper.","homepage":"https://github.com/Anmol1377/dynamically#readme","keywords":["cms","headless-cms","content","dynamically","next.js","sdk"],"repository":{"type":"git","url":"git+https://github.com/Anmol1377/dynamically.git","directory":"packages/client"},"bugs":{"url":"https://github.com/Anmol1377/dynamically/issues"},"license":"MIT","readme":"# @anmollabs/dynamically-client\n\nFramework-agnostic client SDK for the [Dynamically](https://github.com/Anmol1377/dynamically) content API.\n\n## Install\n\n```bash\npnpm add @anmollabs/dynamically-client\n```\n\n## Usage\n\n### Plain JS / Node\n\n```ts\nimport { createClient } from '@anmollabs/dynamically-client';\n\nconst client = createClient({\n  baseUrl: 'http://localhost:3030',\n  apiKey: 'dyn_pub_…',\n});\n\nconst home = await client.getPage('home');\nconsole.log(home.sections.hero.headline);\n```\n\n### Next.js (App Router)\n\n```ts\n// app/page.tsx\nimport { dynamicallyForNext } from '@anmollabs/dynamically-client/next';\n\nexport default async function HomePage() {\n  const client = dynamicallyForNext();\n  const home = await client.getPage('home');\n\n  return (\n    <main>\n      <h1>{home.sections.hero.headline as string}</h1>\n    </main>\n  );\n}\n```\n\nSet in `.env.local`:\n\n```\nDYNAMICALLY_URL=http://localhost:3030\nDYNAMICALLY_API_KEY=dyn_pub_…\n```\n\n### Typed sections\n\nProvide your own type for the `sections` object:\n\n```ts\ntype HomeSections = {\n  hero: { headline: string; subheadline: string };\n};\n\nconst home = await client.getPage<HomeSections>('home');\nhome.sections.hero.headline; // string\n```\n\n### Preview / draft content\n\n```ts\nconst client = createClient({\n  baseUrl: '…',\n  apiKey: 'dyn_prv_…',  // preview-scope key\n  preview: true,\n});\n```\n\n## API\n\n### `createClient(options): DynamicallyClient`\n\nOptions:\n- `baseUrl` (required) — your Dynamically instance URL.\n- `apiKey` — Bearer token. Optional when the instance has anonymous public reads enabled.\n- `preview` — fetch draft content instead of published. Requires a preview-scope key.\n- `next.revalidate` — Next.js ISR window in seconds. Defaults to `60`.\n\n### `client.getPages(): Promise<PageSummary[]>`\n\nLists all published pages.\n\n### `client.getPage<T>(slug): Promise<PageContent<T>>`\n\nReturns the full content tree for one page.\n\n## Errors\n\nFailed requests throw `DynamicallyApiError` with `.status` and `.code`.\n","readmeFilename":"README.md","_rev":"1-d5e01036908eb198a5625081da323543"}