{"_id":"@brandfine/client-astro","name":"@brandfine/client-astro","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@brandfine/client-astro","version":"0.1.0","description":"Astro adapter for @brandfine/client — APIRoute-shaped webhook handler and env helpers.","license":"MIT","type":"module","sideEffects":false,"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"}}},"scripts":{"build":"tsup","dev":"tsup --watch","typecheck":"tsc --noEmit","test":"vitest run","test:watch":"vitest","lint:pkg":"publint","lint:types":"attw --pack --profile node16","validate":"npm run build && npm run typecheck && npm run test && npm run lint:pkg && npm run lint:types","prepublishOnly":"npm run build && npm run lint:pkg"},"engines":{"node":">=20"},"dependencies":{"@brandfine/client":"*"},"peerDependencies":{"astro":">=4.0.0"},"peerDependenciesMeta":{"astro":{"optional":false}},"devDependencies":{"@arethetypeswrong/cli":"0.18.2","astro":"^6.1.8","publint":"0.3.20","tsup":"^8.3.0","typescript":"^6.0.0","vitest":"^2.1.1"},"publishConfig":{"access":"public"},"gitHead":"0fa23887ba7d892e87b3392c3aadfacbc76c1e11","_id":"@brandfine/client-astro@0.1.0","_nodeVersion":"24.12.0","_npmVersion":"11.6.2","dist":{"integrity":"sha512-BVDDtJW5Egc1hZDfWE0sr/PgWmjyTu3TP1SaMS3Z2VN5PNO1sgKT9niforryxiOevTBmBHQ9FOExwROkCTiabw==","shasum":"1b918665eae723a2630923031f4be98a949f3647","tarball":"https://registry.npmjs.org/@brandfine/client-astro/-/client-astro-0.1.0.tgz","fileCount":9,"unpackedSize":21374,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIHsWVlwMomNihFpBzSgVWhCvHbT25GXHQnbh56qB2u9CAiEAwg9JVTY3tOZ45arWJ+zRGr+ek687+OsjA5T4098Wf0A="}]},"_npmUser":{"name":"yigidev","email":"eyupyigitdilber@gmail.com"},"directories":{},"maintainers":[{"name":"yigidev","email":"eyupyigitdilber@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/client-astro_0.1.0_1778651607383_0.2316328340902971"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-13T05:53:27.319Z","0.1.0":"2026-05-13T05:53:27.534Z","modified":"2026-05-13T05:53:27.710Z"},"maintainers":[{"name":"yigidev","email":"eyupyigitdilber@gmail.com"}],"description":"Astro adapter for @brandfine/client — APIRoute-shaped webhook handler and env helpers.","license":"MIT","readme":"# @brandfine/client-astro\n\nAstro adapter for [@brandfine/client](https://www.npmjs.com/package/@brandfine/client). Two thin helpers:\n\n- **`createBrandfineWebhookRoute`** — wraps the framework-agnostic webhook handler in Astro's `APIRoute` shape.\n- **`readBrandfineEnv`** — reads `BRANDFINE_API_URL`, `BRANDFINE_API_KEY`, and `BRANDFINE_WEBHOOK_SECRET` from Vite's `import.meta.env` with a `process.env` fallback.\n\n> **Status:** early development (`0.x.y`). API may change in minor bumps before `1.0`.\n\nThe actual SDK (client, caches, resolvers) lives in [`@brandfine/client`](https://www.npmjs.com/package/@brandfine/client) and is framework-agnostic. Install both:\n\n```sh\nnpm install @brandfine/client @brandfine/client-astro\n```\n\n## Webhook route\n\n```ts\n// src/pages/api/brandfine-webhook.ts\nimport { createBrandfineWebhookRoute, readBrandfineEnv } from '@brandfine/client-astro'\nimport { postsCache, navigationsCache, workspaceCache } from '@/lib/bf'\n\nexport const prerender = false\n\nexport const POST = createBrandfineWebhookRoute({\n  secret: readBrandfineEnv().webhookSecret,\n  onEvent: ({ event, key }) => {\n    postsCache.invalidate()\n    workspaceCache.invalidate()\n    if (event.startsWith('navigation.')) navigationsCache.invalidate(key ?? undefined)\n  },\n})\n```\n\n## Client construction\n\n```ts\n// src/lib/bf.ts\nimport { createBrandfineClient } from '@brandfine/client'\nimport { readBrandfineEnv } from '@brandfine/client-astro'\n\nconst env = readBrandfineEnv()\nexport const bf = createBrandfineClient({\n  baseUrl: env.apiUrl,\n  apiKey: env.apiKey,\n  // Optional: locales, defaultLocale, fetch\n})\n```\n\n## Peer requirements\n\n- `astro` >= 4.0.0 (uses the modern `APIRoute` shape with `Request`)\n- `@brandfine/client` (workspace dep — installed automatically)\n\n## License\n\nMIT\n","readmeFilename":"README.md","_rev":"1-01ffedc142812a41453b025160fb0ef0"}