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

sqrl-cli

Package Overview
Dependencies
Maintainers
2
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sqrl-cli - npm Package Compare versions

Comparing version 0.6.7 to 0.6.8

59

lib/cli/CliArgs.js

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

"<feature>": [],
"<key=value>": []
"<key=value>": [],
};

@@ -71,8 +71,13 @@ function getInputs(args) {

redis: args["--redis"] || null,
requires: (args["--require"] || "").split(",").filter(v => v),
skipDefaultRequires: args["--skip-default-requires"] || false
requires: (args["--require"] || "").split(",").filter((v) => v),
skipDefaultRequires: args["--skip-default-requires"] || false,
};
}
function getCompiledCommandArgs(args) {
return Object.assign(Object.assign({}, getBaseArgs(args)), { inputs: getInputs(args), filename: args["<filename>"] || null, compiled: args["--compiled"] || false });
return {
...getBaseArgs(args),
inputs: getInputs(args),
filename: args["<filename>"] || null,
compiled: args["--compiled"] || false,
};
}

@@ -86,18 +91,41 @@ function intArg(args, arg) {

if (args.compile) {
return Object.assign({ command: "compile" }, getCompiledCommandArgs(args));
return {
command: "compile",
...getCompiledCommandArgs(args),
};
}
else if (args.help) {
return Object.assign(Object.assign({ command: "help" }, getBaseArgs(args)), { section: "functions" });
return {
command: "help",
...getBaseArgs(args),
section: "functions",
};
}
else if (args.repl) {
return Object.assign({ command: "repl" }, getCompiledCommandArgs(args));
return {
command: "repl",
...getCompiledCommandArgs(args),
};
}
else if (args.run) {
return Object.assign(Object.assign({ command: "run" }, getCompiledCommandArgs(args)), { concurrency: intArg(args, "--concurrency"), streamFeature: args["--stream"] || null });
return {
command: "run",
...getCompiledCommandArgs(args),
concurrency: intArg(args, "--concurrency"),
streamFeature: args["--stream"] || null,
};
}
else if (args.serve) {
return Object.assign({ command: "serve", port: intArg(args, "--port") }, getCompiledCommandArgs(args));
return {
command: "serve",
port: intArg(args, "--port"),
...getCompiledCommandArgs(args),
};
}
else if (args.test) {
return Object.assign(Object.assign({ command: "test" }, getBaseArgs(args)), { filename: args["<filename>"] });
return {
command: "test",
...getBaseArgs(args),
filename: args["<filename>"],
};
}

@@ -113,8 +141,11 @@ else {

}
const args = Object.assign({ defaultDocOptArgs: exports.defaultDocOptArgs }, docopt_1.docopt(exports.CliDoc, {
version: 0.1,
argv
}));
const args = {
defaultDocOptArgs: exports.defaultDocOptArgs,
...docopt_1.docopt(exports.CliDoc, {
version: 0.1,
argv,
}),
};
return docOptToCliArgs(args);
}
exports.parseArgs = parseArgs;

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

features: args.features,
onlyBlocked: args.onlyBlocked
onlyBlocked: args.onlyBlocked,
};

@@ -93,3 +93,7 @@ if (args.output === "pretty") {

async function createInstance(args) {
const config = Object.assign(Object.assign(Object.assign({}, sqrl_1.getDefaultConfig()), { "state.allow-in-memory": true }), (args.config ? await readJsonFile_1.readJsonFile(args.config) : {}));
const config = {
...sqrl_1.getDefaultConfig(),
"state.allow-in-memory": true,
...(args.config ? await readJsonFile_1.readJsonFile(args.config) : {}),
};
if (args.redis) {

@@ -100,3 +104,3 @@ config["redis.address"] = args.redis;

assert: new CliAssertService(),
log: new CliLogService()
log: new CliLogService(),
};

@@ -112,5 +116,5 @@ const instance = SQRL.createInstance({ config, services });

"sqrl-jsonpath",
"sqrl-cli-functions"
"sqrl-cli-functions",
]),
...args.requires
...args.requires,
];

