@mastra/mongodb 1.16.0 → 1.17.0-alpha.0
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 +54 -0
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/docs-storage-overview.md +2 -2
- package/dist/index.cjs +36 -38
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +36 -38
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/experiments/index.d.ts.map +1 -1
- package/dist/storage/domains/memory/index.d.ts.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import { MessageList } from "@mastra/core/agent";
|
|
|
9
9
|
import { saveScorePayloadSchema } from "@mastra/core/evals";
|
|
10
10
|
import { skillSnapshotFieldValuesEqual } from "@mastra/core/storage/domains/skills";
|
|
11
11
|
//#region package.json
|
|
12
|
-
var version = "1.
|
|
12
|
+
var version = "1.17.0-alpha.0";
|
|
13
13
|
//#endregion
|
|
14
14
|
//#region src/vector/filter.ts
|
|
15
15
|
/**
|
|
@@ -3666,6 +3666,12 @@ function transformExperimentRow(row) {
|
|
|
3666
3666
|
name: row.name ?? void 0,
|
|
3667
3667
|
description: row.description ?? void 0,
|
|
3668
3668
|
metadata: parseJsonField(row.metadata) ?? void 0,
|
|
3669
|
+
provenance: parseJsonField(row.provenance) ?? null,
|
|
3670
|
+
runnerAttestation: parseJsonField(row.runnerAttestation) ?? null,
|
|
3671
|
+
experimentSetId: row.experimentSetId ?? null,
|
|
3672
|
+
comparisonId: row.comparisonId ?? null,
|
|
3673
|
+
variantId: row.variantId ?? null,
|
|
3674
|
+
trialIndex: row.trialIndex != null ? Number(row.trialIndex) : null,
|
|
3669
3675
|
datasetId: row.datasetId ?? null,
|
|
3670
3676
|
datasetVersion: row.datasetVersion != null ? Number(row.datasetVersion) : null,
|
|
3671
3677
|
organizationId: row.organizationId ?? null,
|
|
@@ -3812,6 +3818,15 @@ var MongoDBExperimentsStorage = class MongoDBExperimentsStorage extends Experime
|
|
|
3812
3818
|
id: 1
|
|
3813
3819
|
}
|
|
3814
3820
|
},
|
|
3821
|
+
{
|
|
3822
|
+
collection: TABLE_EXPERIMENTS,
|
|
3823
|
+
keys: {
|
|
3824
|
+
experimentSetId: 1,
|
|
3825
|
+
comparisonId: 1,
|
|
3826
|
+
variantId: 1,
|
|
3827
|
+
trialIndex: 1
|
|
3828
|
+
}
|
|
3829
|
+
},
|
|
3815
3830
|
{
|
|
3816
3831
|
collection: TABLE_EXPERIMENTS,
|
|
3817
3832
|
keys: {
|
|
@@ -3885,6 +3900,12 @@ var MongoDBExperimentsStorage = class MongoDBExperimentsStorage extends Experime
|
|
|
3885
3900
|
name: input.name ?? null,
|
|
3886
3901
|
description: input.description ?? null,
|
|
3887
3902
|
metadata: input.metadata ?? null,
|
|
3903
|
+
provenance: input.provenance ?? null,
|
|
3904
|
+
runnerAttestation: input.runnerAttestation ?? null,
|
|
3905
|
+
experimentSetId: input.experimentSetId ?? null,
|
|
3906
|
+
comparisonId: input.comparisonId ?? null,
|
|
3907
|
+
variantId: input.variantId ?? null,
|
|
3908
|
+
trialIndex: input.trialIndex ?? null,
|
|
3888
3909
|
datasetId: input.datasetId ?? null,
|
|
3889
3910
|
datasetVersion: input.datasetVersion ?? null,
|
|
3890
3911
|
organizationId: input.organizationId ?? null,
|
|
@@ -3904,28 +3925,7 @@ var MongoDBExperimentsStorage = class MongoDBExperimentsStorage extends Experime
|
|
|
3904
3925
|
};
|
|
3905
3926
|
try {
|
|
3906
3927
|
await (await this.getCollection(TABLE_EXPERIMENTS)).insertOne(doc);
|
|
3907
|
-
return
|
|
3908
|
-
id,
|
|
3909
|
-
name: input.name,
|
|
3910
|
-
description: input.description,
|
|
3911
|
-
metadata: input.metadata,
|
|
3912
|
-
datasetId: input.datasetId ?? null,
|
|
3913
|
-
datasetVersion: input.datasetVersion ?? null,
|
|
3914
|
-
organizationId: input.organizationId ?? null,
|
|
3915
|
-
projectId: input.projectId ?? null,
|
|
3916
|
-
targetType: input.targetType,
|
|
3917
|
-
targetId: input.targetId,
|
|
3918
|
-
status: "pending",
|
|
3919
|
-
totalItems: input.totalItems,
|
|
3920
|
-
succeededCount: 0,
|
|
3921
|
-
failedCount: 0,
|
|
3922
|
-
skippedCount: 0,
|
|
3923
|
-
agentVersion: input.agentVersion ?? null,
|
|
3924
|
-
startedAt: null,
|
|
3925
|
-
completedAt: null,
|
|
3926
|
-
createdAt: now,
|
|
3927
|
-
updatedAt: now
|
|
3928
|
-
};
|
|
3928
|
+
return transformExperimentRow(structuredClone(doc));
|
|
3929
3929
|
} catch (error) {
|
|
3930
3930
|
throw new MastraError({
|
|
3931
3931
|
id: createStorageErrorId("MONGODB", "CREATE_EXPERIMENT", "FAILED"),
|
|
@@ -3992,6 +3992,10 @@ var MongoDBExperimentsStorage = class MongoDBExperimentsStorage extends Experime
|
|
|
3992
3992
|
if (args.targetId) filter.targetId = args.targetId;
|
|
3993
3993
|
if (args.agentVersion) filter.agentVersion = args.agentVersion;
|
|
3994
3994
|
if (args.status) filter.status = args.status;
|
|
3995
|
+
if (args.experimentSetId !== void 0) filter.experimentSetId = args.experimentSetId;
|
|
3996
|
+
if (args.comparisonId !== void 0) filter.comparisonId = args.comparisonId;
|
|
3997
|
+
if (args.variantId !== void 0) filter.variantId = args.variantId;
|
|
3998
|
+
if (args.trialIndex !== void 0) filter.trialIndex = args.trialIndex;
|
|
3995
3999
|
if (args.filters) {
|
|
3996
4000
|
const { organizationId, projectId } = args.filters;
|
|
3997
4001
|
if (organizationId !== void 0) filter.organizationId = organizationId;
|
|
@@ -5563,6 +5567,7 @@ var MemoryStorageMongoDB = class MemoryStorageMongoDB extends MemoryStorage {
|
|
|
5563
5567
|
hasMore
|
|
5564
5568
|
};
|
|
5565
5569
|
} catch (error) {
|
|
5570
|
+
if (error instanceof MastraError && error.category === ErrorCategory.USER) throw error;
|
|
5566
5571
|
const mastraError = new MastraError({
|
|
5567
5572
|
id: createStorageErrorId("MONGODB", "LIST_MESSAGES", "FAILED"),
|
|
5568
5573
|
domain: ErrorDomain.STORAGE,
|
|
@@ -5574,13 +5579,7 @@ var MemoryStorageMongoDB = class MemoryStorageMongoDB extends MemoryStorage {
|
|
|
5574
5579
|
}, error);
|
|
5575
5580
|
this.logger?.error?.(mastraError.toString());
|
|
5576
5581
|
this.logger?.trackException?.(mastraError);
|
|
5577
|
-
|
|
5578
|
-
messages: [],
|
|
5579
|
-
total: 0,
|
|
5580
|
-
page,
|
|
5581
|
-
perPage: perPageForResponse,
|
|
5582
|
-
hasMore: false
|
|
5583
|
-
};
|
|
5582
|
+
throw mastraError;
|
|
5584
5583
|
}
|
|
5585
5584
|
}
|
|
5586
5585
|
async listMessagesByResourceId(args) {
|
|
@@ -5690,6 +5689,7 @@ var MemoryStorageMongoDB = class MemoryStorageMongoDB extends MemoryStorage {
|
|
|
5690
5689
|
hasMore
|
|
5691
5690
|
};
|
|
5692
5691
|
} catch (error) {
|
|
5692
|
+
if (error instanceof MastraError && error.category === ErrorCategory.USER) throw error;
|
|
5693
5693
|
const mastraError = new MastraError({
|
|
5694
5694
|
id: createStorageErrorId("MONGODB", "LIST_MESSAGES_BY_RESOURCE_ID", "FAILED"),
|
|
5695
5695
|
domain: ErrorDomain.STORAGE,
|
|
@@ -5698,13 +5698,7 @@ var MemoryStorageMongoDB = class MemoryStorageMongoDB extends MemoryStorage {
|
|
|
5698
5698
|
}, error);
|
|
5699
5699
|
this.logger?.error?.(mastraError.toString());
|
|
5700
5700
|
this.logger?.trackException?.(mastraError);
|
|
5701
|
-
|
|
5702
|
-
messages: [],
|
|
5703
|
-
total: 0,
|
|
5704
|
-
page,
|
|
5705
|
-
perPage: perPageForResponse,
|
|
5706
|
-
hasMore: false
|
|
5707
|
-
};
|
|
5701
|
+
throw mastraError;
|
|
5708
5702
|
}
|
|
5709
5703
|
}
|
|
5710
5704
|
async saveMessages({ messages }) {
|
|
@@ -5938,7 +5932,8 @@ var MemoryStorageMongoDB = class MemoryStorageMongoDB extends MemoryStorage {
|
|
|
5938
5932
|
hasMore: perPageInput === false ? false : offset + perPage < total
|
|
5939
5933
|
};
|
|
5940
5934
|
} catch (error) {
|
|
5941
|
-
|
|
5935
|
+
if (error instanceof MastraError && error.category === ErrorCategory.USER) throw error;
|
|
5936
|
+
const mastraError = new MastraError({
|
|
5942
5937
|
id: createStorageErrorId("MONGODB", "LIST_THREADS", "FAILED"),
|
|
5943
5938
|
domain: ErrorDomain.STORAGE,
|
|
5944
5939
|
category: ErrorCategory.THIRD_PARTY,
|
|
@@ -5947,6 +5942,9 @@ var MemoryStorageMongoDB = class MemoryStorageMongoDB extends MemoryStorage {
|
|
|
5947
5942
|
hasMetadataFilter: !!filter?.metadata
|
|
5948
5943
|
}
|
|
5949
5944
|
}, error);
|
|
5945
|
+
this.logger?.error?.(mastraError.toString());
|
|
5946
|
+
this.logger?.trackException?.(mastraError);
|
|
5947
|
+
throw mastraError;
|
|
5950
5948
|
}
|
|
5951
5949
|
}
|
|
5952
5950
|
async saveThread({ thread }) {
|