@particle-academy/notion-js 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,16 @@
1
+ # Changelog
2
+
3
+ All notable changes to `@particle-academy/notion-ui`,
4
+ `@particle-academy/notion-js`, `particle-academy/notion-php` and `fancy-notion`.
5
+
6
+ ## [0.1.0] - 2026-08-28
7
+
8
+ ### Added
9
+
10
+ - Retrieve page content through Notion's enhanced Markdown endpoint.
11
+ - Capability-based OAuth without invented scope strings.
12
+ - Rotating refresh-token guidance and an explicitly undocumented access-token lifetime.
13
+ - Dedicated development-workspace sandbox guidance.
14
+ - A deterministic fixture matching Notion's top-level `page_markdown` response.
15
+
16
+ [0.1.0]: https://github.com/Fancy-Friends/notion/releases/tag/v0.1.0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Particle Academy
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,107 @@
1
+ # Notion
2
+
3
+ Notion for [fancy-flow][flow] — as **four imported, versioned packages**, one
4
+ per runtime. Not vendored source: a copy cannot be upgraded, and third-party APIs
5
+ change.
6
+
7
+ [flow]: https://github.com/Particle-Academy/fancy-flow
8
+
9
+ | Runtime | Package | Install |
10
+ |---|---|---|
11
+ | Authoring surface (every host) | `@particle-academy/notion-ui` | `npm install @particle-academy/notion-ui` |
12
+ | Node | `@particle-academy/notion-js` | `npm install @particle-academy/notion-js` |
13
+ | PHP 8.4+ | `particle-academy/notion-php` | `composer require particle-academy/notion-php` |
14
+ | Python 3.11+ | `fancy-notion` | `pip install fancy-notion` |
15
+
16
+ The `ui` package is the editor surface and is React on every host — a PHP or
17
+ Python project installs it *and* its own runtime package, and never the `js` one.
18
+
19
+ ## What it costs you
20
+
21
+ One dependency: `@particle-academy/fancy-connector-core` (or
22
+ `particle-academy/fancy-connector-core` on Composer), which the `js` and `php`
23
+ packages pull in themselves. The Python package has **zero** runtime
24
+ dependencies.
25
+
26
+ **No Notion SDK.** Plain HTTP, deliberately: a vendor SDK is third-party code
27
+ subject to the kit's full approval bar, and one per provider is hundreds of
28
+ dependencies nobody is tracking.
29
+
30
+ ## Setting it up
31
+
32
+ Everything below is generated from `provider/manifest.json`, so it cannot disagree with what the packages do.
33
+
34
+ ### Credentials
35
+
36
+ A Notion connection holds 4 values.
37
+
38
+ **Two kinds of value, and mixing them up matters.** A `provider` credential is ONE value for the whole installation — an OAuth app's client secret serves every connected account. An `account` credential is one per connected account. A host that stores the second where it stores the first lets one account's credentials reach another's.
39
+
40
+ | Field | Scope | Secret | Where it comes from |
41
+ |---|---|---|---|
42
+ | **OAuth client ID** | per installation | not secret | The public connection's OAuth client ID from its Configuration tab. |
43
+ | **OAuth client secret** | per installation | **secret** | The matching secret used by the host for code exchange and token refresh. |
44
+ | **Access token** | per connected account | **secret** | The bearer token for one user's installation in one Notion workspace. |
45
+ | **Refresh token** | per connected account | **secret** | The rotating refresh token. Replace it atomically with the new value returned by every refresh. |
46
+
47
+ ### Authorising
48
+
49
+ Notion uses OAuth2 (authorization_code). The package DECLARES the exchange; the HOST performs it — a consent screen needs a browser, a redirect URI and somewhere to persist the result, and all three belong to the host.
50
+
51
+ - **Authorize URL** — https://api.notion.com/v1/oauth/authorize
52
+ - **Token URL** — https://api.notion.com/v1/oauth/token
53
+ - **Configured capabilities** — `Read content`. This provider does not accept OAuth scope strings; configure these permissions on the integration itself.
54
+ - **Access token lifetime** — not documented by the provider. The host must retain the refresh token and refresh in response to expiry rather than scheduling from an invented TTL.
55
+
56
+ **The refresh tokens ROTATE, and they are single use.** Every refresh returns a new one and spends the one submitted, so replaying a spent token revokes the ENTIRE grant — the user is signed out, with nothing in the failure that says why.
57
+
58
+ Two consequences, both of which a host gets wrong by default:
59
+
60
+ 1. **Do not RETRY a failed refresh with the same token.** A response that arrived but was not persisted — a crash between the reply and the write — turns the reflexive retry into a replay.
61
+ 2. **Do not refresh CONCURRENTLY.** Two workers refreshing at once means one of them replays.
62
+
63
+ Persist the returned token before using the access token it came with.
64
+
65
+ ### The estate
66
+
67
+ Notion has a test estate on the same host, reached with credentials from a SEPARATE test account you register. Selecting sandbox mode uses those credentials.
68
+
69
+ > Install the public connection into a dedicated Notion development workspace and grant it only test pages. Calls use the live API and create or read real content inside that workspace.
70
+
71
+ ## What it can do
72
+
73
+ ### Actions
74
+
75
+ #### `page_markdown_get` — Notion page Markdown
76
+
77
+ Retrieve a Notion page's content as enhanced Markdown.
78
+
79
+ `GET /v1/pages/{pageId}/markdown` · reads only — safe to replay
80
+
81
+ | Input | Required | What it is |
82
+ |---|---|---|
83
+ | `pageId` | yes | The Notion page UUID, with or without hyphens. The connection must have Read content capability and access to this page. |
84
+ | `includeTranscript` | no | Include meeting-note transcripts when the connection and caller are permitted to read them. |
85
+
86
+ ## Run it before you have credentials
87
+
88
+ Every operation ships a **faker**, whether or not Notion has a sandbox. Set a
89
+ node's mode to `fake` and it returns the shape Notion actually publishes — the
90
+ same field names, deterministically — so you can wire the downstream nodes before
91
+ touching an account, a key, or a network.
92
+
93
+ ## This repository is generated
94
+
95
+ `provider/` is the source. Everything under `packages/` is emitted from it and
96
+ **must not be hand-edited** — CI regenerates and diffs on every push, and the
97
+ next protocol sync destroys anything it finds. See [`AGENTS.md`](AGENTS.md).
98
+
99
+ ## Two namespaces, which do not match on purpose
100
+
101
+ The repo is `github.com/Fancy-Friends/notion`; the packages publish under
102
+ `particle-academy`. Nothing derives one from the other — the names come from
103
+ weaver's `friends.json` and nowhere else.
104
+
105
+ ## Licence
106
+
107
+ MIT.
@@ -0,0 +1,73 @@
1
+ import { callConnector } from '@particle-academy/fancy-connector-core';
2
+
3
+ // src/faker.ts
4
+ function fakePageMarkdownGet({ config, fake }) {
5
+ return {
6
+ "object": "page_markdown",
7
+ "id": `${fake.hex(8)}-${fake.hex(4)}-${fake.hex(4)}-${fake.hex(4)}-${fake.hex(12)}`,
8
+ "markdown": "# Meeting Notes\n\nDiscussed roadmap priorities.\n\n## Action items\n\n- [ ] Draft proposal\n- [ ] Schedule follow-up",
9
+ "truncated": false,
10
+ "unknown_block_ids": []
11
+ };
12
+ }
13
+ var notionFaker = (operation, request) => {
14
+ switch (operation) {
15
+ case "page_markdown_get":
16
+ return fakePageMarkdownGet(request);
17
+ default:
18
+ throw new Error(
19
+ `notion: no fake response is defined for "${operation}". Add a fixture under provider/fixtures/ and regenerate \u2014 a connector without a faker cannot be developed against, tested, or demonstrated.`
20
+ );
21
+ }
22
+ };
23
+
24
+ // src/service.ts
25
+ var CONNECTOR_API_VERSION = 1;
26
+ var NOTION_BASE_URLS = {
27
+ "live": "https://api.notion.com",
28
+ "sandbox": "https://api.notion.com"
29
+ };
30
+ var NOTION_REQUIRES = [
31
+ "accessToken"
32
+ ];
33
+ function notionAuthorize(credentials, request, _mode) {
34
+ request.headers["Notion-Version"] = "2026-03-11";
35
+ request.headers.Authorization = `Bearer ${credentials.accessToken ?? ""}`;
36
+ }
37
+ var NOTION = {
38
+ service: "notion",
39
+ title: "Notion",
40
+ sandbox: "separate-account",
41
+ baseUrls: { ...NOTION_BASE_URLS },
42
+ requires: [...NOTION_REQUIRES],
43
+ authorize: notionAuthorize,
44
+ faker: notionFaker
45
+ };
46
+ var PAGE_MARKDOWN_GET_OPERATION = "page_markdown_get";
47
+ async function notionPageMarkdownGet(options) {
48
+ const config = options.config ?? {};
49
+ if (config.pageId === void 0 || config.pageId === null || config.pageId === "") {
50
+ throw new Error(`page_markdown_get: "pageId" is required (Page ID).`);
51
+ }
52
+ return callConnector(NOTION, {
53
+ operation: PAGE_MARKDOWN_GET_OPERATION,
54
+ config,
55
+ input: options.input,
56
+ ...options.credentials === void 0 ? {} : { credentials: options.credentials },
57
+ ...options.mode === void 0 ? {} : { mode: options.mode },
58
+ ...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
59
+ ...options.attempts === void 0 ? {} : { attempts: options.attempts },
60
+ ...options.transport === void 0 ? {} : { transport: options.transport },
61
+ request: {
62
+ method: "GET",
63
+ path: `/v1/pages/${encodeURIComponent(String(config.pageId))}/markdown`,
64
+ query: {
65
+ "include_transcript": config.includeTranscript !== void 0 && config.includeTranscript !== null && config.includeTranscript !== "" ? Boolean(config.includeTranscript) : false
66
+ }
67
+ }
68
+ });
69
+ }
70
+
71
+ export { CONNECTOR_API_VERSION, NOTION, NOTION_BASE_URLS, NOTION_REQUIRES, PAGE_MARKDOWN_GET_OPERATION, notionAuthorize, notionFaker, notionPageMarkdownGet };
72
+ //# sourceMappingURL=chunk-R5NZJO57.js.map
73
+ //# sourceMappingURL=chunk-R5NZJO57.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/faker.ts","../src/service.ts","../src/actions/page-markdown-get.ts"],"names":[],"mappings":";;;AAyBA,SAAS,mBAAA,CAAoB,EAAE,MAAA,EAAQ,IAAA,EAAK,EAAyB;AACnE,EAAA,OAAO;AAAA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;AAAA,QACL,oBAAA,EAAsB,MAAA,CAAO,iBAAA,KAAsB,MAAA,IAAa,MAAA,CAAO,iBAAA,KAAsB,IAAA,IAAQ,MAAA,CAAO,iBAAA,KAAsB,EAAA,GAAK,OAAA,CAAQ,MAAA,CAAO,iBAAiB,CAAA,GAAI;AAAA;AAC7K;AACF,GACD,CAAA;AACH","file":"chunk-R5NZJO57.js","sourcesContent":["/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/fixtures/ by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/fixtures/ (or weaver's template/) and regenerate:\n *\n * npm run provider -- notion\n */\n\n/**\n * The Notion faker.\n *\n * Shapes, not behaviour: the goal is that a downstream node sees the field\n * NAMES Notion actually publishes, so an author can wire {{ $json.data.id }}\n * against a fake and have it keep working against the real thing.\n *\n * Deterministic — same inputs, same output. A faker returning a fresh uuid\n * every call cannot be asserted on, so its fixtures degrade to \"it did not\n * throw\", which is the assertion that catches nothing.\n */\n\nimport type { ConnectorFaker, FakeRequest } from \"@particle-academy/fancy-connector-core\";\n\nfunction fakePageMarkdownGet({ config, fake }: FakeRequest): unknown {\n return {\n \"object\": \"page_markdown\",\n \"id\": `${fake.hex(8)}-${fake.hex(4)}-${fake.hex(4)}-${fake.hex(4)}-${fake.hex(12)}`,\n \"markdown\": \"# Meeting Notes\\n\\nDiscussed roadmap priorities.\\n\\n## Action items\\n\\n- [ ] Draft proposal\\n- [ ] Schedule follow-up\",\n \"truncated\": false,\n \"unknown_block_ids\": [],\n };\n}\n\nexport const notionFaker: ConnectorFaker = (operation, request) => {\n switch (operation) {\n case \"page_markdown_get\":\n return fakePageMarkdownGet(request);\n\n default:\n // A faker asked for an operation it has no shape for must SAY so. Making\n // something up would produce a green run whose output silently has none\n // of the fields the author is about to reference.\n throw new Error(\n `notion: no fake response is defined for \"${operation}\". ` +\n \"Add a fixture under provider/fixtures/ and regenerate — a connector without a faker \" +\n \"cannot be developed against, tested, or demonstrated.\",\n );\n }\n};\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/manifest.json by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/manifest.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- notion\n */\n\n/**\n * Notion, as one service descriptor shared by every Notion operation.\n *\n * @particle-academy/fancy-connector-core carries what is true of ALL\n * connectors. This carries what is true of Notion: its base URL, its auth\n * scheme, its idempotency header, and its faker.\n *\n * ## The sandbox trap, written down where it is used\n *\n * Install the public connection into a dedicated Notion development workspace\n * and grant it only test pages. Calls use the live API and create or read real\n * content inside that workspace.\n */\n\nimport type { ConnectorMode, PreparedRequest, ServiceDescriptor } from \"@particle-academy/fancy-connector-core\";\n\nimport { notionFaker } from \"./faker.js\";\n\n/**\n * The connector API version this package was GENERATED against.\n *\n * A literal, never imported. An imported constant lets an upgrade rewrite the\n * very claim it exists to detect, after which the copy agrees with itself\n * forever.\n */\nexport const CONNECTOR_API_VERSION = 1;\n\nexport const NOTION_BASE_URLS = {\n \"live\": \"https://api.notion.com\",\n \"sandbox\": \"https://api.notion.com\"\n} as const;\n\n/** Credential keys a remote call cannot proceed without. */\nexport const NOTION_REQUIRES = [\n \"accessToken\"\n] as const;\n\n/**\n * Apply Notion's auth scheme to an outgoing request.\n *\n *\n *\n * The mode is passed in because for some providers auth and estate are the\n * same decision expressed in the URL; here it is unused, and saying so is\n * cheaper than wondering later whether it was forgotten.\n */\nexport function notionAuthorize(\n credentials: Record<string, string | undefined>,\n request: PreparedRequest,\n _mode: ConnectorMode,\n): void {\n request.headers[\"Notion-Version\"] = \"2026-03-11\";\n\n request.headers.Authorization = `Bearer ${credentials.accessToken ?? \"\"}`;\n}\n\n/** The Notion service, for the TypeScript runtime. */\nexport const NOTION: ServiceDescriptor = {\n service: \"notion\",\n title: \"Notion\",\n sandbox: \"separate-account\",\n baseUrls: { ...NOTION_BASE_URLS },\n requires: [...NOTION_REQUIRES],\n authorize: notionAuthorize,\n faker: notionFaker,\n};\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/actions/page-markdown-get.json by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/actions/page-markdown-get.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- notion\n */\n\n/**\n * Retrieve a Notion page's content as enhanced Markdown.\n *\n * GET /v1/pages/{pageId}/markdown —\n * https://developers.notion.com/reference/retrieve-page-markdown\n *\n * Notice what is NOT here: no key, no base URL, no mode check, no retry loop,\n * no fake/real branch. This describes the request; callConnector resolves the\n * connection, picks the estate, and either calls Notion or calls the faker.\n */\n\nimport {\n callConnector,\n type ConnectorResult,\n type RequestedMode,\n type Transport,\n} from \"@particle-academy/fancy-connector-core\";\nimport { NOTION } from \"../service.js\";\n\nexport const PAGE_MARKDOWN_GET_OPERATION = \"page_markdown_get\";\n\nexport type PageMarkdownGetOptions = {\n /** The node's resolved config. Keys: pageId, includeTranscript. */\n config: Record<string, unknown>;\n credentials?: Record<string, string | undefined>;\n mode?: RequestedMode;\n connectionId?: string | null;\n input?: unknown;\n attempts?: number;\n /** Override the transport. The only way to exercise this without a network. */\n transport?: Transport;\n};\n\nexport async function notionPageMarkdownGet(options: PageMarkdownGetOptions): Promise<ConnectorResult> {\n const config = options.config ?? {};\n\n if (config.pageId === undefined || config.pageId === null || config.pageId === \"\") {\n throw new Error(`page_markdown_get: \"pageId\" is required (Page ID).`);\n }\n\n return callConnector(NOTION, {\n operation: PAGE_MARKDOWN_GET_OPERATION,\n config,\n input: options.input,\n ...(options.credentials === undefined ? {} : { credentials: options.credentials }),\n ...(options.mode === undefined ? {} : { mode: options.mode }),\n ...(options.connectionId === undefined ? {} : { connectionId: options.connectionId }),\n ...(options.attempts === undefined ? {} : { attempts: options.attempts }),\n ...(options.transport === undefined ? {} : { transport: options.transport }),\n request: {\n method: \"GET\",\n path: `/v1/pages/${encodeURIComponent(String(config.pageId))}/markdown`,\n query: {\n \"include_transcript\": config.includeTranscript !== undefined && config.includeTranscript !== null && config.includeTranscript !== \"\" ? Boolean(config.includeTranscript) : false,\n },\n },\n });\n}\n"]}
package/dist/flow.cjs ADDED
@@ -0,0 +1,97 @@
1
+ 'use strict';
2
+
3
+ var fancyConnectorCore = require('@particle-academy/fancy-connector-core');
4
+ var notionUi = require('@particle-academy/notion-ui');
5
+
6
+ // src/flow.ts
7
+
8
+ // src/faker.ts
9
+ function fakePageMarkdownGet({ config, fake }) {
10
+ return {
11
+ "object": "page_markdown",
12
+ "id": `${fake.hex(8)}-${fake.hex(4)}-${fake.hex(4)}-${fake.hex(4)}-${fake.hex(12)}`,
13
+ "markdown": "# Meeting Notes\n\nDiscussed roadmap priorities.\n\n## Action items\n\n- [ ] Draft proposal\n- [ ] Schedule follow-up",
14
+ "truncated": false,
15
+ "unknown_block_ids": []
16
+ };
17
+ }
18
+ var notionFaker = (operation, request) => {
19
+ switch (operation) {
20
+ case "page_markdown_get":
21
+ return fakePageMarkdownGet(request);
22
+ default:
23
+ throw new Error(
24
+ `notion: no fake response is defined for "${operation}". Add a fixture under provider/fixtures/ and regenerate \u2014 a connector without a faker cannot be developed against, tested, or demonstrated.`
25
+ );
26
+ }
27
+ };
28
+
29
+ // src/service.ts
30
+ var NOTION_BASE_URLS = {
31
+ "live": "https://api.notion.com",
32
+ "sandbox": "https://api.notion.com"
33
+ };
34
+ var NOTION_REQUIRES = [
35
+ "accessToken"
36
+ ];
37
+ function notionAuthorize(credentials, request, _mode) {
38
+ request.headers["Notion-Version"] = "2026-03-11";
39
+ request.headers.Authorization = `Bearer ${credentials.accessToken ?? ""}`;
40
+ }
41
+ var NOTION = {
42
+ service: "notion",
43
+ title: "Notion",
44
+ sandbox: "separate-account",
45
+ baseUrls: { ...NOTION_BASE_URLS },
46
+ requires: [...NOTION_REQUIRES],
47
+ authorize: notionAuthorize,
48
+ faker: notionFaker
49
+ };
50
+ var PAGE_MARKDOWN_GET_OPERATION = "page_markdown_get";
51
+ async function notionPageMarkdownGet(options) {
52
+ const config = options.config ?? {};
53
+ if (config.pageId === void 0 || config.pageId === null || config.pageId === "") {
54
+ throw new Error(`page_markdown_get: "pageId" is required (Page ID).`);
55
+ }
56
+ return fancyConnectorCore.callConnector(NOTION, {
57
+ operation: PAGE_MARKDOWN_GET_OPERATION,
58
+ config,
59
+ input: options.input,
60
+ ...options.credentials === void 0 ? {} : { credentials: options.credentials },
61
+ ...options.mode === void 0 ? {} : { mode: options.mode },
62
+ ...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
63
+ ...options.attempts === void 0 ? {} : { attempts: options.attempts },
64
+ ...options.transport === void 0 ? {} : { transport: options.transport },
65
+ request: {
66
+ method: "GET",
67
+ path: `/v1/pages/${encodeURIComponent(String(config.pageId))}/markdown`,
68
+ query: {
69
+ "include_transcript": config.includeTranscript !== void 0 && config.includeTranscript !== null && config.includeTranscript !== "" ? Boolean(config.includeTranscript) : false
70
+ }
71
+ }
72
+ });
73
+ }
74
+
75
+ // src/flow.ts
76
+ var notionPageExecutor = async (ctx) => {
77
+ const config = ctx.node.data?.config ?? {};
78
+ const result = await notionPageMarkdownGet({
79
+ config,
80
+ input: ctx.inputs?.in
81
+ });
82
+ ctx.emit({
83
+ type: "log",
84
+ level: "info",
85
+ nodeId: ctx.node.id,
86
+ message: `notion page_markdown_get ${result.data?.id} (${result.mode})`
87
+ });
88
+ return { __port: "out", value: result };
89
+ };
90
+ var NOTION_RUNNABLE_KINDS = [
91
+ { ...notionUi.notionPageKind, executor: notionPageExecutor }
92
+ ];
93
+
94
+ exports.NOTION_RUNNABLE_KINDS = NOTION_RUNNABLE_KINDS;
95
+ exports.notionPageExecutor = notionPageExecutor;
96
+ //# sourceMappingURL=flow.cjs.map
97
+ //# sourceMappingURL=flow.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/faker.ts","../src/service.ts","../src/actions/page-markdown-get.ts","../src/flow.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,KAAA;AAAA,MACR,MAAM,CAAA,UAAA,EAAa,kBAAA,CAAmB,OAAO,MAAA,CAAO,MAAM,CAAC,CAAC,CAAA,SAAA,CAAA;AAAA,MAC5D,KAAA,EAAO;AAAA,QACL,oBAAA,EAAsB,MAAA,CAAO,iBAAA,KAAsB,MAAA,IAAa,MAAA,CAAO,iBAAA,KAAsB,IAAA,IAAQ,MAAA,CAAO,iBAAA,KAAsB,EAAA,GAAK,OAAA,CAAQ,MAAA,CAAO,iBAAiB,CAAA,GAAI;AAAA;AAC7K;AACF,GACD,CAAA;AACH;;;AChCO,IAAM,kBAAA,GAAmC,OAAO,GAAA,KAAQ;AAC7D,EAAA,MAAM,MAAA,GAAW,GAAA,CAAI,IAAA,CAAK,IAAA,EAA+C,UAAU,EAAC;AAEpF,EAAA,MAAM,MAAA,GAAS,MAAM,qBAAA,CAAsB;AAAA,IACzC,MAAA;AAAA,IACA,KAAA,EAAO,IAAI,MAAA,EAAQ;AAAA,GACpB,CAAA;AAED,EAAA,GAAA,CAAI,IAAA,CAAK;AAAA,IACP,IAAA,EAAM,KAAA;AAAA,IACN,KAAA,EAAO,MAAA;AAAA,IACP,MAAA,EAAQ,IAAI,IAAA,CAAK,EAAA;AAAA,IACjB,SAAS,CAAA,yBAAA,EAA6B,MAAA,CAAO,MAA0B,EAAE,CAAA,EAAA,EAAK,OAAO,IAAI,CAAA,CAAA;AAAA,GAC1F,CAAA;AAED,EAAA,OAAO,EAAE,MAAA,EAAQ,KAAA,EAAO,KAAA,EAAO,MAAA,EAAO;AACxC;AAGO,IAAM,qBAAA,GAA8C;AAAA,EACzD,EAAE,GAAGC,uBAAA,EAAgB,QAAA,EAAU,kBAAA;AACjC","file":"flow.cjs","sourcesContent":["/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/fixtures/ by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/fixtures/ (or weaver's template/) and regenerate:\n *\n * npm run provider -- notion\n */\n\n/**\n * The Notion faker.\n *\n * Shapes, not behaviour: the goal is that a downstream node sees the field\n * NAMES Notion actually publishes, so an author can wire {{ $json.data.id }}\n * against a fake and have it keep working against the real thing.\n *\n * Deterministic — same inputs, same output. A faker returning a fresh uuid\n * every call cannot be asserted on, so its fixtures degrade to \"it did not\n * throw\", which is the assertion that catches nothing.\n */\n\nimport type { ConnectorFaker, FakeRequest } from \"@particle-academy/fancy-connector-core\";\n\nfunction fakePageMarkdownGet({ config, fake }: FakeRequest): unknown {\n return {\n \"object\": \"page_markdown\",\n \"id\": `${fake.hex(8)}-${fake.hex(4)}-${fake.hex(4)}-${fake.hex(4)}-${fake.hex(12)}`,\n \"markdown\": \"# Meeting Notes\\n\\nDiscussed roadmap priorities.\\n\\n## Action items\\n\\n- [ ] Draft proposal\\n- [ ] Schedule follow-up\",\n \"truncated\": false,\n \"unknown_block_ids\": [],\n };\n}\n\nexport const notionFaker: ConnectorFaker = (operation, request) => {\n switch (operation) {\n case \"page_markdown_get\":\n return fakePageMarkdownGet(request);\n\n default:\n // A faker asked for an operation it has no shape for must SAY so. Making\n // something up would produce a green run whose output silently has none\n // of the fields the author is about to reference.\n throw new Error(\n `notion: no fake response is defined for \"${operation}\". ` +\n \"Add a fixture under provider/fixtures/ and regenerate — a connector without a faker \" +\n \"cannot be developed against, tested, or demonstrated.\",\n );\n }\n};\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/manifest.json by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/manifest.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- notion\n */\n\n/**\n * Notion, as one service descriptor shared by every Notion operation.\n *\n * @particle-academy/fancy-connector-core carries what is true of ALL\n * connectors. This carries what is true of Notion: its base URL, its auth\n * scheme, its idempotency header, and its faker.\n *\n * ## The sandbox trap, written down where it is used\n *\n * Install the public connection into a dedicated Notion development workspace\n * and grant it only test pages. Calls use the live API and create or read real\n * content inside that workspace.\n */\n\nimport type { ConnectorMode, PreparedRequest, ServiceDescriptor } from \"@particle-academy/fancy-connector-core\";\n\nimport { notionFaker } from \"./faker.js\";\n\n/**\n * The connector API version this package was GENERATED against.\n *\n * A literal, never imported. An imported constant lets an upgrade rewrite the\n * very claim it exists to detect, after which the copy agrees with itself\n * forever.\n */\nexport const CONNECTOR_API_VERSION = 1;\n\nexport const NOTION_BASE_URLS = {\n \"live\": \"https://api.notion.com\",\n \"sandbox\": \"https://api.notion.com\"\n} as const;\n\n/** Credential keys a remote call cannot proceed without. */\nexport const NOTION_REQUIRES = [\n \"accessToken\"\n] as const;\n\n/**\n * Apply Notion's auth scheme to an outgoing request.\n *\n *\n *\n * The mode is passed in because for some providers auth and estate are the\n * same decision expressed in the URL; here it is unused, and saying so is\n * cheaper than wondering later whether it was forgotten.\n */\nexport function notionAuthorize(\n credentials: Record<string, string | undefined>,\n request: PreparedRequest,\n _mode: ConnectorMode,\n): void {\n request.headers[\"Notion-Version\"] = \"2026-03-11\";\n\n request.headers.Authorization = `Bearer ${credentials.accessToken ?? \"\"}`;\n}\n\n/** The Notion service, for the TypeScript runtime. */\nexport const NOTION: ServiceDescriptor = {\n service: \"notion\",\n title: \"Notion\",\n sandbox: \"separate-account\",\n baseUrls: { ...NOTION_BASE_URLS },\n requires: [...NOTION_REQUIRES],\n authorize: notionAuthorize,\n faker: notionFaker,\n};\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/actions/page-markdown-get.json by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/actions/page-markdown-get.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- notion\n */\n\n/**\n * Retrieve a Notion page's content as enhanced Markdown.\n *\n * GET /v1/pages/{pageId}/markdown —\n * https://developers.notion.com/reference/retrieve-page-markdown\n *\n * Notice what is NOT here: no key, no base URL, no mode check, no retry loop,\n * no fake/real branch. This describes the request; callConnector resolves the\n * connection, picks the estate, and either calls Notion or calls the faker.\n */\n\nimport {\n callConnector,\n type ConnectorResult,\n type RequestedMode,\n type Transport,\n} from \"@particle-academy/fancy-connector-core\";\nimport { NOTION } from \"../service.js\";\n\nexport const PAGE_MARKDOWN_GET_OPERATION = \"page_markdown_get\";\n\nexport type PageMarkdownGetOptions = {\n /** The node's resolved config. Keys: pageId, includeTranscript. */\n config: Record<string, unknown>;\n credentials?: Record<string, string | undefined>;\n mode?: RequestedMode;\n connectionId?: string | null;\n input?: unknown;\n attempts?: number;\n /** Override the transport. The only way to exercise this without a network. */\n transport?: Transport;\n};\n\nexport async function notionPageMarkdownGet(options: PageMarkdownGetOptions): Promise<ConnectorResult> {\n const config = options.config ?? {};\n\n if (config.pageId === undefined || config.pageId === null || config.pageId === \"\") {\n throw new Error(`page_markdown_get: \"pageId\" is required (Page ID).`);\n }\n\n return callConnector(NOTION, {\n operation: PAGE_MARKDOWN_GET_OPERATION,\n config,\n input: options.input,\n ...(options.credentials === undefined ? {} : { credentials: options.credentials }),\n ...(options.mode === undefined ? {} : { mode: options.mode }),\n ...(options.connectionId === undefined ? {} : { connectionId: options.connectionId }),\n ...(options.attempts === undefined ? {} : { attempts: options.attempts }),\n ...(options.transport === undefined ? {} : { transport: options.transport }),\n request: {\n method: \"GET\",\n path: `/v1/pages/${encodeURIComponent(String(config.pageId))}/markdown`,\n query: {\n \"include_transcript\": config.includeTranscript !== undefined && config.includeTranscript !== null && config.includeTranscript !== \"\" ? Boolean(config.includeTranscript) : false,\n },\n },\n });\n}\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/actions/ + triggers/ by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/actions/ + triggers/ (or weaver's template/) and regenerate:\n *\n * npm run provider -- notion\n */\n\n/**\n * Notion's node kinds with their TypeScript executors attached — for hosts\n * that EXECUTE on TS.\n *\n * The authoring surface in @particle-academy/notion-ui carries no executor:\n * the editor is React on every host, so a PHP or Python project installs the\n * ui package and never this one.\n */\n\nimport type { NodeExecutor, NodeKindDefinition } from \"@particle-academy/fancy-flow/engine\";\nimport {\n idempotencyKeyFor,\n NO_IDEMPOTENCY_KEY_WARNING,\n resolveConnection,\n triggerEvent,\n type RequestedMode,\n} from \"@particle-academy/fancy-connector-core\";\nimport { NOTION } from \"./service.js\";\n\nimport {\n notionPageKind,\n} from \"@particle-academy/notion-ui\";\n\nimport { notionPageMarkdownGet } from \"./actions/page-markdown-get.js\";\n\nexport const notionPageExecutor: NodeExecutor = async (ctx) => {\n const config = ((ctx.node.data as { config?: Record<string, unknown> })?.config ?? {});\n\n const result = await notionPageMarkdownGet({\n config,\n input: ctx.inputs?.in,\n });\n\n ctx.emit({\n type: \"log\",\n level: \"info\",\n nodeId: ctx.node.id,\n message: `notion page_markdown_get ${(result.data as { id?: string })?.id} (${result.mode})`,\n });\n\n return { __port: \"out\", value: result };\n};\n\n/** The kinds a TypeScript host registers. */\nexport const NOTION_RUNNABLE_KINDS: NodeKindDefinition[] = [\n { ...notionPageKind, executor: notionPageExecutor },\n];\n"]}
@@ -0,0 +1,26 @@
1
+ import { NodeKindDefinition, NodeExecutor } from '@particle-academy/fancy-flow/engine';
2
+
3
+ /**
4
+ * GENERATED FILE — do not edit.
5
+ *
6
+ * Emitted from provider/actions/ + triggers/ by weaver's generator.
7
+ * A hand-edit here is destroyed by the next protocol sync, which is worse than
8
+ * being rejected, because it works until it silently does not. Fix
9
+ * provider/actions/ + triggers/ (or weaver's template/) and regenerate:
10
+ *
11
+ * npm run provider -- notion
12
+ */
13
+ /**
14
+ * Notion's node kinds with their TypeScript executors attached — for hosts
15
+ * that EXECUTE on TS.
16
+ *
17
+ * The authoring surface in @particle-academy/notion-ui carries no executor:
18
+ * the editor is React on every host, so a PHP or Python project installs the
19
+ * ui package and never this one.
20
+ */
21
+
22
+ declare const notionPageExecutor: NodeExecutor;
23
+ /** The kinds a TypeScript host registers. */
24
+ declare const NOTION_RUNNABLE_KINDS: NodeKindDefinition[];
25
+
26
+ export { NOTION_RUNNABLE_KINDS, notionPageExecutor };
package/dist/flow.d.ts ADDED
@@ -0,0 +1,26 @@
1
+ import { NodeKindDefinition, NodeExecutor } from '@particle-academy/fancy-flow/engine';
2
+
3
+ /**
4
+ * GENERATED FILE — do not edit.
5
+ *
6
+ * Emitted from provider/actions/ + triggers/ by weaver's generator.
7
+ * A hand-edit here is destroyed by the next protocol sync, which is worse than
8
+ * being rejected, because it works until it silently does not. Fix
9
+ * provider/actions/ + triggers/ (or weaver's template/) and regenerate:
10
+ *
11
+ * npm run provider -- notion
12
+ */
13
+ /**
14
+ * Notion's node kinds with their TypeScript executors attached — for hosts
15
+ * that EXECUTE on TS.
16
+ *
17
+ * The authoring surface in @particle-academy/notion-ui carries no executor:
18
+ * the editor is React on every host, so a PHP or Python project installs the
19
+ * ui package and never this one.
20
+ */
21
+
22
+ declare const notionPageExecutor: NodeExecutor;
23
+ /** The kinds a TypeScript host registers. */
24
+ declare const NOTION_RUNNABLE_KINDS: NodeKindDefinition[];
25
+
26
+ export { NOTION_RUNNABLE_KINDS, notionPageExecutor };
package/dist/flow.js ADDED
@@ -0,0 +1,25 @@
1
+ import { notionPageMarkdownGet } from './chunk-R5NZJO57.js';
2
+ import '@particle-academy/fancy-connector-core';
3
+ import { notionPageKind } from '@particle-academy/notion-ui';
4
+
5
+ var notionPageExecutor = async (ctx) => {
6
+ const config = ctx.node.data?.config ?? {};
7
+ const result = await notionPageMarkdownGet({
8
+ config,
9
+ input: ctx.inputs?.in
10
+ });
11
+ ctx.emit({
12
+ type: "log",
13
+ level: "info",
14
+ nodeId: ctx.node.id,
15
+ message: `notion page_markdown_get ${result.data?.id} (${result.mode})`
16
+ });
17
+ return { __port: "out", value: result };
18
+ };
19
+ var NOTION_RUNNABLE_KINDS = [
20
+ { ...notionPageKind, executor: notionPageExecutor }
21
+ ];
22
+
23
+ export { NOTION_RUNNABLE_KINDS, notionPageExecutor };
24
+ //# sourceMappingURL=flow.js.map
25
+ //# sourceMappingURL=flow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/flow.ts"],"names":[],"mappings":";;;;AAoCO,IAAM,kBAAA,GAAmC,OAAO,GAAA,KAAQ;AAC7D,EAAA,MAAM,MAAA,GAAW,GAAA,CAAI,IAAA,CAAK,IAAA,EAA+C,UAAU,EAAC;AAEpF,EAAA,MAAM,MAAA,GAAS,MAAM,qBAAA,CAAsB;AAAA,IACzC,MAAA;AAAA,IACA,KAAA,EAAO,IAAI,MAAA,EAAQ;AAAA,GACpB,CAAA;AAED,EAAA,GAAA,CAAI,IAAA,CAAK;AAAA,IACP,IAAA,EAAM,KAAA;AAAA,IACN,KAAA,EAAO,MAAA;AAAA,IACP,MAAA,EAAQ,IAAI,IAAA,CAAK,EAAA;AAAA,IACjB,SAAS,CAAA,yBAAA,EAA6B,MAAA,CAAO,MAA0B,EAAE,CAAA,EAAA,EAAK,OAAO,IAAI,CAAA,CAAA;AAAA,GAC1F,CAAA;AAED,EAAA,OAAO,EAAE,MAAA,EAAQ,KAAA,EAAO,KAAA,EAAO,MAAA,EAAO;AACxC;AAGO,IAAM,qBAAA,GAA8C;AAAA,EACzD,EAAE,GAAG,cAAA,EAAgB,QAAA,EAAU,kBAAA;AACjC","file":"flow.js","sourcesContent":["/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/actions/ + triggers/ by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/actions/ + triggers/ (or weaver's template/) and regenerate:\n *\n * npm run provider -- notion\n */\n\n/**\n * Notion's node kinds with their TypeScript executors attached — for hosts\n * that EXECUTE on TS.\n *\n * The authoring surface in @particle-academy/notion-ui carries no executor:\n * the editor is React on every host, so a PHP or Python project installs the\n * ui package and never this one.\n */\n\nimport type { NodeExecutor, NodeKindDefinition } from \"@particle-academy/fancy-flow/engine\";\nimport {\n idempotencyKeyFor,\n NO_IDEMPOTENCY_KEY_WARNING,\n resolveConnection,\n triggerEvent,\n type RequestedMode,\n} from \"@particle-academy/fancy-connector-core\";\nimport { NOTION } from \"./service.js\";\n\nimport {\n notionPageKind,\n} from \"@particle-academy/notion-ui\";\n\nimport { notionPageMarkdownGet } from \"./actions/page-markdown-get.js\";\n\nexport const notionPageExecutor: NodeExecutor = async (ctx) => {\n const config = ((ctx.node.data as { config?: Record<string, unknown> })?.config ?? {});\n\n const result = await notionPageMarkdownGet({\n config,\n input: ctx.inputs?.in,\n });\n\n ctx.emit({\n type: \"log\",\n level: \"info\",\n nodeId: ctx.node.id,\n message: `notion page_markdown_get ${(result.data as { id?: string })?.id} (${result.mode})`,\n });\n\n return { __port: \"out\", value: result };\n};\n\n/** The kinds a TypeScript host registers. */\nexport const NOTION_RUNNABLE_KINDS: NodeKindDefinition[] = [\n { ...notionPageKind, executor: notionPageExecutor },\n];\n"]}
package/dist/index.cjs ADDED
@@ -0,0 +1,82 @@
1
+ 'use strict';
2
+
3
+ var fancyConnectorCore = require('@particle-academy/fancy-connector-core');
4
+
5
+ // src/faker.ts
6
+ function fakePageMarkdownGet({ config, fake }) {
7
+ return {
8
+ "object": "page_markdown",
9
+ "id": `${fake.hex(8)}-${fake.hex(4)}-${fake.hex(4)}-${fake.hex(4)}-${fake.hex(12)}`,
10
+ "markdown": "# Meeting Notes\n\nDiscussed roadmap priorities.\n\n## Action items\n\n- [ ] Draft proposal\n- [ ] Schedule follow-up",
11
+ "truncated": false,
12
+ "unknown_block_ids": []
13
+ };
14
+ }
15
+ var notionFaker = (operation, request) => {
16
+ switch (operation) {
17
+ case "page_markdown_get":
18
+ return fakePageMarkdownGet(request);
19
+ default:
20
+ throw new Error(
21
+ `notion: no fake response is defined for "${operation}". Add a fixture under provider/fixtures/ and regenerate \u2014 a connector without a faker cannot be developed against, tested, or demonstrated.`
22
+ );
23
+ }
24
+ };
25
+
26
+ // src/service.ts
27
+ var CONNECTOR_API_VERSION = 1;
28
+ var NOTION_BASE_URLS = {
29
+ "live": "https://api.notion.com",
30
+ "sandbox": "https://api.notion.com"
31
+ };
32
+ var NOTION_REQUIRES = [
33
+ "accessToken"
34
+ ];
35
+ function notionAuthorize(credentials, request, _mode) {
36
+ request.headers["Notion-Version"] = "2026-03-11";
37
+ request.headers.Authorization = `Bearer ${credentials.accessToken ?? ""}`;
38
+ }
39
+ var NOTION = {
40
+ service: "notion",
41
+ title: "Notion",
42
+ sandbox: "separate-account",
43
+ baseUrls: { ...NOTION_BASE_URLS },
44
+ requires: [...NOTION_REQUIRES],
45
+ authorize: notionAuthorize,
46
+ faker: notionFaker
47
+ };
48
+ var PAGE_MARKDOWN_GET_OPERATION = "page_markdown_get";
49
+ async function notionPageMarkdownGet(options) {
50
+ const config = options.config ?? {};
51
+ if (config.pageId === void 0 || config.pageId === null || config.pageId === "") {
52
+ throw new Error(`page_markdown_get: "pageId" is required (Page ID).`);
53
+ }
54
+ return fancyConnectorCore.callConnector(NOTION, {
55
+ operation: PAGE_MARKDOWN_GET_OPERATION,
56
+ config,
57
+ input: options.input,
58
+ ...options.credentials === void 0 ? {} : { credentials: options.credentials },
59
+ ...options.mode === void 0 ? {} : { mode: options.mode },
60
+ ...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
61
+ ...options.attempts === void 0 ? {} : { attempts: options.attempts },
62
+ ...options.transport === void 0 ? {} : { transport: options.transport },
63
+ request: {
64
+ method: "GET",
65
+ path: `/v1/pages/${encodeURIComponent(String(config.pageId))}/markdown`,
66
+ query: {
67
+ "include_transcript": config.includeTranscript !== void 0 && config.includeTranscript !== null && config.includeTranscript !== "" ? Boolean(config.includeTranscript) : false
68
+ }
69
+ }
70
+ });
71
+ }
72
+
73
+ exports.CONNECTOR_API_VERSION = CONNECTOR_API_VERSION;
74
+ exports.NOTION = NOTION;
75
+ exports.NOTION_BASE_URLS = NOTION_BASE_URLS;
76
+ exports.NOTION_REQUIRES = NOTION_REQUIRES;
77
+ exports.PAGE_MARKDOWN_GET_OPERATION = PAGE_MARKDOWN_GET_OPERATION;
78
+ exports.notionAuthorize = notionAuthorize;
79
+ exports.notionFaker = notionFaker;
80
+ exports.notionPageMarkdownGet = notionPageMarkdownGet;
81
+ //# sourceMappingURL=index.cjs.map
82
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/faker.ts","../src/service.ts","../src/actions/page-markdown-get.ts"],"names":["callConnector"],"mappings":";;;;;AAyBA,SAAS,mBAAA,CAAoB,EAAE,MAAA,EAAQ,IAAA,EAAK,EAAyB;AACnE,EAAA,OAAO;AAAA,IACL,QAAA,EAAU,eAAA;AAAA,IACV,IAAA,EAAM,CAAA,EAAG,IAAA,CAAK,GAAA,CAAI,CAAC,CAAC,CAAA,CAAA,EAAI,IAAA,CAAK,GAAA,CAAI,CAAC,CAAC,CAAA,CAAA,EAAI,KAAK,GAAA,CAAI,CAAC,CAAC,CAAA,CAAA,EAAI,IAAA,CAAK,GAAA,CAAI,CAAC,CAAC,CAAA,CAAA,EAAI,IAAA,CAAK,GAAA,CAAI,EAAE,CAAC,CAAA,CAAA;AAAA,IACjF,UAAA,EAAY,uHAAA;AAAA,IACZ,WAAA,EAAa,KAAA;AAAA,IACb,qBAAqB;AAAC,GACxB;AACF;AAEO,IAAM,WAAA,GAA8B,CAAC,SAAA,EAAW,OAAA,KAAY;AACjE,EAAA,QAAQ,SAAA;AAAW,IACjB,KAAK,mBAAA;AACH,MAAA,OAAO,oBAAoB,OAAO,CAAA;AAAA,IAEpC;AAIE,MAAA,MAAM,IAAI,KAAA;AAAA,QACR,4CAA4C,SAAS,CAAA,iJAAA;AAAA,OAGvD;AAAA;AAEN;;;ACdO,IAAM,qBAAA,GAAwB;AAE9B,IAAM,gBAAA,GAAmB;AAAA,EAC9B,MAAA,EAAQ,wBAAA;AAAA,EACR,SAAA,EAAW;AACb;AAGO,IAAM,eAAA,GAAkB;AAAA,EAC7B;AACF;AAWO,SAAS,eAAA,CACd,WAAA,EACA,OAA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Q,QAAA,KAAa,MAAA,GAAY,EAAC,GAAI,EAAE,QAAA,EAAU,OAAA,CAAQ,QAAA,EAAS;AAAA,IACvE,GAAI,QAAQ,SAAA,KAAc,MAAA,GAAY,EAAC,GAAI,EAAE,SAAA,EAAW,OAAA,CAAQ,SAAA,EAAU;AAAA,IAC1E,OAAA,EAAS;AAAA,MACP,MAAA,EAAQ,KAAA;AAAA,MACR,MAAM,CAAA,UAAA,EAAa,kBAAA,CAAmB,OAAO,MAAA,CAAO,MAAM,CAAC,CAAC,CAAA,SAAA,CAAA;AAAA,MAC5D,KAAA,EAAO;AAAA,QACL,oBAAA,EAAsB,MAAA,CAAO,iBAAA,KAAsB,MAAA,IAAa,MAAA,CAAO,iBAAA,KAAsB,IAAA,IAAQ,MAAA,CAAO,iBAAA,KAAsB,EAAA,GAAK,OAAA,CAAQ,MAAA,CAAO,iBAAiB,CAAA,GAAI;AAAA;AAC7K;AACF,GACD,CAAA;AACH","file":"index.cjs","sourcesContent":["/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/fixtures/ by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/fixtures/ (or weaver's template/) and regenerate:\n *\n * npm run provider -- notion\n */\n\n/**\n * The Notion faker.\n *\n * Shapes, not behaviour: the goal is that a downstream node sees the field\n * NAMES Notion actually publishes, so an author can wire {{ $json.data.id }}\n * against a fake and have it keep working against the real thing.\n *\n * Deterministic — same inputs, same output. A faker returning a fresh uuid\n * every call cannot be asserted on, so its fixtures degrade to \"it did not\n * throw\", which is the assertion that catches nothing.\n */\n\nimport type { ConnectorFaker, FakeRequest } from \"@particle-academy/fancy-connector-core\";\n\nfunction fakePageMarkdownGet({ config, fake }: FakeRequest): unknown {\n return {\n \"object\": \"page_markdown\",\n \"id\": `${fake.hex(8)}-${fake.hex(4)}-${fake.hex(4)}-${fake.hex(4)}-${fake.hex(12)}`,\n \"markdown\": \"# Meeting Notes\\n\\nDiscussed roadmap priorities.\\n\\n## Action items\\n\\n- [ ] Draft proposal\\n- [ ] Schedule follow-up\",\n \"truncated\": false,\n \"unknown_block_ids\": [],\n };\n}\n\nexport const notionFaker: ConnectorFaker = (operation, request) => {\n switch (operation) {\n case \"page_markdown_get\":\n return fakePageMarkdownGet(request);\n\n default:\n // A faker asked for an operation it has no shape for must SAY so. Making\n // something up would produce a green run whose output silently has none\n // of the fields the author is about to reference.\n throw new Error(\n `notion: no fake response is defined for \"${operation}\". ` +\n \"Add a fixture under provider/fixtures/ and regenerate — a connector without a faker \" +\n \"cannot be developed against, tested, or demonstrated.\",\n );\n }\n};\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/manifest.json by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/manifest.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- notion\n */\n\n/**\n * Notion, as one service descriptor shared by every Notion operation.\n *\n * @particle-academy/fancy-connector-core carries what is true of ALL\n * connectors. This carries what is true of Notion: its base URL, its auth\n * scheme, its idempotency header, and its faker.\n *\n * ## The sandbox trap, written down where it is used\n *\n * Install the public connection into a dedicated Notion development workspace\n * and grant it only test pages. Calls use the live API and create or read real\n * content inside that workspace.\n */\n\nimport type { ConnectorMode, PreparedRequest, ServiceDescriptor } from \"@particle-academy/fancy-connector-core\";\n\nimport { notionFaker } from \"./faker.js\";\n\n/**\n * The connector API version this package was GENERATED against.\n *\n * A literal, never imported. An imported constant lets an upgrade rewrite the\n * very claim it exists to detect, after which the copy agrees with itself\n * forever.\n */\nexport const CONNECTOR_API_VERSION = 1;\n\nexport const NOTION_BASE_URLS = {\n \"live\": \"https://api.notion.com\",\n \"sandbox\": \"https://api.notion.com\"\n} as const;\n\n/** Credential keys a remote call cannot proceed without. */\nexport const NOTION_REQUIRES = [\n \"accessToken\"\n] as const;\n\n/**\n * Apply Notion's auth scheme to an outgoing request.\n *\n *\n *\n * The mode is passed in because for some providers auth and estate are the\n * same decision expressed in the URL; here it is unused, and saying so is\n * cheaper than wondering later whether it was forgotten.\n */\nexport function notionAuthorize(\n credentials: Record<string, string | undefined>,\n request: PreparedRequest,\n _mode: ConnectorMode,\n): void {\n request.headers[\"Notion-Version\"] = \"2026-03-11\";\n\n request.headers.Authorization = `Bearer ${credentials.accessToken ?? \"\"}`;\n}\n\n/** The Notion service, for the TypeScript runtime. */\nexport const NOTION: ServiceDescriptor = {\n service: \"notion\",\n title: \"Notion\",\n sandbox: \"separate-account\",\n baseUrls: { ...NOTION_BASE_URLS },\n requires: [...NOTION_REQUIRES],\n authorize: notionAuthorize,\n faker: notionFaker,\n};\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/actions/page-markdown-get.json by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/actions/page-markdown-get.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- notion\n */\n\n/**\n * Retrieve a Notion page's content as enhanced Markdown.\n *\n * GET /v1/pages/{pageId}/markdown —\n * https://developers.notion.com/reference/retrieve-page-markdown\n *\n * Notice what is NOT here: no key, no base URL, no mode check, no retry loop,\n * no fake/real branch. This describes the request; callConnector resolves the\n * connection, picks the estate, and either calls Notion or calls the faker.\n */\n\nimport {\n callConnector,\n type ConnectorResult,\n type RequestedMode,\n type Transport,\n} from \"@particle-academy/fancy-connector-core\";\nimport { NOTION } from \"../service.js\";\n\nexport const PAGE_MARKDOWN_GET_OPERATION = \"page_markdown_get\";\n\nexport type PageMarkdownGetOptions = {\n /** The node's resolved config. Keys: pageId, includeTranscript. */\n config: Record<string, unknown>;\n credentials?: Record<string, string | undefined>;\n mode?: RequestedMode;\n connectionId?: string | null;\n input?: unknown;\n attempts?: number;\n /** Override the transport. The only way to exercise this without a network. */\n transport?: Transport;\n};\n\nexport async function notionPageMarkdownGet(options: PageMarkdownGetOptions): Promise<ConnectorResult> {\n const config = options.config ?? {};\n\n if (config.pageId === undefined || config.pageId === null || config.pageId === \"\") {\n throw new Error(`page_markdown_get: \"pageId\" is required (Page ID).`);\n }\n\n return callConnector(NOTION, {\n operation: PAGE_MARKDOWN_GET_OPERATION,\n config,\n input: options.input,\n ...(options.credentials === undefined ? {} : { credentials: options.credentials }),\n ...(options.mode === undefined ? {} : { mode: options.mode }),\n ...(options.connectionId === undefined ? {} : { connectionId: options.connectionId }),\n ...(options.attempts === undefined ? {} : { attempts: options.attempts }),\n ...(options.transport === undefined ? {} : { transport: options.transport }),\n request: {\n method: \"GET\",\n path: `/v1/pages/${encodeURIComponent(String(config.pageId))}/markdown`,\n query: {\n \"include_transcript\": config.includeTranscript !== undefined && config.includeTranscript !== null && config.includeTranscript !== \"\" ? Boolean(config.includeTranscript) : false,\n },\n },\n });\n}\n"]}
@@ -0,0 +1,113 @@
1
+ import { ServiceDescriptor, PreparedRequest, ConnectorMode, ConnectorFaker, RequestedMode, Transport, ConnectorResult } from '@particle-academy/fancy-connector-core';
2
+
3
+ /**
4
+ * GENERATED FILE — do not edit.
5
+ *
6
+ * Emitted from provider/manifest.json by weaver's generator.
7
+ * A hand-edit here is destroyed by the next protocol sync, which is worse than
8
+ * being rejected, because it works until it silently does not. Fix
9
+ * provider/manifest.json (or weaver's template/) and regenerate:
10
+ *
11
+ * npm run provider -- notion
12
+ */
13
+ /**
14
+ * Notion, as one service descriptor shared by every Notion operation.
15
+ *
16
+ * @particle-academy/fancy-connector-core carries what is true of ALL
17
+ * connectors. This carries what is true of Notion: its base URL, its auth
18
+ * scheme, its idempotency header, and its faker.
19
+ *
20
+ * ## The sandbox trap, written down where it is used
21
+ *
22
+ * Install the public connection into a dedicated Notion development workspace
23
+ * and grant it only test pages. Calls use the live API and create or read real
24
+ * content inside that workspace.
25
+ */
26
+
27
+ /**
28
+ * The connector API version this package was GENERATED against.
29
+ *
30
+ * A literal, never imported. An imported constant lets an upgrade rewrite the
31
+ * very claim it exists to detect, after which the copy agrees with itself
32
+ * forever.
33
+ */
34
+ declare const CONNECTOR_API_VERSION = 1;
35
+ declare const NOTION_BASE_URLS: {
36
+ readonly live: "https://api.notion.com";
37
+ readonly sandbox: "https://api.notion.com";
38
+ };
39
+ /** Credential keys a remote call cannot proceed without. */
40
+ declare const NOTION_REQUIRES: readonly ["accessToken"];
41
+ /**
42
+ * Apply Notion's auth scheme to an outgoing request.
43
+ *
44
+ *
45
+ *
46
+ * The mode is passed in because for some providers auth and estate are the
47
+ * same decision expressed in the URL; here it is unused, and saying so is
48
+ * cheaper than wondering later whether it was forgotten.
49
+ */
50
+ declare function notionAuthorize(credentials: Record<string, string | undefined>, request: PreparedRequest, _mode: ConnectorMode): void;
51
+ /** The Notion service, for the TypeScript runtime. */
52
+ declare const NOTION: ServiceDescriptor;
53
+
54
+ /**
55
+ * GENERATED FILE — do not edit.
56
+ *
57
+ * Emitted from provider/fixtures/ by weaver's generator.
58
+ * A hand-edit here is destroyed by the next protocol sync, which is worse than
59
+ * being rejected, because it works until it silently does not. Fix
60
+ * provider/fixtures/ (or weaver's template/) and regenerate:
61
+ *
62
+ * npm run provider -- notion
63
+ */
64
+ /**
65
+ * The Notion faker.
66
+ *
67
+ * Shapes, not behaviour: the goal is that a downstream node sees the field
68
+ * NAMES Notion actually publishes, so an author can wire {{ $json.data.id }}
69
+ * against a fake and have it keep working against the real thing.
70
+ *
71
+ * Deterministic — same inputs, same output. A faker returning a fresh uuid
72
+ * every call cannot be asserted on, so its fixtures degrade to "it did not
73
+ * throw", which is the assertion that catches nothing.
74
+ */
75
+
76
+ declare const notionFaker: ConnectorFaker;
77
+
78
+ /**
79
+ * GENERATED FILE — do not edit.
80
+ *
81
+ * Emitted from provider/actions/page-markdown-get.json by weaver's generator.
82
+ * A hand-edit here is destroyed by the next protocol sync, which is worse than
83
+ * being rejected, because it works until it silently does not. Fix
84
+ * provider/actions/page-markdown-get.json (or weaver's template/) and regenerate:
85
+ *
86
+ * npm run provider -- notion
87
+ */
88
+ /**
89
+ * Retrieve a Notion page's content as enhanced Markdown.
90
+ *
91
+ * GET /v1/pages/{pageId}/markdown —
92
+ * https://developers.notion.com/reference/retrieve-page-markdown
93
+ *
94
+ * Notice what is NOT here: no key, no base URL, no mode check, no retry loop,
95
+ * no fake/real branch. This describes the request; callConnector resolves the
96
+ * connection, picks the estate, and either calls Notion or calls the faker.
97
+ */
98
+
99
+ declare const PAGE_MARKDOWN_GET_OPERATION = "page_markdown_get";
100
+ type PageMarkdownGetOptions = {
101
+ /** The node's resolved config. Keys: pageId, includeTranscript. */
102
+ config: Record<string, unknown>;
103
+ credentials?: Record<string, string | undefined>;
104
+ mode?: RequestedMode;
105
+ connectionId?: string | null;
106
+ input?: unknown;
107
+ attempts?: number;
108
+ /** Override the transport. The only way to exercise this without a network. */
109
+ transport?: Transport;
110
+ };
111
+ declare function notionPageMarkdownGet(options: PageMarkdownGetOptions): Promise<ConnectorResult>;
112
+
113
+ export { CONNECTOR_API_VERSION, NOTION, NOTION_BASE_URLS, NOTION_REQUIRES, PAGE_MARKDOWN_GET_OPERATION, type PageMarkdownGetOptions, notionAuthorize, notionFaker, notionPageMarkdownGet };
@@ -0,0 +1,113 @@
1
+ import { ServiceDescriptor, PreparedRequest, ConnectorMode, ConnectorFaker, RequestedMode, Transport, ConnectorResult } from '@particle-academy/fancy-connector-core';
2
+
3
+ /**
4
+ * GENERATED FILE — do not edit.
5
+ *
6
+ * Emitted from provider/manifest.json by weaver's generator.
7
+ * A hand-edit here is destroyed by the next protocol sync, which is worse than
8
+ * being rejected, because it works until it silently does not. Fix
9
+ * provider/manifest.json (or weaver's template/) and regenerate:
10
+ *
11
+ * npm run provider -- notion
12
+ */
13
+ /**
14
+ * Notion, as one service descriptor shared by every Notion operation.
15
+ *
16
+ * @particle-academy/fancy-connector-core carries what is true of ALL
17
+ * connectors. This carries what is true of Notion: its base URL, its auth
18
+ * scheme, its idempotency header, and its faker.
19
+ *
20
+ * ## The sandbox trap, written down where it is used
21
+ *
22
+ * Install the public connection into a dedicated Notion development workspace
23
+ * and grant it only test pages. Calls use the live API and create or read real
24
+ * content inside that workspace.
25
+ */
26
+
27
+ /**
28
+ * The connector API version this package was GENERATED against.
29
+ *
30
+ * A literal, never imported. An imported constant lets an upgrade rewrite the
31
+ * very claim it exists to detect, after which the copy agrees with itself
32
+ * forever.
33
+ */
34
+ declare const CONNECTOR_API_VERSION = 1;
35
+ declare const NOTION_BASE_URLS: {
36
+ readonly live: "https://api.notion.com";
37
+ readonly sandbox: "https://api.notion.com";
38
+ };
39
+ /** Credential keys a remote call cannot proceed without. */
40
+ declare const NOTION_REQUIRES: readonly ["accessToken"];
41
+ /**
42
+ * Apply Notion's auth scheme to an outgoing request.
43
+ *
44
+ *
45
+ *
46
+ * The mode is passed in because for some providers auth and estate are the
47
+ * same decision expressed in the URL; here it is unused, and saying so is
48
+ * cheaper than wondering later whether it was forgotten.
49
+ */
50
+ declare function notionAuthorize(credentials: Record<string, string | undefined>, request: PreparedRequest, _mode: ConnectorMode): void;
51
+ /** The Notion service, for the TypeScript runtime. */
52
+ declare const NOTION: ServiceDescriptor;
53
+
54
+ /**
55
+ * GENERATED FILE — do not edit.
56
+ *
57
+ * Emitted from provider/fixtures/ by weaver's generator.
58
+ * A hand-edit here is destroyed by the next protocol sync, which is worse than
59
+ * being rejected, because it works until it silently does not. Fix
60
+ * provider/fixtures/ (or weaver's template/) and regenerate:
61
+ *
62
+ * npm run provider -- notion
63
+ */
64
+ /**
65
+ * The Notion faker.
66
+ *
67
+ * Shapes, not behaviour: the goal is that a downstream node sees the field
68
+ * NAMES Notion actually publishes, so an author can wire {{ $json.data.id }}
69
+ * against a fake and have it keep working against the real thing.
70
+ *
71
+ * Deterministic — same inputs, same output. A faker returning a fresh uuid
72
+ * every call cannot be asserted on, so its fixtures degrade to "it did not
73
+ * throw", which is the assertion that catches nothing.
74
+ */
75
+
76
+ declare const notionFaker: ConnectorFaker;
77
+
78
+ /**
79
+ * GENERATED FILE — do not edit.
80
+ *
81
+ * Emitted from provider/actions/page-markdown-get.json by weaver's generator.
82
+ * A hand-edit here is destroyed by the next protocol sync, which is worse than
83
+ * being rejected, because it works until it silently does not. Fix
84
+ * provider/actions/page-markdown-get.json (or weaver's template/) and regenerate:
85
+ *
86
+ * npm run provider -- notion
87
+ */
88
+ /**
89
+ * Retrieve a Notion page's content as enhanced Markdown.
90
+ *
91
+ * GET /v1/pages/{pageId}/markdown —
92
+ * https://developers.notion.com/reference/retrieve-page-markdown
93
+ *
94
+ * Notice what is NOT here: no key, no base URL, no mode check, no retry loop,
95
+ * no fake/real branch. This describes the request; callConnector resolves the
96
+ * connection, picks the estate, and either calls Notion or calls the faker.
97
+ */
98
+
99
+ declare const PAGE_MARKDOWN_GET_OPERATION = "page_markdown_get";
100
+ type PageMarkdownGetOptions = {
101
+ /** The node's resolved config. Keys: pageId, includeTranscript. */
102
+ config: Record<string, unknown>;
103
+ credentials?: Record<string, string | undefined>;
104
+ mode?: RequestedMode;
105
+ connectionId?: string | null;
106
+ input?: unknown;
107
+ attempts?: number;
108
+ /** Override the transport. The only way to exercise this without a network. */
109
+ transport?: Transport;
110
+ };
111
+ declare function notionPageMarkdownGet(options: PageMarkdownGetOptions): Promise<ConnectorResult>;
112
+
113
+ export { CONNECTOR_API_VERSION, NOTION, NOTION_BASE_URLS, NOTION_REQUIRES, PAGE_MARKDOWN_GET_OPERATION, type PageMarkdownGetOptions, notionAuthorize, notionFaker, notionPageMarkdownGet };
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export { CONNECTOR_API_VERSION, NOTION, NOTION_BASE_URLS, NOTION_REQUIRES, PAGE_MARKDOWN_GET_OPERATION, notionAuthorize, notionFaker, notionPageMarkdownGet } from './chunk-R5NZJO57.js';
2
+ //# sourceMappingURL=index.js.map
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
package/package.json ADDED
@@ -0,0 +1,88 @@
1
+ {
2
+ "name": "@particle-academy/notion-js",
3
+ "version": "0.1.0",
4
+ "description": "Notion for Node — the service descriptor, its faker, its webhook verification, and one function per operation. Plain HTTP on @particle-academy/fancy-connector-core; no vendor SDK.",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/Fancy-Friends/notion.git"
8
+ },
9
+ "homepage": "https://github.com/Fancy-Friends/notion#readme",
10
+ "bugs": "https://github.com/Fancy-Friends/notion/issues",
11
+ "type": "module",
12
+ "main": "./dist/index.cjs",
13
+ "module": "./dist/index.js",
14
+ "types": "./dist/index.d.ts",
15
+ "exports": {
16
+ ".": {
17
+ "import": {
18
+ "types": "./dist/index.d.ts",
19
+ "default": "./dist/index.js"
20
+ },
21
+ "require": {
22
+ "types": "./dist/index.d.cts",
23
+ "default": "./dist/index.cjs"
24
+ }
25
+ },
26
+ "./flow": {
27
+ "import": {
28
+ "types": "./dist/flow.d.ts",
29
+ "default": "./dist/flow.js"
30
+ },
31
+ "require": {
32
+ "types": "./dist/flow.d.cts",
33
+ "default": "./dist/flow.cjs"
34
+ }
35
+ },
36
+ "./package.json": "./package.json"
37
+ },
38
+ "files": [
39
+ "dist",
40
+ "README.md",
41
+ "CHANGELOG.md",
42
+ "LICENSE"
43
+ ],
44
+ "scripts": {
45
+ "build": "tsup",
46
+ "lint": "tsc --noEmit",
47
+ "test": "node --import tsx --test tests/*.test.ts",
48
+ "prepublishOnly": "tsup"
49
+ },
50
+ "dependencies": {
51
+ "@particle-academy/fancy-connector-core": ">=0.3.1 <2.0"
52
+ },
53
+ "peerDependencies": {
54
+ "@particle-academy/fancy-flow": ">=0.47.1 <2.0",
55
+ "@particle-academy/notion-ui": ">=0.1.0 <0.2.0"
56
+ },
57
+ "peerDependenciesMeta": {
58
+ "@particle-academy/fancy-flow": {
59
+ "optional": true
60
+ },
61
+ "@particle-academy/notion-ui": {
62
+ "optional": true
63
+ }
64
+ },
65
+ "devDependencies": {
66
+ "@particle-academy/fancy-flow": ">=0.47.1 <2.0",
67
+ "@types/node": "^26.2.0",
68
+ "tsup": "^8.5.0",
69
+ "tsx": "^4.19.0",
70
+ "typescript": "^5.8.0"
71
+ },
72
+ "publishConfig": {
73
+ "access": "public"
74
+ },
75
+ "keywords": [
76
+ "notion",
77
+ "productivity",
78
+ "connector",
79
+ "api",
80
+ "fancy-ui",
81
+ "particle-academy"
82
+ ],
83
+ "license": "MIT",
84
+ "sideEffects": false,
85
+ "engines": {
86
+ "node": ">=22"
87
+ }
88
+ }