🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

fms-api-client

Package Overview
Dependencies
Maintainers
1
Versions
51
Alerts
File Explorer

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 interaction with a FileMaker application from a web environment.

0.0.4
Source
npm
Version published
Weekly downloads
18
-25%
Maintainers
1
Weekly downloads
 
Created
Source

fms-api-client Build Status

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

For in depth documentation: https://luidog.github.io/fms-api-client/Filemaker.html

Installation

This is a Node.js module available through the npm registry. It can be installed using the npm or yarn command line tools.

npm install fms-api-client --save

Usage

const { connect } = require('marpat');
const { Filemaker } = require('fms-api-client');
const environment = require('dotenv');
const varium = require('varium');

environment.config({ path: './tests/.env' });

varium(process.env, './tests/env.manifest');

/**
 * Connect must be called before the filemaker class is instiantiated. This connect uses Marpat. Marpat is a fork of
 * Camo. much love to https://github.com/scottwrobinson 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 storage.
 * @param  {String} url
 * @return {Promise}           A database.
 */
connect('nedb://memory').then(db => {
  /**
   * The client is the FileMaker class. The class then offers methods designed to
   * make it easier to integrate into filemaker
   */
  const client = Filemaker.create({
    application: process.env.APPLICATION,
    server: process.env.SERVER,
    _username: process.env.USERNAME,
    _password: process.env.PASSWORD,
    _layout: process.env.LAYOUT
  });

  client
    .save()
    .then(filemaker => {
      filemaker
        .list('Heroes', { range: 1 })
        .then(response => filemaker.fieldData(response.data))
        .then(response => console.log('A Long Time Ago', response))
        .catch(error => console.log('That is no moon...', error));

      filemaker
        .create('Heroes', { name: 'Anakin Skywalker' })
        .then(response =>
          console.log('Jedi business, go back to your drinks!', response)
        )
        .catch(error => console.log('That is no moon...', error));

      filemaker
        .globals({ ship: 'Millenium Falcon' })
        .then(response =>
          console.log(
            'Made the Kessel Run in less than twelve parsecs.',
            response
          )
        )
        .catch(error => console.log('That is no moon...', error));

      return filemaker;
    })
    .then(filemaker => {
      filemaker
        .find('Heroes', [{ name: 'Anakin Skywalker' }], { range: '1' })
        .then(response => filemaker.recordId(response.data))
        .then(recordIds =>
          filemaker.edit('Heroes', recordIds[0], { name: 'Darth Vader' })
        )
        .then(response =>
          console.log('I find your lack of faith disturbing', response)
        )
        .catch(error => console.log('That is no moon...', error));
      return filemaker;
    })
    .then(filemaker => {
      filemaker
        .find('Heroes', [{ name: 'Anakin Skywalker' }], { range: '1' })
        .then(response => filemaker.recordId(response.data[0]))
        .then(response => {
          console.log(response);
          return response;
        })
        .then(recordId => filemaker.delete('Heroes', recordId))
        .then(response => console.log('Fin.', response))
        .catch(error => console.log('That is no moon...', error));
    });
});

Tests

npm install
npm test
> fms-api-client@0.0.3 test /Users/luidelaparra/Documents/Development/fms-api-client
> mocha --recursive ./tests
  FileMaker Data API Client
    ✓ should allow an instance to be saved.
    ✓ should get an authentication token. (165ms)
    ✓ should create FileMaker records. (152ms)
    ✓ should edit FileMaker records.
    ✓ should delete FileMaker records.
    ✓ should get a FileMaker specific record.
    ✓ should allow you to modify the FileMaker List response (188ms)
    ✓ should allow you to find FileMaker records (175ms)
    ✓ should allow you to set FileMaker globals (159ms)
  9 passing (877ms)

Dependencies

  • lodash: Lodash modular utilities.
  • marpat: A class-based ES6 ODM for Mongo-like databases.
  • moment: Parse, validate, manipulate, and display dates
  • request: Simplified HTTP request client.
  • request-promise: The simplified HTTP request client 'request' with Promise support. Powered by Bluebird.

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.
  • 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
  • jsdocs: jsdocs
  • minami: Clean and minimal JSDoc 3 Template / Theme
  • mocha: simple, flexible, fun test framework
  • package-json-to-readme: Generate a README.md from package.json contents
  • prettier: Prettier is an opinionated code formatter
  • varium: A strict parser and validator of environment config variables

License

MIT

Keywords

FileMaker

FAQs

Package last updated on 04 Apr 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