From 082b0d8d3a4071e1823b6d52c6b3aec59269ab6b Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Wed, 19 Feb 2025 23:40:03 -0300 Subject: [PATCH 01/14] pnpm --- pnpm-lock.yaml | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5c8ac6dc3702a..797de5460fe08 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4729,8 +4729,7 @@ importers: specifier: ^1.6.0 version: 1.6.6 - components/frontify: - specifiers: {} + components/frontify: {} components/ftrack: dependencies: @@ -16065,12 +16064,12 @@ packages: '@dabh/diagnostics@2.0.3': resolution: {integrity: sha512-hrlQOIi7hAfzsMqlGSFyVucrx38O+j6wiGOf//H2ecvIEqYN4ADBSS2iLMh5UFyDunCNniUIPk/q3riFv45xRA==} - '@definitelytyped/header-parser@0.2.16': - resolution: {integrity: sha512-UFsgPft5bhZn07UNGz/9ck4AhdKgLFEOmi2DNr7gXcGL89zbe3u5oVafKUT8j1HOtSBjT8ZEQsXHKlbq+wwF/Q==} + '@definitelytyped/header-parser@0.2.17': + resolution: {integrity: sha512-U0juKFkTOcbkSfO83WSzMEJHYDwoBFiq0tf/JszulL3+7UoSiqunpGmxXS54bm3eGqy7GWjV8AqPQHdeoEaWBQ==} engines: {node: '>=18.18.0'} - '@definitelytyped/typescript-versions@0.1.6': - resolution: {integrity: sha512-gQpXFteIKrOw4ldmBZQfBrD3WobaIG1SwOr/3alXWkcYbkOWa2NRxQbiaYQ2IvYTGaZK26miJw0UOAFiuIs4gA==} + '@definitelytyped/typescript-versions@0.1.7': + resolution: {integrity: sha512-sBzBi1SBn79OkSr8V0H+FzR7QumHk23syPyRxod/VRBrSkgN9rCliIe+nqLoWRAKN8EeKbp00ketnJNLZhucdA==} engines: {node: '>=18.18.0'} '@definitelytyped/utils@0.1.8': @@ -31727,13 +31726,13 @@ snapshots: enabled: 2.0.0 kuler: 2.0.0 - '@definitelytyped/header-parser@0.2.16': + '@definitelytyped/header-parser@0.2.17': dependencies: - '@definitelytyped/typescript-versions': 0.1.6 + '@definitelytyped/typescript-versions': 0.1.7 '@definitelytyped/utils': 0.1.8 semver: 7.6.3 - '@definitelytyped/typescript-versions@0.1.6': {} + '@definitelytyped/typescript-versions@0.1.7': {} '@definitelytyped/utils@0.1.8': dependencies: @@ -38375,7 +38374,7 @@ snapshots: dts-critic@3.3.11(typescript@5.7.2): dependencies: - '@definitelytyped/header-parser': 0.2.16 + '@definitelytyped/header-parser': 0.2.17 command-exists: 1.2.9 rimraf: 3.0.2 semver: 6.3.1 @@ -38385,8 +38384,8 @@ snapshots: dtslint@4.2.1(typescript@5.7.2): dependencies: - '@definitelytyped/header-parser': 0.2.16 - '@definitelytyped/typescript-versions': 0.1.6 + '@definitelytyped/header-parser': 0.2.17 + '@definitelytyped/typescript-versions': 0.1.7 '@definitelytyped/utils': 0.1.8 dts-critic: 3.3.11(typescript@5.7.2) fs-extra: 6.0.1 From c3b727c0e60a21d5cb0a292d079af551104101cc Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Wed, 19 Feb 2025 23:57:58 -0300 Subject: [PATCH 02/14] App prop description updates --- components/notion/notion.app.mjs | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/components/notion/notion.app.mjs b/components/notion/notion.app.mjs index 0d3d120c7e6b0..d5e42baa8b84a 100644 --- a/components/notion/notion.app.mjs +++ b/components/notion/notion.app.mjs @@ -8,7 +8,7 @@ export default { databaseId: { type: "string", label: "Database ID", - description: "The identifier for a Notion database", + description: "Select a database or provide a database ID", async options({ prevContext }) { const response = await this.listDatabases({ start_cursor: prevContext.nextPageParameters ?? undefined, @@ -20,7 +20,7 @@ export default { pageId: { type: "string", label: "Page ID", - description: "The identifier for a Notion page", + description: "Select a page or provide a page ID", async options({ prevContext }) { const response = await this.search(undefined, { start_cursor: prevContext.nextPageParameters ?? undefined, @@ -32,7 +32,7 @@ export default { pageIdInDatabase: { type: "string", label: "Page ID", - description: "The identifier for a Notion page", + description: "Select a page from the database, or provide a page ID", async options({ prevContext, databaseId, }) { @@ -46,7 +46,7 @@ export default { propertyId: { type: "string", label: "Property ID", - description: "The identifier for a Notion page property", + description: "Select a page property, or provide a property ID", async options({ pageId }) { const response = await this.retrievePage(pageId); @@ -77,7 +77,7 @@ export default { metaTypes: { type: "string[]", label: "Meta Types", - description: "Select the page attributes such as icon and cover", + description: "Select one or more page attributes (such as icon and cover)", options: Object.keys(NOTION_META), optional: true, reloadProps: true, @@ -85,7 +85,7 @@ export default { propertyTypes: { type: "string[]", label: "Property Types", - description: "Select the page properties", + description: "Select one or more page properties", optional: true, async options({ parentId, parentType, @@ -105,19 +105,19 @@ export default { type: "boolean", label: "Archive page", description: "Set to true to archive (delete) a page. Set to false to un-archive\ -(restore) a page.", +(restore) a page", optional: true, }, title: { type: "string", label: "Page Title", - description: "The page title. Defaults to `Untitled`.", + description: "The page title. Defaults to `Untitled`", optional: true, }, userIds: { type: "string[]", label: "Users", - description: "A list of users", + description: "Select one or more users, or provide user IDs", async options() { const users = await this.getUsers(); @@ -130,7 +130,7 @@ export default { sortDirection: { type: "string", label: "Sort Direction", - description: "The direction to sort.", + description: "The direction to sort by", optional: true, options: [ "ascending", @@ -140,20 +140,22 @@ export default { pageSize: { type: "integer", label: "Page Size", - description: "The number of items from the full list desired in the response. Maximum: 100", + description: "The number of items from the full list desired in the response (max 100)", default: 100, + min: 1, + max: 100, optional: true, }, startCursor: { type: "string", label: "Start Cursor (page_id)", - description: "If supplied, this endpoint will return a page of results starting after the cursor provided. If not supplied, this endpoint will return the first page of results.", + description: "Leave blank to retrieve the first page of results. Otherwise, the response will be the page of results starting after the provided cursor", optional: true, }, filter: { type: "string", label: "Filter", - description: "The value of the property to filter the results by. Possible values for object type include `page` or `database`. Limitation: Currently the only filter allowed is `object` which will filter by type of object (either `page` or `database`)", + description: "The value of the property to filter results by", optional: true, options: [ "page", From 4b50092455849cfe64221687a4422edd29145069 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Mon, 3 Mar 2025 17:51:39 -0300 Subject: [PATCH 03/14] pnpm --- pnpm-lock.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 11be3e5e04962..076d01be71ee8 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -2532,8 +2532,7 @@ importers: specifier: ^0.12.4 version: 0.12.5 - components/cloudflare_browser_rendering: - specifiers: {} + components/cloudflare_browser_rendering: {} components/cloudflare_r2: {} From c014f600f87e85daf3fffa613541c2cf33f315a0 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Mon, 3 Mar 2025 20:41:48 -0300 Subject: [PATCH 04/14] "Append Block" significant improvements --- .../actions/append-block/append-block.mjs | 80 +++++++++++++++---- components/notion/notion.app.mjs | 2 +- 2 files changed, 64 insertions(+), 18 deletions(-) diff --git a/components/notion/actions/append-block/append-block.mjs b/components/notion/actions/append-block/append-block.mjs index dbc581d1453e4..50e1c597b950f 100644 --- a/components/notion/actions/append-block/append-block.mjs +++ b/components/notion/actions/append-block/append-block.mjs @@ -5,8 +5,9 @@ export default { ...base, key: "notion-append-block", name: "Append Block to Parent", - description: "Creates and appends blocks to the specified parent. [See the documentation](https://developers.notion.com/reference/patch-block-children)", - version: "0.2.17", + description: + "Creates and appends blocks to the specified parent. [See the documentation](https://developers.notion.com/reference/patch-block-children)", + version: "0.3.0", type: "action", props: { notion, @@ -16,13 +17,39 @@ export default { "pageId", ], label: "Parent Block ID", - description: "The identifier for the parent block", + description: "Select a parent block/page or provide its ID", + }, + blockTypes: { + type: "string[]", + label: "Block Type(s)", + description: "Select which type(s) of block you'd like to append", + reloadProps: true, + options: [ + { + label: + "Use objects of existing blocks (e.g. objects returned from previous steps)", + value: "blockObjects", + }, + { + label: "Select existing blocks or provide their IDs", + value: "blockIds", + }, + { + label: "Provide Markdown content to create new blocks with", + value: "markupContents", + }, + { + label: "Provide Image URLs to create new image blocks", + value: "imageUrls", + }, + ], }, blockObjects: { type: "string[]", label: "Block Objects", - description: "This prop accepts an array of block objects to be appended. Using a custom expression in this prop is recommended.", - optional: true, + description: + "An array of block objects to be appended. You can use a custom expression to reference block objects from previous steps. [See the documentation](https://developers.notion.com/reference/block) for more information", + hidden: true, }, blockIds: { propDefinition: [ @@ -31,22 +58,37 @@ export default { ], type: "string[]", label: "Block IDs", - description: "Contents of selected blocks will be appended", - optional: true, + description: "Select one or more block(s) or page(s) to append (selecting a page appends its children). You can also provide block or page IDs.", + hidden: true, }, markupContents: { type: "string[]", label: "Markup Contents", - description: "Content of new blocks to append. You must use Markdown syntax [See docs](https://www.notion.so/help/writing-and-editing-basics#markdown-&-shortcuts)", - optional: true, + description: + "Each entry is the content of a new block to append, using Markdown syntax. [See the documentation](https://www.notion.com/help/writing-and-editing-basics#markdown-and-shortcuts) for more information", + hidden: true, }, imageUrls: { type: "string[]", label: "Image URLs", - description: "List of URLs to append as image blocks", - optional: true, + description: "One or more Image URLs to append new image blocks with. [See the documentation](https://www.notion.com/help/images-files-and-media#media-block-types) for more information", + hidden: true, }, }, + additionalProps(currentProps) { + const { blockTypes } = this; + + for (let prop of [ + "blockObjects", + "blockIds", + "markupContents", + "imageUrls", + ]) { + currentProps[prop].hidden = !blockTypes.includes(prop); + } + + return {}; + }, methods: { ...base.methods, chunkArray(array, chunkSize = 100) { @@ -58,11 +100,12 @@ export default { }, }, async run({ $ }) { + const { blockTypes } = this; const children = []; // add blocks from blockObjects - if (this.blockObjects?.length > 0) { + if (blockTypes.includes("blockObjects") && this.blockObjects?.length > 0) { for (const obj of this.blockObjects) { - const child = (typeof obj === "string") + const child = typeof obj === "string" ? JSON.parse(obj) : obj; children.push(child); @@ -70,7 +113,7 @@ export default { } // add blocks from blockIds - if (this.blockIds?.length > 0) { + if (blockTypes.includes("blockIds") && this.blockIds?.length > 0) { for (const id of this.blockIds) { const block = await this.notion.retrieveBlock(id); block.children = await this.notion.retrieveBlockChildren(block); @@ -80,7 +123,7 @@ export default { } // add blocks from markup - if (this.markupContents?.length > 0) { + if (blockTypes.includes("markupContents") && this.markupContents?.length > 0) { for (const content of this.markupContents) { const block = this.createBlocks(content); children.push(...block); @@ -88,7 +131,7 @@ export default { } // add image blocks - if (this.imageUrls?.length) { + if (blockTypes.includes("imageUrls") && this.imageUrls?.length) { for (const url of this.imageUrls) { children.push({ type: "image", @@ -111,7 +154,10 @@ export default { const chunks = this.chunkArray(children); for (const chunk of chunks) { - const { results: payload } = await this.notion.appendBlock(this.pageId, chunk); + const { results: payload } = await this.notion.appendBlock( + this.pageId, + chunk, + ); results.push(payload); } diff --git a/components/notion/notion.app.mjs b/components/notion/notion.app.mjs index d5e42baa8b84a..a74ac490b9afc 100644 --- a/components/notion/notion.app.mjs +++ b/components/notion/notion.app.mjs @@ -20,7 +20,7 @@ export default { pageId: { type: "string", label: "Page ID", - description: "Select a page or provide a page ID", + description: "Search for a page or provide a page ID", async options({ prevContext }) { const response = await this.search(undefined, { start_cursor: prevContext.nextPageParameters ?? undefined, From 0afbd4e752149db359187454b6383ff380d0597f Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Tue, 4 Mar 2025 02:38:16 -0300 Subject: [PATCH 05/14] Search and Create Page improvements --- .../actions/common/base-page-builder.mjs | 2 +- .../actions/create-comment/create-comment.mjs | 12 ++++++--- .../create-page-from-database.mjs | 12 ++++----- .../actions/create-page/create-page.mjs | 12 ++++----- .../notion/actions/find-page/find-page.mjs | 22 ---------------- components/notion/actions/search/search.mjs | 25 +++++++------------ components/notion/notion.app.mjs | 14 ++++++++--- 7 files changed, 40 insertions(+), 59 deletions(-) delete mode 100644 components/notion/actions/find-page/find-page.mjs diff --git a/components/notion/actions/common/base-page-builder.mjs b/components/notion/actions/common/base-page-builder.mjs index af11d746910ac..145c6099b086f 100644 --- a/components/notion/actions/common/base-page-builder.mjs +++ b/components/notion/actions/common/base-page-builder.mjs @@ -39,7 +39,7 @@ export default { */ _buildPropDescription(type, example) { const typeName = type.replace(/_/g, "-"); - const description = `The type of this property is \`${type}\`. [See ${type} type docs here](https://developers.notion.com/reference/property-object#${typeName}).`; + const description = `The type of this property is \`${type}\`. [See ${type} type documentation here](https://developers.notion.com/reference/property-object#${typeName}).`; const descriptionExample = example ? `e.g. ${example}.` : ""; diff --git a/components/notion/actions/create-comment/create-comment.mjs b/components/notion/actions/create-comment/create-comment.mjs index 8471473e20d62..e2c717607a9c4 100644 --- a/components/notion/actions/create-comment/create-comment.mjs +++ b/components/notion/actions/create-comment/create-comment.mjs @@ -9,18 +9,22 @@ export default { type: "action", props: { notion, + infoLabel: { + type: "alert", + alertType: "info", + content: "Provide either a page ID or a discussion thread ID to create the comment under.", + }, pageId: { propDefinition: [ notion, "pageId", ], - description: "Unique identifier of a page. Either this or a Discussion ID is required (not both)", optional: true, }, discussionId: { type: "string", label: "Discussion ID", - description: "A UUID identifier for a discussion thread. Either this or a Page ID is required (not both)", + description: "The ID of a discussion thread. [See the documentation](https://developers.notion.com/docs/working-with-comments#retrieving-a-discussion-id) for more information", optional: true, }, comment: { @@ -31,7 +35,7 @@ export default { }, async run({ $ }) { if ((this.pageId && this.discussionId) || (!this.pageId && !this.discussionId)) { - throw new ConfigurationError("Either a Page ID or a Discussion ID is required (not both)"); + throw new ConfigurationError("Provide either a page ID or a discussion thread ID to create the comment under"); } const response = await this.notion._getNotionClient().comments.create({ @@ -47,7 +51,7 @@ export default { }, ], }); - $.export("$summary", `Successfully added comment with ID: ${response.id}`); + $.export("$summary", `Successfully created comment (ID: ${response.id})`); return response; }, }; 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 971c77ec95102..2247fa59b497f 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 @@ -17,7 +17,7 @@ export default { "databaseId", ], label: "Parent Database ID", - description: "The identifier for a Notion parent page", + description: "Select a parent database or provide a database ID", reloadProps: true, }, metaTypes: { @@ -40,13 +40,13 @@ export default { alert: { type: "alert", alertType: "info", - content: "This action will create an empty page by default. To add content, use the `pageContent` prop below.", + content: "This action will create an empty page by default. To add content, use the `Page Content` prop below.", }, pageContent: { - type: "string", - label: "Page Content", - description: "Content of the page. You can use Markdown syntax [See docs](https://www.notion.so/help/writing-and-editing-basics#markdown-&-shortcuts)", - optional: true, + propDefinition: [ + notion, + "pageContent", + ], }, }, async additionalProps() { diff --git a/components/notion/actions/create-page/create-page.mjs b/components/notion/actions/create-page/create-page.mjs index b818d7c3a92db..06f7de39fbdb3 100644 --- a/components/notion/actions/create-page/create-page.mjs +++ b/components/notion/actions/create-page/create-page.mjs @@ -6,7 +6,7 @@ export default { ...base, key: "notion-create-page", name: "Create Page", - description: "Creates a page from a parent page. The only valid property is *title*. [See the documentation](https://developers.notion.com/reference/post-page)", + description: "Creates a page from a parent page. [See the documentation](https://developers.notion.com/reference/post-page)", version: "0.2.13", type: "action", props: { @@ -17,7 +17,7 @@ export default { "pageId", ], label: "Parent Page ID", - description: "The identifier for a Notion parent page", + description: "Select a parent page or provide a page ID", reloadProps: true, }, title: { @@ -33,10 +33,10 @@ export default { ], }, pageContent: { - type: "string", - label: "Page Content", - description: "Content of the page. You can use Markdown syntax [See docs](https://www.notion.so/help/writing-and-editing-basics#markdown-&-shortcuts)", - optional: true, + propDefinition: [ + notion, + "pageContent", + ], }, }, async additionalProps() { diff --git a/components/notion/actions/find-page/find-page.mjs b/components/notion/actions/find-page/find-page.mjs deleted file mode 100644 index bbf4c8291934d..0000000000000 --- a/components/notion/actions/find-page/find-page.mjs +++ /dev/null @@ -1,22 +0,0 @@ -import common from "../common/base-search.mjs"; - -export default { - ...common, - key: "notion-find-page", - name: "Find a Page", - description: "Searches for a page by its title. [See the docs](https://developers.notion.com/reference/post-search)", - version: "0.0.6", - type: "action", - methods: { - getSummary({ - response, title, - }) { - return `Found ${response.results.length} pages ${title - ? `with title search ${this.title}` - : ""}`; - }, - getFilter() { - return "page"; - }, - }, -}; diff --git a/components/notion/actions/search/search.mjs b/components/notion/actions/search/search.mjs index ff86e409c06fc..982ff15400991 100644 --- a/components/notion/actions/search/search.mjs +++ b/components/notion/actions/search/search.mjs @@ -3,19 +3,16 @@ import common from "../common/base-search.mjs"; export default { ...common, key: "notion-search", - name: "Search", - description: "Searches for a page or database. [See the docs](https://developers.notion.com/reference/post-search)", + name: "Find Pages or Databases", + description: "Searches for a page or database. [See the documentation](https://developers.notion.com/reference/post-search)", version: "0.0.4", type: "action", props: { ...common.props, title: { - propDefinition: [ - common.props.notion, - "title", - ], - label: "Query", - description: "The object title.", + type: "string", + label: "Query (Title)", + description: "The object title to search for", }, filter: { propDefinition: [ @@ -25,14 +22,10 @@ export default { }, }, methods: { - getSummary({ - response, title, - }) { - return `Found ${response.results.length} object${response.results.length > 1 - ? "s" - : ""} ${title - ? `with query search ${this.title}` - : ""}`; + getSummary({ response }) { + return `Found ${response.results?.length} object${response.results?.length === 1 + ? "" + : "s"} with query search ${this.title}`; }, getFilter() { return this.filter; diff --git a/components/notion/notion.app.mjs b/components/notion/notion.app.mjs index a74ac490b9afc..8c86f495a612b 100644 --- a/components/notion/notion.app.mjs +++ b/components/notion/notion.app.mjs @@ -32,7 +32,7 @@ export default { pageIdInDatabase: { type: "string", label: "Page ID", - description: "Select a page from the database, or provide a page ID", + description: "Select a page from the database or provide a page ID", async options({ prevContext, databaseId, }) { @@ -46,7 +46,7 @@ export default { propertyId: { type: "string", label: "Property ID", - description: "Select a page property, or provide a property ID", + description: "Select a page property or provide a property ID", async options({ pageId }) { const response = await this.retrievePage(pageId); @@ -154,14 +154,20 @@ export default { }, filter: { type: "string", - label: "Filter", - description: "The value of the property to filter results by", + label: "Page or Database", + description: "Whether to search for pages or databases", optional: true, options: [ "page", "database", ], }, + pageContent: { + type: "string", + label: "Page Content", + description: "The content of the page, using Markdown syntax. [See the documentation](https://www.notion.com/help/writing-and-editing-basics#markdown-and-shortcuts) for more information", + optional: true, + }, }, methods: { _getNotionClient() { From 78833f1789269b8d20bc602e9f7989c1a99d94fb Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Tue, 4 Mar 2025 03:14:18 -0300 Subject: [PATCH 06/14] Description and summary improvements --- .../notion/actions/duplicate-page/duplicate-page.mjs | 6 +++--- .../notion/actions/query-database/query-database.mjs | 12 ++++++++---- .../notion/actions/retrieve-block/retrieve-block.mjs | 12 +++++++----- .../retrieve-database-content.mjs | 6 ++++-- .../retrieve-database-schema.mjs | 4 ++-- .../notion/actions/retrieve-page/retrieve-page.mjs | 7 +++++-- 6 files changed, 29 insertions(+), 18 deletions(-) diff --git a/components/notion/actions/duplicate-page/duplicate-page.mjs b/components/notion/actions/duplicate-page/duplicate-page.mjs index 6d21c41091280..56c0fb7cac6d8 100644 --- a/components/notion/actions/duplicate-page/duplicate-page.mjs +++ b/components/notion/actions/duplicate-page/duplicate-page.mjs @@ -16,7 +16,7 @@ export default { notion, "pageId", ], - description: "The page to copy", + description: "Select a page to copy or provide a page ID", }, title: { propDefinition: [ @@ -31,7 +31,7 @@ export default { "pageId", ], label: "Parent Page ID", - description: "The parent page of the new page being created", + description: "Select a parent page for the new page being created, or provide the ID of a parent page", }, }, async run({ $ }) { @@ -65,7 +65,7 @@ export default { const results = await this.notion.createPage(page); const pageName = this.notion.extractPageTitle(results); - $.export("$summary", `Successfully created the new page, "[${pageName}](${results.url})"`); + $.export("$summary", `Successfully created page "[${pageName}](${results.url})"`); return results; }, }; diff --git a/components/notion/actions/query-database/query-database.mjs b/components/notion/actions/query-database/query-database.mjs index b7a03be37761c..f505ba4621e4f 100644 --- a/components/notion/actions/query-database/query-database.mjs +++ b/components/notion/actions/query-database/query-database.mjs @@ -4,7 +4,7 @@ import utils from "../../common/utils.mjs"; export default { key: "notion-query-database", name: "Query Database", - description: "Query a database. [See the docs](https://developers.notion.com/reference/post-database-query)", + description: "Query a database with a specified filter. [See the documentation](https://developers.notion.com/reference/post-database-query)", version: "0.0.8", type: "action", props: { @@ -16,8 +16,8 @@ export default { ], }, filter: { - label: "Filter", - description: "The filter to query. [See how filters work here](https://developers.notion.com/reference/post-database-query-filter). E.g. { \"property\": \"Email\", \"rich_text\": { \"contains\": \"gmail.com\" } }", + label: "Filter (query)", + description: "The filter to apply, as a JSON-stringified object. [See the documentation for available filters](https://developers.notion.com/reference/post-database-query-filter). Example: `{ \"property\": \"Name\", \"title\": { \"contains\": \"title to search for\" } }`", type: "string", }, }, @@ -28,7 +28,11 @@ export default { filter: utils.parseStringToJSON(filter), }); - $.export("$summary", "Retrieved database query result"); + const length = response?.results?.length; + + $.export("$summary", `Retrieved ${length} result${length === 1 + ? "" + : "s"}`); return response; }, diff --git a/components/notion/actions/retrieve-block/retrieve-block.mjs b/components/notion/actions/retrieve-block/retrieve-block.mjs index aeaccb92ae413..75e25a2836e7d 100644 --- a/components/notion/actions/retrieve-block/retrieve-block.mjs +++ b/components/notion/actions/retrieve-block/retrieve-block.mjs @@ -3,7 +3,7 @@ import notion from "../../notion.app.mjs"; export default { key: "notion-retrieve-block", name: "Retrieve Block", - description: "Retrieves a block. A block object represents content within Notion. Blocks can be text, lists, media, and more. A page is also a type of block. [See the docs](https://developers.notion.com/reference/retrieve-a-block)", + description: "Get details of a block, which can be text, lists, media, a page, among others. [See the documentation](https://developers.notion.com/reference/retrieve-a-block)", version: "0.0.4", type: "action", props: { @@ -14,12 +14,12 @@ export default { "pageId", ], label: "Block ID", - description: "The identifier for a Notion block", + description: "Select a block or provide a block ID", }, retrieveChildren: { type: "boolean", - label: "Retrieve Block Children", - description: "Returns recursively all the children for the block ID specified. [See docs](https://developers.notion.com/reference/get-block-children)", + label: "Retrieve Children", + description: "Retrieve all the children (recursively) for the specified block. [See the documentation](https://developers.notion.com/reference/get-block-children) for more information", optional: true, default: false, }, @@ -29,7 +29,9 @@ export default { if (this.retrieveChildren) { block.children = await this.notion.retrieveBlockChildren(block); } - $.export("$summary", "Retrieved block successfully"); + $.export("$summary", `Successfully retrieved block${this.retrieveChildren + ? ` with ${block.children.length ?? 0} children` + : ""}`); return block; }, }; diff --git a/components/notion/actions/retrieve-database-content/retrieve-database-content.mjs b/components/notion/actions/retrieve-database-content/retrieve-database-content.mjs index 7af746c5a9921..14fcf6a9a4145 100644 --- a/components/notion/actions/retrieve-database-content/retrieve-database-content.mjs +++ b/components/notion/actions/retrieve-database-content/retrieve-database-content.mjs @@ -3,7 +3,7 @@ import notion from "../../notion.app.mjs"; export default { key: "notion-retrieve-database-content", name: "Retrieve Database Content", - description: "Retreive the content of a database. [See the docs](https://developers.notion.com/reference/post-database-query)", + description: "Get all content of a database. [See the documentation](https://developers.notion.com/reference/post-database-query)", version: "0.0.3", type: "action", props: { @@ -17,7 +17,9 @@ export default { }, async run({ $ }) { const { results } = await this.notion.queryDatabase(this.databaseId); - $.export("$summary", "Retrieved database content"); + $.export("$summary", `Successfully retrieved ${results.length} object${results.length === 1 + ? "" + : "s"} in database`); return results; }, }; diff --git a/components/notion/actions/retrieve-database-schema/retrieve-database-schema.mjs b/components/notion/actions/retrieve-database-schema/retrieve-database-schema.mjs index 40c614c3b0b6f..c3ad3687c029a 100644 --- a/components/notion/actions/retrieve-database-schema/retrieve-database-schema.mjs +++ b/components/notion/actions/retrieve-database-schema/retrieve-database-schema.mjs @@ -3,7 +3,7 @@ import notion from "../../notion.app.mjs"; export default { key: "notion-retrieve-database-schema", name: "Retrieve Database Schema", - description: "Retrieves a database object. Database objects describe the property schema of a database in Notion. [See the docs](https://developers.notion.com/reference/retrieve-a-database)", + description: "Get the property schema of a database in Notion. [See the documentation](https://developers.notion.com/reference/retrieve-a-database)", version: "0.0.5", type: "action", props: { @@ -17,7 +17,7 @@ export default { }, async run({ $ }) { const response = await this.notion.retrieveDatabase(this.databaseId); - $.export("$summary", "Retrieved database successfully"); + $.export("$summary", "Successfully retrieved database schema"); return response; }, }; diff --git a/components/notion/actions/retrieve-page/retrieve-page.mjs b/components/notion/actions/retrieve-page/retrieve-page.mjs index f1af22c26eb28..1186018eb6aad 100644 --- a/components/notion/actions/retrieve-page/retrieve-page.mjs +++ b/components/notion/actions/retrieve-page/retrieve-page.mjs @@ -3,7 +3,7 @@ import notion from "../../notion.app.mjs"; export default { key: "notion-retrieve-page", name: "Retrieve Page", - description: "Retrieves a page. [See the docs](https://developers.notion.com/reference/retrieve-a-page)", + description: "Get details of a page. [See the documentation](https://developers.notion.com/reference/retrieve-a-page)", version: "0.0.4", type: "action", props: { @@ -17,7 +17,10 @@ export default { }, async run({ $ }) { const response = await this.notion.retrievePage(this.pageId); - $.export("$summary", "Retrieved page successfully"); + const title = response?.properties?.Name?.title[0]?.plain_text; + $.export("$summary", `Sucessfully retrieved page${title + ? ` "${title}"` + : ""}`); return response; }, }; From e02bcc1c368058e0d43cfd184cfee77c9d0a14e2 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Tue, 4 Mar 2025 03:36:55 -0300 Subject: [PATCH 07/14] Description updates and alert props --- components/notion/actions/append-block/append-block.mjs | 2 +- .../notion/actions/create-comment/create-comment.mjs | 2 +- .../create-page-from-database.mjs | 2 +- components/notion/actions/create-page/create-page.mjs | 2 +- .../notion/actions/duplicate-page/duplicate-page.mjs | 2 +- .../retrieve-page-property-item.mjs | 4 ++-- components/notion/actions/update-page/update-page.mjs | 9 +++++++-- components/notion/notion.app.mjs | 7 +++---- 8 files changed, 17 insertions(+), 13 deletions(-) diff --git a/components/notion/actions/append-block/append-block.mjs b/components/notion/actions/append-block/append-block.mjs index 50e1c597b950f..cedcabe3b5de5 100644 --- a/components/notion/actions/append-block/append-block.mjs +++ b/components/notion/actions/append-block/append-block.mjs @@ -6,7 +6,7 @@ export default { key: "notion-append-block", name: "Append Block to Parent", description: - "Creates and appends blocks to the specified parent. [See the documentation](https://developers.notion.com/reference/patch-block-children)", + "Append new and/or existing blocks to the specified parent. [See the documentation](https://developers.notion.com/reference/patch-block-children)", version: "0.3.0", type: "action", props: { diff --git a/components/notion/actions/create-comment/create-comment.mjs b/components/notion/actions/create-comment/create-comment.mjs index e2c717607a9c4..f35c8811ac049 100644 --- a/components/notion/actions/create-comment/create-comment.mjs +++ b/components/notion/actions/create-comment/create-comment.mjs @@ -4,7 +4,7 @@ import { ConfigurationError } from "@pipedream/platform"; export default { key: "notion-create-comment", name: "Create Comment", - description: "Creates a comment in a page or existing discussion thread. [See the documentation](https://developers.notion.com/reference/create-a-comment)", + description: "Create a comment in a page or existing discussion thread. [See the documentation](https://developers.notion.com/reference/create-a-comment)", version: "0.0.1", type: "action", props: { 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 2247fa59b497f..0b462cf3c2627 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 @@ -6,7 +6,7 @@ export default { ...base, key: "notion-create-page-from-database", name: "Create Page from Database", - description: "Creates a page from a database. [See the documentation](https://developers.notion.com/reference/post-page)", + description: "Create a page from a database. [See the documentation](https://developers.notion.com/reference/post-page)", version: "0.1.15", type: "action", props: { diff --git a/components/notion/actions/create-page/create-page.mjs b/components/notion/actions/create-page/create-page.mjs index 06f7de39fbdb3..f09b4014e4855 100644 --- a/components/notion/actions/create-page/create-page.mjs +++ b/components/notion/actions/create-page/create-page.mjs @@ -6,7 +6,7 @@ export default { ...base, key: "notion-create-page", name: "Create Page", - description: "Creates a page from a parent page. [See the documentation](https://developers.notion.com/reference/post-page)", + description: "Create a page from a parent page. [See the documentation](https://developers.notion.com/reference/post-page)", version: "0.2.13", type: "action", props: { diff --git a/components/notion/actions/duplicate-page/duplicate-page.mjs b/components/notion/actions/duplicate-page/duplicate-page.mjs index 56c0fb7cac6d8..b2249c53dc6bf 100644 --- a/components/notion/actions/duplicate-page/duplicate-page.mjs +++ b/components/notion/actions/duplicate-page/duplicate-page.mjs @@ -6,7 +6,7 @@ export default { ...base, key: "notion-duplicate-page", name: "Duplicate Page", - description: "Creates a new page copied from an existing page block. [See the documentation](https://developers.notion.com/reference/post-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.9", type: "action", props: { diff --git a/components/notion/actions/retrieve-page-property-item/retrieve-page-property-item.mjs b/components/notion/actions/retrieve-page-property-item/retrieve-page-property-item.mjs index 9ee0ec1ba09fe..43d82e2188578 100644 --- a/components/notion/actions/retrieve-page-property-item/retrieve-page-property-item.mjs +++ b/components/notion/actions/retrieve-page-property-item/retrieve-page-property-item.mjs @@ -3,7 +3,7 @@ import notion from "../../notion.app.mjs"; export default { key: "notion-retrieve-page-property-item", name: "Retrieve Page Property Item", - description: "Retrieves a `property_item` object for a given `page_id` and `property_id`.", + description: "Get a Property Item object for a selected page and property. [See the documentation](https://developers.notion.com/reference/retrieve-a-page-property)", version: "0.0.4", type: "action", props: { @@ -29,7 +29,7 @@ export default { this.pageId, this.propertyId, ); - $.export("$summary", "Retrieved property item successfully"); + $.export("$summary", "Successfully retrieved property item"); return response; }, }; diff --git a/components/notion/actions/update-page/update-page.mjs b/components/notion/actions/update-page/update-page.mjs index b1fcdd6a7fa8b..7377281e627ef 100644 --- a/components/notion/actions/update-page/update-page.mjs +++ b/components/notion/actions/update-page/update-page.mjs @@ -6,18 +6,23 @@ export default { ...base, key: "notion-update-page", name: "Update Page", - description: "Updates page property values for the specified page. Properties that are not set will remain unchanged. To append page content, use the *append block* action. [See the documentation](https://developers.notion.com/reference/patch-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: "1.1.3", type: "action", props: { notion, + infoLabel: { + type: "alert", + alertType: "info", + content: "Properties that are not set will remain unchanged.", + }, parent: { propDefinition: [ notion, "databaseId", ], label: "Parent Database ID", - description: "The identifier for a Notion parent database", + description: "Select the database that contains the page to update. If you instead provide a database ID in a custom expression, you will also have to provide the page's ID in a custom expression", reloadProps: true, }, pageId: { diff --git a/components/notion/notion.app.mjs b/components/notion/notion.app.mjs index 8c86f495a612b..543c889aa92d5 100644 --- a/components/notion/notion.app.mjs +++ b/components/notion/notion.app.mjs @@ -103,15 +103,14 @@ export default { }, archived: { type: "boolean", - label: "Archive page", - description: "Set to true to archive (delete) a page. Set to false to un-archive\ -(restore) a page", + label: "Archive Page", + description: "Set to `true` to archive (delete) a page. Set to `false` to un-archive (restore) a page", optional: true, }, title: { type: "string", label: "Page Title", - description: "The page title. Defaults to `Untitled`", + description: "The page title (defaults to `Untitled`)", optional: true, }, userIds: { From eb5c27bca9d499c5d551592f75afb29a63223756 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Tue, 4 Mar 2025 17:36:41 -0300 Subject: [PATCH 08/14] Source updates --- components/notion/notion.app.mjs | 2 +- components/notion/sources/common/base.mjs | 2 +- .../new-comment-created.mjs | 20 +++++++++++++++---- .../sources/new-database/new-database.mjs | 12 +++++++++-- .../notion/sources/new-page/new-page.mjs | 2 +- .../page-or-subpage-updated.mjs | 7 ++++++- .../updated-page-id/updated-page-id.mjs | 9 +++++++-- .../sources/updated-page/updated-page.mjs | 8 ++++---- 8 files changed, 46 insertions(+), 16 deletions(-) diff --git a/components/notion/notion.app.mjs b/components/notion/notion.app.mjs index 543c889aa92d5..4515c42f37b3e 100644 --- a/components/notion/notion.app.mjs +++ b/components/notion/notion.app.mjs @@ -20,7 +20,7 @@ export default { pageId: { type: "string", label: "Page ID", - description: "Search for a page or provide a page ID", + description: "Select a page or provide a page ID", async options({ prevContext }) { const response = await this.search(undefined, { start_cursor: prevContext.nextPageParameters ?? undefined, diff --git a/components/notion/sources/common/base.mjs b/components/notion/sources/common/base.mjs index 954e5abf3b9e5..b2340a2a4dd4e 100644 --- a/components/notion/sources/common/base.mjs +++ b/components/notion/sources/common/base.mjs @@ -47,7 +47,7 @@ export default { return { id, - summary: `${summary}: ${title} - ${id}`, + summary: `${summary}: ${title || id}`, ts, }; }, diff --git a/components/notion/sources/new-comment-created/new-comment-created.mjs b/components/notion/sources/new-comment-created/new-comment-created.mjs index b8b04ae1ebb5a..eec748fcc77a7 100644 --- a/components/notion/sources/new-comment-created/new-comment-created.mjs +++ b/components/notion/sources/new-comment-created/new-comment-created.mjs @@ -10,21 +10,33 @@ export default { dedupe: "unique", props: { ...base.props, + infoLabel: { + type: "alert", + alertType: "info", + content: "Ensure the selected page is shared with your Pipedream integration to receive events.", + }, pageId: { propDefinition: [ base.props.notion, "pageId", ], - description: "Unique identifier of a page or block", + description: "Select the page to watch for new comments, or provide a page ID", }, }, methods: { ...base.methods, generateMeta(comment) { + const { id } = comment; + const text = comment.rich_text?.[0]?.plain_text; + const summary = text + ? `"${text.length > 40 + ? text.slice(0, 35) + "[...]" + : text}"` + : `ID ${id}`; return { - id: comment.id, - summary: `New Comment ID: ${comment.id}`, - ts: comment.created_time, + id, + summary: `New Comment: ${summary}`, + ts: Date.parse(comment.created_time), }; }, }, diff --git a/components/notion/sources/new-database/new-database.mjs b/components/notion/sources/new-database/new-database.mjs index 7b8bad6a0728b..6ef335795eda2 100644 --- a/components/notion/sources/new-database/new-database.mjs +++ b/components/notion/sources/new-database/new-database.mjs @@ -5,10 +5,18 @@ import constants from "../common/constants.mjs"; export default { ...base, key: "notion-new-database", - name: "New Database", - description: "Emit new event when a database is created. Note: Databases must be shared with your Pipedream Integtration to trigger event.", + name: "New Database Created", + description: "Emit new event when a database is created. [See the documentation](https://developers.notion.com/reference/database)", version: "0.0.8", type: "source", + props: { + ...base.props, + infoLabel: { + type: "alert", + alertType: "info", + content: "Ensure Databases are shared with your Pipedream integration to receive events.", + }, + }, async run() { const databases = []; const params = this.lastCreatedSortParam(); diff --git a/components/notion/sources/new-page/new-page.mjs b/components/notion/sources/new-page/new-page.mjs index 6a33e004f0eff..f1cc539ceb9f8 100644 --- a/components/notion/sources/new-page/new-page.mjs +++ b/components/notion/sources/new-page/new-page.mjs @@ -7,7 +7,7 @@ export default { ...base, key: "notion-new-page", name: "New Page in Database", - description: "Emit new event when a page in a database is created", + description: "Emit new event when a page is created in the selected database. [See the documentation](https://developers.notion.com/reference/page)", version: "0.0.10", type: "source", props: { diff --git a/components/notion/sources/page-or-subpage-updated/page-or-subpage-updated.mjs b/components/notion/sources/page-or-subpage-updated/page-or-subpage-updated.mjs index ca198883b96ee..c9a68611dd377 100644 --- a/components/notion/sources/page-or-subpage-updated/page-or-subpage-updated.mjs +++ b/components/notion/sources/page-or-subpage-updated/page-or-subpage-updated.mjs @@ -6,12 +6,17 @@ export default { ...base, key: "notion-page-or-subpage-updated", name: "Page or Subpage Updated", /* eslint-disable-line pipedream/source-name */ - description: "Emit new event when a page or one of its sub-pages is updated.", + description: "Emit new event when the selected page or one of its sub-pages is updated. [See the documentation](https://developers.notion.com/reference/page)", version: "0.0.6", type: "source", dedupe: "unique", props: { ...base.props, + infoLabel: { + type: "alert", + alertType: "info", + content: "Ensure the selected page is shared with your Pipedream integration to receive events.", + }, pageId: { propDefinition: [ base.props.notion, diff --git a/components/notion/sources/updated-page-id/updated-page-id.mjs b/components/notion/sources/updated-page-id/updated-page-id.mjs index d3e4b49e5d1f8..4e3b3e091ad48 100644 --- a/components/notion/sources/updated-page-id/updated-page-id.mjs +++ b/components/notion/sources/updated-page-id/updated-page-id.mjs @@ -5,13 +5,18 @@ import constants from "../common/constants.mjs"; export default { ...base, key: "notion-updated-page-id", - name: "Updated Page ID", /* eslint-disable-line pipedream/source-name */ - description: "Emit new event when a selected page is updated", + name: "Page Updated", /* eslint-disable-line pipedream/source-name */ + description: "Emit new event when a selected page is updated. [See the documentation](https://developers.notion.com/reference/page)", version: "0.0.5", type: "source", dedupe: "unique", props: { ...base.props, + infoLabel: { + type: "alert", + alertType: "info", + content: "Ensure the selected page is shared with your Pipedream integration to receive events.", + }, pageId: { propDefinition: [ notion, diff --git a/components/notion/sources/updated-page/updated-page.mjs b/components/notion/sources/updated-page/updated-page.mjs index 8df7f1e15855b..ea4c469cbe704 100644 --- a/components/notion/sources/updated-page/updated-page.mjs +++ b/components/notion/sources/updated-page/updated-page.mjs @@ -7,8 +7,8 @@ import zlib from "zlib"; export default { ...base, key: "notion-updated-page", - name: "Updated Page in Database", /* eslint-disable-line pipedream/source-name */ - description: "Emit new event when a page in a database is updated. To select a specific page, use `Updated Page ID` instead", + name: "New or Updated Page in Database", /* eslint-disable-line pipedream/source-name */ + description: "Emit new event when a page is created or updated in the selected database. [See the documentation](https://developers.notion.com/reference/page)", version: "0.1.4", type: "source", dedupe: "unique", @@ -23,7 +23,7 @@ export default { includeNewPages: { type: "boolean", label: "Include New Pages", - description: "Set to `true` to emit events when pages are created. Set to `false` to ignore new pages.", + description: "Set to `false` to emit events only for updates, not for new pages.", default: true, }, properties: { @@ -40,7 +40,7 @@ export default { }, alert: { type: "alert", - alertType: "info", + alertType: "warning", content: "Source not saving? Your database might be too large. If deployment takes longer than one minute, an error will occur.", }, }, From 510badba3491b6d7b179539afd7905182f6fb8c4 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Tue, 4 Mar 2025 17:43:44 -0300 Subject: [PATCH 09/14] Version bumps --- components/notion/actions/create-comment/create-comment.mjs | 2 +- .../create-page-from-database/create-page-from-database.mjs | 2 +- components/notion/actions/create-page/create-page.mjs | 2 +- components/notion/actions/duplicate-page/duplicate-page.mjs | 2 +- components/notion/actions/query-database/query-database.mjs | 2 +- components/notion/actions/retrieve-block/retrieve-block.mjs | 2 +- .../retrieve-database-content/retrieve-database-content.mjs | 2 +- .../retrieve-database-schema/retrieve-database-schema.mjs | 2 +- .../retrieve-page-property-item/retrieve-page-property-item.mjs | 2 +- components/notion/actions/retrieve-page/retrieve-page.mjs | 2 +- components/notion/actions/search/search.mjs | 2 +- components/notion/actions/update-page/update-page.mjs | 2 +- components/notion/package.json | 2 +- .../notion/sources/new-comment-created/new-comment-created.mjs | 2 +- components/notion/sources/new-database/new-database.mjs | 2 +- components/notion/sources/new-page/new-page.mjs | 2 +- .../sources/page-or-subpage-updated/page-or-subpage-updated.mjs | 2 +- components/notion/sources/updated-page-id/updated-page-id.mjs | 2 +- components/notion/sources/updated-page/updated-page.mjs | 2 +- 19 files changed, 19 insertions(+), 19 deletions(-) diff --git a/components/notion/actions/create-comment/create-comment.mjs b/components/notion/actions/create-comment/create-comment.mjs index f35c8811ac049..d3607544ecb2b 100644 --- a/components/notion/actions/create-comment/create-comment.mjs +++ b/components/notion/actions/create-comment/create-comment.mjs @@ -5,7 +5,7 @@ export default { key: "notion-create-comment", name: "Create Comment", description: "Create a comment in a page or existing discussion thread. [See the documentation](https://developers.notion.com/reference/create-a-comment)", - version: "0.0.1", + version: "0.0.2", 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 0b462cf3c2627..2b22e89114bd3 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 @@ -7,7 +7,7 @@ export default { key: "notion-create-page-from-database", name: "Create Page from Database", description: "Create a page from a database. [See the documentation](https://developers.notion.com/reference/post-page)", - version: "0.1.15", + version: "0.1.16", 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 f09b4014e4855..d26be9917e810 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.13", + version: "0.2.14", 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 b2249c53dc6bf..f3872a47af34e 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.9", + version: "0.0.10", type: "action", props: { notion, diff --git a/components/notion/actions/query-database/query-database.mjs b/components/notion/actions/query-database/query-database.mjs index f505ba4621e4f..1734228add3fd 100644 --- a/components/notion/actions/query-database/query-database.mjs +++ b/components/notion/actions/query-database/query-database.mjs @@ -5,7 +5,7 @@ export default { key: "notion-query-database", name: "Query Database", description: "Query a database with a specified filter. [See the documentation](https://developers.notion.com/reference/post-database-query)", - version: "0.0.8", + version: "0.0.9", type: "action", props: { notion, diff --git a/components/notion/actions/retrieve-block/retrieve-block.mjs b/components/notion/actions/retrieve-block/retrieve-block.mjs index 75e25a2836e7d..a049022cca6b5 100644 --- a/components/notion/actions/retrieve-block/retrieve-block.mjs +++ b/components/notion/actions/retrieve-block/retrieve-block.mjs @@ -4,7 +4,7 @@ export default { key: "notion-retrieve-block", name: "Retrieve Block", description: "Get details of a block, which can be text, lists, media, a page, among others. [See the documentation](https://developers.notion.com/reference/retrieve-a-block)", - version: "0.0.4", + version: "0.0.5", type: "action", props: { notion, diff --git a/components/notion/actions/retrieve-database-content/retrieve-database-content.mjs b/components/notion/actions/retrieve-database-content/retrieve-database-content.mjs index 14fcf6a9a4145..ffcd8cb6fd50c 100644 --- a/components/notion/actions/retrieve-database-content/retrieve-database-content.mjs +++ b/components/notion/actions/retrieve-database-content/retrieve-database-content.mjs @@ -4,7 +4,7 @@ export default { key: "notion-retrieve-database-content", name: "Retrieve Database Content", description: "Get all content of a database. [See the documentation](https://developers.notion.com/reference/post-database-query)", - version: "0.0.3", + version: "0.0.4", type: "action", props: { notion, diff --git a/components/notion/actions/retrieve-database-schema/retrieve-database-schema.mjs b/components/notion/actions/retrieve-database-schema/retrieve-database-schema.mjs index c3ad3687c029a..30152f8c47035 100644 --- a/components/notion/actions/retrieve-database-schema/retrieve-database-schema.mjs +++ b/components/notion/actions/retrieve-database-schema/retrieve-database-schema.mjs @@ -4,7 +4,7 @@ export default { key: "notion-retrieve-database-schema", name: "Retrieve Database Schema", description: "Get the property schema of a database in Notion. [See the documentation](https://developers.notion.com/reference/retrieve-a-database)", - version: "0.0.5", + version: "0.0.6", type: "action", props: { notion, diff --git a/components/notion/actions/retrieve-page-property-item/retrieve-page-property-item.mjs b/components/notion/actions/retrieve-page-property-item/retrieve-page-property-item.mjs index 43d82e2188578..8bb72609c4021 100644 --- a/components/notion/actions/retrieve-page-property-item/retrieve-page-property-item.mjs +++ b/components/notion/actions/retrieve-page-property-item/retrieve-page-property-item.mjs @@ -4,7 +4,7 @@ export default { key: "notion-retrieve-page-property-item", name: "Retrieve Page Property Item", description: "Get a Property Item object for a selected page and property. [See the documentation](https://developers.notion.com/reference/retrieve-a-page-property)", - version: "0.0.4", + version: "0.0.5", type: "action", props: { notion, diff --git a/components/notion/actions/retrieve-page/retrieve-page.mjs b/components/notion/actions/retrieve-page/retrieve-page.mjs index 1186018eb6aad..f44f34b2dc495 100644 --- a/components/notion/actions/retrieve-page/retrieve-page.mjs +++ b/components/notion/actions/retrieve-page/retrieve-page.mjs @@ -4,7 +4,7 @@ export default { key: "notion-retrieve-page", name: "Retrieve Page", description: "Get details of a page. [See the documentation](https://developers.notion.com/reference/retrieve-a-page)", - version: "0.0.4", + version: "0.0.5", type: "action", props: { notion, diff --git a/components/notion/actions/search/search.mjs b/components/notion/actions/search/search.mjs index 982ff15400991..b65558756cdc8 100644 --- a/components/notion/actions/search/search.mjs +++ b/components/notion/actions/search/search.mjs @@ -5,7 +5,7 @@ export default { key: "notion-search", name: "Find Pages or Databases", description: "Searches for a page or database. [See the documentation](https://developers.notion.com/reference/post-search)", - version: "0.0.4", + version: "0.0.5", type: "action", props: { ...common.props, diff --git a/components/notion/actions/update-page/update-page.mjs b/components/notion/actions/update-page/update-page.mjs index 7377281e627ef..a38141162c497 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: "1.1.3", + version: "1.1.4", type: "action", props: { notion, diff --git a/components/notion/package.json b/components/notion/package.json index c06202a516975..06118ec52a0f2 100644 --- a/components/notion/package.json +++ b/components/notion/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/notion", - "version": "0.3.0", + "version": "0.4.0", "description": "Pipedream Notion Components", "main": "notion.app.mjs", "keywords": [ diff --git a/components/notion/sources/new-comment-created/new-comment-created.mjs b/components/notion/sources/new-comment-created/new-comment-created.mjs index eec748fcc77a7..99e6a361d3f18 100644 --- a/components/notion/sources/new-comment-created/new-comment-created.mjs +++ b/components/notion/sources/new-comment-created/new-comment-created.mjs @@ -5,7 +5,7 @@ export default { key: "notion-new-comment-created", name: "New Comment Created", description: "Emit new event when a new comment is created in a page or block. [See the documentation](https://developers.notion.com/reference/retrieve-a-comment)", - version: "0.0.1", + version: "0.0.2", type: "source", dedupe: "unique", props: { diff --git a/components/notion/sources/new-database/new-database.mjs b/components/notion/sources/new-database/new-database.mjs index 6ef335795eda2..dd8669d0357c6 100644 --- a/components/notion/sources/new-database/new-database.mjs +++ b/components/notion/sources/new-database/new-database.mjs @@ -7,7 +7,7 @@ export default { key: "notion-new-database", name: "New Database Created", description: "Emit new event when a database is created. [See the documentation](https://developers.notion.com/reference/database)", - version: "0.0.8", + version: "0.0.9", type: "source", props: { ...base.props, diff --git a/components/notion/sources/new-page/new-page.mjs b/components/notion/sources/new-page/new-page.mjs index f1cc539ceb9f8..de1f75b0785b4 100644 --- a/components/notion/sources/new-page/new-page.mjs +++ b/components/notion/sources/new-page/new-page.mjs @@ -8,7 +8,7 @@ export default { key: "notion-new-page", name: "New Page in Database", description: "Emit new event when a page is created in the selected database. [See the documentation](https://developers.notion.com/reference/page)", - version: "0.0.10", + version: "0.0.11", type: "source", props: { ...base.props, diff --git a/components/notion/sources/page-or-subpage-updated/page-or-subpage-updated.mjs b/components/notion/sources/page-or-subpage-updated/page-or-subpage-updated.mjs index c9a68611dd377..92461540fe57d 100644 --- a/components/notion/sources/page-or-subpage-updated/page-or-subpage-updated.mjs +++ b/components/notion/sources/page-or-subpage-updated/page-or-subpage-updated.mjs @@ -7,7 +7,7 @@ export default { key: "notion-page-or-subpage-updated", name: "Page or Subpage Updated", /* eslint-disable-line pipedream/source-name */ description: "Emit new event when the selected page or one of its sub-pages is updated. [See the documentation](https://developers.notion.com/reference/page)", - version: "0.0.6", + version: "0.0.7", type: "source", dedupe: "unique", props: { diff --git a/components/notion/sources/updated-page-id/updated-page-id.mjs b/components/notion/sources/updated-page-id/updated-page-id.mjs index 4e3b3e091ad48..528452682e792 100644 --- a/components/notion/sources/updated-page-id/updated-page-id.mjs +++ b/components/notion/sources/updated-page-id/updated-page-id.mjs @@ -7,7 +7,7 @@ export default { key: "notion-updated-page-id", name: "Page Updated", /* eslint-disable-line pipedream/source-name */ description: "Emit new event when a selected page is updated. [See the documentation](https://developers.notion.com/reference/page)", - version: "0.0.5", + version: "0.0.6", type: "source", dedupe: "unique", props: { diff --git a/components/notion/sources/updated-page/updated-page.mjs b/components/notion/sources/updated-page/updated-page.mjs index ea4c469cbe704..e5d718b3c3083 100644 --- a/components/notion/sources/updated-page/updated-page.mjs +++ b/components/notion/sources/updated-page/updated-page.mjs @@ -9,7 +9,7 @@ export default { key: "notion-updated-page", name: "New or Updated Page in Database", /* eslint-disable-line pipedream/source-name */ description: "Emit new event when a page is created or updated in the selected database. [See the documentation](https://developers.notion.com/reference/page)", - version: "0.1.4", + version: "0.1.5", type: "source", dedupe: "unique", props: { From ae71e556efeeb806a635bd7334fb6681ddecb703 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Tue, 4 Mar 2025 17:47:43 -0300 Subject: [PATCH 10/14] Removing unused dependencies --- components/notion/package.json | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/components/notion/package.json b/components/notion/package.json index 06118ec52a0f2..b8f2af93970a2 100644 --- a/components/notion/package.json +++ b/components/notion/package.json @@ -13,18 +13,7 @@ "@notionhq/client": "^2.2.3", "@pipedream/platform": "^3.0.3", "@tryfabric/martian": "^1.2.4", - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "delayed-stream": "^1.0.0", - "form-data": "^3.0.1", - "lodash-es": "^4.17.21", - "md5": "^2.3.0", - "mime-db": "^1.52.0", - "mime-types": "^2.1.35", - "node-fetch": "^2.6.7", - "tr46": "^0.0.3", - "webidl-conversions": "^3.0.1", - "whatwg-url": "^5.0.0" + "lodash-es": "^4.17.21" }, "publishConfig": { "access": "public" From 3a28f5e0592cc964b32afa43cee8c0d7d12c243b Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Tue, 4 Mar 2025 17:48:33 -0300 Subject: [PATCH 11/14] pnpm --- pnpm-lock.yaml | 33 --------------------------------- 1 file changed, 33 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 076d01be71ee8..e32e44f43da22 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8469,42 +8469,9 @@ importers: '@tryfabric/martian': specifier: ^1.2.4 version: 1.2.4 - asynckit: - specifier: ^0.4.0 - version: 0.4.0 - combined-stream: - specifier: ^1.0.8 - version: 1.0.8 - delayed-stream: - specifier: ^1.0.0 - version: 1.0.0 - form-data: - specifier: ^3.0.1 - version: 3.0.2 lodash-es: specifier: ^4.17.21 version: 4.17.21 - md5: - specifier: ^2.3.0 - version: 2.3.0 - mime-db: - specifier: ^1.52.0 - version: 1.53.0 - mime-types: - specifier: ^2.1.35 - version: 2.1.35 - node-fetch: - specifier: ^2.6.7 - version: 2.7.0 - tr46: - specifier: ^0.0.3 - version: 0.0.3 - webidl-conversions: - specifier: ^3.0.1 - version: 3.0.1 - whatwg-url: - specifier: ^5.0.0 - version: 5.0.0 components/nozbe_teams: {} From c83bc114053e58f4893286d7be143282188979b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guilherme=20Falc=C3=A3o?= <48412907+GTFalcao@users.noreply.github.com> Date: Tue, 4 Mar 2025 17:53:14 -0300 Subject: [PATCH 12/14] Update components/notion/actions/retrieve-page/retrieve-page.mjs Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- components/notion/actions/retrieve-page/retrieve-page.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/notion/actions/retrieve-page/retrieve-page.mjs b/components/notion/actions/retrieve-page/retrieve-page.mjs index f44f34b2dc495..15e234bc8787d 100644 --- a/components/notion/actions/retrieve-page/retrieve-page.mjs +++ b/components/notion/actions/retrieve-page/retrieve-page.mjs @@ -18,7 +18,7 @@ export default { async run({ $ }) { const response = await this.notion.retrievePage(this.pageId); const title = response?.properties?.Name?.title[0]?.plain_text; - $.export("$summary", `Sucessfully retrieved page${title + $.export("$summary", `Successfully retrieved page${title ? ` "${title}"` : ""}`); return response; From 84ca40d1144e608c04d5f133529485d3ea809f13 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Sun, 9 Mar 2025 18:38:57 -0300 Subject: [PATCH 13/14] Improvements --- .../actions/append-block/append-block.mjs | 38 ++++--------------- components/notion/notion.app.mjs | 9 +++++ 2 files changed, 17 insertions(+), 30 deletions(-) diff --git a/components/notion/actions/append-block/append-block.mjs b/components/notion/actions/append-block/append-block.mjs index cedcabe3b5de5..d96ec6c84c7b2 100644 --- a/components/notion/actions/append-block/append-block.mjs +++ b/components/notion/actions/append-block/append-block.mjs @@ -26,17 +26,12 @@ export default { reloadProps: true, options: [ { - label: - "Use objects of existing blocks (e.g. objects returned from previous steps)", - value: "blockObjects", - }, - { - label: "Select existing blocks or provide their IDs", + label: "Append existing blocks", value: "blockIds", }, { label: "Provide Markdown content to create new blocks with", - value: "markupContents", + value: "markdownContents", }, { label: "Provide Image URLs to create new image blocks", @@ -44,26 +39,19 @@ export default { }, ], }, - blockObjects: { - type: "string[]", - label: "Block Objects", - description: - "An array of block objects to be appended. You can use a custom expression to reference block objects from previous steps. [See the documentation](https://developers.notion.com/reference/block) for more information", - hidden: true, - }, blockIds: { propDefinition: [ notion, "pageId", ], type: "string[]", - label: "Block IDs", + label: "Existing Block IDs", description: "Select one or more block(s) or page(s) to append (selecting a page appends its children). You can also provide block or page IDs.", hidden: true, }, - markupContents: { + markdownContents: { type: "string[]", - label: "Markup Contents", + label: "Markdown Contents", description: "Each entry is the content of a new block to append, using Markdown syntax. [See the documentation](https://www.notion.com/help/writing-and-editing-basics#markdown-and-shortcuts) for more information", hidden: true, @@ -79,9 +67,8 @@ export default { const { blockTypes } = this; for (let prop of [ - "blockObjects", "blockIds", - "markupContents", + "markdownContents", "imageUrls", ]) { currentProps[prop].hidden = !blockTypes.includes(prop); @@ -102,15 +89,6 @@ export default { async run({ $ }) { const { blockTypes } = this; const children = []; - // add blocks from blockObjects - if (blockTypes.includes("blockObjects") && this.blockObjects?.length > 0) { - for (const obj of this.blockObjects) { - const child = typeof obj === "string" - ? JSON.parse(obj) - : obj; - children.push(child); - } - } // add blocks from blockIds if (blockTypes.includes("blockIds") && this.blockIds?.length > 0) { @@ -123,8 +101,8 @@ export default { } // add blocks from markup - if (blockTypes.includes("markupContents") && this.markupContents?.length > 0) { - for (const content of this.markupContents) { + if (blockTypes.includes("markdownContents") && this.markdownContents?.length > 0) { + for (const content of this.markdownContents) { const block = this.createBlocks(content); children.push(...block); } diff --git a/components/notion/notion.app.mjs b/components/notion/notion.app.mjs index 4515c42f37b3e..fb6cc9061aa5b 100644 --- a/components/notion/notion.app.mjs +++ b/components/notion/notion.app.mjs @@ -1,5 +1,6 @@ import notion from "@notionhq/client"; import NOTION_META from "./common/notion-meta-selection.mjs"; +import { ConfigurationError } from "@pipedream/platform"; export default { type: "app", @@ -36,6 +37,7 @@ export default { async options({ prevContext, databaseId, }) { + this._checkOptionsContext(databaseId, "Database ID"); const response = await this.queryDatabase(databaseId, { start_cursor: prevContext.nextPageParameters ?? undefined, }); @@ -48,6 +50,7 @@ export default { label: "Property ID", description: "Select a page property or provide a property ID", async options({ pageId }) { + this._checkOptionsContext(pageId, "Page ID"); const response = await this.retrievePage(pageId); const parentType = response.parent.type; @@ -90,6 +93,7 @@ export default { async options({ parentId, parentType, }) { + this._checkOptionsContext(parentId, "Database ID"); try { const { properties } = parentType === "database" ? await this.retrieveDatabase(parentId) @@ -169,6 +173,11 @@ export default { }, }, methods: { + _checkOptionsContext(value, name) { + if (value.match(/{{\s?steps/)) { + throw new ConfigurationError(`Please use a custom expression to reference a previous value, since you are also using one for \`${name}\``); + } + }, _getNotionClient() { return new notion.Client({ auth: this.$auth.oauth_access_token, From 97f5c7ff1027333d8f2867337e001b9104aeca74 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Sun, 9 Mar 2025 18:54:17 -0300 Subject: [PATCH 14/14] Label adjustment --- components/notion/actions/create-comment/create-comment.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/notion/actions/create-comment/create-comment.mjs b/components/notion/actions/create-comment/create-comment.mjs index d3607544ecb2b..86e11f332cde0 100644 --- a/components/notion/actions/create-comment/create-comment.mjs +++ b/components/notion/actions/create-comment/create-comment.mjs @@ -12,7 +12,7 @@ export default { infoLabel: { type: "alert", alertType: "info", - content: "Provide either a page ID or a discussion thread ID to create the comment under.", + content: "Provide either a Page ID or a Discussion ID to create the comment under.", }, pageId: { propDefinition: [