@@ -148,3 +152,3 @@ for (const name of requires) {

filesystem,
manipulatorFactory: () => new sqrl_cli_functions_1.CliManipulator()
manipulatorFactory: () => new sqrl_cli_functions_1.CliManipulator(),
});

@@ -186,3 +190,3 @@ const datasetId = "0";

spec: null,
compiled: null
compiled: null,
};

@@ -194,3 +198,3 @@ }

mainFile: path.basename(filename),
setInputs: inputs
setInputs: inputs,
});

@@ -210,3 +214,3 @@ }

await run.triggerRecompile(() => {
return loadSource().then(rv => rv.executable);
return loadSource().then((rv) => rv.executable);
});

@@ -226,3 +230,3 @@ }

throw new CliError_1.CliError("Required input was not provided: " + feature, {
suggestion: `Try add: -s ${feature}=<value>`
suggestion: `Try add: -s ${feature}=<value>`,
});

@@ -266,3 +270,3 @@ }

streamFeature,
features: args.features
features: args.features,
});

@@ -292,3 +296,3 @@ }

manipulatorFactory: () => new sqrl_cli_functions_1.CliManipulator(),
inputs
inputs,
});

@@ -299,6 +303,6 @@ await test.runStatements(ctx, statements);

stdin: options.stdin,
stdout: options.stdout
stdout: options.stdout,
});
repl.start();
await new Promise(resolve => {
await new Promise((resolve) => {
repl.on("exit", resolve);

@@ -312,3 +316,3 @@ });

server.on("listening", resolve);
server.on("error", err => reject(err));
server.on("error", (err) => reject(err));
});

@@ -315,0 +319,0 @@ try {

@@ -48,4 +48,4 @@ "use strict";

.getSlotExprs()
.map(expr => sqrl_1.serializeExpr(expr)),
slotNames: compiledOutput.getSlotNames()
.map((expr) => sqrl_1.serializeExpr(expr)),
slotNames: compiledOutput.getSlotNames(),
}) + "\n");

@@ -57,3 +57,6 @@ }

async compiled(compiledOutput) {
console.log(jsonStableStringify(Object.assign(Object.assign({}, compiledOutput.getExecutableSpec()), { features: compiledOutput.getFeatureDocs() })));
console.log(jsonStableStringify({
...compiledOutput.getExecutableSpec(),
features: compiledOutput.getFeatureDocs(),
}));
}

@@ -65,3 +68,3 @@ }

console.log(generateDot_1.generateDotFile(sqrl_1.createSimpleContext(), compiledOutput, [
"SqrlExecutionComplete"
"SqrlExecutionComplete",
]));

