@keystrokehq/notion 0.0.15 → 0.0.16-integration-id-canonicalization.1

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.
Files changed (48) hide show
  1. package/README.md +24 -87
  2. package/dist/credential-sets/index.d.mts +2 -0
  3. package/dist/credential-sets/index.mjs +4 -0
  4. package/dist/index.d.mts +5 -1
  5. package/dist/index.mjs +7 -1
  6. package/dist/notion-webhook.credential-set-5tXWld_L.d.mts +53 -0
  7. package/dist/notion-webhook.credential-set-D_tczh8M.mjs +25 -0
  8. package/dist/notion.credential-set-BfA-EG9z.mjs +44 -0
  9. package/dist/operations/index.d.mts +1104 -0
  10. package/dist/operations/index.mjs +32 -0
  11. package/dist/{schemas.d.mts → schemas/index.d.mts} +99 -65
  12. package/dist/schemas/index.mjs +3 -0
  13. package/dist/{schemas.mjs → search-D4wvUAjS.mjs} +106 -63
  14. package/dist/update-page.operation-6lf05oVs.d.mts +1147 -0
  15. package/dist/update-page.operation-BQWJrCll.mjs +794 -0
  16. package/package.json +13 -61
  17. package/dist/_official/index.d.mts +0 -33
  18. package/dist/_official/index.mjs +0 -3
  19. package/dist/_runtime/index.d.mts +0 -551
  20. package/dist/_runtime/index.mjs +0 -37
  21. package/dist/blocks.d.mts +0 -114
  22. package/dist/blocks.mjs +0 -104
  23. package/dist/client.d.mts +0 -22
  24. package/dist/client.mjs +0 -95
  25. package/dist/comments.d.mts +0 -102
  26. package/dist/comments.mjs +0 -78
  27. package/dist/connection.d.mts +0 -2
  28. package/dist/connection.mjs +0 -3
  29. package/dist/data-sources.d.mts +0 -119
  30. package/dist/data-sources.mjs +0 -117
  31. package/dist/events.d.mts +0 -80
  32. package/dist/events.mjs +0 -99
  33. package/dist/factory-BmLNLbSq.mjs +0 -8
  34. package/dist/integration--FJUCgRj.d.mts +0 -24
  35. package/dist/integration-xFeJVYim.mjs +0 -60
  36. package/dist/messaging.d.mts +0 -1
  37. package/dist/messaging.mjs +0 -1
  38. package/dist/pages.d.mts +0 -156
  39. package/dist/pages.mjs +0 -208
  40. package/dist/search.d.mts +0 -42
  41. package/dist/search.mjs +0 -44
  42. package/dist/shared-C6A6JPl3.mjs +0 -43
  43. package/dist/triggers.d.mts +0 -48
  44. package/dist/triggers.mjs +0 -172
  45. package/dist/users.d.mts +0 -45
  46. package/dist/users.mjs +0 -52
  47. package/dist/verification.d.mts +0 -18
  48. package/dist/verification.mjs +0 -24
package/README.md CHANGED
@@ -1,110 +1,47 @@
1
1
  # `@keystrokehq/notion`
2
2
 
3
- Official Notion integration for Keystroke.
3
+ Official Notion integration for Keystroke. The package follows Playbook 17 canonical shape: credential sets, one operation per file, domain schemas, and utilities. Provider-app seed metadata remains under `src/provider-apps/` until the provider-app primitive refactor lands (`strict`).
4
4
 
5
5
  ## Import Paths
6
6
 
7
- Use explicit subpath imports. The package root is intentionally non-canonical.
7
+ Use the canonical barrels:
8
8
 
9
9
  ```ts
10
- import { notion } from '@keystrokehq/notion/connection';
11
- import { copyPageContent, createPage, getPage } from '@keystrokehq/notion/pages';
12
- import { listBlockChildren } from '@keystrokehq/notion/blocks';
13
- import { queryDataSource } from '@keystrokehq/notion/data-sources';
14
- import { listComments, createComment } from '@keystrokehq/notion/comments';
15
- import { getMe, listUsers } from '@keystrokehq/notion/users';
16
- import { searchWorkspace } from '@keystrokehq/notion/search';
17
- import { webhooks, polling } from '@keystrokehq/notion/triggers';
10
+ import { notionCredentialSet } from '@keystrokehq/notion/credential-sets';
11
+ import { createPage, getPage, searchWorkspace } from '@keystrokehq/notion/operations';
12
+ import { notionPageSchema } from '@keystrokehq/notion/schemas';
18
13
  ```
