Skip to content
Merged
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/hubspot/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/hubspot",
"version": "1.7.6",
"version": "1.7.7",
"description": "Pipedream Hubspot Components",
"main": "hubspot.app.mjs",
"keywords": [
Expand Down
10 changes: 6 additions & 4 deletions components/hubspot/sources/common/common.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export default {
async processEvents(resources, after) {
let maxTs = after || 0;
for (const result of resources) {
if (await this.isRelevant(result, after)) {
if (!after || await this.isRelevant(result, after)) {
this.emitEvent(result);
const ts = this.getTs(result);
if (ts > maxTs) {
Expand All @@ -80,8 +80,10 @@ export default {

for (const result of results) {
const ts = this.getTs(result);
if (!after || ts > after) {
if (await this.isRelevant(result, after, ts)) {
// Adding ts && !after to handle the case where ts is null
// (e.g. when using deletedAt as the ts field for deleted items)
if ((ts && !after) || ts > after) {
if (!after || await this.isRelevant(result, after, ts)) {
this.emitEvent(result);
}
if (ts > maxTs) {
Expand Down Expand Up @@ -124,7 +126,7 @@ export default {
items = results;
}
for (const item of items) {
if (await this.isRelevant(item, after)) {
if (!after || await this.isRelevant(item, after)) {
this.emitEvent(item);
const ts = this.getTs(item);
if (ts > maxTs) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
export default {
...common,
key: "hubspot-delete-blog-article",
name: "Deleted Blog Posts",

Check warning on line 7 in components/hubspot/sources/delete-blog-article/delete-blog-article.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 for each deleted blog post.",
version: "0.0.33",
version: "0.0.34",
dedupe: "unique",
type: "source",
methods: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
key: "hubspot-new-company-property-change",
name: "New Company Property Change",
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)",
version: "0.0.26",
version: "0.0.27",
dedupe: "unique",
type: "source",
props: {
Expand Down Expand Up @@ -43,7 +43,7 @@ export default {
};
},
isRelevant(company, updatedAfter) {
return !updatedAfter || this.getTs(company) > updatedAfter;
return this.getTs(company) > updatedAfter;
},
getParams(after) {
const params = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
name: "New Contact Added to List",
description:
"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)",
version: "0.0.5",
version: "0.0.6",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

🧩 Analysis chain

Version bump only, but source still skips first run; align with PR goal to emit when ts is falsy

This source seeds and returns early when no last timestamp (Lines 154–158), which prevents emitting on first run. The PR objective is to always emit when ts is falsy. Recommend removing the early return and making the comparison include the falsy-ts case.

Apply:

@@
-        if (!lastMembershipTimestamp) {
-          const baselineTimestamp = new Date().toISOString();
-          this._setLastMembershipTimestamp(listId, baselineTimestamp);
-          return newMemberships;
-        }
+        // Emit on first run when no prior timestamp exists
+        // (do not seed-and-skip; we'll set the latest seen at the end)
@@
-            if (membershipTimestamp > lastMembershipTimestamp) {
+            if (!lastMembershipTimestamp || membershipTimestamp > lastMembershipTimestamp) {
               newMemberships.push({
                 membership,
                 listInfo,
               });
 
               if (
-                !latestMembershipTimestamp ||
-                membershipTimestamp > latestMembershipTimestamp
+                !latestMembershipTimestamp ||
+                membershipTimestamp > latestMembershipTimestamp
               ) {
                 latestMembershipTimestamp = membershipTimestamp;
               }
             }

Optionally, for robustness, compare numeric timestamps instead of ISO strings to avoid format pitfalls; I can provide that diff if desired. Please confirm this behavior matches your centralized isRelevant semantics.

Also applies to: 154-158, 183-195


🏁 Script executed:

#!/bin/bash
set -euo pipefail
file=$(rg --hidden --files | rg "components/hubspot/sources/new-contact-added-to-list/new-contact-added-to-list.mjs" || true)
if [[ -z "$file" ]]; then
  file=$(rg --hidden --files | rg "new-contact-added-to-list.mjs" || true)
fi
if [[ -z "$file" ]]; then
  echo "FILE_NOT_FOUND"
  exit 0
fi
echo "FILE: $file"
nl -ba "$file"
echo
echo "--- relevant identifier matches ---"
rg -n --hidden "lastMembershipTimestamp|_setLastMembershipTimestamp|membershipTimestamp|baselineTimestamp|latestMembershipTimestamp" "$file" -n -C3 || true

Length of output: 130


🏁 Script executed:

#!/bin/bash
set -euo pipefail

file=$(rg --hidden --files | rg "components/hubspot/sources/new-contact-added-to-list/new-contact-added-to-list.mjs" || true)
if [[ -z "$file" ]]; then
  file=$(rg --hidden --files | rg "new-contact-added-to-list.mjs" || true)
fi
if [[ -z "$file" ]]; then
  echo "FILE_NOT_FOUND"
  exit 0
fi

echo "FILE: $file"
echo
echo "----- lines 1-30 -----"
awk 'NR>=1 && NR<=30 {printf "%4d: %s\n", NR, $0}' "$file" || true
echo
echo "----- lines 140-210 -----"
awk 'NR>=140 && NR<=210 {printf "%4d: %s\n", NR, $0}' "$file" || true
echo
echo "----- identifier matches (with context) -----"
rg -n --hidden "lastMembershipTimestamp|_setLastMembershipTimestamp|membershipTimestamp|baselineTimestamp|latestMembershipTimestamp" "$file" -n -C3 || true

Length of output: 6064


Emit on first run: remove seed-and-skip and include falsy ts in comparison

The code currently seeds-and-returns when lastMembershipTimestamp is falsy (lines 154–158), preventing any emits on first run — remove the early return and treat a falsy lastMembershipTimestamp as "emit everything seen" by changing the comparison. Applies to lines 154–158 and 183–195.

Apply:

@@
-        if (!lastMembershipTimestamp) {
-          const baselineTimestamp = new Date().toISOString();
-          this._setLastMembershipTimestamp(listId, baselineTimestamp);
-          return newMemberships;
-        }
+        // Emit on first run when no prior timestamp exists
+        // (do not seed-and-skip; we'll set the latest seen at the end)
@@
-            if (membershipTimestamp > lastMembershipTimestamp) {
+            if (!lastMembershipTimestamp || membershipTimestamp > lastMembershipTimestamp) {
               newMemberships.push({
                 membership,
                 listInfo,
               });
 
               if (
-                !latestMembershipTimestamp ||
-                membershipTimestamp > latestMembershipTimestamp
+                !latestMembershipTimestamp ||
+                membershipTimestamp > latestMembershipTimestamp
               ) {
                 latestMembershipTimestamp = membershipTimestamp;
               }
             }

Optional: compare numeric timestamps (Date.getTime()) instead of ISO strings for robustness. Confirm this matches your centralized isRelevant semantics.

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In
components/hubspot/sources/new-contact-added-to-list/new-contact-added-to-list.mjs
around lines 154–158 and 183–195, the code currently seeds-and-skips when
lastMembershipTimestamp is falsy which prevents any emits on first run; remove
the early return and change the membership timestamp comparison so that a falsy
lastMembershipTimestamp is treated as "emit everything seen" (i.e., when
lastMembershipTimestamp is falsy, consider all events as newer), and use numeric
timestamps (Date.getTime() or Number(new Date(...))) for comparisons instead of
ISO string comparison to match centralized isRelevant semantics.

type: "source",
dedupe: "unique",
props: {
...common.props,
info: {

Check warning on line 20 in components/hubspot/sources/new-contact-added-to-list/new-contact-added-to-list.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop info must have a description. See https://pipedream.com/docs/components/guidelines/#props

Check warning on line 20 in components/hubspot/sources/new-contact-added-to-list/new-contact-added-to-list.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop info must have a label. See https://pipedream.com/docs/components/guidelines/#props
type: "alert",
alertType: "info",
content: `Properties:\n\`${DEFAULT_CONTACT_PROPERTIES.join(", ")}\``,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
key: "hubspot-new-contact-property-change",
name: "New Contact Property Change",
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)",
version: "0.0.28",
version: "0.0.29",
dedupe: "unique",
type: "source",
props: {
Expand Down Expand Up @@ -43,7 +43,7 @@ export default {
};
},
isRelevant(contact, updatedAfter) {
return !updatedAfter || this.getTs(contact) > updatedAfter;
return this.getTs(contact) > updatedAfter;
},
getParams(after) {
const params = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
name: "New Custom Object Property Change",
description:
"Emit new event when a specified property is provided or updated on a custom object.",
version: "0.0.18",
version: "0.0.19",
dedupe: "unique",
type: "source",
props: {
Expand Down Expand Up @@ -49,7 +49,7 @@ export default {
};
},
isRelevant(object, updatedAfter) {
return !updatedAfter || this.getTs(object) > updatedAfter;
return this.getTs(object) > updatedAfter;
},
getParams(after) {
const params = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default {
key: "hubspot-new-deal-in-stage",
name: "New Deal In Stage",
description: "Emit new event for each new deal in a stage.",
version: "0.0.39",
version: "0.0.40",
dedupe: "unique",
type: "source",
props: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
key: "hubspot-new-deal-property-change",
name: "New Deal Property Change",
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)",
version: "0.0.27",
version: "0.0.28",
dedupe: "unique",
type: "source",
props: {
Expand Down Expand Up @@ -41,7 +41,7 @@ export default {
};
},
isRelevant(deal, updatedAfter) {
return !updatedAfter || this.getTs(deal) > updatedAfter;
return this.getTs(deal) > updatedAfter;
},
getParams(after) {
const params = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default {
key: "hubspot-new-email-event",
name: "New Email Event",
description: "Emit new event for each new Hubspot email event.",
version: "0.0.36",
version: "0.0.37",
dedupe: "unique",
type: "source",
props: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "hubspot-new-email-subscriptions-timeline",
name: "New Email Subscriptions Timeline",
description: "Emit new event when a new email timeline subscription is added for the portal.",
version: "0.0.33",
version: "0.0.34",
dedupe: "unique",
type: "source",
methods: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default {
key: "hubspot-new-engagement",
name: "New Engagement",
description: "Emit new event for each new engagement created. This action returns a maximum of 5000 records at a time, make sure you set a correct time range so you don't miss any events",
version: "0.0.38",
version: "0.0.39",
dedupe: "unique",
type: "source",
props: {
Expand Down
2 changes: 1 addition & 1 deletion components/hubspot/sources/new-event/new-event.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default {
key: "hubspot-new-event",
name: "New Events",
description: "Emit new event for each new Hubspot event. Note: Only available for Marketing Hub Enterprise, Sales Hub Enterprise, Service Hub Enterprise, or CMS Hub Enterprise accounts",
version: "0.0.37",
version: "0.0.38",
dedupe: "unique",
type: "source",
props: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "hubspot-new-form-submission",
name: "New Form Submission",
description: "Emit new event for each new submission of a form.",
version: "0.0.38",
version: "0.0.39",
dedupe: "unique",
type: "source",
props: {
Expand Down Expand Up @@ -36,7 +36,7 @@ export default {
}

for (const result of results) {
if (await this.isRelevant(result, after)) {
if (!after || await this.isRelevant(result, after)) {
const form = await this.hubspot.getFormDefinition({
formId: params.formId,
});
Expand Down
2 changes: 1 addition & 1 deletion components/hubspot/sources/new-note/new-note.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default {
key: "hubspot-new-note",
name: "New Note Created",
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)",
version: "1.0.14",
version: "1.0.15",
type: "source",
dedupe: "unique",
methods: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
key: "hubspot-new-or-updated-blog-article",
name: "New or Updated Blog Post",
description: "Emit new event for each new or updated blog post in Hubspot.",
version: "0.0.20",
version: "0.0.21",
dedupe: "unique",
type: "source",
props: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
key: "hubspot-new-or-updated-company",
name: "New or Updated Company",
description: "Emit new event for each new or updated company in Hubspot.",
version: "0.0.20",
version: "0.0.21",
dedupe: "unique",
type: "source",
props: {
...common.props,
info: {

Check warning on line 18 in components/hubspot/sources/new-or-updated-company/new-or-updated-company.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop info must have a description. See https://pipedream.com/docs/components/guidelines/#props

Check warning on line 18 in components/hubspot/sources/new-or-updated-company/new-or-updated-company.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop info must have a label. See https://pipedream.com/docs/components/guidelines/#props
type: "alert",
alertType: "info",
content: `Properties:\n\`${DEFAULT_COMPANY_PROPERTIES.join(", ")}\``,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
key: "hubspot-new-or-updated-contact",
name: "New or Updated Contact",
description: "Emit new event for each new or updated contact in Hubspot.",
version: "0.0.21",
version: "0.0.22",
dedupe: "unique",
type: "source",
props: {
...common.props,
info: {

Check warning on line 18 in components/hubspot/sources/new-or-updated-contact/new-or-updated-contact.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop info must have a description. See https://pipedream.com/docs/components/guidelines/#props

Check warning on line 18 in components/hubspot/sources/new-or-updated-contact/new-or-updated-contact.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop info must have a label. See https://pipedream.com/docs/components/guidelines/#props
type: "alert",
alertType: "info",
content: `Properties:\n\`${DEFAULT_CONTACT_PROPERTIES.join(", ")}\``,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
key: "hubspot-new-or-updated-crm-object",
name: "New or Updated CRM Object",
description: "Emit new event each time a CRM Object of the specified object type is updated.",
version: "0.0.33",
version: "0.0.34",
dedupe: "unique",
type: "source",
props: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
key: "hubspot-new-or-updated-custom-object",
name: "New or Updated Custom Object",
description: "Emit new event each time a Custom Object of the specified schema is updated.",
version: "0.0.22",
version: "0.0.23",
dedupe: "unique",
type: "source",
props: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
key: "hubspot-new-or-updated-deal",
name: "New or Updated Deal",
description: "Emit new event for each new or updated deal in Hubspot",
version: "0.0.20",
version: "0.0.21",
dedupe: "unique",
type: "source",
props: {
...common.props,
info: {

Check warning on line 18 in components/hubspot/sources/new-or-updated-deal/new-or-updated-deal.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop info must have a description. See https://pipedream.com/docs/components/guidelines/#props

Check warning on line 18 in components/hubspot/sources/new-or-updated-deal/new-or-updated-deal.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop info must have a label. See https://pipedream.com/docs/components/guidelines/#props
type: "alert",
alertType: "info",
content: `Properties:\n\`${DEFAULT_DEAL_PROPERTIES.join(", ")}\``,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
key: "hubspot-new-or-updated-line-item",
name: "New or Updated Line Item",
description: "Emit new event for each new line item added or updated in Hubspot.",
version: "0.0.20",
version: "0.0.21",
dedupe: "unique",
type: "source",
props: {
...common.props,
info: {

Check warning on line 18 in components/hubspot/sources/new-or-updated-line-item/new-or-updated-line-item.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop info must have a label. See https://pipedream.com/docs/components/guidelines/#props
type: "alert",
alertType: "info",
content: `Properties:\n\`${DEFAULT_LINE_ITEM_PROPERTIES.join(", ")}\``,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default {
key: "hubspot-new-or-updated-product",
name: "New or Updated Product",
description: "Emit new event for each new or updated product in Hubspot.",
version: "0.0.20",
version: "0.0.21",
dedupe: "unique",
type: "source",
props: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
name: "New Social Media Message",
description:
"Emit new event when a message is posted from HubSpot to the specified social media channel. Note: Only available for Marketing Hub Enterprise accounts",
version: "0.0.33",
version: "0.0.34",
type: "source",
dedupe: "unique",
props: {
Expand Down
2 changes: 1 addition & 1 deletion components/hubspot/sources/new-task/new-task.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default {
name: "New Task Created",
description:
"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)",
version: "1.0.14",
version: "1.0.15",
type: "source",
dedupe: "unique",
methods: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default {
name: "New Ticket Property Change",
description:
"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)",
version: "0.0.27",
version: "0.0.28",
dedupe: "unique",
type: "source",
props: {
Expand Down Expand Up @@ -44,7 +44,7 @@ export default {
};
},
isRelevant(ticket, updatedAfter) {
return !updatedAfter || this.getTs(ticket) > updatedAfter;
return this.getTs(ticket) > updatedAfter;
},
getParams(after) {
const params = {
Expand Down
2 changes: 1 addition & 1 deletion components/hubspot/sources/new-ticket/new-ticket.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default {
key: "hubspot-new-ticket",
name: "New Ticket",
description: "Emit new event for each new ticket created.",
version: "0.0.33",
version: "0.0.34",
dedupe: "unique",
type: "source",
props: {
Expand Down
Loading