Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion components/pipedrive/actions/add-activity/add-activity.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ 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.17",
version: "0.1.18",
annotations: {
destructiveHint: false,
openWorldHint: true,
Expand Down
2 changes: 1 addition & 1 deletion components/pipedrive/actions/add-deal/add-deal.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ 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.18",
version: "0.1.19",
annotations: {
destructiveHint: false,
openWorldHint: true,
Expand Down
2 changes: 1 addition & 1 deletion components/pipedrive/actions/add-lead/add-lead.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "pipedrive-add-lead",
name: "Add Lead",
description: "Create a new lead in Pipedrive. [See the documentation](https://developers.pipedrive.com/docs/api/v1/Leads#addLead)",
version: "0.0.11",
version: "0.0.12",
annotations: {
destructiveHint: false,
openWorldHint: true,
Expand Down
2 changes: 1 addition & 1 deletion components/pipedrive/actions/add-person/add-person.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ 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.17",
version: "0.1.18",
annotations: {
destructiveHint: false,
openWorldHint: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ 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.17",
version: "0.1.18",
annotations: {
destructiveHint: false,
openWorldHint: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "pipedrive-update-person",
name: "Update Person",
description: "Updates an existing person in Pipedrive. [See the documentation](https://developers.pipedrive.com/docs/api/v1/Persons#updatePerson)",
version: "0.0.9",
version: "0.0.10",
annotations: {
destructiveHint: true,
openWorldHint: true,
Expand Down
39 changes: 39 additions & 0 deletions components/pipedrive/common/utils.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,42 @@ export const formatCustomFields = async (resp, getResourcesFn, getFieldsFn) => {
};
});
};

export const formatCustomFieldDataFromSource = async ({
body, customFieldFn, resourceFn,
}) => {
const customFieldNames = await getCustomFieldNames(customFieldFn);
const { data } = await resourceFn(body.data.id);
const formattedCustomFields = {};
for (const [
key,
value,
] of Object.entries(customFieldNames)) {
formattedCustomFields[value] = data[key] ?? data?.custom_fields?.[key] ?? null;
}

const formattedPreviousCustomFields = {};
if (body?.previous?.custom_fields) {
for (const [
key,
value,
] of Object.entries(customFieldNames)) {
if (body.previous.custom_fields[key]) {
formattedPreviousCustomFields[value] = body.previous.custom_fields[key];
}
}
}
return {
...body,
data: {
...body.data,
custom_fields: formattedCustomFields,
},
...(body.previous?.custom_fields && {
previous: {
...body.previous,
custom_fields: formattedPreviousCustomFields,
},
}),
};
};
2 changes: 1 addition & 1 deletion components/pipedrive/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/pipedrive",
"version": "0.10.4",
"version": "0.10.5",
"description": "Pipedream Pipedrive Components",
"main": "pipedrive.app.mjs",
"keywords": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
export default {
...common,
key: "pipedrive-updated-deal-instant",
name: "Deal Updated (Instant)",

Check warning on line 8 in components/pipedrive/sources/updated-deal-instant/updated-deal-instant.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Source names should start with "New". See https://pipedream.com/docs/components/guidelines/#source-name
description: "Emit new event when a deal is updated.",
version: "0.1.6",
version: "0.1.7",
type: "source",
dedupe: "unique",
methods: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { parseData } from "../../common/utils.mjs";
import { formatCustomFieldDataFromSource } from "../../common/utils.mjs";
import common from "../common/base.mjs";
import sampleEmit from "./test-event.mjs";

export default {
...common,
key: "pipedrive-updated-lead-instant",
name: "Lead Updated (Instant)",

Check warning on line 8 in components/pipedrive/sources/updated-lead-instant/updated-lead-instant.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Source names should start with "New". See https://pipedream.com/docs/components/guidelines/#source-name
description: "Emit new event when a lead is updated.",
version: "0.1.6",
version: "0.1.7",
type: "source",
dedupe: "unique",
methods: {
Expand All @@ -22,9 +22,10 @@
return `Lead successfully updated: ${body.data.id}`;
},
async parseData(body) {
return await parseData({
fn: this.pipedrive.getDealCustomFields,
return await formatCustomFieldDataFromSource({
body,
customFieldFn: this.pipedrive.getDealCustomFields,
resourceFn: this.pipedrive.getLead,
});
},
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { parseData } from "../../common/utils.mjs";
import { formatCustomFieldDataFromSource } from "../../common/utils.mjs";
import common from "../common/base.mjs";
import sampleEmit from "./test-event.mjs";

export default {
...common,
key: "pipedrive-updated-person-instant",
name: "Person Updated (Instant)",

Check warning on line 8 in components/pipedrive/sources/updated-person-instant/updated-person-instant.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Source names should start with "New". See https://pipedream.com/docs/components/guidelines/#source-name
description: "Emit new event when a person is updated.",
version: "0.1.6",
version: "0.1.7",
type: "source",
dedupe: "unique",
methods: {
Expand All @@ -22,9 +22,10 @@
return `Person successfully updated: ${body.data.id}`;
},
async parseData(body) {
return await parseData({
fn: this.pipedrive.getPersonCustomFields,
return await formatCustomFieldDataFromSource({
body,
customFieldFn: this.pipedrive.getPersonCustomFields,
resourceFn: this.pipedrive.getPerson,
});
},
},
Expand Down
Loading