UNPKG

node-red-contrib-filemaker

Version:

Node-RED FileMaker nodes. These nodes use the FileMaker Data API to connect with a FileMaker database.

131 lines (124 loc) 5.69 kB
<script type="text/javascript"> RED.nodes.registerType("dapi-transform", { category: "FileMaker", defaults: { name: { value: null, required: false }, parameters: { value: null, required: false }, parameterType: { value: "none", required: false }, data: { value: "payload.data", required: false }, dataType: { value: "msg" }, output: { value: "payload.data", required: true } }, inputs: 1, outputs: 1, icon: "transform.png", color: "#39D1C0", paletteLabel: "Transform", label: function() { return this.name || "Transform Response"; }, oneditprepare: function() { var nullType = { value: "none", label: "None", icon: "", hasValue: false }; $("#node-input-data").typedInput({ default: "msg", types: ["json", "msg", "flow", "global"], typeField: $("#node-input-dataType") }); $("#node-input-parameters").typedInput({ default: "none", types: ["msg", "json", "flow", "global", nullType], typeField: $("#node-input-parametersType") }); $("#node-input-output").typedInput({ default: "msg", types: ["msg"] }); } }); </script> <script type="text/x-red" data-template-name="dapi-transform"> <div class="form-row"> <label for="node-input-name"><i class="fa fa-tag" aria-hidden="true"></i> <span>Name</span></label> <input type="text" id="node-input-name" placeholder="Specific Node"> </div> <hr> <div class="form-row"> <label for="node-input-data"><i class="fa fa-align-left" aria-hidden="true"></i> <span>Data</span></label> <input type="hidden" id="node-input-dataType"> <input type="text" id="node-input-data"> </div> <hr> <div class="form-row"> <label for="node-input-parameters"><i class="fa fa-list" aria-hidden="true"></i> <span>Parameters</span></label> <input type="hidden" id="node-input-parametersType"> <input type="text" id="node-input-parameters"> </div> <hr> <div class="form-row"> <label for="node-input-output"><i class="fa fa-arrow-circle-o-right" aria-hidden="true"></i> <span>Output</span></label> <input type="text" id="node-input-output"> </div> </script> <script type="text/x-red" data-help-name="dapi-transform"> <p> This node transforms data in <code>msg.payload.data</code>. It reduces <code>{ table::field : value }</code> properties to <code>{ table: { field : value } }</code> properties. </p> <h3>Outputs</h3> <ol class="node-ports"> <li>Standard Output <dl class="message-properties"> <dt>data<span class="property-type">Array | Object</span> <dd>Data can be either a single object or an array of objects.</dd> </dt> <dt class="optional">parameters <span class="property-type">Object</span> <dd><b>fieldData</b> - <i>Boolean</i><br/>whether to include fieldData in the result</dd> <dd><b>portalData</b> - <i>Boolean</i><br/>whether to include portalData in the result.</dd> <dd><b>convert</b> - <i>Boolean</i><br/>Whether to transform <code>table::field</code> properties.</dd> </dt> </dl> </li> <li>Standard Error <dl class="message-properties"> <dt>message<span class="property-type">String</span> <dd>A node generated error message.</dd> </dt> </dl> </li> </ol> <h3>Outputs</h3> <ol class="node-ports"> <li>Standard output <dl class="message-properties"> <dt>data<span class="property-type">Array | Object</span> <dd>The transformed data.</dd> </dt> </dl> </li> <li>Standard Error <dl class="message-properties"> <dt>message<span class="property-type">String</span> <dd>A node generated error message.</dd> </dt> </dl> </li> </ol> <h3>Details</h3> <p> This node transforms Data API record data. This node will traverse the incoming data and convert <code>{ table::field : value }</code> properties to <code>{ table: { field : value } }</code>.This node will also move portal and field data properties into the main object. This node also accepts an additional parameters object.<a target="_blank" href="https://github.com/Luidog/fms-api-client#transform-utility-results"> See Example.</a><br/><br/>The parameters object can have three boolean properties. The <code>convert</code> property controls the transformation of <code>table::field</code> properties. The <code>fieldData</code> property controls the merging of field data into to the result. The <code>portalData</code> property controls the merging of portal data to the result.<br/><br/>Provide a parameter object and set one of the parameters to <code>false</code> to turn off that parameter.<br/><br/>This node can be configured to use either static or dynamic input parameters. Dynamic parameters may be read from either the <code>msg</code> property or the <code>flow</code> or <code>global</code> context.<br/><br/>The default output of this node is <code>msg.payload.data</code>. This node can also be configured to merge its output with any property on the <code>msg</code> object. </p> <h3>References</h3> <ul> <li><a href="https://github.com/Luidog/fms-api-client#transform-utility">Transform Utility</a> - Base Client Utility Documentation</li> <li><a href="https://github.com/Luidog/node-red-contrib-filemaker">Node-RED FileMaker</a> - The Node's Github Repository</li> <li><a href="https://github.com/Luidog/fms-api-client">Data API Client</a> - Data API Client Github Repository</li> </ul> </script>