release version 2.2.0

This commit is contained in:
Michael Kolb 2024-08-04 00:47:12 +02:00
parent 77e8c08a25
commit 3b7f1b073d
4 changed files with 66 additions and 154 deletions

View file

@ -55,6 +55,9 @@
<p>
The input message object is available for the <code>filter</code> property via mustache template syntax.
</p>
<p>
<code>msg.filter</code> When leaving the node property 'filter' empty, the filter can be set by the input message property <code>msg.filter</code>.
</p>
<h3>Outputs</h3>
<p>
Array of grist rows (records).

View file

@ -12,7 +12,8 @@ module.exports = function (RED) {
node.on('input', async function (msg, send, done) {
const protocol = this.server.tlsEnabled === true ? "https" : "http";
const url = protocol + "://" + this.server.hostname + ":" + this.server.port;
const filter = this.filter && this.filter !== "" ? JSON.parse(mustache.render(this.filter, { msg })) : undefined
const msg_input_filter = msg.filter ? msg.filter : undefined
const filter = this.filter && this.filter !== "" ? JSON.parse(mustache.render(this.filter, { msg })) : msg_input_filter
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 => {