electrodb 3.4.4 → 3.4.6

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.4",
3
+ "version": "3.4.6",
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
@@ -464,21 +464,19 @@ let clauses = {
464
464
  upsert.indexKey = indexKey;
465
465
 
466
466
  // only "set" data is used to make keys
467
- const setFields = Object.entries(
468
- entity.model.schema.translateToFields(setAttributes),
469
- );
467
+ const setFields = entity.model.schema.translateToFields(setAttributes);
470
468
 
471
469
  // add the keys impacted except for the table index keys; they are upserted
472
470
  // automatically by dynamo
473
471
  for (const key in updatedKeys) {
474
472
  const value = updatedKeys[key];
475
473
  if (indexKey[key] === undefined) {
476
- setFields.push([key, value]);
474
+ setFields[key] = value;
477
475
  }
478
476
  }
479
477
 
480
478
  entity._maybeApplyUpsertUpdate({
481
- fields: setFields,
479
+ fields: Object.entries(setFields),
482
480
  operation: UpsertOperations.set,
483
481
  updateProxy,
484
482
  update,
package/src/entity.js CHANGED
@@ -2012,7 +2012,10 @@ class Entity {
2012
2012
  );
2013
2013
  break;
2014
2014
  case MethodTypes.scan:
2015
- params = this._makeScanParam(filter[ExpressionTypes.FilterExpression]);
2015
+ params = this._makeScanParam(
2016
+ filter[ExpressionTypes.FilterExpression],
2017
+ config,
2018
+ );
2016
2019
  break;
2017
2020
  /* istanbul ignore next */
2018
2021
  default:
@@ -2228,7 +2231,7 @@ class Entity {
2228
2231
  }
2229
2232
 
2230
2233
  /* istanbul ignore next */
2231
- _makeScanParam(filter = {}) {
2234
+ _makeScanParam(filter = {}, options = {}) {
2232
2235
  let indexBase = TableIndex;
2233
2236
  let hasSortKey = this.model.lookup.indexHasSortKeys[indexBase];
2234
2237
  let accessPattern =
@@ -2291,7 +2294,10 @@ class Entity {
2291
2294
  params.FilterExpression = filterExpressions.join(" AND ");
2292
2295
  }
2293
2296
 
2294
- return params;
2297
+ return this._applyProjectionExpressions({
2298
+ parameters: params,
2299
+ config: options,
2300
+ });
2295
2301
  }
2296
2302
 
2297
2303
  _makeSimpleIndexParams(partition, sort) {
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
  },