@keystrokehq/notion 0.0.11 → 0.0.15
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/_official/index.d.mts +4 -10
- package/dist/_official/index.mjs +1 -1
- package/dist/_runtime/index.d.mts +49 -98
- package/dist/blocks.d.mts +11 -22
- package/dist/blocks.mjs +2 -2
- package/dist/client.d.mts +1 -1
- package/dist/client.mjs +2 -2
- package/dist/comments.d.mts +7 -14
- package/dist/comments.mjs +2 -2
- package/dist/connection.d.mts +1 -1
- package/dist/connection.mjs +1 -1
- package/dist/data-sources.d.mts +11 -22
- package/dist/data-sources.mjs +2 -2
- package/dist/factory-BmLNLbSq.mjs +8 -0
- package/dist/integration--FJUCgRj.d.mts +24 -0
- package/dist/integration-xFeJVYim.mjs +60 -0
- package/dist/pages.d.mts +15 -30
- package/dist/pages.mjs +2 -2
- package/dist/search.d.mts +3 -6
- package/dist/search.mjs +1 -1
- package/dist/triggers.d.mts +3 -2
- package/dist/triggers.mjs +8 -8
- package/dist/users.d.mts +7 -14
- package/dist/users.mjs +2 -2
- package/dist/verification.mjs +1 -86
- package/package.json +5 -6
- package/dist/dist-Bbp6t-WQ.mjs +0 -74
- package/dist/factory-Dw2V3rrS.mjs +0 -7
- package/dist/integration-Bc-B-wPX.d.mts +0 -55
- package/dist/integration-Dqf1rNJ6.mjs +0 -770
- /package/dist/{shared-DwBtvjix.mjs → shared-C6A6JPl3.mjs} +0 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { t as notion } from "./integration-xFeJVYim.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 };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as _keystrokehq_integration_authoring_official0 from "@keystrokehq/integration-authoring/official";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import * as _keystrokehq_core0 from "@keystrokehq/core";
|
|
4
|
+
import { InferCredentialSetAuth } from "@keystrokehq/core/credential-set";
|
|
5
|
+
|
|
6
|
+
//#region src/integration.d.ts
|
|
7
|
+
declare const notionOfficialIntegration: {
|
|
8
|
+
id: "notion";
|
|
9
|
+
name: string;
|
|
10
|
+
description: string;
|
|
11
|
+
credentialType: "oauth";
|
|
12
|
+
auth: z.ZodObject<{
|
|
13
|
+
NOTION_ACCESS_TOKEN: z.ZodString;
|
|
14
|
+
}, z.core.$strip>;
|
|
15
|
+
};
|
|
16
|
+
declare const notionBundle: _keystrokehq_integration_authoring_official0.OfficialIntegrationBundle<"notion", z.ZodObject<{
|
|
17
|
+
NOTION_ACCESS_TOKEN: z.ZodString;
|
|
18
|
+
}, z.core.$strip>>;
|
|
19
|
+
declare const notion: _keystrokehq_core0.CredentialSet<"keystroke:notion", z.ZodObject<{
|
|
20
|
+
NOTION_ACCESS_TOKEN: z.ZodString;
|
|
21
|
+
}, z.core.$strip>>;
|
|
22
|
+
type NotionCredentials = InferCredentialSetAuth<typeof notion>;
|
|
23
|
+
//#endregion
|
|
24
|
+
export { notionOfficialIntegration as i, notion as n, notionBundle as r, NotionCredentials as t };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { defineOfficialIntegration, officialCredentialSetId } from "@keystrokehq/integration-authoring/official";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { CredentialSet } from "@keystrokehq/core";
|
|
4
|
+
|
|
5
|
+
//#region src/_official/provider-app.ts
|
|
6
|
+
const notionAppCredentialSet = new CredentialSet({
|
|
7
|
+
id: officialCredentialSetId("notion-app"),
|
|
8
|
+
credentialType: "manual",
|
|
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
|
+
credentialType: "manual",
|
|
35
|
+
exposure: "platform-only",
|
|
36
|
+
name: "Notion Webhook",
|
|
37
|
+
auth: z.object({ verificationToken: z.string().min(1) })
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region src/integration.ts
|
|
42
|
+
const notionAuthSchema = z.object({ NOTION_ACCESS_TOKEN: z.string().min(1) });
|
|
43
|
+
const notionOfficialIntegration = {
|
|
44
|
+
id: "notion",
|
|
45
|
+
name: "Notion",
|
|
46
|
+
description: "Notion pages, blocks, data sources, comments, users, search, and triggers",
|
|
47
|
+
credentialType: "oauth",
|
|
48
|
+
auth: notionAuthSchema
|
|
49
|
+
};
|
|
50
|
+
const notionBundle = defineOfficialIntegration({
|
|
51
|
+
...notionOfficialIntegration,
|
|
52
|
+
internal: {
|
|
53
|
+
providerApp: notionAppCredentialSet,
|
|
54
|
+
webhookVerification: notionWebhookCredentialSet
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
const notion = notionBundle.credentialSet;
|
|
58
|
+
|
|
59
|
+
//#endregion
|
|
60
|
+
export { notionOfficialProviderSeed as a, notionAppCredentialSet as i, notionBundle as n, notionWebhookCredentialSet as o, notionOfficialIntegration as r, notion as t };
|
package/dist/pages.d.mts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import * as _keystrokehq_core0 from "@keystrokehq/core";
|
|
2
1
|
import { z } from "zod";
|
|
3
|
-
import * as
|
|
2
|
+
import * as _keystrokehq_core0 from "@keystrokehq/core";
|
|
4
3
|
|
|
5
4
|
//#region src/pages.d.ts
|
|
6
5
|
declare const getPage: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
@@ -23,11 +22,9 @@ declare const getPage: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
|
23
22
|
workspace: z.ZodOptional<z.ZodBoolean>;
|
|
24
23
|
}, z.core.$strip>>;
|
|
25
24
|
properties: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
26
|
-
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"notion", z.ZodObject<{
|
|
27
|
-
NOTION_ACCESS_TOKEN: z.ZodString;
|
|
28
|
-
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
25
|
+
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:notion", z.ZodObject<{
|
|
29
26
|
NOTION_ACCESS_TOKEN: z.ZodString;
|
|
30
|
-
}, z.core.$strip>>
|
|
27
|
+
}, z.core.$strip>>], undefined>;
|
|
31
28
|
declare const createPage: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
32
29
|
parent: z.ZodObject<{
|
|
33
30
|
pageId: z.ZodOptional<z.ZodString>;
|
|
@@ -55,11 +52,9 @@ declare const createPage: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
|
55
52
|
workspace: z.ZodOptional<z.ZodBoolean>;
|
|
56
53
|
}, z.core.$strip>>;
|
|
57
54
|
properties: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
58
|
-
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"notion", z.ZodObject<{
|
|
55
|
+
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:notion", z.ZodObject<{
|
|
59
56
|
NOTION_ACCESS_TOKEN: z.ZodString;
|
|
60
|
-
}, z.core.$strip
|
|
61
|
-
NOTION_ACCESS_TOKEN: z.ZodString;
|
|
62
|
-
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
57
|
+
}, z.core.$strip>>], undefined>;
|
|
63
58
|
declare const updatePage: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
64
59
|
pageId: z.ZodString;
|
|
65
60
|
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
@@ -85,21 +80,17 @@ declare const updatePage: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
|
85
80
|
workspace: z.ZodOptional<z.ZodBoolean>;
|
|
86
81
|
}, z.core.$strip>>;
|
|
87
82
|
properties: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
88
|
-
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"notion", z.ZodObject<{
|
|
89
|
-
NOTION_ACCESS_TOKEN: z.ZodString;
|
|
90
|
-
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
83
|
+
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:notion", z.ZodObject<{
|
|
91
84
|
NOTION_ACCESS_TOKEN: z.ZodString;
|
|
92
|
-
}, z.core.$strip>>
|
|
85
|
+
}, z.core.$strip>>], undefined>;
|
|
93
86
|
declare const copyPageContent: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
94
87
|
sourcePageId: z.ZodString;
|
|
95
88
|
targetPageId: z.ZodString;
|
|
96
89
|
}, z.core.$strip>, z.ZodObject<{
|
|
97
90
|
success: z.ZodLiteral<true>;
|
|
98
|
-
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"notion", z.ZodObject<{
|
|
91
|
+
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:notion", z.ZodObject<{
|
|
99
92
|
NOTION_ACCESS_TOKEN: z.ZodString;
|
|
100
|
-
}, z.core.$strip
|
|
101
|
-
NOTION_ACCESS_TOKEN: z.ZodString;
|
|
102
|
-
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
93
|
+
}, z.core.$strip>>], undefined>;
|
|
103
94
|
declare const trashPage: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
104
95
|
pageId: z.ZodString;
|
|
105
96
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -120,11 +111,9 @@ declare const trashPage: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
|
120
111
|
workspace: z.ZodOptional<z.ZodBoolean>;
|
|
121
112
|
}, z.core.$strip>>;
|
|
122
113
|
properties: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
123
|
-
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"notion", z.ZodObject<{
|
|
124
|
-
NOTION_ACCESS_TOKEN: z.ZodString;
|
|
125
|
-
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
114
|
+
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:notion", z.ZodObject<{
|
|
126
115
|
NOTION_ACCESS_TOKEN: z.ZodString;
|
|
127
|
-
}, z.core.$strip>>
|
|
116
|
+
}, z.core.$strip>>], undefined>;
|
|
128
117
|
declare const getPageProperty: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
129
118
|
pageId: z.ZodString;
|
|
130
119
|
propertyId: z.ZodString;
|
|
@@ -137,11 +126,9 @@ declare const getPageProperty: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
|
137
126
|
value: z.ZodUnknown;
|
|
138
127
|
nextCursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
139
128
|
hasMore: z.ZodOptional<z.ZodBoolean>;
|
|
140
|
-
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"notion", z.ZodObject<{
|
|
129
|
+
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:notion", z.ZodObject<{
|
|
141
130
|
NOTION_ACCESS_TOKEN: z.ZodString;
|
|
142
|
-
}, z.core.$strip
|
|
143
|
-
NOTION_ACCESS_TOKEN: z.ZodString;
|
|
144
|
-
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
131
|
+
}, z.core.$strip>>], undefined>;
|
|
145
132
|
declare const restorePage: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
146
133
|
pageId: z.ZodString;
|
|
147
134
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -162,10 +149,8 @@ declare const restorePage: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
|
162
149
|
workspace: z.ZodOptional<z.ZodBoolean>;
|
|
163
150
|
}, z.core.$strip>>;
|
|
164
151
|
properties: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
165
|
-
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"notion", z.ZodObject<{
|
|
166
|
-
NOTION_ACCESS_TOKEN: z.ZodString;
|
|
167
|
-
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
152
|
+
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:notion", z.ZodObject<{
|
|
168
153
|
NOTION_ACCESS_TOKEN: z.ZodString;
|
|
169
|
-
}, z.core.$strip>>
|
|
154
|
+
}, z.core.$strip>>], undefined>;
|
|
170
155
|
//#endregion
|
|
171
156
|
export { copyPageContent, createPage, getPage, getPageProperty, restorePage, trashPage, updatePage };
|
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-
|
|
4
|
-
import { i as buildPlainTextRichText, n as buildPageParent, r as buildPaginationInput } from "./shared-
|
|
3
|
+
import { t as notionOperation } from "./factory-BmLNLbSq.mjs";
|
|
4
|
+
import { i as buildPlainTextRichText, n as buildPageParent, r as buildPaginationInput } from "./shared-C6A6JPl3.mjs";
|
|
5
5
|
import { z } from "zod";
|
|
6
6
|
|
|
7
7
|
//#region src/pages.ts
|
package/dist/search.d.mts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import * as _keystrokehq_core0 from "@keystrokehq/core";
|
|
2
1
|
import { z } from "zod";
|
|
3
|
-
import * as
|
|
2
|
+
import * as _keystrokehq_core0 from "@keystrokehq/core";
|
|
4
3
|
|
|
5
4
|
//#region src/search.d.ts
|
|
6
5
|
declare const searchWorkspace: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
@@ -36,10 +35,8 @@ declare const searchWorkspace: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
|
36
35
|
}, z.core.$strip>>;
|
|
37
36
|
hasMore: z.ZodBoolean;
|
|
38
37
|
nextCursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
39
|
-
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"notion", z.ZodObject<{
|
|
40
|
-
NOTION_ACCESS_TOKEN: z.ZodString;
|
|
41
|
-
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
38
|
+
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:notion", z.ZodObject<{
|
|
42
39
|
NOTION_ACCESS_TOKEN: z.ZodString;
|
|
43
|
-
}, z.core.$strip>>
|
|
40
|
+
}, z.core.$strip>>], undefined>;
|
|
44
41
|
//#endregion
|
|
45
42
|
export { searchWorkspace };
|
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-
|
|
3
|
+
import { t as notionOperation } from "./factory-BmLNLbSq.mjs";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
|
|
6
6
|
//#region src/search.ts
|
package/dist/triggers.d.mts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { n as notion } from "./integration
|
|
2
|
-
import { BoundTrigger, Operation } from "@keystrokehq/core";
|
|
1
|
+
import { n as notion } from "./integration--FJUCgRj.mjs";
|
|
3
2
|
import { z } from "zod";
|
|
3
|
+
import { BoundTrigger } from "@keystrokehq/core";
|
|
4
|
+
import { IntegrationTriggerBindingOptions } from "@keystrokehq/integration-authoring";
|
|
4
5
|
import { PollingTriggerManifest } from "@keystrokehq/core/trigger";
|
|
5
6
|
|
|
6
7
|
//#region src/triggers.d.ts
|
package/dist/triggers.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { t as notion } from "./integration-
|
|
2
|
-
import { n as createPollingTriggerBindingFactory } from "./dist-Bbp6t-WQ.mjs";
|
|
1
|
+
import { t as notion } from "./integration-xFeJVYim.mjs";
|
|
3
2
|
import { createNotionClient, withRateLimitRetry } from "./client.mjs";
|
|
4
3
|
import { createPollingEvent, notionPollingEventSchema } from "./events.mjs";
|
|
5
4
|
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: { notion: ctx.credentials["notion"] },
|
|
31
|
+
credentials: { "keystroke:notion": ctx.credentials["keystroke: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["notion"], ctx.lastPolledAt, options.query)
|
|
147
|
+
build: (options, ctx) => pollAllPages(ctx.credentials["keystroke: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["notion"], ctx.lastPolledAt, options.blockId)
|
|
152
|
+
build: (options, ctx) => pollCommentsAdded(ctx.credentials["keystroke: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["notion"], ctx.lastPolledAt, options.dataSourceId)
|
|
157
|
+
build: (options, ctx) => pollPagesAddedToDataSource(ctx.credentials["keystroke: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["notion"], ctx.lastPolledAt, options.pageId)
|
|
162
|
+
build: (options, ctx) => pollPagesAddedToPage(ctx.credentials["keystroke: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["notion"], ctx.lastPolledAt, options.pageId)
|
|
167
|
+
build: (options, ctx) => pollPageUpdated(ctx.credentials["keystroke:notion"], ctx.lastPolledAt, options.pageId)
|
|
168
168
|
})
|
|
169
169
|
});
|
|
170
170
|
|
package/dist/users.d.mts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import * as _keystrokehq_core0 from "@keystrokehq/core";
|
|
2
1
|
import { z } from "zod";
|
|
3
|
-
import * as
|
|
2
|
+
import * as _keystrokehq_core0 from "@keystrokehq/core";
|
|
4
3
|
|
|
5
4
|
//#region src/users.d.ts
|
|
6
5
|
declare const getMe: _keystrokehq_core0.Operation<z.ZodObject<{}, z.core.$strip>, z.ZodObject<{
|
|
@@ -10,11 +9,9 @@ declare const getMe: _keystrokehq_core0.Operation<z.ZodObject<{}, z.core.$strip>
|
|
|
10
9
|
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
11
10
|
avatarUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
12
11
|
email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
13
|
-
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"notion", z.ZodObject<{
|
|
14
|
-
NOTION_ACCESS_TOKEN: z.ZodString;
|
|
15
|
-
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
12
|
+
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:notion", z.ZodObject<{
|
|
16
13
|
NOTION_ACCESS_TOKEN: z.ZodString;
|
|
17
|
-
}, z.core.$strip>>
|
|
14
|
+
}, z.core.$strip>>], undefined>;
|
|
18
15
|
declare const getUser: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
19
16
|
userId: z.ZodString;
|
|
20
17
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -24,11 +21,9 @@ declare const getUser: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
|
24
21
|
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
25
22
|
avatarUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
26
23
|
email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
27
|
-
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"notion", z.ZodObject<{
|
|
24
|
+
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:notion", z.ZodObject<{
|
|
28
25
|
NOTION_ACCESS_TOKEN: z.ZodString;
|
|
29
|
-
}, z.core.$strip
|
|
30
|
-
NOTION_ACCESS_TOKEN: z.ZodString;
|
|
31
|
-
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
26
|
+
}, z.core.$strip>>], undefined>;
|
|
32
27
|
declare const listUsers: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
33
28
|
limit: z.ZodOptional<z.ZodNumber>;
|
|
34
29
|
startCursor: z.ZodOptional<z.ZodString>;
|
|
@@ -43,10 +38,8 @@ declare const listUsers: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
|
43
38
|
}, z.core.$strip>>;
|
|
44
39
|
hasMore: z.ZodBoolean;
|
|
45
40
|
nextCursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
46
|
-
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"notion", z.ZodObject<{
|
|
47
|
-
NOTION_ACCESS_TOKEN: z.ZodString;
|
|
48
|
-
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
41
|
+
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:notion", z.ZodObject<{
|
|
49
42
|
NOTION_ACCESS_TOKEN: z.ZodString;
|
|
50
|
-
}, z.core.$strip>>
|
|
43
|
+
}, z.core.$strip>>], undefined>;
|
|
51
44
|
//#endregion
|
|
52
45
|
export { getMe, getUser, listUsers };
|
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-
|
|
4
|
-
import { r as buildPaginationInput } from "./shared-
|
|
3
|
+
import { t as notionOperation } from "./factory-BmLNLbSq.mjs";
|
|
4
|
+
import { r as buildPaginationInput } from "./shared-C6A6JPl3.mjs";
|
|
5
5
|
import { z } from "zod";
|
|
6
6
|
|
|
7
7
|
//#region src/users.ts
|
package/dist/verification.mjs
CHANGED
|
@@ -1,90 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { verifyHmacWebhook } from "@keystrokehq/integration-authoring/webhooks";
|
|
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
|
|
88
3
|
//#region src/verification.ts
|
|
89
4
|
/**
|
|
90
5
|
* notion/verification.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@keystrokehq/notion",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.15",
|
|
4
4
|
"private": false,
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"type": "module",
|
|
@@ -76,22 +76,21 @@
|
|
|
76
76
|
"LICENSE"
|
|
77
77
|
],
|
|
78
78
|
"dependencies": {
|
|
79
|
+
"@keystrokehq/integration-authoring": "^0.0.9",
|
|
79
80
|
"@notionhq/client": "^5.17.0",
|
|
80
81
|
"zod": "^4.3.6"
|
|
81
82
|
},
|
|
82
83
|
"peerDependencies": {
|
|
83
|
-
"@keystrokehq/core": ">=0.0.
|
|
84
|
+
"@keystrokehq/core": ">=0.0.13 <0.1.0"
|
|
84
85
|
},
|
|
85
86
|
"devDependencies": {
|
|
86
87
|
"@types/node": "^22.19.11",
|
|
87
88
|
"tsdown": "^0.20.3",
|
|
88
89
|
"typescript": "^5.9.3",
|
|
89
90
|
"vitest": "^4.0.18",
|
|
90
|
-
"@keystrokehq/core": "^0.0.
|
|
91
|
-
"@keystrokehq/typescript-config": "0.0.0",
|
|
92
|
-
"@keystrokehq/integration-authoring": "0.0.9",
|
|
91
|
+
"@keystrokehq/core": "^0.0.13",
|
|
93
92
|
"@keystrokehq/test-utils": "0.0.0",
|
|
94
|
-
"@keystrokehq/
|
|
93
|
+
"@keystrokehq/typescript-config": "0.0.0"
|
|
95
94
|
},
|
|
96
95
|
"keywords": [
|
|
97
96
|
"notion",
|
package/dist/dist-Bbp6t-WQ.mjs
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { Operation } from "@keystrokehq/core";
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
import { pollingTrigger } from "@keystrokehq/core/trigger";
|
|
4
|
-
|
|
5
|
-
//#region ../../packages/integration-authoring/dist/index.mjs
|
|
6
|
-
function isThenable(value) {
|
|
7
|
-
return !!value && typeof value === "object" && "then" in value && typeof value.then === "function";
|
|
8
|
-
}
|
|
9
|
-
function createErrorNormalizingProxy(target, normalizeError, path = []) {
|
|
10
|
-
return new Proxy(target, { get(obj, property, receiver) {
|
|
11
|
-
const value = Reflect.get(obj, property, receiver);
|
|
12
|
-
if (typeof value === "function") return (...args) => {
|
|
13
|
-
try {
|
|
14
|
-
const result = value.apply(obj, args);
|
|
15
|
-
if (isThenable(result)) return result.then(void 0, (error) => {
|
|
16
|
-
throw normalizeError(error, { methodPath: [...path, String(property)].join(".") });
|
|
17
|
-
});
|
|
18
|
-
return result;
|
|
19
|
-
} catch (error) {
|
|
20
|
-
throw normalizeError(error, { methodPath: [...path, String(property)].join(".") });
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
if (value && typeof value === "object") return createErrorNormalizingProxy(value, normalizeError, [...path, String(property)]);
|
|
24
|
-
return value;
|
|
25
|
-
} });
|
|
26
|
-
}
|
|
27
|
-
const IntegrationConfigSchema = z.object({
|
|
28
|
-
id: z.string().min(1),
|
|
29
|
-
name: z.string().min(1),
|
|
30
|
-
description: z.string().optional()
|
|
31
|
-
});
|
|
32
|
-
function resolveMetadata(metadata, defaults) {
|
|
33
|
-
return {
|
|
34
|
-
id: metadata?.id ?? defaults.defaultId,
|
|
35
|
-
description: metadata?.description ?? defaults.defaultDescription
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
function resolveAuthorPayload(payload, mapPayload) {
|
|
39
|
-
if (!mapPayload) return payload;
|
|
40
|
-
return mapPayload(payload);
|
|
41
|
-
}
|
|
42
|
-
function createIntegrationTriggerBindingFactory(config) {
|
|
43
|
-
const bind = (options) => {
|
|
44
|
-
const resolvedMetadata = resolveMetadata(options, config);
|
|
45
|
-
const baseTrigger = config.createBaseTrigger(resolvedMetadata);
|
|
46
|
-
const userTransform = options?.transform;
|
|
47
|
-
return baseTrigger({ transform: userTransform || config.mapPayload ? (runtimePayload, request) => {
|
|
48
|
-
const authorPayload = resolveAuthorPayload(runtimePayload, config.mapPayload);
|
|
49
|
-
if (authorPayload === null) throw new Error(`Trigger "${resolvedMetadata.id}" mapPayload returned null after the trigger filter passed; tighten the trigger filter schema.`);
|
|
50
|
-
if (!userTransform) return authorPayload;
|
|
51
|
-
return userTransform(authorPayload, request);
|
|
52
|
-
} : void 0 });
|
|
53
|
-
};
|
|
54
|
-
return Object.freeze(bind);
|
|
55
|
-
}
|
|
56
|
-
function createPollingTriggerBindingFactory(config) {
|
|
57
|
-
return createIntegrationTriggerBindingFactory({
|
|
58
|
-
defaultId: config.defaultId,
|
|
59
|
-
defaultDescription: config.defaultDescription,
|
|
60
|
-
mapPayload: config.mapPayload,
|
|
61
|
-
createBaseTrigger: (metadata) => pollingTrigger({
|
|
62
|
-
id: metadata.id,
|
|
63
|
-
description: metadata.description,
|
|
64
|
-
schedule: config.schedule,
|
|
65
|
-
response: config.response,
|
|
66
|
-
poll: config.poll,
|
|
67
|
-
...config.credentialSets ? { credentialSets: config.credentialSets } : {},
|
|
68
|
-
...config.filter ? { filter: config.filter } : {}
|
|
69
|
-
})
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
//#endregion
|
|
74
|
-
export { createPollingTriggerBindingFactory as n, createErrorNormalizingProxy as t };
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import * as _keystrokehq_core0 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/integration.d.ts
|
|
7
|
-
declare const notionOfficialIntegration: {
|
|
8
|
-
id: "notion";
|
|
9
|
-
name: string;
|
|
10
|
-
description: string;
|
|
11
|
-
auth: z.ZodObject<{
|
|
12
|
-
NOTION_ACCESS_TOKEN: z.ZodString;
|
|
13
|
-
}, z.core.$strip>;
|
|
14
|
-
connections: ({
|
|
15
|
-
kind: "oauth";
|
|
16
|
-
tokenType: "refreshable";
|
|
17
|
-
authUrl: "https://api.notion.com/v1/oauth/authorize";
|
|
18
|
-
tokenUrl: "https://api.notion.com/v1/oauth/token";
|
|
19
|
-
revokeUrl: "https://api.notion.com/v1/oauth/revoke";
|
|
20
|
-
scopes: readonly ["content:read", "content:write", "comments:read", "comments:write", "users:read"];
|
|
21
|
-
vault: {
|
|
22
|
-
readonly accessToken: "NOTION_ACCESS_TOKEN";
|
|
23
|
-
};
|
|
24
|
-
oauth: {
|
|
25
|
-
readonly id: "official.notion.oauth";
|
|
26
|
-
};
|
|
27
|
-
buildAuthUrl: _keystrokehq_core_credential_set0.BuildAuthUrlHook;
|
|
28
|
-
exchangeCode: _keystrokehq_core_credential_set0.ExchangeCodeHook;
|
|
29
|
-
refreshToken: _keystrokehq_core_credential_set0.RefreshTokenHook;
|
|
30
|
-
id: string;
|
|
31
|
-
label: string;
|
|
32
|
-
recommended: true;
|
|
33
|
-
advanced?: undefined;
|
|
34
|
-
input?: undefined;
|
|
35
|
-
} | {
|
|
36
|
-
id: string;
|
|
37
|
-
kind: "manual";
|
|
38
|
-
label: string;
|
|
39
|
-
advanced: true;
|
|
40
|
-
input: z.ZodObject<{
|
|
41
|
-
NOTION_ACCESS_TOKEN: z.ZodString;
|
|
42
|
-
}, z.core.$strip>;
|
|
43
|
-
})[];
|
|
44
|
-
};
|
|
45
|
-
declare const notionBundle: undefined<"notion", z.ZodObject<{
|
|
46
|
-
NOTION_ACCESS_TOKEN: z.ZodString;
|
|
47
|
-
}, z.core.$strip>>;
|
|
48
|
-
declare const notion: _keystrokehq_core0.CredentialSet<"notion", z.ZodObject<{
|
|
49
|
-
NOTION_ACCESS_TOKEN: z.ZodString;
|
|
50
|
-
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
51
|
-
NOTION_ACCESS_TOKEN: z.ZodString;
|
|
52
|
-
}, z.core.$strip>>[] | undefined>;
|
|
53
|
-
type NotionCredentials = InferCredentialSetAuth<typeof notion>;
|
|
54
|
-
//#endregion
|
|
55
|
-
export { notionOfficialIntegration as i, notion as n, notionBundle as r, NotionCredentials as t };
|