@@ -112,3 +115,3 @@ }

}
const row = this.features.map(name => {
const row = this.features.map((name) => {
return sqrl_common_1.SqrlObject.ensureBasic(loggedFeatures[name]);

@@ -151,8 +154,8 @@ });

if (this.includeLogMessages) {
manipulator.logged.forEach(message => {
manipulator.logged.forEach((message) => {
console.error(message);
});
}
this.rows.push(sqrl_common_1.mapObject(loggedFeatures, val => val.getBasicValue()));
Object.keys(loggedFeatures).forEach(name => {
this.rows.push(sqrl_common_1.mapObject(loggedFeatures, (val) => val.getBasicValue()));
Object.keys(loggedFeatures).forEach((name) => {
this.headers.add(name);

@@ -166,3 +169,3 @@ });

const headers = this.features.concat(Array.from(this.headers)
.filter(feature => !this.features.includes(feature))
.filter((feature) => !this.features.includes(feature))
.sort());

@@ -169,0 +172,0 @@ if (this.rows.length) {

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

source: true,
stacktrace: false
stacktrace: false,
});

@@ -136,3 +136,3 @@ }

this.line(chalk_1.default.red.bold(CROSS) + time + chalk_1.default.red("action was blocked."));
manipulator.blockedRules.forEach(details => {
manipulator.blockedRules.forEach((details) => {
this.line(chalk_1.default.red(`${DOWNWARDS_ARROW} [${details.name}]` +

@@ -162,5 +162,5 @@ (details.reason ? ": " + details.reason : "")));

}
manipulator.logged.forEach(message => this.line(message));
manipulator.logged.forEach((message) => this.line(message));
}
}
exports.CliPrettyOutput = CliPrettyOutput;

@@ -16,7 +16,7 @@ "use strict";

return compileCallback()
.then(rv => {
.then((rv) => {
this.executable = rv;
this.output.sourceUpdated();
})
.catch(err => {
.catch((err) => {
this.output.sourceRecompileError(err);

@@ -30,3 +30,3 @@ });

inputs,
manipulator
manipulator,
});

@@ -46,6 +46,6 @@ const loggedFeatures = {};

const busy = new Semaphore_1.default();
stream.on("data", line => {
stream.on("data", (line) => {
const lineValues = Object.assign({}, options.inputs);
try {
lineValues[options.streamFeature] = JSON.parse(line);
lineValues[options.streamFeature] = JSON.parse(line.toString("utf-8"));
}

@@ -56,3 +56,3 @@ catch (err) {

}
sqrl_common_1.promiseFinally(busy.wrap(this.action(options.ctx, lineValues, options.features).catch(err => {
sqrl_common_1.promiseFinally(busy.wrap(this.action(options.ctx, lineValues, options.features).catch((err) => {
console.error("Error: " + err.toString());

@@ -68,3 +68,3 @@ })), () => {

stream.on("end", () => resolve());
stream.on("error", err => reject(err));
stream.on("error", (err) => reject(err));
});

@@ -71,0 +71,0 @@ await busy.waitForZero();

@@ -12,5 +12,5 @@ "use strict";

fillColor: "",
includeSlots: false
includeSlots: false,
}) {
const { includeCost, includeSlots, reverseEdges, clusterRules, clusterFeatures } = options;
const { includeCost, includeSlots, reverseEdges, clusterRules, clusterFeatures, } = options;
const ignoreSet = new Set(ignore);

@@ -23,3 +23,3 @@ const nodes = {};

slotNames.forEach((slotName, idx) => {
slotLoad[idx].forEach(loadIdx => {
slotLoad[idx].forEach((loadIdx) => {
const feature = slotNames[loadIdx];

@@ -34,3 +34,3 @@ forward[slotName].add(feature);

cost: 0,
recursiveCost: 0
recursiveCost: 0,
};

@@ -44,3 +44,3 @@ });

cost: doc.cost,
recursiveCost: doc.recursiveCost
recursiveCost: doc.recursiveCost,
};

@@ -60,3 +60,3 @@ });

recurseSeen.add(name);
edges[name].forEach(feature => recurse(feature, edges, recurseSeen));
edges[name].forEach((feature) => recurse(feature, edges, recurseSeen));
}

@@ -75,4 +75,4 @@ const seen = new Set();

.sort()
.filter(name => !ignoreSet.has(name))
.map(name => nodes[name]);
.filter((name) => !ignoreSet.has(name))
.map((name) => nodes[name]);
function quoteName(name) {

@@ -83,3 +83,3 @@ return sqrl_1.isValidFeatureName(name) ? name : JSON.stringify(name);

let nodesDot = filteredNodes
.map(node => {
.map((node) => {
let label = node.name;

@@ -103,8 +103,8 @@ if (!includeSlots && !sqrl_1.isValidFeatureName(node.name)) {

}
rv += nodesToDot(renderNodes.filter(node => node.rule), "red", clusterRules ? "cluster_rules" : null);
rv += nodesToDot(renderNodes.filter(node => !node.rule), "blue", clusterFeatures ? "cluster_features" : null);
renderNodes.forEach(node => {
rv += nodesToDot(renderNodes.filter((node) => node.rule), "red", clusterRules ? "cluster_rules" : null);
rv += nodesToDot(renderNodes.filter((node) => !node.rule), "blue", clusterFeatures ? "cluster_features" : null);
renderNodes.forEach((node) => {
Array.from(forward[node.name])
.sort()
.forEach(feature => {
.forEach((feature) => {
if (render.has(feature) && !ignoreSet.has(feature)) {

@@ -111,0 +111,0 @@ if (reverseEdges) {

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

persistent: false,
usePolling: true
usePolling: true,
});

@@ -18,0 +18,0 @@ }

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

})
.catch(err => {
.catch((err) => {
output.error(err);

@@ -35,0 +35,0 @@ }), () => {

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

this.closed = true;
this.list.forEach(o => o.close());
this.list.forEach((o) => o.close());
this.list = [];

@@ -19,0 +19,0 @@ }

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

return target[name];
}
},
});

@@ -15,0 +15,0 @@ }

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

.sort()
.map(pkg => {
.map((pkg) => {
return renderPackageHelp("stdlib", pkg, stdlib[pkg]);

@@ -43,7 +43,7 @@ }),

.sort()
.map(pkg => {
.map((pkg) => {
return renderPackageHelp("package", pkg, packages[pkg]);
})
}),
].join("\n\n");
}
exports.renderFunctionsHelp = renderFunctionsHelp;

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

const ast = SqrlParse_1.parseRepl(input, {
customFunctions: this.instance._instance.customFunctions
customFunctions: this.instance._instance.customFunctions,
});

@@ -50,3 +50,3 @@ const statements = ast.statements;

location: last.location,
expr: last
expr: last,
};

@@ -63,3 +63,3 @@ }

description: null,
location
location,
}));

@@ -122,3 +122,3 @@ returnFeature = "SqrlReplOutput";

.reverse()
.filter(line => line.trim());
.filter((line) => line.trim());
}

@@ -142,4 +142,4 @@ else {

eval: (cmd, context, filename, callback) => {
this.eval(cmd, context, filename).then(rv => callback(null, rv), err => callback(err, null));
}
this.eval(cmd, context, filename).then((rv) => callback(null, rv), (err) => callback(err, null));
},
});

@@ -151,3 +151,3 @@ this.server.on("exit", () => {

if (this.server.history) {
this.readHistory().map(line => this.server.history.push(line));
this.readHistory().map((line) => this.server.history.push(line));
}

@@ -154,0 +154,0 @@ }

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

separator: "blue",
"value:json": "gray"
"value:json": "gray",
};

@@ -21,3 +21,3 @@ function spanToShell(span) {

if (span.children) {
rv = span.children.map(child => spanToShell(child)).join("");
rv = span.children.map((child) => spanToShell(child)).join("");
}

@@ -24,0 +24,0 @@ else {

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

inputs,
featureTimeoutMs
featureTimeoutMs,
});

@@ -29,3 +29,3 @@ await execution.fetchFeature("SqrlExecutionComplete");

rules[rule.name] = {
reason: rule.reason
reason: rule.reason,
};

@@ -38,5 +38,5 @@ return rule.name;

blockRules: manipulator.blockedRules.map(ruleToName) || [],
whitelistRules: manipulator.whitelistedRules.map(ruleToName) || []
whitelistRules: manipulator.whitelistedRules.map(ruleToName) || [],
},
rules
rules,
};

@@ -43,0 +43,0 @@ if (query.features) {

{
"name": "sqrl-cli",
"version": "0.6.7",
"version": "0.6.8",
"description": "SQRL (A Safe, Stateful Rules Language for Event Streams) - command line tools",

@@ -54,3 +54,3 @@ "homepage": "https://twitter.github.io/sqrl",

"engines": {
"node": ">=6.0.0"
"node": ">=12.0.0"
},

@@ -70,12 +70,12 @@ "dependencies": {

"split2": "^3.2.2",
"sqrl": "^0.6.7",
"sqrl-cli-functions": "^0.6.7",
"sqrl-common": "^0.6.7",
"sqrl-jsonpath": "^0.6.7",
"sqrl-load-functions": "^0.6.7",
"sqrl-redis-functions": "^0.6.7",
"sqrl-text-functions": "^0.6.7",
"sqrl": "^0.6.8",
"sqrl-cli-functions": "^0.6.8",
"sqrl-common": "^0.6.8",
"sqrl-jsonpath": "^0.6.8",
"sqrl-load-functions": "^0.6.8",
"sqrl-redis-functions": "^0.6.8",
"sqrl-text-functions": "^0.6.8",
"wait-for-sigint": "^0.1.0"
},
"gitHead": "58739afad2cac0a31ea348ad2fcfee09e86d54e2"
"gitHead": "43c653144f3e4947ce96d4d62d5fc5fc3200e79e"
}
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