@frogbotai/piece-notion 0.21.0 → 0.23.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/README.md +46 -0
- package/dist/actions/comments.d.ts +33 -0
- package/dist/actions/comments.d.ts.map +1 -0
- package/dist/actions/comments.js +24 -0
- package/dist/actions/comments.js.map +1 -0
- package/dist/actions/core.d.ts +271 -0
- package/dist/actions/core.d.ts.map +1 -0
- package/dist/actions/core.js +216 -0
- package/dist/actions/core.js.map +1 -0
- package/dist/actions/customApiCall.d.ts +33 -0
- package/dist/actions/customApiCall.d.ts.map +1 -0
- package/dist/actions/customApiCall.js +28 -0
- package/dist/actions/customApiCall.js.map +1 -0
- package/dist/actions/read.d.ts +143 -0
- package/dist/actions/read.d.ts.map +1 -0
- package/dist/actions/read.js +131 -0
- package/dist/actions/read.js.map +1 -0
- package/dist/client.d.ts +25 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +47 -0
- package/dist/client.js.map +1 -0
- package/dist/config.d.ts +7 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +7 -0
- package/dist/config.js.map +1 -0
- package/dist/definitions.d.ts +66 -0
- package/dist/definitions.d.ts.map +1 -0
- package/dist/definitions.js +7 -0
- package/dist/definitions.js.map +1 -0
- package/dist/filtering.d.ts +9 -0
- package/dist/filtering.d.ts.map +1 -0
- package/dist/filtering.js +46 -0
- package/dist/filtering.js.map +1 -0
- package/dist/index.d.ts +745 -35
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +64 -54
- package/dist/index.js.map +1 -1
- package/dist/properties.d.ts +181 -0
- package/dist/properties.d.ts.map +1 -0
- package/dist/properties.js +41 -0
- package/dist/properties.js.map +1 -0
- package/dist/schemas.d.ts +38 -0
- package/dist/schemas.d.ts.map +1 -0
- package/dist/schemas.js +35 -0
- package/dist/schemas.js.map +1 -0
- package/dist/triggers/polling.d.ts +263 -0
- package/dist/triggers/polling.d.ts.map +1 -0
- package/dist/triggers/polling.js +96 -0
- package/dist/triggers/polling.js.map +1 -0
- package/package.json +5 -10
package/README.md
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# `@frogbotai/piece-notion`
|
|
2
|
+
|
|
3
|
+
Create, query, update, and monitor Notion pages, databases, blocks, and comments.
|
|
4
|
+
|
|
5
|
+
## Authentication
|
|
6
|
+
|
|
7
|
+
OAuth connections use Notion's public OAuth flow. Internal integration tokens are also supported by passing `{ auth: { accessToken } }`; share each required page or database with that integration in Notion first.
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { createNotion } from '@frogbotai/piece-notion';
|
|
11
|
+
|
|
12
|
+
export const notion = createNotion({
|
|
13
|
+
auth: { accessToken: process.env.NOTION_TOKEN! },
|
|
14
|
+
});
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Actions
|
|
18
|
+
|
|
19
|
+
| Upstream action slug | Previous wrapper export | Native action | Notes |
|
|
20
|
+
| --------------------------- | ----------------------- | --------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
21
|
+
| `list_databases` | None | `listDatabases` | Preserves cursor pagination. |
|
|
22
|
+
| `create_database_item` | None | `createDatabaseItem` | Dynamic fields use the database schema. |
|
|
23
|
+
| `update_database_item` | None | `updateDatabaseItem` | Dynamic fields use the database schema. |
|
|
24
|
+
| `notion-find-database-item` | None | `findDatabaseItem` | |
|
|
25
|
+
| `list_database_pages` | None | `listDatabasePages` | Preserves cursor pagination. |
|
|
26
|
+
| `createPage` | None | `createPage` | |
|
|
27
|
+
| `append_to_page` | None | `appendToPage` | Content is appended as a paragraph block. |
|
|
28
|
+
| `getPageOrBlockChildren` | None | `getBlockContent` | Returns paginated block JSON recursively to the requested depth. Upstream markdown rendering is not exposed because the native package has no markdown converter. |
|
|
29
|
+
| `archive_database_item` | None | `archiveDatabaseItem` | |
|
|
30
|
+
| `restore_database_item` | None | `restoreDatabaseItem` | |
|
|
31
|
+
| `add_comment` | None | `addComment` | Requires insert-comment capability. |
|
|
32
|
+
| `retrieve_database` | None | `retrieveDatabase` | |
|
|
33
|
+
| `get_page_comments` | None | `getPageComments` | Requires read-comment capability. |
|
|
34
|
+
| `find_page` | None | `findPage` | |
|
|
35
|
+
| `custom_api_call` | None | `customApiCall` | Restricted to relative Notion API paths; credentials cannot be sent to another origin. |
|
|
36
|
+
|
|
37
|
+
## Triggers
|
|
38
|
+
|
|
39
|
+
| Upstream trigger slug | Native trigger | Type | Notes |
|
|
40
|
+
| ----------------------- | --------------------- | --------- | ----------------------------------------- |
|
|
41
|
+
| `new_database_item` | `newDatabaseItem` | `polling` | Timestamp cursor. |
|
|
42
|
+
| `updated_database_item` | `updatedDatabaseItem` | `polling` | Timestamp cursor. |
|
|
43
|
+
| `new_comment` | `newComment` | `polling` | Requires read-comment capability. |
|
|
44
|
+
| `updated_page` | `updatedPage` | `polling` | Watches pages shared with the connection. |
|
|
45
|
+
|
|
46
|
+
All requests use Notion API version `2022-02-22`. Notion only exposes resources explicitly shared with the OAuth connection or internal integration.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const addComment: import("frogbot/pieces").PieceActionDefinition<z.ZodObject<{
|
|
3
|
+
pageId: z.ZodString;
|
|
4
|
+
commentText: z.ZodString;
|
|
5
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
6
|
+
object: z.ZodString;
|
|
7
|
+
id: z.ZodString;
|
|
8
|
+
created_time: z.ZodString;
|
|
9
|
+
last_edited_time: z.ZodOptional<z.ZodString>;
|
|
10
|
+
discussion_id: z.ZodOptional<z.ZodString>;
|
|
11
|
+
rich_text: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
|
|
12
|
+
}, z.core.$loose>, object, {
|
|
13
|
+
request: ({ method, path, query, body, signal, }: {
|
|
14
|
+
method?: string;
|
|
15
|
+
path: string;
|
|
16
|
+
query?: Record<string, string | number | boolean | undefined>;
|
|
17
|
+
body?: unknown;
|
|
18
|
+
signal?: AbortSignal;
|
|
19
|
+
}) => Promise<unknown>;
|
|
20
|
+
listAll: ({ path, body, query, signal, }: {
|
|
21
|
+
path: string;
|
|
22
|
+
body?: Record<string, unknown>;
|
|
23
|
+
query?: Record<string, string | number | boolean | undefined>;
|
|
24
|
+
signal?: AbortSignal;
|
|
25
|
+
}) => Promise<{
|
|
26
|
+
[x: string]: unknown;
|
|
27
|
+
object: string;
|
|
28
|
+
id: string;
|
|
29
|
+
}[]>;
|
|
30
|
+
}> & {
|
|
31
|
+
slug: "addComment";
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=comments.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comments.d.ts","sourceRoot":"","sources":["../../src/actions/comments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,eAAO,MAAM,UAAU;;;;;;;;;;;;cAOF,CAAC;;aACL,CAAC;YAET,CAAC;cACQ,CAAA;;;;YASs+B,CAAC;aAAoC,CAAC;cAAwC,CAAC;;;;;;;;CADrkC,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { notionId } from '../config.js';
|
|
3
|
+
import { defineNotionAction } from '../definitions.js';
|
|
4
|
+
import { notionComment } from '../schemas.js';
|
|
5
|
+
export const addComment = defineNotionAction({
|
|
6
|
+
slug: 'addComment',
|
|
7
|
+
description: 'Add a comment to a page.',
|
|
8
|
+
input: z.object({ pageId: notionId, commentText: z.string().min(1) }),
|
|
9
|
+
output: notionComment,
|
|
10
|
+
idempotent: false,
|
|
11
|
+
async run({ client, input, req }) {
|
|
12
|
+
const result = await client.request({
|
|
13
|
+
method: 'POST',
|
|
14
|
+
path: '/comments',
|
|
15
|
+
body: {
|
|
16
|
+
parent: { page_id: input.pageId },
|
|
17
|
+
rich_text: [{ text: { content: input.commentText } }],
|
|
18
|
+
},
|
|
19
|
+
signal: req.signal ?? undefined,
|
|
20
|
+
});
|
|
21
|
+
return notionComment.parse(result);
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
//# sourceMappingURL=comments.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comments.js","sourceRoot":"","sources":["../../src/actions/comments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C,MAAM,CAAC,MAAM,UAAU,GAAG,kBAAkB,CAAC;IAC3C,IAAI,EAAE,YAAY;IAClB,WAAW,EAAE,0BAA0B;IACvC,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;IACrE,MAAM,EAAE,aAAa;IACrB,UAAU,EAAE,KAAK;IACjB,KAAK,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE;QAC9B,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC;YAClC,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,WAAW;YACjB,IAAI,EAAE;gBACJ,MAAM,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,MAAM,EAAE;gBACjC,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC;aACtD;YACD,MAAM,EAAE,GAAG,CAAC,MAAM,IAAI,SAAS;SAChC,CAAC,CAAC;QAEH,OAAO,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACrC,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const createDatabaseItem: import("frogbot/pieces").PieceActionDefinition<z.ZodObject<{
|
|
3
|
+
databaseId: z.ZodString;
|
|
4
|
+
fields: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
5
|
+
content: z.ZodOptional<z.ZodString>;
|
|
6
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
7
|
+
object: z.ZodString;
|
|
8
|
+
id: z.ZodString;
|
|
9
|
+
created_time: z.ZodOptional<z.ZodString>;
|
|
10
|
+
last_edited_time: z.ZodOptional<z.ZodString>;
|
|
11
|
+
archived: z.ZodOptional<z.ZodBoolean>;
|
|
12
|
+
url: z.ZodOptional<z.ZodString>;
|
|
13
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
14
|
+
}, z.core.$loose>, object, {
|
|
15
|
+
request: ({ method, path, query, body, signal, }: {
|
|
16
|
+
method?: string;
|
|
17
|
+
path: string;
|
|
18
|
+
query?: Record<string, string | number | boolean | undefined>;
|
|
19
|
+
body?: unknown;
|
|
20
|
+
signal?: AbortSignal;
|
|
21
|
+
}) => Promise<unknown>;
|
|
22
|
+
listAll: ({ path, body, query, signal, }: {
|
|
23
|
+
path: string;
|
|
24
|
+
body?: Record<string, unknown>;
|
|
25
|
+
query?: Record<string, string | number | boolean | undefined>;
|
|
26
|
+
signal?: AbortSignal;
|
|
27
|
+
}) => Promise<{
|
|
28
|
+
[x: string]: unknown;
|
|
29
|
+
object: string;
|
|
30
|
+
id: string;
|
|
31
|
+
}[]>;
|
|
32
|
+
}> & {
|
|
33
|
+
slug: "createDatabaseItem";
|
|
34
|
+
};
|
|
35
|
+
export declare const updateDatabaseItem: import("frogbot/pieces").PieceActionDefinition<z.ZodObject<{
|
|
36
|
+
databaseId: z.ZodString;
|
|
37
|
+
fields: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
38
|
+
itemId: z.ZodString;
|
|
39
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
40
|
+
object: z.ZodString;
|
|
41
|
+
id: z.ZodString;
|
|
42
|
+
created_time: z.ZodOptional<z.ZodString>;
|
|
43
|
+
last_edited_time: z.ZodOptional<z.ZodString>;
|
|
44
|
+
archived: z.ZodOptional<z.ZodBoolean>;
|
|
45
|
+
url: z.ZodOptional<z.ZodString>;
|
|
46
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
47
|
+
}, z.core.$loose>, object, {
|
|
48
|
+
request: ({ method, path, query, body, signal, }: {
|
|
49
|
+
method?: string;
|
|
50
|
+
path: string;
|
|
51
|
+
query?: Record<string, string | number | boolean | undefined>;
|
|
52
|
+
body?: unknown;
|
|
53
|
+
signal?: AbortSignal;
|
|
54
|
+
}) => Promise<unknown>;
|
|
55
|
+
listAll: ({ path, body, query, signal, }: {
|
|
56
|
+
path: string;
|
|
57
|
+
body?: Record<string, unknown>;
|
|
58
|
+
query?: Record<string, string | number | boolean | undefined>;
|
|
59
|
+
signal?: AbortSignal;
|
|
60
|
+
}) => Promise<{
|
|
61
|
+
[x: string]: unknown;
|
|
62
|
+
object: string;
|
|
63
|
+
id: string;
|
|
64
|
+
}[]>;
|
|
65
|
+
}> & {
|
|
66
|
+
slug: "updateDatabaseItem";
|
|
67
|
+
};
|
|
68
|
+
export declare const createPage: import("frogbot/pieces").PieceActionDefinition<z.ZodObject<{
|
|
69
|
+
pageId: z.ZodString;
|
|
70
|
+
title: z.ZodOptional<z.ZodString>;
|
|
71
|
+
content: z.ZodOptional<z.ZodString>;
|
|
72
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
73
|
+
object: z.ZodString;
|
|
74
|
+
id: z.ZodString;
|
|
75
|
+
created_time: z.ZodOptional<z.ZodString>;
|
|
76
|
+
last_edited_time: z.ZodOptional<z.ZodString>;
|
|
77
|
+
archived: z.ZodOptional<z.ZodBoolean>;
|
|
78
|
+
url: z.ZodOptional<z.ZodString>;
|
|
79
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
80
|
+
}, z.core.$loose>, object, {
|
|
81
|
+
request: ({ method, path, query, body, signal, }: {
|
|
82
|
+
method?: string;
|
|
83
|
+
path: string;
|
|
84
|
+
query?: Record<string, string | number | boolean | undefined>;
|
|
85
|
+
body?: unknown;
|
|
86
|
+
signal?: AbortSignal;
|
|
87
|
+
}) => Promise<unknown>;
|
|
88
|
+
listAll: ({ path, body, query, signal, }: {
|
|
89
|
+
path: string;
|
|
90
|
+
body?: Record<string, unknown>;
|
|
91
|
+
query?: Record<string, string | number | boolean | undefined>;
|
|
92
|
+
signal?: AbortSignal;
|
|
93
|
+
}) => Promise<{
|
|
94
|
+
[x: string]: unknown;
|
|
95
|
+
object: string;
|
|
96
|
+
id: string;
|
|
97
|
+
}[]>;
|
|
98
|
+
}> & {
|
|
99
|
+
slug: "createPage";
|
|
100
|
+
};
|
|
101
|
+
export declare const appendToPage: import("frogbot/pieces").PieceActionDefinition<z.ZodObject<{
|
|
102
|
+
pageId: z.ZodString;
|
|
103
|
+
content: z.ZodString;
|
|
104
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
105
|
+
object: z.ZodLiteral<"list">;
|
|
106
|
+
results: z.ZodArray<z.ZodObject<{
|
|
107
|
+
object: z.ZodString;
|
|
108
|
+
id: z.ZodString;
|
|
109
|
+
}, z.core.$loose>>;
|
|
110
|
+
has_more: z.ZodBoolean;
|
|
111
|
+
next_cursor: z.ZodNullable<z.ZodString>;
|
|
112
|
+
}, z.core.$loose>, object, {
|
|
113
|
+
request: ({ method, path, query, body, signal, }: {
|
|
114
|
+
method?: string;
|
|
115
|
+
path: string;
|
|
116
|
+
query?: Record<string, string | number | boolean | undefined>;
|
|
117
|
+
body?: unknown;
|
|
118
|
+
signal?: AbortSignal;
|
|
119
|
+
}) => Promise<unknown>;
|
|
120
|
+
listAll: ({ path, body, query, signal, }: {
|
|
121
|
+
path: string;
|
|
122
|
+
body?: Record<string, unknown>;
|
|
123
|
+
query?: Record<string, string | number | boolean | undefined>;
|
|
124
|
+
signal?: AbortSignal;
|
|
125
|
+
}) => Promise<{
|
|
126
|
+
[x: string]: unknown;
|
|
127
|
+
object: string;
|
|
128
|
+
id: string;
|
|
129
|
+
}[]>;
|
|
130
|
+
}> & {
|
|
131
|
+
slug: "appendToPage";
|
|
132
|
+
};
|
|
133
|
+
export declare const archiveDatabaseItem: import("frogbot/pieces").PieceActionDefinition<z.ZodObject<{
|
|
134
|
+
databaseId: z.ZodString;
|
|
135
|
+
itemId: z.ZodString;
|
|
136
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
137
|
+
object: z.ZodString;
|
|
138
|
+
id: z.ZodString;
|
|
139
|
+
created_time: z.ZodOptional<z.ZodString>;
|
|
140
|
+
last_edited_time: z.ZodOptional<z.ZodString>;
|
|
141
|
+
archived: z.ZodOptional<z.ZodBoolean>;
|
|
142
|
+
url: z.ZodOptional<z.ZodString>;
|
|
143
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
144
|
+
}, z.core.$loose>, object, {
|
|
145
|
+
request: ({ method, path, query, body, signal, }: {
|
|
146
|
+
method?: string;
|
|
147
|
+
path: string;
|
|
148
|
+
query?: Record<string, string | number | boolean | undefined>;
|
|
149
|
+
body?: unknown;
|
|
150
|
+
signal?: AbortSignal;
|
|
151
|
+
}) => Promise<unknown>;
|
|
152
|
+
listAll: ({ path, body, query, signal, }: {
|
|
153
|
+
path: string;
|
|
154
|
+
body?: Record<string, unknown>;
|
|
155
|
+
query?: Record<string, string | number | boolean | undefined>;
|
|
156
|
+
signal?: AbortSignal;
|
|
157
|
+
}) => Promise<{
|
|
158
|
+
[x: string]: unknown;
|
|
159
|
+
object: string;
|
|
160
|
+
id: string;
|
|
161
|
+
}[]>;
|
|
162
|
+
}> & {
|
|
163
|
+
slug: "archiveDatabaseItem" | "restoreDatabaseItem";
|
|
164
|
+
};
|
|
165
|
+
export declare const restoreDatabaseItem: import("frogbot/pieces").PieceActionDefinition<z.ZodObject<{
|
|
166
|
+
databaseId: z.ZodString;
|
|
167
|
+
itemId: z.ZodString;
|
|
168
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
169
|
+
object: z.ZodString;
|
|
170
|
+
id: z.ZodString;
|
|
171
|
+
created_time: z.ZodOptional<z.ZodString>;
|
|
172
|
+
last_edited_time: z.ZodOptional<z.ZodString>;
|
|
173
|
+
archived: z.ZodOptional<z.ZodBoolean>;
|
|
174
|
+
url: z.ZodOptional<z.ZodString>;
|
|
175
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
176
|
+
}, z.core.$loose>, object, {
|
|
177
|
+
request: ({ method, path, query, body, signal, }: {
|
|
178
|
+
method?: string;
|
|
179
|
+
path: string;
|
|
180
|
+
query?: Record<string, string | number | boolean | undefined>;
|
|
181
|
+
body?: unknown;
|
|
182
|
+
signal?: AbortSignal;
|
|
183
|
+
}) => Promise<unknown>;
|
|
184
|
+
listAll: ({ path, body, query, signal, }: {
|
|
185
|
+
path: string;
|
|
186
|
+
body?: Record<string, unknown>;
|
|
187
|
+
query?: Record<string, string | number | boolean | undefined>;
|
|
188
|
+
signal?: AbortSignal;
|
|
189
|
+
}) => Promise<{
|
|
190
|
+
[x: string]: unknown;
|
|
191
|
+
object: string;
|
|
192
|
+
id: string;
|
|
193
|
+
}[]>;
|
|
194
|
+
}> & {
|
|
195
|
+
slug: "archiveDatabaseItem" | "restoreDatabaseItem";
|
|
196
|
+
};
|
|
197
|
+
export declare const listDatabases: import("frogbot/pieces").PieceActionDefinition<z.ZodObject<{
|
|
198
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
199
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
200
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
201
|
+
success: z.ZodLiteral<true>;
|
|
202
|
+
data: z.ZodArray<z.ZodObject<{
|
|
203
|
+
object: z.ZodString;
|
|
204
|
+
id: z.ZodString;
|
|
205
|
+
}, z.core.$loose>>;
|
|
206
|
+
pagination: z.ZodObject<{
|
|
207
|
+
count: z.ZodNumber;
|
|
208
|
+
hasMore: z.ZodBoolean;
|
|
209
|
+
nextCursor: z.ZodNullable<z.ZodString>;
|
|
210
|
+
limit: z.ZodNumber;
|
|
211
|
+
}, z.core.$strip>;
|
|
212
|
+
}, z.core.$strip>, object, {
|
|
213
|
+
request: ({ method, path, query, body, signal, }: {
|
|
214
|
+
method?: string;
|
|
215
|
+
path: string;
|
|
216
|
+
query?: Record<string, string | number | boolean | undefined>;
|
|
217
|
+
body?: unknown;
|
|
218
|
+
signal?: AbortSignal;
|
|
219
|
+
}) => Promise<unknown>;
|
|
220
|
+
listAll: ({ path, body, query, signal, }: {
|
|
221
|
+
path: string;
|
|
222
|
+
body?: Record<string, unknown>;
|
|
223
|
+
query?: Record<string, string | number | boolean | undefined>;
|
|
224
|
+
signal?: AbortSignal;
|
|
225
|
+
}) => Promise<{
|
|
226
|
+
[x: string]: unknown;
|
|
227
|
+
object: string;
|
|
228
|
+
id: string;
|
|
229
|
+
}[]>;
|
|
230
|
+
}> & {
|
|
231
|
+
slug: "listDatabases";
|
|
232
|
+
};
|
|
233
|
+
export declare const listDatabasePages: import("frogbot/pieces").PieceActionDefinition<z.ZodObject<{
|
|
234
|
+
databaseId: z.ZodString;
|
|
235
|
+
fields: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
236
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
237
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
238
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
239
|
+
success: z.ZodLiteral<true>;
|
|
240
|
+
data: z.ZodArray<z.ZodObject<{
|
|
241
|
+
object: z.ZodString;
|
|
242
|
+
id: z.ZodString;
|
|
243
|
+
}, z.core.$loose>>;
|
|
244
|
+
pagination: z.ZodObject<{
|
|
245
|
+
count: z.ZodNumber;
|
|
246
|
+
hasMore: z.ZodBoolean;
|
|
247
|
+
nextCursor: z.ZodNullable<z.ZodString>;
|
|
248
|
+
limit: z.ZodNumber;
|
|
249
|
+
}, z.core.$strip>;
|
|
250
|
+
}, z.core.$strip>, object, {
|
|
251
|
+
request: ({ method, path, query, body, signal, }: {
|
|
252
|
+
method?: string;
|
|
253
|
+
path: string;
|
|
254
|
+
query?: Record<string, string | number | boolean | undefined>;
|
|
255
|
+
body?: unknown;
|
|
256
|
+
signal?: AbortSignal;
|
|
257
|
+
}) => Promise<unknown>;
|
|
258
|
+
listAll: ({ path, body, query, signal, }: {
|
|
259
|
+
path: string;
|
|
260
|
+
body?: Record<string, unknown>;
|
|
261
|
+
query?: Record<string, string | number | boolean | undefined>;
|
|
262
|
+
signal?: AbortSignal;
|
|
263
|
+
}) => Promise<{
|
|
264
|
+
[x: string]: unknown;
|
|
265
|
+
object: string;
|
|
266
|
+
id: string;
|
|
267
|
+
}[]>;
|
|
268
|
+
}> & {
|
|
269
|
+
slug: "listDatabasePages";
|
|
270
|
+
};
|
|
271
|
+
//# sourceMappingURL=core.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../src/actions/core.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAsCxB,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;cA7BF,CAAC;;aAAqC,CAAC;YACnC,CAAC;cAAsB,CAAA;;;;YA0ClD,CAAF;aACgB,CAAC;cAEE,CAAC;;;;;;;;CAuBtB,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;cAvEF,CAAC;;aAAqC,CAAC;YACnC,CAAC;cAAsB,CAAA;;;;YA0ClD,CAAF;aACgB,CAAC;cAEE,CAAC;;;;;;;;CAgDtB,CAAC;AAEH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;cAhGM,CAAC;;aAAqC,CAAC;YACnC,CAAC;cAAsB,CAAA;;;;YA0ClD,CAAF;aACgB,CAAC;cAEE,CAAC;;;;;;;;CAkFtB,CAAC;AAEH,eAAO,MAAM,YAAY;;;;;;;;;;;;;cAlII,CAAC;;aAAqC,CAAC;YACnC,CAAC;cAAsB,CAAA;;;;YA0ClD,CAAF;aACgB,CAAC;cAEE,CAAC;;;;;;;;CA4GtB,CAAC;AAsBH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;cAhLH,CAAC;;aAAqC,CAAC;YACnC,CAAC;cAAsB,CAAA;;;;YA0ClD,CAAF;aACgB,CAAC;cAEE,CAAC;;;;;;;;CAkI+C,CAAC;AACxE,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;cAjLH,CAAC;;aAAqC,CAAC;YACnC,CAAC;cAAsB,CAAA;;;;YA0ClD,CAAF;aACgB,CAAC;cAEE,CAAC;;;;;;;;CAmIgD,CAAC;AAEzE,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;cAnLG,CAAC;;aAAqC,CAAC;YACnC,CAAC;cAAsB,CAAA;;;;YA0ClD,CAAF;aACgB,CAAC;cAEE,CAAC;;;;;;;;CAqKtB,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;cArND,CAAC;;aAAqC,CAAC;YACnC,CAAC;cAAsB,CAAA;;;;YA0ClD,CAAF;aACgB,CAAC;cAEE,CAAC;;;;;;;;CA+MtB,CAAC"}
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { databaseFields, notionId } from '../config.js';
|
|
3
|
+
import { defineNotionAction } from '../definitions.js';
|
|
4
|
+
import { buildFilters } from '../filtering.js';
|
|
5
|
+
import { buildProperty, hasValue } from '../properties.js';
|
|
6
|
+
import { notionList, notionObject, notionPage, pagination } from '../schemas.js';
|
|
7
|
+
const args = z.object({ databaseId: notionId, fields: databaseFields });
|
|
8
|
+
const listOutput = z.object({ success: z.literal(true), data: z.array(notionObject), pagination });
|
|
9
|
+
const schemaResponse = z
|
|
10
|
+
.object({ properties: z.record(z.string(), z.object({ type: z.string() }).passthrough()) })
|
|
11
|
+
.passthrough();
|
|
12
|
+
async function properties(client, databaseId, fields, signal) {
|
|
13
|
+
const database = schemaResponse.parse(await client.request({ path: `/databases/${databaseId}`, signal }));
|
|
14
|
+
const result = {};
|
|
15
|
+
Object.entries(fields).forEach(([name, value]) => {
|
|
16
|
+
if (!hasValue(value))
|
|
17
|
+
return;
|
|
18
|
+
const property = database.properties[name];
|
|
19
|
+
const built = property ? buildProperty(property.type, value) : undefined;
|
|
20
|
+
if (built)
|
|
21
|
+
result[name] = built;
|
|
22
|
+
});
|
|
23
|
+
return result;
|
|
24
|
+
}
|
|
25
|
+
export const createDatabaseItem = defineNotionAction({
|
|
26
|
+
slug: 'createDatabaseItem',
|
|
27
|
+
description: 'Create an item in a database.',
|
|
28
|
+
input: args.extend({ content: z.string().optional() }),
|
|
29
|
+
output: notionPage,
|
|
30
|
+
idempotent: false,
|
|
31
|
+
async run({ client, input, req, }) {
|
|
32
|
+
const values = await properties(client, input.databaseId, input.fields, req.signal ?? undefined);
|
|
33
|
+
const children = input.content
|
|
34
|
+
? [
|
|
35
|
+
{
|
|
36
|
+
object: 'block',
|
|
37
|
+
type: 'paragraph',
|
|
38
|
+
paragraph: { rich_text: [{ type: 'text', text: { content: input.content } }] },
|
|
39
|
+
},
|
|
40
|
+
]
|
|
41
|
+
: [];
|
|
42
|
+
const result = await client.request({
|
|
43
|
+
method: 'POST',
|
|
44
|
+
path: '/pages',
|
|
45
|
+
body: {
|
|
46
|
+
parent: { type: 'database_id', database_id: input.databaseId },
|
|
47
|
+
properties: values,
|
|
48
|
+
children,
|
|
49
|
+
},
|
|
50
|
+
signal: req.signal ?? undefined,
|
|
51
|
+
});
|
|
52
|
+
return notionPage.parse(result);
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
export const updateDatabaseItem = defineNotionAction({
|
|
56
|
+
slug: 'updateDatabaseItem',
|
|
57
|
+
description: 'Update fields on a database item.',
|
|
58
|
+
input: args.extend({ itemId: notionId }),
|
|
59
|
+
output: notionPage,
|
|
60
|
+
idempotent: true,
|
|
61
|
+
async run({ client, input, req }) {
|
|
62
|
+
const values = await properties(client, input.databaseId, input.fields, req.signal ?? undefined);
|
|
63
|
+
const result = await client.request({
|
|
64
|
+
method: 'PATCH',
|
|
65
|
+
path: `/pages/${input.itemId}`,
|
|
66
|
+
body: { properties: values },
|
|
67
|
+
signal: req.signal ?? undefined,
|
|
68
|
+
});
|
|
69
|
+
return notionPage.parse(result);
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
export const createPage = defineNotionAction({
|
|
73
|
+
slug: 'createPage',
|
|
74
|
+
description: 'Create a child page.',
|
|
75
|
+
input: z.object({
|
|
76
|
+
pageId: notionId,
|
|
77
|
+
title: z.string().optional(),
|
|
78
|
+
content: z.string().optional(),
|
|
79
|
+
}),
|
|
80
|
+
output: notionPage,
|
|
81
|
+
idempotent: false,
|
|
82
|
+
async run({ client, input, req }) {
|
|
83
|
+
const result = await client.request({
|
|
84
|
+
method: 'POST',
|
|
85
|
+
path: '/pages',
|
|
86
|
+
body: {
|
|
87
|
+
parent: { page_id: input.pageId },
|
|
88
|
+
properties: { title: { title: [{ text: { content: input.title ?? '' } }] } },
|
|
89
|
+
children: input.content
|
|
90
|
+
? [
|
|
91
|
+
{
|
|
92
|
+
object: 'block',
|
|
93
|
+
type: 'paragraph',
|
|
94
|
+
paragraph: { rich_text: [{ type: 'text', text: { content: input.content } }] },
|
|
95
|
+
},
|
|
96
|
+
]
|
|
97
|
+
: [],
|
|
98
|
+
},
|
|
99
|
+
signal: req.signal ?? undefined,
|
|
100
|
+
});
|
|
101
|
+
return notionPage.parse(result);
|
|
102
|
+
},
|
|
103
|
+
});
|
|
104
|
+
export const appendToPage = defineNotionAction({
|
|
105
|
+
slug: 'appendToPage',
|
|
106
|
+
description: 'Append content to a page.',
|
|
107
|
+
input: z.object({ pageId: notionId, content: z.string() }),
|
|
108
|
+
output: notionList,
|
|
109
|
+
idempotent: false,
|
|
110
|
+
async run({ client, input, req }) {
|
|
111
|
+
const result = await client.request({
|
|
112
|
+
method: 'PATCH',
|
|
113
|
+
path: `/blocks/${input.pageId}/children`,
|
|
114
|
+
body: {
|
|
115
|
+
children: [
|
|
116
|
+
{
|
|
117
|
+
object: 'block',
|
|
118
|
+
type: 'paragraph',
|
|
119
|
+
paragraph: { rich_text: [{ type: 'text', text: { content: input.content } }] },
|
|
120
|
+
},
|
|
121
|
+
],
|
|
122
|
+
},
|
|
123
|
+
signal: req.signal ?? undefined,
|
|
124
|
+
});
|
|
125
|
+
return notionList.parse(result);
|
|
126
|
+
},
|
|
127
|
+
});
|
|
128
|
+
function archive(slug, archived) {
|
|
129
|
+
return defineNotionAction({
|
|
130
|
+
slug,
|
|
131
|
+
description: `${archived ? 'Archive' : 'Restore'} a database item.`,
|
|
132
|
+
input: z.object({ databaseId: notionId, itemId: notionId }),
|
|
133
|
+
output: notionPage,
|
|
134
|
+
idempotent: true,
|
|
135
|
+
async run({ client, input, req }) {
|
|
136
|
+
const result = await client.request({
|
|
137
|
+
method: 'PATCH',
|
|
138
|
+
path: `/pages/${input.itemId}`,
|
|
139
|
+
body: { archived },
|
|
140
|
+
signal: req.signal ?? undefined,
|
|
141
|
+
});
|
|
142
|
+
return notionPage.parse(result);
|
|
143
|
+
},
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
export const archiveDatabaseItem = archive('archiveDatabaseItem', true);
|
|
147
|
+
export const restoreDatabaseItem = archive('restoreDatabaseItem', false);
|
|
148
|
+
export const listDatabases = defineNotionAction({
|
|
149
|
+
slug: 'listDatabases',
|
|
150
|
+
description: 'List accessible databases.',
|
|
151
|
+
input: z.object({ limit: z.number().min(1).max(100).default(10), cursor: z.string().optional() }),
|
|
152
|
+
output: listOutput,
|
|
153
|
+
idempotent: true,
|
|
154
|
+
async run({ client, input, req }) {
|
|
155
|
+
const result = notionList.parse(await client.request({
|
|
156
|
+
method: 'POST',
|
|
157
|
+
path: '/search',
|
|
158
|
+
body: {
|
|
159
|
+
filter: { value: 'database', property: 'object' },
|
|
160
|
+
page_size: input.limit,
|
|
161
|
+
start_cursor: input.cursor,
|
|
162
|
+
sort: { direction: 'descending', timestamp: 'last_edited_time' },
|
|
163
|
+
},
|
|
164
|
+
signal: req.signal ?? undefined,
|
|
165
|
+
}));
|
|
166
|
+
return listOutput.parse({
|
|
167
|
+
success: true,
|
|
168
|
+
data: result.results,
|
|
169
|
+
pagination: {
|
|
170
|
+
count: result.results.length,
|
|
171
|
+
hasMore: result.has_more,
|
|
172
|
+
nextCursor: result.next_cursor,
|
|
173
|
+
limit: input.limit,
|
|
174
|
+
},
|
|
175
|
+
});
|
|
176
|
+
},
|
|
177
|
+
});
|
|
178
|
+
export const listDatabasePages = defineNotionAction({
|
|
179
|
+
slug: 'listDatabasePages',
|
|
180
|
+
description: 'List pages in a database.',
|
|
181
|
+
input: args
|
|
182
|
+
.partial({ fields: true })
|
|
183
|
+
.extend({ limit: z.number().min(1).max(100).default(10), cursor: z.string().optional() }),
|
|
184
|
+
output: listOutput,
|
|
185
|
+
idempotent: true,
|
|
186
|
+
async run({ client, input, req }) {
|
|
187
|
+
const filters = await buildFilters({
|
|
188
|
+
client,
|
|
189
|
+
databaseId: input.databaseId,
|
|
190
|
+
fields: input.fields ?? {},
|
|
191
|
+
match: 'contains',
|
|
192
|
+
signal: req.signal ?? undefined,
|
|
193
|
+
});
|
|
194
|
+
const result = notionList.parse(await client.request({
|
|
195
|
+
method: 'POST',
|
|
196
|
+
path: `/databases/${input.databaseId}/query`,
|
|
197
|
+
body: {
|
|
198
|
+
page_size: input.limit,
|
|
199
|
+
start_cursor: input.cursor,
|
|
200
|
+
...(filters.length > 0 ? { filter: { and: filters } } : {}),
|
|
201
|
+
},
|
|
202
|
+
signal: req.signal ?? undefined,
|
|
203
|
+
}));
|
|
204
|
+
return listOutput.parse({
|
|
205
|
+
success: true,
|
|
206
|
+
data: result.results,
|
|
207
|
+
pagination: {
|
|
208
|
+
count: result.results.length,
|
|
209
|
+
hasMore: result.has_more,
|
|
210
|
+
nextCursor: result.next_cursor,
|
|
211
|
+
limit: input.limit,
|
|
212
|
+
},
|
|
213
|
+
});
|
|
214
|
+
},
|
|
215
|
+
});
|
|
216
|
+
//# sourceMappingURL=core.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../src/actions/core.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEjF,MAAM,IAAI,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC,CAAC;AACxE,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC;AACnG,MAAM,cAAc,GAAG,CAAC;KACrB,MAAM,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC;KA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pieces").PieceActionDefinition<z.ZodObject<{
|
|
3
|
+
method: z.ZodEnum<{
|
|
4
|
+
GET: "GET";
|
|
5
|
+
POST: "POST";
|
|
6
|
+
PATCH: "PATCH";
|
|
7
|
+
DELETE: "DELETE";
|
|
8
|
+
}>;
|
|
9
|
+
path: z.ZodString;
|
|
10
|
+
query: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
11
|
+
body: z.ZodOptional<z.ZodJSONSchema>;
|
|
12
|
+
}, z.core.$strip>, z.ZodJSONSchema, object, {
|
|
13
|
+
request: ({ method, path, query, body, signal, }: {
|
|
14
|
+
method?: string;
|
|
15
|
+
path: string;
|
|
16
|
+
query?: Record<string, string | number | boolean | undefined>;
|
|
17
|
+
body?: unknown;
|
|
18
|
+
signal?: AbortSignal;
|
|
19
|
+
}) => Promise<unknown>;
|
|
20
|
+
listAll: ({ path, body, query, signal, }: {
|
|
21
|
+
path: string;
|
|
22
|
+
body?: Record<string, unknown>;
|
|
23
|
+
query?: Record<string, string | number | boolean | undefined>;
|
|
24
|
+
signal?: AbortSignal;
|
|
25
|
+
}) => Promise<{
|
|
26
|
+
[x: string]: unknown;
|
|
27
|
+
object: string;
|
|
28
|
+
id: string;
|
|
29
|
+
}[]>;
|
|
30
|
+
}> & {
|
|
31
|
+
slug: "customApiCall";
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=customApiCall.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customApiCall.d.ts","sourceRoot":"","sources":["../../src/actions/customApiCall.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,eAAO,MAAM,aAAa;;;;;;;;;;;;cAST,CAAC;;aAAqC,CAAC;YACpD,CAAD;cAAqB,CAAC;;;;YAe23B,CAAC;aAAoC,CAAC;cAAwC,CAAC;;;;;;;;CADj+B,CAAC"}
|