You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP

fms-api-client

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fms-api-client

A FileMaker Data API client designed to allow easier interaction with a FileMaker application from a web environment.

1.6.0
Version published
Weekly downloads
29
-30.95%
Maintainers
1
Weekly downloads
 
Created

fms-api-client

Build Status Known Vulnerabilities Coverage Status GitHub issues Github commits (since latest release) GitHub license

A FileMaker Data API client designed to allow easier interaction with a FileMaker application from a web environment. This client abstracts the FileMaker 17 Data API into class based methods. You can find detailed documentation on this project here:

fms-api-client documentation

Installation

npm install --save fms-api-client

Usage

Introduction

The fms-api-client is a wrapper around the FileMaker Data API. Much :heart: to FileMaker for their work on the Data API. The client attempts to follow the terminology used by FileMaker wherever possible. the client uses a lightweight datastore to hold Data API connections. The client contains methods which are modeled after the Data API Endpoints.

The client requires that you first connect to a datastore before creating or querying the FileMaker class. You can use the datastore to save a multitude of clients. Each client committed to the datastore will automatically handle Data API Sessions. Once saved to the data store a client's methods can be used to interact with a FileMaker Database without the need for additional authentication.

Each client will manage their own FileMaker Data API session, but the clients can manually open or close their FileMaker sessions by calling either the client.login() method or the client.logout() method. To remove a client from a datastore and log out a session call client.destroy().

The client supports the same parameter syntax as is found in the Data API Documentation. Where appropriate and useful the client also allows additional parameters. Any method that accepts script or portals in a query or body parameters will also accept the following script and portal parameters:

Script Array Syntax

The custom script parameter follows the following syntax:

{
  "scripts": [
    {
      "name": "At Mos Eisley",
      "phase": "presort",
      "param": "awesome bar"
    },
    {
      "name": "First Shot",
      "phase": "prerequest",
      "param": "Han"
    },
    {
      "name": "Moof Milker",
      "param": "Greedo"
    }
  ]
}

File ./examples/schema/scripts-array-schema.json

Portal Array Syntax

The custom portal parameter follows the following syntax:

{
  "portals": [
    { "name": "planets", "limit": 1, "offset": 1 },
    { "name": "vehicles", "limit": 2 }
  ]
}

File ./examples/schema/portals-array-schema.json

Note: The FileMaker script and portal syntax will override the alternative script and portal parameter syntax.

In addition to allowing an exanded syntax for invoking script or selecting portals the client will also automatically parse arrays, objects, and numbers to adhere to the requirements of the Data API. Arrays and objects are stringified before being inserted into field data. Also limits and offsets can be set as either a strings or a numbers.

The client will also automatically convert limit, find, and offset into their underscored conterparts as needed. Additionally, if a script result can be parsed as JSON it will be automatically parsed for you by the client.

All methods on the client return promises and each each method will reject with a message and code upon encountering an error. All messages and codes follow the FileMaker Data API where possible.

This project also provides utility modules to aid in working with FileMaker Data API Results. The provided utility modules are fieldData, recordId, and transform. These utilities will accept and return either an object or an an array objects. For more information on the utility modules see the utility section.

Datastore Connection

Connect must be called before the FileMaker class is used. This connect uses Marpat. Marpat is a fork of Camo. Thanks and love to Scott Robinson for his creation and maintenance of Camo. My fork of Camo - Marpat is designed to allow the use of multiple datastores with the focus on encrypted file storage and project flexibility.

For more information on marpat and the different types of supported storage visit marpat

const { connect } = require('marpat');
connect('nedb://memory')

Excerpt from ./examples/index.js

Client Creation

After connecting to a datastore you can import and create clients. A client is created using the create method on the Filemaker class. The FileMaker class accepts an object with the following properties:

PropertyTypeDescription
applicationStringrequired The FileMaker application / database to connect to
serverStringrequired The FileMaker server to use as the host. Note: Must be an http or https Domain.
userStringrequired The FileMaker user account to be used when authenticating into the Data API
passwordStringrequired The FileMaker user account's password.
nameStringoptional A name for the client.
usageBooleanoptional Track Data API usage for this client. Note: Default is true
    const client = Filemaker.create({
      application: process.env.APPLICATION,
      server: process.env.SERVER,
      user: process.env.USERNAME,
      name: process.env.CLIENT_NAME,
      usage: process.env.CLIENT_USAGE_TRACKING,
      password: process.env.PASSWORD
    });

