Skip to content

Commit

Permalink
consider enumerability of fields
Browse files Browse the repository at this point in the history
  • Loading branch information
gr0uch committed Oct 13, 2018
1 parent 6d74caa commit 66e2fc5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Changelog


##### 1.6.8 (2018-10-13)
##### 1.6.9 (2018-10-13)
- Fix: do not allow extraneous fields in update to cause silent error.


Expand Down
8 changes: 4 additions & 4 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ module.exports = Adapter => class PostgreSQLAdapter extends Adapter {
const client = this.client
const typeMap = this.options.typeMap
const primaryKey = this.keys.primary
const recordTypes = this.recordTypes
const recordType = this.recordTypes[type]

// This is a little bit wrong, it is only safe to update within a
// transaction. It's not possible to put it all in one update statement,
Expand All @@ -452,7 +452,7 @@ module.exports = Adapter => class PostgreSQLAdapter extends Adapter {
let set = []

for (const field in update.replace) {
if (!(field in recordTypes[type])) continue
if (!recordType.propertyIsEnumerable(field)) continue
const value = update.replace[field]
index++
if (Array.isArray(value)) parameters.push(value.map(inputValue))
Expand All @@ -461,7 +461,7 @@ module.exports = Adapter => class PostgreSQLAdapter extends Adapter {
}

for (const field in update.push) {
if (!(field in recordTypes[type])) continue
if (!recordType.propertyIsEnumerable(field)) continue
const value = update.push[field]
index++

Expand All @@ -476,7 +476,7 @@ module.exports = Adapter => class PostgreSQLAdapter extends Adapter {
}

for (const field in update.pull) {
if (!(field in recordTypes[type])) continue
if (!recordType.propertyIsEnumerable(field)) continue
const value = update.pull[field]

if (Array.isArray(value)) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "fortune-postgres",
"description": "Postgres adapter for Fortune.",
"version": "1.6.8",
"version": "1.6.9",
"license": "MIT",
"repository": {
"type": "git",
Expand Down

0 comments on commit 66e2fc5

Please sign in to comment.