betterddb 0.5.2 → 0.5.3

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.
@@ -144,7 +144,6 @@ class QueryBuilder {
144
144
  this.expressionAttributeNames['#entity'] = 'entityType';
145
145
  this.expressionAttributeValues[':entity_value'] = this.parent.getEntityType();
146
146
  params.FilterExpression = this.filterConditions.join(' AND ');
147
- console.log(params);
148
147
  const result = await this.parent.getClient().send(new lib_dynamodb_1.QueryCommand(params));
149
148
  return { items: this.parent.getSchema().array().parse(result.Items), lastKey: (_c = result.LastEvaluatedKey) !== null && _c !== void 0 ? _c : undefined };
150
149
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "betterddb",
3
- "version": "0.5.2",
3
+ "version": "0.5.3",
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",
@@ -168,7 +168,6 @@ export class QueryBuilder<T> {
168
168
  this.expressionAttributeValues[':entity_value'] = this.parent.getEntityType();
169
169
  params.FilterExpression = this.filterConditions.join(' AND ');
170
170
 
171
- console.log(params);
172
171
  const result = await this.parent.getClient().send(new QueryCommand(params));
173
172
  return {items: this.parent.getSchema().array().parse(result.Items) as T[], lastKey: result.LastEvaluatedKey ?? undefined};
174
173
  }
package/test/get.test.ts CHANGED
@@ -77,4 +77,9 @@ describe('BetterDDB - Get Operation', () => {
77
77
  expect(user).not.toBeNull();
78
78
  expect(user?.id).toBe('user-123');
79
79
  });
80
+
81
+ it('should retrieve an item using GetBuilder that does not exist', async () => {
82
+ const user = await userDdb.get({ id: 'user-123', email: 'jane@example.com' }).execute();
83
+ expect(user).toBeNull();
84
+ });
80
85
  });
@@ -179,4 +179,14 @@ describe('BetterDDB - Query Operation', () => {
179
179
  expect(result.name).toContain('B');
180
180
  });
181
181
  });
182
+
183
+ it('should query items using QueryBuilder with where clause on an index', async () => {
184
+ // Query the GSI for email "alice@example.com". Two items match.
185
+ // Then apply two filter conditions: name begins_with "Alice" and name contains "B" should only match one.
186
+ const results = await userDdb.query({ email: 'alice@example.com' })
187
+ .usingIndex('EmailIndex')
188
+ .where('begins_with', { email: 'alice' })
189
+ .execute();
190
+ expect(results.items.length).toEqual(2);
191
+ });
182
192
  });