diff --git a/components/apollo_io/actions/add-contacts-to-sequence/add-contacts-to-sequence.mjs b/components/apollo_io/actions/add-contacts-to-sequence/add-contacts-to-sequence.mjs index 7f5613c6ef3e4..b4dd5fa4f6a41 100644 --- a/components/apollo_io/actions/add-contacts-to-sequence/add-contacts-to-sequence.mjs +++ b/components/apollo_io/actions/add-contacts-to-sequence/add-contacts-to-sequence.mjs @@ -5,7 +5,7 @@ export default { name: "Add Contacts to Sequence", description: "Adds one or more contacts to a sequence in Apollo.io. [See the documentation](https://apolloio.github.io/apollo-api-docs/?shell#add-contacts-to-sequence)", type: "action", - version: "0.0.4", + version: "0.0.5", props: { app, sequenceId: { diff --git a/components/apollo_io/actions/create-account/create-account.mjs b/components/apollo_io/actions/create-account/create-account.mjs index 0c9eba9bfa2ae..64b374e1d9b9a 100644 --- a/components/apollo_io/actions/create-account/create-account.mjs +++ b/components/apollo_io/actions/create-account/create-account.mjs @@ -5,7 +5,7 @@ export default { name: "Create Account", description: "Creates a new account in Apollo.io. [See the documentation](https://apolloio.github.io/apollo-api-docs/?shell#create-an-account)", type: "action", - version: "0.0.4", + version: "0.0.5", props: { app, name: { diff --git a/components/apollo_io/actions/create-contact/create-contact.mjs b/components/apollo_io/actions/create-contact/create-contact.mjs index 356410c48bc7b..1d734d46d8a04 100644 --- a/components/apollo_io/actions/create-contact/create-contact.mjs +++ b/components/apollo_io/actions/create-contact/create-contact.mjs @@ -5,7 +5,7 @@ export default { name: "Create Contact", description: "Creates a new contact in Apollo.io. [See the documentation](https://apolloio.github.io/apollo-api-docs/?shell#create-a-contact)", type: "action", - version: "0.0.5", + version: "0.0.6", props: { app, email: { diff --git a/components/apollo_io/actions/create-opportunity/create-opportunity.mjs b/components/apollo_io/actions/create-opportunity/create-opportunity.mjs index 5ff109e987959..f6d9e29aa923e 100644 --- a/components/apollo_io/actions/create-opportunity/create-opportunity.mjs +++ b/components/apollo_io/actions/create-opportunity/create-opportunity.mjs @@ -5,7 +5,7 @@ export default { name: "Create Opportunity", description: "Creates a new opportunity in Apollo.io. [See the documentation](https://apolloio.github.io/apollo-api-docs/?shell#create-opportunity)", type: "action", - version: "0.0.3", + version: "0.0.4", props: { app, ownerId: { diff --git a/components/apollo_io/actions/create-update-contact/create-update-contact.mjs b/components/apollo_io/actions/create-update-contact/create-update-contact.mjs index a5d9bf85d5c4c..9d0f10756408e 100644 --- a/components/apollo_io/actions/create-update-contact/create-update-contact.mjs +++ b/components/apollo_io/actions/create-update-contact/create-update-contact.mjs @@ -6,7 +6,7 @@ export default { name: "Create Or Update Contact", description: "Creates or updates a specific contact. If the contact email already exists, it's updated. Otherwise, a new contact is created. [See the documentation](https://apolloio.github.io/apollo-api-docs/?shell#create-a-contact)", type: "action", - version: "0.0.2", + version: "0.0.3", props: { app, email: { @@ -88,7 +88,7 @@ export default { direct_phone: this.phone, }); - const { contacts } = await this.app.listContacts({ + const { contacts } = await this.app.searchContacts({ params: { q_keywords: this.email, }, diff --git a/components/apollo_io/actions/get-opportunity/get-opportunity.mjs b/components/apollo_io/actions/get-opportunity/get-opportunity.mjs index b6d3bf775c730..228312fbb5306 100644 --- a/components/apollo_io/actions/get-opportunity/get-opportunity.mjs +++ b/components/apollo_io/actions/get-opportunity/get-opportunity.mjs @@ -5,7 +5,7 @@ export default { name: "Get Opportunity", description: "Gets a specific opportunity in Apollo.io. [See the documentation](https://apolloio.github.io/apollo-api-docs/?shell#view-opportunity)", type: "action", - version: "0.0.3", + version: "0.0.4", props: { app, opportunityId: { diff --git a/components/apollo_io/actions/people-enrichment/people-enrichment.mjs b/components/apollo_io/actions/people-enrichment/people-enrichment.mjs index ea84e180d8c18..545ea52955717 100644 --- a/components/apollo_io/actions/people-enrichment/people-enrichment.mjs +++ b/components/apollo_io/actions/people-enrichment/people-enrichment.mjs @@ -5,7 +5,7 @@ export default { name: "People Enrichment", description: "Enriches a person's information, the more information you pass in, the more likely we can find a match. [See the documentation](https://apolloio.github.io/apollo-api-docs/?shell#people-enrichment)", type: "action", - version: "0.0.6", + version: "0.0.7", props: { app, firstName: { diff --git a/components/apollo_io/actions/search-accounts/search-accounts.mjs b/components/apollo_io/actions/search-accounts/search-accounts.mjs index e72b5d0d40a91..4d8b6406de98a 100644 --- a/components/apollo_io/actions/search-accounts/search-accounts.mjs +++ b/components/apollo_io/actions/search-accounts/search-accounts.mjs @@ -6,7 +6,7 @@ export default { name: "Search For Accounts", description: "Search for accounts in Apollo.io. [See the documentation](https://apolloio.github.io/apollo-api-docs/?shell#search-for-accounts)", type: "action", - version: "0.0.3", + version: "0.0.4", props: { app, search: { diff --git a/components/apollo_io/actions/search-contacts/search-contacts.mjs b/components/apollo_io/actions/search-contacts/search-contacts.mjs index cbdd2b66ee148..8fe234ba8fd8a 100644 --- a/components/apollo_io/actions/search-contacts/search-contacts.mjs +++ b/components/apollo_io/actions/search-contacts/search-contacts.mjs @@ -6,7 +6,7 @@ export default { name: "Search For Contacts", description: "Search for contacts in Apollo.io. [See the documentation](https://apolloio.github.io/apollo-api-docs/?shell#search-for-contacts)", type: "action", - version: "0.0.3", + version: "0.0.4", props: { app, search: { diff --git a/components/apollo_io/actions/search-sequences/search-sequences.mjs b/components/apollo_io/actions/search-sequences/search-sequences.mjs index a7b48517efc55..647052f72f1d1 100644 --- a/components/apollo_io/actions/search-sequences/search-sequences.mjs +++ b/components/apollo_io/actions/search-sequences/search-sequences.mjs @@ -6,7 +6,7 @@ export default { name: "Search For Sequences", description: "Search for sequences in Apollo.io. [See the documentation](https://apolloio.github.io/apollo-api-docs/?shell#search-for-sequences)", type: "action", - version: "0.0.3", + version: "0.0.4", props: { app, search: { diff --git a/components/apollo_io/actions/update-account-stage/update-account-stage.mjs b/components/apollo_io/actions/update-account-stage/update-account-stage.mjs index 09cdc892e373f..385abc493e48c 100644 --- a/components/apollo_io/actions/update-account-stage/update-account-stage.mjs +++ b/components/apollo_io/actions/update-account-stage/update-account-stage.mjs @@ -5,7 +5,7 @@ export default { name: "Update Account Stage", description: "Updates the stage of one or more accounts in Apollo.io. [See the documentation](https://apolloio.github.io/apollo-api-docs/?shell#update-account-stage)", type: "action", - version: "0.0.4", + version: "0.0.5", props: { app, accountIds: { diff --git a/components/apollo_io/actions/update-account/update-account.mjs b/components/apollo_io/actions/update-account/update-account.mjs index ab1aedb714780..9e9a3d79d63f9 100644 --- a/components/apollo_io/actions/update-account/update-account.mjs +++ b/components/apollo_io/actions/update-account/update-account.mjs @@ -6,7 +6,7 @@ export default { name: "Update Account", description: "Updates an existing account in Apollo.io. [See the documentation](https://apolloio.github.io/apollo-api-docs/?shell#update-an-account)", type: "action", - version: "0.0.4", + version: "0.0.5", props: { app, accountId: { diff --git a/components/apollo_io/actions/update-contact-stage/update-contact-stage.mjs b/components/apollo_io/actions/update-contact-stage/update-contact-stage.mjs index 6a44bcd1af1cc..1909f6a75761e 100644 --- a/components/apollo_io/actions/update-contact-stage/update-contact-stage.mjs +++ b/components/apollo_io/actions/update-contact-stage/update-contact-stage.mjs @@ -5,7 +5,7 @@ export default { name: "Update Contact Stage", description: "Updates the stage of one or more contacts in Apollo.io. [See the documentation](https://apolloio.github.io/apollo-api-docs/?shell#update-contact-stage)", type: "action", - version: "0.0.4", + version: "0.0.5", props: { app, contactIds: { diff --git a/components/apollo_io/actions/update-contact/update-contact.mjs b/components/apollo_io/actions/update-contact/update-contact.mjs index 11afb44ea690c..0bf6e7b7ecb02 100644 --- a/components/apollo_io/actions/update-contact/update-contact.mjs +++ b/components/apollo_io/actions/update-contact/update-contact.mjs @@ -6,7 +6,7 @@ export default { name: "Update Contact", description: "Updates an existing contact in Apollo.io. [See the documentation](https://apolloio.github.io/apollo-api-docs/?shell#update-a-contact)", type: "action", - version: "0.0.5", + version: "0.0.6", props: { app, contactId: { diff --git a/components/apollo_io/actions/update-opportunity/update-opportunity.mjs b/components/apollo_io/actions/update-opportunity/update-opportunity.mjs index aa3d293866fba..3b4bc2115989f 100644 --- a/components/apollo_io/actions/update-opportunity/update-opportunity.mjs +++ b/components/apollo_io/actions/update-opportunity/update-opportunity.mjs @@ -5,7 +5,7 @@ export default { name: "Update Opportunity", description: "Updates a new opportunity in Apollo.io. [See the documentation](https://apolloio.github.io/apollo-api-docs/?shell#update-opportunity)", type: "action", - version: "0.0.3", + version: "0.0.4", props: { app, opportunityId: { diff --git a/components/apollo_io/apollo_io.app.mjs b/components/apollo_io/apollo_io.app.mjs index 11c28ed6f88d1..ec999f8e53846 100644 --- a/components/apollo_io/apollo_io.app.mjs +++ b/components/apollo_io/apollo_io.app.mjs @@ -1,5 +1,6 @@ import { axios } from "@pipedream/platform"; import constants from "./common/constants.mjs"; +import utils from "./common/utils.mjs"; export default { type: "app", @@ -10,7 +11,7 @@ export default { label: "Account ID", description: "Identifier of the account for this contact", async options({ page }) { - const { accounts } = await this.listAccounts({ + const { accounts } = await this.searchAccounts({ params: { page: page + 1, }, @@ -28,7 +29,7 @@ export default { label: "Contact ID", description: "Identifier of the contact to update", async options({ page }) { - const { contacts } = await this.listContacts({ + const { contacts } = await this.searchContacts({ params: { page: page + 1, }, @@ -243,15 +244,15 @@ export default { ...args, }); }, - listAccounts(args = {}) { + put(args = {}) { return this.makeRequest({ - path: "/accounts/search", + method: "put", ...args, }); }, - listContacts(args = {}) { + patch(args = {}) { return this.makeRequest({ - path: "/contacts/search", + method: "patch", ...args, }); }, @@ -268,7 +269,7 @@ export default { }); }, listSequences(args = {}) { - return this.makeRequest({ + return this.post({ path: "/emailer_campaigns/search", ...args, }); @@ -298,8 +299,7 @@ export default { }); }, createContact(args = {}) { - return this.makeRequest({ - method: "POST", + return this.post({ path: "/contacts", ...args, }); @@ -307,29 +307,25 @@ export default { updateContact({ contactId, ...args }) { - return this.makeRequest({ - method: "PUT", + return this.put({ path: `/contacts/${contactId}`, ...args, }); }, updateContactStage(args = {}) { - return this.makeRequest({ - method: "POST", + return this.post({ path: "/contacts/update_stages", ...args, }); }, createAccount(args = {}) { - return this.makeRequest({ - method: "POST", + return this.post({ path: "/accounts", ...args, }); }, createOpportunity(args = {}) { - return this.makeRequest({ - method: "POST", + return this.post({ path: "/opportunities", ...args, }); @@ -337,8 +333,7 @@ export default { updateOpportunity({ opportunityId, ...args }) { - return this.makeRequest({ - method: "PATCH", + return this.patch({ path: `/opportunities/${opportunityId}`, ...args, }); @@ -354,15 +349,13 @@ export default { updateAccount({ accountId, ...args }) { - return this.makeRequest({ - method: "PUT", + return this.put({ path: `/accounts/${accountId}`, ...args, }); }, updateAccountStage(args = {}) { - return this.makeRequest({ - method: "POST", + return this.post({ path: "/accounts/bulk_update", ...args, }); @@ -370,20 +363,19 @@ export default { addContactsToSequence({ sequenceId, ...args }) { - return this.makeRequest({ - method: "POST", + return this.post({ path: `/emailer_campaigns/${sequenceId}/add_contact_ids`, ...args, }); }, searchAccounts(args = {}) { - return this.makeRequest({ + return this.post({ path: "/accounts/search", ...args, }); }, searchContacts(args = {}) { - return this.makeRequest({ + return this.post({ path: "/contacts/search", ...args, }); @@ -394,7 +386,7 @@ export default { ...args, }); }, - async *getResourcesStream({ + async *getIterations({ resourceFn, resourceFnArgs, resourceName, @@ -409,6 +401,7 @@ export default { ...resourceFnArgs, params: { ...resourceFnArgs.params, + per_page: constants.DEFAULT_LIMIT, page, }, }); @@ -429,8 +422,16 @@ export default { } } + if (nextResources.length < constants.DEFAULT_LIMIT) { + console.log("No next page"); + return; + } + page += 1; } }, + paginate(args = {}) { + return utils.iterate(this.getIterations(args)); + }, }, }; diff --git a/components/apollo_io/common/constants.mjs b/components/apollo_io/common/constants.mjs index e3628e249ba27..755dd134476a4 100644 --- a/components/apollo_io/common/constants.mjs +++ b/components/apollo_io/common/constants.mjs @@ -1,9 +1,11 @@ const BASE_URL = "https://api.apollo.io"; -const VERSION_PATH = "/v1"; +const VERSION_PATH = "/api/v1"; +const DEFAULT_LIMIT = 100; const DEFAULT_MAX = 600; export default { BASE_URL, VERSION_PATH, + DEFAULT_LIMIT, DEFAULT_MAX, }; diff --git a/components/apollo_io/common/utils.mjs b/components/apollo_io/common/utils.mjs index b76fe38a140f0..7c0dbef7b38bd 100644 --- a/components/apollo_io/common/utils.mjs +++ b/components/apollo_io/common/utils.mjs @@ -1,9 +1,9 @@ -async function streamIterator(stream) { - const resources = []; - for await (const resource of stream) { - resources.push(resource); +async function iterate(iterations) { + const items = []; + for await (const item of iterations) { + items.push(item); } - return resources; + return items; } function cleanObject(o) { @@ -16,6 +16,6 @@ function cleanObject(o) { } export default { - streamIterator, + iterate, cleanObject, }; diff --git a/components/apollo_io/package.json b/components/apollo_io/package.json index d4791dce31af3..f55cd929c74b3 100644 --- a/components/apollo_io/package.json +++ b/components/apollo_io/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/apollo_io", - "version": "0.5.0", + "version": "0.5.1", "description": "Pipedream Apollo.io Components", "main": "apollo_io.app.mjs", "keywords": [ diff --git a/components/apollo_io/sources/account-created/account-created.mjs b/components/apollo_io/sources/account-created/account-created.mjs index 03dd3f2d348e4..c97eefd4a2357 100644 --- a/components/apollo_io/sources/account-created/account-created.mjs +++ b/components/apollo_io/sources/account-created/account-created.mjs @@ -3,10 +3,10 @@ import common from "../common/polling.mjs"; export default { ...common, key: "apollo_io-account-created", - name: "Account Created", - description: "Triggers when an account is created. [See the documentation](https://apolloio.github.io/apollo-api-docs/?shell#search-for-accounts)", + name: "New Account Created", + description: "Emit new event when an account is created. [See the documentation](https://apolloio.github.io/apollo-api-docs/?shell#search-for-accounts)", type: "source", - version: "0.0.4", + version: "0.0.5", dedupe: "unique", props: { ...common.props, @@ -27,10 +27,11 @@ export default { return "accounts"; }, getResourceFn() { - return this.app.listAccounts; + return this.app.searchAccounts; }, getResourceFnArgs() { return { + debug: true, params: { account_stage_ids: this.accountStageIds, sort_by_field: "account_created_at", diff --git a/components/apollo_io/sources/account-updated/account-updated.mjs b/components/apollo_io/sources/account-updated/account-updated.mjs index 94b6dc2358260..70e64a508e6e9 100644 --- a/components/apollo_io/sources/account-updated/account-updated.mjs +++ b/components/apollo_io/sources/account-updated/account-updated.mjs @@ -5,9 +5,9 @@ export default { ...common, key: "apollo_io-account-updated", name: "Account Updated", - description: "Triggers when an account is updated. [See the documentation](https://apolloio.github.io/apollo-api-docs/?shell#search-for-contacts)", + description: "Emit new event when an account is updated. [See the documentation](https://apolloio.github.io/apollo-api-docs/?shell#search-for-contacts)", type: "source", - version: "0.0.4", + version: "0.0.5", dedupe: "unique", props: { ...common.props, @@ -34,10 +34,11 @@ export default { return "accounts"; }, getResourceFn() { - return this.app.listAccounts; + return this.app.searchAccounts; }, getResourceFnArgs() { return { + debug: true, params: { account_stage_ids: this.accountStageIds, sort_by_field: "account_last_activity_date", diff --git a/components/apollo_io/sources/common/polling.mjs b/components/apollo_io/sources/common/polling.mjs index c2ac9a3d59bfb..aa15de750755a 100644 --- a/components/apollo_io/sources/common/polling.mjs +++ b/components/apollo_io/sources/common/polling.mjs @@ -3,7 +3,6 @@ import { DEFAULT_POLLING_SOURCE_TIMER_INTERVAL, } from "@pipedream/platform"; import common from "./base.mjs"; -import utils from "../../common/utils.mjs"; export default { ...common, @@ -36,19 +35,21 @@ export default { filterResources(resources) { return resources; }, - async processStreamEvents(resourcesStream) { - const resources = await utils.streamIterator(resourcesStream); + async processStreamEvents(resources) { const relevantResources = this.filterResources(resources); relevantResources.reverse().forEach(this.processEvent); + console.log(`Fetched ${resources.length} total resources`); + console.log(`Emitting ${relevantResources.length} resources`); + console.log(`Filtered out ${resources.length - relevantResources.length} unchanged`); }, }, async run() { - const resourcesStream = this.app.getResourcesStream({ + const resources = await this.app.paginate({ resourceFn: this.getResourceFn(), resourceFnArgs: this.getResourceFnArgs(), resourceName: this.getResourceName(), }); - await this.processStreamEvents(resourcesStream); + await this.processStreamEvents(resources); }, }; diff --git a/components/apollo_io/sources/contact-created/contact-created.mjs b/components/apollo_io/sources/contact-created/contact-created.mjs index 98a37fe7c2321..6c9146075d7f1 100644 --- a/components/apollo_io/sources/contact-created/contact-created.mjs +++ b/components/apollo_io/sources/contact-created/contact-created.mjs @@ -3,10 +3,10 @@ import common from "../common/polling.mjs"; export default { ...common, key: "apollo_io-contact-created", - name: "Contact Created", - description: "Triggers when a contact is created. [See the documentation](https://apolloio.github.io/apollo-api-docs/?shell#search-for-contacts)", + name: "New Contact Created", + description: "Emit new event when a contact is created. [See the documentation](https://apolloio.github.io/apollo-api-docs/?shell#search-for-contacts)", type: "source", - version: "0.0.6", + version: "0.0.7", dedupe: "unique", methods: { ...common.methods, @@ -18,6 +18,7 @@ export default { }, getResourceFnArgs() { return { + debug: true, params: { sort_by_field: "contact_created_at", sort_ascending: false, diff --git a/components/apollo_io/sources/contact-updated/contact-updated.mjs b/components/apollo_io/sources/contact-updated/contact-updated.mjs index a41c2a6a29ed6..056695fa17870 100644 --- a/components/apollo_io/sources/contact-updated/contact-updated.mjs +++ b/components/apollo_io/sources/contact-updated/contact-updated.mjs @@ -4,9 +4,9 @@ export default { ...common, key: "apollo_io-contact-updated", name: "Contact Updated", - description: "Triggers when a contact is updated. [See the documentation](https://apolloio.github.io/apollo-api-docs/?shell#search-for-contacts)", + description: "Emit new event when a contact is updated. [See the documentation](https://apolloio.github.io/apollo-api-docs/?shell#search-for-contacts)", type: "source", - version: "0.0.6", + version: "0.0.7", dedupe: "unique", methods: { ...common.methods, @@ -18,6 +18,7 @@ export default { }, getResourceFnArgs() { return { + debug: true, params: { sort_by_field: "contact_updated_at", sort_ascending: false, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 439ac3947ef9a..e39376605af3e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -847,8 +847,7 @@ importers: components/api_bible: {} - components/api_labz: - specifiers: {} + components/api_labz: {} components/api_ninjas: {} @@ -4661,9 +4660,6 @@ importers: specifier: ^3.0.3 version: 3.0.3 - components/formatting: - specifiers: {} - components/formbricks: dependencies: '@pipedream/platform': @@ -8043,8 +8039,7 @@ importers: specifier: ^3.0.0 version: 3.0.3 - components/miyn: - specifiers: {} + components/miyn: {} components/moaform: dependencies: @@ -9328,8 +9323,7 @@ importers: components/perry_github_test: {} - components/persanaai: - specifiers: {} + components/persanaai: {} components/persistiq: dependencies: @@ -34342,8 +34336,6 @@ snapshots: '@putout/operator-filesystem': 5.0.0(putout@36.13.1(eslint@8.57.1)(typescript@5.6.3)) '@putout/operator-json': 2.2.0 putout: 36.13.1(eslint@8.57.1)(typescript@5.6.3) - transitivePeerDependencies: - - supports-color '@putout/operator-regexp@1.0.0(putout@36.13.1(eslint@8.57.1)(typescript@5.6.3))': dependencies: