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

massive

Package Overview
Dependencies
Maintainers
2
Versions
117
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

massive - npm Package Compare versions

Comparing version 4.7.1 to 4.7.2

6

docs/options.md

@@ -75,4 +75,8 @@ # Options

Any other key on a schema is taken to represent a nested schema, and nested schemas **may not be named** with one of the reserved keys. The following schema:
Any other key on a schema is taken to represent a nested schema, and nested schemas **may not be named** with one of the reserved keys.
Note also that pks and columns must be unique in your query's results, which is important if your query includes tables with shared column names. Ensure that any duplicate column names are aliased in your `SELECT` list.
The following schema:
```javascript

@@ -79,0 +83,0 @@ db.user_tests.find({}, {

@@ -337,3 +337,8 @@ 'use strict';

} else {
sql = query.format();
try {
sql = query.format();
} catch (err) {
return this.$p.reject(err);
}
params = query.params;

@@ -340,0 +345,0 @@ options = query;

2

lib/executable.js

@@ -35,3 +35,3 @@ 'use strict';

this.sql = spec.sql;
this.isDatabaseFunction = spec.hasOwnProperty('isVariadic');
this.isDatabaseFunction = Object.prototype.hasOwnProperty.call(spec, 'isVariadic');
this.paramCount = spec.paramCount; // this actually only matters for QueryFiles since functions can have overloads

@@ -38,0 +38,0 @@ this.isVariadic = !!spec.isVariadic; // only for db functions

@@ -129,3 +129,3 @@ 'use strict';

return this.pk.every(keyColumn => {
if (criteria.hasOwnProperty(keyColumn)) { return true; }
if (Object.prototype.hasOwnProperty.call(criteria, keyColumn)) { return true; }

@@ -132,0 +132,0 @@ return criteriaKeys.some(k => new RegExp(`^${keyColumn}[^\\w\\d]?`).test(k));

@@ -24,3 +24,3 @@ 'use strict';

this.onConflictIgnore = options.onConflictIgnore;
this.deepInsert = options.hasOwnProperty('deepInsert') ? options.deepInsert : true;
this.deepInsert = Object.prototype.hasOwnProperty.call(options, 'deepInsert') ? options.deepInsert : true;
if (_.isArray(record)) {

@@ -45,6 +45,2 @@ this.records = record;

if (this.deepInsert && this.junctions.length) {
if (this.records.length > 1) {
throw new Error('Deep insert is only supported for single records');
}
// append all junction params (that aren't stubbing out the foreign keys)

@@ -71,2 +67,6 @@ // to the insert's parameter list

Insert.prototype.format = function () {
if (this.deepInsert && this.junctions.length && this.records.length > 1) {
throw new Error('Found potential deep insert definitions in the record array. Deep insert is only supported for single records. If you are not attempting a deep insert, ensure that your records do not contain non-column keys or use the {deepInsert: false} option.');
}
const quotedColumns = this.columns.map(f => `"${f}"`);

@@ -97,2 +97,6 @@

const junctionQueries = _.reduce(this.junctions, (queries, j, idx) => {
if (!Array.isArray(this.records[0][j])) {
throw new Error('Attempted a deep insert with a bad junction definition. If you did not intend a deep insert, ensure that your record only contains values for database columns or disable this functionality with the {deepInsert: false} option.');
}
return queries.concat(this.records[0][j].map((r, jdx) => {

@@ -99,0 +103,0 @@ // separate out keyColumns so they are consistently positioned in the

@@ -66,3 +66,3 @@ 'use strict';

if (criteria.hasOwnProperty('conditions') && criteria.hasOwnProperty('params')) {
if (Object.prototype.hasOwnProperty.call(criteria, 'conditions') && Object.prototype.hasOwnProperty.call(criteria, 'params')) {
// pre-built predicates (full-text searches and Queryable.where style calls use this)

@@ -69,0 +69,0 @@ this.where = criteria;

@@ -47,3 +47,3 @@ 'use strict';

const criteria = this.pk.reduce((obj, pkColumn) => {
if (record.hasOwnProperty(pkColumn)) {
if (Object.prototype.hasOwnProperty.call(record, pkColumn)) {
obj[pkColumn] = record[pkColumn];

@@ -50,0 +50,0 @@ } else {

@@ -44,2 +44,6 @@ 'use strict';

const mapping = data.reduce(function (acc, row) {
if (row[schema.pk] === null) {
throw new Error('Attempted to decompose a row where the root object has a null PK. This can happen if tables in your SELECT list share column names. Ensure that all columns are aliased uniquely and update your decomposition schema if necessary.');
}
return (function build (obj, objSchema) {

@@ -56,3 +60,3 @@ const id = row[objSchema.pk];

return undefined;
} else if (!obj.hasOwnProperty(strid)) {
} else if (!Object.prototype.hasOwnProperty.call(obj, strid)) {
// this entity is new

@@ -59,0 +63,0 @@ obj[strid] = {};

{
"name": "massive",
"version": "4.7.1",
"version": "4.7.2",
"description": "A small query tool for Postgres that embraces json and makes life simpler",

@@ -66,6 +66,6 @@ "homepage": "https://dmfay.github.io/massive-js/",

"coveralls": "~3.0.0",
"eslint": "~4.18.0",
"eslint": "~4.19.0",
"jsdoc": "^3.5.4",
"mocha": "~5.0.0",
"nyc": "~11.4.1"
"mocha": "~5.1.0",
"nyc": "~11.6.0"
},

@@ -72,0 +72,0 @@ "repository": {

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