electrodb 3.4.5 → 3.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/clauses.js +5 -6
- package/src/errors.js +1 -1
package/package.json
CHANGED
package/src/clauses.js
CHANGED
|
@@ -15,7 +15,6 @@ const {
|
|
|
15
15
|
AttributeOperationProxy,
|
|
16
16
|
UpdateOperations,
|
|
17
17
|
FilterOperationNames,
|
|
18
|
-
UpdateOperationNames,
|
|
19
18
|
} = require("./operations");
|
|
20
19
|
const { UpdateExpression } = require("./update");
|
|
21
20
|
const { FilterExpression } = require("./where");
|
|
@@ -464,21 +463,21 @@ let clauses = {
|
|
|
464
463
|
upsert.indexKey = indexKey;
|
|
465
464
|
|
|
466
465
|
// only "set" data is used to make keys
|
|
467
|
-
const setFields =
|
|
468
|
-
entity.model.schema.translateToFields(setAttributes),
|
|
469
|
-
);
|
|
466
|
+
const setFields = entity.model.schema.translateToFields(setAttributes);
|
|
470
467
|
|
|
471
468
|
// add the keys impacted except for the table index keys; they are upserted
|
|
472
469
|
// automatically by dynamo
|
|
473
470
|
for (const key in updatedKeys) {
|
|
474
471
|
const value = updatedKeys[key];
|
|
475
472
|
if (indexKey[key] === undefined) {
|
|
476
|
-
setFields
|
|
473
|
+
setFields[key] = value;
|
|
474
|
+
} else {
|
|
475
|
+
delete setFields[key];
|
|
477
476
|
}
|
|
478
477
|
}
|
|
479
478
|
|
|
480
479
|
entity._maybeApplyUpsertUpdate({
|
|
481
|
-
fields: setFields,
|
|
480
|
+
fields: Object.entries(setFields),
|
|
482
481
|
operation: UpsertOperations.set,
|
|
483
482
|
updateProxy,
|
|
484
483
|
update,
|
package/src/errors.js
CHANGED