Excerpt from ./examples/index.js

Note: The server must be an http or https domain.

A client can be used directly after saving it. The client.save() method takes no arguments and will either reject with an error or resolve with a useable client. The client will automatically handle Data API session creation and expiration. Once a client is saved it will be stored on the datastore for reuse later.

    return client.save();
  })
  .then(client => authentication(client))
  .then(client => creates(client))
  .then(client => gets(client))
  .then(client => lists(client))
  .then(client => finds(client))
  .then(client => edits(client))
  .then(client => scripts(client))
  .then(client => globals(client))
  .then(client => deletes(client))
  .then(client => uploads(client))
  .then(client => utilities(client))

Excerpt from ./examples/index.js

A client can be removed using either the client.destroy() method, the Filemaker.deleteOne(query) method or the Filemaker.deleteMany(query) method.

Note Only the client.destroy() method will close a FileMaker session. Any client removed using the the Filemaker.deleteOne(query) method or the Filemaker.deleteMany(query) method will not log out before being destroyed.

Client Use

A client can be used after it is created and saved or recalled from the datastore. The Filemaker.find(query) or Filemaker.findOne(query) methods can be used to recall clients. The filemaker.findOne(query) method will return either an client or null. The filemaker.find(query) will return an array of clients. All public methods on the client are return promises.

const createManyRecords = client =>
  Promise.all([
    client.create('Heroes', { name: 'Anakin Skywalker' }, { merge: true }),
    client.create('Heroes', { name: 'Obi-Wan' }, { merge: true }),
    client.create('Heroes', { name: 'Yoda' }, { merge: true })
  ]).then(result => log('create-many-records-example', result));

Excerpt from ./examples/create.examples.js

Results:

[
  {
    "name": "Anakin Skywalker",
    "recordId": "738823",
    "modId": "0"
  },
  {
    "name": "Obi-Wan",
    "recordId": "738825",
    "modId": "0"
  },
  {
    "name": "Yoda",
    "recordId": "738826",
    "modId": "0"
  }
]

File ./examples/results/create-many-records-example.json

Data API Sessions

The client will automatically handle creating and closing Data API sessions. If required the client will authenticate and generate a new session token with each method call. The Data API session is also monitored, updated, and saved as the client interacts with the Data API. A client will always attempt to reuse a valid token whenever possible.

The client contains two methods related to Data API sessions.These methods are client.login() and client.logout(). The login method is used to start a Data API session and the logout method will end a Data API session.

Login Method

The client will automatically call the login method if it does not have a valid token. This method returns an object with a token property. This method will also save the token to the client's connection for future use.

client.login()

const login = client => client.login();

Excerpt from ./examples/authentication.examples.js

Logout Method

The logout method is used to end a Data API session. This method will also remove the current client's authentication token.

client.logout()

Note The logout method will change in an upcoming release. It will be modified to accept a session parameter.

const logout = client =>
  client.logout().then(result => log('client-logout-example', result));

Excerpt from ./examples/authentication.examples.js

Create Records

Using the client you can create filemaker records. To create a record specify the layout to use and the data to insert on creation. The client will automatically convert numbers, arrays, and objects into strings so they can be inserted into a filemaker field.

client.create(layout, data, parameters)

InputTypeDescription
layoutStringThe layout to use as context for creating the record
dataObjectThe data to use when creating a record.
parametersObjectThe parameters to use when creating a record.
const createRecord = client =>
  client
    .create('Heroes', {
      name: 'George Lucas'
    })
    .then(result => log('create-record-example', result));

Excerpt from ./examples/create.examples.js

Result:

{
  "recordId": "738822",
  "modId": "0"
}

File ./examples/results/create-record-example.json

Both the create method and the edit method accept a merge boolean in their options. If merge is true the data used to create or edit the filemaker record will be merged with

const mergeDataOnCreate = client =>
  client
    .create(
      'Heroes',
      {
        name: 'George Lucas'
      },
      { merge: true }
    )
    .then(result => log('create-record-merge-example', result));

