Skip to content

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

2 watching

Forks

Repository files navigation




Javascript Development Kit



Installation

NPM

Run this command:

npm install comfortable-javascript

For usage in the Browser

<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/comfortable-javascript@latest/dist/comfortable.min.js"></script>

Note: For a specific version replace @latest with the version of your choice.

The SDK will be available as a global variable called: Comfortable

Downloadable version

Check out our release Page: https://github.com/cmftable/comfortable-javascript/releases


Include the dependency:

const Comfortable = require('comfortable-javascript');

Connect to your Repository and make your first request:

const api = Comfortable.api('{repository-api-id}', '{api-key}', options);

api.getDocuments()
  .then(result => {
    // futher implementation
  })
  .catch(err => {
    throw err;
  })

Complete documentation, installation instructions, and examples are available here.

Options:

Option Type Description
useProxy boolean enables the usage of a Proxy Endpoint instead of using https://api.cmft.io/v1
proxy string Proxy Url e.g. https://custom-api.com/v1

Tests

  1. npm is a prerequisite for running the tests. Install npm on your system, then run npm install to install required files.
  2. Edit tests/Api.ts to add your credentials and test documents. Alternatively you can set your credentials as environment variables. For this you have to define CMFT_REPOSITORY, CMFT_APIKEY, CMFT_DOCUMENT_ID, CMFT_DOCUMENT_ALIAS. CMFT_ASSET_ID. CMFT_PROXY_URL.
  3. The tests can be executed by running the following command from the root directory:
npm run test
// or
CMFT_REPOSITORY=... CMFT_APIKEY=... CMFT_DOCUMENT_ID=... CMFT_DOCUMENT_ALIAS=... CMFT_ASSET_ID=... CMFT_PROXY_URL=... npm run test

Docker-based test/build workflow

Use this if your host machine should not provide Node/npm directly.

  1. Build the SDK container image:
npm run docker:build-image
  1. Install dependencies in the container:
npm run docker:install
  1. Build SDK bundle in the container:
npm run docker:build
  1. Run tests in the container:
CMFT_REPOSITORY=... CMFT_APIKEY=... CMFT_DOCUMENT_ID=... CMFT_DOCUMENT_ALIAS=... CMFT_ASSET_ID=... CMFT_PROXY_URL=... npm run docker:test
  1. Optional: enable per-test response debug output:
CMFT_DEBUG_TESTS=1 npm run docker:test

This prints API responses for each test with the [TEST DEBUG] prefix.

Security audit in Docker

Read current security status:

npm run docker:audit

Read only production dependency status:

npm run docker:audit:prod

Apply non-breaking security fixes:

npm run docker:audit:fix

Apply all possible fixes including potentially breaking updates:

npm run docker:audit:fix:force

More information

Contributing

Pull requests are always welcome!

PRs Welcome

License

This repository is published under the MIT license.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages