diff --git a/components/notion_api_key/actions/append-block/append-block.mjs b/components/notion_api_key/actions/append-block/append-block.mjs new file mode 100644 index 0000000000000..5b652158c5343 --- /dev/null +++ b/components/notion_api_key/actions/append-block/append-block.mjs @@ -0,0 +1,22 @@ +import app from "../../notion_api_key.app.mjs"; +import common from "@pipedream/notion/actions/append-block/append-block.mjs"; + +import { adjustPropDefinitions } from "../../common/utils.mjs"; + +const { + name, description, type, ...others +} = common; +const props = adjustPropDefinitions(others.props, app); + +export default { + ...others, + key: "notion_api_key-append-block", + version: "0.0.1", + name, + description, + type, + props: { + notion: app, + ...props, + }, +}; diff --git a/components/notion_api_key/actions/create-comment/create-comment.mjs b/components/notion_api_key/actions/create-comment/create-comment.mjs new file mode 100644 index 0000000000000..8175de5a61e59 --- /dev/null +++ b/components/notion_api_key/actions/create-comment/create-comment.mjs @@ -0,0 +1,22 @@ +import app from "../../notion_api_key.app.mjs"; +import common from "@pipedream/notion/actions/create-comment/create-comment.mjs"; + +import { adjustPropDefinitions } from "../../common/utils.mjs"; + +const { + name, description, type, ...others +} = common; +const props = adjustPropDefinitions(others.props, app); + +export default { + ...others, + key: "notion_api_key-create-comment", + version: "0.0.1", + name, + description, + type, + props: { + notion: app, + ...props, + }, +}; diff --git a/components/notion_api_key/actions/create-page-from-database/create-page-from-database.mjs b/components/notion_api_key/actions/create-page-from-database/create-page-from-database.mjs new file mode 100644 index 0000000000000..f2f9bfd998ac6 --- /dev/null +++ b/components/notion_api_key/actions/create-page-from-database/create-page-from-database.mjs @@ -0,0 +1,22 @@ +import app from "../../notion_api_key.app.mjs"; +import common from "@pipedream/notion/actions/create-page-from-database/create-page-from-database.mjs"; + +import { adjustPropDefinitions } from "../../common/utils.mjs"; + +const { + name, description, type, ...others +} = common; +const props = adjustPropDefinitions(others.props, app); + +export default { + ...others, + key: "notion_api_key-create-page-from-database", + version: "0.0.1", + name, + description, + type, + props: { + notion: app, + ...props, + }, +}; diff --git a/components/notion_api_key/actions/create-page/create-page.mjs b/components/notion_api_key/actions/create-page/create-page.mjs new file mode 100644 index 0000000000000..f97ddc3694ba4 --- /dev/null +++ b/components/notion_api_key/actions/create-page/create-page.mjs @@ -0,0 +1,22 @@ +import app from "../../notion_api_key.app.mjs"; +import common from "@pipedream/notion/actions/create-page/create-page.mjs"; + +import { adjustPropDefinitions } from "../../common/utils.mjs"; + +const { + name, description, type, ...others +} = common; +const props = adjustPropDefinitions(others.props, app); + +export default { + ...others, + key: "notion_api_key-create-page", + version: "0.0.1", + name, + description, + type, + props: { + notion: app, + ...props, + }, +}; diff --git a/components/notion_api_key/actions/duplicate-page/duplicate-page.mjs b/components/notion_api_key/actions/duplicate-page/duplicate-page.mjs new file mode 100644 index 0000000000000..6bc1d8727005c --- /dev/null +++ b/components/notion_api_key/actions/duplicate-page/duplicate-page.mjs @@ -0,0 +1,22 @@ +import app from "../../notion_api_key.app.mjs"; +import common from "@pipedream/notion/actions/duplicate-page/duplicate-page.mjs"; + +import { adjustPropDefinitions } from "../../common/utils.mjs"; + +const { + name, description, type, ...others +} = common; +const props = adjustPropDefinitions(others.props, app); + +export default { + ...others, + key: "notion_api_key-duplicate-page", + version: "0.0.1", + name, + description, + type, + props: { + notion: app, + ...props, + }, +}; diff --git a/components/notion_api_key/actions/query-database/query-database.mjs b/components/notion_api_key/actions/query-database/query-database.mjs new file mode 100644 index 0000000000000..a3b5e64192e55 --- /dev/null +++ b/components/notion_api_key/actions/query-database/query-database.mjs @@ -0,0 +1,22 @@ +import app from "../../notion_api_key.app.mjs"; +import common from "@pipedream/notion/actions/query-database/query-database.mjs"; + +import { adjustPropDefinitions } from "../../common/utils.mjs"; + +const { + name, description, type, ...others +} = common; +const props = adjustPropDefinitions(others.props, app); + +export default { + ...others, + key: "notion_api_key-query-database", + version: "0.0.1", + name, + description, + type, + props: { + notion: app, + ...props, + }, +}; diff --git a/components/notion_api_key/actions/retrieve-block/retrieve-block.mjs b/components/notion_api_key/actions/retrieve-block/retrieve-block.mjs new file mode 100644 index 0000000000000..83a66db6d6166 --- /dev/null +++ b/components/notion_api_key/actions/retrieve-block/retrieve-block.mjs @@ -0,0 +1,22 @@ +import app from "../../notion_api_key.app.mjs"; +import common from "@pipedream/notion/actions/retrieve-block/retrieve-block.mjs"; + +import { adjustPropDefinitions } from "../../common/utils.mjs"; + +const { + name, description, type, ...others +} = common; +const props = adjustPropDefinitions(others.props, app); + +export default { + ...others, + key: "notion_api_key-retrieve-block", + version: "0.0.1", + name, + description, + type, + props: { + notion: app, + ...props, + }, +}; diff --git a/components/notion_api_key/actions/retrieve-database-content/retrieve-database-content.mjs b/components/notion_api_key/actions/retrieve-database-content/retrieve-database-content.mjs new file mode 100644 index 0000000000000..b8f1a8305fe64 --- /dev/null +++ b/components/notion_api_key/actions/retrieve-database-content/retrieve-database-content.mjs @@ -0,0 +1,22 @@ +import app from "../../notion_api_key.app.mjs"; +import common from "@pipedream/notion/actions/retrieve-database-content/retrieve-database-content.mjs"; + +import { adjustPropDefinitions } from "../../common/utils.mjs"; + +const { + name, description, type, ...others +} = common; +const props = adjustPropDefinitions(others.props, app); + +export default { + ...others, + key: "notion_api_key-retrieve-database-content", + version: "0.0.1", + name, + description, + type, + props: { + notion: app, + ...props, + }, +}; diff --git a/components/notion_api_key/actions/retrieve-database-schema/retrieve-database-schema.mjs b/components/notion_api_key/actions/retrieve-database-schema/retrieve-database-schema.mjs new file mode 100644 index 0000000000000..9fecdf83543ed --- /dev/null +++ b/components/notion_api_key/actions/retrieve-database-schema/retrieve-database-schema.mjs @@ -0,0 +1,22 @@ +import app from "../../notion_api_key.app.mjs"; +import common from "@pipedream/notion/actions/retrieve-database-schema/retrieve-database-schema.mjs"; + +import { adjustPropDefinitions } from "../../common/utils.mjs"; + +const { + name, description, type, ...others +} = common; +const props = adjustPropDefinitions(others.props, app); + +export default { + ...others, + key: "notion_api_key-retrieve-database-schema", + version: "0.0.1", + name, + description, + type, + props: { + notion: app, + ...props, + }, +}; diff --git a/components/notion_api_key/actions/retrieve-page-property-item/retrieve-page-property-item.mjs b/components/notion_api_key/actions/retrieve-page-property-item/retrieve-page-property-item.mjs new file mode 100644 index 0000000000000..c9ae4d4b03a88 --- /dev/null +++ b/components/notion_api_key/actions/retrieve-page-property-item/retrieve-page-property-item.mjs @@ -0,0 +1,22 @@ +import app from "../../notion_api_key.app.mjs"; +import common from "@pipedream/notion/actions/retrieve-page-property-item/retrieve-page-property-item.mjs"; + +import { adjustPropDefinitions } from "../../common/utils.mjs"; + +const { + name, description, type, ...others +} = common; +const props = adjustPropDefinitions(others.props, app); + +export default { + ...others, + key: "notion_api_key-retrieve-page-property-item", + version: "0.0.1", + name, + description, + type, + props: { + notion: app, + ...props, + }, +}; diff --git a/components/notion_api_key/actions/retrieve-page/retrieve-page.mjs b/components/notion_api_key/actions/retrieve-page/retrieve-page.mjs new file mode 100644 index 0000000000000..5a3926dc95e19 --- /dev/null +++ b/components/notion_api_key/actions/retrieve-page/retrieve-page.mjs @@ -0,0 +1,22 @@ +import app from "../../notion_api_key.app.mjs"; +import common from "@pipedream/notion/actions/retrieve-page/retrieve-page.mjs"; + +import { adjustPropDefinitions } from "../../common/utils.mjs"; + +const { + name, description, type, ...others +} = common; +const props = adjustPropDefinitions(others.props, app); + +export default { + ...others, + key: "notion_api_key-retrieve-page", + version: "0.0.1", + name, + description, + type, + props: { + notion: app, + ...props, + }, +}; diff --git a/components/notion_api_key/actions/search/search.mjs b/components/notion_api_key/actions/search/search.mjs new file mode 100644 index 0000000000000..f5ee158270272 --- /dev/null +++ b/components/notion_api_key/actions/search/search.mjs @@ -0,0 +1,22 @@ +import app from "../../notion_api_key.app.mjs"; +import common from "@pipedream/notion/actions/search/search.mjs"; + +import { adjustPropDefinitions } from "../../common/utils.mjs"; + +const { + name, description, type, ...others +} = common; +const props = adjustPropDefinitions(others.props, app); + +export default { + ...others, + key: "notion_api_key-search", + version: "0.0.1", + name, + description, + type, + props: { + notion: app, + ...props, + }, +}; diff --git a/components/notion_api_key/actions/update-page/update-page.mjs b/components/notion_api_key/actions/update-page/update-page.mjs new file mode 100644 index 0000000000000..e73702628f1f4 --- /dev/null +++ b/components/notion_api_key/actions/update-page/update-page.mjs @@ -0,0 +1,22 @@ +import app from "../../notion_api_key.app.mjs"; +import common from "@pipedream/notion/actions/update-page/update-page.mjs"; + +import { adjustPropDefinitions } from "../../common/utils.mjs"; + +const { + name, description, type, ...others +} = common; +const props = adjustPropDefinitions(others.props, app); + +export default { + ...others, + key: "notion_api_key-update-page", + version: "0.0.1", + name, + description, + type, + props: { + notion: app, + ...props, + }, +}; diff --git a/components/notion_api_key/common/utils.mjs b/components/notion_api_key/common/utils.mjs new file mode 100644 index 0000000000000..d42df055ddeb0 --- /dev/null +++ b/components/notion_api_key/common/utils.mjs @@ -0,0 +1,40 @@ +export function adjustPropDefinitions(props, app) { + return Object.fromEntries( + Object.entries(props).map(([ + key, + prop, + ]) => { + if (typeof prop === "string") return [ + key, + prop, + ]; + const { + propDefinition, ...otherValues + } = prop; + if (propDefinition) { + const [ + , ...otherDefs + ] = propDefinition; + return [ + key, + { + propDefinition: [ + app, + ...otherDefs, + ], + ...otherValues, + }, + ]; + } + return [ + key, + otherValues.type === "app" + ? null + : otherValues, + ]; + }) + .filter(([ + , value, + ]) => value), + ); +} diff --git a/components/notion_api_key/notion_api_key.app.mjs b/components/notion_api_key/notion_api_key.app.mjs index 3bd8c23e455e8..a33c7f369c8bb 100644 --- a/components/notion_api_key/notion_api_key.app.mjs +++ b/components/notion_api_key/notion_api_key.app.mjs @@ -1,11 +1,17 @@ +import notion from "@notionhq/client"; +import common from "@pipedream/notion"; + export default { + ...common, type: "app", app: "notion_api_key", - propDefinitions: {}, methods: { - // this.$auth contains connected account data - authKeys() { - console.log(Object.keys(this.$auth)); + ...common.methods, + _getNotionClient() { + return new notion.Client({ + auth: this.$auth.api_secret, + notionVersion: "2022-02-22", + }); }, }, }; diff --git a/components/notion_api_key/package.json b/components/notion_api_key/package.json index 53fcd794821b3..27c00b0f35bea 100644 --- a/components/notion_api_key/package.json +++ b/components/notion_api_key/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/notion_api_key", - "version": "0.0.1", + "version": "0.1.0", "description": "Pipedream Notion (API Key) Components", "main": "notion_api_key.app.mjs", "keywords": [ @@ -11,5 +11,9 @@ "author": "Pipedream (https://pipedream.com/)", "publishConfig": { "access": "public" + }, + "dependencies": { + "@notionhq/client": "^2.3.0", + "@pipedream/notion": "^0.6.2" } -} \ No newline at end of file +} diff --git a/components/notion_api_key/sources/new-comment-created/new-comment-created.mjs b/components/notion_api_key/sources/new-comment-created/new-comment-created.mjs new file mode 100644 index 0000000000000..53d3d5b248639 --- /dev/null +++ b/components/notion_api_key/sources/new-comment-created/new-comment-created.mjs @@ -0,0 +1,22 @@ +import app from "../../notion_api_key.app.mjs"; +import common from "@pipedream/notion/sources/new-comment-created/new-comment-created.mjs"; + +import { adjustPropDefinitions } from "../../common/utils.mjs"; + +const { + name, description, type, ...others +} = common; +const props = adjustPropDefinitions(others.props, app); + +export default { + ...others, + key: "notion_api_key-new-comment-created", + version: "0.0.1", + name, + description, + type, + props: { + notion: app, + ...props, + }, +}; diff --git a/components/notion_api_key/sources/new-database/new-database.mjs b/components/notion_api_key/sources/new-database/new-database.mjs new file mode 100644 index 0000000000000..a6c177af74169 --- /dev/null +++ b/components/notion_api_key/sources/new-database/new-database.mjs @@ -0,0 +1,22 @@ +import app from "../../notion_api_key.app.mjs"; +import common from "@pipedream/notion/sources/new-database/new-database.mjs"; + +import { adjustPropDefinitions } from "../../common/utils.mjs"; + +const { + name, description, type, ...others +} = common; +const props = adjustPropDefinitions(others.props, app); + +export default { + ...others, + key: "notion_api_key-new-database", + version: "0.0.1", + name, + description, + type, + props: { + notion: app, + ...props, + }, +}; diff --git a/components/notion_api_key/sources/new-page/new-page.mjs b/components/notion_api_key/sources/new-page/new-page.mjs new file mode 100644 index 0000000000000..b71aa2d81ee27 --- /dev/null +++ b/components/notion_api_key/sources/new-page/new-page.mjs @@ -0,0 +1,22 @@ +import app from "../../notion_api_key.app.mjs"; +import common from "@pipedream/notion/sources/new-page/new-page.mjs"; + +import { adjustPropDefinitions } from "../../common/utils.mjs"; + +const { + name, description, type, ...others +} = common; +const props = adjustPropDefinitions(others.props, app); + +export default { + ...others, + key: "notion_api_key-new-page", + version: "0.0.1", + name, + description, + type, + props: { + notion: app, + ...props, + }, +}; diff --git a/components/notion_api_key/sources/page-or-subpage-updated/page-or-subpage-updated.mjs b/components/notion_api_key/sources/page-or-subpage-updated/page-or-subpage-updated.mjs new file mode 100644 index 0000000000000..47d77c152c63a --- /dev/null +++ b/components/notion_api_key/sources/page-or-subpage-updated/page-or-subpage-updated.mjs @@ -0,0 +1,22 @@ +import app from "../../notion_api_key.app.mjs"; +import common from "@pipedream/notion/sources/page-or-subpage-updated/page-or-subpage-updated.mjs"; + +import { adjustPropDefinitions } from "../../common/utils.mjs"; + +const { + name, description, type, ...others +} = common; +const props = adjustPropDefinitions(others.props, app); + +export default { + ...others, + key: "notion_api_key-page-or-subpage-updated", + version: "0.0.1", + name, + description, + type, + props: { + notion: app, + ...props, + }, +}; diff --git a/components/notion_api_key/sources/updated-page-id/updated-page-id.mjs b/components/notion_api_key/sources/updated-page-id/updated-page-id.mjs new file mode 100644 index 0000000000000..d3a8690913b8c --- /dev/null +++ b/components/notion_api_key/sources/updated-page-id/updated-page-id.mjs @@ -0,0 +1,22 @@ +import app from "../../notion_api_key.app.mjs"; +import common from "@pipedream/notion/sources/updated-page-id/updated-page-id.mjs"; + +import { adjustPropDefinitions } from "../../common/utils.mjs"; + +const { + name, description, type, ...others +} = common; +const props = adjustPropDefinitions(others.props, app); + +export default { + ...others, + key: "notion_api_key-updated-page-id", + version: "0.0.1", + name, + description, + type, + props: { + notion: app, + ...props, + }, +}; diff --git a/components/notion_api_key/sources/updated-page/updated-page.mjs b/components/notion_api_key/sources/updated-page/updated-page.mjs new file mode 100644 index 0000000000000..134fe60a755c7 --- /dev/null +++ b/components/notion_api_key/sources/updated-page/updated-page.mjs @@ -0,0 +1,22 @@ +import app from "../../notion_api_key.app.mjs"; +import common from "@pipedream/notion/sources/updated-page/updated-page.mjs"; + +import { adjustPropDefinitions } from "../../common/utils.mjs"; + +const { + name, description, type, ...others +} = common; +const props = adjustPropDefinitions(others.props, app); + +export default { + ...others, + key: "notion_api_key-updated-page", + version: "0.0.1", + name, + description, + type, + props: { + notion: app, + ...props, + }, +}; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f20104a5942db..a368ec49795c5 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8720,7 +8720,14 @@ importers: specifier: 3.1.8 version: 3.1.8 - components/notion_api_key: {} + components/notion_api_key: + dependencies: + '@notionhq/client': + specifier: ^2.3.0 + version: 2.3.0 + '@pipedream/notion': + specifier: ^0.6.2 + version: 0.6.2 components/nozbe_teams: {} @@ -17835,6 +17842,10 @@ packages: resolution: {integrity: sha512-XhdSY/4B1D34tSco/GION+23GMjaS9S2zszcqYkMHo8RcWInymF6L1x+Gk7EmHdrSxNFva2WM8orhC4BwQCwgw==} engines: {node: '>=12'} + '@notionhq/client@2.3.0': + resolution: {integrity: sha512-l7WqTCpQqC+HibkB9chghONQTYcxNQT0/rOJemBfmuKQRTu2vuV8B3yA395iKaUdDo7HI+0KvQaz9687Xskzkw==} + engines: {node: '>=12'} + '@octokit/auth-token@2.5.0': resolution: {integrity: sha512-r5FVUJCOLl19AxiuZD2VRZ/ORjp/4IN98Of6YJoJOkY75CIBuYfmiNHGrDwXr+aLGG55igl9QrxX3hbiXlLb+g==} @@ -17956,6 +17967,9 @@ packages: '@pipedream/monday@0.7.0': resolution: {integrity: sha512-ovVtLhKMJpOTSoc7JcVLrbVrJxW4BT96eW79TiiPc+DgMSM7ouRmCk5lHL2xCAtrqDForXSrXXGjHOAzhJsytA==} + '@pipedream/notion@0.6.2': + resolution: {integrity: sha512-xA2oh2eVwUrQ/pvAAtlLjWaWJsYaDhNQ00W3xkv5RcAMYKA0EbUQzSjL6ljSWlWiye3CftoFxK/L56Mld38iOQ==} + '@pipedream/platform@0.10.0': resolution: {integrity: sha512-N3F/xVfBZQXc9wl+2/4E8U9Zma1rxpvylK6Gtw8Ofmiwjnmnvs+2SNjEpIXBPUeL+wxEkofSGOq7bkqt1hqwDg==} @@ -33876,6 +33890,13 @@ snapshots: transitivePeerDependencies: - encoding + '@notionhq/client@2.3.0': + dependencies: + '@types/node-fetch': 2.6.12 + node-fetch: 2.7.0 + transitivePeerDependencies: + - encoding + '@octokit/auth-token@2.5.0': dependencies: '@octokit/types': 6.41.0 @@ -34140,6 +34161,18 @@ snapshots: - debug - encoding + '@pipedream/notion@0.6.2': + dependencies: + '@notionhq/client': 2.3.0 + '@pipedream/platform': 3.0.3 + '@tryfabric/martian': 1.2.4 + lodash-es: 4.17.21 + notion-to-md: 3.1.8 + transitivePeerDependencies: + - debug + - encoding + - supports-color + '@pipedream/platform@0.10.0': dependencies: axios: 0.19.2