electrodb 2.6.0 → 2.6.1

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/entity.js +14 -23
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "electrodb",
3
- "version": "2.6.0",
3
+ "version": "2.6.1",
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/entity.js CHANGED
@@ -576,8 +576,7 @@ class Entity {
576
576
  let results = config._isCollectionQuery
577
577
  ? {}
578
578
  : [];
579
- // let ExclusiveStartKey = this._formatExclusiveStartKey({config, indexName: parameters.IndexName });
580
- let ExclusiveStartKey = this._formatExclusiveStartKey(config);
579
+ let ExclusiveStartKey = this._formatExclusiveStartKey({config, indexName: parameters.IndexName });
581
580
  if (ExclusiveStartKey === null) {
582
581
  ExclusiveStartKey = undefined;
583
582
  }
@@ -1067,30 +1066,22 @@ class Entity {
1067
1066
  return config.formatCursor.serialize(page) || null;
1068
1067
  }
1069
1068
 
1070
- // _formatExclusiveStartKey({config, indexName = TableIndex}) {
1071
- // let exclusiveStartKey = config.cursor;
1072
- // if (config.raw || config.pager === Pager.raw) {
1073
- // return this._trimKeysToIndex({ provided: exclusiveStartKey, indexName }) || null;
1074
- // }
1075
- // let keys;
1076
- // if (config.pager === Pager.item) {
1077
- // keys = this._fromCompositeToKeysByIndex({indexName, provided: exclusiveStartKey});
1078
- // } else {
1079
- // keys = config.formatCursor.deserialize(exclusiveStartKey);
1080
- // }
1081
- // if (!keys) {
1082
- // return null;
1083
- // }
1084
- //
1085
- // return this._trimKeysToIndex({provided: keys, indexName}) || null;
1086
- // }
1087
-
1088
- _formatExclusiveStartKey(config) {
1069
+ _formatExclusiveStartKey({config, indexName = TableIndex}) {
1089
1070
  let exclusiveStartKey = config.cursor;
1090
1071
  if (config.raw || config.pager === Pager.raw) {
1091
- return exclusiveStartKey || null;
1072
+ return this._trimKeysToIndex({ provided: exclusiveStartKey, indexName }) || null;
1092
1073
  }
1093
- return config.formatCursor.deserialize(exclusiveStartKey) || null;
1074
+ let keys;
1075
+ if (config.pager === Pager.item) {
1076
+ keys = this._fromCompositeToKeysByIndex({indexName, provided: exclusiveStartKey});
1077
+ } else {
1078
+ keys = config.formatCursor.deserialize(exclusiveStartKey);
1079
+ }
1080
+ if (!keys) {
1081
+ return null;
1082
+ }
1083
+
1084
+ return this._trimKeysToIndex({provided: keys, indexName}) || null;
1094
1085
  }
1095
1086
 
1096
1087
  setClient(client) {