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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "electrodb",
3
- "version": "3.4.5",
3
+ "version": "3.4.7",
4
4
  "description": "A library to more easily create and interact with multiple entities and heretical relationships in dynamodb",
5
5
  "main": "index.js",
6
6
  "scripts": {
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 = Object.entries(
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.push([key, value]);
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
@@ -165,7 +165,7 @@ const ErrorCodes = {
165
165
  },
166
166
  IncompleteCompositeAttributes: {
167
167
  code: 2002,
168
- section: "incomplete-composite-attributes",
168
+ section: "missing-composite-attributes",
169
169
  name: "IncompleteCompositeAttributes",
170
170
  sym: ErrorCode,
171
171
  },