diff --git a/components/pipedrive/actions/add-activity/add-activity.mjs b/components/pipedrive/actions/add-activity/add-activity.mjs index a016d80ac6899..d611e311fce78 100644 --- a/components/pipedrive/actions/add-activity/add-activity.mjs +++ b/components/pipedrive/actions/add-activity/add-activity.mjs @@ -1,12 +1,13 @@ +import { ConfigurationError } from "@pipedream/platform"; import constants from "../../common/constants.mjs"; -import utils from "../../common/utils.mjs"; +import { parseObject } from "../../common/utils.mjs"; import pipedriveApp from "../../pipedrive.app.mjs"; export default { key: "pipedrive-add-activity", name: "Add Activity", description: "Adds a new activity. Includes `more_activities_scheduled_in_context` property in response's `additional_data` which indicates whether there are more undone activities scheduled with the same deal, person or organization (depending on the supplied data). See the Pipedrive API docs for Activities [here](https://developers.pipedrive.com/docs/api/v1/#!/Activities). For info on [adding an activity in Pipedrive](https://developers.pipedrive.com/docs/api/v1/Activities#addActivity)", - version: "0.1.6", + version: "0.1.7", type: "action", props: { pipedriveApp, @@ -15,22 +16,6 @@ export default { label: "Subject", description: "Subject of the activity", }, - done: { - type: "string", - label: "Done", - description: "Whether the activity is done or not. 0 = Not done, 1 = Done", - optional: true, - options: [ - { - label: "Not done", - value: "0", - }, - { - label: "Done", - value: "1", - }, - ], - }, type: { type: "string", label: "Type", @@ -45,25 +30,7 @@ export default { })); }, }, - dueDate: { - type: "string", - label: "Due Date", - description: "Due date of the activity. Format: `YYYY-MM-DD`", - optional: true, - }, - dueTime: { - type: "string", - label: "Due Time", - description: "Due time of the activity in UTC. Format: `HH:MM`", - optional: true, - }, - duration: { - type: "string", - label: "Duration", - description: "Duration of the activity. Format: `HH:MM`", - optional: true, - }, - userId: { + ownerId: { propDefinition: [ pipedriveApp, "userId", @@ -76,148 +43,159 @@ export default { "dealId", ], }, - personId: { + leadId: { propDefinition: [ pipedriveApp, - "personId", + "leadId", ], - description: "ID of the person this activity will be associated with", }, - participants: { - type: "string[]", - label: "Participants", - description: "List of multiple persons (participants) this activity will be associated with. If omitted, single participant from `person_id` field is used. It requires a structure as follows: `[{\"person_id\":1,\"primary_flag\":true}]`", - optional: true, + orgId: { propDefinition: [ pipedriveApp, - "personId", + "organizationId", ], + description: "ID of the organization this activity will be associated with", }, - organizationId: { + projectId: { propDefinition: [ pipedriveApp, - "organizationId", + "projectId", ], - description: "ID of the organization this activity will be associated with", + description: "ID of the project this activity will be associated with", }, - note: { + dueDate: { type: "string", - label: "Note", - description: "Note of the activity (HTML format)", + label: "Due Date", + description: "Due date of the activity. Format: `YYYY-MM-DD`", optional: true, }, - location: { + dueTime: { type: "string", - label: "Location", - description: "The address of the activity. Pipedrive will automatically check if the location matches a geo-location on Google maps.", + label: "Due Time", + description: "Due time of the activity in UTC. Format: `HH:MM`", optional: true, }, - publicDescription: { + duration: { type: "string", - label: "Public Description", - description: "Additional details about the activity that will be synced to your external calendar. Unlike the note added to the activity, the description will be publicly visible to any guests added to the activity.", + label: "Duration", + description: "Duration of the activity. Format: `HH:MM`", optional: true, }, - busyFlag: { + busy: { type: "boolean", - label: "Busy Flag", + label: "Busy", description: "Set the activity as 'Busy' or 'Free'. If the flag is set to true, your customers will not be able to book that time slot through any Scheduler links", optional: true, }, + done: { + type: "boolean", + label: "Done", + description: "Whether the activity is done or not.", + optional: true, + }, + location: { + type: "object", + label: "Location", + description: "The address of the activity. Pipedrive will automatically check if the location matches a geo-location on Google maps.", + optional: true, + }, + participants: { + type: "string[]", + label: "Participants", + description: "List of multiple persons (participants) this activity will be associated with. If omitted, single participant from `person_id` field is used. It requires a structure as follows: `[{\"person_id\":1,\"primary\":true}]`", + optional: true, + propDefinition: [ + pipedriveApp, + "personId", + ], + }, attendees: { type: "string[]", label: "Attendees", - description: "Attendees of the activity. This can be either your existing Pipedrive contacts or an external email address. It requires a structure as follows: `[{\"email_address\":\"mail@example.org\"}]` or `[{\"person_id\":1, \"email_address\":\"mail@example.org\"}]`", + description: "Attendees of the activity. This can be either your existing Pipedrive contacts or an external email address. It requires a structure as follows: `[{\"email\":\"mail@example.org\"}]`", optional: true, async options({ prevContext }) { - const { - moreItemsInCollection, - start, - } = prevContext; - - if (moreItemsInCollection === false) { + if (prevContext?.cursor === false) { return []; } - const { data: persons, additional_data: additionalData, } = await this.pipedriveApp.getPersons({ - start, + cursor: prevContext.cursor, limit: constants.DEFAULT_PAGE_LIMIT, }); - const options = - persons?.flatMap(({ - name, email, - }) => email?.map(({ value }) => ({ + return { + options: persons?.flatMap(({ + name, emails, + }) => emails?.map(({ value }) => ({ label: name, value, - })).filter((option) => option?.value)); - - return { - options, + })).filter((option) => option?.value)), context: { - moreItemsInCollection: additionalData.pagination.more_items_in_collection, - start: additionalData.pagination.next_start, + cursor: additionalData.next_cursor, }, }; }, }, + publicDescription: { + type: "string", + label: "Public Description", + description: "Additional details about the activity that will be synced to your external calendar. Unlike the note added to the activity, the description will be publicly visible to any guests added to the activity.", + optional: true, + }, + note: { + type: "string", + label: "Note", + description: "Note of the activity (HTML format)", + optional: true, + }, }, async run({ $ }) { const { - subject, - type, + pipedriveApp, dueDate, dueTime, - duration, - userId, + ownerId, dealId, - personId, - organizationId, - note, + leadId, + orgId, + projectId, location, + participants, + attendees, publicDescription, - busyFlag, + ...data } = this; - const participants = utils.parseOrUndefined(this.participants); - const attendees = utils.parseOrUndefined(this.attendees); - const done = utils.parseOrUndefined(this.done); - try { const resp = - await this.pipedriveApp.addActivity({ - subject, - done, - type, + await pipedriveApp.addActivity({ due_date: dueDate, due_time: dueTime, - duration, - user_id: userId, + owner_id: ownerId, deal_id: dealId, - person_id: personId, - participants: participants?.map((value, idx) => ({ + lead_id: leadId, + participants: parseObject(participants)?.map((value, idx) => ({ person_id: value, - primary_flag: !idx, + primary: !idx, })), - org_id: organizationId, - note, - location, + org_id: orgId, + project_id: projectId, + location: parseObject(location), public_description: publicDescription, - busy_flag: busyFlag, - attendees: attendees?.map((value) => ({ - email_address: value, + attendees: parseObject(attendees)?.map((value) => ({ + email: value, })), + ...data, }); $.export("$summary", "Successfully added activity"); return resp; - } catch (error) { - console.error(error.context?.body || error); - throw error.context?.body?.error || "Failed to add activity"; + } catch ({ error }) { + throw new ConfigurationError(error); } }, }; diff --git a/components/pipedrive/actions/add-deal/add-deal.mjs b/components/pipedrive/actions/add-deal/add-deal.mjs index 427a4f78e1854..aa309c5c8a6e0 100644 --- a/components/pipedrive/actions/add-deal/add-deal.mjs +++ b/components/pipedrive/actions/add-deal/add-deal.mjs @@ -1,10 +1,11 @@ +import { ConfigurationError } from "@pipedream/platform"; import pipedriveApp from "../../pipedrive.app.mjs"; export default { key: "pipedrive-add-deal", name: "Add Deal", description: "Adds a new deal. See the Pipedrive API docs for Deals [here](https://developers.pipedrive.com/docs/api/v1/Deals#addDeal)", - version: "0.1.6", + version: "0.1.7", type: "action", props: { pipedriveApp, @@ -14,40 +15,47 @@ export default { "dealTitle", ], }, - value: { + ownerId: { propDefinition: [ pipedriveApp, - "dealValue", + "userId", ], }, - currency: { + personId: { propDefinition: [ pipedriveApp, - "dealCurrency", + "personId", ], }, - userId: { + orgId: { propDefinition: [ pipedriveApp, - "userId", + "organizationId", ], }, - personId: { + pipelineId: { propDefinition: [ pipedriveApp, - "personId", + "pipelineId", ], + optional: true, }, - organizationId: { + stageId: { propDefinition: [ pipedriveApp, - "organizationId", + "stageId", ], }, - stageId: { + value: { propDefinition: [ pipedriveApp, - "stageId", + "dealValue", + ], + }, + currency: { + propDefinition: [ + pipedriveApp, + "dealCurrency", ], }, status: { @@ -74,52 +82,30 @@ export default { "visibleTo", ], }, - addTime: { - propDefinition: [ - pipedriveApp, - "addTime", - ], - }, }, async run({ $ }) { - const { - title, - value, - currency, - userId, - personId, - organizationId, - stageId, - status, - probability, - lostReason, - visibleTo, - addTime, - } = this; - try { const resp = await this.pipedriveApp.addDeal({ - title, - value, - currency, - user_id: userId, - person_id: personId, - org_id: organizationId, - stage_id: stageId, - status, - probability, - lost_reason: lostReason, - visible_to: visibleTo, - add_time: addTime, + title: this.title, + owner_id: this.ownerId, + person_id: this.personId, + org_id: this.orgId, + pipeline_id: this.pipelineId, + stage_id: this.stageId, + value: this.value, + currency: this.currency, + status: this.status, + probability: this.probability, + lost_reason: this.lostReason, + visible_to: this.visibleTo, }); $.export("$summary", "Successfully added deal"); return resp; - } catch (error) { - console.error(error.context?.body || error); - throw error.context?.body?.error || "Failed to add deal"; + } catch ({ error }) { + throw new ConfigurationError(error); } }, }; diff --git a/components/pipedrive/actions/add-note/add-note.mjs b/components/pipedrive/actions/add-note/add-note.mjs index 171fcdc699e64..1d75bbaccc846 100644 --- a/components/pipedrive/actions/add-note/add-note.mjs +++ b/components/pipedrive/actions/add-note/add-note.mjs @@ -1,18 +1,25 @@ +import { ConfigurationError } from "@pipedream/platform"; import pipedriveApp from "../../pipedrive.app.mjs"; export default { key: "pipedrive-add-note", name: "Add Note", description: "Adds a new note. For info on [adding an note in Pipedrive](https://developers.pipedrive.com/docs/api/v1/Notes#addNote)", - version: "0.0.4", + version: "0.0.5", type: "action", props: { pipedriveApp, content: { + type: "string", + label: "Content", + description: "The content of the note in HTML format. Subject to sanitization on the back-end.", + }, + leadId: { propDefinition: [ pipedriveApp, - "content", + "leadId", ], + description: "The ID of the lead the note will be attached to. This property is required unless one of (deal_id/person_id/org_id) is specified.", }, dealId: { propDefinition: [ @@ -49,62 +56,56 @@ export default { ], }, pinnedToDealFlag: { - propDefinition: [ - pipedriveApp, - "pinnedToDealFlag", - ], + type: "boolean", + label: "Pinned To Deal Flag", + description: "If set, the results are filtered by note to deal pinning state (deal_id is also required)", + default: false, + optional: true, + }, + pinnedToLeadFlag: { + type: "boolean", + label: "Pinned To Lead Flag", + description: "If set, the results are filtered by note to lead pinning state (lead_id is also required)", + default: false, optional: true, }, pinnedToOrgFlag: { - propDefinition: [ - pipedriveApp, - "pinnedToOrgFlag", - ], + type: "boolean", + label: "Pinned To Organization Flag", + description: "If set, the results are filtered by note to organization pinning state (org_id is also required)", + default: false, optional: true, }, pinnedToPersonFlag: { - propDefinition: [ - pipedriveApp, - "pinnedToPersonFlag", - ], + type: "boolean", + label: "Pinned To Person Flag", + description: "If set, the results are filtered by note to person pinning state (person_id is also required)", + default: false, optional: true, }, }, async run({ $ }) { - const { - content, - dealId, - personId, - organizationId, - userId, - addTime, - pinnedToLeadFlag, - pinnedToDealFlag, - pinnedToOrgFlag, - pinnedToPersonFlag, - } = this; - try { const resp = await this.pipedriveApp.addNote({ - content, - deal_id: dealId, - person_id: personId, - org_id: organizationId, - user_id: userId, - add_time: addTime, - pinned_to_lead_flag: pinnedToLeadFlag, - pinned_to_deal_flag: pinnedToDealFlag, - pinned_to_organization_flag: pinnedToOrgFlag, - pinned_to_person_flag: pinnedToPersonFlag, + content: this.content, + lead_id: this.leadId, + deal_id: this.dealId, + person_id: this.personId, + org_id: this.organizationId, + user_id: this.userId, + add_time: this.addTime, + pinned_to_lead_flag: this.pinnedToLeadFlag, + pinned_to_deal_flag: this.pinnedToDealFlag, + pinned_to_organization_flag: this.pinnedToOrgFlag, + pinned_to_person_flag: this.pinnedToPersonFlag, }); $.export("$summary", "Successfully added note"); return resp; - } catch (error) { - console.error(error.context?.body || error); - throw error; + } catch ({ error }) { + throw new ConfigurationError(error); } }, }; diff --git a/components/pipedrive/actions/add-organization/add-organization.mjs b/components/pipedrive/actions/add-organization/add-organization.mjs index 154a49ee29539..e2775daa867a5 100644 --- a/components/pipedrive/actions/add-organization/add-organization.mjs +++ b/components/pipedrive/actions/add-organization/add-organization.mjs @@ -1,10 +1,11 @@ +import { ConfigurationError } from "@pipedream/platform"; import pipedriveApp from "../../pipedrive.app.mjs"; export default { key: "pipedrive-add-organization", name: "Add Organization", description: "Adds a new organization. See the Pipedrive API docs for Organizations [here](https://developers.pipedrive.com/docs/api/v1/Organizations#addOrganization)", - version: "0.1.6", + version: "0.1.7", type: "action", props: { pipedriveApp, @@ -28,37 +29,20 @@ export default { ], description: "Visibility of the organization. If omitted, visibility will be set to the default visibility setting of this item type for the authorized user.", }, - addTime: { - propDefinition: [ - pipedriveApp, - "addTime", - ], - description: "Optional creation date & time of the organization in UTC. Requires admin user API token. Format: `YYYY-MM-DD HH:MM:SS`", - }, }, async run({ $ }) { - const { - name, - ownerId, - visibleTo, - addTime, - } = this; - try { - const resp = - await this.pipedriveApp.addOrganization({ - name, - owner_id: ownerId, - visible_to: visibleTo, - add_time: addTime, - }); + const resp = await this.pipedriveApp.addOrganization({ + name: this.name, + owner_id: this.ownerId, + visible_to: this.visibleTo, + }); $.export("$summary", "Successfully added organization"); return resp; - } catch (error) { - console.error(error.context?.body || error); - throw error.context?.body?.error || "Failed to add organization"; + } catch ({ error }) { + throw new ConfigurationError(error); } }, }; diff --git a/components/pipedrive/actions/add-person/add-person.mjs b/components/pipedrive/actions/add-person/add-person.mjs index 1fd1770cfff3b..e14be3b0aff84 100644 --- a/components/pipedrive/actions/add-person/add-person.mjs +++ b/components/pipedrive/actions/add-person/add-person.mjs @@ -1,10 +1,12 @@ +import { ConfigurationError } from "@pipedream/platform"; +import { parseObject } from "../../common/utils.mjs"; import pipedriveApp from "../../pipedrive.app.mjs"; export default { key: "pipedrive-add-person", name: "Add Person", description: "Adds a new person. See the Pipedrive API docs for People [here](https://developers.pipedrive.com/docs/api/v1/Persons#addPerson)", - version: "0.1.6", + version: "0.1.7", type: "action", props: { pipedriveApp, @@ -28,16 +30,16 @@ export default { ], description: "ID of the organization this person will belong to.", }, - email: { - type: "any", - label: "Email", - description: "Email addresses (one or more) associated with the person, presented in the same manner as received by GET request of a person.", + emails: { + type: "string[]", + label: "Emails", + description: "Email addresses (one or more) associated with the person, presented in the same manner as received by GET request of a person. **Example: {\"value\":\"email1@email.com\", \"primary\":true, \"label\":\"work\"}**", optional: true, }, - phone: { - type: "any", - label: "Phone", - description: "Phone numbers (one or more) associated with the person, presented in the same manner as received by GET request of a person.", + phones: { + type: "string[]", + label: "Phones", + description: "Phone numbers (one or more) associated with the person, presented in the same manner as received by GET request of a person. **Example: {\"value\":\"12345\", \"primary\":true, \"label\":\"work\"}**", optional: true, }, visibleTo: { @@ -47,44 +49,25 @@ export default { ], description: "Visibility of the person. If omitted, visibility will be set to the default visibility setting of this item type for the authorized user.", }, - addTime: { - propDefinition: [ - pipedriveApp, - "addTime", - ], - description: "Optional creation date & time of the person in UTC. Requires admin user API token. Format: `YYYY-MM-DD HH:MM:SS`", - }, }, async run({ $ }) { - const { - name, - ownerId, - organizationId, - email, - phone, - visibleTo, - addTime, - } = this; - try { const resp = await this.pipedriveApp.addPerson({ - name, - owner_id: ownerId, - org_id: organizationId, - email, - phone, - visible_to: visibleTo, - add_time: addTime, + name: this.name, + owner_id: this.ownerId, + org_id: this.organizationId, + emails: parseObject(this.emails), + phones: parseObject(this.phones), + visible_to: this.visibleTo, }); $.export("$summary", "Successfully added person"); return resp; - } catch (error) { - console.error(error.context?.body || error); - throw error.context?.body?.error || "Failed to add person"; + } catch ({ error }) { + throw new ConfigurationError(error); } }, }; diff --git a/components/pipedrive/actions/search-persons/search-persons.mjs b/components/pipedrive/actions/search-persons/search-persons.mjs index 2348af23ecf83..459c87f16ac45 100644 --- a/components/pipedrive/actions/search-persons/search-persons.mjs +++ b/components/pipedrive/actions/search-persons/search-persons.mjs @@ -1,11 +1,13 @@ +import { ConfigurationError } from "@pipedream/platform"; import constants from "../../common/constants.mjs"; +import { parseObject } from "../../common/utils.mjs"; import pipedriveApp from "../../pipedrive.app.mjs"; export default { key: "pipedrive-search-persons", name: "Search persons", description: "Searches all Persons by `name`, `email`, `phone`, `notes` and/or custom fields. This endpoint is a wrapper of `/v1/itemSearch` with a narrower OAuth scope. Found Persons can be filtered by Organization ID. See the Pipedrive API docs [here](https://developers.pipedrive.com/docs/api/v1/Persons#searchPersons)", - version: "0.1.6", + version: "0.1.7", type: "action", props: { pipedriveApp, @@ -15,9 +17,9 @@ export default { description: "The search term to look for. Minimum 2 characters (or 1 if using exact_match).", }, fields: { - type: "string", + type: "string[]", label: "Search fields", - description: "A comma-separated string array. The fields to perform the search from. Defaults to all of them.", + description: "An array containing fields to perform the search from. Defaults to all of them.", optional: true, options: constants.FIELD_OPTIONS, }, @@ -42,48 +44,37 @@ export default { options: constants.INCLUDE_FIELDS_OPTIONS, }, start: { - propDefinition: [ - pipedriveApp, - "start", - ], + type: "integer", + label: "Pagination start", + description: "Pagination start. Note that the pagination is based on main results and does not include related items when using `search_for_related_items` parameter.", + optional: true, }, limit: { - propDefinition: [ - pipedriveApp, - "limit", - ], + type: "integer", + label: "Limit", + description: "Items shown per page.", + optional: true, }, }, async run({ $ }) { - const { - term, - fields, - exactMatch, - organizationId, - includeFields, - start, - limit, - } = this; - try { const resp = await this.pipedriveApp.searchPersons({ - term, - fields, - exact_match: exactMatch, - org_id: organizationId, - include_fields: includeFields, - start, - limit, + term: this.term, + fields: parseObject(this.fields), + exact_match: this.exactMatch, + org_id: this.organizationId, + include_fields: this.includeFields, + start: this.start, + limit: this.limit, }); $.export("$summary", `Successfully found ${resp.data?.items.length || 0} persons`); return resp; - } catch (error) { - console.error(error.context?.body || error); - throw error.context?.body?.error || "Failed to search persons"; + } catch ({ error }) { + throw new ConfigurationError(error); } }, }; diff --git a/components/pipedrive/actions/update-deal/update-deal.mjs b/components/pipedrive/actions/update-deal/update-deal.mjs index 4d6e11017faa1..af698080f1aeb 100644 --- a/components/pipedrive/actions/update-deal/update-deal.mjs +++ b/components/pipedrive/actions/update-deal/update-deal.mjs @@ -1,20 +1,21 @@ +import { ConfigurationError } from "@pipedream/platform"; import pipedriveApp from "../../pipedrive.app.mjs"; export default { key: "pipedrive-update-deal", name: "Update Deal", description: "Updates the properties of a deal. See the Pipedrive API docs for Deals [here](https://developers.pipedrive.com/docs/api/v1/Deals#updateDeal)", - version: "0.1.7", + version: "0.1.8", type: "action", props: { pipedriveApp, dealId: { - description: "ID of the deal", - optional: false, propDefinition: [ pipedriveApp, "dealId", ], + optional: false, + description: "ID of the deal", }, title: { propDefinition: [ @@ -23,40 +24,47 @@ export default { ], optional: true, }, - value: { + ownerId: { propDefinition: [ pipedriveApp, - "dealValue", + "userId", ], }, - currency: { + personId: { propDefinition: [ pipedriveApp, - "dealCurrency", + "personId", ], }, - userId: { + orgId: { propDefinition: [ pipedriveApp, - "userId", + "organizationId", ], }, - personId: { + pipelineId: { propDefinition: [ pipedriveApp, - "personId", + "pipelineId", ], + optional: true, }, - organizationId: { + stageId: { propDefinition: [ pipedriveApp, - "organizationId", + "stageId", ], }, - stageId: { + value: { propDefinition: [ pipedriveApp, - "stageId", + "dealValue", + ], + }, + currency: { + propDefinition: [ + pipedriveApp, + "dealCurrency", ], }, status: { @@ -85,45 +93,29 @@ export default { }, }, async run({ $ }) { - const { - dealId, - title, - value, - currency, - userId, - personId, - organizationId, - stageId, - status, - probability, - lostReason, - visibleTo, - } = this; - try { - const resp = - await this.pipedriveApp.updateDeal({ - dealId, - title, - value, - currency, - user_id: userId, - person_id: personId, - org_id: organizationId, - stage_id: stageId, - status, - probability, - lost_reason: lostReason, - visible_to: visibleTo, - }); + const resp = await this.pipedriveApp.updateDeal({ + dealId: this.dealId, + title: this.title, + owner_id: this.ownerId, + person_id: this.personId, + org_id: this.orgId, + pipeline_id: this.pipelineId, + stage_id: this.stageId, + value: this.value, + currency: this.currency, + status: this.status, + probability: this.probability, + lost_reason: this.lostReason, + visible_to: this.visibleTo, + }); $.export("$summary", "Successfully updated deal"); return resp; - } catch (error) { - console.error(error.context?.body || error); - throw error.context?.body?.error || "Failed to update deal"; + } catch ({ error }) { + throw new ConfigurationError(error); } }, }; diff --git a/components/pipedrive/common/constants.mjs b/components/pipedrive/common/constants.mjs index 263ac9b090560..4af0c17a543cd 100644 --- a/components/pipedrive/common/constants.mjs +++ b/components/pipedrive/common/constants.mjs @@ -1,8 +1,4 @@ -const LAST_RESOURCE_PROPERTY = "lastResourceProperty"; -const FILTER_ID = "filterId"; -const FIELD_ID = "fieldId"; const DEFAULT_PAGE_LIMIT = 20; // max is 500 per page -const DEFAULT_MAX_ITEMS = DEFAULT_PAGE_LIMIT * 4; const STATUS_OPTIONS = [ "open", @@ -22,11 +18,11 @@ const FIELD_OPTIONS = [ const VISIBLE_TO_OPTIONS = [ { label: "Owner & followers (private)", - value: "1", + value: 1, }, { label: "Entire company (shared)", - value: "3", + value: 3, }, ]; @@ -34,156 +30,6 @@ const INCLUDE_FIELDS_OPTIONS = [ "person.picture", ]; -const EVENT_OBJECT = { - ACTIVITY: "activity", - ACTIVITY_TYPE: "activityType", - DEAL: "deal", - NOTE: "note", - ORGANIZATION: "organization", - PERSON: "person", - PIPELINE: "pipeline", - PRODUCT: "product", - STAGE: "stage", - USER: "user", -}; - -const FILTER_TYPE = { - DEALS: "deals", - LEADS: "leads", - ORG: "org", - PEOPLE: "people", - PRODUCTS: "products", - ACTIVITY: "activity", -}; - -const EVENT_ACTION = { - ADDED: "added", - UPDATED: "updated", - MERGED: "merged", - DELETED: "deleted", -}; - -const API = { - WEBHOOKS: [ - "WebhooksApi", - "AddWebhookRequest", - ], - USERS: [ - "UsersApi", - ], - USER_SETTINGS: [ - "UserSettingsApi", - ], - USER_CONNECTIONS: [ - "UserConnectionsApi", - ], - TEAMS: [ - "TeamsApi", - ], - SUBSCRIPTIONS: [ - "SubscriptionsApi", - ], - STAGES: [ - "StagesApi", - ], - ROLES: [ - "RolesApi", - ], - RECENTS: [ - "RecentsApi", - ], - PRODUCTS: [ - "ProductsApi", - ], - PRODUCT_FIELDS: [ - "ProductFieldsApi", - ], - PIPELINES: [ - "PipelinesApi", - ], - PERSONS: [ - "PersonsApi", - "NewPerson", - "BasicPerson", - ], - PERSON_FIELDS: [ - "PersonFieldsApi", - ], - PERMISSION_SETS: [ - "PermissionSetsApi", - ], - ORGANIZATIONS: [ - "OrganizationsApi", - "NewOrganization", - ], - ORGANIZATION_RELATIONSHIPS: [ - "OrganizationRelationshipsApi", - ], - ORGANIZATION_FIELDS: [ - "OrganizationFieldsApi", - ], - NOTES: [ - "NotesApi", - ], - NOTE_FIELDS: [ - "NoteFieldsApi", - ], - MAILBOX: [ - "MailboxApi", - ], - LEADS: [ - "LeadsApi", - ], - LEAD_SOURCES: [ - "LeadSourcesApi", - ], - LEAD_LABELS: [ - "LeadLabelsApi", - ], - ITEM_SEARCH: [ - "ItemSearchApi", - ], - GOALS: [ - "GoalsApi", - ], - GLOBAL_MESSAGES: [ - "GlobalMessagesApi", - ], - FILTERS: [ - "FiltersApi", - "AddFilterRequest", - "UpdateFilterRequest", - ], - FILES: [ - "FilesApi", - ], - DEALS: [ - "DealsApi", - "NewDeal", - "UpdateDealRequest", - ], - DEAL_FIELDS: [ - "DealFieldsApi", - ], - CURRENCIES: [ - "CurrenciesApi", - ], - CALL_LOGS: [ - "CallLogsApi", - ], - ACTIVITY_TYPES: [ - "ActivityTypesApi", - ], - ACTIVITY_FIELDS: [ - "ActivityFieldsApi", - ], - ACTIVITIES: [ - "ActivitiesApi", - "ActivityPostObject", - "ActivityPutObject", - ], -}; - const FIELD = { ADD_TIME: "add_time", UPDATE_TIME: "update_time", @@ -194,14 +40,6 @@ export default { FIELD_OPTIONS, VISIBLE_TO_OPTIONS, INCLUDE_FIELDS_OPTIONS, - LAST_RESOURCE_PROPERTY, - FILTER_ID, - FIELD_ID, - EVENT_OBJECT, - EVENT_ACTION, - API, DEFAULT_PAGE_LIMIT, - DEFAULT_MAX_ITEMS, FIELD, - FILTER_TYPE, }; diff --git a/components/pipedrive/common/utils.mjs b/components/pipedrive/common/utils.mjs index cc17a9478cfe9..dcc9cc61f6f41 100644 --- a/components/pipedrive/common/utils.mjs +++ b/components/pipedrive/common/utils.mjs @@ -1,17 +1,24 @@ -export default { - parseOrUndefined(value) { - if (value === undefined) { - return undefined; +export const parseObject = (obj) => { + if (!obj) return undefined; + + if (Array.isArray(obj)) { + return obj.map((item) => { + if (typeof item === "string") { + try { + return JSON.parse(item); + } catch (e) { + return item; + } + } + return item; + }); + } + if (typeof obj === "string") { + try { + return JSON.parse(obj); + } catch (e) { + return obj; } - return typeof(value) === "object" - ? value - : JSON.parse(value); - }, - async streamIterator(stream) { - const resources = []; - for await (const resource of stream) { - resources.push(resource); - } - return resources; - }, + } + return obj; }; diff --git a/components/pipedrive/package.json b/components/pipedrive/package.json index b0723645ecfdf..e1e5470a64072 100644 --- a/components/pipedrive/package.json +++ b/components/pipedrive/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/pipedrive", - "version": "0.3.10", + "version": "0.3.11", "description": "Pipedream Pipedrive Components", "main": "pipedrive.app.mjs", "keywords": [ @@ -14,7 +14,7 @@ "access": "public" }, "dependencies": { - "@pipedream/platform": "^1.2.0", - "pipedrive": "^13.2.7" + "@pipedream/platform": "^3.0.3", + "pipedrive": "^24.1.1" } } diff --git a/components/pipedrive/pipedrive.app.mjs b/components/pipedrive/pipedrive.app.mjs index 6637202884ed0..51a85b4acc6ea 100644 --- a/components/pipedrive/pipedrive.app.mjs +++ b/components/pipedrive/pipedrive.app.mjs @@ -1,15 +1,10 @@ -import pipedrive from "pipedrive@13.2.7"; +import pd from "pipedrive"; import constants from "./common/constants.mjs"; export default { type: "app", app: "pipedrive", propDefinitions: { - content: { - type: "string", - label: "Content", - description: "The content of the note in HTML format. Subject to sanitization on the back-end.", - }, userId: { type: "integer", label: "User ID", @@ -31,35 +26,26 @@ export default { description: "ID of the person this deal will be associated with", optional: true, async options({ prevContext }) { - const { - moreItemsInCollection, - start, - } = prevContext; - - if (moreItemsInCollection === false) { + if (prevContext?.cursor === false) { return []; } - const { data: persons, additional_data: additionalData, } = await this.getPersons({ - start, + cursor: prevContext.cursor, limit: constants.DEFAULT_PAGE_LIMIT, }); - const options = persons.map(({ - id, name, - }) => ({ - label: name, - value: id, - })); - return { - options, + options: persons.map(({ + id, name, + }) => ({ + label: name, + value: id, + })), context: { - moreItemsInCollection: additionalData.pagination.more_items_in_collection, - start: additionalData.pagination.next_start, + cursor: additionalData.next_cursor, }, }; }, @@ -70,57 +56,29 @@ export default { description: "ID of the organization this deal will be associated with", optional: true, async options({ prevContext }) { - const { - moreItemsInCollection, - start, - } = prevContext; - - if (moreItemsInCollection === false) { + if (prevContext?.cursor === false) { return []; } - const { data: organizations, additional_data: additionalData, } = await this.getOrganizations({ - start, + cursor: prevContext.cursor, limit: constants.DEFAULT_PAGE_LIMIT, }); - - const options = organizations.map(({ - id, name, - }) => ({ - label: name, - value: id, - })); - return { - options, + options: organizations.map(({ + id, name, + }) => ({ + label: name, + value: id, + })), context: { - moreItemsInCollection: additionalData.pagination.more_items_in_collection, - start: additionalData.pagination.next_start, + cursor: additionalData.next_cursor || false, }, }; }, }, - pinnedToDealFlag: { - type: "boolean", - label: "Pinned To Deal Flag", - description: "If set, the results are filtered by note to deal pinning state (deal_id is also required)", - default: false, - }, - pinnedToOrgFlag: { - type: "boolean", - label: "Pinned To Organization Flag", - description: "If set, the results are filtered by note to organization pinning state (org_id is also required)", - default: false, - }, - pinnedToPersonFlag: { - type: "boolean", - label: "Pinned To Person Flag", - description: "If set, the results are filtered by note to person pinning state (person_id is also required)", - default: false, - }, probability: { type: "integer", label: "Probability", @@ -134,7 +92,7 @@ export default { optional: true, }, visibleTo: { - type: "string", + type: "integer", label: "Visible To", description: "Visibility of the deal. If omitted, visibility will be set to the default visibility setting of this item type for the authorized user.", optional: true, @@ -143,7 +101,7 @@ export default { addTime: { type: "string", label: "Add Time", - description: "Optional creation date & time of the deal in UTC. Requires admin user API token. Format: `YYYY-MM-DD HH:MM:SS`", + description: "The creation date and time of the deal. Requires admin user API token. Format: `YYYY-MM-DDTHH:MM:SSZ`", optional: true, }, dealTitle: { @@ -168,14 +126,29 @@ export default { label: "Stage ID", description: "ID of the stage this deal will be placed in a pipeline (note that you can't supply the ID of the pipeline as this will be assigned automatically based on `stage_id`). If omitted, the deal will be placed in the first stage of the default pipeline. Get the `stage_id` from [here](https://developers.pipedrive.com/docs/api/v1/#!/Stages/get_stages).", optional: true, - async options() { - const { data: stages } = await this.getStages(); - return stages.map(({ - id, name, - }) => ({ - label: name, - value: id, - })); + async options({ prevContext }) { + if (prevContext.cursor === false) { + return []; + } + const { + data: stages, + additional_data: additionalData, + } = await this.getStages({ + cursor: prevContext.cursor, + limit: constants.DEFAULT_PAGE_LIMIT, + }); + + return { + options: stages?.map(({ + id, name, + }) => ({ + label: name, + value: id, + })), + context: { + cursor: additionalData.next_cursor, + }, + }; }, }, status: { @@ -185,245 +158,225 @@ export default { optional: true, options: constants.STATUS_OPTIONS, }, - start: { - type: "integer", - label: "Pagination start", - description: "Pagination start. Note that the pagination is based on main results and does not include related items when using `search_for_related_items` parameter.", - optional: true, - }, - limit: { - type: "integer", - label: "Limit", - description: "Items shown per page.", - optional: true, - }, dealId: { type: "string", label: "Deal ID", description: "ID of the deal this activity will be associated with", optional: true, async options({ prevContext }) { + if (prevContext?.cursor === false) { + return []; + } const { - moreItemsInCollection, - start, - } = prevContext; + data: deals, + additional_data: additionalData, + } = await this.getDeals({ + cursor: prevContext.cursor, + limit: constants.DEFAULT_PAGE_LIMIT, + }); - if (moreItemsInCollection === false) { + return { + options: deals?.map(({ + id, title, + }) => ({ + label: title, + value: id, + })), + context: { + cursor: additionalData.next_cursor, + }, + }; + }, + }, + pipelineId: { + type: "string", + label: "Pipeline ID", + description: "ID of the pipeline this activity will be associated with", + optional: true, + async options({ prevContext }) { + if (prevContext?.cursor === false) { return []; } + const { + data: pipelines, + additional_data: additionalData, + } = await this.getPipelines({ + cursor: prevContext.cursor, + limit: constants.DEFAULT_PAGE_LIMIT, + }); + return { + options: pipelines?.map(({ + id, title, + }) => ({ + label: title, + value: id, + })), + context: { + cursor: additionalData.next_cursor, + }, + }; + }, + }, + leadId: { + type: "string", + label: "Lead ID", + description: "ID of the lead this activity will be associated with", + optional: true, + async options({ prevContext }) { + if (prevContext?.nextStart === false) { + return []; + } const { - data: deals, + data: leads, additional_data: additionalData, - } = await this.getDeals({ - start, + } = await this.getLeads({ + start: prevContext.nextStart, limit: constants.DEFAULT_PAGE_LIMIT, }); - const options = deals?.map(({ - id, title, - }) => ({ - label: title, - value: id, - })); + return { + options: leads?.map(({ + id, title, + }) => ({ + label: title, + value: id, + })), + context: { + nextStart: additionalData.next_start || false, + }, + }; + }, + }, + projectId: { + type: "string", + label: "Project ID", + description: "ID of the project this activity will be associated with", + optional: true, + async options({ prevContext }) { + if (prevContext?.nextStart === false) { + return []; + } + const { + data: projects, + additional_data: additionalData, + } = await this.getProjects({ + start: prevContext.nextStart, + limit: constants.DEFAULT_PAGE_LIMIT, + }); return { - options, + options: projects?.map(({ + id, title, + }) => ({ + label: title, + value: id, + })), context: { - moreItemsInCollection: additionalData.pagination.more_items_in_collection, - start: additionalData.pagination.next_start, + nextStart: additionalData.next_start || false, }, }; }, }, }, methods: { - setupToken() { - const client = new pipedrive.ApiClient(); - const oauth2 = client.authentications.oauth2; - oauth2.accessToken = this.$auth.oauth_access_token; - oauth2.refreshToken = this.$auth.oauth_refresh_token; - oauth2.clientId = this.$auth.oauth_client_id; - return client; - }, - api(className) { - const client = this.setupToken(); - return new pipedrive[className](client); - }, - buildOpts(property, opts) { - return pipedrive[property].constructFromObject(opts); - }, - async addActivity(opts = {}) { - const [ - className, - addProperty, - ] = constants.API.ACTIVITIES; - try { - return this.api(className).addActivity(this.buildOpts(addProperty, opts)); - } catch (error) { - console.error(error); - throw new Error(error); - } - }, - addDeal(opts = {}) { - const [ - className, - addProperty, - ] = constants.API.DEALS; - return this.api(className).addDeal(this.buildOpts(addProperty, opts)); - }, - updateDeal(opts = {}) { - const { - dealId, - ...otherOpts - } = opts; - const [ - className,, - updateProperty, - ] = constants.API.DEALS; - return this.api(className).updateDeal(dealId, this.buildOpts(updateProperty, otherOpts)); - }, - async addNote(opts = {}) { - const [ - className, - ] = constants.API.NOTES; - return this.api(className).addNote(opts); - }, - async addOrganization(opts = {}) { - const [ - className, - addProperty, - ] = constants.API.ORGANIZATIONS; - return this.api(className).addOrganization(this.buildOpts(addProperty, opts)); + api(model, version = "v1") { + const config = new pd[version].Configuration({ + accessToken: this.$auth.oauth_access_token, + basePath: `${this.$auth.api_domain}/api/${version}`, + }); + return new pd[version][model](config); }, - addPerson(opts = {}) { - const [ - className, - ] = constants.API.PERSONS; - return this.api(className).addPerson(opts); - }, - searchPersons(opts = {}) { - const { - term, - ...otherOpts - } = opts; - const [ - className, - ] = constants.API.PERSONS; - return this.api(className).searchPersons(term, otherOpts); - }, - addFilter(opts = {}) { - const [ - className, - addProperty, - ] = constants.API.FILTERS; - return this.api(className).addFilter(this.buildOpts(addProperty, opts)); - }, - updateFilter(opts = {}) { - const { - filterId, - ...otherOpts - } = opts; - const [ - className,, - updateProperty, - ] = constants.API.FILTERS; - return this.api(className).updateFilter(filterId, this.buildOpts(updateProperty, otherOpts)); - }, - deleteFilter(filterId) { - const [ - className, - ] = constants.API.FILTERS; - return this.api(className).deleteFilter(filterId); + getActivityTypes(opts) { + const activityTypesApi = this.api("ActivityTypesApi"); + return activityTypesApi.getActivityTypes(opts); }, getDeals(opts = {}) { - const [ - className, - ] = constants.API.DEALS; - return this.api(className).getDeals(opts); + const dealApi = this.api("DealsApi", "v2"); + return dealApi.getDeals(opts); }, - getPersons(opts = {}) { - const [ - className, - ] = constants.API.PERSONS; - return this.api(className).getPersons(opts); - }, - async getLeads(opts) { - const [ - className, - ] = constants.API.LEADS; - return this.api(className).getLeads(opts); - }, - async getUsers(opts) { - const [ - className, - ] = constants.API.USERS; - return this.api(className).getUsers(opts); + getPipelines(opts = {}) { + const pipelineApi = this.api("PipelinesApi", "v2"); + return pipelineApi.getPipelines(opts); }, - getActivityTypes(opts) { - const [ - className, - ] = constants.API.ACTIVITY_TYPES; - return this.api(className).getActivityTypes(opts); + getLeads(opts = {}) { + const leadApi = this.api("LeadsApi"); + return leadApi.getLeads(opts); + }, + getProjects(opts = {}) { + const projectApi = this.api("ProjectsApi"); + return projectApi.getProjects(opts); }, getOrganizations(opts = {}) { - const [ - className, - ] = constants.API.ORGANIZATIONS; - return this.api(className).getOrganizations(opts); + const organizationApi = this.api("OrganizationsApi", "v2"); + return organizationApi.getOrganizations(opts); + }, + getPersons(opts = {}) { + const personApi = this.api("PersonsApi", "v2"); + return personApi.getPersons(opts); + }, + getUsers(opts) { + const UsersApi = this.api("UsersApi"); + return UsersApi.getUsers(opts); }, getStages(opts) { - const [ - className, - ] = constants.API.STAGES; - return this.api(className).getStages(opts); - }, - getDealFields(opts = {}) { - const [ - className, - ] = constants.API.DEAL_FIELDS; - return this.api(className).getDealFields(opts); - }, - getPersonFields(opts = {}) { - const [ - className, - ] = constants.API.PERSON_FIELDS; - return this.api(className).getPersonFields(opts); - }, - async *getResourcesStream({ - resourceFn, - resourceFnArgs, - limit = constants.DEFAULT_PAGE_LIMIT, - max = constants.DEFAULT_MAX_ITEMS, + const stagesApi = this.api("StagesApi", "v2"); + return stagesApi.getStages(opts); + }, + addActivity(opts = {}) { + const activityApi = this.api("ActivitiesApi", "v2"); + return activityApi.addActivity({ + AddActivityRequest: opts, + }); + }, + addNote(opts = {}) { + const noteApi = this.api("NotesApi"); + return noteApi.addNote({ + AddNoteRequest: opts, + }); + }, + addDeal(opts = {}) { + const dealsApi = this.api("DealsApi", "v2"); + return dealsApi.addDeal({ + AddDealRequest: opts, + }); + }, + addOrganization(opts = {}) { + const organizationApi = this.api("OrganizationsApi", "v2"); + return organizationApi.addOrganization({ + AddOrganizationRequest: opts, + }); + }, + addPerson(opts = {}) { + const personsApi = this.api("PersonsApi", "v2"); + return personsApi.addPerson({ + AddPersonRequest: opts, + }); + }, + addWebhook(opts = {}) { + const webhooksApi = this.api("WebhooksApi"); + return webhooksApi.addWebhook({ + AddWebhookRequest: opts, + }); + }, + deleteWebhook(webhookId) { + const webhooksApi = this.api("WebhooksApi"); + return webhooksApi.deleteWebhook({ + id: webhookId, + }); + }, + searchPersons(opts = {}) { + const personsApi = this.api("PersonsApi"); + return personsApi.searchPersons(opts); + }, + updateDeal({ + dealId, ...opts }) { - let start = 0; - let resourcesCount = 0; - - while (true) { - const response = - await resourceFn({ - ...resourceFnArgs, - limit, - start, - }); - - const nextResources = response?.data || []; - start = response?.additional_data?.pagination?.next_start; - - if (!nextResources.length) { - console.log("No more records to fetch."); - return; - } - - for (const resource of nextResources) { - resourcesCount += 1; - yield resource; - } - - if (!start || resourcesCount >= max) { - return; - } - } + const dealsApi = this.api("DealsApi", "v2"); + return dealsApi.updateDeal({ + id: dealId, + UpdateDealRequest: opts, + }); }, }, }; diff --git a/components/pipedrive/sources/common/base.mjs b/components/pipedrive/sources/common/base.mjs index d111a47e7b8da..66b57c3b0089e 100644 --- a/components/pipedrive/sources/common/base.mjs +++ b/components/pipedrive/sources/common/base.mjs @@ -1,162 +1,44 @@ -import app from "../../pipedrive.app.mjs"; -import constants from "../../common/constants.mjs"; -import utils from "../../common/utils.mjs"; -import { DEFAULT_POLLING_SOURCE_TIMER_INTERVAL } from "@pipedream/platform"; +import pipedrive from "../../pipedrive.app.mjs"; export default { props: { - app, + pipedrive, + http: "$.interface.http", db: "$.service.db", - timer: { - type: "$.interface.timer", - label: "Polling schedule", - description: "How often to poll the Pipedrive API", - default: { - intervalSeconds: DEFAULT_POLLING_SOURCE_TIMER_INTERVAL, - }, - }, - }, - hooks: { - async deploy() { - const fieldId = await this.fetchFieldId(); - const args = await this.getFilterArgs({ - fieldId, - }); - const { data: { id: filterId } } = await this.app.addFilter(args); - this.setFilterId(filterId); - }, - async deactivate() { - await this.app.deleteFilter(this.getFilterId()); - }, }, methods: { - getFilterId() { - return this.db.get(constants.FILTER_ID); - }, - setFilterId(value) { - this.db.set(constants.FILTER_ID, value); - }, - getFieldId() { - return this.db.get(constants.FIELD_ID); - }, - setFieldId(value) { - this.db.set(constants.FIELD_ID, value); - }, - getFieldKey() { - throw new Error("getFieldKey not implemented"); - }, - getEventObject() { - throw new Error("getEventObject not implemented"); - }, - getEventAction() { - throw new Error("getEventAction not implemented"); - }, - getResourceFn() { - throw new Error("getResourceFn not implemented"); - }, - getResourceFnArgs() { - throw new Error("getResourceFnArgs not implemented"); - }, - getTimestamp() { - throw new Error("getTimestamp not implemented"); - }, - getFilterArgs() { - throw new Error("getFilterArgs not implemented"); + _getHookId() { + return this.db.get("hookId"); }, - getFieldsFn() { - throw new Error("getFieldsFn not implemented"); + _setHookId(hookId) { + this.db.set("hookId", hookId); }, - getMetaId(resource) { - return resource.id; + getExtraData() { + return {}; }, - getConditions({ - fieldId, value, - } = {}) { - return { - glue: "and", - conditions: [ - { - glue: "or", - conditions: [], - }, - { - glue: "and", - conditions: [ - { - object: this.getEventObject(), - field_id: fieldId, - operator: ">", - value, - extra_value: null, - }, - ], - }, - ], - }; - }, - async fetchFieldId() { - const fieldId = this.getFieldId(); - - if (fieldId) { - return fieldId; - } - const getFields = this.getFieldsFn(); - const { data: fields } = await getFields(); - const field = fields.find(({ key }) => key === this.getFieldKey()); - - this.setFieldId(field.id); + }, + hooks: { + async activate() { + const response = await this.pipedrive.addWebhook({ + subscription_url: this.http.endpoint, + ...this.getExtraData(), + }); + console.log("response: ", response); - return field.id; - }, - generateMeta(resource) { - return { - id: this.getMetaId(resource), - summary: `${this.getEventObject()} ${resource.id} was ${this.getEventAction()}`, - ts: this.getTimestamp(resource), - }; + this._setHookId(response.data.id); }, - processEvent(resource) { - const meta = this.generateMeta(resource); - this.$emit(resource, meta); - }, - async processStreamEvents(stream) { - const resources = await utils.streamIterator(stream); - - if (resources.length === 0) { - console.log("No new events detected. Skipping..."); - return; - } - - const [ - lastResource, - ] = resources; - - resources.reverse().forEach(this.processEvent); - - if (lastResource) { - const lastDateTimeStr = lastResource[this.getFieldKey()]; - - const fieldId = await this.fetchFieldId(); - - const lastDate = new Date(lastDateTimeStr); - const args = this.getFilterArgs({ - fieldId, - value: lastDate.toISOString().split("T")[0], - }); - await this.app.updateFilter({ - filterId: this.getFilterId(), - ...args, - }); - } + async deactivate() { + const webhookId = this._getHookId(); + await this.pipedrive.deleteWebhook(webhookId); }, }, - async run() { - const stream = - await this.app.getResourcesStream({ - resourceFn: this.getResourceFn(), - resourceFnArgs: this.getResourceFnArgs(), - }); - - await this.processStreamEvents(stream); + async run({ body }) { + const ts = Date.parse(body.current.update_time); + + this.$emit(body, { + id: `${body.current.id}-${ts}`, + summary: this.getSummary(body), + ts, + }); }, }; diff --git a/components/pipedrive/sources/new-deal-instant/new-deal-instant.mjs b/components/pipedrive/sources/new-deal-instant/new-deal-instant.mjs new file mode 100644 index 0000000000000..25be591244a65 --- /dev/null +++ b/components/pipedrive/sources/new-deal-instant/new-deal-instant.mjs @@ -0,0 +1,25 @@ +import common from "../common/base.mjs"; +import sampleEmit from "./test-event.mjs"; + +export default { + ...common, + key: "pipedrive-new-deal-instant", + name: "New Deal (Instant)", + description: "Emit new event when a new deal is created.", + version: "0.0.1", + type: "source", + dedupe: "unique", + methods: { + ...common.methods, + getExtraData() { + return { + event_action: "added", + event_object: "deal", + }; + }, + getSummary(body) { + return `New Deal successfully created: ${body.current.id}`; + }, + }, + sampleEmit, +}; diff --git a/components/pipedrive/sources/new-deal-instant/test-event.mjs b/components/pipedrive/sources/new-deal-instant/test-event.mjs new file mode 100644 index 0000000000000..b6459df9c5370 --- /dev/null +++ b/components/pipedrive/sources/new-deal-instant/test-event.mjs @@ -0,0 +1,106 @@ +export default { + "v": 1, + "matches_filters": { + "current": [] + }, + "meta": { + "action": "added", + "change_source": "api", + "company_id": 1234567890, + "host": "subdomain.pipedrive.com", + "id": 10, + "is_bulk_update": false, + "matches_filters": { + "current": [] + }, + "object": "deal", + "permitted_user_ids": [ + 1234567890 + ], + "pipedrive_service_name": false, + "timestamp": 1739826584, + "timestamp_micro": 1739826584443168, + "prepublish_timestamp": 1739826584525, + "trans_pending": false, + "user_id": 1234567890, + "v": 1, + "webhook_id": "1234567890" + }, + "current": { + "email_messages_count": 0, + "cc_email": "subomain+deal11@pipedrivemail.com", + "channel": 8, + "products_count": 0, + "archive_time": null, + "acv_currency": null, + "next_activity_date": null, + "acv": null, + "next_activity_type": null, + "local_close_date": null, + "next_activity_duration": null, + "id": 11, + "person_id": null, + "creator_user_id": 1234567890, + "expected_close_date": null, + "owner_name": "Owner Name", + "arr_currency": null, + "participants_count": 0, + "stage_id": 1, + "probability": null, + "undone_activities_count": 0, + "active": true, + "local_lost_date": null, + "person_name": null, + "last_activity_date": null, + "close_time": null, + "org_hidden": false, + "next_activity_id": null, + "weighted_value_currency": "USD", + "local_won_date": null, + "stage_order_nr": 0, + "next_activity_subject": null, + "rotten_time": null, + "is_archived": false, + "user_id": 1234567890, + "visible_to": "3", + "org_id": null, + "notes_count": 0, + "next_activity_time": null, + "channel_id": "Pipedream", + "formatted_value": "$ 0", + "status": "open", + "formatted_weighted_value": "$ 0", + "mrr_currency": null, + "first_won_time": null, + "origin": "Marketplace", + "last_outgoing_mail_time": null, + "origin_id": "5d80274eae050b58", + "title": "Deal Title", + "last_activity_id": null, + "update_time": "2025-02-17 21:09:44", + "activities_count": 0, + "pipeline_id": 1, + "lost_time": null, + "currency": "USD", + "weighted_value": 0, + "org_name": null, + "value": 0, + "person_hidden": false, + "next_activity_note": null, + "arr": null, + "files_count": 0, + "last_incoming_mail_time": null, + "label": null, + "mrr": null, + "lost_reason": null, + "deleted": false, + "won_time": null, + "followers_count": 0, + "stage_change_time": null, + "add_time": "2025-02-17 21:09:44", + "done_activities_count": 0 + }, + "previous": null, + "retry": 0, + "event": "added.deal" +} \ No newline at end of file diff --git a/components/pipedrive/sources/new-deal/new-deal.mjs b/components/pipedrive/sources/new-deal/new-deal.mjs deleted file mode 100644 index e865dc5d43657..0000000000000 --- a/components/pipedrive/sources/new-deal/new-deal.mjs +++ /dev/null @@ -1,51 +0,0 @@ -import constants from "../../common/constants.mjs"; -import common from "../common/base.mjs"; - -export default { - ...common, - key: "pipedrive-new-deal", - name: "New Deal", - description: "Emit new event when a new deal is created.", - version: "0.0.6", - type: "source", - dedupe: "unique", - methods: { - ...common.methods, - getFieldsFn() { - return this.app.getDealFields; - }, - getResourceFn() { - return this.app.getDeals; - }, - getResourceFnArgs() { - return { - filter_id: this.getFilterId(), - sort: `${this.getFieldKey()} DESC, id DESC`, - }; - }, - getFieldKey() { - return constants.FIELD.ADD_TIME; - }, - getEventObject() { - return constants.EVENT_OBJECT.DEAL; - }, - getEventAction() { - return constants.EVENT_ACTION.ADDED; - }, - getTimestamp(resource) { - return Date.parse(resource.add_time); - }, - getFilterArgs({ - fieldId, value = "3_months_ago", - } = {}) { - return { - type: constants.FILTER_TYPE.DEALS, - name: "Pipedream: Deals created later than specific value", - conditions: this.getConditions({ - fieldId, - value, - }), - }; - }, - }, -}; diff --git a/components/pipedrive/sources/new-person-instant/new-person-instant.mjs b/components/pipedrive/sources/new-person-instant/new-person-instant.mjs new file mode 100644 index 0000000000000..76400aa10c134 --- /dev/null +++ b/components/pipedrive/sources/new-person-instant/new-person-instant.mjs @@ -0,0 +1,25 @@ +import common from "../common/base.mjs"; +import sampleEmit from "./test-event.mjs"; + +export default { + ...common, + key: "pipedrive-new-person-instant", + name: "New Person (Instant)", + description: "Emit new event when a new person is created.", + version: "0.0.1", + type: "source", + dedupe: "unique", + methods: { + ...common.methods, + getExtraData() { + return { + event_action: "added", + event_object: "person", + }; + }, + getSummary(body) { + return `New Person successfully created: ${body.current.id}`; + }, + }, + sampleEmit, +}; diff --git a/components/pipedrive/sources/new-person-instant/test-event.mjs b/components/pipedrive/sources/new-person-instant/test-event.mjs new file mode 100644 index 0000000000000..8f56cc935301b --- /dev/null +++ b/components/pipedrive/sources/new-person-instant/test-event.mjs @@ -0,0 +1,110 @@ +export default { + "v": 1, + "matches_filters": { + "current": [] + }, + "meta": { + "action": "added", + "change_source": "api", + "company_id": 1234567890, + "host": "subdomain.pipedrive.com", + "id": 10, + "is_bulk_update": false, + "matches_filters": { + "current": [] + }, + "object": "person", + "permitted_user_ids": [ + 1234567890 + ], + "pipedrive_service_name": false, + "timestamp": 1739826941, + "timestamp_micro": 1739826941509060, + "prepublish_timestamp": 1739826941605, + "trans_pending": false, + "user_id": 1234567890, + "v": 1, + "webhook_id": "1234567890" + }, + "current": { + "related_closed_deals_count": 0, + "notes": null, + "email_messages_count": 0, + "cc_email": "subdomain@pipedrivemail.com", + "owner_id": 1234567890, + "open_deals_count": 0, + "postal_address_subpremise": null, + "next_activity_date": null, + "participant_open_deals_count": 0, + "postal_address_locality": null, + "id": 10, + "job_title": null, + "postal_address": null, + "owner_name": "Owner Name", + "im": [ + { + "value": "", + "primary": true + } + ], + "related_won_deals_count": 0, + "label_ids": [], + "undone_activities_count": 0, + "last_activity_date": null, + "next_activity_id": null, + "postal_address_country": null, + "phone": [ + { + "value": "", + "primary": true + } + ], + "visible_to": "3", + "org_id": null, + "notes_count": 0, + "name": "Person Name", + "participant_closed_deals_count": 0, + "lost_deals_count": 0, + "next_activity_time": null, + "birthday": null, + "delete_time": null, + "postal_address_postal_code": null, + "last_outgoing_mail_time": null, + "active_flag": true, + "picture_id": null, + "last_activity_id": null, + "update_time": "2025-02-17 21:15:41", + "activities_count": 0, + "postal_address_route": null, + "org_name": null, + "first_name": "Person Name", + "email": [ + { + "value": "", + "primary": true + } + ], + "postal_address_street_number": null, + "won_deals_count": 0, + "files_count": 0, + "company_id": 1234567890, + "last_incoming_mail_time": null, + "first_char": "p", + "closed_deals_count": 0, + "last_name": "02", + "label": null, + "related_lost_deals_count": 0, + "related_open_deals_count": 0, + "postal_address_formatted_address": null, + "postal_address_sublocality": null, + "postal_address_admin_area_level_2": null, + "postal_address_admin_area_level_1": null, + "followers_count": 0, + "primary_email": null, + "add_time": "2025-02-17 21:15:41", + "done_activities_count": 0 + }, + "previous": null, + "retry": 0, + "event": "added.person" +} \ No newline at end of file diff --git a/components/pipedrive/sources/new-person/new-person.mjs b/components/pipedrive/sources/new-person/new-person.mjs deleted file mode 100644 index 3e5aa58838406..0000000000000 --- a/components/pipedrive/sources/new-person/new-person.mjs +++ /dev/null @@ -1,51 +0,0 @@ -import constants from "../../common/constants.mjs"; -import common from "../common/base.mjs"; - -export default { - ...common, - key: "pipedrive-new-person", - name: "New Person", - description: "Emit new event when a new person is created.", - version: "0.0.6", - type: "source", - dedupe: "unique", - methods: { - ...common.methods, - getFieldsFn() { - return this.app.getPersonFields; - }, - getResourceFn() { - return this.app.getPersons; - }, - getResourceFnArgs() { - return { - filter_id: this.getFilterId(), - sort: `${this.getFieldKey()} DESC, id DESC`, - }; - }, - getFieldKey() { - return constants.FIELD.ADD_TIME; - }, - getEventObject() { - return constants.EVENT_OBJECT.PERSON; - }, - getEventAction() { - return constants.EVENT_ACTION.ADDED; - }, - getTimestamp(resource) { - return Date.parse(resource.add_time); - }, - getFilterArgs({ - fieldId, value = "3_months_ago", - } = {}) { - return { - type: constants.FILTER_TYPE.PEOPLE, - name: "Pipedream: Persons created later than specific value", - conditions: this.getConditions({ - fieldId, - value, - }), - }; - }, - }, -}; diff --git a/components/pipedrive/sources/updated-deal-instant/test-event.mjs b/components/pipedrive/sources/updated-deal-instant/test-event.mjs new file mode 100644 index 0000000000000..5ec55c7f65796 --- /dev/null +++ b/components/pipedrive/sources/updated-deal-instant/test-event.mjs @@ -0,0 +1,179 @@ +export default { + "v": 1, + "matches_filters": { + "current": [] + }, + "meta": { + "action": "updated", + "change_source": "api", + "company_id": 1234567890, + "host": "subdomain.pipedrive.com", + "id": 9, + "is_bulk_update": false, + "matches_filters": { + "current": [] + }, + "object": "deal", + "permitted_user_ids": [ + 1234567890 + ], + "pipedrive_service_name": false, + "timestamp": 1739827361, + "timestamp_micro": 1739827361322662, + "prepublish_timestamp": 1739827361337, + "trans_pending": false, + "user_id": 1234567890, + "v": 1, + "webhook_id": "1234567890" + }, + "current": { + "email_messages_count": 0, + "cc_email": "subdomain+deal9@pipedrivemail.com", + "channel": 8, + "products_count": 0, + "archive_time": null, + "acv_currency": null, + "next_activity_date": null, + "acv": null, + "next_activity_type": null, + "local_close_date": null, + "next_activity_duration": null, + "id": 9, + "person_id": null, + "creator_user_id": 1234567890, + "expected_close_date": null, + "owner_name": "Owner Name", + "arr_currency": null, + "participants_count": 0, + "stage_id": 1, + "probability": null, + "undone_activities_count": 0, + "active": true, + "local_lost_date": null, + "person_name": null, + "last_activity_date": null, + "close_time": null, + "org_hidden": false, + "next_activity_id": null, + "weighted_value_currency": "USD", + "local_won_date": null, + "stage_order_nr": 0, + "next_activity_subject": null, + "rotten_time": null, + "is_archived": false, + "user_id": 1234567890, + "visible_to": "3", + "org_id": null, + "notes_count": 0, + "next_activity_time": null, + "channel_id": "Channel", + "formatted_value": "$0", + "status": "open", + "formatted_weighted_value": "$0", + "mrr_currency": null, + "first_won_time": null, + "origin": "Marketplace", + "last_outgoing_mail_time": null, + "origin_id": "5d80274eae050b58", + "title": "Updated Deal Title", + "last_activity_id": null, + "update_time": "2025-02-17 21:22:41", + "activities_count": 0, + "pipeline_id": 1, + "lost_time": null, + "currency": "USD", + "weighted_value": 0, + "org_name": null, + "value": 0, + "person_hidden": false, + "next_activity_note": null, + "arr": null, + "files_count": 0, + "last_incoming_mail_time": null, + "label": null, + "mrr": null, + "lost_reason": null, + "deleted": false, + "won_time": null, + "followers_count": 1, + "stage_change_time": null, + "add_time": "2025-02-17 18:06:03", + "done_activities_count": 0 + }, + "previous": { + "email_messages_count": 0, + "cc_email": "subdomain+deal9@pipedrivemail.com", + "channel": 8, + "products_count": 0, + "archive_time": null, + "acv_currency": null, + "next_activity_date": null, + "acv": null, + "next_activity_type": null, + "local_close_date": null, + "next_activity_duration": null, + "id": 9, + "person_id": null, + "creator_user_id": 1234567890, + "expected_close_date": null, + "owner_name": "Owner Name", + "arr_currency": null, + "participants_count": 0, + "stage_id": 1, + "probability": null, + "undone_activities_count": 0, + "active": true, + "local_lost_date": null, + "person_name": null, + "last_activity_date": null, + "close_time": null, + "org_hidden": false, + "next_activity_id": null, + "weighted_value_currency": "USD", + "local_won_date": null, + "stage_order_nr": 0, + "next_activity_subject": null, + "rotten_time": null, + "is_archived": false, + "user_id": 1234567890, + "visible_to": "3", + "org_id": null, + "notes_count": 0, + "next_activity_time": null, + "channel_id": "Channel", + "formatted_value": "$0", + "status": "open", + "formatted_weighted_value": "$0", + "mrr_currency": null, + "first_won_time": null, + "origin": "Marketplace", + "last_outgoing_mail_time": null, + "origin_id": "5d80274eae050b58", + "title": "Updated Deal Title", + "last_activity_id": null, + "update_time": "2025-02-17 19:46:52", + "activities_count": 0, + "pipeline_id": 1, + "lost_time": null, + "currency": "USD", + "weighted_value": 0, + "org_name": null, + "value": 0, + "person_hidden": false, + "next_activity_note": null, + "arr": null, + "files_count": 0, + "last_incoming_mail_time": null, + "label": null, + "mrr": null, + "lost_reason": null, + "deleted": false, + "won_time": null, + "followers_count": 1, + "stage_change_time": null, + "add_time": "2025-02-17 18:06:03", + "done_activities_count": 0 + }, + "retry": 0, + "event": "updated.deal" +} \ No newline at end of file diff --git a/components/pipedrive/sources/updated-deal-instant/updated-deal-instant.mjs b/components/pipedrive/sources/updated-deal-instant/updated-deal-instant.mjs new file mode 100644 index 0000000000000..d1a759e95ac53 --- /dev/null +++ b/components/pipedrive/sources/updated-deal-instant/updated-deal-instant.mjs @@ -0,0 +1,25 @@ +import common from "../common/base.mjs"; +import sampleEmit from "./test-event.mjs"; + +export default { + ...common, + key: "pipedrive-updated-deal-instant", + name: "New Deal Update (Instant)", + description: "Emit new event when a deal is updated.", + version: "0.0.1", + type: "source", + dedupe: "unique", + methods: { + ...common.methods, + getExtraData() { + return { + event_action: "updated", + event_object: "deal", + }; + }, + getSummary(body) { + return `Deal successfully updated: ${body.current.id}`; + }, + }, + sampleEmit, +}; diff --git a/components/pipedrive/sources/updated-deal/updated-deal.mjs b/components/pipedrive/sources/updated-deal/updated-deal.mjs deleted file mode 100644 index 56059c65c28f3..0000000000000 --- a/components/pipedrive/sources/updated-deal/updated-deal.mjs +++ /dev/null @@ -1,54 +0,0 @@ -import constants from "../../common/constants.mjs"; -import common from "../common/base.mjs"; - -export default { - ...common, - key: "pipedrive-updated-deal", - name: "Updated Deal", - description: "Emit new event when a deal is updated.", - version: "0.0.6", - type: "source", - dedupe: "greatest", - methods: { - ...common.methods, - getFieldsFn() { - return this.app.getDealFields; - }, - getResourceFn() { - return this.app.getDeals; - }, - getResourceFnArgs() { - return { - filter_id: this.getFilterId(), - sort: `${this.getFieldKey()} DESC, id DESC`, - }; - }, - getFieldKey() { - return constants.FIELD.UPDATE_TIME; - }, - getEventObject() { - return constants.EVENT_OBJECT.DEAL; - }, - getEventAction() { - return constants.EVENT_ACTION.UPDATED; - }, - getMetaId(resource) { - return this.getTimestamp(resource); - }, - getTimestamp(resource) { - return Date.parse(resource.update_time); - }, - getFilterArgs({ - fieldId, value = "3_months_ago", - } = {}) { - return { - type: constants.FILTER_TYPE.DEALS, - name: "Pipedream: Deals updated later than specific value", - conditions: this.getConditions({ - fieldId, - value, - }), - }; - }, - }, -}; diff --git a/components/pipedrive/sources/updated-person-instant/test-event.mjs b/components/pipedrive/sources/updated-person-instant/test-event.mjs new file mode 100644 index 0000000000000..98912c6596d7e --- /dev/null +++ b/components/pipedrive/sources/updated-person-instant/test-event.mjs @@ -0,0 +1,189 @@ +export default { + "v": 1, + "matches_filters": { + "current": [] + }, + "meta": { + "action": "updated", + "change_source": "app", + "company_id": 1234567890, + "host": "subdomain.pipedrive.com", + "id": 11, + "is_bulk_update": false, + "matches_filters": { + "current": [] + }, + "object": "person", + "permitted_user_ids": [ + 1234567890 + ], + "pipedrive_service_name": false, + "timestamp": 1739827618, + "timestamp_micro": 1739827618595189, + "prepublish_timestamp": 1739827618608, + "trans_pending": false, + "user_id": 1234567890, + "v": 1, + "webhook_id": "1234567890" + }, + "current": { + "related_closed_deals_count": 0, + "notes": null, + "email_messages_count": 0, + "cc_email": "subdomain@pipedrivemail.com", + "owner_id": 1234567890, + "open_deals_count": 0, + "postal_address_subpremise": null, + "next_activity_date": null, + "participant_open_deals_count": 0, + "postal_address_locality": null, + "id": 11, + "job_title": null, + "postal_address": null, + "owner_name": "Owner Name", + "im": [ + { + "value": "", + "primary": true + } + ], + "related_won_deals_count": 0, + "label_ids": [ + 14 + ], + "undone_activities_count": 0, + "picture_128_url": null, + "last_activity_date": null, + "next_activity_id": null, + "postal_address_country": null, + "phone": [ + { + "value": "", + "primary": true + } + ], + "visible_to": "3", + "org_id": null, + "notes_count": 0, + "name": "Person Name", + "participant_closed_deals_count": 0, + "lost_deals_count": 0, + "next_activity_time": null, + "birthday": null, + "delete_time": null, + "postal_address_postal_code": null, + "last_outgoing_mail_time": null, + "active_flag": true, + "picture_id": null, + "last_activity_id": null, + "update_time": "2025-02-17 21:26:58", + "activities_count": 0, + "postal_address_route": null, + "org_name": null, + "first_name": "Person Name", + "email": [ + { + "value": "", + "primary": true + } + ], + "postal_address_street_number": null, + "won_deals_count": 0, + "files_count": 0, + "company_id": 1234567890, + "last_incoming_mail_time": null, + "first_char": "p", + "closed_deals_count": 0, + "last_name": "Surname", + "label": 14, + "related_lost_deals_count": 0, + "related_open_deals_count": 0, + "postal_address_formatted_address": null, + "postal_address_sublocality": null, + "postal_address_admin_area_level_2": null, + "postal_address_admin_area_level_1": null, + "followers_count": 1, + "add_time": "2025-02-17 21:15:41", + "done_activities_count": 0 + }, + "previous": { + "related_closed_deals_count": 0, + "notes": null, + "email_messages_count": 0, + "cc_email": "subdomain@pipedrivemail.com", + "owner_id": 1234567890, + "open_deals_count": 0, + "postal_address_subpremise": null, + "next_activity_date": null, + "participant_open_deals_count": 0, + "postal_address_locality": null, + "id": 11, + "job_title": null, + "postal_address": null, + "owner_name": "Owner Name", + "im": [ + { + "value": "", + "primary": true + } + ], + "related_won_deals_count": 0, + "label_ids": [], + "undone_activities_count": 0, + "picture_128_url": null, + "last_activity_date": null, + "next_activity_id": null, + "postal_address_country": null, + "phone": [ + { + "value": "", + "primary": true + } + ], + "visible_to": "3", + "org_id": null, + "notes_count": 0, + "name": "Person Name", + "participant_closed_deals_count": 0, + "lost_deals_count": 0, + "next_activity_time": null, + "birthday": null, + "delete_time": null, + "postal_address_postal_code": null, + "last_outgoing_mail_time": null, + "active_flag": true, + "picture_id": null, + "last_activity_id": null, + "update_time": "2025-02-17 21:15:41", + "activities_count": 0, + "postal_address_route": null, + "org_name": null, + "first_name": "Person Name", + "email": [ + { + "value": "", + "primary": true + } + ], + "postal_address_street_number": null, + "won_deals_count": 0, + "files_count": 0, + "company_id": 1234567890, + "last_incoming_mail_time": null, + "first_char": "p", + "closed_deals_count": 0, + "last_name": "Surname", + "label": null, + "related_lost_deals_count": 0, + "related_open_deals_count": 0, + "postal_address_formatted_address": null, + "postal_address_sublocality": null, + "postal_address_admin_area_level_2": null, + "postal_address_admin_area_level_1": null, + "followers_count": 1, + "add_time": "2025-02-17 21:15:41", + "done_activities_count": 0 + }, + "retry": 0, + "event": "updated.person" +} \ No newline at end of file diff --git a/components/pipedrive/sources/updated-person-instant/updated-person-instant.mjs b/components/pipedrive/sources/updated-person-instant/updated-person-instant.mjs new file mode 100644 index 0000000000000..73e4527455a93 --- /dev/null +++ b/components/pipedrive/sources/updated-person-instant/updated-person-instant.mjs @@ -0,0 +1,25 @@ +import common from "../common/base.mjs"; +import sampleEmit from "./test-event.mjs"; + +export default { + ...common, + key: "pipedrive-updated-person-instant", + name: "New Person Update (Instant)", + description: "Emit new event when a person is updated.", + version: "0.0.1", + type: "source", + dedupe: "unique", + methods: { + ...common.methods, + getExtraData() { + return { + event_action: "updated", + event_object: "person", + }; + }, + getSummary(body) { + return `Person successfully updated: ${body.current.id}`; + }, + }, + sampleEmit, +}; diff --git a/components/pipedrive/sources/updated-person/updated-person.mjs b/components/pipedrive/sources/updated-person/updated-person.mjs deleted file mode 100644 index 378d1bcf56292..0000000000000 --- a/components/pipedrive/sources/updated-person/updated-person.mjs +++ /dev/null @@ -1,54 +0,0 @@ -import constants from "../../common/constants.mjs"; -import common from "../common/base.mjs"; - -export default { - ...common, - key: "pipedrive-updated-person", - name: "Updated Person", - description: "Emit new event when a person is updated.", - version: "0.0.6", - type: "source", - dedupe: "greatest", - methods: { - ...common.methods, - getFieldsFn() { - return this.app.getPersonFields; - }, - getResourceFn() { - return this.app.getPersons; - }, - getResourceFnArgs() { - return { - filter_id: this.getFilterId(), - sort: `${this.getFieldKey()} DESC, id DESC`, - }; - }, - getFieldKey() { - return constants.FIELD.UPDATE_TIME; - }, - getEventObject() { - return constants.EVENT_OBJECT.PERSON; - }, - getEventAction() { - return constants.EVENT_ACTION.UPDATED; - }, - getMetaId(resource) { - return this.getTimestamp(resource); - }, - getTimestamp(resource) { - return Date.parse(resource.update_time); - }, - getFilterArgs({ - fieldId, value = "3_months_ago", - } = {}) { - return { - type: constants.FILTER_TYPE.PEOPLE, - name: "Pipedream: Persons updated later than specific value", - conditions: this.getConditions({ - fieldId, - value, - }), - }; - }, - }, -}; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7062164d7b4dc..3525da2c85b2b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1447,8 +1447,7 @@ importers: specifier: ^6.11.2 version: 6.13.1 - components/brillium: - specifiers: {} + components/brillium: {} components/brosix: {} @@ -7472,9 +7471,6 @@ importers: components/openai: dependencies: - '@ffmpeg-installer/ffmpeg': - specifier: ^1.1.0 - version: 1.1.0 '@pipedream/platform': specifier: ^3.0.3 version: 3.0.3 @@ -8072,11 +8068,11 @@ importers: components/pipedrive: dependencies: '@pipedream/platform': - specifier: ^1.2.0 - version: 1.6.6 + specifier: ^3.0.3 + version: 3.0.3 pipedrive: - specifier: ^13.2.7 - version: 13.3.4 + specifier: ^24.1.1 + version: 24.1.1 components/pipefy: dependencies: @@ -14746,49 +14742,6 @@ packages: '@fastify/busboy@3.1.1': resolution: {integrity: sha512-5DGmA8FTdB2XbDeEwc/5ZXBl6UbBAyBOOLlPuBnZ/N1SwdH9Ii+cOX3tBROlDgcTXxjOYnLMVoKk9+FXAw0CJw==} - '@ffmpeg-installer/darwin-arm64@4.1.5': - resolution: {integrity: sha512-hYqTiP63mXz7wSQfuqfFwfLOfwwFChUedeCVKkBtl/cliaTM7/ePI9bVzfZ2c+dWu3TqCwLDRWNSJ5pqZl8otA==} - cpu: [arm64] - os: [darwin] - - '@ffmpeg-installer/darwin-x64@4.1.0': - resolution: {integrity: sha512-Z4EyG3cIFjdhlY8wI9aLUXuH8nVt7E9SlMVZtWvSPnm2sm37/yC2CwjUzyCQbJbySnef1tQwGG2Sx+uWhd9IAw==} - cpu: [x64] - os: [darwin] - - '@ffmpeg-installer/ffmpeg@1.1.0': - resolution: {integrity: sha512-Uq4rmwkdGxIa9A6Bd/VqqYbT7zqh1GrT5/rFwCwKM70b42W5gIjWeVETq6SdcL0zXqDtY081Ws/iJWhr1+xvQg==} - - '@ffmpeg-installer/linux-arm64@4.1.4': - resolution: {integrity: sha512-dljEqAOD0oIM6O6DxBW9US/FkvqvQwgJ2lGHOwHDDwu/pX8+V0YsDL1xqHbj1DMX/+nP9rxw7G7gcUvGspSoKg==} - cpu: [arm64] - os: [linux] - - '@ffmpeg-installer/linux-arm@4.1.3': - resolution: {integrity: sha512-NDf5V6l8AfzZ8WzUGZ5mV8O/xMzRag2ETR6+TlGIsMHp81agx51cqpPItXPib/nAZYmo55Bl2L6/WOMI3A5YRg==} - cpu: [arm] - os: [linux] - - '@ffmpeg-installer/linux-ia32@4.1.0': - resolution: {integrity: sha512-0LWyFQnPf+Ij9GQGD034hS6A90URNu9HCtQ5cTqo5MxOEc7Rd8gLXrJvn++UmxhU0J5RyRE9KRYstdCVUjkNOQ==} - cpu: [ia32] - os: [linux] - - '@ffmpeg-installer/linux-x64@4.1.0': - resolution: {integrity: sha512-Y5BWhGLU/WpQjOArNIgXD3z5mxxdV8c41C+U15nsE5yF8tVcdCGet5zPs5Zy3Ta6bU7haGpIzryutqCGQA/W8A==} - cpu: [x64] - os: [linux] - - '@ffmpeg-installer/win32-ia32@4.1.0': - resolution: {integrity: sha512-FV2D7RlaZv/lrtdhaQ4oETwoFUsUjlUiasiZLDxhEUPdNDWcH1OU9K1xTvqz+OXLdsmYelUDuBS/zkMOTtlUAw==} - cpu: [ia32] - os: [win32] - - '@ffmpeg-installer/win32-x64@4.1.0': - resolution: {integrity: sha512-Drt5u2vzDnIONf4ZEkKtFlbvwj6rI3kxw1Ck9fpudmtgaZIHD4ucsWB2lCZBXRxJgXR+2IMSti+4rtM4C4rXgg==} - cpu: [x64] - os: [win32] - '@firebase/app-check-interop-types@0.3.3': resolution: {integrity: sha512-gAlxfPLT2j8bTI/qfe3ahl2I2YcBQ8cFIBdhAQA4I2f3TndcO+22YizyGYuttLHPQEpWkhmpFW60VCFEPg4g5A==} @@ -24088,8 +24041,8 @@ packages: resolution: {integrity: sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==} engines: {node: '>=6'} - pipedrive@13.3.4: - resolution: {integrity: sha512-4/o4wNFBd4rlN4oKlUfYc4NDuWhNwFUT0F/oPdRUh5xev7EoiMj0NgjEansiqyC3OvvGUjij7DQu09+MQBvjmA==} + pipedrive@24.1.1: + resolution: {integrity: sha512-5F4b1xG20LlhYhID6CCkd8IExBKnmriDD1OZtex/aTL5195lbpD5D2FSoP524AvUtaHYPNlgb0XsN5NbVTQKvw==} pirates@4.0.6: resolution: {integrity: sha512-saLsH7WeYYPiD25LDuLRRY/i+6HaPYr6G1OUlN39otzkSTxKnubR9RTxS3/Kk50s1g2JTgFwWQDQyplC5/SHZg==} @@ -30356,41 +30309,6 @@ snapshots: '@fastify/busboy@3.1.1': {} - '@ffmpeg-installer/darwin-arm64@4.1.5': - optional: true - - '@ffmpeg-installer/darwin-x64@4.1.0': - optional: true - - '@ffmpeg-installer/ffmpeg@1.1.0': - optionalDependencies: - '@ffmpeg-installer/darwin-arm64': 4.1.5 - '@ffmpeg-installer/darwin-x64': 4.1.0 - '@ffmpeg-installer/linux-arm': 4.1.3 - '@ffmpeg-installer/linux-arm64': 4.1.4 - '@ffmpeg-installer/linux-ia32': 4.1.0 - '@ffmpeg-installer/linux-x64': 4.1.0 - '@ffmpeg-installer/win32-ia32': 4.1.0 - '@ffmpeg-installer/win32-x64': 4.1.0 - - '@ffmpeg-installer/linux-arm64@4.1.4': - optional: true - - '@ffmpeg-installer/linux-arm@4.1.3': - optional: true - - '@ffmpeg-installer/linux-ia32@4.1.0': - optional: true - - '@ffmpeg-installer/linux-x64@4.1.0': - optional: true - - '@ffmpeg-installer/win32-ia32@4.1.0': - optional: true - - '@ffmpeg-installer/win32-x64@4.1.0': - optional: true - '@firebase/app-check-interop-types@0.3.3': {} '@firebase/app-compat@0.1.39': @@ -42465,13 +42383,12 @@ snapshots: pify@4.0.1: {} - pipedrive@13.3.4: + pipedrive@24.1.1: dependencies: - '@babel/runtime': 7.26.0 - lodash: 4.17.21 - superagent: 5.3.1 + axios: 1.7.9 + qs: 6.13.1 transitivePeerDependencies: - - supports-color + - debug pirates@4.0.6: {}