@mastra/dynamodb 1.4.3 → 1.4.4
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.
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/index.cjs +46 -28
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +46 -28
- package/dist/index.js.map +1 -1
- package/package.json +7 -8
package/dist/docs/SKILL.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -1383,22 +1383,38 @@ var BackgroundTasksStorageDynamoDB = class extends _mastra_core_storage.Backgrou
|
|
|
1383
1383
|
const removeFields = [];
|
|
1384
1384
|
if ("status" in update && update.status !== void 0) setFields.status = update.status;
|
|
1385
1385
|
if ("retryCount" in update && update.retryCount !== void 0) setFields.retryCount = update.retryCount;
|
|
1386
|
-
if ("result" in update)
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
if ("
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
if ("
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
if ("
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1386
|
+
if ("result" in update) {
|
|
1387
|
+
if (update.result === void 0 || update.result === null) removeFields.push("result");
|
|
1388
|
+
else setFields.result = serializeJson(update.result);
|
|
1389
|
+
}
|
|
1390
|
+
if ("error" in update) {
|
|
1391
|
+
if (update.error === void 0 || update.error === null) removeFields.push("error");
|
|
1392
|
+
else setFields.error = serializeJson(update.error);
|
|
1393
|
+
}
|
|
1394
|
+
if ("suspendPayload" in update) {
|
|
1395
|
+
if (update.suspendPayload === void 0 || update.suspendPayload === null) removeFields.push("suspendPayload");
|
|
1396
|
+
else setFields.suspendPayload = serializeJson(update.suspendPayload);
|
|
1397
|
+
}
|
|
1398
|
+
if ("startedAt" in update) {
|
|
1399
|
+
if (update.startedAt === void 0 || update.startedAt === null) removeFields.push("startedAtIso");
|
|
1400
|
+
else setFields.startedAtIso = update.startedAt.toISOString();
|
|
1401
|
+
}
|
|
1402
|
+
if ("suspendedAt" in update) {
|
|
1403
|
+
if (update.suspendedAt === void 0 || update.suspendedAt === null) removeFields.push("suspendedAtIso");
|
|
1404
|
+
else setFields.suspendedAtIso = update.suspendedAt.toISOString();
|
|
1405
|
+
}
|
|
1406
|
+
if ("completedAt" in update) {
|
|
1407
|
+
if (update.completedAt === void 0 || update.completedAt === null) removeFields.push("completedAtIso");
|
|
1408
|
+
else setFields.completedAtIso = update.completedAt.toISOString();
|
|
1409
|
+
}
|
|
1410
|
+
if ("ownerId" in update) {
|
|
1411
|
+
if (update.ownerId === void 0 || update.ownerId === null) removeFields.push("ownerId");
|
|
1412
|
+
else setFields.ownerId = update.ownerId;
|
|
1413
|
+
}
|
|
1414
|
+
if ("leaseExpiresAt" in update) {
|
|
1415
|
+
if (update.leaseExpiresAt === void 0 || update.leaseExpiresAt === null) removeFields.push("leaseExpiresAtIso");
|
|
1416
|
+
else setFields.leaseExpiresAtIso = update.leaseExpiresAt.toISOString();
|
|
1417
|
+
}
|
|
1402
1418
|
if (Object.keys(setFields).length === 0 && removeFields.length === 0) return false;
|
|
1403
1419
|
let op = this.service.entities.background_task.patch({
|
|
1404
1420
|
entity: ENTITY,
|
|
@@ -1746,13 +1762,14 @@ var MemoryStorageDynamoDB = class MemoryStorageDynamoDB extends _mastra_core_sto
|
|
|
1746
1762
|
return true;
|
|
1747
1763
|
}
|
|
1748
1764
|
async prune(policies, options) {
|
|
1765
|
+
const targets = (0, _mastra_core_storage.resolveRetentionTargets)({
|
|
1766
|
+
policies,
|
|
1767
|
+
descriptor: MemoryStorageDynamoDB.retentionTables,
|
|
1768
|
+
order: ["runFences"]
|
|
1769
|
+
});
|
|
1749
1770
|
return (0, _mastra_core_storage.executeRetentionPrune)({
|
|
1750
1771
|
domain: "memory",
|
|
1751
|
-
targets
|
|
1752
|
-
policies,
|
|
1753
|
-
descriptor: MemoryStorageDynamoDB.retentionTables,
|
|
1754
|
-
order: ["runFences"]
|
|
1755
|
-
}),
|
|
1772
|
+
targets,
|
|
1756
1773
|
options,
|
|
1757
1774
|
cutoffFor: (target, now) => (0, _mastra_core_storage.retentionCutoffMs)(target.policy, now),
|
|
1758
1775
|
deleteBatch: (_target, cutoff, limit) => pruneRunClaims(this.service, "memory_run_fence", "retiredAt", Number(cutoff), limit)
|
|
@@ -2916,13 +2933,14 @@ var WorkflowStorageDynamoDB = class WorkflowStorageDynamoDB extends _mastra_core
|
|
|
2916
2933
|
return true;
|
|
2917
2934
|
}
|
|
2918
2935
|
async prune(policies, options) {
|
|
2936
|
+
const targets = (0, _mastra_core_storage.resolveRetentionTargets)({
|
|
2937
|
+
policies,
|
|
2938
|
+
descriptor: WorkflowStorageDynamoDB.retentionTables,
|
|
2939
|
+
order: ["runOwnership"]
|
|
2940
|
+
});
|
|
2919
2941
|
return (0, _mastra_core_storage.executeRetentionPrune)({
|
|
2920
2942
|
domain: "workflows",
|
|
2921
|
-
targets
|
|
2922
|
-
policies,
|
|
2923
|
-
descriptor: WorkflowStorageDynamoDB.retentionTables,
|
|
2924
|
-
order: ["runOwnership"]
|
|
2925
|
-
}),
|
|
2943
|
+
targets,
|
|
2926
2944
|
options,
|
|
2927
2945
|
cutoffFor: (target, now) => (0, _mastra_core_storage.retentionCutoffMs)(target.policy, now),
|
|
2928
2946
|
deleteBatch: (_target, cutoff, limit) => pruneRunClaims(this.service, "workflow_run_owner", "updatedAt", Number(cutoff), limit)
|
|
@@ -3118,7 +3136,7 @@ var WorkflowStorageDynamoDB = class WorkflowStorageDynamoDB extends _mastra_core
|
|
|
3118
3136
|
return snapshot.context;
|
|
3119
3137
|
} catch (error) {
|
|
3120
3138
|
if (this.isConditionalCheckFailed(error)) {
|
|
3121
|
-
if (attempt <
|
|
3139
|
+
if (attempt < 4) {
|
|
3122
3140
|
this.logger.debug(`Optimistic locking conflict in updateWorkflowResults, retrying (attempt ${attempt + 1})`);
|
|
3123
3141
|
await this.delay(attempt);
|
|
3124
3142
|
continue;
|
|
@@ -3181,7 +3199,7 @@ var WorkflowStorageDynamoDB = class WorkflowStorageDynamoDB extends _mastra_core
|
|
|
3181
3199
|
return updatedSnapshot;
|
|
3182
3200
|
} catch (error) {
|
|
3183
3201
|
if (this.isConditionalCheckFailed(error)) {
|
|
3184
|
-
if (attempt <
|
|
3202
|
+
if (attempt < 4) {
|
|
3185
3203
|
this.logger.debug(`Optimistic locking conflict in updateWorkflowState, retrying (attempt ${attempt + 1})`);
|
|
3186
3204
|
await this.delay(attempt);
|
|
3187
3205
|
continue;
|