@mastra/cloudflare 1.7.5-alpha.0 → 1.7.5
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/do/index.cjs +1 -1
- package/dist/do/index.js +1 -2
- package/dist/{do-D4lAj_Bf.js → do-BX1nAsXg.js} +37 -29
- package/dist/do-BX1nAsXg.js.map +1 -0
- package/dist/{do-CjtUyEjN.cjs → do-Cl2WWMnv.cjs} +37 -29
- package/dist/{do-D4lAj_Bf.js.map → do-Cl2WWMnv.cjs.map} +1 -1
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.js +2 -2
- package/dist/kv/index.cjs +1 -1
- package/dist/kv/index.js +1 -2
- package/dist/{kv-CJ02qv2x.js → kv-OtUwwOU4.js} +13 -9
- package/dist/kv-OtUwwOU4.js.map +1 -0
- package/dist/{kv-DDF-qbWq.cjs → kv-kikiC8PI.cjs} +14 -10
- package/dist/kv-kikiC8PI.cjs.map +1 -0
- package/package.json +7 -8
- package/dist/do-CjtUyEjN.cjs.map +0 -1
- package/dist/kv-CJ02qv2x.js.map +0 -1
- package/dist/kv-DDF-qbWq.cjs.map +0 -1
|
@@ -299,10 +299,11 @@ async function assertRunFence(db, { claimsTable, fence, operation }) {
|
|
|
299
299
|
params: [fence.runId],
|
|
300
300
|
first: true
|
|
301
301
|
});
|
|
302
|
-
|
|
302
|
+
const current = row ? {
|
|
303
303
|
generation: Number(row.generation),
|
|
304
304
|
ownerId: String(row.ownerId)
|
|
305
|
-
} : null
|
|
305
|
+
} : null;
|
|
306
|
+
if (!(0, _mastra_core_storage.matchesRunFence)(current, fence)) throw new _mastra_core_storage.RunFenceConflictError(fence, operation);
|
|
306
307
|
}
|
|
307
308
|
/**
|
|
308
309
|
* Runs one statement of a fenced write. With a check, `statement` must carry
|
|
@@ -1013,13 +1014,14 @@ var MemoryStorageDO = class MemoryStorageDO extends _mastra_core_storage.MemoryS
|
|
|
1013
1014
|
});
|
|
1014
1015
|
}
|
|
1015
1016
|
async prune(policies, options) {
|
|
1017
|
+
const targets = (0, _mastra_core_storage.resolveRetentionTargets)({
|
|
1018
|
+
policies,
|
|
1019
|
+
descriptor: MemoryStorageDO.retentionTables,
|
|
1020
|
+
order: ["runFences"]
|
|
1021
|
+
});
|
|
1016
1022
|
return (0, _mastra_core_storage.executeRetentionPrune)({
|
|
1017
1023
|
domain: "memory",
|
|
1018
|
-
targets
|
|
1019
|
-
policies,
|
|
1020
|
-
descriptor: MemoryStorageDO.retentionTables,
|
|
1021
|
-
order: ["runFences"]
|
|
1022
|
-
}),
|
|
1024
|
+
targets,
|
|
1023
1025
|
options,
|
|
1024
1026
|
cutoffFor: (target, now) => (0, _mastra_core_storage.retentionCutoffMs)(target.policy, now),
|
|
1025
1027
|
deleteBatch: (_target, cutoff, limit) => this.#db.pruneRunRows({
|
|
@@ -1794,15 +1796,17 @@ var MemoryStorageDO = class MemoryStorageDO extends _mastra_core_storage.MemoryS
|
|
|
1794
1796
|
const existing = existingMessagesMap.get(update.id);
|
|
1795
1797
|
if (!existing) continue;
|
|
1796
1798
|
let mergedContent = existing.content;
|
|
1797
|
-
if (update.content)
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1799
|
+
if (update.content) {
|
|
1800
|
+
if (typeof mergedContent === "object" && mergedContent !== null) mergedContent = {
|
|
1801
|
+
...mergedContent,
|
|
1802
|
+
...update.content,
|
|
1803
|
+
metadata: {
|
|
1804
|
+
...mergedContent.metadata,
|
|
1805
|
+
...update.content.metadata
|
|
1806
|
+
}
|
|
1807
|
+
};
|
|
1808
|
+
else mergedContent = update.content;
|
|
1809
|
+
}
|
|
1806
1810
|
updatedMessages.push({
|
|
1807
1811
|
...existing,
|
|
1808
1812
|
...update,
|
|
@@ -1942,9 +1946,10 @@ var ScoresStorageDO = class extends _mastra_core_storage.ScoresStorage {
|
|
|
1942
1946
|
try {
|
|
1943
1947
|
const fullTableName = this.#db.getTableName(_mastra_core_storage.TABLE_SCORERS);
|
|
1944
1948
|
const serializedRecord = {};
|
|
1945
|
-
for (const [key, value] of Object.entries(parsedScore)) if (value !== null && value !== void 0)
|
|
1946
|
-
|
|
1947
|
-
|
|
1949
|
+
for (const [key, value] of Object.entries(parsedScore)) if (value !== null && value !== void 0) {
|
|
1950
|
+
if (typeof value === "object") serializedRecord[key] = JSON.stringify(value);
|
|
1951
|
+
else serializedRecord[key] = value;
|
|
1952
|
+
} else serializedRecord[key] = null;
|
|
1948
1953
|
const now = /* @__PURE__ */ new Date();
|
|
1949
1954
|
serializedRecord.id = id;
|
|
1950
1955
|
serializedRecord.createdAt = now.toISOString();
|
|
@@ -2215,13 +2220,14 @@ var WorkflowsStorageDO = class WorkflowsStorageDO extends _mastra_core_storage.W
|
|
|
2215
2220
|
});
|
|
2216
2221
|
}
|
|
2217
2222
|
async prune(policies, options) {
|
|
2223
|
+
const targets = (0, _mastra_core_storage.resolveRetentionTargets)({
|
|
2224
|
+
policies,
|
|
2225
|
+
descriptor: WorkflowsStorageDO.retentionTables,
|
|
2226
|
+
order: ["runOwnership"]
|
|
2227
|
+
});
|
|
2218
2228
|
return (0, _mastra_core_storage.executeRetentionPrune)({
|
|
2219
2229
|
domain: "workflows",
|
|
2220
|
-
targets
|
|
2221
|
-
policies,
|
|
2222
|
-
descriptor: WorkflowsStorageDO.retentionTables,
|
|
2223
|
-
order: ["runOwnership"]
|
|
2224
|
-
}),
|
|
2230
|
+
targets,
|
|
2225
2231
|
options,
|
|
2226
2232
|
cutoffFor: (target, now) => (0, _mastra_core_storage.retentionCutoffMs)(target.policy, now),
|
|
2227
2233
|
deleteBatch: (_target, cutoff, limit) => this.#db.pruneRunRows({
|
|
@@ -2486,10 +2492,12 @@ var WorkflowsStorageDO = class WorkflowsStorageDO extends _mastra_core_storage.W
|
|
|
2486
2492
|
builder.whereAnd("CASE WHEN json_valid(snapshot) THEN json_extract(snapshot, '$.status') END = ?", status);
|
|
2487
2493
|
countBuilder.whereAnd("CASE WHEN json_valid(snapshot) THEN json_extract(snapshot, '$.status') END = ?", status);
|
|
2488
2494
|
}
|
|
2489
|
-
if (resourceId)
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2495
|
+
if (resourceId) {
|
|
2496
|
+
if (await this.#db.hasColumn(fullTableName, "resourceId")) {
|
|
2497
|
+
builder.whereAnd("resourceId = ?", resourceId);
|
|
2498
|
+
countBuilder.whereAnd("resourceId = ?", resourceId);
|
|
2499
|
+
} else this.logger.warn(`[${fullTableName}] resourceId column not found. Skipping resourceId filter.`);
|
|
2500
|
+
}
|
|
2493
2501
|
if (fromDate) {
|
|
2494
2502
|
builder.whereAnd("createdAt >= ?", fromDate instanceof Date ? fromDate.toISOString() : fromDate);
|
|
2495
2503
|
countBuilder.whereAnd("createdAt >= ?", fromDate instanceof Date ? fromDate.toISOString() : fromDate);
|
|
@@ -2717,4 +2725,4 @@ Object.defineProperty(exports, "WorkflowsStorageDO", {
|
|
|
2717
2725
|
}
|
|
2718
2726
|
});
|
|
2719
2727
|
|
|
2720
|
-
//# sourceMappingURL=do-
|
|
2728
|
+
//# sourceMappingURL=do-Cl2WWMnv.cjs.map
|