diff --git a/components/notion/actions/append-block/append-block.mjs b/components/notion/actions/append-block/append-block.mjs index b76b6f97b667a..ef74394108aa8 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.7", + version: "0.3.8", 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 418d9ebd08c93..2bb116155e2c5 100644 --- a/components/notion/actions/common/base-page-builder.mjs +++ b/components/notion/actions/common/base-page-builder.mjs @@ -1,6 +1,6 @@ import { markdownToBlocks } from "@tryfabric/martian"; import { - NOTION_DATABASE_META, + NOTION_DATA_SOURCE_META, NOTION_PAGE_META, } from "../../common/notion-meta-properties.mjs"; import NOTION_META from "../../common/notion-meta-selection.mjs"; @@ -10,7 +10,7 @@ export default { methods: { /** * Creates additional props for page properties and the selected block children - * @param properties - The selected (database) properties from the page obtained from Notion + * @param properties - The selected (data source) properties from the page obtained from Notion * @param meta - The selected meta properties * @param blocks - The selected block children from the workflow UI * @returns additional props @@ -74,7 +74,8 @@ export default { * @param properties - Properties from the selected page obtained from Notion * @returns the selected props inputted by the user with the following attributes: * - type: the Notion property type used in notion-page-properties.mjs - * - label: the page's property name + * - label: the property ID for API calls + * (was property name before data source migration) * - value: the property value inputted by the user */ _filterProps(properties = {}) { @@ -83,7 +84,7 @@ export default { || (this.properties && this.properties[property])) .map((property) => ({ type: properties[property]?.type ?? property, - label: property, + label: properties[property]?.id || property, value: this[property] || this.properties?.[property], })); }, @@ -96,20 +97,26 @@ export default { _convertPropertiesToNotion(properties = [], NOTION_CONVERTER = {}) { const notionProperties = {}; for (const property of properties) { - const notionProperty = NOTION_CONVERTER[property.type]; - notionProperties[property.label] = notionProperty?.convertToNotion(property); + // If the property value is already in Notion format, use it directly + if (this._isAlreadyNotionFormat(property.value, property.type)) { + notionProperties[property.label] = property.value; + } else { + // Otherwise, convert using the appropriate converter + const notionProperty = NOTION_CONVERTER[property.type]; + notionProperties[property.label] = notionProperty?.convertToNotion(property); + } } return notionProperties; }, /** - * Builds page meta properties (parent, icon, cover, archived) from a parent database + * Builds page meta properties (parent, icon, cover, archived) from a parent data source * Uses the property label as its type to be able to select in notion-meta-properties.mjs * @param properties - list of Notion page properties inputted by the user * @returns the meta properties in Notion format inputted by the user */ - _buildNotionDatabaseMeta(properties = []) { + _buildNotionDataSourceMeta(properties = []) { properties.forEach((property) => property.type = property.label); - return this._convertPropertiesToNotion(properties, NOTION_DATABASE_META); + return this._convertPropertiesToNotion(properties, NOTION_DATA_SOURCE_META); }, /** * Builds page meta properties (parent, icon, cover, archived) from a parent page @@ -122,7 +129,7 @@ export default { return this._convertPropertiesToNotion(properties, NOTION_PAGE_META); }, /** - * Builds page properties from a parent database/page + * Builds page properties from a parent data source/page * @param properties - list of Notion page properties inputted by the user * @returns the properties in Notion format inputted by the user */ @@ -130,13 +137,13 @@ export default { return this._convertPropertiesToNotion(properties, NOTION_PAGE_PROPERTIES); }, /** - * Builds the page meta inputted by the user in Notion format from a parent database - * @param parentDatabase - the parent database that contains the meta properties + * Builds the page meta inputted by the user in Notion format from a parent data source + * @param parentDataSource - the parent data source that contains the meta properties * @returns the meta properties in Notion format */ - buildDatabaseMeta(parentDatabase) { - const filteredMeta = this._filterProps(parentDatabase); - return this._buildNotionDatabaseMeta(filteredMeta); + buildDataSourceMeta(parentDataSource) { + const filteredMeta = this._filterProps(parentDataSource); + return this._buildNotionDataSourceMeta(filteredMeta); }, /** * Builds the page meta inputted by the user in Notion format from a parent page @@ -156,6 +163,32 @@ export default { const filteredProperties = this._filterProps(parentProperties); return this._buildNotionPageProperties(filteredProperties); }, + /** + * Checks if a property value is already in Notion format + * @param value - the property value to check + * @returns true if already in Notion format, false otherwise + */ + _isAlreadyNotionFormat(value) { + if (!value || typeof value !== "object") return false; + + // Check for common Notion property structures + const notionKeys = [ + "title", + "rich_text", + "number", + "select", + "multi_select", + "date", + "people", + "files", + "checkbox", + "url", + "email", + "phone_number", + "relation", + ]; + return notionKeys.some((key) => key in value); + }, /** * Creates the block children inputted by the user in Notion format * @returns the block children in Notion format @@ -210,13 +243,13 @@ export default { }, }; }, - childDatabaseToLink(block) { + childDataSourceToLink(block) { return { object: "block", type: "link_to_page", link_to_page: { - type: "database_id", - database_id: block.id, + type: "data_source_id", + data_source_id: block.id, }, }; }, @@ -236,9 +269,9 @@ export default { if (child.type === "child_page") { // convert child pages to links children[i] = this.childPageToLink(child); - } else if (child.type === "child_database") { - // convert child databases to links - children[i] = this.childDatabaseToLink(child); + } else if (child.type === "child_data_source") { + // convert child data sources to links + children[i] = this.childDataSourceToLink(child); } else { if (this.notValid(child, c)) { children[i] = undefined; 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 adb2869f82b75..108cd25aeae97 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.2", + version: "0.0.3", type: "action", props: { notion, diff --git a/components/notion/actions/create-comment/create-comment.mjs b/components/notion/actions/create-comment/create-comment.mjs index fbcffa707efba..77a1cc32cd482 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.7", + version: "0.0.8", 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 f77a437a2074c..8b46e52e8661b 100644 --- a/components/notion/actions/create-database/create-database.mjs +++ b/components/notion/actions/create-database/create-database.mjs @@ -6,8 +6,8 @@ export default { ...base, key: "notion-create-database", name: "Create Database", - description: "Create a database. [See the documentation](https://developers.notion.com/reference/create-a-database)", - version: "0.0.2", + description: "Create a database and its initial data source. [See the documentation](https://developers.notion.com/reference/database-create)", + version: "0.1.0", type: "action", props: { notion, @@ -45,7 +45,9 @@ export default { }, }, ], - properties: utils.parseObject(this.properties), + initial_data_source: { + properties: utils.parseObject(this.properties), + }, }); $.export("$summary", `Successfully created database with ID ${response.id}`); 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 7e0c975584a27..68bf8591c5c18 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.2", + version: "0.0.3", type: "action", props: { notion, diff --git a/components/notion/actions/create-page-from-database/README.md b/components/notion/actions/create-page-from-database/README.md index 900d852a72b40..8e92c4457c02e 100644 --- a/components/notion/actions/create-page-from-database/README.md +++ b/components/notion/actions/create-page-from-database/README.md @@ -1,25 +1,25 @@ # Overview -The Notion Create Page from Database action allows you to add pages to a Notion Database. +The Notion Create Page from Data Source action allows you to add pages to a Notion Data Source. -This action features easy to use dropdowns that automatically populate your databases as well as your database's properties, also known as columns. +This action features easy to use dropdowns that automatically populate your data source as well as your data source's properties, also known as columns. -This action interacts with the [Notion create a Page API endpoint](https://developers.notion.com/reference/post-page). The Database selected in the `Parent Database ID` is used as the `parent_id` parameter to that endpoint so the page is added to your databaset . +This action interacts with the [Notion create a Page API endpoint](https://developers.notion.com/reference/post-page). The Data Source selected in the `Parent Data Source ID` is used as the `parent_id` parameter to that endpoint so the page is added to your data source. # Getting Started -[Follow this short 4 minute guide to connect your Notion account and add new Database pages](https://youtu.be/wciWsu564_0) +[Follow this short 4 minute guide to connect your Notion account and add new Data Source pages](https://youtu.be/wciWsu564_0) (note: as of 2025-09-02, Databases are divided into multiple Data Sources, which are the entities that contain the pages) ### Props -When using the **Create Page from Database** action, there are several props to define: +When using the **Create Page from Data Source** action, there are several props to define: 1. `Notion Account` - see the **Accounts** section below. -2. `Parent Database ID` - the database to add a page to. +2. `Parent Data Source ID` - the data source to add a page to. 3. `Meta Types` - an icon or cover to add to the new page (optional). -4. `Property Types` - one or more properties to add to the new page that correspond with columns in the database. +4. `Property Types` - one or more properties to add to the new page that correspond with columns in the data source. 5. `Page Content` - the content of the page that appears when it's opened in a side view. Each selected `Property Type` will also add a new prop for that given column. @@ -37,12 +37,12 @@ Each selected `Property Type` will also add a new prop for that given column. 1. [Create a new workflow](https://pipedream.com/new). 2. Select your trigger (HTTP, Cron, etc.). 3. Click on the **+** button below the trigger step, and search for "Notion". -4. Select the **Create Page from Database** action. +4. Select the **Create Page from Data Source** action. 5. Click the **Connect Account** button near the top of the step. This will prompt you to select any existing Notion accounts you've previously authenticated with Pipedream, or you can select a **New** account. Clicking **New** opens a new window asking you to allow Pipedream access to your Notion workspaces and pages. Choose the workspaces and pages where you'd like to install the app, then click **Allow**. 6. That's it! You can now connect to the Notion API using any of the Slack actions within a Pipedream workflow. # Troubleshooting -If your database doesn't appear under the options, try deleting your Notion account connection and reconnecting. +If your data source doesn't appear under the options, try deleting your Notion account connection and reconnecting. -There's an issue with Notion Databases not appearing in the options if the Database was created _after_ you connected your Notion account to Pipedream. \ No newline at end of file +There's an issue with Notion Data Sources not appearing in the options if the Data Source was created _after_ you connected your Notion account to Pipedream. \ No newline at end of file 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 3301bbba9ae04..31990728a340d 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,30 +6,30 @@ import base from "../common/base-page-builder.mjs"; export default { ...base, 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.2.4", + 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.0", type: "action", props: { notion, - parent: { + parentDataSource: { propDefinition: [ notion, - "databaseId", + "dataSourceId", ], - label: "Parent Database ID", - description: "Select a parent database or provide a database ID", + label: "Parent Data Source ID", + description: "Select a parent data source or provide a data source ID", }, Name: { type: "string", label: "Name", - description: "The name of the page. Use this only if the database has a `title` property named `Name`. Otherwise, use the `Properties` prop below to set the title property.", + description: "The name of the page. Use this only if the data source has a `title` property named `Name`. Otherwise, use the `Properties` prop below to set the title property.", optional: true, }, properties: { type: "object", label: "Properties", - description: "The values of the page's properties. The schema must match the parent database's properties. [See the documentation](https://developers.notion.com/reference/property-object) for information on various property types. Example: `{ \"Tags\": [ \"tag1\" ], \"Link\": \"https://pipedream.com\" }`", + description: "The values of the page's properties. The schema must match the parent data source's properties. [See the documentation](https://developers.notion.com/reference/property-object) for information on various property types. Example: `{ \"Tags\": [ \"tag1\" ], \"Link\": \"https://pipedream.com\" }`", optional: true, }, icon: { @@ -60,14 +60,14 @@ export default { methods: { ...base.methods, /** - * Builds a page from a parent database - * @param parentDatabase - the parent database + * Builds a page from a parent data source + * @param parentDataSource - the parent data source * @returns the constructed page in Notion format */ - buildPage(parentDatabase) { - const meta = this.buildDatabaseMeta(parentDatabase); + buildPage(parentDataSource) { + const meta = this.buildDataSourceMeta(parentDataSource); this.properties = utils.parseObject(this.properties); - const properties = this.buildPageProperties(parentDatabase.properties); + const properties = this.buildPageProperties(parentDataSource.properties); const children = this.createBlocks(this.pageContent); return { ...meta, @@ -78,7 +78,7 @@ export default { }, async run({ $ }) { const MAX_BLOCKS = 100; - const parentPage = await this.notion.retrieveDatabase(this.parent); + const parentPage = await this.notion.retrieveDataSource(this.parentDataSource); const { children, ...page } = this.buildPage(parentPage); diff --git a/components/notion/actions/create-page/create-page.mjs b/components/notion/actions/create-page/create-page.mjs index d87c029ec05e7..164b747ff15e6 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.20", + version: "0.2.21", 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 3fa6525eae513..a98f6083e12dd 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.2", + version: "0.0.3", 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 743f4c0e38114..8a1c6e4a1a864 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.17", + version: "0.0.18", type: "action", props: { notion, diff --git a/components/notion/actions/list-all-users/list-all-users.mjs b/components/notion/actions/list-all-users/list-all-users.mjs index dbf9d1765a053..e45b6438afef8 100644 --- a/components/notion/actions/list-all-users/list-all-users.mjs +++ b/components/notion/actions/list-all-users/list-all-users.mjs @@ -4,7 +4,7 @@ export default { key: "notion-list-all-users", name: "List All Users", description: "Returns all users in the workspace. [See the documentation](https://developers.notion.com/reference/get-users)", - version: "0.0.2", + version: "0.0.3", 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 9655b34fe6e98..0ed02d25c15b0 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.2", + version: "0.0.3", 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 3fdbc9d884ca0..0d3ab32f83d46 100644 --- a/components/notion/actions/query-database/query-database.mjs +++ b/components/notion/actions/query-database/query-database.mjs @@ -3,26 +3,26 @@ import notion from "../../notion.app.mjs"; 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.1.1", + name: "Query Data Source", + description: "Query a data source with a specified filter. [See the documentation](https://developers.notion.com/reference/query-a-data-source)", + version: "1.0.0", type: "action", props: { notion, - databaseId: { + dataSourceId: { propDefinition: [ notion, - "databaseId", + "dataSourceId", ], }, filter: { 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\" } }`", + description: "The filter to apply, as a JSON-stringified object. [See the documentation for available filters](https://developers.notion.com/reference/filter-data-source-entries). Example: `{ \"property\": \"Name\", \"title\": { \"contains\": \"title to search for\" } }`", type: "string", }, sorts: { label: "Sorts", - description: "The sort order for the query. [See the documentation for available sorts](https://developers.notion.com/reference/post-database-query-sort). Example: `[ { \"property\": \"Name\", \"direction\": \"ascending\" } ]`", + description: "The sort order for the query. [See the documentation for available sorts](https://developers.notion.com/reference/sort-data-source-entries). Example: `[ { \"property\": \"Name\", \"direction\": \"ascending\" } ]`", type: "string[]", }, }, @@ -31,7 +31,7 @@ export default { filter, sorts, } = this; - const response = await this.notion.queryDatabase(this.databaseId, { + const response = await this.notion.queryDataSource(this.dataSourceId, { filter: utils.parseStringToJSON(filter), sorts: utils.parseObject(sorts), }); diff --git a/components/notion/actions/retrieve-block/retrieve-block.mjs b/components/notion/actions/retrieve-block/retrieve-block.mjs index 1b0e0fb86067d..565016bbbd54d 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 Page Content", description: "Get page content as block objects or markdown. Blocks can be text, lists, media, a page, among others. [See the documentation](https://developers.notion.com/reference/retrieve-a-block)", - version: "0.2.5", + version: "0.2.6", 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 0313e481dda99..2bcad9bb2b7b9 100644 --- a/components/notion/actions/retrieve-database-content/retrieve-database-content.mjs +++ b/components/notion/actions/retrieve-database-content/retrieve-database-content.mjs @@ -2,24 +2,24 @@ import notion from "../../notion.app.mjs"; 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.9", + name: "Retrieve Data Source Content", + description: "Get all content of a data source. [See the documentation](https://developers.notion.com/reference/query-a-data-source)", + version: "1.0.0", type: "action", props: { notion, - databaseId: { + dataSourceId: { propDefinition: [ notion, - "databaseId", + "dataSourceId", ], }, }, async run({ $ }) { - const { results } = await this.notion.queryDatabase(this.databaseId); + const { results } = await this.notion.queryDataSource(this.dataSourceId); $.export("$summary", `Successfully retrieved ${results.length} object${results.length === 1 ? "" - : "s"} in database`); + : "s"} in data source`); 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 8d7e21379956d..785bbe38609df 100644 --- a/components/notion/actions/retrieve-database-schema/retrieve-database-schema.mjs +++ b/components/notion/actions/retrieve-database-schema/retrieve-database-schema.mjs @@ -2,22 +2,22 @@ import notion from "../../notion.app.mjs"; 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.11", + name: "Retrieve Data Source Schema", + description: "Get the property schema of a data source in Notion. [See the documentation](https://developers.notion.com/reference/retrieve-a-data-source)", + version: "1.0.0", type: "action", props: { notion, - databaseId: { + dataSourceId: { propDefinition: [ notion, - "databaseId", + "dataSourceId", ], }, }, async run({ $ }) { - const response = await this.notion.retrieveDatabase(this.databaseId); - $.export("$summary", "Successfully retrieved database schema"); + const response = await this.notion.retrieveDataSource(this.dataSourceId); + $.export("$summary", "Successfully retrieved data source schema"); return response; }, }; 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 dcc417513a7bc..059e9858ec2c5 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.2", + version: "0.0.3", 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 7f1b2c9090428..13eaf7c0a079c 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.10", + version: "0.0.11", 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 dd7de041ca7a6..f56af679ed887 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 Metadata", description: "Get details of a page. [See the documentation](https://developers.notion.com/reference/retrieve-a-page)", - version: "0.0.11", + version: "0.0.12", type: "action", props: { notion, diff --git a/components/notion/actions/retrieve-user/retrieve-user.mjs b/components/notion/actions/retrieve-user/retrieve-user.mjs index 76718e58673c3..d604f9fb7171a 100644 --- a/components/notion/actions/retrieve-user/retrieve-user.mjs +++ b/components/notion/actions/retrieve-user/retrieve-user.mjs @@ -4,7 +4,7 @@ export default { key: "notion-retrieve-user", name: "Retrieve User", description: "Returns a user using the ID specified. [See the documentation](https://developers.notion.com/reference/get-user)", - version: "0.0.2", + version: "0.0.3", type: "action", props: { notion, diff --git a/components/notion/actions/search/search.mjs b/components/notion/actions/search/search.mjs index 82862b74a98f2..384617ac6f7ed 100644 --- a/components/notion/actions/search/search.mjs +++ b/components/notion/actions/search/search.mjs @@ -3,9 +3,9 @@ import common from "../common/base-search.mjs"; export default { ...common, 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.10", + name: "Find Pages or Data Sources", + description: "Searches for a page or data source. [See the documentation](https://developers.notion.com/reference/post-search)", + version: "0.1.0", type: "action", props: { ...common.props, 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 87392063107d7..9141bfe8bfc38 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.2", + version: "0.0.3", 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 72faf2f32a5a4..b82a2a1ae5b8a 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.2", + version: "0.0.3", 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 a90ce9a0dd3f5..333783c1d5de1 100644 --- a/components/notion/actions/update-database/update-database.mjs +++ b/components/notion/actions/update-database/update-database.mjs @@ -5,45 +5,45 @@ import base from "../common/base-page-builder.mjs"; export default { ...base, key: "notion-update-database", - name: "Update Database", - description: "Update a database. [See the documentation](https://developers.notion.com/reference/update-a-database)", - version: "0.0.2", + name: "Update Data Source", + description: "Update a data source. [See the documentation](https://developers.notion.com/reference/update-a-data-source)", + version: "1.0.0", type: "action", props: { notion, - databaseId: { + dataSourceId: { propDefinition: [ notion, - "databaseId", + "dataSourceId", ], reloadProps: true, }, title: { type: "string", label: "Title", - description: "Title of database as it appears in Notion. An array of [rich text objects](https://developers.notion.com/reference/rich-text).", + description: "Title of the data source as it appears in Notion. An array of [rich text objects](https://developers.notion.com/reference/rich-text).", optional: true, }, description: { type: "string", label: "Description", - description: "An array of [rich text objects](https://developers.notion.com/reference/rich-text) that represents the description of the database that is displayed in the Notion UI. If omitted, then the database description remains unchanged.", + description: "An array of [rich text objects](https://developers.notion.com/reference/rich-text) that represents the description of the data source that is displayed in the Notion UI. If omitted, then the data source description remains unchanged.", optional: true, }, properties: { type: "object", label: "Properties", - description: "The properties of a database to be changed in the request, in the form of a JSON object. If updating an existing property, then the keys are the names or IDs of the properties as they appear in Notion, and the values are [property schema objects](https://developers.notion.com/reference/rich-text). If adding a new property, then the key is the name of the new database property and the value is a [property schema object](https://developers.notion.com/reference/property-schema-object).", + description: "The properties of a data source to be changed in the request, in the form of a JSON object. If updating an existing property, then the keys are the names or IDs of the properties as they appear in Notion, and the values are [property schema objects](https://developers.notion.com/reference/property-schema-object). If adding a new property, then the key is the name of the new data source property and the value is a [property schema object](https://developers.notion.com/reference/property-schema-object).", optional: true, }, }, async additionalProps(props) { - if (this.databaseId) { - const database = await this.notion.retrieveDatabase(this.databaseId); + if (this.dataSourceId) { + const dataSource = await this.notion.retrieveDataSource(this.dataSourceId); - props.title.default = database.title.map((text) => text.text.content).join(" "); - props.description.default = database.description.map((text) => text.plain_text).join(" "); - props.properties.default = Object.entries(database.properties).reduce((acc, [ + props.title.default = dataSource.title.map((text) => text.text.content).join(" "); + props.description.default = dataSource.description.map((text) => text.plain_text).join(" "); + props.properties.default = Object.entries(dataSource.properties).reduce((acc, [ key, value, ]) => { @@ -54,8 +54,8 @@ export default { } }, async run({ $ }) { - const response = await this.notion.updateDatabase({ - database_id: this.databaseId, + const response = await this.notion.updateDataSource({ + data_source_id: this.dataSourceId, title: [ { text: { @@ -73,7 +73,7 @@ export default { properties: utils.parseObject(this.properties), }); - $.export("$summary", `Successfully updated database with ID ${response.id}`); + $.export("$summary", `Successfully updated data source with ID ${response.id}`); return response; }, }; diff --git a/components/notion/actions/update-page/update-page.mjs b/components/notion/actions/update-page/update-page.mjs index 7ea9dc753f8e8..09468438e14f6 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.10", + version: "2.0.0", type: "action", props: { notion, @@ -16,21 +16,21 @@ export default { alertType: "info", content: "Properties that are not set will remain unchanged.", }, - parent: { + parentDataSource: { propDefinition: [ notion, - "databaseId", + "dataSourceId", ], - label: "Parent Database ID", - 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", + label: "Parent Data Source ID", + description: "Select the data source that contains the page to update. If you instead provide a data source ID in a custom expression, you will also have to provide the page's ID in a custom expression", reloadProps: true, }, pageId: { propDefinition: [ notion, - "pageIdInDatabase", + "pageIdInDataSource", (c) => ({ - databaseId: c.parent, + dataSourceId: c.parentDataSource, }), ], }, @@ -51,8 +51,8 @@ export default { notion, "propertyTypes", (c) => ({ - parentId: c.parent, - parentType: "database", + parentId: c.parentDataSource, + parentType: "data_source", }), ], reloadProps: true, @@ -60,7 +60,7 @@ export default { }, async additionalProps() { try { - const { properties } = await this.notion.retrieveDatabase(this.parent); + const { properties } = await this.notion.retrieveDataSource(this.parentDataSource); const selectedProperties = pick(properties, this.propertyTypes); return this.buildAdditionalProps({ @@ -85,7 +85,7 @@ export default { * @returns the constructed page in Notion format */ buildPage(page) { - const meta = this.buildDatabaseMeta(page); + const meta = this.buildDataSourceMeta(page); const properties = this.buildPageProperties(page.properties); return { ...meta, diff --git a/components/notion/common/notion-meta-properties.mjs b/components/notion/common/notion-meta-properties.mjs index 0486ded9eb6d7..b0e2dfab572af 100644 --- a/components/notion/common/notion-meta-properties.mjs +++ b/components/notion/common/notion-meta-properties.mjs @@ -2,14 +2,15 @@ import utils from "./utils.mjs"; /** * Implementation for Database Meta in Notion - https://developers.notion.com/reference/database + * See also Data Sources - https://developers.notion.com/reference/data-source * * convertToNotion: converts the prop values to send to the Notion API */ -export const NOTION_DATABASE_META = { +export const NOTION_DATA_SOURCE_META = { parent: { convertToNotion: (property) => ({ - type: "database_id", - database_id: property.value, + type: "data_source_id", + data_source_id: property.value, }), }, title: { @@ -42,7 +43,7 @@ export const NOTION_DATABASE_META = { * Implementation for Page Meta in Notion - https://developers.notion.com/reference/page */ export const NOTION_PAGE_META = { - ...NOTION_DATABASE_META, + ...NOTION_DATA_SOURCE_META, parent: { convertToNotion: (property) => ({ type: "page_id", @@ -52,6 +53,6 @@ export const NOTION_PAGE_META = { }; export default { - NOTION_DATABASE_META, + NOTION_DATA_SOURCE_META, NOTION_PAGE_META, }; diff --git a/components/notion/notion.app.mjs b/components/notion/notion.app.mjs index b831c907d8299..f95dc708c9b98 100644 --- a/components/notion/notion.app.mjs +++ b/components/notion/notion.app.mjs @@ -7,15 +7,15 @@ export default { type: "app", app: "notion", propDefinitions: { - databaseId: { + dataSourceId: { type: "string", - label: "Database ID", - description: "Select a database or provide a database ID", + label: "Data Source ID", + description: "Select a data source or provide a data source ID", async options({ prevContext }) { - const response = await this.listDatabases({ + const response = await this.listDataSources({ start_cursor: prevContext.nextPageParameters ?? undefined, }); - const options = this._extractDatabaseTitleOptions(response.results); + const options = this._extractDataSourceTitleOptions(response.results); return this._buildPaginatedOptions(options, response.next_cursor); }, }, @@ -38,16 +38,16 @@ export default { return this._buildPaginatedOptions(options, response.next_cursor); }, }, - pageIdInDatabase: { + pageIdInDataSource: { type: "string", label: "Page ID", - description: "Search for a page from the database or provide a page ID", + description: "Search for a page from the data source or provide a page ID", useQuery: true, async options({ - query, prevContext, databaseId, + query, prevContext, dataSourceId, }) { - this._checkOptionsContext(databaseId, "Database ID"); - const response = await this.queryDatabase(databaseId, { + this._checkOptionsContext(dataSourceId, "Data Source ID"); + const response = await this.queryDataSource(dataSourceId, { query, start_cursor: prevContext.nextPageParameters ?? undefined, }); @@ -65,8 +65,8 @@ export default { const parentType = response.parent.type; try { - const { properties } = parentType === "database_id" - ? await this.retrieveDatabase(response.parent.database_id) + const { properties } = parentType === "data_source_id" + ? await this.retrieveDataSource(response.parent.data_source_id) : response; const propEntries = Object.entries(properties); @@ -103,10 +103,10 @@ export default { async options({ parentId, parentType, }) { - this._checkOptionsContext(parentId, "Database ID"); + this._checkOptionsContext(parentId, "Data Source ID"); try { - const { properties } = parentType === "database" - ? await this.retrieveDatabase(parentId) + const { properties } = parentType === "data_source" + ? await this.retrieveDataSource(parentId) : await this.retrievePage(parentId); return Object.keys(properties); } catch (error) { @@ -195,12 +195,12 @@ export default { }, filter: { type: "string", - label: "Page or Database", - description: "Whether to search for pages or databases", + label: "Page or Data Source", + description: "Whether to search for pages or data sources.", optional: true, options: [ "page", - "database", + "data_source", ], }, pageContent: { @@ -219,10 +219,10 @@ export default { _getNotionClient() { return new notion.Client({ auth: this.$auth.oauth_access_token, - notionVersion: "2022-02-22", + notionVersion: "2025-09-03", }); }, - _extractDatabaseTitleOptions(databases) { + _extractDataSourceTitleOptions(databases) { return databases.map((database) => { const title = database.title .map((title) => title.plain_text) @@ -256,8 +256,8 @@ export default { }, }; }, - extractDatabaseTitle(database) { - return this._extractDatabaseTitleOptions([ + extractDataSourceTitle(database) { + return this._extractDataSourceTitleOptions([ database, ])[0].label; }, @@ -266,31 +266,31 @@ export default { page, ])[0].label; }, - async listDatabases(params = {}) { + async listDataSources(params = {}) { return this._getNotionClient().search({ filter: { property: "object", - value: "database", + value: "data_source", }, ...params, }); }, - async queryDatabase(databaseId, params = {}) { - return this._getNotionClient().databases.query({ - database_id: databaseId, - ...params, - }); - }, - async retrieveDatabase(databaseId) { - return this._getNotionClient().databases.retrieve({ - database_id: databaseId, + async retrieveDataSource(dataSourceId) { + return this._getNotionClient().dataSources.retrieve({ + data_source_id: dataSourceId, }); }, async createDatabase(database) { return this._getNotionClient().databases.create(database); }, - async updateDatabase(database) { - return this._getNotionClient().databases.update(database); + async updateDataSource(database) { + return this._getNotionClient().dataSources.update(database); + }, + async queryDataSource(dataSourceId, params = {}) { + return this._getNotionClient().dataSources.query({ + data_source_id: dataSourceId, + ...params, + }); }, async createFileUpload(file) { return this._getNotionClient().fileUploads.create(file); @@ -342,14 +342,14 @@ export default { }); }, /** - * This generator function scans the pages in a database yields each page + * This generator function scans the pages in a data source and yields each page * separately. * - * @param {string} databaseId - The database containing the pages to scan + * @param {string} dataSourceId - The data source containing the pages to scan * @param {object} [opts] - Options to customize the operation * @yield {object} The next page */ - async *getPages(databaseId, opts = {}) { + async *getPages(dataSourceId, opts = {}) { let cursor; do { @@ -357,7 +357,7 @@ export default { ...opts, start_cursor: cursor, }; - const response = await this.queryDatabase(databaseId, params); + const response = await this.queryDataSource(dataSourceId, params); const { results: pages, next_cursor: nextCursor, diff --git a/components/notion/package.json b/components/notion/package.json index dbdc60948d951..15d66ac78804b 100644 --- a/components/notion/package.json +++ b/components/notion/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/notion", - "version": "0.10.1", + "version": "1.0.0", "description": "Pipedream Notion Components", "main": "notion.app.mjs", "keywords": [ @@ -10,7 +10,7 @@ "homepage": "https://pipedream.com/apps/notion", "author": "Pipedream (https://pipedream.com/)", "dependencies": { - "@notionhq/client": "4.0.2", + "@notionhq/client": "^5.0.0", "@pipedream/platform": "^3.1.0", "@tryfabric/martian": "^1.2.4", "lodash-es": "^4.17.21", diff --git a/components/notion/sources/common/base.mjs b/components/notion/sources/common/base.mjs index b2340a2a4dd4e..08e1bfe554e01 100644 --- a/components/notion/sources/common/base.mjs +++ b/components/notion/sources/common/base.mjs @@ -34,8 +34,8 @@ export default { } = obj; const ts = Date.parse(lastTime); - if (type === constants.types.DATABASE) { - title = this.notion.extractDatabaseTitle(obj); + if (type === constants.types.DATABASE || type === constants.types.DATA_SOURCE) { + title = this.notion.extractDataSourceTitle(obj); } else { title = this.notion.extractPageTitle(obj); // Create composite ID so update events for the same page have unique keys diff --git a/components/notion/sources/common/constants.mjs b/components/notion/sources/common/constants.mjs index ab8e54972dc46..782084ee5e0f3 100644 --- a/components/notion/sources/common/constants.mjs +++ b/components/notion/sources/common/constants.mjs @@ -1,10 +1,12 @@ const types = { DATABASE: "database", + DATA_SOURCE: "data_source", PAGE: "page", }; const summaries = { DATABASE_ADDED: "Database added", + DATA_SOURCE_ADDED: "Data source added", PAGE_ADDED: "Page added", PAGE_UPDATED: "Page updated", }; 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 bc64a408f336d..ee509db1f9754 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.7", + version: "0.0.8", 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 9f2d73f6b8c9c..fbe83f13bce6e 100644 --- a/components/notion/sources/new-database/new-database.mjs +++ b/components/notion/sources/new-database/new-database.mjs @@ -5,48 +5,48 @@ import sampleEmit from "./test-event.mjs"; export default { ...base, 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.14", + name: "New Data Source Created", + description: "Emit new event when a data source is created. [See the documentation](https://developers.notion.com/reference/data-source)", + version: "0.1.0", type: "source", props: { ...base.props, infoLabel: { type: "alert", alertType: "info", - content: "Ensure Databases are shared with your Pipedream integration to receive events.", + content: "Ensure Data Sources are shared with your Pipedream integration to receive events.", }, }, async run() { - const databases = []; + const dataSources = []; const params = this.lastCreatedSortParam(); const lastCreatedTimestamp = this.getLastCreatedTimestamp(); do { - const response = await this.notion.listDatabases(params); + const response = await this.notion.listDataSources(params); - for (const database of response.results) { - if (!this.isResultNew(database.created_time, lastCreatedTimestamp)) { + for (const dataSource of response.results) { + if (!this.isResultNew(dataSource.created_time, lastCreatedTimestamp)) { params.start_cursor = null; break; } - databases.push(database); + dataSources.push(dataSource); } params.start_cursor = response.next_cursor; } while (params.start_cursor); - databases.reverse().forEach((database) => { + dataSources.reverse().forEach((dataSource) => { const meta = this.generateMeta( - database, - constants.types.DATABASE, + dataSource, + constants.types.DATA_SOURCE, constants.timestamps.CREATED_TIME, - constants.summaries.DATABASE_ADDED, + constants.summaries.DATA_SOURCE_ADDED, ); - this.$emit(database, meta); + this.$emit(dataSource, meta); }); - const lastCreatedTime = databases[databases.length - 1]?.created_time; + const lastCreatedTime = dataSources[dataSources.length - 1]?.created_time; if (lastCreatedTime) { this.setLastCreatedTimestamp(Date.parse(lastCreatedTime)); } diff --git a/components/notion/sources/new-page/new-page.mjs b/components/notion/sources/new-page/new-page.mjs index 6fe16c1eae166..e2cd78e5dbe01 100644 --- a/components/notion/sources/new-page/new-page.mjs +++ b/components/notion/sources/new-page/new-page.mjs @@ -6,16 +6,16 @@ import sampleEmit from "./test-event.mjs"; export default { ...base, 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.16", + name: "New Page in Data Source", + description: "Emit new event when a page is created in the selected data source. [See the documentation](https://developers.notion.com/reference/page)", + version: "1.0.0", type: "source", props: { ...base.props, - databaseId: { + dataSourceId: { propDefinition: [ notion, - "databaseId", + "dataSourceId", ], }, }, @@ -46,7 +46,7 @@ export default { // Get pages in created order descending until the first page edited after // lastCreatedTimestamp, then reverse list of pages and emit - const pagesStream = this.notion.getPages(this.databaseId, params); + const pagesStream = this.notion.getPages(this.dataSourceId, params); for await (const page of pagesStream) { if (!this.isResultNew(page.created_time, lastCreatedTimestamp) diff --git a/components/notion/sources/new-webhook-event-instant/new-webhook-event-instant.mjs b/components/notion/sources/new-webhook-event-instant/new-webhook-event-instant.mjs index ea409a5b32115..4992fe61a1d8e 100644 --- a/components/notion/sources/new-webhook-event-instant/new-webhook-event-instant.mjs +++ b/components/notion/sources/new-webhook-event-instant/new-webhook-event-instant.mjs @@ -6,7 +6,7 @@ export default { key: "notion-new-webhook-event-instant", name: "New Webhook Event (Instant)", description: "Emit new event each time a webhook event is received. Webhook must be setup in Notion. [See the documentation](https://developers.notion.com/reference/webhooks#step-1-creating-a-webhook-subscription)", - version: "0.0.2", + version: "0.0.3", type: "source", dedupe: "unique", methods: { 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 81348d87e13c8..ea79655e767c2 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.12", + version: "0.0.13", type: "source", dedupe: "unique", props: { diff --git a/components/notion/sources/page-properties-updated-instant/page-properties-updated-instant.mjs b/components/notion/sources/page-properties-updated-instant/page-properties-updated-instant.mjs index 76e74bcd725bb..0e45844c78189 100644 --- a/components/notion/sources/page-properties-updated-instant/page-properties-updated-instant.mjs +++ b/components/notion/sources/page-properties-updated-instant/page-properties-updated-instant.mjs @@ -5,16 +5,16 @@ export default { ...common, key: "notion-page-properties-updated-instant", name: "Page Properties Updated (Instant)", - description: "Emit new event each time a page property is updated in a database. For use with Page Properties Updated event type. Webhook must be set up in Notion. [See the documentation](https://developers.notion.com/reference/webhooks#step-1-creating-a-webhook-subscription)", - version: "0.0.2", + description: "Emit new event each time a page property is updated in a data source. For use with Page Properties Updated event type. Webhook must be set up in Notion. [See the documentation](https://developers.notion.com/reference/webhooks#step-1-creating-a-webhook-subscription)", + version: "1.0.0", type: "source", dedupe: "unique", props: { ...common.props, - databaseId: { + dataSourceId: { propDefinition: [ common.props.notion, - "databaseId", + "dataSourceId", ], }, properties: { @@ -24,7 +24,7 @@ export default { optional: true, async options() { try { - const { properties } = await this.notion.retrieveDatabase(this.databaseId); + const { properties } = await this.notion.retrieveDataSource(this.dataSourceId); const propEntries = Object.entries(properties); return propEntries.map((prop) => ({ label: prop[1].name, @@ -55,8 +55,8 @@ export default { return; } - if (event.data.parent.id !== this.databaseId) { - console.log(`Skipping event for database: ${event.data.parent.id}`); + if (event.data.parent.data_source_id !== this.dataSourceId) { + console.log(`Skipping event for data source: ${event.data.parent.data_source_id}`); return; } diff --git a/components/notion/sources/updated-page-by-timestamp/updated-page-by-timestamp.mjs b/components/notion/sources/updated-page-by-timestamp/updated-page-by-timestamp.mjs index cc38568e7ccf8..78f76b8a4c251 100644 --- a/components/notion/sources/updated-page-by-timestamp/updated-page-by-timestamp.mjs +++ b/components/notion/sources/updated-page-by-timestamp/updated-page-by-timestamp.mjs @@ -6,17 +6,17 @@ import sampleEmit from "./test-event.mjs"; export default { ...base, key: "notion-updated-page-by-timestamp", - name: "New or Updated Page in Database (By Timestamp)", - 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.0.4", + name: "New or Updated Page in Data Source (By Timestamp)", + description: "Emit new event when a page is created or updated in the selected data source. [See the documentation](https://developers.notion.com/reference/page)", + version: "1.0.0", type: "source", dedupe: "unique", props: { ...base.props, - databaseId: { + dataSourceId: { propDefinition: [ notion, - "databaseId", + "dataSourceId", ], }, includeNewPages: { @@ -59,7 +59,7 @@ export default { }, }; - const pagesStream = this.notion.getPages(this.databaseId, params); + const pagesStream = this.notion.getPages(this.dataSourceId, params); for await (const page of pagesStream) { if (lastUpdatedTimestamp > Date.parse(page.last_edited_time)) { 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 3bc50dee1aa0c..467acb47351d1 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.11", + version: "0.0.12", 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 7ba099dce3a4e..2f8dbf408ceb5 100644 --- a/components/notion/sources/updated-page/updated-page.mjs +++ b/components/notion/sources/updated-page/updated-page.mjs @@ -7,17 +7,17 @@ import sampleEmit from "./test-event.mjs"; export default { ...base, key: "notion-updated-page", - name: "New or Updated Page in Database (By Property)", - 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.12", + name: "New or Updated Page in Data Source (By Property)", + description: "Emit new event when a page is created or updated in the selected data source. [See the documentation](https://developers.notion.com/reference/page)", + version: "1.0.0", type: "source", dedupe: "unique", props: { ...base.props, - databaseId: { + dataSourceId: { propDefinition: [ notion, - "databaseId", + "dataSourceId", ], }, includeNewPages: { @@ -31,8 +31,8 @@ export default { notion, "propertyTypes", (c) => ({ - parentId: c.databaseId, - parentType: "database", + parentId: c.dataSourceId, + parentType: "data_source", }), ], description: "Only emit events when one or more of the selected properties have changed", @@ -51,7 +51,7 @@ export default { const propertyValues = {}; const propertiesToCheck = await this._getPropertiesToCheck(); const params = this.lastUpdatedSortParam(); - const pagesStream = this.notion.getPages(this.databaseId, params); + const pagesStream = this.notion.getPages(this.dataSourceId, params); for await (const page of pagesStream) { for (const propertyName of propertiesToCheck) { const currentValue = this._maybeRemoveFileSubItems(page.properties[propertyName]); @@ -91,7 +91,7 @@ export default { if (this.properties?.length) { return this.properties; } - const { properties } = await this.notion.retrieveDatabase(this.databaseId); + const { properties } = await this.notion.retrieveDataSource(this.dataSourceId); return Object.keys(properties); }, _maybeRemoveFileSubItems(property) { @@ -150,7 +150,7 @@ export default { }; let newLastUpdatedTimestamp = lastCheckedTimestamp; const propertiesToCheck = await this._getPropertiesToCheck(); - const pagesStream = this.notion.getPages(this.databaseId, params); + const pagesStream = this.notion.getPages(this.dataSourceId, params); for await (const page of pagesStream) { const changes = []; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 927a88947673f..c6a0cc67cc759 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -9549,8 +9549,8 @@ importers: components/notion: dependencies: '@notionhq/client': - specifier: 4.0.2 - version: 4.0.2 + specifier: ^5.0.0 + version: 5.0.0 '@pipedream/platform': specifier: ^3.1.0 version: 3.1.0 @@ -19762,6 +19762,10 @@ packages: resolution: {integrity: sha512-4pk3dm4umhjsRI0umCnJ8lCZh0TMiaMdkY0rz6FV4OqVuTsmYFV3pk+YTR5S8792ZY2Rm4lJHlLj05HQVKDuIg==} engines: {node: '>=18'} + '@notionhq/client@5.0.0': + resolution: {integrity: sha512-eXq0bZTXN8+xwT6e3qlrH9QCUn8mQLJ9UkNgKSew2NKNV/hyKb2wmIzQAuass8a2Q6F1aMjMPi+EGLQwgbVlOA==} + engines: {node: '>=18'} + '@octokit/auth-token@2.5.0': resolution: {integrity: sha512-r5FVUJCOLl19AxiuZD2VRZ/ORjp/4IN98Of6YJoJOkY75CIBuYfmiNHGrDwXr+aLGG55igl9QrxX3hbiXlLb+g==} @@ -37477,6 +37481,8 @@ snapshots: '@notionhq/client@4.0.2': {} + '@notionhq/client@5.0.0': {} + '@octokit/auth-token@2.5.0': dependencies: '@octokit/types': 6.41.0