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/salesforce_rest_api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/salesforce_rest_api",
"version": "1.9.0",
"version": "1.9.1",
"description": "Pipedream Salesforce (REST API) Components",
"main": "salesforce_rest_api.app.mjs",
"keywords": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
export default {
...common,
type: "source",
name: "Case Updated (Instant, of Selectable Type)",

Check warning on line 7 in components/salesforce_rest_api/sources/case-updated-instant/case-updated-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
key: "salesforce_rest_api-case-updated-instant",
description: "Emit new event when a case is updated. [See the documentation](https://sforce.co/3yPSJZy)",
version: "0.0.3",
version: "0.0.4",
props: {
salesforce: common.props.salesforce,
db: "$.service.db",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,20 @@ export default {
const nameField = await this.salesforce.getNameFieldForObjectType(objectType);
this.setNameField(nameField);

// emit historical events
const { recentItems } = await this.salesforce.listSObjectTypeIds(objectType);
const ids = recentItems.map((item) => item.Id);
for (const id of ids.slice(-25)) {
const object = await this.salesforce.getSObject(objectType, id);
const event = {
body: {
"New": object,
"UserId": id,
},
};
const meta = this.generateWebhookMeta(event);
this.$emit(event.body, meta);
if (!this.skipFirstRun) {
const { recentItems } = await this.salesforce.listSObjectTypeIds(objectType);
const ids = recentItems.map((item) => item.Id);
for (const id of ids.slice(-25)) {
const object = await this.salesforce.getSObject(objectType, id);
const event = {
body: {
"New": object,
"UserId": id,
},
};
const meta = this.generateWebhookMeta(event);
this.$emit(event.body, meta);
}
}
},
async activate() {
Expand Down
8 changes: 8 additions & 0 deletions components/salesforce_rest_api/sources/common/common.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,15 @@ export default {
console.log("Ignoring timer event (webhook active)");
return;
}

const startTimestamp = this.getLatestDateCovered();

if (this.skipFirstRun && !startTimestamp) {
const now = new Date().toISOString();
this.setLatestDateCovered(now);
return;
}

const endTimestamp = new Date(event.timestamp * 1000).toISOString();
const timeDiffSec = Math.floor(
(Date.parse(endTimestamp) - Date.parse(startTimestamp)) / 1000,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
export default {
...common,
type: "source",
name: "Email Template Updated (Instant, of Selectable Type)",

Check warning on line 7 in components/salesforce_rest_api/sources/email-template-updated-instant/email-template-updated-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
key: "salesforce_rest_api-email-template-updated-instant",
description: "Emit new event when an email template is updated. [See the documentation](https://sforce.co/3yPSJZy)",
version: "0.0.3",
version: "0.0.4",
props: {
salesforce: common.props.salesforce,
db: "$.service.db",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
export default {
...common,
type: "source",
name: "Knowledge Article Updated (Instant, of Selectable Type)",

Check warning on line 7 in components/salesforce_rest_api/sources/knowledge-article-updated-instant/knowledge-article-updated-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
key: "salesforce_rest_api-knowledge-article-updated-instant",
description: "Emit new event when a knowledge article is updated. [See the documentation](https://sforce.co/3yPSJZy)",
version: "0.0.3",
version: "0.0.4",
props: {
salesforce: common.props.salesforce,
db: "$.service.db",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
name: "New Case (Instant, of Selectable Type)",
key: "salesforce_rest_api-new-case-instant",
description: "Emit new event when a case is created. [See the documentation](https://sforce.co/3yPSJZy)",
version: "0.0.3",
version: "0.0.4",
props: {
salesforce: common.props.salesforce,
db: "$.service.db",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
name: "New Email Template (Instant, of Selectable Type)",
key: "salesforce_rest_api-new-email-template-instant",
description: "Emit new event when an email template is created. [See the documentation](https://sforce.co/3yPSJZy)",
version: "0.0.3",
version: "0.0.4",
props: {
salesforce: common.props.salesforce,
db: "$.service.db",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
name: "New Knowledge Article (Instant, of Selectable Type)",
key: "salesforce_rest_api-new-knowledge-article-instant",
description: "Emit new event when a knowledge article is created. [See the documentation](https://sforce.co/3yPSJZy)",
version: "0.0.3",
version: "0.0.4",
props: {
salesforce: common.props.salesforce,
db: "$.service.db",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
name: "New Outbound Message (Instant)",
key: "salesforce_rest_api-new-outbound-message",
description: "Emit new event when a new outbound message is received in Salesforce.",
version: "0.1.9",
version: "0.1.10",
dedupe: "unique",
props: {
db: "$.service.db",
Expand All @@ -15,7 +15,7 @@
customResponse: true,
},
salesforce,
infoBox: {

Check warning on line 18 in components/salesforce_rest_api/sources/new-outbound-message/new-outbound-message.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

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

Check warning on line 18 in components/salesforce_rest_api/sources/new-outbound-message/new-outbound-message.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop infoBox must have a label. See https://pipedream.com/docs/components/guidelines/#props
type: "alert",
alertType: "info",
content: `See Salesforce's guide on [setting up Outbound Messaging](https://sforce.co/3JbZJom).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
name: "New Record (Instant, of Selectable Type)",
key: "salesforce_rest_api-new-record-instant",
description: "Emit new event when a record of the selected object type is created. [See the documentation](https://sforce.co/3yPSJZy)",
version: "0.2.3",
version: "0.2.4",
props: {
...common.props,
fieldsToObtain: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
name: "New Deleted Record (Instant, of Selectable Type)",
key: "salesforce_rest_api-record-deleted-instant",
description: "Emit new event when a record of the selected object type is deleted. [See the documentation](https://sforce.co/3msDDEE)",
version: "0.1.3",
version: "0.1.4",
methods: {
...common.methods,
generateWebhookMeta(data) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
name: "New Updated Record (Instant, of Selectable Type)",
key: "salesforce_rest_api-record-updated-instant",
description: "Emit new event when a record of the selected type is updated. [See the documentation](https://sforce.co/3yPSJZy)",
version: "0.2.3",
version: "0.2.4",
props: {
...common.props,
fields: {
Expand All @@ -24,6 +24,13 @@ export default {
optional: true,
description: "If specified, events will only be emitted if at least one of the selected fields is updated. This filter is only available when a webhook is created successfully.",
},
skipFirstRun: {
type: "boolean",
label: "Skip existing records when first activated",
description: "When enabled, this trigger will ignore all existing records and only watch for updates that happen after activation. When disabled, it will process existing records on first run.",
optional: true,
default: false,
},
},
methods: {
...common.methods,
Expand Down
Loading