19
14
 
20
- ## Connection Model
21
-
22
- The public connection surface normalizes two auth paths into the same runtime credential shape:
23
-
24
- - OAuth connection through Keystroke-managed Notion public integrations
25
- - Manual internal-integration token entry
26
-
27
- Both resolve to:
15
+ Official provider seed descriptor (catalog only):
28
16
 
29
17
  ```ts
30
- {
31
- NOTION_ACCESS_TOKEN: string;
32
- }
18
+ import { notionOfficialProviderSeed } from 'catalog discovery via `src/provider-apps/`';
33
19
  ```
34
20
 
35
- In practice:
36
-
37
- - OAuth is the default path when users run `keystroke connect notion`
38
- - Manual token entry is for internal Notion integrations that already have a bearer token
39
-
40
- ## Core Surfaces
41
-
42
- - `pages`: page reads, property reads, create, content copy, updates, trash, restore
43
- - `blocks`: block reads, child listing, append, update, delete
44
- - `data-sources`: canonical data-source discovery and query flows
45
- - `comments`: page comments and discussion replies
46
- - `users`: `me`, single-user lookup, workspace user listing
47
- - `search`: workspace-wide page and data-source discovery
48
- - `triggers`: webhook-first direct bindings plus polling parity helpers
49
-
50
- `data_source` is the canonical runtime model in this package. Database discovery is still available for the upgrade path, but author-facing operations prefer `data_source` IDs over legacy database query endpoints.
51
-
52
- For duplication-style workflows, pair `createPage` with `copyPageContent`. The helper recreates supported block trees level by level so it stays inside Notion's append limits. Pages containing API-unsupported block types such as `child_page`, `child_database`, or `link_preview` should use a template-driven flow instead.
53
-
54
- ## Trigger Examples
55
-
56
- ```ts
57
- import { webhooks, polling } from '@keystrokehq/notion/triggers';
58
-
59
- const pageCreated = webhooks.pageCreated({
60
- name: 'Notion Page Created',
61
- transform: (event) => ({
62
- pageId: event.entityId,
63
- eventType: event.eventType,
64
- }),
65
- });
66
-
67
- const pageUpdated = polling.pageUpdated({
68
- name: 'Notion Page Updated',
69
- pageId: 'notion-page-id',
70
- schedule: '*/10 * * * *',
71
- });
72
- ```
21
+ ## Connection Model
73
22
 
74
- Webhook bindings emit metadata-first payloads. They intentionally do not auto-hydrate full Notion objects. Use the page, comment, or data-source operations to fetch current state when the workflow needs it.
23
+ The user credential set (`notion`) normalizes two auth paths into the same runtime shape:
75
24
 
76
- ## Platform Admin Setup
25
+ - **Public integration (OAuth)** — workspace-level scopes configured on the Notion app; authorize URL omits `scope` and sets `owner=user`.
26
+ - **Internal integration (manual)** — static integration secret mapped to `NOTION_ACCESS_TOKEN`.
77
27
 
78
- Notion webhook subscriptions are configured in Notion, not through the public API. A Keystroke platform admin must complete the bootstrap:
28
+ Both resolve to `{ NOTION_ACCESS_TOKEN: string }` at runtime via `context.credentials.notion` in operations.
79
29
 
80
- 1. Create or update the Keystroke-managed Notion public integration in Notion.
81
- 2. Enable the minimum capabilities the shipped surface expects:
82
- - Read content
83
- - Insert content
84
- - Update content
85
- - Read comment
86
- - Insert comment
87
- - User information
88
- 3. Configure the OAuth redirect URL to Keystroke's `/api/v1/connections/callback`.
89
- 4. Configure the webhook destination URL to Keystroke's `/api/v1/webhooks/{orgId}/notion`.
90
- 5. Store the Notion OAuth app credentials in the internal `notion-app` credential set.
91
- 6. Store the Notion webhook verification token in the internal `notion-webhook` credential set.
30
+ Platform-only credential sets (`notion-app`, `notion-webhook`) live in `src/credential-sets/` with `exposure: 'platform-only'`.
92
31
 
