Skip to content

Commit b0f14e4

Browse files
committed
updates
1 parent d3e3821 commit b0f14e4

File tree

9 files changed

+29
-17
lines changed

9 files changed

+29
-17
lines changed

components/hubspot/package.json

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

components/hubspot/sources/common/common.mjs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,19 +140,22 @@ export default {
140140
}
141141
}
142142
},
143-
async getPaginatedItems(resourceFn, params) {
143+
async getPaginatedItems(resourceFn, params, after = null) {
144144
const items = [];
145+
const maxPages = 10;
146+
let page = 0;
145147
do {
146148
const {
147149
results, paging,
148150
} = await resourceFn(params);
149151
items.push(...results);
150152
if (paging) {
151153
params.after = paging.next.after;
154+
page++;
152155
} else {
153156
delete params.after;
154157
}
155-
} while (params.after);
158+
} while (params.after && after && page < maxPages);
156159
return items;
157160
},
158161
emitEvent(result) {

components/hubspot/sources/new-company-property-change/new-company-property-change.mjs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default {
77
key: "hubspot-new-company-property-change",
88
name: "New Company Property Change",
99
description: "Emit new event when a specified property is provided or updated on a company. [See the documentation](https://developers.hubspot.com/docs/api/crm/companies)",
10-
version: "0.0.25",
10+
version: "0.0.26",
1111
dedupe: "unique",
1212
type: "source",
1313
props: {
@@ -46,7 +46,7 @@ export default {
4646
return !updatedAfter || this.getTs(company) > updatedAfter;
4747
},
4848
getParams(after) {
49-
return {
49+
const params = {
5050
object: "companies",
5151
data: {
5252
limit: DEFAULT_LIMIT,
@@ -66,16 +66,19 @@ export default {
6666
propertyName: this.property,
6767
operator: "HAS_PROPERTY",
6868
},
69-
{
70-
propertyName: "hs_lastmodifieddate",
71-
operator: "GTE",
72-
value: after,
73-
},
7469
],
7570
},
7671
],
7772
},
7873
};
74+
if (after) {
75+
params.data.filterGroups[0].filters.push({
76+
propertyName: "hs_lastmodifieddate",
77+
operator: "GTE",
78+
value: after,
79+
});
80+
}
81+
return params;
7982
},
8083
batchGetCompanies(inputs) {
8184
return this.hubspot.batchGetObjects({
@@ -104,6 +107,7 @@ export default {
104107
const updatedCompanies = await this.getPaginatedItems(
105108
this.hubspot.searchCRM,
106109
params,
110+
after,
107111
);
108112

109113
if (!updatedCompanies.length) {

components/hubspot/sources/new-contact-property-change/new-contact-property-change.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default {
77
key: "hubspot-new-contact-property-change",
88
name: "New Contact Property Change",
99
description: "Emit new event when a specified property is provided or updated on a contact. [See the documentation](https://developers.hubspot.com/docs/api/crm/contacts)",
10-
version: "0.0.27",
10+
version: "0.0.28",
1111
dedupe: "unique",
1212
type: "source",
1313
props: {
@@ -106,6 +106,7 @@ export default {
106106
const updatedContacts = await this.getPaginatedItems(
107107
this.hubspot.searchCRM,
108108
params,
109+
after,
109110
);
110111

111112
if (!updatedContacts.length) {

components/hubspot/sources/new-custom-object-property-change/new-custom-object-property-change.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default {
77
name: "New Custom Object Property Change",
88
description:
99
"Emit new event when a specified property is provided or updated on a custom object.",
10-
version: "0.0.17",
10+
version: "0.0.18",
1111
dedupe: "unique",
1212
type: "source",
1313
props: {
@@ -113,6 +113,7 @@ export default {
113113
const updatedObjects = await this.getPaginatedItems(
114114
this.hubspot.searchCRM,
115115
params,
116+
after,
116117
);
117118

118119
if (!updatedObjects.length) {

components/hubspot/sources/new-deal-property-change/new-deal-property-change.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default {
77
key: "hubspot-new-deal-property-change",
88
name: "New Deal Property Change",
99
description: "Emit new event when a specified property is provided or updated on a deal. [See the documentation](https://developers.hubspot.com/docs/api/crm/deals)",
10-
version: "0.0.26",
10+
version: "0.0.27",
1111
dedupe: "unique",
1212
type: "source",
1313
props: {
@@ -104,6 +104,7 @@ export default {
104104
const updatedDeals = await this.getPaginatedItems(
105105
this.hubspot.searchCRM,
106106
params,
107+
after,
107108
);
108109

109110
if (!updatedDeals.length) {

components/hubspot/sources/new-note/new-note.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export default {
88
key: "hubspot-new-note",
99
name: "New Note Created",
1010
description: "Emit new event for each new note created. [See the documentation](https://developers.hubspot.com/docs/reference/api/crm/engagements/notes#get-%2Fcrm%2Fv3%2Fobjects%2Fnotes)",
11-
version: "1.0.13",
11+
version: "1.0.14",
1212
type: "source",
1313
dedupe: "unique",
1414
methods: {
@@ -49,7 +49,7 @@ export default {
4949
};
5050
},
5151
async processResults(after, params) {
52-
const notes = await this.getPaginatedItems(this.hubspot.listNotes.bind(this), params);
52+
const notes = await this.getPaginatedItems(this.hubspot.listNotes.bind(this), params, after);
5353
await this.processEvents(notes, after);
5454
},
5555
},

components/hubspot/sources/new-task/new-task.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export default {
99
name: "New Task Created",
1010
description:
1111
"Emit new event for each new task created. [See the documentation](https://developers.hubspot.com/docs/reference/api/crm/engagements/tasks#get-%2Fcrm%2Fv3%2Fobjects%2Ftasks)",
12-
version: "1.0.13",
12+
version: "1.0.14",
1313
type: "source",
1414
dedupe: "unique",
1515
methods: {
@@ -55,6 +55,7 @@ export default {
5555
const tasks = await this.getPaginatedItems(
5656
this.hubspot.listTasks.bind(this),
5757
params,
58+
after,
5859
);
5960
await this.processEvents(tasks, after);
6061
},

components/hubspot/sources/new-ticket-property-change/new-ticket-property-change.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export default {
88
name: "New Ticket Property Change",
99
description:
1010
"Emit new event when a specified property is provided or updated on a ticket. [See the documentation](https://developers.hubspot.com/docs/api/crm/tickets)",
11-
version: "0.0.26",
11+
version: "0.0.27",
1212
dedupe: "unique",
1313
type: "source",
1414
props: {
@@ -108,6 +108,7 @@ export default {
108108
const updatedTickets = await this.getPaginatedItems(
109109
this.hubspot.searchCRM,
110110
params,
111+
after,
111112
);
112113

113114
if (!updatedTickets.length) {

0 commit comments

Comments
 (0)