node-red-contrib-filemaker
Version:
Node-RED FileMaker nodes. These nodes use the FileMaker Data API to connect with a FileMaker database.
176 lines (169 loc) • 8.29 kB
HTML
<script type="text/javascript">
RED.nodes.registerType("dapi-upload-file", {
category: "FileMaker",
defaults: {
name: { value: null, required: false },
client: { value: "", type: "dapi-client" },
layout: {
value: "payload.layout",
required: true
},
layoutType: { value: "msg" },
file: { value: "payload.file" },
fileType: { value: "msg" },
field: { value: "payload.field", required: true },
fieldType: { value: "msg" },
recordId: { value: null, required: false },
recordIdType: { value: "" },
parameters: { value: null, required: false },
parametersType: { value: "none" },
output: { value: "payload", required: true }
},
inputs: 1,
outputs: 1,
icon: "upload.png",
color: "#39D1C0",
paletteLabel: "Upload",
label: function() {
return this.name || "Upload File";
},
oneditprepare: function() {
var nullType = { value: "none", label: "None", icon: "", hasValue: false };
$("#node-input-layout").typedInput({
default: "msg",
types: ["str", "msg", "flow", "global"],
typeField: $("#node-input-layoutType")
});
$("#node-input-layout").typedInput({
default: "msg",
types: ["str", "msg", "flow", "global"],
typeField: $("#node-input-layoutType")
});
$("#node-input-file").typedInput({
default: "msg",
types: ["msg", "flow", "global", "bin", "json"],
typeField: $("#node-input-fileType")
});
$("#node-input-field").typedInput({
default: "msg",
types: ["str", "msg", "flow", "global", "json"],
typeField: $("#node-input-fieldType")
});
$("#node-input-recordId").typedInput({
default: "none",
types: [nullType, "num", "msg", "flow", "global"],
typeField: $("#node-input-recordIdType")
});
$("#node-input-parameters").typedInput({
default: "none",
types: ["json", "msg", "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-upload-file">
<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-file"><i class="fa fa-file-o" aria-hidden="true"></i> <span>File</span></label>
<input type="hidden" id="node-input-fileType">
<input type="text" id="node-input-file">
</div>
<div class="form-row">
<label for="node-input-field"><i class="fa fa-minus-square-o" aria-hidden="true"></i> <span>Field</span></label>
<input type="hidden" id="node-input-fieldType">
<input type="text" id="node-input-field">
</div>
<div class="form-row">
<label for="node-input-recordId"><i class="fa fa-bullseye" aria-hidden="true"></i> <span>Record Id</span></label>
<input type="hidden" id="node-input-recordIdType">
<input type="text" id="node-input-recordId">
</div>
<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-upload-file">
<p>
This node uploads binary data to a FileMaker container. Defaults are <code>msg.payload.file</code> as the file to upload and <code>msg.payload.layout</code> as the layout context.
</p>
<h3>Inputs</h3>
<dl class="message-properties">
<dt>file<span class="property-type">String | Object</span><dd>a path or buffer object to upload to FileMaker.</dd>
<dt>layout<span class="property-type">String</span><dd>The layout to use when uploading a file.</dd>
<dt>field<span class="property-type">String</span><dd>The name of the container field to insert a file into.</dd>
<dt>recordId<span class="property-type">String | Number</span><dd>The record id to target when uploading a file. If omitted a new record will be created.</dd>
<dt class="optional">parameters <span class="property-type">Object</span>
<dd><b>fieldRepetition</b> - <i>String | Number</i><br/>Container field repetition to upload the data.</dd>
<dd><b>timeout</b> - <i>Number</i><br/>Timeout for the request. The default is <code>0</code> - no timeout.</dd>
<dd><b>agent</b> - <i>Object</i><br/>Agent to use when making the request.<a target="_blank" href="https://github.com/Luidog/fms-api-client#custom-request-agents"> More Info.</a></dd></dd>
<dd><b>proxy</b> - <i>Object</i><br/>Proxy server to use when making the request.<a target="_blank" href="https://github.com/Luidog/fms-api-client#proxies"> More Info.</a></dd></dd>
</dt>
</dl>
<h3>Outputs</h3>
<ol class="node-ports">
<li>Standard Output
<dl class="message-properties">
<dt>recordId<span class="property-type">String</span>
<dd>The record id for the created or updated record.</dd>
</dt>
<dt>modId<span class="property-type">String</span>
<dd>The modification Id for the created or updated record.</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 uploads binary data to a FileMaker container field. By default this node will use a value in <code>msg.payload.file</code>
as the file to insert into a container field. If the <code>file</code> property is a <code>string</code> it will be treated as a <code>path</code> relative to the Node
Red process. This node can also handle buffered data in the form of an <code>object</code> with a <code>buffer</code> property and a <code>name</code> property.
The buffer property should be buffered file data and the name property should be the name of the file.<br/><br/> This node will create a FileMaker
record unless it recieves a record id property. This node can also be configured with an optional parameter object. The parameter object can
include a field repetition, a request timeout, and a proxy.<br/><br/> The properties specify a container field repetition and upload request timeout.<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#upload-files">Upload 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>