Excerpt from ./examples/create.examples.js

Result:

{
  "name": "George Lucas",
  "recordId": "738824",
  "modId": "0"
}

File ./examples/results/create-record-merge-example.json

The create methods also allows you to trigger scripts when creating a record. Notice the scripts property in the following example. You can specify scripts to run using either FileMaker's script.key syntax or specify an array of scripts with a name, phase, and script parameter.

const triggerScriptsOnCreate = client =>
  client
    .create(
      'Heroes',
      { name: 'Anakin Skywalker' },
      {
        merge: true,
        scripts: [
          { name: 'Create Droids', param: { droids: ['C3-PO', 'R2-D2'] } }
        ]
      }
    )
    .then(result => log('trigger-scripts-on-create-example', result));

Excerpt from ./examples/create.examples.js

Result:

{
  "name": "Anakin Skywalker",
  "scriptError": "0",
  "recordId": "738827",
  "modId": "0"
}

File ./examples/results/trigger-scripts-on-create-example.json

Get Record Details

client.get(layout, recordId, parameters)

      client
        .get('Heroes', response.data[0].recordId)
        .then(result => log('get-record-example', result))

Excerpt from ./examples/get.examples.js

Result:

{
  "data": [
    {
      "fieldData": {
        "name": "yoda",
        "image(1)": "https://some-server.com/Streaming_SSL/MainDB/98C6029AFE031625FD7B96A36AB3A5A690E8A2F7E09AB68E45366C25F33BA5EC?RCType=EmbeddedRCFileProcessor",
        "object": "",
        "array": "",
        "height": "",
        "id": "EED86CE1-41D1-D847-AA9B-62B91E69D7D2"
      },
      "portalData": {
        "Planets": [],
        "Vehicles": []
      },
      "recordId": "733077",
      "modId": "1"
    }
  ]
}

File ./examples/results/get-record-example.json

List Records

You can use the client to list filemaker records. The list method accepts a layout and parameter variable. The client will automatically santize the limit, offset, and sort keys to correspond with the DAPI's requirements.

client.list(layout, parameters)

const listHeroes = client =>
  client
    .list('Heroes', { limit: 2 })
    .then(result => log('list-records-example', result));

Excerpt from ./examples/list.examples.js

Result:

{
  "data": [
    {
      "fieldData": {
        "name": "George Lucas",
        "image(1)": "https://some-server.com/Streaming_SSL/MainDB/164DAF9AA28E4308B1EF6EC6236C0175B5E585C4A9F03D12465AE3AC616E7A0A?RCType=EmbeddedRCFileProcessor",
        "object": "",
        "array": "",
        "height": "",
        "id": "0E6DF26C-761E-7947-9A3C-C312C285EE55"
      },
      "portalData": {
        "Planets": [],
        "Vehicles": []
      },
      "recordId": "732765",
      "modId": "6"
    },
    {
      "fieldData": {
        "name": "George Lucas",
        "image(1)": "",
        "object": "",
        "array": "",
        "height": "",
        "id": "0F628510-432C-0E47-8D03-BA90AAF2EA17"
      },
      "portalData": {
        "Planets": [],
        "Vehicles": []
      },
      "recordId": "732766",
      "modId": "0"
    }
  ]
}

File ./examples/results/list-records-example.json

Find Records

The client's find method will accept either a single object as find parameters or an array. The find method will also santize the limit, sort, and offset parameters to conform with the Data API's requirements.

client.find(layout, query, parameters)

const findRecords = client =>
  client
    .find('Heroes', [{ name: 'Anakin Skywalker' }], { limit: 1 })
    .then(result => log('find-records-example', result));

Excerpt from ./examples/find.examples.js

Result:

{
  "data": [
    {
      "fieldData": {
        "name": "Anakin Skywalker",
        "image(1)": "",
        "object": "",
        "array": "",
        "height": "",
        "id": "9BBDF8D1-420A-9040-945B-90D5360DFDBF"
      },
      "portalData": {
        "Planets": [],
        "Vehicles": []
      },
      "recordId": "736951",
      "modId": "0"
    }
  ]
}

File ./examples/results/find-records-example.json

Edit Records

