This is a Node.js module available through the npm registry for connect with the AIR-Core API.
This module lets you connect the platform AIR-Core (formerly Deep Intelligence), using their functions, to your projects. It encapsulates by means of functions the different calls to the API in order to obtain the required data from it.
Table of Contents
npm i @airinstitute/deepint-js-sdkYou can import this package using the classic Javascript require or with import in the case you use Typescript as shown on the following examples:
const deepint = require('@airinstitute/deepint-js-sdk');
deepint.getWorkspaces()
.then(workspaces => {
console.log(workspaces);
})
.catch(err => {
console.log(err);
});import * as deepint from '@airinstitute/deepint-js-sdk';
deepint.getWorkspaces()
.then(workspaces => {
console.log(workspaces);
})
.catch(err => {
console.log(err);
});OR using desestructuring to get only the requested function
import {getWorkspaces} from '@airinstitute/deepint-js-sdk';
getWorkspaces()
.then(workspaces => {
console.log(workspaces);
})
.catch(err => {
console.log(err);
});The module contains all API functions with a characteristic function name: 'methodAPI'+'groupAsociated'+'groupFunctions'+'informationFunction'. Eg: get+Workspace+Visualization+ById = getWorkspaceVisualizationById(params);.
Here there is a list of functions you can use:
-
- postLoginToken
- postRevokeToken
-
- getProfile
- getSession
-
- getWorkspaces
- postWorkspaces
- postWorkspacesImport
- getWorkspaceById
- postWorkspaceById
- deleteWorkspaceById
- postIframe
- postWorkspace
- postWorkspaceClone
-
- getWorkspaceTasks
- getWorkspaceTaskById
- deleteWorkspaceTaskById
-
- getWorkspaceSources
- postWorkspaceSource
- postSourceClone
- postSourceDerived
- postSourceExternal
- postSourceOther
- getWorkspaceSourceById
- postWorkspaceSourceById
- deleteWorkspaceSourceById
- getConnectionSourceById
- postConnectionSourceById
- getAutoUpdateSourceById
- postAutoUpdateSourceById
- postTransformFeaturesSourcesById
- getSourceInstances
- postSourceInstances
- deleteSourceInstances
- postExternalSources
-
- getWorkspaceModels
- postWorkspaceModels
- getWorkspaceModelById
- postWorkspaceModelById
- deleteWorkspaceModelById
- getModelEvaluation
- getModelPredict
- postModelBatchPredict
- postModelPredict1d
-
- getWorkspaceAlerts
- postWorkspaceAlerts
- getWorkspaceAlertById
- postWorkspaceAlertById
- deleteWorkspaceAlertById
- getWorkspaceAlertInstances
-
- getWorkspaceEmails
- postWorkspaceEmails
- deleteWorkspaceEmailById
-
- getWorkspaceVisualizations
- postWorkspaceVisualizations
- getWorkspaceVisualizationById
- postWorkspaceVisualizationById
- deleteWorkspaceVisualizationById
- postCloneVisualizationById
-
- getWorkspaces
- postWorkspaces
- postWorkspacesImport
- getWorkspaceById
- postWorkspaceById
- deleteWorkspaceById
- postIframe
- postWorkspace
- postWorkspaceClone
These functions work asynchronously, so they return a promise.
To configure the module, set the following environment variables:
| Variable Name | Description |
|---|---|
| X_AUTH_TOKEN | Token Authorization to connect to the API |
| X_AIRCORE_ORGANIZATION | Organization Token (legacy name X_DEEPINT_ORGANIZATION is still supported) |
| AIRCORE_API_URL | AIR-Core API URL, default is https://app.air-core.io/api/v1/ (legacy name DEEPINT_API_URL is still supported). Must end with / |
| AIRCORE_OAUTH_URL | Optional. Base URL of the OAuth endpoints used by postLoginToken and postRevokeToken. Defaults to <API URL>/../oauth/, i.e. https://app.air-core.io/api/oauth/ |
When both the AIRCORE_* and the legacy DEEPINT_* variables are set, the AIRCORE_* value is used. To keep using a legacy Deep Intelligence instance, set AIRCORE_API_URL (or DEEPINT_API_URL) to https://app.deepint.net/api/v1/.
In case you can not set environment variable and still want to use this SDK you can set this parameters directly on your code, like this:
const deepint = require('@airinstitute/deepint-js-sdk');
// If you did not setted X_AUTH_TOKEN && X_AIRCORE_ORGANIZATION env variables in order to be able to use the SDK you can set this variables on code in the next way
deepint.Config.getInstance().setToken("<Your AIR-Core user token>");
deepint.Config.getInstance().setOrganization("<Your AIR-Core organization ID>");
// This method it is only for development use in production please set the envionment variablesEven this method is available and working its highly recomended to set this variables through environment variables due it's more safety and this last method if used with text plain can expose your AIR-Core credentials.
For source configuration, set the following variables:
| Variable Name | Description |
|---|---|
| SOURCE_PUB_KEY | Public key of the external source |
| SOURCE_SECRET_KEY | External source secret key |
Module repository for more information: https://github.com/deepintdev/deepint-node-connector
Start by running npm install inside the module folder.
npm run tsc to build the module,
npm run start to build the module,
npm run pre to run it in development mode.
To get the documentation of the module functions: npx typedoc --out docs .
This project has been developed with TypeScript, Node Js and Express languages and technologies.
To express our gratitude to the following people involved in this project:
- Miguel Chaveinte García: https://github.com/miguelchaveinte
- Pablo Chamoso Santos: https://github.com/chamoso
- Francisco Pinto Santos: https://github.com/GandalFran
- Raúl López Blanco: https://github.com/raullb34
- Ángel Martín Domínguez: https://github.com/amartdom
- Alberto Galante Melero: https://github.com/Galazord