node-red-contrib-filemaker 1.0.4

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

npm install node-red-contrib-filemaker

Node-RED FileMaker nodes. These nodes use fms-api-client to connect to FileMaker Server. Each node exposes an fms-api-client method or utility. Nodes connecting to FileMaker Server depend upon a configurable FileMaker Data API client.

Project Information

npm version Build Status Coverage Status Known Vulnerabilities

The nodes in this project use fms-api-client to connect via the FileMaker Data API to FileMaker Server. The nodes that connect to FileMaker Server depend upon a configurable client node. The client node uses marpat to store and maintain FileMaker Data API session information in-memory. For security client configuration parameters are not exported with a flow.

Once configured a client node will automatically create and maintain a FileMaker Data API session as needed. You are not required to call the login or logout nodes in a flow.

Each node can be configured to use either static or dynamic parameters. Dynamic parameters may be read from either the msg property or the flow and global contexts. The default output of each node is msg.payload. A node can also be configured to merge its output with any property on the msg object.

:v: and :heart: - Lui de la Parra

Table of Contents

Installation

These nodes can be installed from the command line by running the following command in your Node-RED directory:

npm install --save node-red-contrib-filemaker

These nodes can also be installed using the Node-RED palette manager.

Login Node

The login node will open a FileMaker Data API session. This node will also save the resulting session token for future use by the configured client. You are not required to login before using any other node in a flow.

Login Illustration

Login Node

Login Flow

Example Flow

Logout Node

The logout node closes the currently open Data API session and removes the associated session token. You are not required to logout at the end of a flow.

Logout Illustration

Logout Node

Logout Flow

Logout Example Flow

Create Node

The create node creates a record in FileMaker. By default The create node will use the value in msg.payload.layout as the layout context and msg.payload.data for setting field and portal data.

Create Illustration

Create Node

Create Flow

Create Example Flow

Edit Node

The edit node edits a specific record in FileMaker. By default the edit node will use msg.payload.recordId as the record id to target for editing, the data found in msg.payload.data for editing field and portal data, and msg.payload.layout as the layout context.

Edit Illustration

Edit Node

Edit Flow

Edit Example Flow

Delete Node

The delete node deletes a specific record in FileMaker. By default the delete node will use msg.payload.recordId as the record id to target for deletion and msg.payload.layout as the layout context.

Delete Illustration

Delete Node

Delete Flow

Delete Example Flow

Get Node

The get node retrieves a specific FileMaker record. By default the get node will use msg.payload.layout as the layout context, and msg.payload.recordId as the record id to target.

Get Illustration

Get Node

Get Flow

Get Example Flow

List Node

The List node lists FileMaker records for a specified layout. By default the list node will use the value found in msg.payload.layout as the layout context.

List Illustration

List Node

List Flow

List Example Flow

Find Node

The find node performs a find in FileMaker. By Default the find node will user msg.payload.layout as the layout context, and msg.payload.query as query parameters for the find.

Find Illustration

Find Node

Find Flow

Find Example Flow

Script Node

The script node will trigger a script in FileMaker. By default the script node will use msg.payload.layout as the layout context, and msg.payload.script as the script to run. An optional script parameter may also be passed using msg.payload.parameter.

Script Illustration

Script Node

Script Flow

Script Example Flow

Upload Node

The upload node will transfer binary data to a FileMaker container. By default the upload node will use msg.payload.file as either a string path or buffer object and msg.payload.layout as the layout context.

Upload Illustration

Upload Node

Upload Flow

Upload Example Flow

Globals Node

The globals node will set global record field values for the current FileMaker session. The globals node will use msg.payload.data to set global fields.

Globals Illustration

Globals Node

Globals Flow

Globals Example Flow

Field Data Node

The field data node reduces the data found in msg.payload.data to only include the modId, recordId, and fieldData properties.

Field Data Illustration

Field Data Node

Field Data Flow

Field Data Example Flow

Record Ids Node

The record ids node reduces the data found in msg.payload.data to only include the recordId property.

Record Ids Illustration

Record Ids Node

Record Ids Flow

Record Ids Example Flow

Transform Node

The tranform node transforms data in msg.payload.data. It reduces { table::field : value } properties to { table: { field : value } } properties.

Transform Illustration

Transform Node

Transform Flow

Transform Example Flow

Container Data Node

The container node retrieves container data from msg.payload.data. The container node requires a container property, a filename property, and a destination property. Each property should be a dot notation path to the required data, such as fieldData.container and fieldData.fileName. If the configured path does not exist it will be automatically created.

