From 2a0bd0c63b00876cd1bad63a8a615f1545c69189 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Sun, 10 Nov 2024 23:00:33 -0300 Subject: [PATCH 1/3] version bumps --- components/salesforce_rest_api/package.json | 2 +- .../sources/new-record-instant/new-record-instant.mjs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/components/salesforce_rest_api/package.json b/components/salesforce_rest_api/package.json index ccbf2505e532a..c45dc0f43c0be 100644 --- a/components/salesforce_rest_api/package.json +++ b/components/salesforce_rest_api/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/salesforce_rest_api", - "version": "1.3.0", + "version": "1.3.1", "description": "Pipedream Salesforce (REST API) Components", "main": "salesforce_rest_api.app.mjs", "keywords": [ diff --git a/components/salesforce_rest_api/sources/new-record-instant/new-record-instant.mjs b/components/salesforce_rest_api/sources/new-record-instant/new-record-instant.mjs index b512834263831..0367ec90eb6c2 100644 --- a/components/salesforce_rest_api/sources/new-record-instant/new-record-instant.mjs +++ b/components/salesforce_rest_api/sources/new-record-instant/new-record-instant.mjs @@ -7,7 +7,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.1.0", + version: "0.2.0", hooks: { ...common.hooks, async deploy() { From 66ac239eb5424f32a3f216c4ced9ddcd798d63f7 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Mon, 11 Nov 2024 01:02:33 -0300 Subject: [PATCH 2/3] Adding fieldsToObtain prop --- .../new-record-instant/new-record-instant.mjs | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/components/salesforce_rest_api/sources/new-record-instant/new-record-instant.mjs b/components/salesforce_rest_api/sources/new-record-instant/new-record-instant.mjs index 0367ec90eb6c2..15b0187edced6 100644 --- a/components/salesforce_rest_api/sources/new-record-instant/new-record-instant.mjs +++ b/components/salesforce_rest_api/sources/new-record-instant/new-record-instant.mjs @@ -8,6 +8,20 @@ export default { 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.0", + props: { + ...common.props, + fieldsToObtain: { + propDefinition: [ + common.props.salesforce, + "fieldsToObtain", + (c) => ({ + objType: c.objectType, + }), + ], + optional: true, + description: "Select the field(s) to be retrieved for the records. Only applicable if the source is running on a timer. If running on a webhook, or if not specified, all fields will be retrieved.", + }, + }, hooks: { ...common.hooks, async deploy() { @@ -118,8 +132,11 @@ export default { setObjectTypeColumns, } = this; - const { fields } = await getObjectTypeDescription(objectType); - const columns = fields.map(({ name }) => name); + let columns = this.fieldsToObtain; + if (!columns) { + const { fields } = await getObjectTypeDescription(objectType); + columns = fields.map(({ name }) => name); + } setObjectTypeColumns(columns); }, From 780801482d2510289dd1ed3b00bc70af56550758 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Mon, 11 Nov 2024 02:24:07 -0300 Subject: [PATCH 3/3] Adjustments --- .../sources/new-record-instant/new-record-instant.mjs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/salesforce_rest_api/sources/new-record-instant/new-record-instant.mjs b/components/salesforce_rest_api/sources/new-record-instant/new-record-instant.mjs index 15b0187edced6..382ba6a826ba5 100644 --- a/components/salesforce_rest_api/sources/new-record-instant/new-record-instant.mjs +++ b/components/salesforce_rest_api/sources/new-record-instant/new-record-instant.mjs @@ -54,7 +54,7 @@ export default { Id: id, } = item; const entityType = startCase(objectType); - const summary = `New ${entityType} created: ${name}`; + const summary = `New ${entityType} created: ${name ?? id}`; const ts = Date.parse(createdDate); return { id, @@ -71,7 +71,7 @@ export default { [nameField]: name, } = newObject; const entityType = startCase(this.objectType).toLowerCase(); - const summary = `New ${entityType} created: ${name}`; + const summary = `New ${entityType} created: ${name ?? id}`; const ts = Date.parse(createdDate); return { id, @@ -133,7 +133,7 @@ export default { } = this; let columns = this.fieldsToObtain; - if (!columns) { + if (!columns?.length) { const { fields } = await getObjectTypeDescription(objectType); columns = fields.map(({ name }) => name); }