diff --git a/components/apify_oauth/actions/get-dataset-items/get-dataset-items.mjs b/components/apify_oauth/actions/get-dataset-items/get-dataset-items.mjs new file mode 100644 index 0000000000000..512f3cf946627 --- /dev/null +++ b/components/apify_oauth/actions/get-dataset-items/get-dataset-items.mjs @@ -0,0 +1,22 @@ +import app from "../../apify_oauth.app.mjs"; +import common from "@pipedream/apify/actions/get-dataset-items/get-dataset-items.mjs"; + +import { adjustPropDefinitions } from "../../common/utils.mjs"; + +const { + name, description, type, ...others +} = common; +const props = adjustPropDefinitions(others.props, app); + +export default { + ...others, + key: "apify_oauth-get-dataset-items", + version: "0.0.1", + name, + description, + type, + props: { + apify: app, + ...props, + }, +}; diff --git a/components/apify_oauth/actions/run-actor/run-actor.mjs b/components/apify_oauth/actions/run-actor/run-actor.mjs new file mode 100644 index 0000000000000..d2185b8dd415e --- /dev/null +++ b/components/apify_oauth/actions/run-actor/run-actor.mjs @@ -0,0 +1,22 @@ +import app from "../../apify_oauth.app.mjs"; +import common from "@pipedream/apify/actions/run-actor/run-actor.mjs"; + +import { adjustPropDefinitions } from "../../common/utils.mjs"; + +const { + name, description, type, ...others +} = common; +const props = adjustPropDefinitions(others.props, app); + +export default { + ...others, + key: "apify_oauth-run-actor", + version: "0.0.1", + name, + description, + type, + props: { + apify: app, + ...props, + }, +}; diff --git a/components/apify_oauth/actions/run-task-synchronously/run-task-synchronously.mjs b/components/apify_oauth/actions/run-task-synchronously/run-task-synchronously.mjs new file mode 100644 index 0000000000000..bc1148e71b47f --- /dev/null +++ b/components/apify_oauth/actions/run-task-synchronously/run-task-synchronously.mjs @@ -0,0 +1,22 @@ +import app from "../../apify_oauth.app.mjs"; +import common from "@pipedream/apify/actions/run-task-synchronously/run-task-synchronously.mjs"; + +import { adjustPropDefinitions } from "../../common/utils.mjs"; + +const { + name, description, type, ...others +} = common; +const props = adjustPropDefinitions(others.props, app); + +export default { + ...others, + key: "apify_oauth-run-task-synchronously", + version: "0.0.1", + name, + description, + type, + props: { + apify: app, + ...props, + }, +}; diff --git a/components/apify_oauth/actions/scrape-single-url/scrape-single-url.mjs b/components/apify_oauth/actions/scrape-single-url/scrape-single-url.mjs new file mode 100644 index 0000000000000..8f9fe7fb05813 --- /dev/null +++ b/components/apify_oauth/actions/scrape-single-url/scrape-single-url.mjs @@ -0,0 +1,22 @@ +import app from "../../apify_oauth.app.mjs"; +import common from "@pipedream/apify/actions/scrape-single-url/scrape-single-url.mjs"; + +import { adjustPropDefinitions } from "../../common/utils.mjs"; + +const { + name, description, type, ...others +} = common; +const props = adjustPropDefinitions(others.props, app); + +export default { + ...others, + key: "apify_oauth-scrape-single-url", + version: "0.0.1", + name, + description, + type, + props: { + apify: app, + ...props, + }, +}; diff --git a/components/apify_oauth/actions/set-key-value-store-record/set-key-value-store-record.mjs b/components/apify_oauth/actions/set-key-value-store-record/set-key-value-store-record.mjs new file mode 100644 index 0000000000000..61b12378caeb1 --- /dev/null +++ b/components/apify_oauth/actions/set-key-value-store-record/set-key-value-store-record.mjs @@ -0,0 +1,22 @@ +import app from "../../apify_oauth.app.mjs"; +import common from "@pipedream/apify/actions/set-key-value-store-record/set-key-value-store-record.mjs"; + +import { adjustPropDefinitions } from "../../common/utils.mjs"; + +const { + name, description, type, ...others +} = common; +const props = adjustPropDefinitions(others.props, app); + +export default { + ...others, + key: "apify_oauth-set-key-value-store-record", + version: "0.0.1", + name, + description, + type, + props: { + apify: app, + ...props, + }, +}; diff --git a/components/apify_oauth/apify_oauth.app.mjs b/components/apify_oauth/apify_oauth.app.mjs index e829abd708582..9764aaafbf77a 100644 --- a/components/apify_oauth/apify_oauth.app.mjs +++ b/components/apify_oauth/apify_oauth.app.mjs @@ -1,11 +1,19 @@ +import common from "@pipedream/apify"; + export default { type: "app", app: "apify_oauth", - propDefinitions: {}, + propDefinitions: { + ...common.propDefinitions, + }, methods: { - // this.$auth contains connected account data - authKeys() { - console.log(Object.keys(this.$auth)); + ...common.methods, + _headers() { + return { + "Content-Type": "application/json", + "Authorization": `Bearer ${this.$auth.oauth_access_token}`, + "x-apify-integration-platform": "pipedream", + }; }, }, }; diff --git a/components/apify_oauth/common/utils.mjs b/components/apify_oauth/common/utils.mjs new file mode 100644 index 0000000000000..d42df055ddeb0 --- /dev/null +++ b/components/apify_oauth/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/apify_oauth/package.json b/components/apify_oauth/package.json index a42361d609c13..6184248d3fc36 100644 --- a/components/apify_oauth/package.json +++ b/components/apify_oauth/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/apify_oauth", - "version": "0.0.1", + "version": "0.1.0", "description": "Pipedream Apify (OAuth) Components", "main": "apify_oauth.app.mjs", "keywords": [ @@ -11,5 +11,8 @@ "author": "Pipedream (https://pipedream.com/)", "publishConfig": { "access": "public" + }, + "dependencies": { + "@pipedream/apify": "^0.3.0" } -} \ No newline at end of file +} diff --git a/components/apify_oauth/sources/new-finished-actor-run-instant/new-finished-actor-run-instant.mjs b/components/apify_oauth/sources/new-finished-actor-run-instant/new-finished-actor-run-instant.mjs new file mode 100644 index 0000000000000..48a61114c1ea6 --- /dev/null +++ b/components/apify_oauth/sources/new-finished-actor-run-instant/new-finished-actor-run-instant.mjs @@ -0,0 +1,22 @@ +import app from "../../apify_oauth.app.mjs"; +import common from "@pipedream/apify/sources/new-finished-actor-run-instant/new-finished-actor-run-instant.mjs"; + +import { adjustPropDefinitions } from "../../common/utils.mjs"; + +const { + name, description, type, ...others +} = common; +const props = adjustPropDefinitions(others.props, app); + +export default { + ...others, + key: "apify_oauth-new-finished-actor-run-instant", + version: "0.0.1", + name, + description, + type, + props: { + apify: app, + ...props, + }, +}; diff --git a/components/apify_oauth/sources/new-finished-task-run-instant/new-finished-task-run-instant.mjs b/components/apify_oauth/sources/new-finished-task-run-instant/new-finished-task-run-instant.mjs new file mode 100644 index 0000000000000..e4e604bc3c294 --- /dev/null +++ b/components/apify_oauth/sources/new-finished-task-run-instant/new-finished-task-run-instant.mjs @@ -0,0 +1,22 @@ +import app from "../../apify_oauth.app.mjs"; +import common from "@pipedream/apify/sources/new-finished-task-run-instant/new-finished-task-run-instant.mjs"; + +import { adjustPropDefinitions } from "../../common/utils.mjs"; + +const { + name, description, type, ...others +} = common; +const props = adjustPropDefinitions(others.props, app); + +export default { + ...others, + key: "apify_oauth-new-finished-task-run-instant", + version: "0.0.1", + name, + description, + type, + props: { + apify: app, + ...props, + }, +}; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 89318847ae0a6..679b2a2ceb681 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -439,8 +439,7 @@ importers: specifier: ^3.0.0 version: 3.0.3 - components/afosto: - specifiers: {} + components/afosto: {} components/aftership: dependencies: @@ -969,7 +968,11 @@ importers: specifier: ^4.1.2 version: 4.1.2 - components/apify_oauth: {} + components/apify_oauth: + dependencies: + '@pipedream/apify': + specifier: ^0.3.0 + version: 0.3.0 components/apilio: {} @@ -20170,6 +20173,9 @@ packages: resolution: {integrity: sha512-dfUnCxiN9H4ap84DvD2ubjw+3vUNpstxa0TneY/Paat8a3R4uQZDLSvWjmznAY/DoahqTHl9V46HF/Zs3F29pg==} engines: {node: '>= 10.0.0'} + '@pipedream/apify@0.3.0': + resolution: {integrity: sha512-FDzYOGiD97brfl6IsfuIZyPzbVYiSoqMHi0/syQdNtYfxQZz7rwtc7OL2D+HJO6gH6gWAoHZlRHW0N9hd+8cow==} + '@pipedream/aws@1.1.0': resolution: {integrity: sha512-1v/AcyW72RgAd6ZSQ6odj6VN9dy0w1JQZPc97s2+JuIEkfgxrH/o/djkdyMAPSwGx+8uU9EMKIXMQdNDyLdlSA==} @@ -38162,6 +38168,14 @@ snapshots: '@parcel/watcher-win32-ia32': 2.5.1 '@parcel/watcher-win32-x64': 2.5.1 + '@pipedream/apify@0.3.0': + dependencies: + '@apify/consts': 2.43.0 + '@pipedream/platform': 3.1.0 + got-scraping: 4.1.2 + transitivePeerDependencies: + - debug + '@pipedream/aws@1.1.0(aws-crt@1.25.0)(babel-plugin-macros@3.1.0)': dependencies: '@aws-sdk/client-cloudwatch-logs': 3.698.0(aws-crt@1.25.0)