Container Data Illustration

Containers Node

Container Data Flow

Containers Example Flow

Tests

npm install
npm test
> [email protected] test /node-red-contrib-filemaker
> nyc _mocha --recursive  "test/**/*_spec.js" --timeout=30000 --exit



  Client Node
    ✓ should be loaded

  Container Data Node
    ✓ should be loaded
    ✓ should download an object with container data to a buffer (2602ms)
    ✓ should download an array of objects with container data to a buffer (1591ms)
    ✓ should download an object with container data to the filesystem (1415ms)
    ✓ should download an array of objects with container data to the filesystem (1394ms)
    ✓ should throw an error with a message and a code when writing an object to a buffer and an error is triggered
    ✓ should throw an error with a message and a code when writing an array to a buffer an error is triggered 
    ✓ should handle undefined data input when writing to a buffer
    ✓ should handle undefined data input when writing to a file
    ✓ should throw an error when writing data to the filesystem and an error is triggered
    ✓ should throw an error with a message and a code when writing to a buffer and an array is triggered

  Create Record Node
    ✓ should be loaded
    ✓ should create a record (180ms)
    ✓ should create allow the filemaker response to be merged to the message object (172ms)
    ✓ should use flow context to create a record. (176ms)
    ✓ should use global context to create a record. (178ms)
    ✓ should throw an error with a message and a code (170ms)

  Delete Record Node
    ✓ should be loaded
    ✓ should delete a record (259ms)
    ✓ should throw an error with a message and a code (183ms)

  Edit Record Node
    ✓ should be loaded
    ✓ should edit a record (257ms)
    ✓ should support merging data when editing a record (254ms)
    ✓ should throw an error with a message and a code (168ms)

  FieldData Utility Node
    ✓ should be loaded
    ✓ should transform an array of objects (272ms)
    ✓ should transform a a single object (443ms)
    ✓ should reject with an error message and code

  Find Records Node
    ✓ should be loaded
    ✓ should perform a find (268ms)
    ✓ should throw an error with a message and a code (170ms)

  Get Record Node
    ✓ should be loaded
    ✓ should get a specific record (261ms)
    ✓ should throw an error with a message and a code (168ms)

  Set Globals Node
    ✓ should be loaded
    ✓ should set globals (171ms)
    ✓ should throw an error with a message and a code (165ms)

  List Records Node
    ✓ should be loaded
    ✓ should List records (259ms)
    ✓ should throw an error with a message and a code (172ms)

  Login Node
    ✓ should be loaded
    ✓ should login to a Data API session (91ms)
    ✓ should throw an error with a message and a code (1659ms)

  Logout Node
    ✓ should be loaded
    ✓ should close a Data API Session (213ms)
    ✓ should throw an error with a message and a code

  Record Id Utility Node
    ✓ should be loaded
    ✓ should extract record ids from a single object (253ms)
    ✓ should extract record ids from an array of objects (257ms)
    ✓ should reject with an error message and a code

  Trigger Script Node
    ✓ should be loaded
    ✓ should trigger a script (170ms)
    ✓ should parse a script result if it is valid json (173ms)
    ✓ should not parse a script result if it is not valid json (181ms)
    ✓ should throw an error with a message and a code (166ms)

  Utility Services
    merge utility
      ✓ should merge data to the payload object
    sanitize utility
      ✓ should discard unspecified properties
    compact utility
      ✓ should accept an array of objects
      ✓ should remove null properties
      ✓ should remove null properties
      ✓ should remove empty strings
      ✓ should not remove false values
      ✓ should discard non json values
      ✓ should discard non json values
    isJson Utility
      ✓ it should return true for an object
      ✓ it should return true for an empty object
      ✓ it should return true for a stringified object
      ✓ it should return false for a number
      ✓ it should return false for undefined
      ✓ it should return false for a string
      ✓ it should return false for null
    castBoolean Utility
      ✓ it should cast a true string as true boolean
      ✓ it should cast a false string as false boolean
      ✓ it should cast multiple string values as booleans
      ✓ it should only cast strings of true or false

  Transform Utility Node
    ✓ should be loaded
    ✓ should transform an array of objects (263ms)
    ✓ should transform a single object (262ms)
    ✓ should throw an error with a message and a code

  Upload File Node
    ✓ should be loaded
    ✓ should upload to an existing record (337ms)
    ✓ should upload to a file to a new record (357ms)
    ✓ should throw an error with a message and a code


  84 passing (16s)

