Skip to content

Commit a6b99c9

Browse files
authored
Hubspot - bug fix to sources w/ property changes (#18379)
* updates * versions
1 parent c08f93b commit a6b99c9

File tree

26 files changed

+46
-34
lines changed

26 files changed

+46
-34
lines changed

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/delete-blog-article/delete-blog-article.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default {
66
key: "hubspot-delete-blog-article",
77
name: "Deleted Blog Posts",
88
description: "Emit new event for each deleted blog post.",
9-
version: "0.0.32",
9+
version: "0.0.33",
1010
dedupe: "unique",
1111
type: "source",
1212
methods: {

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-added-to-list/new-contact-added-to-list.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export default {
1212
name: "New Contact Added to List",
1313
description:
1414
"Emit new event when a contact is added to a HubSpot list. [See the documentation](https://developers.hubspot.com/docs/reference/api/crm/lists#get-%2Fcrm%2Fv3%2Flists%2F%7Blistid%7D%2Fmemberships%2Fjoin-order)",
15-
version: "0.0.4",
15+
version: "0.0.5",
1616
type: "source",
1717
dedupe: "unique",
1818
props: {

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-in-stage/new-deal-in-stage.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export default {
1111
key: "hubspot-new-deal-in-stage",
1212
name: "New Deal In Stage",
1313
description: "Emit new event for each new deal in a stage.",
14-
version: "0.0.38",
14+
version: "0.0.39",
1515
dedupe: "unique",
1616
type: "source",
1717
props: {

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-email-event/new-email-event.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export default {
88
key: "hubspot-new-email-event",
99
name: "New Email Event",
1010
description: "Emit new event for each new Hubspot email event.",
11-
version: "0.0.35",
11+
version: "0.0.36",
1212
dedupe: "unique",
1313
type: "source",
1414
props: {

components/hubspot/sources/new-email-subscriptions-timeline/new-email-subscriptions-timeline.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default {
66
key: "hubspot-new-email-subscriptions-timeline",
77
name: "New Email Subscriptions Timeline",
88
description: "Emit new event when a new email timeline subscription is added for the portal.",
9-
version: "0.0.32",
9+
version: "0.0.33",
1010
dedupe: "unique",
1111
type: "source",
1212
methods: {

0 commit comments

Comments
 (0)