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.
|
@@ -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
|
-
|
|
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
|
-
|
|
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 `
|
|
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
|
|
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
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
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.
|
|
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.
|
|
35
|
+
"wirejs-resources": "^0.1.44-table-resource"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@aws-amplify/backend": "^1.14.0",
|