Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@cognite/sdk

Package Overview
Dependencies
Maintainers
47
Versions
241
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cognite/sdk

Javascript client library for Cognite SDK

  • 2.0.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
8.8K
increased by13.72%
Maintainers
47
Weekly downloads
 
Created
Source
Cognite logo

Cognite Javascript SDK

Build Status codecov

The Cognite js library provides convenient access to the Cognite API from applications written in client- or server-side JavaScript.

The SDK supports authentication through api-keys (for server-side applications) and bearer tokens (for web applications).

Installation

Install the package with yarn:

$ yarn add @cognite/sdk

or npm

$ npm install @cognite/sdk --save

Usage

const { CogniteClient } = require('@cognite/sdk');

Using ES modules

import { CogniteClient } from '@cognite/sdk';

Using typescript

The SDK is written in native typescript, so no extra types needs to be defined.

Quickstart

Web

import { CogniteClient } from '@cognite/sdk';

async function quickstart() {
  const client = new CogniteClient({ appId: 'YOUR APPLICATION NAME' });
  client.loginWithOAuth({
    project: 'publicdata',
  });

  const assets = await client.assets
    .list()
    .autoPagingToArray({ limit: 100 });
}
quickstart();

For more details see this document.

Backend

const { CogniteClient } = require('@cognite/sdk');

async function quickstart() {
  const client = new CogniteClient({ appId: 'YOUR APPLICATION NAME' });
  client.loginWithApiKey({
    project: 'publicdata',
    apiKey: 'YOUR_SECRET_API_KEY',
  });

  const assets = await client.assets
    .list()
    .autoPagingToArray({ limit: 100 });
}
quickstart();

Samples

Samples are in the samples/ directory. The samples' README.md has instructions for running the samples.

Documentation

Migration

See this guide on how to migrate from version 1.x.x to version 2.x.x.

License

Apache 2.0

Development

There is one integration test that requires a api key. In order to run this, you need an api key for the cognitesdk-js tenant. Talk to any of the contributors or leave an issue and it'll get sorted. Jenkins will run the test and has its own api key. Set the environment variable COGNITE_CREDENTIALS to your api-key.

Run all tests:

$ yarn
$ yarn test

Set the environment variable REVISION_3D_INTEGRATION_TEST=true to run 3D revision integration tests.

We use jest to run tests, see their documentation for more information.

Versioning

The library follow Semantic Versioning.

Contributing

Contributions welcome! See the code of conduct.

Release

How to release a new version:

  1. Create a new branch
  2. Commit changes (if any)
  3. Run
    $ npm version [patch/minor/major]
    # example: $ npm version patch
    
  4. Update the SDK-version in ./samples/package.json
  5. Push branch and push tags (git push --tags)
  6. Create a new pull requests
  7. A new version will be published when the PR is merged

Keywords

FAQs

Package last updated on 01 Aug 2019

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc