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

cassanknex

Package Overview
Dependencies
Maintainers
6
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cassanknex - npm Package Compare versions

Comparing version 1.17.0 to 1.18.0

2

componentDeclarations/componentBuilderMethods.js

@@ -57,2 +57,3 @@ /**

"orWhere": {"name": "orWhere", "grouping": "where"},
"tokenWhere": {"name": "tokenWhere", "grouping": "where"},

@@ -79,2 +80,3 @@ "orderBy": {"name": "orderBy", "grouping": "orderBy"},

"ttl": {"name": "ttl", "grouping": "aggregate"},
"writetime": {"name": "writetime", "grouping": "aggregate"},

@@ -81,0 +83,0 @@ "allowFiltering": {"name": "allowFiltering", "grouping": "allow"}

22

package.json
{
"name": "cassanknex",
"version": "1.17.0",
"version": "1.18.0",
"description": "An Apache Cassandra CQL query builder with support for the DataStax NodeJS driver, written in the spirit of Knex.",

@@ -23,14 +23,14 @@ "main": "index.js",

"dependencies": {
"cassandra-driver": "^3.2.2",
"inherits": "^2.0.1",
"lodash": "^3.10.1"
"cassandra-driver": "^3.5.0",
"inherits": "^2.0.3",
"lodash": "^4.17.10"
},
"devDependencies": {
"async": "^0.9.0",
"chai": "^2.2.0",
"grunt": "^0.4.5",
"grunt-contrib-jshint": "^0.11.1",
"grunt-mocha-test": "^0.13.2",
"mocha": "^3.1.2",
"uuid": "^2.0.1"
"async": "^2.6.1",
"chai": "^4.1.2",
"grunt": "^1.0.3",
"grunt-contrib-jshint": "^1.1.0",
"grunt-mocha-test": "^0.13.3",
"mocha": "^5.2.0",
"uuid": "^3.3.2"
},

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

@@ -107,2 +107,3 @@ /**

switch (aggregate.type) {
case "writetime":
case "ttl":

@@ -118,3 +119,3 @@ var key, val;

cql += (columnStatements.length ? ", " : "") +
"ttl(" + formatter.wrapQuotes(key) + ")" +
aggregate.type + "(" + formatter.wrapQuotes(key) + ")" +
(val ? " AS " + formatter.wrapQuotes(val) : "");

@@ -253,15 +254,22 @@ break;

var key = statement.key;
// test for nested columns
if ((/\[.*\]$/).test(key)) {
var value = formatter.parameterize(statement.val, client);
if ((/\[.*\]$/).test(key)) { // test for nested columns
key = formatter.wrapQuotes(key.replace(/\[.*/g, "")) + key.replace(/.+?(?=\[)/, "");
}
else if (Array.isArray(key)) {
key = '"' + key.join('", "') + '"';
}
else {
key = formatter.wrapQuotes(key);
}
if (type === "tokenWhere") {
key = 'TOKEN(' + key + ')';
value = 'TOKEN(' + value + ')';
}
switch (statement.op.toLowerCase()) {
case "in":
relations.push([key, statement.op, "(" + formatter.parameterize(statement.val, client) + ")"].join(" "));
relations.push([key, statement.op, "(" + value + ")"].join(" "));
break;
default:
relations.push([key, statement.op, formatter.parameterize(statement.val, client)].join(" "));
relations.push([key, statement.op, value].join(" "));
}

@@ -357,3 +365,3 @@ });