The client's edit method requires a layout, recordId, and object to use for updating the record.

client.edit(layout, recordId, data, parameters)

const editRecord = client =>
  client
    .find('Heroes', [{ name: 'Anakin Skywalker' }], { limit: 1 })
    .then(response => response.data[0].recordId)
    .then(recordId => client.edit('Heroes', recordId, { name: 'Darth Vader' }))
    .then(result => log('edit-record-example', result));

Excerpt from ./examples/edit.examples.js

Result:

{
  "modId": "2"
}

File ./examples/results/edit-record-example.json

Delete Records

The client's delete method requires a layout and a record id.

client.delete(layout, recordId, parameters)

const deleteRecords = client =>
  client
    .find('Heroes', [{ name: 'yoda' }], { limit: 1 })
    .then(response => response.data[0].recordId)
    .then(recordId => client.delete('Heroes', recordId))
    .then(result => log('delete-record-example', result));

Excerpt from ./examples/delete.examples.js

Result:

{}

File ./examples/results/delete-record-example.json

Trigger Scripts

The client's script method requires a script to run and a layout to run on.

client.script(layout, script, parameter)

const triggerScript = client =>
  client
    .script('Heroes', 'FMS Triggered Script', { name: 'Han' })
    .then(result => log('script-trigger-example', result));

Excerpt from ./examples/script.examples.js

Result:

{
  "result": {
    "answer": "Han shot first"
  }
}

File ./examples/results/script-trigger-example.json

Upload Files

The client's upload method will upload file data to a filemaker file. The upload method requires a file path, layout, and container field name.

client.upload(file, layout, containerFieldName, recordId, fieldRepetition)

const uploadImage = client =>
  client
    .upload('./assets/placeholder.md', 'Heroes', 'image')
    .then(result => log('upload-image-example', result));

Excerpt from ./examples/upload.examples.js

Result:

{
  "modId": "1",
  "recordId": "738829"
}

File ./examples/results/upload-image-example.json

You can also provide a record Id to the upload method and the file will be uploaded to that record.

          client
            .upload('./assets/placeholder.md', 'Heroes', 'image', recordId)
            .then(result => log('upload-specific-record-example', result)),

Excerpt from ./examples/upload.examples.js

Result:

{
  "modId": "1",
  "recordId": "733082"
}

File ./examples/results/upload-specific-record-example.json

Set Session Globals

You can also use the client to set FileMaker Globals for the session.

client.globals(object)

const setGlobals = client =>
	client
		.globals({ 'Globals::ship': 'Millenium Falcon' })
		.then(result => log('set-globals-example', result));

Excerpt from ./examples/globals.examples.js

Result:

{}

File ./examples/results/set-globals-example.json

Utility Methods

The client also provides utility methods to aid in parsing and manipulating FileMaker Data. The client exports the recordId(data), fieldData(data), and transform(data, options) to aid in transforming Data API response data into other formats. Each utility method is capable of recieving either an object or a array.

recordId Method

The recordId method retrieves the recordId properties for a response. This method will return either a single string or an array of strings.

recordId(data)

const extractRecordId = client =>
  client
    .find('Heroes', { name: 'yoda' }, { limit: 2 })
    .then(response => recordId(response.data))
    .then(result => log('recordid-utility-example', result));

Excerpt from ./examples/utility.examples.js

Result:

[
  "733082",
  "733085"
]

File ./examples/results/recordid-utility-example.json

fieldData Method

The fieldData method retrieves the fieldData, recordId, and modId properties from a Data API response. The fieldData method will merge the recordId and modId properties into fielData properties. This method will not convert table::field properties.

fieldData(data)

const extractFieldData = client =>
  client
    .find('Heroes', { name: 'yoda' }, { limit: 2 })
    .then(response => fieldData(response.data))
    .then(result => log('fielddata-utility-example', result));

Excerpt from ./examples/utility.examples.js

Result:

