Skip to content

Commit ef68123

Browse files
authored
Merging pull request #18281
* new components * pnpm-lock.yaml
1 parent a842fdf commit ef68123

File tree

10 files changed

+162
-7
lines changed

10 files changed

+162
-7
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import pipedriveApp from "../../pipedrive.app.mjs";
2+
3+
export default {
4+
key: "pipedrive-merge-deals",
5+
name: "Merge Deals",
6+
description: "Merge two deals in Pipedrive. [See the documentation](https://developers.pipedrive.com/docs/api/v1/Deals#mergeDeals)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
pipedriveApp,
11+
dealId: {
12+
propDefinition: [
13+
pipedriveApp,
14+
"dealId",
15+
],
16+
description: "The ID of the deal to merge",
17+
optional: false,
18+
},
19+
targetDealId: {
20+
propDefinition: [
21+
pipedriveApp,
22+
"dealId",
23+
],
24+
label: "Target Deal ID",
25+
description: "The ID of the deal that the deal will be merged with",
26+
optional: false,
27+
},
28+
},
29+
methods: {
30+
mergeDeals({
31+
id, ...opts
32+
}) {
33+
const dealsApi = this.pipedriveApp.api("DealsApi");
34+
return dealsApi.mergeDeals({
35+
id,
36+
MergeDealsRequest: opts,
37+
});
38+
},
39+
},
40+
async run({ $ }) {
41+
const { data } = await this.mergeDeals({
42+
id: this.dealId,
43+
merge_with_id: this.targetDealId,
44+
});
45+
46+
$.export("$summary", `Successfully merged deals with IDs ${this.dealId} and ${this.targetDealId}`);
47+
48+
return data;
49+
},
50+
};
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import pipedriveApp from "../../pipedrive.app.mjs";
2+
3+
export default {
4+
key: "pipedrive-merge-persons",
5+
name: "Merge Persons",
6+
description: "Merge two persons in Pipedrive. [See the documentation](https://developers.pipedrive.com/docs/api/v1/Persons#mergePersons)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
pipedriveApp,
11+
personId: {
12+
propDefinition: [
13+
pipedriveApp,
14+
"personId",
15+
],
16+
description: "The ID of the person to merge",
17+
optional: false,
18+
},
19+
targetPersonId: {
20+
propDefinition: [
21+
pipedriveApp,
22+
"personId",
23+
],
24+
label: "Target Person ID",
25+
description: "The ID of the person that will not be overwritten. This person's data will be prioritized in case of conflict with the other person.",
26+
optional: false,
27+
},
28+
},
29+
methods: {
30+
mergePersons({
31+
id, ...opts
32+
}) {
33+
const personsApi = this.pipedriveApp.api("PersonsApi");
34+
return personsApi.mergePersons({
35+
id,
36+
MergePersonsRequest: opts,
37+
});
38+
},
39+
},
40+
async run({ $ }) {
41+
const { data } = await this.mergePersons({
42+
id: this.personId,
43+
merge_with_id: this.targetPersonId,
44+
});
45+
46+
$.export("$summary", `Successfully merged persons with IDs ${this.personId} and ${this.targetPersonId}`);
47+
48+
return data;
49+
},
50+
};

components/pipedrive/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/pipedrive",
3-
"version": "0.9.0",
3+
"version": "0.10.0",
44
"description": "Pipedream Pipedrive Components",
55
"main": "pipedrive.app.mjs",
66
"keywords": [

components/pipedrive/sources/common/base.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export default {
3939
const ts = Date.parse(body.meta.timestamp);
4040

4141
this.$emit(await this.parseData(body), {
42-
id: `${body.data.id}-${ts}`,
42+
id: `${body.data?.id || body.meta?.id}-${ts}`,
4343
summary: this.getSummary(body),
4444
ts,
4545
});

components/pipedrive/sources/new-deal-instant/new-deal-instant.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default {
66
key: "pipedrive-new-deal-instant",
77
name: "New Deal (Instant)",
88
description: "Emit new event when a new deal is created.",
9-
version: "0.0.9",
9+
version: "0.0.10",
1010
type: "source",
1111
dedupe: "unique",
1212
methods: {
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import common from "../common/base.mjs";
2+
3+
export default {
4+
...common,
5+
key: "pipedrive-new-event-instant",
6+
name: "New Event (Instant)",
7+
description: "Emit new event when a new webhook event is received. [See the documentation](https://developers.pipedrive.com/docs/api/v1/Webhooks#addWebhook)",
8+
version: "0.0.1",
9+
type: "source",
10+
dedupe: "unique",
11+
props: {
12+
...common.props,
13+
eventAction: {
14+
type: "string",
15+
label: "Event Action",
16+
description: "The type of action to receive notifications about. Wildcard (*) will match all supported actions.",
17+
options: [
18+
"*",
19+
"create",
20+
"change",
21+
"delete",
22+
],
23+
},
24+
eventObject: {
25+
type: "string",
26+
label: "Event Object",
27+
description: "The type of object to receive notifications about. Wildcard (*) will match all supported objects.",
28+
options: [
29+
"*",
30+
"activity",
31+
"deal",
32+
"lead",
33+
"note",
34+
"organization",
35+
"person",
36+
"pipeline",
37+
"product",
38+
"stage",
39+
"user",
40+
],
41+
},
42+
},
43+
methods: {
44+
...common.methods,
45+
getExtraData() {
46+
return {
47+
event_action: this.eventAction,
48+
event_object: this.eventObject,
49+
};
50+
},
51+
getSummary(body) {
52+
return `New ${body.meta.action}.${body.meta.entity} event`;
53+
},
54+
},
55+
};

components/pipedrive/sources/new-person-instant/new-person-instant.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default {
66
key: "pipedrive-new-person-instant",
77
name: "New Person (Instant)",
88
description: "Emit new event when a new person is created.",
9-
version: "0.0.9",
9+
version: "0.0.10",
1010
type: "source",
1111
dedupe: "unique",
1212
methods: {

components/pipedrive/sources/updated-deal-instant/updated-deal-instant.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default {
77
key: "pipedrive-updated-deal-instant",
88
name: "Deal Updated (Instant)",
99
description: "Emit new event when a deal is updated.",
10-
version: "0.1.2",
10+
version: "0.1.3",
1111
type: "source",
1212
dedupe: "unique",
1313
methods: {

components/pipedrive/sources/updated-lead-instant/updated-lead-instant.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default {
77
key: "pipedrive-updated-lead-instant",
88
name: "Lead Updated (Instant)",
99
description: "Emit new event when a lead is updated.",
10-
version: "0.1.2",
10+
version: "0.1.3",
1111
type: "source",
1212
dedupe: "unique",
1313
methods: {

components/pipedrive/sources/updated-person-instant/updated-person-instant.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default {
77
key: "pipedrive-updated-person-instant",
88
name: "Person Updated (Instant)",
99
description: "Emit new event when a person is updated.",
10-
version: "0.1.2",
10+
version: "0.1.3",
1111
type: "source",
1212
dedupe: "unique",
1313
methods: {

0 commit comments

Comments
 (0)