Comparing version 6.1.4 to 6.2.0
@@ -5,2 +5,20 @@ # Changelog | ||
## [6.2.0](https://gitlab.com/dmfay/massive-js/compare/v6.1.4...v6.2.0) (2020-02-09) | ||
### Features | ||
* support all explicit locking options for SELECT ([c19b17c](https://gitlab.com/dmfay/massive-js/commit/c19b17ce5c01fc58acabdc01196a5796c5420332)) | ||
### Bug Fixes | ||
* **deps:** update dependency commander to v4.1.0 ([c7c3520](https://gitlab.com/dmfay/massive-js/commit/c7c352096751af110a0c0170a6ddb7ec354d5ee3)) | ||
* **deps:** update dependency commander to v4.1.1 ([64d22d2](https://gitlab.com/dmfay/massive-js/commit/64d22d2393832266845c620383ff623b5ae73df0)) | ||
* **deps:** update dependency pg-promise to v10.3.2 ([b5d2d9e](https://gitlab.com/dmfay/massive-js/commit/b5d2d9ed2a563b9dd2fe54ca3eb671877b2d85cf)) | ||
* **deps:** update dependency pg-promise to v10.4.3 ([81b3d39](https://gitlab.com/dmfay/massive-js/commit/81b3d39f17d3d3ffa9ed8799994588fff3d7acd4)) | ||
* **deps:** update dependency pg-query-stream to v3 ([2064bdb](https://gitlab.com/dmfay/massive-js/commit/2064bdbf6150d75fc3b7788191e4f5ce176ff1af)) | ||
* decomposing a resultset missing a schema-defined field will not include explicit undefineds ([ee34d87](https://gitlab.com/dmfay/massive-js/commit/ee34d876f472ba1cd353909240261fa6ceede6e0)) | ||
* **deps:** update dependency pg-query-stream to v2.1.2 ([5a970a8](https://gitlab.com/dmfay/massive-js/commit/5a970a8b715667732e63c4964674988bbd292c86)) | ||
### [6.1.4](https://gitlab.com/dmfay/massive-js/compare/v6.1.3...v6.1.4) (2019-12-11) | ||
@@ -7,0 +25,0 @@ |
@@ -35,4 +35,3 @@ 'use strict'; | ||
this.pageLength = options.pageLength; | ||
this.forUpdate = options.forUpdate || false; | ||
this.forShare = options.forShare || false; | ||
this.lock = this.parseLock(options); | ||
@@ -152,2 +151,33 @@ // with pageLength set for keyset pagination, add last values of ordering | ||
/** | ||
* Parse a query explicit locking options, supporting legacy `forUpdate` and `forShare` | ||
* and `forShare` arguments | ||
* @param {Object} [options] - {@link https://massivejs.org/docs/options-objects|Select options} | ||
* @return {Object} a lock object | ||
*/ | ||
Select.prototype.parseLock = function (options) { | ||
// TODO remove forUpdate and forShare in v7 | ||
const {forUpdate, forShare, lock} = options; | ||
// fail if more than one of those options is not null and not undefined | ||
if ([forShare, forUpdate, lock].filter((x) => x != null).length > 1) { | ||
throw new Error('The "forUpdate", "forShare", and "lock" options are mutually exclusive'); | ||
} | ||
if (forUpdate !== undefined || forShare !== undefined && process.env.NODE_ENV !== 'production') { | ||
/* eslint-disable-next-line no-console */ | ||
console.log('DEPRECATED: the "forShare" and "forUpdate" options are deprecated and will be removed in a future version. Use "lock" instead.'); | ||
} | ||
if (forUpdate) { | ||
return {strength: 'UPDATE'}; | ||
} | ||
if (forShare) { | ||
return {strength: 'SHARE'}; | ||
} | ||
return options.lock; | ||
}; | ||
/** | ||
* Format this object into a SQL SELECT. | ||
@@ -176,4 +206,4 @@ * | ||
if (this.order.length) { sql += ` ORDER BY ${this.order.join(',')}`; } | ||
if (this.forUpdate) { sql += ' FOR UPDATE'; } | ||
if (this.forShare) { sql += ' FOR SHARE'; } | ||
if (this.lock) { sql += ` FOR ${this.lock.strength}`; } | ||
if (this.lock && this.lock.lockedRows) { sql += ` ${this.lock.lockedRows}`; } | ||
if (this.pageLength) { sql += ` FETCH FIRST ${this.pageLength} ROWS ONLY`; } | ||
@@ -180,0 +210,0 @@ if (this.offset) { sql += ` OFFSET ${this.offset}`; } |
@@ -73,6 +73,14 @@ 'use strict'; | ||
// columns is just a list of field names | ||
mapper = val => obj[strid][val] = row[val]; | ||
mapper = val => { | ||
if (row[val] !== undefined) { | ||
obj[strid][val] = row[val]; | ||
} | ||
}; | ||
} else { | ||
// the columns object maps field names in the row to object key names | ||
mapper = (val, key) => obj[strid][val] = row[key]; | ||
mapper = (val, key) => { | ||
if (row[key] !== undefined) { | ||
obj[strid][val] = row[key]; | ||
} | ||
}; | ||
} | ||
@@ -79,0 +87,0 @@ |
{ | ||
"name": "massive", | ||
"version": "6.1.4", | ||
"version": "6.2.0", | ||
"description": "A small query tool for Postgres that embraces json and makes life simpler", | ||
@@ -52,8 +52,8 @@ "homepage": "https://massivejs.org", | ||
"dependencies": { | ||
"commander": "4.0.1", | ||
"commander": "4.1.1", | ||
"glob": "7.1.6", | ||
"lodash": "4.17.15", | ||
"murmurhash": "0.0.2", | ||
"pg-promise": "10.3.1", | ||
"pg-query-stream": "2.0.1" | ||
"pg-promise": "10.4.3", | ||
"pg-query-stream": "3.0.2" | ||
}, | ||
@@ -64,6 +64,6 @@ "devDependencies": { | ||
"coveralls": "3.0.9", | ||
"eslint": "6.7.2", | ||
"mocha": "6.2.2", | ||
"nyc": "14.1.1", | ||
"standard-version": "7.0.1" | ||
"eslint": "6.8.0", | ||
"mocha": "7.0.1", | ||
"nyc": "15.0.0", | ||
"standard-version": "7.1.0" | ||
}, | ||
@@ -70,0 +70,0 @@ "repository": { |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
179345
3015
3
+ Addedassert-options@0.6.1(transitive)
+ Addedcommander@4.1.1(transitive)
+ Addedpg@7.18.1(transitive)
+ Addedpg-minify@1.5.2(transitive)
+ Addedpg-packet-stream@1.1.0(transitive)
+ Addedpg-promise@10.4.3(transitive)
+ Addedpg-query-stream@3.0.2(transitive)
+ Addedspex@3.0.1(transitive)
- Removedassert-options@0.6.0(transitive)
- Removedcommander@4.0.1(transitive)
- Removedmanakin@0.5.2(transitive)
- Removedpg@7.14.0(transitive)
- Removedpg-minify@1.5.1(transitive)
- Removedpg-promise@10.3.1(transitive)
- Removedpg-query-stream@2.0.1(transitive)
- Removedspex@3.0.0(transitive)
Updatedcommander@4.1.1
Updatedpg-promise@10.4.3
Updatedpg-query-stream@3.0.2