New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

mb-vqb-core

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mb-vqb-core - npm Package Compare versions

Comparing version 0.6.1 to 0.7.1

1

dist/codeGenerator/index.js

@@ -122,2 +122,3 @@ "use strict";

registerCodeGenerator(_1.CodeGenType.NodeJSAsync, nodejs.generateNodeJsEs7Code);
registerCodeGenerator(_1.CodeGenType.NodeJS3xAsync, nodejs.generateNodeJsDriver3xEs7Code);
registerCodeGenerator(_1.CodeGenType.Python, python.generatePythonCode);

@@ -124,0 +125,0 @@ registerCodeGenerator(_1.CodeGenType.CSharp, csharp.generateCSharpCode);

@@ -6,1 +6,2 @@ import * as vqb from "../";

export declare function generateNodeJsEs7Code(params: vqb.GenerateCodeParams): any;
export declare function generateNodeJsDriver3xEs7Code(params: vqb.GenerateCodeParams): any;

20

dist/codeGenerator/nodeJsGen.js

@@ -8,12 +8,16 @@ "use strict";

var mongoUri = _a.mongoUri, collection = _a.collection, importsList = _a.importsList, refFunctionList = _a.refFunctionList, clause = _a.clause;
return "var mongodb = require(\"mongodb\");\n" + (importsList.map(function (it) { return "var " + it + "=mongodb." + it + ";"; }).join("\n") + "\n") + "\n" + refFunctionList.join("\n") + "\n\nvar client = mongodb.MongoClient;\n\nclient.connect(" + JSON.stringify(mongoUri) + ", function (err, db) {\n \n var cursor = db.collection(" + JSON.stringify(collection) + ")" + clause + ";\n \n // Created with MongoBoooter, the essential IDE for MongoDB - https://www.mongobooster.com\n cursor.toArray(function(err, docs) {\n if (err) throw err;\n console.log(docs.map(function(it){return it._id}));\n db.close();\n });\n});";
return "var mongodb = require(\"mongodb\");//npm i mongodb@2\n" + (importsList.map(function (it) { return "var " + it + "=mongodb." + it + ";"; }).join("\n") + "\n") + "\n" + refFunctionList.join("\n") + "\n\nvar client = mongodb.MongoClient;\n\nclient.connect(" + JSON.stringify(mongoUri) + ", function (err, db) {\n \n var cursor = db.collection(" + JSON.stringify(collection) + ")" + clause + ";\n \n // Created with MongoBoooter, the essential IDE for MongoDB - https://www.mongobooster.com\n cursor.toArray(function(err, docs) {\n if (err) throw err;\n console.log(docs.map(function(it){return it._id}));\n db.close();\n });\n});";
};
var es6tmpl = function (_a) {
var mongoUri = _a.mongoUri, collection = _a.collection, importsList = _a.importsList, refFunctionList = _a.refFunctionList, clause = _a.clause;
return "const mongodb=require(\"mongodb\");\nconst {" + ["MongoClient"].concat(importsList).join(",") + "}=mongodb;\n\n" + refFunctionList.join("\n") + "\n\n// Created with MongoBoooter, the essential IDE for MongoDB - https://www.mongobooster.com\nMongoClient.connect(" + JSON.stringify(mongoUri) + ").then((db)=> {\n return db.collection(" + JSON.stringify(collection) + ")" + clause + "\n .toArray()\n .then((docs)=>{\n console.log(docs.map(it=>it._id));\n db.close();\n })\n }).catch(err=>{\n console.error(err);\n});";
return "const mongodb=require(\"mongodb\");//npm i mongodb@2\nconst {" + ["MongoClient"].concat(importsList).join(",") + "}=mongodb;\n\n" + refFunctionList.join("\n") + "\n\n// Created with MongoBoooter, the essential IDE for MongoDB - https://www.mongobooster.com\nMongoClient.connect(" + JSON.stringify(mongoUri) + ").then((db)=> {\n return db.collection(" + JSON.stringify(collection) + ")" + clause + "\n .toArray()\n .then((docs)=>{\n console.log(docs.map(it=>it._id));\n db.close();\n })\n }).catch(err=>{\n console.error(err);\n});";
};
var es7tmpl = function (_a) {
var mongoUri = _a.mongoUri, collection = _a.collection, importsList = _a.importsList, refFunctionList = _a.refFunctionList, clause = _a.clause;
return "const mongodb=require(\"mongodb\");\nconst {" + ["MongoClient"].concat(importsList).join(",") + "}=mongodb;\n\n" + refFunctionList.join("\n") + "\n\n// Created with MongoBoooter, the essential IDE for MongoDB - https://www.mongobooster.com\nasync function main(){\n const db=await MongoClient.connect(" + JSON.stringify(mongoUri) + ");\n const docs=await db.collection(" + JSON.stringify(collection) + ")" + clause + "\n .toArray();\n \n console.log(docs.map(it=>it._id));\n\n db.close();\n}\n\nmain()";
return "const mongodb=require(\"mongodb\");//npm i mongodb@2\nconst {" + ["MongoClient"].concat(importsList).join(",") + "}=mongodb;\n\n" + refFunctionList.join("\n") + "\n\n// Created with MongoBoooter, the essential IDE for MongoDB - https://www.mongobooster.com\nasync function main(){\n const db=await MongoClient.connect(" + JSON.stringify(mongoUri) + ");\n const docs=await db.collection(" + JSON.stringify(collection) + ")" + clause + "\n .toArray();\n \n console.log(docs.map(it=>it._id));\n\n db.close();\n}\n\nmain()";
};
var es7Driver3xtmpl = function (_a) {
var mongoUriNoDb = _a.mongoUriNoDb, database = _a.database, collection = _a.collection, importsList = _a.importsList, refFunctionList = _a.refFunctionList, clause = _a.clause;
return "const mongodb=require(\"mongodb\");//npm i mongodb\nconst {" + ["MongoClient"].concat(importsList).join(",") + "}=mongodb;\n\n" + refFunctionList.join("\n") + "\n\n// Created with MongoBoooter, the essential IDE for MongoDB - https://www.mongobooster.com\nasync function main(){\n const client=await MongoClient.connect(" + JSON.stringify(mongoUriNoDb) + ");\n const db=client.db(" + JSON.stringify(database) + ")\n const docs=await db.collection(" + JSON.stringify(collection) + ")" + clause + "\n .toArray();\n \n console.log(docs.map(it=>it._id));\n\n client.close();\n}\n\nmain()";
};
function nodejsStringify(_a) {

@@ -39,3 +43,3 @@ var obj = _a.obj, imports = _a.imports, fakeMod = _a.fakeMod;

//vqb.fakeMongo.nodejs
var mongoUri = params.mongoUri, type = params.type, pipeline = params.pipeline, database = params.database, collection = params.collection;
var mongoUri = params.mongoUri, mongoUriNoDb = params.mongoUriNoDb, type = params.type, pipeline = params.pipeline, database = params.database, collection = params.collection;
var _a = params.isAggr ? { $match: pipeline } : pipeline, $match = _a.$match, $project = _a.$project, $sort = _a.$sort, $skip = _a.$skip, $limit = _a.$limit;

@@ -46,3 +50,3 @@ var transRst = _1.codegen.trans$match({ $match: $match, fakeMod: fakeMod || vqb.codegen.fakeNodejs, stringifyFunc: nodejsStringify, isAggr: params.isAggr });

var aggrClause = ".aggregate(" + transRst.wherePart + ")";
return tmplFunc({ mongoUri: mongoUri, database: database, collection: collection, importsList: transRst.importList, refFunctionList: transRst.refFunctionList, clause: aggrClause });
return tmplFunc({ mongoUri: mongoUri, mongoUriNoDb: mongoUriNoDb, database: database, collection: collection, importsList: transRst.importList, refFunctionList: transRst.refFunctionList, clause: aggrClause });
}

