Socket
Socket
Sign inDemoInstall

calais-js-client

Package Overview
Dependencies
22
Maintainers
2
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    calais-js-client

## Implementation


Version published
Weekly downloads
0
decreased by-100%
Maintainers
2
Install size
1.06 MB
Created
Weekly downloads
 

Readme

Source

CommonJS Calais Client

Implementation

To post data into Calais you will need a Passport ID and a Passport Secret - contact elliot.coad@shortlist.com to request access.

calais-js-client can be included in your project a few different ways:

CommonJS

If you use browserify or webpack then install from npm as calais-js-client

To use in your project require as you would any other package:

First install and save to your project's dependecies npm i -S calais-js-client

Then in your project:


var CalaisClient = require('calais-js-client')

// Instantiate client, you can pass in your payload here
var calaisClient = new CalaisClient(PASSPORT_ID, PASSPORT_SECRET, [optional dataRecord object]

// If you want to post repeatedly, you can use the .setDataRecord api
calaisClient.setDataRecord(dataRecordObject)

// When you're read to send your data, call the .post() method.
// .post() returns a promise

calaisClient.post().then(handleResolvedPromise, handleRejectedPromise)

Hosted Client

You can include a hosted version of the Calais JS Client from our server. It requires no dependencies.

<script src="http://js-client.calaisapi.com/dist/calais-client.min.js"></script>

Build Standalone Client locally

npm run-script bundle will create a standalone calais-client.min.js file in the ./dist folder. You can then include this in your current JavaScript setup.

Dependencies

The client is bundled with SuperAgent, CryptoJS, and es6-promise. So requires no external dependencies.

Browser Support

Calais JS Client supports modern browsers and IE9+

Build & tests

Tests are included in test/test.js

Create a file containing your test passport credentials

cp test/example.test-passport-credentials.json test/test-passport-credentials.json

Run npm install && gulp to build the script and run the tests

Deploying client

Add to SSH config:

[remote "production"]
  url = ssh://trusty/var/application/repos/calais-js-client.git
  fetch = +refs/heads/*:refs/remotes/production/*

Deploy:

git push production master

FAQs

Last updated on 24 Mar 2016

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc