Skip to content

Commit 9c1ba5b

Browse files
17823 notion (#18005)
* Update Notion component with new actions and enhancements - Added actions for creating, completing, sending, and retrieving file uploads. - Introduced actions for creating and updating databases. - Enhanced user management with actions to list all users and retrieve user details. - Updated existing actions to improve functionality and consistency. - Bumped version numbers for various actions to reflect changes. - Updated dependencies in package.json to the latest versions. * pnpm update * pnpm update * Update components/notion/actions/create-file-upload/create-file-upload.mjs Co-authored-by: michelle0927 <[email protected]> * versions * versions * Fix optional chaining in base-page-builder and update block description for clarity * Refactor update-block action to utilize utility function for content parsing and improve block description formatting * pnpm update --------- Co-authored-by: michelle0927 <[email protected]> Co-authored-by: Michelle Bergeron <[email protected]>
1 parent 717cd0a commit 9c1ba5b

File tree

36 files changed

+623
-66
lines changed

36 files changed

+623
-66
lines changed

components/notion/actions/append-block/append-block.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default {
77
name: "Append Block to Parent",
88
description:
99
"Append new and/or existing blocks to the specified parent. [See the documentation](https://developers.notion.com/reference/patch-block-children)",
10-
version: "0.3.5",
10+
version: "0.3.6",
1111
type: "action",
1212
props: {
1313
notion,

components/notion/actions/common/base-page-builder.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export default {
8484
.map((property) => ({
8585
type: properties[property]?.type ?? property,
8686
label: property,
87-
value: this[property] || this.properties[property],
87+
value: this[property] || this.properties?.[property],
8888
}));
8989
},
9090
/**
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import notion from "../../notion.app.mjs";
2+
import base from "../common/base-page-builder.mjs";
3+
4+
export default {
5+
...base,
6+
key: "notion-complete-file-upload",
7+
name: "Complete File Upload",
8+
description: "Use this action to finalize a `mode=multi_part` file upload after all of the parts have been sent successfully. [See the documentation](https://developers.notion.com/reference/complete-a-file-upload)",
9+
version: "0.0.1",
10+
type: "action",
11+
props: {
12+
notion,
13+
fileUploadId: {
14+
propDefinition: [
15+
notion,
16+
"fileUploadId",
17+
() => ({
18+
status: "pending",
19+
}),
20+
],
21+
},
22+
},
23+
async run({ $ }) {
24+
const response = await this.notion.completeFileUpload({
25+
file_upload_id: this.fileUploadId,
26+
});
27+
28+
$.export("$summary", `Successfully completed file upload with ID ${this.fileUploadId}`);
29+
return response;
30+
},
31+
};

components/notion/actions/create-comment/create-comment.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import notion from "../../notion.app.mjs";
21
import { ConfigurationError } from "@pipedream/platform";
2+
import notion from "../../notion.app.mjs";
33

44
export default {
55
key: "notion-create-comment",
66
name: "Create Comment",
77
description: "Create a comment in a page or existing discussion thread. [See the documentation](https://developers.notion.com/reference/create-a-comment)",
8-
version: "0.0.5",
8+
version: "0.0.6",
99
type: "action",
1010
props: {
1111
notion,
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import utils from "../../common/utils.mjs";
2+
import notion from "../../notion.app.mjs";
3+
import base from "../common/base-page-builder.mjs";
4+
5+
export default {
6+
...base,
7+
key: "notion-create-database",
8+
name: "Create Database",
9+
description: "Create a database. [See the documentation](https://developers.notion.com/reference/create-a-database)",
10+
version: "0.0.1",
11+
type: "action",
12+
props: {
13+
notion,
14+
parent: {
15+
propDefinition: [
16+
notion,
17+
"pageId",
18+
],
19+
label: "Parent Page ID",
20+
description: "Select a parent page or provide a page ID",
21+
},
22+
title: {
23+
type: "string",
24+
label: "Title",
25+
description: "Title of database as it appears in Notion. An array of [rich text objects](https://developers.notion.com/reference/rich-text).",
26+
optional: true,
27+
},
28+
properties: {
29+
type: "object",
30+
label: "Properties",
31+
description: "Property schema of database. The keys are the names of properties as they appear in Notion and the values are [property schema objects](https://developers.notion.com/reference/property-schema-object).",
32+
},
33+
},
34+
async run({ $ }) {
35+
const response = await this.notion.createDatabase({
36+
parent: {
37+
type: "page_id",
38+
page_id: this.parent,
39+
},
40+
title: [
41+
{
42+
type: "text",
43+
text: {
44+
content: this.title,
45+
},
46+
},
47+
],
48+
properties: utils.parseObject(this.properties),
49+
});
50+
51+
$.export("$summary", `Successfully created database with ID ${response.id}`);
52+
return response;
53+
},
54+
};
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
import notion from "../../notion.app.mjs";
2+
import base from "../common/base-page-builder.mjs";
3+
4+
export default {
5+
...base,
6+
key: "notion-create-file-upload",
7+
name: "Create File Upload",
8+
description: "Create a file upload. [See the documentation](https://developers.notion.com/reference/create-a-file-upload)",
9+
version: "0.0.1",
10+
type: "action",
11+
props: {
12+
notion,
13+
mode: {
14+
type: "string",
15+
label: "Mode",
16+
description: "How the file is being sent. Use `Multi Part` for files larger than 20MB. Use `External URL` for files that are temporarily hosted publicly elsewhere.",
17+
options: [
18+
{
19+
label: "Single Part",
20+
value: "single_part",
21+
},
22+
{
23+
label: "Multi Part",
24+
value: "multi_part",
25+
},
26+
{
27+
label: "External URL",
28+
value: "external_url",
29+
},
30+
],
31+
optional: true,
32+
},
33+
filename: {
34+
type: "string",
35+
label: "Filename",
36+
description: "Name of the file to be created. Required when mode is multi_part or external_url. Otherwise optional, and used to override the filename. Must include an extension.",
37+
optional: true,
38+
},
39+
contentType: {
40+
type: "string",
41+
label: "Content Type",
42+
description: "MIME type of the file to be created. Recommended when sending the file in multiple parts. Must match the content type of the file that's sent, and the extension of the `filename` parameter if any.",
43+
optional: true,
44+
},
45+
numberOfParts: {
46+
type: "integer",
47+
label: "Number of Parts",
48+
description: "When mode is `Multi Part`, the number of parts you are uploading. Must be between 1 and 1,000. This must match the number of parts as well as the final part_number you send.",
49+
optional: true,
50+
},
51+
externalUrl: {
52+
type: "string",
53+
label: "External URL",
54+
description: "When mode is `External URL`, provide the HTTPS URL of a publicly accessible file to import into your workspace.",
55+
optional: true,
56+
},
57+
},
58+
async run({ $ }) {
59+
const response = await this.notion.createFileUpload({
60+
mode: this.mode,
61+
filename: this.filename,
62+
content_type: this.contentType,
63+
number_of_parts: this.numberOfParts,
64+
external_url: this.externalUrl,
65+
});
66+
67+
$.export("$summary", `Successfully created file upload with ID ${response.id}`);
68+
return response;
69+
},
70+
};

components/notion/actions/create-page-from-database/create-page-from-database.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
import notion from "../../notion.app.mjs";
2-
import base from "../common/base-page-builder.mjs";
31
import NOTION_ICONS from "../../common/notion-icons.mjs";
42
import utils from "../../common/utils.mjs";
3+
import notion from "../../notion.app.mjs";
4+
import base from "../common/base-page-builder.mjs";
55

66
export default {
77
...base,
88
key: "notion-create-page-from-database",
99
name: "Create Page from Database",
1010
description: "Create a page from a database. [See the documentation](https://developers.notion.com/reference/post-page)",
11-
version: "0.2.2",
11+
version: "0.2.3",
1212
type: "action",
1313
props: {
1414
notion,

components/notion/actions/create-page/create-page.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default {
77
key: "notion-create-page",
88
name: "Create Page",
99
description: "Create a page from a parent page. [See the documentation](https://developers.notion.com/reference/post-page)",
10-
version: "0.2.18",
10+
version: "0.2.19",
1111
type: "action",
1212
props: {
1313
notion,
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import notion from "../../notion.app.mjs";
2+
import base from "../common/base-page-builder.mjs";
3+
4+
export default {
5+
...base,
6+
key: "notion-delete-block",
7+
name: "Delete Block",
8+
description: "Sets a Block object, including page blocks, to archived: true using the ID specified. [See the documentation](https://developers.notion.com/reference/delete-a-block)",
9+
version: "0.0.1",
10+
type: "action",
11+
props: {
12+
notion,
13+
infoLabel: {
14+
type: "alert",
15+
alertType: "info",
16+
content: "**Note:** In the Notion UI application, this moves the block to the \"Trash\" where it can still be accessed and restored.",
17+
},
18+
blockId: {
19+
type: "string",
20+
label: "Block ID",
21+
description: "Block ID retrieved from the **Retrieve Page Content** action",
22+
},
23+
},
24+
async run({ $ }) {
25+
const response = await this.notion.deleteBlock(this.blockId);
26+
$.export("$summary", `Successfully deleted block with ID ${this.blockId}`);
27+
return response;
28+
},
29+
};

components/notion/actions/duplicate-page/duplicate-page.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1+
import utils from "../../common/utils.mjs";
12
import notion from "../../notion.app.mjs";
23
import base from "../common/base-page-builder.mjs";
3-
import utils from "../../common/utils.mjs";
44

55
export default {
66
...base,
77
key: "notion-duplicate-page",
88
name: "Duplicate Page",
99
description: "Create a new page copied from an existing page block. [See the documentation](https://developers.notion.com/reference/post-page)",
10-
version: "0.0.15",
10+
version: "0.0.16",
1111
type: "action",
1212
props: {
1313
notion,

0 commit comments

Comments
 (0)