Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sqb

Package Overview
Dependencies
Maintainers
1
Versions
174
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sqb - npm Package Compare versions

Comparing version 0.8.1 to 0.8.2

8

lib/connect/metadata.js

@@ -65,5 +65,5 @@ /* SQB

tableName = String(tableName);
assert(['schemas', 'tables', 'columns', 'primary_keys',
'foreign_keys'].includes(tableName
.toLowerCase()), 'Unknown table "' + tableName + '"');
assert(['schemas', 'tables', 'columns', 'primary_keys', 'foreign_keys']
.indexOf(tableName.toLowerCase()) >= 0, 'Unknown table "' + tableName +
'"');
var subSelect;

@@ -108,3 +108,3 @@ var sourceFields;

col = String(col).toLowerCase();
if (sourceFields.includes(col) && !listFields.includes(col))
if (sourceFields.indexOf(col) >= 0 && listFields.indexOf(col) < 0)
listFields.push(col);

@@ -111,0 +111,0 @@ });

@@ -47,7 +47,7 @@ /* SQB

if (row[key] instanceof Date &&
options.fetchAsString.includes(Date)) {
options.fetchAsString.indexOf(Date) >= 0) {
row[key] = row[key].toISOString();
}
if (row[key] instanceof Number &&
options.fetchAsString.includes(Number)) {
options.fetchAsString.indexOf(Number) >= 0) {
row[key] = String(row[key]);

@@ -54,0 +54,0 @@ }

@@ -24,6 +24,8 @@ /* SQB

createPool: function(config) {
var plugin;
var result;
for (var i = 0; i < items.length; i++) {
const plugin = items[i];
plugin = items[i];
if (typeof plugin.createPool === 'function') {
const result = plugin.createPool(config);
result = plugin.createPool(config);
if (result) return result;

@@ -35,6 +37,8 @@ }

createSerializer: function(config) {
var plugin;
var result;
for (var i = 0; i < items.length; i++) {
const plugin = items[i];
plugin = items[i];
if (typeof plugin.createSerializer === 'function') {
const result = plugin.createSerializer(config);
result = plugin.createSerializer(config);
if (result) return result;

@@ -46,4 +50,5 @@ }

get stringify() {
var plugin;
for (var i = 0; i < items.length; i++) {
const plugin = items[i];
plugin = items[i];
if (typeof plugin.stringify === 'function')

@@ -50,0 +55,0 @@ return plugin.stringify;

@@ -72,2 +72,3 @@ /* SQB

proto.values = function(values) {
var out;
if (!values)

@@ -78,3 +79,3 @@ this._values = undefined;

else if (Array.isArray(values)) {
const out = {};
out = {};
var i = 0;

@@ -90,3 +91,3 @@ this._columns.forEach(function(key) {

// We build a new map of upper keys for case insensitivity
const out = {};
out = {};
Object.getOwnPropertyNames(values).forEach(function(key) {

@@ -93,0 +94,0 @@ out[key.toUpperCase()] = values[key];

@@ -117,4 +117,5 @@ /* SQB

const self = this;
var arg;
for (var i = 0; i < arguments.length; i++) {
const arg = arguments[i];
arg = arguments[i];
if (Array.isArray(arg)) {

@@ -137,4 +138,5 @@ arg.forEach(function(item) {

this.clearFrom();
var arg;
for (var i = 0; i < arguments.length; i++) {
const arg = arguments[i];
arg = arguments[i];
if (arg)

@@ -153,4 +155,5 @@ this._tables.push(

proto.join = function(join) {
var arg;
for (var i = 0; i < arguments.length; i++) {
const arg = arguments[i];
arg = arguments[i];
if (arg instanceof Join)

@@ -183,4 +186,5 @@ this._joins.push(arg);

this.clearGroupBy();
var arg;
for (var i = 0; i < arguments.length; i++) {
const arg = arguments[i];
arg = arguments[i];
if (arg)

@@ -200,4 +204,5 @@ this._groupby.push(arg.isRaw ? arg : new Column(String(arg)));

this.clearOrderBy();
var arg;
for (var i = 0; i < arguments.length; i++) {
const arg = arguments[i];
arg = arguments[i];
if (arg)

@@ -204,0 +209,0 @@ this._orderby.push(arg.isRaw ? arg : new Order(String(arg)));

@@ -145,3 +145,3 @@ /* SQB

s = String(s).toLowerCase();
if (this.reservedWords.includes(s))
if (this.reservedWords.indexOf(s) >= 0)
return true;

@@ -182,3 +182,3 @@ if (this.pluginSerializer &&

'*';
if (s.length > 60 || s.includes('\n')) {
if (s.length > 60 || s.indexOf('\n') >= 0) {
out += '\n\t' + s + '\b';

@@ -194,3 +194,3 @@ sep = '\n';

if (s) {
if (s.includes('\n'))
if (s.indexOf('\n') >= 0)
sep = '\n';

@@ -234,3 +234,3 @@ out += sep + s;

assert.ok(query && query._table &&
['raw', 'table'].includes(query._table.type),
['raw', 'table'].indexOf(query._table.type) >= 0,
'Invalid argument. Only Raw or TableName allowed in "insert(?)"');

@@ -248,5 +248,6 @@ assert.ok(!!query._values, 'values required for Insert query');

const objValues = query._values;
var s;
if (objValues) {
if (['raw', 'select'].includes(objValues.type)) {
const s = __serialize(self, objValues, {section: 'insert.values'});
if (['raw', 'select'].indexOf(objValues.type) >= 0) {
s = __serialize(self, objValues, {section: 'insert.values'});
if (s)

@@ -268,3 +269,3 @@ out += (objValues.type === 'select' ? '\n' : ' ') + s;

iinf.index = idx;
const s = serializeValue(self, val, iinf);
s = serializeValue(self, val, iinf);
if (s)

@@ -277,3 +278,3 @@ out += (idx ? ', ' : '') + s;

if (query._returning) {
var s = serializeReturning(self, query._returning,
s = serializeReturning(self, query._returning,
{section: 'insert.returning'});

@@ -295,3 +296,3 @@ if (s)

assert.ok(query && query._table &&
['raw', 'table'].includes(query._table.type),
['raw', 'table'].indexOf(query._table.type) >= 0,
'Invalid argument. Only Raw or TableName allowed in "update(?)"');

@@ -349,3 +350,3 @@ assert.ok(!!query._values, 'values required for Update query');

assert.ok(query && query._table &&
['raw', 'table'].includes(query._table.type),
['raw', 'table'].indexOf(query._table.type) >= 0,
'Invalid argument. Only Raw or TableName allowed in "delete(?)"');

@@ -409,3 +410,3 @@ const self = this;

if (!column) return '';
assert.ok(['column', 'raw', 'case', 'select'].includes(column.type),
assert.ok(['column', 'raw', 'case', 'select'].indexOf(column.type) >= 0,
'Invalid object for serializing column');

@@ -452,3 +453,3 @@ const s = __serialize(this, column, inf);

tables.forEach(function(item) {
assert.ok(['raw', 'select', 'table'].includes(item.type),
assert.ok(['raw', 'select', 'table'].indexOf(item.type) >= 0,
'Invalid object used as Table Name');

@@ -527,3 +528,3 @@ var s = __serialize(self, item, iinf);

assert.ok(['raw', 'select', 'table'].includes(join.table.type),
assert.ok(['raw', 'select', 'table'].indexOf(join.table.type) >= 0,
'Invalid object used as Table Name');

@@ -610,3 +611,3 @@ var s = __serialize(this, join.table, inf);

group._items.forEach(function(item) {
assert.ok(['raw', 'conditiongroup', 'condition'].includes(item.type),
assert.ok(['raw', 'conditiongroup', 'condition'].indexOf(item.type)>=0,
'Invalid object used as Condition');

@@ -647,3 +648,3 @@ logop = item.logicalOperator || logop;

var str;
if (['raw', 'select'].includes(item.field.type)) {
if (['raw', 'select'].indexOf(item.field.type)>=0) {
str = (str = __serialize(self, item.field, inf)) &&

@@ -688,3 +689,3 @@ item.field.type === 'select' ?

Array.isArray(item.value) &&
(s = item.value.join()) && ((s.includes('%')) || s.includes('?'))) {
(s = item.value.join()) && ((s.indexOf('%')>=0) || s.indexOf('?')>=0)) {
s = '(';

@@ -709,3 +710,3 @@ item.value.forEach(function(v, i) {

if (s.startsWith('(')) {
if (['!=', '<>', ' not like'].includes(operator)) operator = 'not in';
if (['!=', '<>', ' not like'].indexOf(operator)>=0) operator = 'not in';
else operator = 'in';

@@ -913,4 +914,4 @@ }

obj._expressions.forEach(function(item) {
assert.ok(['conditiongroup', 'condition', 'raw'].includes(
item.condition.type),
assert.ok(['conditiongroup', 'condition', 'raw'].indexOf(
item.condition.type)>=0,
'Invalid object used in "case" expression');

@@ -1045,3 +1046,3 @@ const s = __serialize(self, item.condition, iinf);

if (obj !== instance.query &&
['select', 'insert', 'update', 'delete'].includes(obj.type)) {
['select', 'insert', 'update', 'delete'].indexOf(obj.type)>=0) {
const sub = new SerializerInstance(instance);

@@ -1048,0 +1049,0 @@ return sub.generate(obj, instance.inputValues);

@@ -50,5 +50,6 @@ /* SQB

if (!(item && arguments.length)) return this;
var c;
const self = this;
if (typeof arguments[0] === 'string') {
const c = Object.create(Condition.prototype);
c = Object.create(Condition.prototype);
Condition.apply(c, arguments);

@@ -60,4 +61,5 @@ self._items.push(c);

var logop = self.logicalOperator;
var arg;
for (var i = 0; i < arguments.length; i++) {
const arg = arguments[i];
arg = arguments[i];
// Process array argument

@@ -68,3 +70,3 @@ if (Array.isArray(arg)) {

if (Array.isArray(arg[0])) {
const c = Object.create(ConditionGroup.prototype);
c = Object.create(ConditionGroup.prototype);
ConditionGroup.apply(c, arg);

@@ -75,3 +77,3 @@ c.logicalOperator = logop;

arg[0].type === 'raw') {
const c = Object.create(Condition.prototype);
c = Object.create(Condition.prototype);
Condition.apply(c, arg);

@@ -78,0 +80,0 @@ c.logicalOperator = logop;

@@ -37,3 +37,3 @@ /* SQB

else if (m[4])
this.descending = ['desc', 'descending'].includes(m[4].toLowerCase());
this.descending = ['desc', 'descending'].indexOf(m[4].toLowerCase()) >= 0;
} else

@@ -40,0 +40,0 @@ throw new ArgumentError('Invalid order by definition (%s)', value);

{
"name": "sqb",
"description": "Plugin-driven, multi-dialect SQL query builder and Database connection framework for JavaScript",
"version": "0.8.1",
"version": "0.8.2",
"author": "Panates Ltd.",

@@ -6,0 +6,0 @@ "contributors": [

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