JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 63
  • Score
    100M100P100Q64606F
  • License MIT

node sdk to interface with coresystems apis. Find more docs at https://docs.coresystems.net

Package Exports

  • fsm-sdk

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (fsm-sdk) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

node fsm sdk to interface with coresystems apis and services.

Find more docs at https://docs.coresystems.net

Getting started

npm i fsm-sdk --save
const fsm = require('fsm-sdk');

const client = new fsm.CoreAPIClient({

  // debug: true  /* write oauth token to disk & provide verbose logs */

  // put your client config here
  clientIdentifier: '<your-clientIdentifier>',
  clientSecret: '<your-clientSecret>',
  clientVersion: '<your-clientVersion>',

  // put your auth config here
  authAccountName: '<your-authAccountName>',
  authUserName: '<your-authUserName>',
  authPassword: '<your-authPassword>',

});

related:

CoreAPIClient

CoreAPIClient will return a Promise and is async by default.

Query for objects using CoreSQL

providing the [coreSQL] and the [dtos] used in the query see https://docs.coresystems.net/api/query-api.html

const coreSQL =
  `SELECT
    sc.id,
    sc.subject
  FROM
    ServiceCall sc
  WHERE
   sc.id = '36A5626F65A54FE7911F536C501D151A'
  `;

await client.query(coreSQL, ['ServiceCall']);

CRUD object

see https://docs.coresystems.net/api/data-model.html

create a new object

const serviceCall = { 
   id: fsm.CoreAPIClient.createUUID(), // => 36A5626F65A54FE7911F536C501D151A
   ... 
};

await client.post('ServiceCall', serviceCall);

read object by id

await client.getById('ServiceCall', '36A5626F65A54FE7911F536C501D151A');

update object (providing full new version)

await client.put('ServiceCall', { ... });

update object (providing only fields to change)

await client.patch('ServiceCall', {
    id: '36A5626F65A54FE7911F536C501D151A',
    subject: 'update-only-subject',
    lastChanged: 1535712340
  });

delete object

await client.deleteById('ServiceCall', {
    id: '36A5626F65A54FE7911F536C501D151A',
    lastChanged: 1535712340
  });
lastChanged

The lastChanged-field is used for optimistic locking. It's like a version-key you have to provide in order to update an object.