Socket
Socket
Sign inDemoInstall

nqm-common-import

Package Overview
Dependencies
53
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.4 to 0.0.5

26

lib/commands.js

@@ -44,3 +44,3 @@ /**

buildSchema(schema[k], v);
} else if (typeof v === "string" && k !== "type") {
} else if (typeof v === "string" && k !== "__tdxType") {
schema[k] = { type: v };

@@ -53,15 +53,12 @@ } else {

};
function createTargetDataset(commandHost, accessToken, name, schema, primaryKey, cb) {
var url = util.format("%s/commandSync/dataset/create", commandHost);
function createTargetDataset(commandHost, accessToken, targetFolder, name, basedOn, schema, primaryKey, cb) {
var url = util.format("%s/commandSync/resource/create", commandHost);
var data = {};
data.parentId = targetFolder;
data.name = name;
data.uniqueIndex = _.map(primaryKey, function(key) { return { asc: key }} );
data.schema = {};
buildSchema(data.schema, schema);
_.forEach(primaryKey, function(key) {
var pointer = parser.DotNotationPointers(data.schema, key)[0];
pointer.val.index = true;
pointer.val.unique = true;
});
data.basedOnSchema = basedOn;
data.schema = { dataSchema: schema };
data.schema.uniqueIndex = _.map(primaryKey, function(key) { return { asc: key }} );
// buildSchema(data.schema.dataSchema, schema);
log("sending create dataset [%j]",data);

@@ -116,4 +113,5 @@ request({ url: url, method: "post", headers: { authorization: "Bearer " + accessToken }, json: true, body: data }, function(err, response, content) {

bulk.payload = data;
log("sending createMany [%d - %d bytes]",data.length, JSON.stringify(data).length);
request({ url: url, timeout: 3600000, method: "post", headers: { authorization: "Bearer " + accessToken }, json: true, body: bulk }, function(err, response, content) {
var requestOptions = { url: url, timeout: 3600000, method: "post", headers: { authorization: "Bearer " + accessToken }, json: true, body: bulk };
log("sending createMany [%d - %d bytes] to %s using token %s",data.length, JSON.stringify(data).length, url, accessToken);
request(requestOptions, function(err, response, content) {
if (err || response.statusCode !== 200 || response.body.error) {

@@ -120,0 +118,0 @@ err = err || new Error(response.body.error || "not found");

@@ -94,10 +94,13 @@ /**

var flattened = exports.flattenSchema(schema);
// Create a lookup for all possible target fields, and determine
// if the target is an array.
// Create a lookup for all possible target fields
var fieldMap = {};
_.forEach(flattened, function(v,k) {
fieldMap[k] = {
name: k,
type: v.type ? v.type : v
};
var comps = k.split(".");
var last = comps.splice(-1,1);
if (last[0].indexOf("__tdxType") !== 0) {
fieldMap[k] = {
name: k,
type: v.__tdxType ? v.__tdxType : v
};
}
});

@@ -104,0 +107,0 @@

{
"name": "nqm-common-import",
"version": "0.0.4",
"repository": {
"type": "git",
"url": "git://github.com/nqminds/nqm-common-import.git"
},
"version": "0.0.5",
"description": "",

@@ -5,0 +9,0 @@ "main": "index.js",

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