@@ -57,3 +61,3 @@ else {

});
return tmplFunc({ mongoUri: mongoUri, database: database, collection: collection, importsList: transRst.importList, refFunctionList: transRst.refFunctionList, clause: findClause });
return tmplFunc({ mongoUri: mongoUri, database: database, mongoUriNoDb: mongoUriNoDb, collection: collection, importsList: transRst.importList, refFunctionList: transRst.refFunctionList, clause: findClause });
}

@@ -77,2 +81,6 @@ })();

exports.generateNodeJsEs7Code = generateNodeJsEs7Code;
function generateNodeJsDriver3xEs7Code(params) {
return doGenNodeJsCode(params, es7Driver3xtmpl);
}
exports.generateNodeJsDriver3xEs7Code = generateNodeJsDriver3xEs7Code;
//# sourceMappingURL=nodeJsGen.js.map

@@ -14,3 +14,3 @@ "use strict";

}
if ([_1.CodeGenType.NodeJS, _1.CodeGenType.NodeJSAsync, _1.CodeGenType.NodeJSPromise].indexOf(type) > -1) {
if ([_1.CodeGenType.NodeJS, _1.CodeGenType.NodeJSAsync, _1.CodeGenType.NodeJSPromise, _1.CodeGenType.NodeJS3xAsync].indexOf(type) > -1) {
return _1.codegen.fakeNodejs;

@@ -17,0 +17,0 @@ }

@@ -65,5 +65,6 @@ export * from "./utils";

ShellJs = "MongoDB Shell",
NodeJS = "Javascript Node.js ES5",
NodeJSPromise = "Javascript Node.js ES6 Promise",
NodeJSAsync = "Javascript Node.js ES7 Async/Await",
NodeJS3xAsync = "Node.js ES7 Async/Await (3.x driver)",
NodeJS = "Node.js ES5 (2.x driver)",
NodeJSPromise = "Node.js ES6 Promise (2.x driver)",
NodeJSAsync = "Node.js ES7 Async/Await (2.x driver)",
Python = "Python (PyMongo3.x)",

@@ -70,0 +71,0 @@ CSharp = "C# (2.x driver)",

@@ -27,5 +27,6 @@ "use strict";

//FluentShellJs = "MongoBooster Fluent shell js",
CodeGenType["NodeJS"] = "Javascript Node.js ES5";
CodeGenType["NodeJSPromise"] = "Javascript Node.js ES6 Promise";
CodeGenType["NodeJSAsync"] = "Javascript Node.js ES7 Async/Await";
CodeGenType["NodeJS3xAsync"] = "Node.js ES7 Async/Await (3.x driver)";
CodeGenType["NodeJS"] = "Node.js ES5 (2.x driver)";
CodeGenType["NodeJSPromise"] = "Node.js ES6 Promise (2.x driver)";
CodeGenType["NodeJSAsync"] = "Node.js ES7 Async/Await (2.x driver)";
CodeGenType["Python"] = "Python (PyMongo3.x)";

@@ -32,0 +33,0 @@ CodeGenType["CSharp"] = "C# (2.x driver)";

{
"name": "mb-vqb-core",
"version": "0.6.1",
"version": "0.7.1",
"description": "mb query core, internal project",

@@ -18,3 +18,3 @@ "main": "dist/index.js",

"codegen-debug": "node --inspect-brk ./test/codegen.js",
"codegen": "node ./test/codegen.js",
"codegen": "tsc && node ./test/codegen.js",
"node-es5-find": "node ./test/codegen-out/find/javascript_node_js_es_5.js",

@@ -21,0 +21,0 @@ "node-es5-aggr": "node ./test/codegen-out/aggregate/javascript_node_js_es_5.js",

@@ -11,3 +11,4 @@

cmd 2:
npm run codegen
npm run codegen-all //for code gen
npm run test //for query builder
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