@mastra/dynamodb 1.0.0-beta.3 → 1.0.0-beta.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/CHANGELOG.md +29 -0
- package/dist/index.cjs +43 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +43 -11
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/operations/index.d.ts.map +1 -1
- package/dist/storage/domains/score/index.d.ts +2 -2
- package/dist/storage/domains/score/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 +6 -2
- package/dist/storage/index.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1663,7 +1663,8 @@ var StoreOperationsDynamoDB = class extends StoreOperations {
|
|
|
1663
1663
|
[TABLE_SCORERS]: "score",
|
|
1664
1664
|
[TABLE_TRACES]: "trace",
|
|
1665
1665
|
[TABLE_RESOURCES]: "resource",
|
|
1666
|
-
[TABLE_SPANS]: "ai_span"
|
|
1666
|
+
[TABLE_SPANS]: "ai_span",
|
|
1667
|
+
mastra_agents: "agent"
|
|
1667
1668
|
};
|
|
1668
1669
|
return mapping[tableName] || null;
|
|
1669
1670
|
}
|
|
@@ -2016,13 +2017,20 @@ var ScoresStorageDynamoDB = class extends ScoresStorage {
|
|
|
2016
2017
|
{
|
|
2017
2018
|
id: createStorageErrorId("DYNAMODB", "SAVE_SCORE", "VALIDATION_FAILED"),
|
|
2018
2019
|
domain: ErrorDomain.STORAGE,
|
|
2019
|
-
category: ErrorCategory.
|
|
2020
|
+
category: ErrorCategory.USER,
|
|
2021
|
+
details: {
|
|
2022
|
+
scorer: score.scorer?.id ?? "unknown",
|
|
2023
|
+
entityId: score.entityId ?? "unknown",
|
|
2024
|
+
entityType: score.entityType ?? "unknown",
|
|
2025
|
+
traceId: score.traceId ?? "",
|
|
2026
|
+
spanId: score.spanId ?? ""
|
|
2027
|
+
}
|
|
2020
2028
|
},
|
|
2021
2029
|
error
|
|
2022
2030
|
);
|
|
2023
2031
|
}
|
|
2024
2032
|
const now = /* @__PURE__ */ new Date();
|
|
2025
|
-
const scoreId =
|
|
2033
|
+
const scoreId = crypto.randomUUID();
|
|
2026
2034
|
const scorer = typeof validatedScore.scorer === "string" ? validatedScore.scorer : JSON.stringify(validatedScore.scorer);
|
|
2027
2035
|
const preprocessStepResult = typeof validatedScore.preprocessStepResult === "string" ? validatedScore.preprocessStepResult : JSON.stringify(validatedScore.preprocessStepResult);
|
|
2028
2036
|
const analyzeStepResult = typeof validatedScore.analyzeStepResult === "string" ? validatedScore.analyzeStepResult : JSON.stringify(validatedScore.analyzeStepResult);
|
|
@@ -2052,13 +2060,14 @@ var ScoresStorageDynamoDB = class extends ScoresStorage {
|
|
|
2052
2060
|
);
|
|
2053
2061
|
try {
|
|
2054
2062
|
await this.service.entities.score.upsert(scoreData).go();
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2063
|
+
return {
|
|
2064
|
+
score: {
|
|
2065
|
+
...validatedScore,
|
|
2066
|
+
id: scoreId,
|
|
2067
|
+
createdAt: now,
|
|
2068
|
+
updatedAt: now
|
|
2069
|
+
}
|
|
2060
2070
|
};
|
|
2061
|
-
return { score: savedScore };
|
|
2062
2071
|
} catch (error) {
|
|
2063
2072
|
throw new MastraError(
|
|
2064
2073
|
{
|
|
@@ -2475,6 +2484,26 @@ var WorkflowStorageDynamoDB = class extends WorkflowsStorage {
|
|
|
2475
2484
|
);
|
|
2476
2485
|
}
|
|
2477
2486
|
}
|
|
2487
|
+
async deleteWorkflowRunById({ runId, workflowName }) {
|
|
2488
|
+
this.logger.debug("Deleting workflow run by ID", { runId, workflowName });
|
|
2489
|
+
try {
|
|
2490
|
+
await this.service.entities.workflow_snapshot.delete({
|
|
2491
|
+
entity: "workflow_snapshot",
|
|
2492
|
+
workflow_name: workflowName,
|
|
2493
|
+
run_id: runId
|
|
2494
|
+
}).go();
|
|
2495
|
+
} catch (error) {
|
|
2496
|
+
throw new MastraError(
|
|
2497
|
+
{
|
|
2498
|
+
id: createStorageErrorId("DYNAMODB", "DELETE_WORKFLOW_RUN_BY_ID", "FAILED"),
|
|
2499
|
+
domain: ErrorDomain.STORAGE,
|
|
2500
|
+
category: ErrorCategory.THIRD_PARTY,
|
|
2501
|
+
details: { runId, workflowName }
|
|
2502
|
+
},
|
|
2503
|
+
error
|
|
2504
|
+
);
|
|
2505
|
+
}
|
|
2506
|
+
}
|
|
2478
2507
|
};
|
|
2479
2508
|
|
|
2480
2509
|
// src/storage/index.ts
|
|
@@ -2689,6 +2718,9 @@ var DynamoDBStore = class extends MastraStorage {
|
|
|
2689
2718
|
async getWorkflowRunById(args) {
|
|
2690
2719
|
return this.stores.workflows.getWorkflowRunById(args);
|
|
2691
2720
|
}
|
|
2721
|
+
async deleteWorkflowRunById({ runId, workflowName }) {
|
|
2722
|
+
return this.stores.workflows.deleteWorkflowRunById({ runId, workflowName });
|
|
2723
|
+
}
|
|
2692
2724
|
async getResourceById({ resourceId }) {
|
|
2693
2725
|
return this.stores.memory.getResourceById({ resourceId });
|
|
2694
2726
|
}
|
|
@@ -2728,8 +2760,8 @@ var DynamoDBStore = class extends MastraStorage {
|
|
|
2728
2760
|
async getScoreById({ id: _id }) {
|
|
2729
2761
|
return this.stores.scores.getScoreById({ id: _id });
|
|
2730
2762
|
}
|
|
2731
|
-
async saveScore(
|
|
2732
|
-
return this.stores.scores.saveScore(
|
|
2763
|
+
async saveScore(score) {
|
|
2764
|
+
return this.stores.scores.saveScore(score);
|
|
2733
2765
|
}
|
|
2734
2766
|
async listScoresByRunId({
|
|
2735
2767
|
runId: _runId,
|