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