@mastra/mongodb 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 +31 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +31 -10
- 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 +6 -2
- package/dist/storage/index.d.ts.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
# @mastra/mongodb
|
|
2
2
|
|
|
3
|
+
## 1.0.0-beta.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Add delete workflow run API ([#10991](https://github.com/mastra-ai/mastra/pull/10991))
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
await workflow.deleteWorkflowRunById(runId);
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
- Updated dependencies [[`edb07e4`](https://github.com/mastra-ai/mastra/commit/edb07e49283e0c28bd094a60e03439bf6ecf0221), [`b7e17d3`](https://github.com/mastra-ai/mastra/commit/b7e17d3f5390bb5a71efc112204413656fcdc18d), [`261473a`](https://github.com/mastra-ai/mastra/commit/261473ac637e633064a22076671e2e02b002214d), [`5d7000f`](https://github.com/mastra-ai/mastra/commit/5d7000f757cd65ea9dc5b05e662fd83dfd44e932), [`4f0331a`](https://github.com/mastra-ai/mastra/commit/4f0331a79bf6eb5ee598a5086e55de4b5a0ada03), [`8a000da`](https://github.com/mastra-ai/mastra/commit/8a000da0c09c679a2312f6b3aa05b2ca78ca7393)]:
|
|
14
|
+
- @mastra/core@1.0.0-beta.10
|
|
15
|
+
|
|
16
|
+
## 1.0.0-beta.5
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- Fix saveScore not persisting ID correctly, breaking getScoreById retrieval ([#10915](https://github.com/mastra-ai/mastra/pull/10915))
|
|
21
|
+
|
|
22
|
+
**What Changed**
|
|
23
|
+
- saveScore now correctly returns scores that can be retrieved with getScoreById
|
|
24
|
+
- Validation errors now include contextual information (scorer, entity, trace details) for easier debugging
|
|
25
|
+
|
|
26
|
+
**Impact**
|
|
27
|
+
Previously, calling getScoreById after saveScore would return null because the generated ID wasn't persisted to the database. This is now fixed across all store implementations, ensuring consistent behavior and data integrity.
|
|
28
|
+
|
|
29
|
+
- Updated dependencies [[`0d41fe2`](https://github.com/mastra-ai/mastra/commit/0d41fe245355dfc66d61a0d9c85d9400aac351ff), [`6b3ba91`](https://github.com/mastra-ai/mastra/commit/6b3ba91494cc10394df96782f349a4f7b1e152cc), [`7907fd1`](https://github.com/mastra-ai/mastra/commit/7907fd1c5059813b7b870b81ca71041dc807331b)]:
|
|
30
|
+
- @mastra/core@1.0.0-beta.8
|
|
31
|
+
|
|
3
32
|
## 1.0.0-beta.4
|
|
4
33
|
|
|
5
34
|
### Minor Changes
|
package/dist/index.cjs
CHANGED
|
@@ -13,7 +13,7 @@ var evals = require('@mastra/core/evals');
|
|
|
13
13
|
|
|
14
14
|
// package.json
|
|
15
15
|
var package_default = {
|
|
16
|
-
version: "1.0.0-beta.
|
|
16
|
+
version: "1.0.0-beta.6"};
|
|
17
17
|
var MongoDBFilterTranslator = class extends filter.BaseFilterTranslator {
|
|
18
18
|
getSupportedOperators() {
|
|
19
19
|
return {
|
|
@@ -1939,14 +1939,21 @@ var ScoresStorageMongoDB = class extends storage.ScoresStorage {
|
|
|
1939
1939
|
{
|
|
1940
1940
|
id: storage.createStorageErrorId("MONGODB", "SAVE_SCORE", "VALIDATION_FAILED"),
|
|
1941
1941
|
domain: error.ErrorDomain.STORAGE,
|
|
1942
|
-
category: error.ErrorCategory.
|
|
1942
|
+
category: error.ErrorCategory.USER,
|
|
1943
|
+
details: {
|
|
1944
|
+
scorer: score.scorer?.id ?? "unknown",
|
|
1945
|
+
entityId: score.entityId ?? "unknown",
|
|
1946
|
+
entityType: score.entityType ?? "unknown",
|
|
1947
|
+
traceId: score.traceId ?? "",
|
|
1948
|
+
spanId: score.spanId ?? ""
|
|
1949
|
+
}
|
|
1943
1950
|
},
|
|
1944
1951
|
error$1
|
|
1945
1952
|
);
|
|
1946
1953
|
}
|
|
1947
1954
|
try {
|
|
1948
1955
|
const now = /* @__PURE__ */ new Date();
|
|
1949
|
-
const scoreId =
|
|
1956
|
+
const scoreId = crypto.randomUUID();
|
|
1950
1957
|
const scorer = typeof validatedScore.scorer === "string" ? storage.safelyParseJSON(validatedScore.scorer) : validatedScore.scorer;
|
|
1951
1958
|
const preprocessStepResult = typeof validatedScore.preprocessStepResult === "string" ? storage.safelyParseJSON(validatedScore.preprocessStepResult) : validatedScore.preprocessStepResult;
|
|
1952
1959
|
const analyzeStepResult = typeof validatedScore.analyzeStepResult === "string" ? storage.safelyParseJSON(validatedScore.analyzeStepResult) : validatedScore.analyzeStepResult;
|
|
@@ -1958,6 +1965,7 @@ var ScoresStorageMongoDB = class extends storage.ScoresStorage {
|
|
|
1958
1965
|
const updatedAt = now;
|
|
1959
1966
|
const dataToSave = {
|
|
1960
1967
|
...validatedScore,
|
|
1968
|
+
id: scoreId,
|
|
1961
1969
|
scorer,
|
|
1962
1970
|
preprocessStepResult,
|
|
1963
1971
|
analyzeStepResult,
|
|
@@ -1970,13 +1978,7 @@ var ScoresStorageMongoDB = class extends storage.ScoresStorage {
|
|
|
1970
1978
|
};
|
|
1971
1979
|
const collection = await this.operations.getCollection(storage.TABLE_SCORERS);
|
|
1972
1980
|
await collection.insertOne(dataToSave);
|
|
1973
|
-
|
|
1974
|
-
...score,
|
|
1975
|
-
id: scoreId,
|
|
1976
|
-
createdAt: now,
|
|
1977
|
-
updatedAt: now
|
|
1978
|
-
};
|
|
1979
|
-
return { score: savedScore };
|
|
1981
|
+
return { score: dataToSave };
|
|
1980
1982
|
} catch (error$1) {
|
|
1981
1983
|
throw new error.MastraError(
|
|
1982
1984
|
{
|
|
@@ -2378,6 +2380,22 @@ var WorkflowsStorageMongoDB = class extends storage.WorkflowsStorage {
|
|
|
2378
2380
|
);
|
|
2379
2381
|
}
|
|
2380
2382
|
}
|
|
2383
|
+
async deleteWorkflowRunById({ runId, workflowName }) {
|
|
2384
|
+
try {
|
|
2385
|
+
const collection = await this.operations.getCollection(storage.TABLE_WORKFLOW_SNAPSHOT);
|
|
2386
|
+
await collection.deleteOne({ workflow_name: workflowName, run_id: runId });
|
|
2387
|
+
} catch (error$1) {
|
|
2388
|
+
throw new error.MastraError(
|
|
2389
|
+
{
|
|
2390
|
+
id: storage.createStorageErrorId("MONGODB", "DELETE_WORKFLOW_RUN_BY_ID", "FAILED"),
|
|
2391
|
+
domain: error.ErrorDomain.STORAGE,
|
|
2392
|
+
category: error.ErrorCategory.THIRD_PARTY,
|
|
2393
|
+
details: { runId, workflowName }
|
|
2394
|
+
},
|
|
2395
|
+
error$1
|
|
2396
|
+
);
|
|
2397
|
+
}
|
|
2398
|
+
}
|
|
2381
2399
|
parseWorkflowRun(row) {
|
|
2382
2400
|
let parsedSnapshot = row.snapshot;
|
|
2383
2401
|
if (typeof parsedSnapshot === "string") {
|
|
@@ -2562,6 +2580,9 @@ var MongoDBStore = class extends storage.MastraStorage {
|
|
|
2562
2580
|
}) {
|
|
2563
2581
|
return this.stores.workflows.getWorkflowRunById({ runId, workflowName });
|
|
2564
2582
|
}
|
|
2583
|
+
async deleteWorkflowRunById({ runId, workflowName }) {
|
|
2584
|
+
return this.stores.workflows.deleteWorkflowRunById({ runId, workflowName });
|
|
2585
|
+
}
|
|
2565
2586
|
async close() {
|
|
2566
2587
|
try {
|
|
2567
2588
|
await this.#connector.close();
|