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

datahub-nodejs-sdk

Package Overview
Dependencies
Maintainers
2
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

datahub-nodejs-sdk - npm Package Compare versions

Comparing version 1.1.0 to 2.0.0

88

lib/datahub-nodejs-sdk.js

@@ -100,92 +100,4 @@ 'use strict';

}
/**
* update scene by projectId and dataId.
* @async
* @param {string} projectId
* @param {string} dataId
* @returns {Promise}
*/
async updateSceneByProjectIdAndDataId (projectId, dataId, {
currentScene,
delay,
statusCode,
responseHeaders,
}) {
assertArgument(projectId, 'projectId is required');
assertArgument(dataId, 'dataId is required');
const res = await this.getDataByProjectIdAndDataId(projectId, dataId);
if (!res.success) {
return this.EXCEPTION_RESPONSE;
}
let proxyContent = {};
try {
proxyContent = JSON.parse(res.data.proxyContent);
} catch (_) { /* ignore invalid proxyContent */ }
proxyContent.statusCode = statusCode;
proxyContent.responseHeaders = responseHeaders;
return this.post(`data/${projectId}/${dataId}`, {
currentScene,
delay,
proxyContent: JSON.stringify(proxyContent),
});
}
/**
* update multiple data
* @async
* @param {object} data list
* @returns {Promise}
*/
async updateMultiData (data) {
assertArgument(data, 'data is required');
return this.post('multi/data', data);
}
/**
* get data list by projectId and dataId.
* @async
* @param {string} projectId
* @param {string} dataId
* @returns {Promise}
*/
async getDataByProjectIdAndDataId (projectId, dataId) {
assertArgument(projectId, 'projectId is required');
assertArgument(dataId, 'dataId is required');
return this.get(`data/${projectId}/${dataId}`);
}
/**
* get data list by projectId.
* @async
* @param {string} projectId
* @returns {Promise}
*/
async getDataListByProjectId (projectId) {
assertArgument(projectId, 'projectId is required');
return this.get(`data/${projectId}`);
}
/**
* get scene data
* @async
* @param {string} projectId
* @param {string} dataId
* @param {string} sceneId
* @returns {Object} scene data
*/
async getSceneDataByProjectIdAndDataId (projectId, dataId, sceneId) {
assertArgument(projectId, 'projectId is required');
assertArgument(dataId, 'dataId is required');
assertArgument(sceneId, 'sceneId is required');
const res = await this.getDataByProjectIdAndDataId(projectId, dataId);
try {
const jsonData = JSON.parse(res.data.scenes);
return jsonData.find(i => i.name === sceneId).data;
} catch (_) {
return {};
}
}
}
module.exports = DataHubSDK;

2

package.json
{
"name": "datahub-nodejs-sdk",
"version": "1.1.0",
"version": "2.0.0",
"description": "DataHub Node.js SDK",

@@ -5,0 +5,0 @@ "keywords": [

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