-----------------------|----------|----------|----------|----------|-------------------|
File                   |  % Stmts | % Branch |  % Funcs |  % Lines | Uncovered Line #s |
-----------------------|----------|----------|----------|----------|-------------------|
All files              |      100 |      100 |      100 |      100 |                   |
 client                |      100 |      100 |      100 |      100 |                   |
  client.js            |      100 |      100 |      100 |      100 |                   |
 nodes                 |      100 |      100 |      100 |      100 |                   |
  containerData.js     |      100 |      100 |      100 |      100 |                   |
  create.js            |      100 |      100 |      100 |      100 |                   |
  delete.js            |      100 |      100 |      100 |      100 |                   |
  edit.js              |      100 |      100 |      100 |      100 |                   |
  fieldData.js         |      100 |      100 |      100 |      100 |                   |
  find.js              |      100 |      100 |      100 |      100 |                   |
  get.js               |      100 |      100 |      100 |      100 |                   |
  globals.js           |      100 |      100 |      100 |      100 |                   |
  list.js              |      100 |      100 |      100 |      100 |                   |
  login.js             |      100 |      100 |      100 |      100 |                   |
  logout.js            |      100 |      100 |      100 |      100 |                   |
  recordId.js          |      100 |      100 |      100 |      100 |                   |
  script.js            |      100 |      100 |      100 |      100 |                   |
  transform.js         |      100 |      100 |      100 |      100 |                   |
  upload.js            |      100 |      100 |      100 |      100 |                   |
 services              |      100 |      100 |      100 |      100 |                   |
  index.js             |      100 |      100 |      100 |      100 |                   |
  utilities.service.js |      100 |      100 |      100 |      100 |                   |
-----------------------|----------|----------|----------|----------|-------------------|

License

MIT © Lui de la Parra

Dependencies

  • fms-api-client: A FileMaker Data API client designed to allow easier interaction with a FileMaker application from a web environment.
  • fs-extra: fs-extra contains methods that aren't included in the vanilla Node.js fs package. Such as mkdir -p, cp -r, and rm -rf.
  • lodash: Lodash modular utilities.
  • marpat: A class-based ES6 ODM for Mongo-like databases.

Development Dependencies

  • chai: BDD/TDD assertion library for node.js and the browser. Test framework agnostic.
  • coveralls: takes json-cov output into stdin and POSTs to coveralls.io
  • dotenv: Loads environment variables from .env file
  • eslint: An AST-based pattern checker for JavaScript.
  • eslint-config-google: ESLint shareable config for the Google style
  • eslint-config-prettier: Turns off all rules that are unnecessary or might conflict with Prettier.
  • eslint-plugin-html: A ESLint plugin to lint and fix inline scripts contained in HTML files.
  • eslint-plugin-prettier: Runs prettier as an eslint rule
  • mocha: simple, flexible, fun test framework
  • mocha-lcov-reporter: LCOV reporter for Mocha
  • mos: A pluggable module that injects content into your markdown files via hidden JavaScript snippets
  • mos-plugin-dependencies: A mos plugin that creates dependencies sections
  • mos-plugin-execute: Mos plugin to inline a process output
  • mos-plugin-installation: A mos plugin for creating installation section
  • mos-plugin-license: A mos plugin for generating a license section
  • node-red: A visual tool for wiring the Internet of Things
  • node-red-node-test-helper: A test framework for Node-RED nodes
  • nyc: the Istanbul command line interface
  • pm2: Production process manager for Node.JS applications with a built-in load balancer.
  • prettier: Prettier is an opinionated code formatter
  • varium: A strict parser and validator of environment config variables

Node Info

Version: 1.0.4
Updated 1 month, 3 weeks ago
License: MIT
Rating:

Downloads

6 in the last day
115 in the last week
185 in the last month

Nodes

  • dapi-client
  • dapi-login
  • dapi-logout
  • dapi-create-record
  • dapi-edit-record
  • dapi-delete-record
  • dapi-get-record
  • dapi-list-records
  • dapi-perform-find
  • dapi-trigger-script
  • dapi-upload-file
  • dapi-set-globals
  • dapi-field-data
  • dapi-record-id
  • dapi-transform
  • dapi-container-data

Keywords

  • Node-RED
  • FileMaker
  • Data API
  • Admin API
  • Node

Maintainers

  • luidog