wirejs-deploy-amplify-basic 0.0.61-table-resource → 0.0.62-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.
|
@@ -6,6 +6,7 @@ function isFieldComparison(filter) {
|
|
|
6
6
|
return !['and', 'or', 'not'].some(key => key in filter);
|
|
7
7
|
}
|
|
8
8
|
function buildFilterExpression(filter) {
|
|
9
|
+
console.log('Building filter expression for filter:', filter);
|
|
9
10
|
if (filter.and) {
|
|
10
11
|
return `(${filter.and.map(buildFilterExpression).join(' AND ')})`;
|
|
11
12
|
}
|
|
@@ -39,6 +40,7 @@ function buildFilterExpression(filter) {
|
|
|
39
40
|
throw new Error(`Unsupported filter condition: ${JSON.stringify(condition)}`);
|
|
40
41
|
}
|
|
41
42
|
function buildExpressionAttributeValues(filter) {
|
|
43
|
+
console.log('Building expression attribute values for filter:', filter);
|
|
42
44
|
const values = {};
|
|
43
45
|
if (filter.and || filter.or || filter.not) {
|
|
44
46
|
const subFilters = filter.and ?? filter.or ?? [filter.not];
|
|
@@ -49,7 +51,7 @@ function buildExpressionAttributeValues(filter) {
|
|
|
49
51
|
}
|
|
50
52
|
}
|
|
51
53
|
else if (isFieldComparison(filter)) {
|
|
52
|
-
const field = Object.keys(filter)
|
|
54
|
+
const [field] = Object.keys(filter);
|
|
53
55
|
const condition = filter[field];
|
|
54
56
|
if ('eq' in condition)
|
|
55
57
|
values[`:${field}`] = { S: condition.eq };
|
|
@@ -125,6 +127,7 @@ export class DistributedTable extends Resource {
|
|
|
125
127
|
...key,
|
|
126
128
|
...item,
|
|
127
129
|
};
|
|
130
|
+
console.log('Saving item to DynamoDB:', itemToSave);
|
|
128
131
|
await this.ddbClient.send(new PutItemCommand({
|
|
129
132
|
TableName: this.table,
|
|
130
133
|
Item: itemToSave,
|
|
@@ -136,6 +139,7 @@ export class DistributedTable extends Resource {
|
|
|
136
139
|
}
|
|
137
140
|
async delete(item) {
|
|
138
141
|
const key = this.#getDDBKey(item);
|
|
142
|
+
console.log('Deleting item from DynamoDB:', key);
|
|
139
143
|
await this.ddbClient.send(new DeleteItemCommand({
|
|
140
144
|
TableName: this.table,
|
|
141
145
|
Key: key,
|
|
@@ -147,6 +151,7 @@ export class DistributedTable extends Resource {
|
|
|
147
151
|
}
|
|
148
152
|
async get(key) {
|
|
149
153
|
const ddbKey = this.#getDDBKey(key);
|
|
154
|
+
console.log('Getting item from DynamoDB:', ddbKey);
|
|
150
155
|
const result = await this.ddbClient.send(new GetItemCommand({
|
|
151
156
|
TableName: this.table,
|
|
152
157
|
Key: ddbKey,
|
|
@@ -156,6 +161,7 @@ export class DistributedTable extends Resource {
|
|
|
156
161
|
return this.parse(result.Item);
|
|
157
162
|
}
|
|
158
163
|
async *scan(options = {}) {
|
|
164
|
+
console.log('Scanning DynamoDB table:', this.table, options);
|
|
159
165
|
let lastEvaluatedKey = undefined;
|
|
160
166
|
do {
|
|
161
167
|
const filterExpression = options.filter ? buildFilterExpression(options.filter) : undefined;
|
|
@@ -176,6 +182,7 @@ export class DistributedTable extends Resource {
|
|
|
176
182
|
} while (lastEvaluatedKey);
|
|
177
183
|
}
|
|
178
184
|
async *query(partition, options = {}) {
|
|
185
|
+
console.log('Querying DynamoDB table:', this.table, partition, options);
|
|
179
186
|
let lastEvaluatedKey = undefined;
|
|
180
187
|
do {
|
|
181
188
|
const ddbKey = this.#getDDBKey(partition);
|
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.62-table-resource",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"recursive-copy": "^2.0.14",
|
|
32
32
|
"rimraf": "^6.0.1",
|
|
33
33
|
"wirejs-dom": "^1.0.38",
|
|
34
|
-
"wirejs-resources": "^0.1.
|
|
34
|
+
"wirejs-resources": "^0.1.30-table-resource"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@aws-amplify/backend": "^1.14.0",
|