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

queryablejs

Package Overview
Dependencies
Maintainers
2
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

queryablejs - npm Package Compare versions

Comparing version 0.0.9 to 0.0.10

146

dist/index.js

@@ -372,8 +372,2 @@ (function webpackUniversalModuleDefinition(root, factory) {

if (query.include != null && query.include.nodeName === "include") {
this.query.include = query.include;
} else {
this.query.include = new _OperationExpression2.default("include");
}
if (query.orderBy != null && query.orderBy.nodeName === "orderBy") {

@@ -388,3 +382,3 @@ this.query.orderBy = query.orderBy;

} else {
this.query.select = new _OperationExpression2.default("select");
this.query.select = new _ValueExpression2.default("select", {});
}

@@ -406,8 +400,8 @@ }

copy.orderBy = query.orderBy.copy();
copy.include = query.include.copy();
copy.select = query.select.copy();
copy.parameters = JSON.parse(JSON.stringify(query.parameters));
copy.take = query.take.copy();
copy.skip = query.skip.copy();
copy.parameters = JSON.parse(JSON.stringify(query.parameters));
return copy;

@@ -495,2 +489,52 @@ }

}, {
key: "_validatePropertyName",
value: function _validatePropertyName(name) {
return typeof name === "string" && name.length > 0 && isNaN(parseInt(name.charAt(0), 10));
}
}, {
key: "_selectArray",
value: function _selectArray(properties) {
var _this = this;
var hasValidMapping = properties.every(function (property) {
return _this._validatePropertyName(property);
});
if (!hasValidMapping) {
throw new Error("Invalid mapping: The mappings need to be a string that is at least one character long and doesn't start with a number.");
}
var query = this._copyQuery(this.getQuery());
var existingMapping = query.select.value;
properties.forEach(function (property) {
existingMapping[property] = property;
});
return this.copy(query);
}
}, {
key: "_selectObject",
value: function _selectObject(mapping) {
var _this2 = this;
var mappingKeys = Object.keys(mapping);
var hasValidMapping = mappingKeys.every(function (key) {
return _this2._validatePropertyName(key) && _this2._validatePropertyName(mapping[key]);
});
if (!hasValidMapping) {
throw new Error("Invalid mapping: The mappings need to be a string that is at least one character long and doesn't start with a number.");
}
var query = this._copyQuery(this.getQuery());
var existingMapping = query.select.value;
mappingKeys.forEach(function (key) {
existingMapping[key] = mapping[key];
});
return this.copy(query);
}
}, {
key: "and",

@@ -524,21 +568,2 @@ value: function and(lambda) {

}, {
key: "include",
value: function include(propertyName) {
if (typeof propertyName !== "string") {
throw new Error("Illegal Argument: Expected a string.");
}
var query = this._copyQuery(this.getQuery());
var propertyAccess = new _OperationExpression2.default("propertyAccess");
propertyAccess.children.push(new _ValueExpression2.default("type", "Object"), new _ValueExpression2.default("property", propertyName));
if (!query.include.contains(propertyAccess)) {
query.include.children.push(propertyAccess);
return this.copy(query);
} else {
return this;
}
}
}, {
key: "merge",

@@ -550,5 +575,5 @@ value: function merge(queryable) {

var clone = this.copy();
var cloneQuery = clone.getQuery();
var cloneQuery = this._copyQuery(this.getQuery());
var query = queryable.getQuery();
var rightExpression = query.where.children[0];

@@ -572,4 +597,4 @@

query.include.children.forEach(function (expression) {
cloneQuery.include.children.push(expression.copy());
Object.keys(query.select.value).forEach(function (key) {
cloneQuery.select.value[key] = query.select.value[key];
});

@@ -586,9 +611,2 @@

}, {
key: "ofType",
value: function ofType(type) {
var queryable = new Queryable(type);
queryable.provider = this.provider;
return queryable;
}
}, {
key: "or",

@@ -645,26 +663,8 @@ value: function or(lambda) {

key: "select",
value: function select(properties) {
var _this = this;
if (!Array.isArray(properties)) {
throw new Error("Illegal Argument: Expected an array of strings.");
value: function select(mapping) {
if (Array.isArray(mapping)) {
return this._selectArray(mapping);
} else {
return this._selectObject(mapping);
}
var query = this._copyQuery(this.getQuery());
properties.forEach(function (propertyName) {
if (typeof propertyName !== "string") {
throw new Error("Illegal Argument: Expected a string.");
}
var propertyAccess = new _OperationExpression2.default("propertyAccess");
propertyAccess.children.push(new _ValueExpression2.default("type", _this.type), new _ValueExpression2.default("property", propertyName));
if (!query.select.contains(propertyAccess)) {
query.select.children.push(propertyAccess);
}
});
return this.copy(query);
}

@@ -858,12 +858,2 @@ }, {

}, {
key: "any",
value: function any(lambda) {
return this._createLambdaOperationExpression("any", lambda);
}
}, {
key: "all",
value: function all(lambda) {
return this._createLambdaOperationExpression("all", lambda);
}
}, {
key: "contains",

@@ -957,2 +947,4 @@ value: function contains(value) {

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

@@ -988,3 +980,9 @@

value: function copy() {
return new ValueExpression(this.nodeName, this.value);
var value = this.value;
if ((typeof value === "undefined" ? "undefined" : _typeof(value)) === "object" && value != null) {
value = JSON.parse(JSON.stringify(value));
}
return new ValueExpression(this.nodeName, value);
}

@@ -1081,3 +1079,3 @@ }, {

if (!expression) {
if (expression == null) {
return null;

@@ -1084,0 +1082,0 @@ }

@@ -152,12 +152,2 @@ "use strict";

}, {
key: "any",
value: function any(lambda) {
return this._createLambdaOperationExpression("any", lambda);
}
}, {
key: "all",
value: function all(lambda) {
return this._createLambdaOperationExpression("all", lambda);
}
}, {
key: "contains",

@@ -164,0 +154,0 @@ value: function contains(value) {

@@ -67,8 +67,2 @@ "use strict";

if (query.include != null && query.include.nodeName === "include") {
this.query.include = query.include;
} else {
this.query.include = new _OperationExpression2.default("include");
}
if (query.orderBy != null && query.orderBy.nodeName === "orderBy") {

@@ -100,8 +94,8 @@ this.query.orderBy = query.orderBy;

copy.orderBy = query.orderBy.copy();
copy.include = query.include.copy();
copy.select = query.select.copy();
copy.parameters = JSON.parse(JSON.stringify(query.parameters));
copy.take = query.take.copy();
copy.skip = query.skip.copy();
copy.parameters = JSON.parse(JSON.stringify(query.parameters));
return copy;

@@ -273,5 +267,5 @@ }

var clone = this.copy();
var cloneQuery = clone.getQuery();
var cloneQuery = this._copyQuery(this.getQuery());
var query = queryable.getQuery();
var rightExpression = query.where.children[0];

@@ -295,4 +289,4 @@

query.include.children.forEach(function (expression) {
cloneQuery.include.children.push(expression.copy());
Object.keys(query.select.value).forEach(function (key) {
cloneQuery.select.value[key] = query.select.value[key];
});

@@ -309,9 +303,2 @@

}, {
key: "ofType",
value: function ofType(type) {
var queryable = new Queryable(type);
queryable.provider = this.provider;
return queryable;
}
}, {
key: "or",

@@ -318,0 +305,0 @@ value: function or(lambda) {

@@ -477,16 +477,2 @@ "use strict";

exports["Queryable: Constructor with ofType called."] = function () {
var queryable = new _Queryable2.default();
var testType = { test: "test" };
queryable = queryable.ofType(testType);
assert.deepEqual(queryable.type, testType);
};
exports["Queryable: Constructor with ofType called."] = function () {
var queryable = new _Queryable2.default();
var testType = { test: "test" };
queryable = queryable.ofType(testType);
assert.deepEqual(queryable.type, testType);
};
exports["Queryable: Constructor with copy called."] = function () {

@@ -493,0 +479,0 @@ var queryable = new _Queryable2.default();

{
"name": "queryablejs",
"version": "0.0.9",
"version": "0.0.10",
"description": "",

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

@@ -126,10 +126,2 @@ import ValueExpression from "./ValueExpression";

any(lambda) {
return this._createLambdaOperationExpression("any", lambda);
}
all(lambda) {
return this._createLambdaOperationExpression("all", lambda);
}
contains(value) {

@@ -136,0 +128,0 @@ return this._createOperationExpression("contains", value);

@@ -35,8 +35,2 @@ import Expression from "./Expression";

if (query.include != null && query.include.nodeName === "include") {
this.query.include = query.include;
} else {
this.query.include = new OperationExpression("include");
}
if (query.orderBy != null && query.orderBy.nodeName === "orderBy") {

@@ -67,8 +61,8 @@ this.query.orderBy = query.orderBy;

copy.orderBy = query.orderBy.copy();
copy.include = query.include.copy();
copy.select = query.select.copy();
copy.parameters = JSON.parse(JSON.stringify(query.parameters));
copy.take = query.take.copy();
copy.skip = query.skip.copy();
copy.parameters = JSON.parse(JSON.stringify(query.parameters));
return copy;

@@ -223,5 +217,5 @@ }

let clone = this.copy();
let cloneQuery = clone.getQuery();
let cloneQuery = this._copyQuery(this.getQuery());
let query = queryable.getQuery();
let rightExpression = query.where.children[0];

@@ -248,4 +242,4 @@

query.include.children.forEach(function (expression) {
cloneQuery.include.children.push(expression.copy());
Object.keys(query.select.value).forEach((key) => {
cloneQuery.select.value[key] = query.select.value[key];
});

@@ -262,8 +256,2 @@

ofType(type) {
let queryable = new Queryable(type);
queryable.provider = this.provider;
return queryable;
}
or(lambda) {

@@ -270,0 +258,0 @@ return this._createQueryableFromLambda("or", lambda);

@@ -476,16 +476,2 @@ import * as assert from "assert";

exports["Queryable: Constructor with ofType called."] = function () {
let queryable = new Queryable();
const testType = { test: "test" };
queryable = queryable.ofType(testType);
assert.deepEqual(queryable.type, testType);
};
exports["Queryable: Constructor with ofType called."] = function () {
let queryable = new Queryable();
const testType = { test: "test" };
queryable = queryable.ofType(testType);
assert.deepEqual(queryable.type, testType);
};
exports["Queryable: Constructor with copy called."] = function () {

@@ -492,0 +478,0 @@ let queryable = new Queryable();

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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