@statezero/core 0.1.97 → 0.1.98
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.
|
@@ -223,7 +223,7 @@ export class QueryExecutor {
|
|
|
223
223
|
};
|
|
224
224
|
const operation = OperationFactory.createUpdateOperation(querySet, apiCallArgs.data, querySet.build().filter);
|
|
225
225
|
const estimatedCount = operation.instances.length;
|
|
226
|
-
let liveResult = [estimatedCount, { [modelName]: estimatedCount }];
|
|
226
|
+
let liveResult = [estimatedCount, { [modelName]: estimatedCount }, []];
|
|
227
227
|
const promise = makeApiCall(querySet, operationType, apiCallArgs, operation.operationId)
|
|
228
228
|
.then((response) => {
|
|
229
229
|
const { data, included } = response.data || {};
|
|
@@ -233,7 +233,7 @@ export class QueryExecutor {
|
|
|
233
233
|
: [];
|
|
234
234
|
operation.updateStatus(Status.CONFIRMED, updatedObjects);
|
|
235
235
|
const updatedCount = response.metadata?.updated_count ?? 0;
|
|
236
|
-
liveResult = [updatedCount, { [modelName]: updatedCount }];
|
|
236
|
+
liveResult = [updatedCount, { [modelName]: updatedCount }, updatedObjects];
|
|
237
237
|
breakThenable(liveResult);
|
|
238
238
|
return liveResult;
|
|
239
239
|
})
|
|
@@ -258,13 +258,13 @@ export class QueryExecutor {
|
|
|
258
258
|
const operation = OperationFactory.createDeleteOperation(querySet);
|
|
259
259
|
// live placeholder: assume we delete all existing pks
|
|
260
260
|
const estimatedCount = operation.instances.length;
|
|
261
|
-
let liveResult = [estimatedCount, { [modelName]: estimatedCount }];
|
|
261
|
+
let liveResult = [estimatedCount, { [modelName]: estimatedCount }, []];
|
|
262
262
|
const promise = makeApiCall(querySet, operationType, {}, operation.operationId)
|
|
263
263
|
.then((response) => {
|
|
264
264
|
const deletedCount = response.metadata.deleted_count;
|
|
265
265
|
const deletedInstances = response.metadata.rows_deleted;
|
|
266
266
|
operation.updateStatus(Status.CONFIRMED, deletedInstances);
|
|
267
|
-
liveResult = [deletedCount, { [modelName]: deletedCount }];
|
|
267
|
+
liveResult = [deletedCount, { [modelName]: deletedCount }, deletedInstances || []];
|
|
268
268
|
breakThenable(liveResult);
|
|
269
269
|
return liveResult;
|
|
270
270
|
})
|
|
@@ -468,7 +468,7 @@ export class QueryExecutor {
|
|
|
468
468
|
// Use factory to create operation
|
|
469
469
|
const operation = OperationFactory.createDeleteInstanceOperation(querySet, args);
|
|
470
470
|
// 1) placeholder result
|
|
471
|
-
let liveResult = [1, { [modelName]: 1 }];
|
|
471
|
+
let liveResult = [1, { [modelName]: 1 }, []];
|
|
472
472
|
// 2) async call
|
|
473
473
|
const promise = makeApiCall(querySet, operationType, args, operation.operationId)
|
|
474
474
|
.then((response) => {
|
|
@@ -477,10 +477,12 @@ export class QueryExecutor {
|
|
|
477
477
|
if (typeof response.data === "number") {
|
|
478
478
|
deletedCount = response.data;
|
|
479
479
|
}
|
|
480
|
+
// Get deleted instances from metadata if available
|
|
481
|
+
const deletedInstances = response.metadata?.rows_deleted || [args];
|
|
480
482
|
// Confirm operation
|
|
481
483
|
operation.updateStatus(Status.CONFIRMED, [args]);
|
|
482
484
|
// Swap in real result and freeze
|
|
483
|
-
liveResult = [deletedCount, { [modelName]: deletedCount }];
|
|
485
|
+
liveResult = [deletedCount, { [modelName]: deletedCount }, deletedInstances];
|
|
484
486
|
breakThenable(liveResult);
|
|
485
487
|
return liveResult;
|
|
486
488
|
})
|
package/package.json
CHANGED