[
  {
    "name": "Yoda",
    "image(1)": "https://some-server.com/Streaming_SSL/MainDB/E8456ED04499B8CC37C9AE21CA26D2058304C0E972B3981A96D74E091505A46B?RCType=EmbeddedRCFileProcessor",
    "object": "",
    "array": "",
    "height": "",
    "id": "E34C56D8-5EB8-B440-893F-19E0DE2022DE",
    "recordId": "733082",
    "modId": "1"
  },
  {
    "name": "yoda",
    "image(1)": "",
    "object": "",
    "array": "",
    "height": "",
    "id": "C68FE194-03D7-E04E-AF72-9764DB492D0D",
    "recordId": "733085",
    "modId": "0"
  }
]

File ./examples/results/fielddata-utility-example.json

Transform Method

The transform method converts Data API response data by converting table::field properties to objects. This method will transverse the response data and converting { table::field : value} properties to { table:{ field : value } }. The transform method will also convert portalData into arrays of objects.

The transform method accepts three option properties. The three option properties are all booleans and true by default. The three option properties are convert,fieldData,portalData. The convert property controls the transfomation of table::field properties. The fieldData property controls the merging of fieldData to the result. The portalData property controls the merging of portalData to the result. Setting any propery to false its transformation off.

transform(data,options)

const transformData = client =>
  client
    .find('Transform', { name: 'Han Solo' }, { limit: 1 })
    .then(result => transform(result.data))
    .then(result => log('transform-utility-example', result));

Excerpt from ./examples/utility.examples.js

Result:

[
  {
    "starships": "",
    "vehicles": "",
    "species": "",
    "biography": "",
    "birthYear": "",
    "id": "193B8CEE-00CE-D942-92F0-FEEF4DA87967",
    "name": "Han Solo",
    "Planets": [
      {
        "recordId": "2",
        "name": "Coriella",
        "modId": "2"
      }
    ],
    "Vehicles": [
      {
        "recordId": "1",
        "name": "Millenium Falcon",
        "type": "Starship",
        "modId": "2"
      }
    ],
    "recordId": "732824",
    "modId": "2"
  }
]

File ./examples/results/transform-utility-example.json

Tests

npm install
npm test
> fms-api-client@1.5.2 test /Users/luidelaparra/Documents/Development/fms-api-client
> nyc _mocha --recursive  ./tests --timeout=30000 --exit



  Authentication Capabilities