_.each(usingStatements, function (statement) {
var statementString = "USING ";
var statementString = using.length ? "" : "USING ";
if (statement.type === "usingTTL")

@@ -377,3 +385,3 @@ statementString += "TTL ";

_.each(_.pluck(orderByStatements, "orderBy"), function (statement) {
_.each(_.map(orderByStatements, "orderBy"), function (statement) {
orderBy.push(formatter.wrapQuotes(statement.column) + " " + statement.order);

@@ -380,0 +388,0 @@ });

@@ -645,2 +645,3 @@

- orWhere
- tokenWhere
- set

@@ -661,2 +662,3 @@ - add

- count
- writetime

@@ -735,2 +737,7 @@ ##### <a name="QueryModifiers-ColumnFamilies"></a>*For column family queries*:

- 1.18.0 (Special thanks to @dekelev for these contributions)
- Update project library dependencies per [#42](https://github.com/azuqua/cassanknex/pull/42).
- Fix issue when using both the `usingTimestamp` & `usingTTL` query modifiers per [#43](https://github.com/azuqua/cassanknex/pull/43).
- Add `writetime` query modifier per [#44](https://github.com/azuqua/cassanknex/pull/44/files).
- Add `tokenWhere` query modifier per [#45](https://github.com/azuqua/cassanknex/pull/45/files).
- 1.17.0

@@ -737,0 +744,0 @@ - Add `Date` type for column family compilation.

@@ -18,3 +18,3 @@ /**

var cql = 'INSERT INTO "cassanKnexy"."columnFamily" ("id","bar","baz") VALUES (?, ?, ?) USING TIMESTAMP ? AND USING TTL ?;'
var cql = 'INSERT INTO "cassanKnexy"."columnFamily" ("id","bar","baz") VALUES (?, ?, ?) USING TIMESTAMP ? AND TTL ?;'
, qb = cassanKnex("cassanKnexy")

@@ -36,3 +36,3 @@ , values = {

var cql = 'INSERT INTO "cassanKnexy"."columnFamily" ("id","bar","baz") VALUES (?, ?, ?) IF NOT EXISTS USING TIMESTAMP ? AND USING TTL ?;'
var cql = 'INSERT INTO "cassanKnexy"."columnFamily" ("id","bar","baz") VALUES (?, ?, ?) IF NOT EXISTS USING TIMESTAMP ? AND TTL ?;'
, qb = cassanKnex("cassanKnexy")

@@ -447,2 +447,26 @@ , values = {

it("should compile a 'select' query string with token condition", function () {
var cql = 'SELECT "id" FROM "cassanKnexy"."columnFamily" WHERE TOKEN("id") > TOKEN(?);'
, qb = cassanKnex("cassanKnexy");
qb.select("id")
.from("columnFamily")
.tokenWhere("id", ">", 1);
var _cql = qb.cql();
assert(_cql === cql, "Expected compilation: '" + cql + "' but compiled: " + _cql);
});
it("should compile a 'select' query string with composite token condition", function () {
var cql = 'SELECT "id" FROM "cassanKnexy"."columnFamily" WHERE TOKEN("id", "name") > TOKEN(?, ?);'
, qb = cassanKnex("cassanKnexy");
qb.select("id")
.from("columnFamily")
.tokenWhere(["id", "name"], ">", [1, "John"]);
var _cql = qb.cql();
assert(_cql === cql, "Expected compilation: '" + cql + "' but compiled: " + _cql);
});
// AGGREGATES, coming soon...

@@ -474,2 +498,26 @@

it("should compile a simple 'writetime' query string", function () {
var cql = 'SELECT "foo", writetime("foo") FROM "cassanKnexy"."columnFamily";'
, qb = cassanKnex("cassanKnexy");
qb.select("foo")
.writetime("foo")
.from("columnFamily");
var _cql = qb.cql();
assert(_cql === cql, "Expected compilation: '" + cql + "' but compiled: " + _cql);
});
it("should compile a 'select as' 'writetime' query string", function () {
var cql = 'SELECT "foo", writetime("foo") AS "fooWriteTime" FROM "cassanKnexy"."columnFamily";'
, qb = cassanKnex("cassanKnexy");
qb.select("foo")
.writetime({foo: "fooWriteTime"})
.from("columnFamily");
var _cql = qb.cql();
assert(_cql === cql, "Expected compilation: '" + cql + "' but compiled: " + _cql);
});
it("should compile a simple 'count' query string", function () {

@@ -476,0 +524,0 @@

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