Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion components/notion/actions/append-block/append-block.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
name: "Append Block to Parent",
description:
"Append new and/or existing blocks to the specified parent. [See the documentation](https://developers.notion.com/reference/patch-block-children)",
version: "0.3.9",
version: "0.3.10",
type: "action",
props: {
notion,
Expand Down
3 changes: 2 additions & 1 deletion components/notion/actions/common/base-page-builder.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ export default {
type: properties[property]?.type ?? property,
label: properties[property]?.id || property,
value: this[property] || this.properties?.[property],
name: properties[property]?.name || property,
}));
},
/**
Expand All @@ -107,7 +108,7 @@ export default {
try {
notionProperties[property.label] = notionProperty?.convertToNotion(property);
} catch {
throw new ConfigurationError(`Error converting property with label \`${property.label}\` to Notion format. Must be of type \`${NOTION_CONVERTER[property.type]?.type}\`.`);
throw new ConfigurationError(`Error converting property \`${property.name}\` to Notion format. Must be of type \`${NOTION_CONVERTER[property.type]?.type}\`.`);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "notion-complete-file-upload",
name: "Complete File Upload",
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)",
version: "0.0.4",
version: "0.0.5",
type: "action",
props: {
notion,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
key: "notion-create-database",
name: "Create Database",
description: "Create a database and its initial data source. [See the documentation](https://developers.notion.com/reference/database-create)",
version: "0.1.1",
version: "0.1.2",
type: "action",
props: {
notion,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "notion-create-file-upload",
name: "Create File Upload",
description: "Create a file upload. [See the documentation](https://developers.notion.com/reference/create-a-file-upload)",
version: "0.0.4",
version: "0.0.5",
type: "action",
props: {
notion,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
key: "notion-create-page-from-database",
name: "Create Page from Data Source",
description: "Create a page from a data source. [See the documentation](https://developers.notion.com/reference/post-page)",
version: "1.0.1",
version: "1.0.2",
type: "action",
props: {
notion,
Expand Down Expand Up @@ -45,7 +45,7 @@
description: "Cover [External URL](https://developers.notion.com/reference/file-object#external-file-objects)",
optional: true,
},
alert: {

Check warning on line 48 in components/notion/actions/create-page-from-database/create-page-from-database.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop alert must have a description. See https://pipedream.com/docs/components/guidelines/#props

Check warning on line 48 in components/notion/actions/create-page-from-database/create-page-from-database.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop alert must have a label. See https://pipedream.com/docs/components/guidelines/#props
type: "alert",
alertType: "info",
content: "This action will create an empty page by default. To add content, use the `Page Content` prop below.",
Expand Down
2 changes: 1 addition & 1 deletion components/notion/actions/create-page/create-page.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
key: "notion-create-page",
name: "Create Page",
description: "Create a page from a parent page. [See the documentation](https://developers.notion.com/reference/post-page)",
version: "0.2.22",
version: "0.2.23",
type: "action",
props: {
notion,
Expand Down
2 changes: 1 addition & 1 deletion components/notion/actions/delete-block/delete-block.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
key: "notion-delete-block",
name: "Delete Block",
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)",
version: "0.0.4",
version: "0.0.5",
type: "action",
props: {
notion,
infoLabel: {

Check warning on line 13 in components/notion/actions/delete-block/delete-block.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop infoLabel must have a description. See https://pipedream.com/docs/components/guidelines/#props

Check warning on line 13 in components/notion/actions/delete-block/delete-block.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop infoLabel must have a label. See https://pipedream.com/docs/components/guidelines/#props
type: "alert",
alertType: "info",
content: "**Note:** In the Notion UI application, this moves the block to the \"Trash\" where it can still be accessed and restored.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
key: "notion-duplicate-page",
name: "Duplicate Page",
description: "Create a new page copied from an existing page block. [See the documentation](https://developers.notion.com/reference/post-page)",
version: "0.0.19",
version: "0.0.20",
type: "action",
props: {
notion,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "notion-list-file-uploads",
name: "List File Uploads",
description: "Use this action to list file uploads. [See the documentation](https://developers.notion.com/reference/list-file-uploads)",
version: "0.0.4",
version: "0.0.5",
type: "action",
props: {
notion,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "notion-retrieve-file-upload",
name: "Retrieve File Upload",
description: "Use this action to retrieve a file upload. [See the documentation](https://developers.notion.com/reference/retrieve-a-file-upload)",
version: "0.0.4",
version: "0.0.5",
type: "action",
props: {
notion,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default {
key: "notion-send-file-upload",
name: "Send File Upload",
description: "Send a file upload. [See the documentation](https://developers.notion.com/reference/send-a-file-upload)",
version: "0.0.4",
version: "0.0.5",
type: "action",
props: {
notion,
Expand Down
2 changes: 1 addition & 1 deletion components/notion/actions/update-block/update-block.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
key: "notion-update-block",
name: "Update Child Block",
description: "Updates a child block object. [See the documentation](https://developers.notion.com/reference/update-a-block)",
version: "0.0.4",
version: "0.0.5",
type: "action",
props: {
notion,
Expand All @@ -16,7 +16,7 @@
label: "Block ID",
description: "Block ID retrieved from the **Retrieve Page Content** action",
},
infoLabel: {

Check warning on line 19 in components/notion/actions/update-block/update-block.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop infoLabel must have a description. See https://pipedream.com/docs/components/guidelines/#props

Check warning on line 19 in components/notion/actions/update-block/update-block.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop infoLabel must have a label. See https://pipedream.com/docs/components/guidelines/#props
type: "alert",
alertType: "info",
content: "**Note:** The update replaces the entire value for a given field. If a field is omitted (ex: omitting checked when updating a to_do block), the value will not be changed.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
key: "notion-update-database",
name: "Update Data Source",
description: "Update a data source. [See the documentation](https://developers.notion.com/reference/update-a-data-source)",
version: "1.0.1",
version: "1.0.2",
type: "action",
props: {
notion,
Expand Down
2 changes: 1 addition & 1 deletion components/notion/actions/update-page/update-page.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
key: "notion-update-page",
name: "Update Page",
description: "Update a page's property values. To append page content, use the *Append Block* action instead. [See the documentation](https://developers.notion.com/reference/patch-page)",
version: "2.0.1",
version: "2.0.2",
type: "action",
props: {
notion,
infoLabel: {

Check warning on line 14 in components/notion/actions/update-page/update-page.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop infoLabel must have a description. See https://pipedream.com/docs/components/guidelines/#props

Check warning on line 14 in components/notion/actions/update-page/update-page.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop infoLabel must have a label. See https://pipedream.com/docs/components/guidelines/#props
type: "alert",
alertType: "info",
content: "Properties that are not set will remain unchanged.",
Expand Down
96 changes: 68 additions & 28 deletions components/notion/common/notion-page-properties.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,43 +13,68 @@ const NOTION_PAGE_PROPERTIES = {
type: "string",
example: "New Beauty Title",
options: () => undefined,
convertToNotion: (property) => ({
title: utils.buildTextProperty(property.value),
}),
convertToNotion: (property) => {
if (typeof property.value !== "string") {
throw new Error;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add a message to these errors, in case they do get thrown?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They're caught in /common/base-page-builder.mjs on line 111:

throw new ConfigurationError(Error converting property \${property.name}` to Notion format. Must be of type `${NOTION_CONVERTER[property.type]?.type}`.`);

}
return {
title: utils.buildTextProperty(property.value),
};
},
},
rich_text: {
type: "string",
example: "A beauty text value",
options: () => undefined,
convertToNotion: (property) => ({
rich_text: utils.buildTextProperty(property.value),
}),
convertToNotion: (property) => {
if (typeof property.value !== "string") {
throw new Error;
}
return {
rich_text: utils.buildTextProperty(property.value),
};
},
},
number: {
type: "integer",
example: "59",
options: () => undefined,
convertToNotion: (property) => ({
number: property.value,
}),
convertToNotion: (property) => {
if (isNaN(property.value)) {
throw new Error;
}
return {
number: property.value,
};
},
},
status: {
type: "string",
options: (property) => property.status?.options.map((option) => option.name),
convertToNotion: (property) => ({
status: {
name: property.value,
},
}),
convertToNotion: (property) => {
if (typeof property.value !== "string") {
throw new Error;
}
return {
status: {
name: property.value,
},
};
},
},
select: {
type: "string",
options: (property) => property.select?.options.map((option) => option.name),
convertToNotion: (property) => ({
select: {
name: property.value,
},
}),
convertToNotion: (property) => {
if (typeof property.value !== "string") {
throw new Error;
}
return {
select: {
name: property.value,
},
};
},
},
multi_select: {
type: "string[]",
Expand Down Expand Up @@ -113,25 +138,40 @@ const NOTION_PAGE_PROPERTIES = {
type: "string",
example: "https://pipedream.com",
options: () => undefined,
convertToNotion: (property) => ({
url: property.value,
}),
convertToNotion: (property) => {
if (typeof property.value !== "string") {
throw new Error;
}
return {
url: property.value,
};
},
},
email: {
type: "string",
example: "example@pipedream.com",
options: () => undefined,
convertToNotion: (property) => ({
email: property.value,
}),
convertToNotion: (property) => {
if (typeof property.value !== "string") {
throw new Error;
}
return {
email: property.value,
};
},
},
phone_number: {
type: "string",
example: "999-999-9999",
options: () => undefined,
convertToNotion: (property) => ({
phone_number: property.value,
}),
convertToNotion: (property) => {
if (typeof property.value !== "string") {
throw new Error;
}
return {
phone_number: property.value,
};
},
},
relation: {
type: "string[]",
Expand Down
2 changes: 1 addition & 1 deletion components/notion/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/notion",
"version": "1.0.1",
"version": "1.0.2",
"description": "Pipedream Notion Components",
"main": "notion.app.mjs",
"keywords": [
Expand Down
Loading