{"_id":"@act-spec/adapter-notion","name":"@act-spec/adapter-notion","dist-tags":{"rc":"0.2.0-rc.1","latest":"0.2.0-rc.1"},"versions":{"0.2.0-rc.1":{"name":"@act-spec/adapter-notion","version":"0.2.0-rc.1","description":"Notion adapter for ACT (Agent Content Tree). Consumes the Notion API (databases.query, pages.retrieve, blocks.children.list) and emits ACT envelopes against the shared adapter framework. Supports database-as-branch / page-as-leaf mapping, block-tree to pr","license":"Apache-2.0","author":{"name":"Jeremy Forsythe","email":"jeremy@act-spec.org"},"homepage":"https://act-spec.org","bugs":{"url":"https://github.com/act-spec/act/issues"},"type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/act-spec/act.git","directory":"packages/adapter-notion"},"dependencies":{"@act-spec/validator":"0.2.0-rc.1","@act-spec/core":"0.2.0-rc.1","@act-spec/adapter-framework":"0.2.0-rc.1"},"devDependencies":{"@vitest/coverage-v8":"^2.1.9","tsx":"^4.19.2","typescript":"^5.6.3","vitest":"^2.1.4"},"scripts":{"build":"tsc -p tsconfig.json","test":"vitest run","test:watch":"vitest","test:coverage":"vitest run --coverage","lint":"eslint src","typecheck":"tsc -p tsconfig.json --noEmit","conformance":"tsx conformance.ts"},"_id":"@act-spec/adapter-notion@0.2.0-rc.1","_integrity":"sha512-2oU1TMhqB7CX8LDtPnel+MwUp+3gf+3VhBAxJTiRbRQno+4Z3pFccYAtyIMGwC8nABqgktko5le0/aLtW5QZsg==","_resolved":"/private/var/folders/yp/y7frhcvj70jgr6b8g633lghr0000gn/T/7d17c21f87b83a7cc1fbf27c13df3ea5/act-spec-adapter-notion-0.2.0-rc.1.tgz","_from":"file:act-spec-adapter-notion-0.2.0-rc.1.tgz","_nodeVersion":"22.19.0","_npmVersion":"11.6.0","dist":{"integrity":"sha512-2oU1TMhqB7CX8LDtPnel+MwUp+3gf+3VhBAxJTiRbRQno+4Z3pFccYAtyIMGwC8nABqgktko5le0/aLtW5QZsg==","shasum":"e690b1f88c4636858ad4495149623445b08b54bd","tarball":"https://registry.npmjs.org/@act-spec/adapter-notion/-/adapter-notion-0.2.0-rc.1.tgz","fileCount":45,"unpackedSize":232036,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDSlTv59AF1Jd/rs8yjzbxKj2aVFJ3OZlDDTW0B35nICwIhAKv16u0kMxIIV5sle9R6ebx7yyyxmFmyjy+BG6ArWK8w"}]},"_npmUser":{"name":"jdforsythe","email":"jdforsythe@gmail.com"},"directories":{},"maintainers":[{"name":"jdforsythe","email":"jdforsythe@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/adapter-notion_0.2.0-rc.1_1777915290342_0.22732682214637756"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-04T17:21:30.264Z","0.2.0-rc.1":"2026-05-04T17:21:30.602Z","modified":"2026-05-04T17:21:30.871Z"},"maintainers":[{"name":"jdforsythe","email":"jdforsythe@gmail.com"}],"description":"Notion adapter for ACT (Agent Content Tree). Consumes the Notion API (databases.query, pages.retrieve, blocks.children.list) and emits ACT envelopes against the shared adapter framework. Supports database-as-branch / page-as-leaf mapping, block-tree to pr","homepage":"https://act-spec.org","repository":{"type":"git","url":"git+https://github.com/act-spec/act.git","directory":"packages/adapter-notion"},"author":{"name":"Jeremy Forsythe","email":"jeremy@act-spec.org"},"bugs":{"url":"https://github.com/act-spec/act/issues"},"license":"Apache-2.0","readme":"# @act-spec/adapter-notion\n\nNotion adapter for ACT (Agent Content Tree). Consumes the\n[Notion API](https://developers.notion.com) (`databases.query`,\n`pages.retrieve`, `blocks.children.list`) and emits ACT envelopes against the\nshared adapter framework (`@act-spec/adapter-framework`).\n\n- Database -> branch ACT node (`type: 'collection'` by default).\n- Page     -> leaf ACT node (`type: 'article'` by default).\n- Block tree -> ACT prose / code / callout / data blocks.\n- Per-page locale extraction from a configurable Notion property\n  (default: a `select` named `Locale`).\n\n## Install\n\n```bash\npnpm add @act-spec/adapter-notion\n```\n\nThe adapter has zero runtime dependencies outside the ACT workspace\npackages. HTTP traffic uses the global `fetch`.\n\n## Usage\n\n```ts\nimport { notionAdapter } from '@act-spec/adapter-notion';\nimport { runAdapter } from '@act-spec/adapter-framework';\n\nconst adapter = notionAdapter();\n\nawait runAdapter(\n  adapter,\n  {\n    accessToken: { from_env: 'NOTION_TOKEN' },\n    databaseId: 'abcd1234abcd1234abcd1234abcd1234',\n    properties: { tags: 'Tags' },\n    locale: { property: 'Locale', default: 'en-US' },\n  },\n  ctx, // your AdapterContext\n);\n```\n\nTo run against recorded API responses (tests, deterministic CI):\n\n```ts\nimport { notionAdapter, corpusProvider } from '@act-spec/adapter-notion';\n\nconst adapter = notionAdapter({ corpus: { database, pages, pageBlocks } });\n```\n\n## Notion API version\n\nPinned to `Notion-Version: 2022-06-28` (Notion's current stable as of this\nrelease). Override via `notionApiVersion` in the config when Notion ships a\nnewer stable that you want to opt in to.\n\n## Authentication\n\nPass a Notion integration token via:\n\n- `accessToken: { from_env: 'NOTION_TOKEN' }` — preferred; the adapter reads\n  the env var at `init()` time.\n- `accessToken: '<raw token>'` — accepted but logged with a warning.\n\nThe token is sent as `Authorization: Bearer <token>` on every request.\n\nThe integration must be invited to the database (Notion Settings ->\nConnections -> Add) or the API returns `404` and the adapter throws\n`NotionAdapterError({ code: 'database_not_found' })`.\n\n## Block-type coverage\n\n| Notion block type          | ACT block                                |\n| -------------------------- | ---------------------------------------- |\n| `paragraph`                | `prose` (`format: 'plain'`)              |\n| `heading_1` / `_2` / `_3`  | `prose` with `level: 1 / 2 / 3`          |\n| `bulleted_list_item`       | grouped run -> single `prose:markdown`   |\n| `numbered_list_item`       | grouped run -> single `prose:markdown`   |\n| `to_do`                    | grouped run -> single `prose:markdown`   |\n| `code`                     | `code` (with `language`)                 |\n| `quote`                    | `callout` (`variant: 'quote'`)           |\n| `divider`                  | `data` (`shape: 'divider'`)              |\n| _anything else_            | `text` block with `notion_type` recorded |\n\nUnknown block types are deliberately preserved in a `text` fallback so the\nemitted tree remains lossless at the block level. Each unmapped type is\nalso surfaced as a warning on the adapter logger.\n\n## Configuration\n\n| Option              | Default              | Notes                                                                                    |\n| ------------------- | -------------------- | ---------------------------------------------------------------------------------------- |\n| `accessToken`       | (required)           | Inline string OR `{ from_env: 'NOTION_TOKEN' }`.                                          |\n| `databaseId`        | (required)           | Notion database UUID.                                                                    |\n| `databaseType`      | `'collection'`       | ACT type for the branch envelope.                                                        |\n| `pageType`          | `'article'`          | ACT type for leaf envelopes.                                                             |\n| `databaseTitle`     | (Notion title)       | Override the branch title.                                                               |\n| `databaseSummary`   | (Notion description) | Override the branch summary.                                                             |\n| `properties.title`  | first `type:'title'` | Notion property name to read as the page title.                                          |\n| `properties.summary`| (none)               | Notion property name to read as the page summary (rich-text).                            |\n| `properties.tags`   | (none)               | Notion property name (`select` or `multi_select`) to map to ACT `tags`.                  |\n| `locale.property`   | `'Locale'`           | Notion property name. Reads `select` / `multi_select` / `rich_text`.                     |\n| `locale.default`    | (none)               | Default to stamp when the property is missing / empty.                                   |\n| `idStrategy.namespace` | `'cms'`           | ID prefix. Emitted ids look like `<namespace>/[<locale>/]<page-uuid>`.                   |\n| `apiBaseUrl`        | `https://api.notion.com` | Override Notion API host.                                                            |\n| `notionApiVersion`  | `2022-06-28`         | Override Notion API version header.                                                      |\n| `concurrency.transform` | `4`              | Adapter framework transform parallelism.                                                 |\n\n## Conformance\n\nConformance target: `standard`.\n\nEvery public API is exercised by a citing test in `src/notion.test.ts`\n(block-tree -> prose, locale extraction, integration-token auth header,\nconfig-validation error paths, full adapter pipeline against a recorded\ncorpus). The conformance gate runs `@act-spec/validator` against the\nadapter's emitted nodes.\n\n```bash\npnpm -F @act-spec/adapter-notion conformance\n```\n","readmeFilename":"README.md","_rev":"1-d93304bd3aad677a0ee36d7304999d0c"}