@mastra/cloudflare 1.0.0-beta.4 → 1.0.0-beta.6
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/CHANGELOG.md +29 -0
- package/dist/index.cjs +38 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +38 -7
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/scores/index.d.ts +2 -2
- package/dist/storage/domains/scores/index.d.ts.map +1 -1
- package/dist/storage/domains/workflows/index.d.ts +4 -0
- package/dist/storage/domains/workflows/index.d.ts.map +1 -1
- package/dist/storage/index.d.ts +7 -2
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/types.d.ts +2 -1
- package/dist/storage/types.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1551,13 +1551,19 @@ var ScoresStorageCloudflare = class extends ScoresStorage {
|
|
|
1551
1551
|
id: createStorageErrorId("CLOUDFLARE", "SAVE_SCORE", "VALIDATION_FAILED"),
|
|
1552
1552
|
domain: ErrorDomain.STORAGE,
|
|
1553
1553
|
category: ErrorCategory.USER,
|
|
1554
|
-
details: {
|
|
1554
|
+
details: {
|
|
1555
|
+
scorer: score.scorer?.id ?? "unknown",
|
|
1556
|
+
entityId: score.entityId ?? "unknown",
|
|
1557
|
+
entityType: score.entityType ?? "unknown",
|
|
1558
|
+
traceId: score.traceId ?? "",
|
|
1559
|
+
spanId: score.spanId ?? ""
|
|
1560
|
+
}
|
|
1555
1561
|
},
|
|
1556
1562
|
error
|
|
1557
1563
|
);
|
|
1558
1564
|
}
|
|
1565
|
+
const id = crypto.randomUUID();
|
|
1559
1566
|
try {
|
|
1560
|
-
const id = crypto.randomUUID();
|
|
1561
1567
|
const serializedRecord = {};
|
|
1562
1568
|
for (const [key, value] of Object.entries(parsedScore)) {
|
|
1563
1569
|
if (value !== null && value !== void 0) {
|
|
@@ -1570,23 +1576,23 @@ var ScoresStorageCloudflare = class extends ScoresStorage {
|
|
|
1570
1576
|
serializedRecord[key] = null;
|
|
1571
1577
|
}
|
|
1572
1578
|
}
|
|
1579
|
+
const now = /* @__PURE__ */ new Date();
|
|
1573
1580
|
serializedRecord.id = id;
|
|
1574
|
-
serializedRecord.createdAt =
|
|
1575
|
-
serializedRecord.updatedAt =
|
|
1581
|
+
serializedRecord.createdAt = now.toISOString();
|
|
1582
|
+
serializedRecord.updatedAt = now.toISOString();
|
|
1576
1583
|
await this.operations.putKV({
|
|
1577
1584
|
tableName: TABLE_SCORERS,
|
|
1578
1585
|
key: id,
|
|
1579
1586
|
value: serializedRecord
|
|
1580
1587
|
});
|
|
1581
|
-
|
|
1582
|
-
return { score: scoreFromDb };
|
|
1588
|
+
return { score: { ...parsedScore, id, createdAt: now, updatedAt: now } };
|
|
1583
1589
|
} catch (error) {
|
|
1584
1590
|
const mastraError = new MastraError(
|
|
1585
1591
|
{
|
|
1586
1592
|
id: createStorageErrorId("CLOUDFLARE", "SAVE_SCORE", "FAILED"),
|
|
1587
1593
|
domain: ErrorDomain.STORAGE,
|
|
1588
1594
|
category: ErrorCategory.THIRD_PARTY,
|
|
1589
|
-
|
|
1595
|
+
details: { id }
|
|
1590
1596
|
},
|
|
1591
1597
|
error
|
|
1592
1598
|
);
|
|
@@ -2040,6 +2046,28 @@ var WorkflowsStorageCloudflare = class extends WorkflowsStorage {
|
|
|
2040
2046
|
return null;
|
|
2041
2047
|
}
|
|
2042
2048
|
}
|
|
2049
|
+
async deleteWorkflowRunById({ runId, workflowName }) {
|
|
2050
|
+
try {
|
|
2051
|
+
if (!runId || !workflowName) {
|
|
2052
|
+
throw new Error("runId and workflowName are required");
|
|
2053
|
+
}
|
|
2054
|
+
const key = this.operations.getKey(TABLE_WORKFLOW_SNAPSHOT, { workflow_name: workflowName, run_id: runId });
|
|
2055
|
+
await this.operations.deleteKV(TABLE_WORKFLOW_SNAPSHOT, key);
|
|
2056
|
+
} catch (error) {
|
|
2057
|
+
throw new MastraError(
|
|
2058
|
+
{
|
|
2059
|
+
id: createStorageErrorId("CLOUDFLARE", "DELETE_WORKFLOW_RUN_BY_ID", "FAILED"),
|
|
2060
|
+
domain: ErrorDomain.STORAGE,
|
|
2061
|
+
category: ErrorCategory.THIRD_PARTY,
|
|
2062
|
+
details: {
|
|
2063
|
+
workflowName,
|
|
2064
|
+
runId
|
|
2065
|
+
}
|
|
2066
|
+
},
|
|
2067
|
+
error
|
|
2068
|
+
);
|
|
2069
|
+
}
|
|
2070
|
+
}
|
|
2043
2071
|
};
|
|
2044
2072
|
|
|
2045
2073
|
// src/storage/types.ts
|
|
@@ -2231,6 +2259,9 @@ var CloudflareStore = class extends MastraStorage {
|
|
|
2231
2259
|
}) {
|
|
2232
2260
|
return this.stores.workflows.getWorkflowRunById({ runId, workflowName });
|
|
2233
2261
|
}
|
|
2262
|
+
async deleteWorkflowRunById({ runId, workflowName }) {
|
|
2263
|
+
return this.stores.workflows.deleteWorkflowRunById({ runId, workflowName });
|
|
2264
|
+
}
|
|
2234
2265
|
async updateMessages(args) {
|
|
2235
2266
|
return this.stores.memory.updateMessages(args);
|
|
2236
2267
|
}
|