diff --git a/components/notion/actions/append-block/append-block.mjs b/components/notion/actions/append-block/append-block.mjs index 98491e5140c67..9ca8f7696dd55 100644 --- a/components/notion/actions/append-block/append-block.mjs +++ b/components/notion/actions/append-block/append-block.mjs @@ -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, diff --git a/components/notion/actions/common/base-page-builder.mjs b/components/notion/actions/common/base-page-builder.mjs index 2345e63759f15..b7ac7cfa6ebdc 100644 --- a/components/notion/actions/common/base-page-builder.mjs +++ b/components/notion/actions/common/base-page-builder.mjs @@ -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, })); }, /** @@ -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}\`.`); } } } diff --git a/components/notion/actions/complete-file-upload/complete-file-upload.mjs b/components/notion/actions/complete-file-upload/complete-file-upload.mjs index e34426e8e0999..876296b2491f1 100644 --- a/components/notion/actions/complete-file-upload/complete-file-upload.mjs +++ b/components/notion/actions/complete-file-upload/complete-file-upload.mjs @@ -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, diff --git a/components/notion/actions/create-database/create-database.mjs b/components/notion/actions/create-database/create-database.mjs index cf75b649ac8db..40dd875659b35 100644 --- a/components/notion/actions/create-database/create-database.mjs +++ b/components/notion/actions/create-database/create-database.mjs @@ -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, diff --git a/components/notion/actions/create-file-upload/create-file-upload.mjs b/components/notion/actions/create-file-upload/create-file-upload.mjs index ab0b03e21b23f..90f26f41472f2 100644 --- a/components/notion/actions/create-file-upload/create-file-upload.mjs +++ b/components/notion/actions/create-file-upload/create-file-upload.mjs @@ -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, diff --git a/components/notion/actions/create-page-from-database/create-page-from-database.mjs b/components/notion/actions/create-page-from-database/create-page-from-database.mjs index afa080bc6473b..48546ca5de419 100644 --- a/components/notion/actions/create-page-from-database/create-page-from-database.mjs +++ b/components/notion/actions/create-page-from-database/create-page-from-database.mjs @@ -8,7 +8,7 @@ export default { 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, diff --git a/components/notion/actions/create-page/create-page.mjs b/components/notion/actions/create-page/create-page.mjs index 032fe7977eb0c..a4c81767d418c 100644 --- a/components/notion/actions/create-page/create-page.mjs +++ b/components/notion/actions/create-page/create-page.mjs @@ -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, diff --git a/components/notion/actions/delete-block/delete-block.mjs b/components/notion/actions/delete-block/delete-block.mjs index 791c085f350e5..94f1818f36e32 100644 --- a/components/notion/actions/delete-block/delete-block.mjs +++ b/components/notion/actions/delete-block/delete-block.mjs @@ -6,7 +6,7 @@ export default { 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, diff --git a/components/notion/actions/duplicate-page/duplicate-page.mjs b/components/notion/actions/duplicate-page/duplicate-page.mjs index ede033c683b67..69144f464dc15 100644 --- a/components/notion/actions/duplicate-page/duplicate-page.mjs +++ b/components/notion/actions/duplicate-page/duplicate-page.mjs @@ -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, diff --git a/components/notion/actions/list-file-uploads/list-file-uploads.mjs b/components/notion/actions/list-file-uploads/list-file-uploads.mjs index 770c7fbfe35b4..ca58c024bf1e0 100644 --- a/components/notion/actions/list-file-uploads/list-file-uploads.mjs +++ b/components/notion/actions/list-file-uploads/list-file-uploads.mjs @@ -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, diff --git a/components/notion/actions/retrieve-file-upload/retrieve-file-upload.mjs b/components/notion/actions/retrieve-file-upload/retrieve-file-upload.mjs index 1308069faf600..ec3d500ddde58 100644 --- a/components/notion/actions/retrieve-file-upload/retrieve-file-upload.mjs +++ b/components/notion/actions/retrieve-file-upload/retrieve-file-upload.mjs @@ -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, diff --git a/components/notion/actions/send-file-upload/send-file-upload.mjs b/components/notion/actions/send-file-upload/send-file-upload.mjs index 6d9747b689090..dccb0cf4d6614 100644 --- a/components/notion/actions/send-file-upload/send-file-upload.mjs +++ b/components/notion/actions/send-file-upload/send-file-upload.mjs @@ -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, diff --git a/components/notion/actions/update-block/update-block.mjs b/components/notion/actions/update-block/update-block.mjs index 89cddd64c9b11..6771492b975e3 100644 --- a/components/notion/actions/update-block/update-block.mjs +++ b/components/notion/actions/update-block/update-block.mjs @@ -7,7 +7,7 @@ export default { 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, diff --git a/components/notion/actions/update-database/update-database.mjs b/components/notion/actions/update-database/update-database.mjs index d00b0cf03f562..907858efdf619 100644 --- a/components/notion/actions/update-database/update-database.mjs +++ b/components/notion/actions/update-database/update-database.mjs @@ -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, diff --git a/components/notion/actions/update-page/update-page.mjs b/components/notion/actions/update-page/update-page.mjs index 6f31a04b750ce..3bbdc9bd6e164 100644 --- a/components/notion/actions/update-page/update-page.mjs +++ b/components/notion/actions/update-page/update-page.mjs @@ -7,7 +7,7 @@ export default { 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, diff --git a/components/notion/common/notion-page-properties.mjs b/components/notion/common/notion-page-properties.mjs index 621e304c3e352..bbd0fa08aec23 100644 --- a/components/notion/common/notion-page-properties.mjs +++ b/components/notion/common/notion-page-properties.mjs @@ -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; + } + 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[]", @@ -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[]", diff --git a/components/notion/package.json b/components/notion/package.json index ba167d9dafbee..2d9b3e6dfb2dd 100644 --- a/components/notion/package.json +++ b/components/notion/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/notion", - "version": "1.0.1", + "version": "1.0.2", "description": "Pipedream Notion Components", "main": "notion.app.mjs", "keywords": [