wirejs-deploy-amplify-basic 0.0.74-table-resource → 0.0.76-table-resource

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.
@@ -3,6 +3,6 @@
3
3
  "dependencies": {
4
4
  "jsdom": "^25.0.1",
5
5
  "wirejs-dom": "^1.0.38",
6
- "wirejs-resources": "^0.1.42-table-resource"
6
+ "wirejs-resources": "^0.1.44-table-resource"
7
7
  }
8
8
  }
@@ -13,13 +13,26 @@ function isFieldComparison(filter) {
13
13
  function buildFilterExpression(filter) {
14
14
  console.log('Building filter expression for filter:', filter);
15
15
  if (filter.and) {
16
- return `(${filter.and.map(buildFilterExpression).join(' AND ')})`;
16
+ let pl = '(';
17
+ let pr = ')';
18
+ if (filter.and.length === 1) {
19
+ pl = '';
20
+ pr = '';
21
+ }
22
+ return `${pl}${filter.and.map(buildFilterExpression).join(' AND ')}${pr}`;
17
23
  }
18
24
  if (filter.or) {
19
- return `(${filter.or.map(buildFilterExpression).join(' OR ')})`;
25
+ let pl = '(';
26
+ ;
27
+ let pr = ')';
28
+ if (filter.or.length === 1) {
29
+ pl = '';
30
+ pr = '';
31
+ }
32
+ return `${pl}${filter.or.map(buildFilterExpression).join(' OR ')}${pr}`;
20
33
  }
21
34
  if (filter.not) {
22
- return `(NOT ${buildFilterExpression(filter.not)})`;
35
+ return `NOT ${buildFilterExpression(filter.not)}`;
23
36
  }
24
37
  if (!isFieldComparison(filter)) {
25
38
  throw new Error(`Unsupported filter: ${JSON.stringify(filter)}`);
@@ -236,17 +249,9 @@ export class DistributedTable extends Resource {
236
249
  partition: this.key.partition,
237
250
  sort: this.key.sort
238
251
  });
239
- console.log('DynamoDB query params', {
240
- TableName: this.table,
241
- IndexName: isIndexNameTheDefault ? undefined : options.by,
242
- KeyConditionExpression: keyConditionExpression,
243
- FilterExpression: filterExpression,
244
- ExpressionAttributeValues: expressionAttributeValues,
245
- ExpressionAttributeNames: expressionAttributeNames,
246
- });
247
252
  let lastEvaluatedKey = undefined;
248
253
  do {
249
- const result = await this.ddbClient.send(new QueryCommand({
254
+ const command = new QueryCommand({
250
255
  TableName: this.table,
251
256
  IndexName: isIndexNameTheDefault ? undefined : options.by,
252
257
  KeyConditionExpression: keyConditionExpression,
@@ -254,16 +259,23 @@ export class DistributedTable extends Resource {
254
259
  ExpressionAttributeValues: expressionAttributeValues,
255
260
  ExpressionAttributeNames: expressionAttributeNames,
256
261
  ExclusiveStartKey: lastEvaluatedKey,
257
- Select: 'ALL_ATTRIBUTES',
258
- }));
259
- console.log('DDB Query result:', result);
260
- for (const item of result.Items || []) {
261
- if (!item)
262
- continue;
263
- const record = this.parse(item);
264
- yield record;
262
+ });
263
+ console.log('DynamoDB query command:', JSON.stringify(command, null, 2));
264
+ try {
265
+ const result = await this.ddbClient.send(command);
266
+ console.log('DDB Query result:', result);
267
+ for (const item of result.Items || []) {
268
+ if (!item)
269
+ continue;
270
+ const record = this.parse(item);
271
+ yield record;
272
+ }
273
+ lastEvaluatedKey = result.LastEvaluatedKey;
274
+ }
275
+ catch (error) {
276
+ console.error('Error executing query:', error);
277
+ throw error;
265
278
  }
266
- lastEvaluatedKey = result.LastEvaluatedKey;
267
279
  } while (lastEvaluatedKey);
268
280
  }
269
281
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wirejs-deploy-amplify-basic",
3
- "version": "0.0.74-table-resource",
3
+ "version": "0.0.76-table-resource",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -32,7 +32,7 @@
32
32
  "recursive-copy": "^2.0.14",
33
33
  "rimraf": "^6.0.1",
34
34
  "wirejs-dom": "^1.0.38",
35
- "wirejs-resources": "^0.1.42-table-resource"
35
+ "wirejs-resources": "^0.1.44-table-resource"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@aws-amplify/backend": "^1.14.0",