93
- ## Provider Caveats
32
+ ## API Version
94
33
 
95
- - Notion OAuth is provider-specific. The Keystroke server uses a Notion-specific auth URL builder and token exchange flow instead of the generic OAuth strategy.
96
- - Notion webhook payloads are sparse. Event IDs, entity IDs, authors, and event metadata are the contract; workflows should fetch fresh objects when they need content.
97
- - Notion write operations are approval-gated by default.
34
+ `src/utils/client.ts` pins `Notion-Version: 2026-03-11` (`NOTION_API_VERSION`) on every SDK request.
98
35
 
99
- ## Testing
36
+ ## Schema Layout
100
37
 
101
- - **Coverage map:** See [`TEST_MATRIX.md`](./TEST_MATRIX.md) for the full list of operations, webhook/polling triggers, and credential/server boundaries and what each must prove (success, failure, safety, live).
102
- - **Unit / contract:** `pnpm test:unit` — exercises `.run()` paths with mocked `@notionhq/client`, triggers, client helpers, events, verification, and schemas.
103
- - **Live Notion (`test:int`):** `pnpm test:int` — package-level integration suites in `*.int.test.ts`. Credentials follow a two-tier waterfall via the shared `resolveLiveCredentialsForCredentialSet` helper from `@keystrokehq/test-utils`:
104
- 1. **Env vars (CI-friendly):** `NOTION_TEST_ACCESS_TOKEN` or `NOTION_TEST_INTEGRATION_TOKEN` in `.env.test`.
105
- 2. **Saved Keystroke connection (recommended for local dev):** run `pnpm cli auth` + `pnpm cli connect notion` once. The suites then resolve credentials from the Keystroke server (`POST /api/v1/credentials/resolve`), so any OAuth refresh happens server-side and tests never touch the refresh token.
38
+ Shared parent/list helpers and block-related normalization live in `src/schemas/common.ts`. Resource-specific schemas are split deliberately because Notion’s block model is recursive:
106
39
 
107
- **Sandbox parent page is auto-discovered.** The integration test harness calls Notion's search API in `beforeAll` to pick the first page the integration has access to as the sandbox parent. Just share at least one page with your Notion integration (during the OAuth consent, or later via the page share menu) and the page/block/comment/trigger suites will run end-to-end. Set `NOTION_TEST_PARENT_PAGE_ID` to pin a specific page (recommended in CI for deterministic runs).
40
+ - `pages.ts` page and page-property-item shapes
41
+ - `blocks.ts` — block normalization (typed `value` per block type)
42
+ - `databases.ts` — data sources and database discovery
43
+ - `comments.ts` — comments and comment targets
44
+ - `users.ts` — workspace users
45
+ - `search.ts` — workspace search results
108
46
 
