diff --git a/node-red-grist/add-records.js b/node-red-grist/add-records.js index d2fcb13..d2d1132 100644 --- a/node-red-grist/add-records.js +++ b/node-red-grist/add-records.js @@ -15,7 +15,7 @@ module.exports = function (RED) { const data = Array.isArray(msg.payload) ? msg.payload : [msg.payload] api.addRecords(this.table, data).then(data => { - node.send({ payload: data, topic: this.table }) + node.send({ ...msg, payload: data }) }).catch(reason => done(reason, "Failed to perform grist request to " + url)); }); diff --git a/node-red-grist/get-records.js b/node-red-grist/get-records.js index 4db55d5..0c9b434 100644 --- a/node-red-grist/get-records.js +++ b/node-red-grist/get-records.js @@ -16,7 +16,7 @@ module.exports = function (RED) { node.log(`filter evaluated to: ${JSON.stringify(filter)}`) const api = new GristDocAPI(this.document.docid, { apiKey: this.server.apiKey, server: url }); api.fetchTable(this.table, filter).then(data => { - node.send({ payload: data, topic: this.table }) + node.send({ ...msg, payload: data }) }).catch(reason => done(reason, "Failed to perform grist request to " + url)); }); diff --git a/node-red-grist/update-records.js b/node-red-grist/update-records.js index db797c9..8f218d9 100644 --- a/node-red-grist/update-records.js +++ b/node-red-grist/update-records.js @@ -15,7 +15,7 @@ module.exports = function (RED) { const data = Array.isArray(msg.payload) ? msg.payload : [msg.payload] api.updateRecords(this.table, data).then(data => { - node.send({ payload: data, topic: this.table }) + node.send({ ...msg, payload: data }) }).catch(reason => done(reason, "Failed to perform grist request to " + url)); });