(node:21547) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
    ✓ should authenticate into FileMaker. (166ms)
    ✓ should automatically request an authentication token (180ms)
    ✓ should reuse a saved authentication token (182ms)
    ✓ should log out of the filemaker. (192ms)
    ✓ should not attempt a logout if there is no valid token.
    ✓ should reject if the logout request fails (191ms)
    ✓ should reject if the authentication request fails (1435ms)
    ✓ should attempt to log out before being removed (174ms)
    ✓ should catch the log out error before being removed if the login is not valid

  Create Capabilities
    ✓ should create FileMaker records. (185ms)
    ✓ should reject bad data with an error (85ms)
    ✓ should create records with mixed types (83ms)
    ✓ should substitute an empty object if data is not provided (84ms)
    ✓ should return an object with merged data properties (87ms)
    ✓ should allow you to run a script when creating a record with a merge response (93ms)
    ✓ should allow you to specify scripts as an array (96ms)
    ✓ should allow you to specify scripts as an array with a merge response (96ms)
    ✓ should sanitize parameters when creating a new record (99ms)
    ✓ should accept both the default script parameters and a scripts array (95ms)
    ✓ should remove an expired token (88ms)

  Delete Capabilities
    ✓ should delete FileMaker records. (274ms)
    ✓ should trigger scripts via an array when deleting records. (169ms)
    ✓ should trigger scripts via parameters when deleting records. (175ms)
    ✓ should allow you to mix script parameters and scripts array when deleting records. (171ms)
    ✓ should stringify script parameters. (176ms)
    ✓ should reject deletions that do not specify a recordId (83ms)
    ✓ should reject deletions that do not specify an invalid recordId (86ms)
    ✓ should remove an expired token (85ms)

  Edit Capabilities
    ✓ should edit FileMaker records.
    ✓ should reject bad data with an error (307ms)
    ✓ should return an object with merged filemaker and data properties
    ✓ should allow you to run a script when editing a record (198ms)
    ✓ should allow you to run a script via a scripts array when editing a record (180ms)
    ✓ should allow you to specify scripts as an array (180ms)
    ✓ should allow you to specify scripts as an array with a merge response (189ms)
    ✓ should sanitize parameters when creating a editing record (181ms)
    ✓ should accept both the default script parameters and a scripts array (178ms)
    ✓ should remove an expired token (160ms)

  FieldData Capabilities
    ✓ it should extract field data while maintaining the array (273ms)
    ✓ it should extract field data while maintaining the object (176ms)

  Find Capabilities
    ✓ should perform a find request (317ms)
    ✓ should allow you to use an object instead of an array for a find (221ms)
    ✓ should specify omit Criterea (130ms)
    ✓ should allow additional parameters to manipulate the results (83ms)
    ✓ should allow you to limit the number of portal records to return (89ms)
    ✓ should allow you to use numbers in the find query parameters (91ms)
    ✓ should allow you to sort the results (321ms)
    ✓ should return an empty array if the find does not return results (87ms)
    ✓ should allow you run a pre request script (90ms)
    ✓ should return a response even if a script fails (89ms)
    ✓ should allow you to send a parameter to the pre request script (94ms)
    ✓ should allow you run script after the find and before the sort (178ms)
    ✓ should allow you to pass a parameter to a script after the find and before the sort (195ms)
    ✓ should reject of there is an issue with the find request (84ms)
    ✓ should remove an expired token (79ms)

  Get Capabilities
    ✓ should get specific FileMaker records. (277ms)
    ✓ should reject get requests that do not specify a recordId (162ms)
    ✓ should allow you to limit the number of portal records to return (170ms)
    ✓ should accept namespaced portal limit and offset parameters (169ms)
    ✓ should remove an expired token (87ms)

  Global Capabilities
    ✓ should allow you to set session globals (188ms)
    ✓ should reject with a message and code if it fails to set a global (84ms)
    ✓ should remove an expired token (94ms)

  Request Interceptor Capabilities
    ✓ should reject if the server errors (413ms)
    ✓ should handle non JSON responses by rejecting with a json error (224ms)
    ✓ should reject non http requests to the server with a json error
 * Notice * Data API response does not contain a code. Only a message
    ✓ should reject non https requests to the server with a json error (141ms)

  List Capabilities
    ✓ should allow you to list records (315ms)
    ✓ should allow you use parameters to modify the list response (95ms)
    ✓ should should allow you to use numbers in parameters (89ms)
    ✓ should should allow you to provide an array of portals in parameters (89ms)
    ✓ should should remove non used properties from a portal object (88ms)
    ✓ should modify requests to comply with DAPI name reservations (95ms)
    ✓ should allow strings while complying with DAPI name reservations (81ms)
    ✓ should allow you to offset the list response (85ms)
    ✓ should santize parameters that would cause unexpected parameters (85ms)
    ✓ should allow you to limit the number of portal records to return (85ms)
    ✓ should accept namespaced portal limit and offset parameters (89ms)
    ✓ should reject invalid parameters (99ms)
    ✓ should remove an expired token (91ms)

  RecordId Capabilities
    ✓ it should extract the recordId while maintaining the array (275ms)
    ✓ it should extract recordId while maintaining the object (180ms)

  Script Capabilities
    ✓ should allow you to trigger a script (193ms)
    ✓ should allow you to trigger a script in a find (224ms)
    ✓ should allow you to trigger a script in a list (96ms)
    ✓ should allow reject a script that does not exist (82ms)
    ✓ should allow return a result even if a script returns an error (94ms)
    ✓ should parse script results if the results are json (104ms)
    ✓ should not parse script results if the results are not json (90ms)
    ✓ should parse an array of scripts (89ms)
    ✓ should trigger scripts on all three script phases (101ms)
    ✓ should remove an expired token (89ms)

  Storage
    ✓ should allow an instance to be created
    ✓ should allow an instance to be saved.
    ✓ should reject if a client can not be validated
    ✓ should allow an instance to be recalled
    ✓ should allow insances to be listed
    ✓ should allow you to remove an instance

  Transform Capabilities
    ✓ should merge portal data and field data from an array (327ms)
    ✓ should merge portal data and field data from an object (132ms)
    ✓ should optionally not convert table::field keys from an array (128ms)
    ✓ should optionally not convert table::field keys from an object (125ms)
    ✓ should allow you to remove field data from an array (131ms)
    ✓ should allow you to remove field data from an object (136ms)
    ✓ should allow you to remove portal data from an array (139ms)
    ✓ should allow you to remove portal data from an object (121ms)
    ✓ should merge portal data and portal data from an array (132ms)

  File Upload Capabilities
    ✓ should allow you to upload a file to a new record (1380ms)
    ✓ should allow you to upload a file to a specific container repetition (1388ms)
    ✓ should reject with a message if it can not find the file to upload
    ✓ should allow you to upload a file to a specific record (1263ms)
    ✓ should allow you to upload a file to a specific record container repetition (1498ms)
    ✓ should reject of the request is invalid (229ms)
    ✓ should remove an expired token (80ms)

  Data Usage 
    Tracks Data Usage
      ✓ should track API usage data. (176ms)
      ✓ should allow you to reset usage data. (89ms)
    Does Not Track Data Usage
      ✓ should not track data usage in (190ms)
      ✓ should not track data usage out (81ms)

  Utility Capabilities
    Omit Utility
      ✓ it should remove properties while maintaing the array
      ✓ it should remove properties while maintaing the object
    Parse Utility
      ✓ it should return a string when given a string
      ✓ it should return an object when given a stringified object


  122 passing (22s)

