UNPKG

node-red-contrib-filemaker

Version:

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

145 lines (138 loc) 5.86 kB
<script type="text/javascript"> RED.nodes.registerType("dapi-trigger-script", { category: "FileMaker", defaults: { name: { value: null, required: false }, client: { value: "", type: "dapi-client" }, layout: { value: "payload.layout", required: true }, layoutType: { value: "msg" }, script: { value: "payload.script", required: true }, scriptType: { value: "msg" }, parameter: { value: null, required: false }, parameterType: { value: "none" }, output: { value: "payload", required: true } }, inputs: 1, outputs: 1, icon: "script.png", color: "#39D1C0", paletteLabel: "Script", label: function() { return this.name || "Trigger Script"; }, oneditprepare: function() { var nullType = { value: "none", label: "None", icon: "", hasValue: false }; $("#node-input-layout").typedInput({ default: "msg", types: ["str", "msg", "flow", "global", nullType], typeField: $("#node-input-layoutType") }); $("#node-input-script").typedInput({ default: "msg", types: ["str", "msg", "flow", "global", nullType], typeField: $("#node-input-scriptType") }); $("#node-input-parameter").typedInput({ default: "none", types: ["json", "msg", "flow", "global", nullType], typeField: $("#node-input-parameterType") }); $("#node-input-output").typedInput({ default: "msg", types: ["msg"] }); } }); </script> <script type="text/x-red" data-template-name="dapi-trigger-script"> <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-client"><i class="fa fa-cogs" aria-hidden="true"></i> <span>Client</span></label> <input type="text" id="node-input-client"> </div> <div class="form-row"> <label for="node-input-layout"><i class="fa fa-list-alt" aria-hidden="true"></i> <span>Layout</span></label> <input type="hidden" id="node-input-layoutType"> <input type="text" id="node-input-layout"> </div> <hr> <div class="form-row"> <label for="node-input-script"><i class="fa fa-files-o" aria-hidden="true"></i> <span>Scripts</span></label> <input type="hidden" id="node-input-scriptType"> <input type="text" id="node-input-script"> </div> </div> <div class="form-row"> <label for="node-input-parameter"><i class="fa fa-minus" aria-hidden="true"></i> <span>Parameter</span></label> <input type="hidden" id="node-input-parameterType"> <input type="text" id="node-input-parameter"> </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="hidden" id="node-input-outputType"> <input type="text" id="node-input-output"> </div> </script> <script type="text/x-red" data-help-name="dapi-trigger-script"> <p> This node triggers a FileMaker script. Defaults are <code>msg.payload.layout</code> as the layout context, and <code>msg.payload.script</code> as the script to run. </p> <h3>Inputs</h3> <dl class="message-properties"> <dt>layout<span class="property-type">String</span><dd>The layout to use when running the script.</dd> <dt>script<span class="property-type">string</span><dd>The name of the script to run.</dd> <dt>parameter<span class="property-type">Any</span><dd>The parameter to send to the script.</dd> </dl> <h3>Outputs</h3> <ol class="node-ports"> <li>Standard Output <dl class="message-properties"> <dt>scriptError<span class="property-type">String</span> <dd>A FileMaker error code cast as a string if the script encountered an error.</dd> </dt> <dt>scriptResult<span class="property-type">Object | String</span> <dd>The result of the script. If the result is JSON it will be parsed.</dd> </dt> </dl> </li> <li>Standard Error <dl class="message-properties"> <dt>message<span class="property-type">String</span> <dd>The FileMaker or Data API client error message.</dd> </dt> <dt>error<span class="property-type">String</span> <dd>The applicable FileMaker error code.</dd> </dt> </dl> </li> </ol> <h3>Details</h3> <p> This node will run a specific script in FileMaker. By default this node will use <code>msg.payload.layout</code> as the layout context and <code>msg.payload.script</code> as the script to run. This node can also be configured to call a script with a dynamic parameter. If a script's result is valid JSON it will be automatically parsed. This node is an abstraction of endpoints in the FileMaker Data API.<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> and <code>global</code> contexts.<br/><br/>The default output of this node is <code>msg.payload</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#trigger-script">Trigger Script Method</a> - Base Client Method 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>