109
- Other fixture IDs (`NOTION_TEST_DATA_SOURCE_ID`, `NOTION_TEST_PAGE_ID`, `NOTION_TEST_PAGE_PROPERTY_ID`, etc.) remain opt-in env overrides; tests that need them `it.skipIf` out cleanly when they are absent. Full list in the root [`.env.test.example`](../../../.env.test.example). Without credentials, the suites skip the whole suite with a warning — no flag flipping required.
110
- - **Server OAuth:** Database-backed routes are covered under `@keystroke/server` (`connections/.../initiate`, `connections/callback`). Run `turbo run test:int --filter=@keystroke/server` with a local Postgres (see root `.env.test.example`).
47
+ Triggers and webhook event schemas remain under `src/triggers/` and `src/events/` (allowed strict folders).
@@ -0,0 +1,2 @@
1
+ import { a as NotionCredentials, i as notionAppCredentialSet, n as notionWebhookCredentialSet, o as notionCredentialSet, r as NotionAppCredentials, t as NotionWebhookCredentials } from "../notion-webhook.credential-set-5tXWld_L.mjs";
2
+ export { type NotionAppCredentials, type NotionCredentials, type NotionWebhookCredentials, notionAppCredentialSet, notionCredentialSet, notionWebhookCredentialSet };
@@ -0,0 +1,4 @@
1
+ import { t as notionCredentialSet } from "../notion.credential-set-BfA-EG9z.mjs";
2
+ import { n as notionAppCredentialSet, t as notionWebhookCredentialSet } from "../notion-webhook.credential-set-D_tczh8M.mjs";
3
+
4
+ export { notionAppCredentialSet, notionCredentialSet, notionWebhookCredentialSet };
package/dist/index.d.mts CHANGED
@@ -1 +1,5 @@
1
- export { };
1
+ import { a as NotionCredentials, i as notionAppCredentialSet, n as notionWebhookCredentialSet, o as notionCredentialSet, r as NotionAppCredentials, t as NotionWebhookCredentials } from "./notion-webhook.credential-set-5tXWld_L.mjs";
2
+ import { C as copyPageContentOperation, S as createCommentOperation, _ as getBlockOperation, a as searchWorkspaceOperation, b as createPageOperation, c as listUsersOperation, d as getUserOperation, f as getPagePropertyOperation, g as getCommentOperation, h as getDataSourceOperation, i as trashPageOperation, l as listCommentsOperation, m as getMeOperation, n as updateDataSourceEntryOperation, o as restorePageOperation, p as getPageOperation, r as updateBlockOperation, s as queryDataSourceOperation, t as updatePageOperation, u as listBlockChildrenOperation, v as discoverDatabaseDataSourcesOperation, w as appendBlockChildrenOperation, x as createDataSourceEntryOperation, y as deleteBlockOperation } from "./update-page.operation-6lf05oVs.mjs";
3
+ import { notionOperations } from "./operations/index.mjs";
4
+ import { NotionBlock, NotionComment, NotionDataSource, NotionListMeta, NotionPage, NotionPagePropertyItem, NotionParent, NotionSearchResult, NotionUser, asBoolean, asRecord, asString, commentTargetSchema, databaseDiscoverySchema, extractTextContent, firstPropertyText, normalizeBlock, normalizeComment, normalizeDataSource, normalizeListMeta, normalizePage, normalizePagePropertyItem, normalizeParent, normalizeSearchResult, normalizeUser, notionBlockSchema, notionCommentSchema, notionDataSourceSchema, notionListMetaSchema, notionListResponseSchema, notionPagePropertyItemSchema, notionPageSchema, notionParentSchema, notionSearchResultSchema, notionSuccessResponseSchema, notionUserSchema, pageParentInputSchema } from "./schemas/index.mjs";
5
+ export { NotionAppCredentials, NotionBlock, NotionComment, NotionCredentials, NotionDataSource, NotionListMeta, NotionPage, NotionPagePropertyItem, NotionParent, NotionSearchResult, NotionUser, NotionWebhookCredentials, appendBlockChildrenOperation as appendBlockChildren, appendBlockChildrenOperation, appendBlockChildrenOperation as appendBlockChildrenTool, asBoolean, asRecord, asString, commentTargetSchema, copyPageContentOperation as copyPageContent, copyPageContentOperation, copyPageContentOperation as copyPageContentTool, createCommentOperation as createComment, createCommentOperation, createCommentOperation as createCommentTool, createDataSourceEntryOperation as createDataSourceEntry, createDataSourceEntryOperation, createDataSourceEntryOperation as createDataSourceEntryTool, createPageOperation as createPage, createPageOperation, createPageOperation as createPageTool, databaseDiscoverySchema, deleteBlockOperation as deleteBlock, deleteBlockOperation, deleteBlockOperation as deleteBlockTool, discoverDatabaseDataSourcesOperation as discoverDatabaseDataSources, discoverDatabaseDataSourcesOperation, discoverDatabaseDataSourcesOperation as discoverDatabaseDataSourcesTool, extractTextContent, firstPropertyText, getBlockOperation as getBlock, getBlockOperation, getBlockOperation as getBlockTool, getCommentOperation as getComment, getCommentOperation, getCommentOperation as getCommentTool, getDataSourceOperation as getDataSource, getDataSourceOperation, getDataSourceOperation as getDataSourceTool, getMeOperation as getMe, getMeOperation, getMeOperation as getMeTool, getPageOperation as getPage, getPageOperation, getPageOperation as getPageTool, getPagePropertyOperation as getPageProperty, getPagePropertyOperation, getPagePropertyOperation as getPagePropertyTool, getUserOperation as getUser, getUserOperation, getUserOperation as getUserTool, listBlockChildrenOperation as listBlockChildren, listBlockChildrenOperation, listBlockChildrenOperation as listBlockChildrenTool, listCommentsOperation as listComments, listCommentsOperation, listCommentsOperation as listCommentsTool, listUsersOperation as listUsers, listUsersOperation, listUsersOperation as listUsersTool, normalizeBlock, normalizeComment, normalizeDataSource, normalizeListMeta, normalizePage, normalizePagePropertyItem, normalizeParent, normalizeSearchResult, normalizeUser, notionAppCredentialSet, notionBlockSchema, notionCommentSchema, notionCredentialSet, notionDataSourceSchema, notionListMetaSchema, notionListResponseSchema, notionOperations, notionPagePropertyItemSchema, notionPageSchema, notionParentSchema, notionSearchResultSchema, notionSuccessResponseSchema, notionUserSchema, notionWebhookCredentialSet, pageParentInputSchema, queryDataSourceOperation as queryDataSource, queryDataSourceOperation, queryDataSourceOperation as queryDataSourceTool, restorePageOperation as restorePage, restorePageOperation, restorePageOperation as restorePageTool, searchWorkspaceOperation as searchWorkspace, searchWorkspaceOperation, searchWorkspaceOperation as searchWorkspaceTool, trashPageOperation as trashPage, trashPageOperation, trashPageOperation as trashPageTool, updateBlockOperation as updateBlock, updateBlockOperation, updateBlockOperation as updateBlockTool, updateDataSourceEntryOperation as updateDataSourceEntry, updateDataSourceEntryOperation, updateDataSourceEntryOperation as updateDataSourceEntryTool, updatePageOperation as updatePage, updatePageOperation, updatePageOperation as updatePageTool };
package/dist/index.mjs CHANGED
@@ -1 +1,7 @@
1
- export { };
1
+ import { t as notionCredentialSet } from "./notion.credential-set-BfA-EG9z.mjs";
2
+ import { n as notionAppCredentialSet, t as notionWebhookCredentialSet } from "./notion-webhook.credential-set-D_tczh8M.mjs";
3
+ import { C as normalizeListMeta, D as notionParentSchema, E as notionListResponseSchema, O as notionSuccessResponseSchema, S as firstPropertyText, T as notionListMetaSchema, _ as notionUserSchema, a as notionDataSourceSchema, b as asString, c as normalizePage, d as notionPageSchema, f as pageParentInputSchema, g as normalizeUser, h as notionCommentSchema, i as normalizeDataSource, l as normalizePagePropertyItem, m as normalizeComment, n as notionSearchResultSchema, o as normalizeBlock, p as commentTargetSchema, r as databaseDiscoverySchema, s as notionBlockSchema, t as normalizeSearchResult, u as notionPagePropertyItemSchema, v as asBoolean, w as normalizeParent, x as extractTextContent, y as asRecord } from "./search-D4wvUAjS.mjs";
4
+ import { C as copyPageContentOperation, S as createCommentOperation, _ as getBlockOperation, a as searchWorkspaceOperation, b as createPageOperation, c as listUsersOperation, d as getUserOperation, f as getPagePropertyOperation, g as getCommentOperation, h as getDataSourceOperation, i as trashPageOperation, l as listCommentsOperation, m as getMeOperation, n as updateDataSourceEntryOperation, o as restorePageOperation, p as getPageOperation, r as updateBlockOperation, s as queryDataSourceOperation, t as updatePageOperation, u as listBlockChildrenOperation, v as discoverDatabaseDataSourcesOperation, w as appendBlockChildrenOperation, x as createDataSourceEntryOperation, y as deleteBlockOperation } from "./update-page.operation-BQWJrCll.mjs";
5
+ import { notionOperations } from "./operations/index.mjs";
6
+
7
+ export { appendBlockChildrenOperation as appendBlockChildren, appendBlockChildrenOperation, appendBlockChildrenOperation as appendBlockChildrenTool, asBoolean, asRecord, asString, commentTargetSchema, copyPageContentOperation as copyPageContent, copyPageContentOperation, copyPageContentOperation as copyPageContentTool, createCommentOperation as createComment, createCommentOperation, createCommentOperation as createCommentTool, createDataSourceEntryOperation as createDataSourceEntry, createDataSourceEntryOperation, createDataSourceEntryOperation as createDataSourceEntryTool, createPageOperation as createPage, createPageOperation, createPageOperation as createPageTool, databaseDiscoverySchema, deleteBlockOperation as deleteBlock, deleteBlockOperation, deleteBlockOperation as deleteBlockTool, discoverDatabaseDataSourcesOperation as discoverDatabaseDataSources, discoverDatabaseDataSourcesOperation, discoverDatabaseDataSourcesOperation as discoverDatabaseDataSourcesTool, extractTextContent, firstPropertyText, getBlockOperation as getBlock, getBlockOperation, getBlockOperation as getBlockTool, getCommentOperation as getComment, getCommentOperation, getCommentOperation as getCommentTool, getDataSourceOperation as getDataSource, getDataSourceOperation, getDataSourceOperation as getDataSourceTool, getMeOperation as getMe, getMeOperation, getMeOperation as getMeTool, getPageOperation as getPage, getPageOperation, getPageOperation as getPageTool, getPagePropertyOperation as getPageProperty, getPagePropertyOperation, getPagePropertyOperation as getPagePropertyTool, getUserOperation as getUser, getUserOperation, getUserOperation as getUserTool, listBlockChildrenOperation as listBlockChildren, listBlockChildrenOperation, listBlockChildrenOperation as listBlockChildrenTool, listCommentsOperation as listComments, listCommentsOperation, listCommentsOperation as listCommentsTool, listUsersOperation as listUsers, listUsersOperation, listUsersOperation as listUsersTool, normalizeBlock, normalizeComment, normalizeDataSource, normalizeListMeta, normalizePage, normalizePagePropertyItem, normalizeParent, normalizeSearchResult, normalizeUser, notionAppCredentialSet, notionBlockSchema, notionCommentSchema, notionCredentialSet, notionDataSourceSchema, notionListMetaSchema, notionListResponseSchema, notionOperations, notionPagePropertyItemSchema, notionPageSchema, notionParentSchema, notionSearchResultSchema, notionSuccessResponseSchema, notionUserSchema, notionWebhookCredentialSet, pageParentInputSchema, queryDataSourceOperation as queryDataSource, queryDataSourceOperation, queryDataSourceOperation as queryDataSourceTool, restorePageOperation as restorePage, restorePageOperation, restorePageOperation as restorePageTool, searchWorkspaceOperation as searchWorkspace, searchWorkspaceOperation, searchWorkspaceOperation as searchWorkspaceTool, trashPageOperation as trashPage, trashPageOperation, trashPageOperation as trashPageTool, updateBlockOperation as updateBlock, updateBlockOperation, updateBlockOperation as updateBlockTool, updateDataSourceEntryOperation as updateDataSourceEntry, updateDataSourceEntryOperation, updateDataSourceEntryOperation as updateDataSourceEntryTool, updatePageOperation as updatePage, updatePageOperation, updatePageOperation as updatePageTool };
@@ -0,0 +1,53 @@
1
+ import { CredentialSet } from "@keystrokehq/core";
2
+ import { z } from "zod";
3
+ import * as _keystrokehq_core_credential_set0 from "@keystrokehq/core/credential-set";
4
+ import { InferCredentialSetAuth } from "@keystrokehq/core/credential-set";
5
+
6
+ //#region src/credential-sets/notion.credential-set.d.ts
7
+ declare const notionCredentialSet: CredentialSet<"notion", z.ZodObject<{
8
+ NOTION_ACCESS_TOKEN: z.ZodString;
9
+ }, z.core.$strip>, ({
10
+ kind: "oauth";
11
+ tokenType: "refreshable";
12
+ authUrl: "https://api.notion.com/v1/oauth/authorize";
13
+ tokenUrl: "https://api.notion.com/v1/oauth/token";
14
+ revokeUrl: "https://api.notion.com/v1/oauth/revoke";
15
+ scopes: readonly ["content:read", "content:write", "comments:read", "comments:write", "users:read"];
16
+ vault: {
17
+ readonly accessToken: "NOTION_ACCESS_TOKEN";
18
+ };
19
+ id: string;
20
+ label: string;
21
+ recommended: true;
22
+ advanced?: undefined;
23
+ input?: undefined;
24
+ } | {
25
+ id: string;
26
+ kind: "manual";
27
+ label: string;
28
+ advanced: true;
29
+ input: z.ZodObject<{
30
+ NOTION_ACCESS_TOKEN: z.ZodString;
31
+ }, z.core.$strip>;
32
+ })[]>;
33
+ type NotionCredentials = InferCredentialSetAuth<typeof notionCredentialSet>;
34
+ //#endregion
35
+ //#region src/credential-sets/notion-app.credential-set.d.ts
36
+ declare const notionAppCredentialSet: CredentialSet<"notion-app", z.ZodObject<{
37
+ clientId: z.ZodString;
38
+ clientSecret: z.ZodString;
39
+ }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
40
+ clientId: z.ZodString;
41
+ clientSecret: z.ZodString;
42
+ }, z.core.$strip>>[] | undefined>;
43
+ type NotionAppCredentials = InferCredentialSetAuth<typeof notionAppCredentialSet>;
44
+ //#endregion
45
+ //#region src/credential-sets/notion-webhook.credential-set.d.ts
46
+ declare const notionWebhookCredentialSet: CredentialSet<"notion-webhook", z.ZodObject<{
47
+ verificationToken: z.ZodString;
48
+ }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
49
+ verificationToken: z.ZodString;
50
+ }, z.core.$strip>>[] | undefined>;
51
+ type NotionWebhookCredentials = InferCredentialSetAuth<typeof notionWebhookCredentialSet>;
52
+ //#endregion
53
+ export { NotionCredentials as a, notionAppCredentialSet as i, notionWebhookCredentialSet as n, notionCredentialSet as o, NotionAppCredentials as r, NotionWebhookCredentials as t };
@@ -0,0 +1,25 @@
1
+ import { CredentialSet } from "@keystrokehq/core";
2
+ import { z } from "zod";
3
+
4
+ //#region src/credential-sets/notion-app.credential-set.ts
5
+ const notionAppCredentialSet = new CredentialSet({
6
+ id: "notion-app",
7
+ exposure: "platform-only",
8
+ name: "Notion App",
9
+ auth: z.object({
10
+ clientId: z.string().min(1),
11
+ clientSecret: z.string().min(1)
12
+ })
13
+ });
14
+
15
+ //#endregion
16
+ //#region src/credential-sets/notion-webhook.credential-set.ts
17
+ const notionWebhookCredentialSet = new CredentialSet({
18
+ id: "notion-webhook",
19
+ exposure: "platform-only",
20
+ name: "Notion Webhook",
21
+ auth: z.object({ verificationToken: z.string().min(1) })
22
+ });
23
+
24
+ //#endregion
25
+ export { notionAppCredentialSet as n, notionWebhookCredentialSet as t };
@@ -0,0 +1,44 @@
1
+ import { CredentialSet } from "@keystrokehq/core";
2
+ import { z } from "zod";
3
+
4
+ //#region src/utils/oauth-connection.ts
5
+ const notionOAuthConnection = {
6
+ kind: "oauth",
7
+ tokenType: "refreshable",
8
+ authUrl: "https://api.notion.com/v1/oauth/authorize",
9
+ tokenUrl: "https://api.notion.com/v1/oauth/token",
10
+ revokeUrl: "https://api.notion.com/v1/oauth/revoke",
11
+ scopes: [
12
+ "content:read",
13
+ "content:write",
14
+ "comments:read",
15
+ "comments:write",
16
+ "users:read"
17
+ ],
18
+ vault: { accessToken: "NOTION_ACCESS_TOKEN" }
19
+ };
20
+
21
+ //#endregion
22
+ //#region src/credential-sets/notion.credential-set.ts
23
+ const notionAuthSchema = z.object({ NOTION_ACCESS_TOKEN: z.string().min(1) });
24
+ const notionCredentialSet = new CredentialSet({
25
+ id: "notion",
26
+ name: "Notion",
27
+ description: "Notion pages, blocks, data sources, comments, users, search, and triggers",
28
+ auth: notionAuthSchema,
29
+ connections: [{
30
+ id: "oauth",
31
+ label: "Connect Notion workspace",
32
+ recommended: true,
33
+ ...notionOAuthConnection
34
+ }, {
35
+ id: "integration-token",
36
+ kind: "manual",
37
+ label: "Use internal integration token",
38
+ advanced: true,
39
+ input: notionAuthSchema
40
+ }]
41
+ });
42
+
43
+ //#endregion
44
+ export { notionCredentialSet as t };