betterddb 0.5.4 → 0.5.5

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.
@@ -57,9 +57,10 @@ class ScanBuilder {
57
57
  Limit: this.limit,
58
58
  ExclusiveStartKey: this.lastKey
59
59
  };
60
- if (this.filters.length > 0) {
61
- params.FilterExpression = this.filters.join(' AND ');
62
- }
60
+ this.filters.push(`#entity = :entity_value`);
61
+ this.expressionAttributeNames['#entity'] = 'entityType';
62
+ this.expressionAttributeValues[':entity_value'] = this.parent.getEntityType();
63
+ params.FilterExpression = this.filters.join(' AND ');
63
64
  const result = await this.parent.getClient().send(new lib_dynamodb_1.ScanCommand(params));
64
65
  return { items: this.parent.getSchema().array().parse(result.Items), lastKey: (_a = result.LastEvaluatedKey) !== null && _a !== void 0 ? _a : undefined };
65
66
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "betterddb",
3
- "version": "0.5.4",
3
+ "version": "0.5.5",
4
4
  "description": "A definition-based DynamoDB wrapper library that provides a schema-driven and fully typesafe DAL.",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -69,9 +69,10 @@ export class ScanBuilder<T> {
69
69
  ExclusiveStartKey: this.lastKey
70
70
  };
71
71
 
72
- if (this.filters.length > 0) {
73
- params.FilterExpression = this.filters.join(' AND ');
74
- }
72
+ this.filters.push(`#entity = :entity_value`);
73
+ this.expressionAttributeNames['#entity'] = 'entityType';
74
+ this.expressionAttributeValues[':entity_value'] = this.parent.getEntityType();
75
+ params.FilterExpression = this.filters.join(' AND ');
75
76
 
76
77
  const result = await this.parent.getClient().send(new ScanCommand(params));
77
78