0.5.9 • Published 7 years ago
@cognite/cognitesdk v0.5.9
cognitesdk

Javascript client library for Cognite SDK
Installation
$ npm install --save cognitesdk
Usage
Authentication with 'silent login' (available from version >0.4)
This injects an iframe into the
// Intially call the redirect function
cognitesdk.loginWithRedirect();
// get the token from the url
const token = some_querystring_parser('access_token');
// use that token for all subsequent calls to api
cognitesdk.setBearerToken(token)
// Figure out how long til the token expires
const decodedToken = jwtDecode(token);
const msToExpiration =
decodedToken.expire_time * 1000 - new Date().getTime();
/* Call silentlogin function some time before it expires
repeat every time you get a new token
This injcts an iframe into your page, and gets the token from the a redirect in that frame
Pass in the url to an empty html file for fastest load times.
*/
setTimeout(() => {
getAccessTokenFromSession('www.myapplication.com/empty.html')
}, msToExpiration - 5000);
Example get a project
const cognitesdk = require('cognitesdk');
cognitesdk.configure({
project,
version,
});
cognitesdk
.getProject()
.then(console.log)
.catch(console.error);
To release
Use the command yarn release
This will build, bump version and release to npm.
Build from repo
The tests need an API key to make sure it's working. Create a file called
.secrets.json
in the root folder, looking like this:
{
"apikey": "..."
}
$ git clone git@github.com:cognitedata/cognitesdk-js
$ yarn
$ yarn test
0.5.11
7 years ago
0.5.10
7 years ago
0.5.9
7 years ago
1.0.0-alpha.3
7 years ago
0.5.8
7 years ago
1.0.0-alpha.2
7 years ago
1.0.0-alpha.1
7 years ago
0.5.7
7 years ago
0.5.6
7 years ago
0.5.5
7 years ago
0.5.3
7 years ago
0.5.2
7 years ago
0.5.1
7 years ago
0.5.0
7 years ago
0.4.7
7 years ago
0.4.6
7 years ago
0.4.5
7 years ago
0.4.4
7 years ago
0.4.3
7 years ago
0.4.2
7 years ago
0.4.1
7 years ago
0.4.0
7 years ago
0.3.11
7 years ago
0.3.10
7 years ago
0.3.9
7 years ago
0.3.8
7 years ago
0.3.7
7 years ago
0.3.6
7 years ago
0.3.5
7 years ago
0.3.1
7 years ago
0.2.0
7 years ago
0.1.7
7 years ago
0.1.6
7 years ago
0.1.5
7 years ago
0.1.4
7 years ago
0.1.3
7 years ago
0.1.2
7 years ago
0.1.1
7 years ago
0.1.0
8 years ago
0.0.9-1
8 years ago
0.0.9-0
8 years ago
0.0.8
8 years ago