electrodb 2.3.2 → 2.3.4

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/notes CHANGED
@@ -1,23 +1,8 @@
1
- put
2
- 1. checkCreate
3
- - getValidate
4
- - `val()`
5
- - `cast()`
6
- - undefined ? `default()`
7
- - `isValid()`
8
- - `_isType()`
9
- - `validate()` - user validation
10
-
11
- 2. items added to clause state via `applyPut`
12
- 3. pk && sk are expected
13
- put(batch)
14
- create
15
- 1. checkCreate
16
- 2. items added to clause state via `applyPut`
17
- upsert
18
- 1. checkCreate
19
- update
20
- patch
21
- remove
22
- delete
23
- delete(batch)
1
+ - add hydrate option to query
2
+ - add hydrate option to collection
3
+ - implement hydrate on entity query
4
+ - implement hydrate on collection query
5
+ - add index property to signify only keys are present
6
+ - skip for match/find
7
+ - do not apply automatic filters on queries
8
+ - validate
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "electrodb",
3
- "version": "2.3.2",
3
+ "version": "2.3.4",
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
@@ -298,7 +298,7 @@ let clauses = {
298
298
  return state;
299
299
  }
300
300
  },
301
- children: ["set", "append", "remove", "add", "subtract", "data"],
301
+ children: ["set", "append","updateRemove", "updateDelete", "add", "subtract", "data"],
302
302
  },
303
303
  update: {
304
304
  name: "update",
package/src/entity.js CHANGED
@@ -1494,7 +1494,7 @@ class Entity {
1494
1494
  update.set(this.identifiers.entity, this.getName());
1495
1495
  update.set(this.identifiers.version, this.getVersion());
1496
1496
  for (const field of [...Object.keys(upsertAttributes), ...Object.keys(updatedKeys)]) {
1497
- const value = upsertAttributes[field] || updatedKeys[field];
1497
+ const value = u.getFirstDefined(upsertAttributes[field], updatedKeys[field]);
1498
1498
  if (!keyNames.includes(field)) {
1499
1499
  update.set(field, value);
1500
1500
  }
@@ -3023,7 +3023,7 @@ class Entity {
3023
3023
  if (sk.isCustom) {
3024
3024
  definitions[indexName].sk.push({name, label});
3025
3025
  } else {
3026
- definitions[indexName].sk.push({name, label: fromModel[name] || name});
3026
+ definitions[indexName].sk.push({name, label: u.getFirstDefined(fromModel[name], name) });
3027
3027
  }
3028
3028
  }
3029
3029
  }
package/src/util.js CHANGED
@@ -233,6 +233,10 @@ function shiftSortOrder(str = '', codePoint) {
233
233
  return newString;
234
234
  }
235
235
 
236
+ function getFirstDefined(...params) {
237
+ return params.find(val => val !== undefined);
238
+ }
239
+
236
240
  module.exports = {
237
241
  getUnique,
238
242
  batchItems,
@@ -241,6 +245,7 @@ module.exports = {
241
245
  removeFixings,
242
246
  parseJSONPath,
243
247
  shiftSortOrder,
248
+ getFirstDefined,
244
249
  getInstanceType,
245
250
  getModelVersion,
246
251
  formatKeyCasing,