------------------------------|----------|----------|----------|----------|-------------------|
File                          |  % Stmts | % Branch |  % Funcs |  % Lines | Uncovered Line #s |
------------------------------|----------|----------|----------|----------|-------------------|
All files                     |      100 |      100 |      100 |      100 |                   |
 fms-api-client               |      100 |      100 |      100 |      100 |                   |
  index.js                    |      100 |      100 |      100 |      100 |                   |
 fms-api-client/src           |      100 |      100 |      100 |      100 |                   |
  client.model.js             |      100 |      100 |      100 |      100 |                   |
  connection.model.js         |      100 |      100 |      100 |      100 |                   |
  credentials.model.js        |      100 |      100 |      100 |      100 |                   |
  data.model.js               |      100 |      100 |      100 |      100 |                   |
  index.js                    |      100 |      100 |      100 |      100 |                   |
  request.service.js          |      100 |      100 |      100 |      100 |                   |
 fms-api-client/src/utilities |      100 |      100 |      100 |      100 |                   |
  conversion.utilities.js     |      100 |      100 |      100 |      100 |                   |
  filemaker.utilities.js      |      100 |      100 |      100 |      100 |                   |
  index.js                    |      100 |      100 |      100 |      100 |                   |
  transform.utilities.js      |      100 |      100 |      100 |      100 |                   |
 fms-api-client/tests         |      100 |      100 |      100 |      100 |                   |
  transform.tests.js          |      100 |      100 |      100 |      100 |                   |
------------------------------|----------|----------|----------|----------|-------------------|

Dependencies

  • axios: Promise based HTTP client for the browser and node.js
  • form-data: A library to create readable "multipart/form-data" streams. Can be used to submit forms and file uploads to other web applications.
  • lodash: Lodash modular utilities.
  • marpat: A class-based ES6 ODM for Mongo-like databases.
  • moment: Parse, validate, manipulate, and display dates
  • object-sizeof: Sizeof of a JavaScript object in Bytes
  • prettysize: Convert bytes to other sizes for prettier logging

Dev Dependencies

  • chai: BDD/TDD assertion library for node.js and the browser. Test framework agnostic.
  • chai-as-promised: Extends Chai with assertions about promises.
  • colors: get colors in your node.js console
  • coveralls: takes json-cov output into stdin and POSTs to coveralls.io
  • deep-map: Transforms nested values of complex objects
  • 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-prettier: Runs prettier as an eslint rule
  • 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.
  • jsdoc: An API documentation generator for JavaScript.
  • minami: Clean and minimal JSDoc 3 Template / Theme
  • 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
  • mos-plugin-snippet: A mos plugin for embedding snippets from files
  • nyc: the Istanbul command line interface
  • prettier: Prettier is an opinionated code formatter
  • varium: A strict parser and validator of environment config variables

License

MIT © Lui de la Parra

FAQs

Package last updated on 08 Oct 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts