@keystrokehq/notion 0.0.10 → 0.0.11

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/dist/pages.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { z } from "zod";
2
1
  import * as _keystrokehq_core0 from "@keystrokehq/core";
2
+ import { z } from "zod";
3
3
  import * as _keystrokehq_core_credential_set0 from "@keystrokehq/core/credential-set";
4
4
 
5
5
  //#region src/pages.d.ts
@@ -23,7 +23,7 @@ declare const getPage: _keystrokehq_core0.Operation<z.ZodObject<{
23
23
  workspace: z.ZodOptional<z.ZodBoolean>;
24
24
  }, z.core.$strip>>;
25
25
  properties: z.ZodRecord<z.ZodString, z.ZodUnknown>;
26
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:notion", z.ZodObject<{
26
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"notion", z.ZodObject<{
27
27
  NOTION_ACCESS_TOKEN: z.ZodString;
28
28
  }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
29
29
  NOTION_ACCESS_TOKEN: z.ZodString;
@@ -55,7 +55,7 @@ declare const createPage: _keystrokehq_core0.Operation<z.ZodObject<{
55
55
  workspace: z.ZodOptional<z.ZodBoolean>;
56
56
  }, z.core.$strip>>;
57
57
  properties: z.ZodRecord<z.ZodString, z.ZodUnknown>;
58
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:notion", z.ZodObject<{
58
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"notion", z.ZodObject<{
59
59
  NOTION_ACCESS_TOKEN: z.ZodString;
60
60
  }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
61
61
  NOTION_ACCESS_TOKEN: z.ZodString;
@@ -85,7 +85,7 @@ declare const updatePage: _keystrokehq_core0.Operation<z.ZodObject<{
85
85
  workspace: z.ZodOptional<z.ZodBoolean>;
86
86
  }, z.core.$strip>>;
87
87
  properties: z.ZodRecord<z.ZodString, z.ZodUnknown>;
88
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:notion", z.ZodObject<{
88
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"notion", z.ZodObject<{
89
89
  NOTION_ACCESS_TOKEN: z.ZodString;
90
90
  }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
91
91
  NOTION_ACCESS_TOKEN: z.ZodString;
@@ -95,7 +95,7 @@ declare const copyPageContent: _keystrokehq_core0.Operation<z.ZodObject<{
95
95
  targetPageId: z.ZodString;
96
96
  }, z.core.$strip>, z.ZodObject<{
97
97
  success: z.ZodLiteral<true>;
98
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:notion", z.ZodObject<{
98
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"notion", z.ZodObject<{
99
99
  NOTION_ACCESS_TOKEN: z.ZodString;
100
100
  }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
101
101
  NOTION_ACCESS_TOKEN: z.ZodString;
@@ -120,7 +120,7 @@ declare const trashPage: _keystrokehq_core0.Operation<z.ZodObject<{
120
120
  workspace: z.ZodOptional<z.ZodBoolean>;
121
121
  }, z.core.$strip>>;
122
122
  properties: z.ZodRecord<z.ZodString, z.ZodUnknown>;
123
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:notion", z.ZodObject<{
123
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"notion", z.ZodObject<{
124
124
  NOTION_ACCESS_TOKEN: z.ZodString;
125
125
  }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
126
126
  NOTION_ACCESS_TOKEN: z.ZodString;
@@ -137,7 +137,7 @@ declare const getPageProperty: _keystrokehq_core0.Operation<z.ZodObject<{
137
137
  value: z.ZodUnknown;
138
138
  nextCursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
139
139
  hasMore: z.ZodOptional<z.ZodBoolean>;
140
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:notion", z.ZodObject<{
140
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"notion", z.ZodObject<{
141
141
  NOTION_ACCESS_TOKEN: z.ZodString;
142
142
  }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
143
143
  NOTION_ACCESS_TOKEN: z.ZodString;
@@ -162,7 +162,7 @@ declare const restorePage: _keystrokehq_core0.Operation<z.ZodObject<{
162
162
  workspace: z.ZodOptional<z.ZodBoolean>;
163
163
  }, z.core.$strip>>;
164
164
  properties: z.ZodRecord<z.ZodString, z.ZodUnknown>;
165
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:notion", z.ZodObject<{
165
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"notion", z.ZodObject<{
166
166
  NOTION_ACCESS_TOKEN: z.ZodString;
167
167
  }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
168
168
  NOTION_ACCESS_TOKEN: z.ZodString;
package/dist/pages.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { NOTION_MAX_BLOCK_CHILDREN_PER_REQUEST, appendBlockChildrenAndReturnResults, chunkArray, createNotionClient, listAllPaginatedResults, withRateLimitRetry } from "./client.mjs";
2
2
  import { normalizePage, normalizePagePropertyItem, notionPagePropertyItemSchema, notionPageSchema, notionSuccessResponseSchema } from "./schemas.mjs";
3
- import { t as notionOperation } from "./factory-BFy8QmFf.mjs";
4
- import { i as buildPlainTextRichText, n as buildPageParent, r as buildPaginationInput } from "./shared-C6A6JPl3.mjs";
3
+ import { t as notionOperation } from "./factory-Dw2V3rrS.mjs";
4
+ import { i as buildPlainTextRichText, n as buildPageParent, r as buildPaginationInput } from "./shared-DwBtvjix.mjs";
5
5
  import { z } from "zod";
6
6
 
7
7
  //#region src/pages.ts
package/dist/search.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { z } from "zod";
2
1
  import * as _keystrokehq_core0 from "@keystrokehq/core";
2
+ import { z } from "zod";
3
3
  import * as _keystrokehq_core_credential_set0 from "@keystrokehq/core/credential-set";
4
4
 
5
5
  //#region src/search.d.ts
@@ -36,7 +36,7 @@ declare const searchWorkspace: _keystrokehq_core0.Operation<z.ZodObject<{
36
36
  }, z.core.$strip>>;
37
37
  hasMore: z.ZodBoolean;
38
38
  nextCursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
39
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:notion", z.ZodObject<{
39
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"notion", z.ZodObject<{
40
40
  NOTION_ACCESS_TOKEN: z.ZodString;
41
41
  }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
42
42
  NOTION_ACCESS_TOKEN: z.ZodString;
package/dist/search.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { createNotionClient, withRateLimitRetry } from "./client.mjs";
2
2
  import { normalizeListMeta, normalizeSearchResult, notionListResponseSchema, notionSearchResultSchema } from "./schemas.mjs";
3
- import { t as notionOperation } from "./factory-BFy8QmFf.mjs";
3
+ import { t as notionOperation } from "./factory-Dw2V3rrS.mjs";
4
4
  import { z } from "zod";
5
5
 
6
6
  //#region src/search.ts
@@ -1,7 +1,6 @@
1
- import { n as notion } from "./integration-D12eY2r0.mjs";
1
+ import { n as notion } from "./integration-Bc-B-wPX.mjs";
2
+ import { BoundTrigger, Operation } from "@keystrokehq/core";
2
3
  import { z } from "zod";
3
- import { BoundTrigger } from "@keystrokehq/core";
4
- import { IntegrationTriggerBindingOptions } from "@keystrokehq/integration-authoring";
5
4
  import { PollingTriggerManifest } from "@keystrokehq/core/trigger";
6
5
 
7
6
  //#region src/triggers.d.ts
package/dist/triggers.mjs CHANGED
@@ -1,8 +1,8 @@
1
- import { t as notion } from "./integration-BdUbYCu5.mjs";
1
+ import { t as notion } from "./integration-Dqf1rNJ6.mjs";
2
+ import { n as createPollingTriggerBindingFactory } from "./dist-Bbp6t-WQ.mjs";
2
3
  import { createNotionClient, withRateLimitRetry } from "./client.mjs";
3
4
  import { createPollingEvent, notionPollingEventSchema } from "./events.mjs";
4
5
  import { z } from "zod";
5
- import { createPollingTriggerBindingFactory } from "@keystrokehq/integration-authoring";
6
6
 
7
7
  //#region src/triggers.ts
8
8
  const DEFAULT_POLLING_SCHEDULE = "*/10 * * * *";
@@ -28,7 +28,7 @@ function createPollingBinding(config) {
28
28
  credentialSets: notionPollingCredentialSets,
29
29
  response: notionPollingBatchSchema,
30
30
  poll: (ctx) => config.build(options, {
31
- credentials: { "keystroke:notion": ctx.credentials["keystroke:notion"] },
31
+ credentials: { notion: ctx.credentials["notion"] },
32
32
  lastPolledAt: ctx.lastPolledAt
33
33
  })
34
34
  })({
@@ -144,27 +144,27 @@ const polling = Object.freeze({
144
144
  allPageEvents: createPollingBinding({
145
145
  defaultId: "notion.polling.all_page_events",
146
146
  defaultDescription: "Poll for recently changed Notion pages",
147
- build: (options, ctx) => pollAllPages(ctx.credentials["keystroke:notion"], ctx.lastPolledAt, options.query)
147
+ build: (options, ctx) => pollAllPages(ctx.credentials["notion"], ctx.lastPolledAt, options.query)
148
148
  }),
149
149
  commentsAdded: createPollingBinding({
150
150
  defaultId: "notion.polling.comments_added",
151
151
  defaultDescription: "Poll for newly created Notion comments on a block or page",
152
- build: (options, ctx) => pollCommentsAdded(ctx.credentials["keystroke:notion"], ctx.lastPolledAt, options.blockId)
152
+ build: (options, ctx) => pollCommentsAdded(ctx.credentials["notion"], ctx.lastPolledAt, options.blockId)
153
153
  }),
154
154
  pageAddedToDataSource: createPollingBinding({
155
155
  defaultId: "notion.polling.page_added_to_data_source",
156
156
  defaultDescription: "Poll for newly created entries in a Notion data source",
157
- build: (options, ctx) => pollPagesAddedToDataSource(ctx.credentials["keystroke:notion"], ctx.lastPolledAt, options.dataSourceId)
157
+ build: (options, ctx) => pollPagesAddedToDataSource(ctx.credentials["notion"], ctx.lastPolledAt, options.dataSourceId)
158
158
  }),
159
159
  pageAddedToPage: createPollingBinding({
160
160
  defaultId: "notion.polling.page_added_to_page",
161
161
  defaultDescription: "Poll for new child pages added under a Notion page",
162
- build: (options, ctx) => pollPagesAddedToPage(ctx.credentials["keystroke:notion"], ctx.lastPolledAt, options.pageId)
162
+ build: (options, ctx) => pollPagesAddedToPage(ctx.credentials["notion"], ctx.lastPolledAt, options.pageId)
163
163
  }),
164
164
  pageUpdated: createPollingBinding({
165
165
  defaultId: "notion.polling.page_updated",
166
166
  defaultDescription: "Poll a single Notion page for updates",
167
- build: (options, ctx) => pollPageUpdated(ctx.credentials["keystroke:notion"], ctx.lastPolledAt, options.pageId)
167
+ build: (options, ctx) => pollPageUpdated(ctx.credentials["notion"], ctx.lastPolledAt, options.pageId)
168
168
  })
169
169
  });
170
170
 
package/dist/users.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { z } from "zod";
2
1
  import * as _keystrokehq_core0 from "@keystrokehq/core";
2
+ import { z } from "zod";
3
3
  import * as _keystrokehq_core_credential_set0 from "@keystrokehq/core/credential-set";
4
4
 
5
5
  //#region src/users.d.ts
@@ -10,7 +10,7 @@ declare const getMe: _keystrokehq_core0.Operation<z.ZodObject<{}, z.core.$strip>
10
10
  name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
11
11
  avatarUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
12
12
  email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
13
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:notion", z.ZodObject<{
13
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"notion", z.ZodObject<{
14
14
  NOTION_ACCESS_TOKEN: z.ZodString;
15
15
  }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
16
16
  NOTION_ACCESS_TOKEN: z.ZodString;
@@ -24,7 +24,7 @@ declare const getUser: _keystrokehq_core0.Operation<z.ZodObject<{
24
24
  name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
25
25
  avatarUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
26
26
  email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
27
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:notion", z.ZodObject<{
27
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"notion", z.ZodObject<{
28
28
  NOTION_ACCESS_TOKEN: z.ZodString;
29
29
  }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
30
30
  NOTION_ACCESS_TOKEN: z.ZodString;
@@ -43,7 +43,7 @@ declare const listUsers: _keystrokehq_core0.Operation<z.ZodObject<{
43
43
  }, z.core.$strip>>;
44
44
  hasMore: z.ZodBoolean;
45
45
  nextCursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
46
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:notion", z.ZodObject<{
46
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"notion", z.ZodObject<{
47
47
  NOTION_ACCESS_TOKEN: z.ZodString;
48
48
  }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
49
49
  NOTION_ACCESS_TOKEN: z.ZodString;
package/dist/users.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { createNotionClient, withRateLimitRetry } from "./client.mjs";
2
2
  import { normalizeListMeta, normalizeUser, notionListResponseSchema, notionUserSchema } from "./schemas.mjs";
3
- import { t as notionOperation } from "./factory-BFy8QmFf.mjs";
4
- import { r as buildPaginationInput } from "./shared-C6A6JPl3.mjs";
3
+ import { t as notionOperation } from "./factory-Dw2V3rrS.mjs";
4
+ import { r as buildPaginationInput } from "./shared-DwBtvjix.mjs";
5
5
  import { z } from "zod";
6
6
 
7
7
  //#region src/users.ts
@@ -1,5 +1,90 @@
1
- import { verifyHmacWebhook } from "@keystrokehq/integration-authoring/webhooks";
1
+ import { createHmac, timingSafeEqual } from "node:crypto";
2
2
 
3
+ //#region ../../packages/integration-authoring/dist/webhooks.mjs
4
+ /**
5
+ * Shared HMAC webhook signature verification helpers.
6
+ *
7
+ * Most providers that sign webhook payloads follow the same recipe:
8
+ *
9
+ * HMAC-<algo>(secret, <optional prefix>:<optional timestamp>:<raw body>)
10
+ *
11
+ * …compared to an expected signature taken from a header and an optional
12
+ * timestamp replay window. This module centralizes that recipe so individual
13
+ * integration packages only describe the provider-specific parts (header
14
+ * names, signature prefix, timestamp mixing).
15
+ *
16
+ * Example (Slack v0):
17
+ *
18
+ * ```ts
19
+ * export const verifySlackRequest = (request, signingSecret) =>
20
+ * verifyHmacWebhook(request, {
21
+ * secret: signingSecret,
22
+ * signatureHeader: 'x-slack-signature',
23
+ * signaturePrefix: 'v0=',
24
+ * timestamp: { header: 'x-slack-request-timestamp', toleranceSeconds: 300 },
25
+ * buildBase: ({ body, timestamp }) => `v0:${timestamp}:${body}`,
26
+ * });
27
+ * ```
28
+ *
29
+ * Example (Notion):
30
+ *
31
+ * ```ts
32
+ * export const verifyNotionWebhook = (request, token) =>
33
+ * verifyHmacWebhook(request, {
34
+ * secret: token,
35
+ * signatureHeader: 'x-notion-signature',
36
+ * signaturePrefix: 'sha256=',
37
+ * });
38
+ * ```
39
+ */
40
+ /**
41
+ * Case-insensitive single-value header lookup. Returns the first value
42
+ * when the header is an array.
43
+ */
44
+ function getWebhookHeader(headers, name) {
45
+ const lower = name.toLowerCase();
46
+ const value = headers[name] ?? headers[lower];
47
+ if (value !== void 0) return Array.isArray(value) ? value[0] : value;
48
+ for (const [key, candidate] of Object.entries(headers)) if (key.toLowerCase() === lower) return Array.isArray(candidate) ? candidate[0] : candidate;
49
+ }
50
+ /**
51
+ * Verify an incoming HMAC-signed webhook request.
52
+ *
53
+ * Returns `true` only when:
54
+ * - the signature header is present,
55
+ * - the timestamp (if configured) is within tolerance,
56
+ * - and the computed signature matches the header via `timingSafeEqual`.
57
+ */
58
+ function verifyHmacWebhook(request, config) {
59
+ const signature = getWebhookHeader(request.headers, config.signatureHeader);
60
+ if (!signature) return false;
61
+ let timestamp;
62
+ if (config.timestamp) {
63
+ timestamp = getWebhookHeader(request.headers, config.timestamp.header);
64
+ if (!timestamp) return false;
65
+ const nowSeconds = Math.floor((config.now?.() ?? Date.now()) / 1e3);
66
+ const parsed = Number(timestamp);
67
+ if (!Number.isFinite(parsed)) return false;
68
+ if (Math.abs(nowSeconds - parsed) > config.timestamp.toleranceSeconds) return false;
69
+ }
70
+ const body = typeof request.body === "string" ? request.body : request.body.toString("utf8");
71
+ const base = config.buildBase ? config.buildBase({
72
+ body,
73
+ timestamp
74
+ }) : body;
75
+ const digest = createHmac(config.algorithm ?? "sha256", config.secret).update(base).digest("hex");
76
+ const expected = `${config.signaturePrefix ?? ""}${digest}`;
77
+ try {
78
+ const a = Buffer.from(expected);
79
+ const b = Buffer.from(signature);
80
+ if (a.length !== b.length) return false;
81
+ return timingSafeEqual(a, b);
82
+ } catch {
83
+ return false;
84
+ }
85
+ }
86
+
87
+ //#endregion
3
88
  //#region src/verification.ts
4
89
  /**
5
90
  * notion/verification.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@keystrokehq/notion",
3
- "version": "0.0.10",
3
+ "version": "0.0.11",
4
4
  "private": false,
5
5
  "sideEffects": false,
6
6
  "type": "module",
@@ -76,8 +76,6 @@
76
76
  "LICENSE"
77
77
  ],
78
78
  "dependencies": {
79
- "@keystrokehq/credential-connection": "^1.0.0",
80
- "@keystrokehq/integration-authoring": "^0.0.8",
81
79
  "@notionhq/client": "^5.17.0",
82
80
  "zod": "^4.3.6"
83
81
  },
@@ -89,9 +87,11 @@
89
87
  "tsdown": "^0.20.3",
90
88
  "typescript": "^5.9.3",
91
89
  "vitest": "^4.0.18",
92
- "@keystrokehq/core": "^0.0.8",
90
+ "@keystrokehq/core": "^0.0.12",
91
+ "@keystrokehq/typescript-config": "0.0.0",
92
+ "@keystrokehq/integration-authoring": "0.0.9",
93
93
  "@keystrokehq/test-utils": "0.0.0",
94
- "@keystrokehq/typescript-config": "0.0.0"
94
+ "@keystrokehq/credential-connection": "1.0.0"
95
95
  },
96
96
  "keywords": [
97
97
  "notion",
@@ -1,8 +0,0 @@
1
- import { t as notion } from "./integration-BdUbYCu5.mjs";
2
- import { createOfficialOperationFactory } from "@keystrokehq/integration-authoring/official";
3
-
4
- //#region src/factory.ts
5
- const notionOperation = createOfficialOperationFactory(notion);
6
-
7
- //#endregion
8
- export { notionOperation as t };
@@ -1,93 +0,0 @@
1
- import { defineOfficialIntegration, officialCredentialSetId } from "@keystrokehq/integration-authoring/official";
2
- import { z } from "zod";
3
- import { CredentialSet } from "@keystrokehq/core";
4
- import { oauthDefaults, oauthPresets, pipe } from "@keystrokehq/credential-connection";
5
-
6
- //#region src/_official/provider-app.ts
7
- const notionAppCredentialSet = new CredentialSet({
8
- id: officialCredentialSetId("notion-app"),
9
- exposure: "platform-only",
10
- name: "Notion App",
11
- auth: z.object({
12
- clientId: z.string().min(1),
13
- clientSecret: z.string().min(1)
14
- })
15
- });
16
- const notionOfficialProviderSeed = {
17
- provider: "notion",
18
- appRef: "notion-official",
19
- displayName: "Notion Platform",
20
- credentialSetName: "Keystroke Notion Platform App",
21
- envShape: {
22
- KEYSTROKE_OFFICIAL_NOTION_CLIENT_ID: z.string().optional(),
23
- KEYSTROKE_OFFICIAL_NOTION_CLIENT_SECRET: z.string().optional()
24
- },
25
- requiredEnvKeys: ["KEYSTROKE_OFFICIAL_NOTION_CLIENT_ID", "KEYSTROKE_OFFICIAL_NOTION_CLIENT_SECRET"],
26
- externalAppIdEnvKey: "KEYSTROKE_OFFICIAL_NOTION_CLIENT_ID",
27
- buildCredentials: (env) => ({
28
- clientId: env.KEYSTROKE_OFFICIAL_NOTION_CLIENT_ID,
29
- clientSecret: env.KEYSTROKE_OFFICIAL_NOTION_CLIENT_SECRET
30
- })
31
- };
32
- const notionWebhookCredentialSet = new CredentialSet({
33
- id: officialCredentialSetId("notion-webhook"),
34
- exposure: "platform-only",
35
- name: "Notion Webhook",
36
- auth: z.object({ verificationToken: z.string().min(1) })
37
- });
38
-
39
- //#endregion
40
- //#region src/oauth-connection.ts
41
- const notionTokenExchange = oauthPresets.basicAuthJsonBody();
42
- const notionOAuthConnection = {
43
- kind: "oauth",
44
- tokenType: "refreshable",
45
- authUrl: "https://api.notion.com/v1/oauth/authorize",
46
- tokenUrl: "https://api.notion.com/v1/oauth/token",
47
- revokeUrl: "https://api.notion.com/v1/oauth/revoke",
48
- scopes: [
49
- "content:read",
50
- "content:write",
51
- "comments:read",
52
- "comments:write",
53
- "users:read"
54
- ],
55
- vault: { accessToken: "NOTION_ACCESS_TOKEN" },
56
- oauth: { id: "official.notion.oauth" },
57
- buildAuthUrl: pipe(oauthDefaults.buildAuthUrl, oauthPresets.noScopeParam, oauthPresets.extraAuthParams({ owner: "user" })),
58
- exchangeCode: pipe(oauthDefaults.exchangeCode, notionTokenExchange.exchangeCode),
59
- refreshToken: pipe(oauthDefaults.refreshToken, notionTokenExchange.refreshToken)
60
- };
61
-
62
- //#endregion
63
- //#region src/integration.ts
64
- const notionAuthSchema = z.object({ NOTION_ACCESS_TOKEN: z.string().min(1) });
65
- const notionOfficialIntegration = {
66
- id: "notion",
67
- name: "Notion",
68
- description: "Notion pages, blocks, data sources, comments, users, search, and triggers",
69
- auth: notionAuthSchema,
70
- connections: [{
71
- id: "oauth",
72
- label: "Connect Notion workspace",
73
- recommended: true,
74
- ...notionOAuthConnection
75
- }, {
76
- id: "integration-token",
77
- kind: "manual",
78
- label: "Use internal integration token",
79
- advanced: true,
80
- input: notionAuthSchema
81
- }]
82
- };
83
- const notionBundle = defineOfficialIntegration({
84
- ...notionOfficialIntegration,
85
- internal: {
86
- providerApp: notionAppCredentialSet,
87
- webhookVerification: notionWebhookCredentialSet
88
- }
89
- });
90
- const notion = notionBundle.credentialSet;
91
-
92
- //#endregion
93
- export { notionOfficialProviderSeed as a, notionAppCredentialSet as i, notionBundle as n, notionWebhookCredentialSet as o, notionOfficialIntegration as r, notion as t };