@mastra/mongodb 1.0.0-beta.7 → 1.0.0-beta.9
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 +258 -0
- package/dist/index.cjs +971 -623
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +968 -625
- package/dist/index.js.map +1 -1
- package/dist/storage/db/index.d.ts +10 -0
- package/dist/storage/db/index.d.ts.map +1 -0
- package/dist/storage/domains/agents/index.d.ts +36 -0
- package/dist/storage/domains/agents/index.d.ts.map +1 -0
- package/dist/storage/domains/memory/index.d.ts +21 -5
- package/dist/storage/domains/memory/index.d.ts.map +1 -1
- package/dist/storage/domains/observability/index.d.ts +28 -28
- package/dist/storage/domains/observability/index.d.ts.map +1 -1
- package/dist/storage/domains/scores/index.d.ts +24 -23
- package/dist/storage/domains/scores/index.d.ts.map +1 -1
- package/dist/storage/domains/workflows/index.d.ts +23 -6
- package/dist/storage/domains/workflows/index.d.ts.map +1 -1
- package/dist/storage/index.d.ts +30 -186
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/types.d.ts +67 -1
- package/dist/storage/types.d.ts.map +1 -1
- package/package.json +3 -3
- package/dist/storage/domains/operations/index.d.ts +0 -50
- package/dist/storage/domains/operations/index.d.ts.map +0 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { MongoDBConnector } from '../connectors/MongoDBConnector.js';
|
|
2
|
+
import type { MongoDBConfig, MongoDBDomainConfig } from '../types.js';
|
|
3
|
+
export type { MongoDBConfig, MongoDBDomainConfig } from '../types.js';
|
|
4
|
+
export { MongoDBConnector } from '../connectors/MongoDBConnector.js';
|
|
5
|
+
/**
|
|
6
|
+
* Resolves a config to a MongoDBConnector instance.
|
|
7
|
+
* Accepts both MongoDBConfig (main store) and MongoDBDomainConfig (domains).
|
|
8
|
+
*/
|
|
9
|
+
export declare function resolveMongoDBConfig(config: MongoDBConfig | MongoDBDomainConfig): MongoDBConnector;
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/storage/db/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,KAAK,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAGnE,YAAY,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAElE;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,aAAa,GAAG,mBAAmB,GAAG,gBAAgB,CA0ClG"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { AgentsStorage } from '@mastra/core/storage';
|
|
2
|
+
import type { StorageAgentType, StorageCreateAgentInput, StorageUpdateAgentInput, StorageListAgentsInput, StorageListAgentsOutput } from '@mastra/core/storage';
|
|
3
|
+
import type { MongoDBDomainConfig, MongoDBIndexConfig } from '../../types.js';
|
|
4
|
+
export declare class MongoDBAgentsStorage extends AgentsStorage {
|
|
5
|
+
#private;
|
|
6
|
+
/** Collections managed by this domain */
|
|
7
|
+
static readonly MANAGED_COLLECTIONS: readonly ["mastra_agents"];
|
|
8
|
+
constructor(config: MongoDBDomainConfig);
|
|
9
|
+
private getCollection;
|
|
10
|
+
/**
|
|
11
|
+
* Returns default index definitions for the agents domain collections.
|
|
12
|
+
* These indexes optimize common query patterns for agent lookups.
|
|
13
|
+
*/
|
|
14
|
+
getDefaultIndexDefinitions(): MongoDBIndexConfig[];
|
|
15
|
+
createDefaultIndexes(): Promise<void>;
|
|
16
|
+
/**
|
|
17
|
+
* Creates custom user-defined indexes for this domain's collections.
|
|
18
|
+
*/
|
|
19
|
+
createCustomIndexes(): Promise<void>;
|
|
20
|
+
init(): Promise<void>;
|
|
21
|
+
dangerouslyClearAll(): Promise<void>;
|
|
22
|
+
getAgentById({ id }: {
|
|
23
|
+
id: string;
|
|
24
|
+
}): Promise<StorageAgentType | null>;
|
|
25
|
+
createAgent({ agent }: {
|
|
26
|
+
agent: StorageCreateAgentInput;
|
|
27
|
+
}): Promise<StorageAgentType>;
|
|
28
|
+
updateAgent({ id, ...updates }: StorageUpdateAgentInput): Promise<StorageAgentType>;
|
|
29
|
+
deleteAgent({ id }: {
|
|
30
|
+
id: string;
|
|
31
|
+
}): Promise<void>;
|
|
32
|
+
listAgents(args?: StorageListAgentsInput): Promise<StorageListAgentsOutput>;
|
|
33
|
+
private transformAgent;
|
|
34
|
+
private serializeAgent;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/agents/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,aAAa,EAKd,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EACV,gBAAgB,EAChB,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,EACtB,uBAAuB,EACxB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,KAAK,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAE3E,qBAAa,oBAAqB,SAAQ,aAAa;;IAKrD,yCAAyC;IACzC,MAAM,CAAC,QAAQ,CAAC,mBAAmB,6BAA2B;gBAElD,MAAM,EAAE,mBAAmB;YAUzB,aAAa;IAI3B;;;OAGG;IACH,0BAA0B,IAAI,kBAAkB,EAAE;IAQ5C,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC;IAe3C;;OAEG;IACG,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC;IAepC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAKrB,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC;IAKpC,YAAY,CAAC,EAAE,EAAE,EAAE,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAuBtE,WAAW,CAAC,EAAE,KAAK,EAAE,EAAE;QAAE,KAAK,EAAE,uBAAuB,CAAA;KAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC;IA0CrF,WAAW,CAAC,EAAE,EAAE,EAAE,GAAG,OAAO,EAAE,EAAE,uBAAuB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAmEnF,WAAW,CAAC,EAAE,EAAE,EAAE,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAkBlD,UAAU,CAAC,IAAI,CAAC,EAAE,sBAAsB,GAAG,OAAO,CAAC,uBAAuB,CAAC;IAsEjF,OAAO,CAAC,cAAc;IAStB,OAAO,CAAC,cAAc;CAKvB"}
|
|
@@ -2,12 +2,27 @@ import type { MastraMessageContentV2 } from '@mastra/core/agent';
|
|
|
2
2
|
import type { MastraDBMessage, StorageThreadType } from '@mastra/core/memory';
|
|
3
3
|
import { MemoryStorage } from '@mastra/core/storage';
|
|
4
4
|
import type { StorageResourceType, StorageListMessagesInput, StorageListMessagesOutput, StorageListThreadsByResourceIdInput, StorageListThreadsByResourceIdOutput } from '@mastra/core/storage';
|
|
5
|
-
import type {
|
|
5
|
+
import type { MongoDBDomainConfig, MongoDBIndexConfig } from '../../types.js';
|
|
6
6
|
export declare class MemoryStorageMongoDB extends MemoryStorage {
|
|
7
|
-
private
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
#private;
|
|
8
|
+
/** Collections managed by this domain */
|
|
9
|
+
static readonly MANAGED_COLLECTIONS: readonly ["mastra_threads", "mastra_messages", "mastra_resources"];
|
|
10
|
+
constructor(config: MongoDBDomainConfig);
|
|
11
|
+
private getCollection;
|
|
12
|
+
init(): Promise<void>;
|
|
13
|
+
/**
|
|
14
|
+
* Returns default index definitions for the memory domain collections.
|
|
15
|
+
*/
|
|
16
|
+
getDefaultIndexDefinitions(): MongoDBIndexConfig[];
|
|
17
|
+
/**
|
|
18
|
+
* Creates default indexes for optimal query performance.
|
|
19
|
+
*/
|
|
20
|
+
createDefaultIndexes(): Promise<void>;
|
|
21
|
+
/**
|
|
22
|
+
* Creates custom user-defined indexes for this domain's collections.
|
|
23
|
+
*/
|
|
24
|
+
createCustomIndexes(): Promise<void>;
|
|
25
|
+
dangerouslyClearAll(): Promise<void>;
|
|
11
26
|
private parseRow;
|
|
12
27
|
private _getIncludedMessages;
|
|
13
28
|
listMessagesById({ messageIds }: {
|
|
@@ -56,5 +71,6 @@ export declare class MemoryStorageMongoDB extends MemoryStorage {
|
|
|
56
71
|
deleteThread({ threadId }: {
|
|
57
72
|
threadId: string;
|
|
58
73
|
}): Promise<void>;
|
|
74
|
+
deleteMessages(messageIds: string[]): Promise<void>;
|
|
59
75
|
}
|
|
60
76
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/memory/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAEjE,OAAO,KAAK,EAAmB,eAAe,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC/F,OAAO,EAEL,aAAa,EAOd,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EACV,mBAAmB,EACnB,wBAAwB,EACxB,yBAAyB,EACzB,mCAAmC,EACnC,oCAAoC,EACrC,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/memory/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAEjE,OAAO,KAAK,EAAmB,eAAe,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC/F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xB,YAAY,CAAC,EAAE,QAAQ,EAAE,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAqB/D,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CA8B1D"}
|
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
import type { TracingStorageStrategy } from '@mastra/core/observability';
|
|
2
1
|
import { ObservabilityStorage } from '@mastra/core/storage';
|
|
3
|
-
import type { SpanRecord,
|
|
4
|
-
import type {
|
|
2
|
+
import type { SpanRecord, PaginationInfo, ListTracesArgs, TracingStorageStrategy, UpdateSpanArgs, BatchDeleteTracesArgs, BatchCreateSpansArgs, BatchUpdateSpansArgs, CreateSpanArgs, GetSpanArgs, GetSpanResponse, GetRootSpanArgs, GetRootSpanResponse, GetTraceArgs, GetTraceResponse } from '@mastra/core/storage';
|
|
3
|
+
import type { MongoDBDomainConfig, MongoDBIndexConfig } from '../../types.js';
|
|
5
4
|
export declare class ObservabilityMongoDB extends ObservabilityStorage {
|
|
6
|
-
private
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
#private;
|
|
6
|
+
/** Collections managed by this domain */
|
|
7
|
+
static readonly MANAGED_COLLECTIONS: readonly ["mastra_ai_spans"];
|
|
8
|
+
constructor(config: MongoDBDomainConfig);
|
|
9
|
+
private getCollection;
|
|
10
|
+
/**
|
|
11
|
+
* Returns default index definitions for the observability domain collections.
|
|
12
|
+
* These indexes optimize common query patterns for span and trace lookups.
|
|
13
|
+
*/
|
|
14
|
+
getDefaultIndexDefinitions(): MongoDBIndexConfig[];
|
|
15
|
+
createDefaultIndexes(): Promise<void>;
|
|
16
|
+
/**
|
|
17
|
+
* Creates custom user-defined indexes for this domain's collections.
|
|
18
|
+
*/
|
|
19
|
+
createCustomIndexes(): Promise<void>;
|
|
20
|
+
init(): Promise<void>;
|
|
21
|
+
dangerouslyClearAll(): Promise<void>;
|
|
10
22
|
get tracingStrategy(): {
|
|
11
23
|
preferred: TracingStorageStrategy;
|
|
12
24
|
supported: TracingStorageStrategy[];
|
|
13
25
|
};
|
|
14
|
-
createSpan(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}): Promise<void>;
|
|
21
|
-
getTracesPaginated({ filters, pagination, }: TracesPaginatedArg): Promise<{
|
|
26
|
+
createSpan(args: CreateSpanArgs): Promise<void>;
|
|
27
|
+
getSpan(args: GetSpanArgs): Promise<GetSpanResponse | null>;
|
|
28
|
+
getRootSpan(args: GetRootSpanArgs): Promise<GetRootSpanResponse | null>;
|
|
29
|
+
getTrace(args: GetTraceArgs): Promise<GetTraceResponse | null>;
|
|
30
|
+
updateSpan(args: UpdateSpanArgs): Promise<void>;
|
|
31
|
+
listTraces(args: ListTracesArgs): Promise<{
|
|
22
32
|
pagination: PaginationInfo;
|
|
23
33
|
spans: SpanRecord[];
|
|
24
34
|
}>;
|
|
25
|
-
batchCreateSpans(args:
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
batchUpdateSpans(args: {
|
|
29
|
-
records: {
|
|
30
|
-
traceId: string;
|
|
31
|
-
spanId: string;
|
|
32
|
-
updates: Partial<UpdateSpanRecord>;
|
|
33
|
-
}[];
|
|
34
|
-
}): Promise<void>;
|
|
35
|
-
batchDeleteTraces(args: {
|
|
36
|
-
traceIds: string[];
|
|
37
|
-
}): Promise<void>;
|
|
35
|
+
batchCreateSpans(args: BatchCreateSpansArgs): Promise<void>;
|
|
36
|
+
batchUpdateSpans(args: BatchUpdateSpansArgs): Promise<void>;
|
|
37
|
+
batchDeleteTraces(args: BatchDeleteTracesArgs): Promise<void>;
|
|
38
38
|
/**
|
|
39
39
|
* Transform MongoDB document to SpanRecord format
|
|
40
40
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/observability/index.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/observability/index.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,oBAAoB,EAGrB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EACV,UAAU,EAEV,cAAc,EACd,cAAc,EACd,sBAAsB,EACtB,cAAc,EACd,qBAAqB,EACrB,oBAAoB,EACpB,oBAAoB,EACpB,cAAc,EACd,WAAW,EACX,eAAe,EACf,eAAe,EACf,mBAAmB,EACnB,YAAY,EACZ,gBAAgB,EACjB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,KAAK,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAE3E,qBAAa,oBAAqB,SAAQ,oBAAoB;;IAK5D,yCAAyC;IACzC,MAAM,CAAC,QAAQ,CAAC,mBAAmB,+BAA0B;gBAEjD,MAAM,EAAE,mBAAmB;YAUzB,aAAa;IAI3B;;;OAGG;IACH,0BAA0B,IAAI,kBAAkB,EAAE;IAW5C,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC;IAe3C;;OAEG;IACG,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC;IAepC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAKrB,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC;IAK1C,IAAoB,eAAe,IAAI;QACrC,SAAS,EAAE,sBAAsB,CAAC;QAClC,SAAS,EAAE,sBAAsB,EAAE,CAAC;KACrC,CAKA;IAEK,UAAU,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAkC/C,OAAO,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC;IA0B3D,WAAW,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;IA0BvE,QAAQ,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;IA8B9D,UAAU,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAmC/C,UAAU,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC;QAAE,UAAU,EAAE,cAAc,CAAC;QAAC,KAAK,EAAE,UAAU,EAAE,CAAA;KAAE,CAAC;IAmS9F,gBAAgB,CAAC,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;IA+B3D,gBAAgB,CAAC,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;IA4C3D,iBAAiB,CAAC,IAAI,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC;IAmBnE;;OAEG;IACH,OAAO,CAAC,sBAAsB;CAoB/B"}
|
|
@@ -1,12 +1,25 @@
|
|
|
1
|
-
import type { SaveScorePayload, ScoreRowData, ScoringSource } from '@mastra/core/evals';
|
|
1
|
+
import type { ListScoresResponse, SaveScorePayload, ScoreRowData, ScoringSource } from '@mastra/core/evals';
|
|
2
2
|
import { ScoresStorage } from '@mastra/core/storage';
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
3
|
+
import type { StoragePagination } from '@mastra/core/storage';
|
|
4
|
+
import type { MongoDBDomainConfig, MongoDBIndexConfig } from '../../types.js';
|
|
5
5
|
export declare class ScoresStorageMongoDB extends ScoresStorage {
|
|
6
|
-
private
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
#private;
|
|
7
|
+
/** Collections managed by this domain */
|
|
8
|
+
static readonly MANAGED_COLLECTIONS: readonly ["mastra_scorers"];
|
|
9
|
+
constructor(config: MongoDBDomainConfig);
|
|
10
|
+
private getCollection;
|
|
11
|
+
/**
|
|
12
|
+
* Returns default index definitions for the scores domain collections.
|
|
13
|
+
* These indexes optimize common query patterns for score lookups.
|
|
14
|
+
*/
|
|
15
|
+
getDefaultIndexDefinitions(): MongoDBIndexConfig[];
|
|
16
|
+
createDefaultIndexes(): Promise<void>;
|
|
17
|
+
/**
|
|
18
|
+
* Creates custom user-defined indexes for this domain's collections.
|
|
19
|
+
*/
|
|
20
|
+
createCustomIndexes(): Promise<void>;
|
|
21
|
+
init(): Promise<void>;
|
|
22
|
+
dangerouslyClearAll(): Promise<void>;
|
|
10
23
|
getScoreById({ id }: {
|
|
11
24
|
id: string;
|
|
12
25
|
}): Promise<ScoreRowData | null>;
|
|
@@ -19,32 +32,20 @@ export declare class ScoresStorageMongoDB extends ScoresStorage {
|
|
|
19
32
|
entityId?: string;
|
|
20
33
|
entityType?: string;
|
|
21
34
|
source?: ScoringSource;
|
|
22
|
-
}): Promise<
|
|
23
|
-
pagination: PaginationInfo;
|
|
24
|
-
scores: ScoreRowData[];
|
|
25
|
-
}>;
|
|
35
|
+
}): Promise<ListScoresResponse>;
|
|
26
36
|
listScoresByRunId({ runId, pagination, }: {
|
|
27
37
|
runId: string;
|
|
28
38
|
pagination: StoragePagination;
|
|
29
|
-
}): Promise<
|
|
30
|
-
pagination: PaginationInfo;
|
|
31
|
-
scores: ScoreRowData[];
|
|
32
|
-
}>;
|
|
39
|
+
}): Promise<ListScoresResponse>;
|
|
33
40
|
listScoresByEntityId({ entityId, entityType, pagination, }: {
|
|
34
41
|
pagination: StoragePagination;
|
|
35
42
|
entityId: string;
|
|
36
43
|
entityType: string;
|
|
37
|
-
}): Promise<
|
|
38
|
-
pagination: PaginationInfo;
|
|
39
|
-
scores: ScoreRowData[];
|
|
40
|
-
}>;
|
|
44
|
+
}): Promise<ListScoresResponse>;
|
|
41
45
|
listScoresBySpan({ traceId, spanId, pagination, }: {
|
|
42
46
|
traceId: string;
|
|
43
47
|
spanId: string;
|
|
44
48
|
pagination: StoragePagination;
|
|
45
|
-
}): Promise<
|
|
46
|
-
pagination: PaginationInfo;
|
|
47
|
-
scores: ScoreRowData[];
|
|
48
|
-
}>;
|
|
49
|
+
}): Promise<ListScoresResponse>;
|
|
49
50
|
}
|
|
50
51
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/scores/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/scores/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAE5G,OAAO,EAEL,aAAa,EAMd,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAG9D,OAAO,KAAK,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAY3E,qBAAa,oBAAqB,SAAQ,aAAa;;IAKrD,yCAAyC;IACzC,MAAM,CAAC,QAAQ,CAAC,mBAAmB,8BAA4B;gBAEnD,MAAM,EAAE,mBAAmB;YAUzB,aAAa;IAI3B;;;OAGG;IACH,0BAA0B,IAAI,kBAAkB,EAAE;IAY5C,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC;IAe3C;;OAEG;IACG,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC;IAepC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAKrB,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC;IAKpC,YAAY,CAAC,EAAE,EAAE,EAAE,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;IAuBlE,SAAS,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,YAAY,CAAA;KAAE,CAAC;IA+EpE,oBAAoB,CAAC,EACzB,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,UAAU,EACV,MAAM,GACP,EAAE;QACD,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,EAAE,iBAAiB,CAAC;QAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,MAAM,CAAC,EAAE,aAAa,CAAC;KACxB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAqEzB,iBAAiB,CAAC,EACtB,KAAK,EACL,UAAU,GACX,EAAE;QACD,KAAK,EAAE,MAAM,CAAC;QACd,UAAU,EAAE,iBAAiB,CAAC;KAC/B,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAuDzB,oBAAoB,CAAC,EACzB,QAAQ,EACR,UAAU,EACV,UAAU,GACX,EAAE;QACD,UAAU,EAAE,iBAAiB,CAAC;QAC9B,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,EAAE,MAAM,CAAC;KACpB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAuDzB,gBAAgB,CAAC,EACrB,OAAO,EACP,MAAM,EACN,UAAU,GACX,EAAE;QACD,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,MAAM,CAAC;QACf,UAAU,EAAE,iBAAiB,CAAC;KAC/B,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAuDhC"}
|
|
@@ -1,12 +1,27 @@
|
|
|
1
1
|
import { WorkflowsStorage } from '@mastra/core/storage';
|
|
2
2
|
import type { WorkflowRun, WorkflowRuns, StorageListWorkflowRunsInput, UpdateWorkflowStateOptions } from '@mastra/core/storage';
|
|
3
3
|
import type { StepResult, WorkflowRunState } from '@mastra/core/workflows';
|
|
4
|
-
import type {
|
|
4
|
+
import type { MongoDBDomainConfig, MongoDBIndexConfig } from '../../types.js';
|
|
5
5
|
export declare class WorkflowsStorageMongoDB extends WorkflowsStorage {
|
|
6
|
-
private
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
#private;
|
|
7
|
+
/** Collections managed by this domain */
|
|
8
|
+
static readonly MANAGED_COLLECTIONS: readonly ["mastra_workflow_snapshot"];
|
|
9
|
+
constructor(config: MongoDBDomainConfig);
|
|
10
|
+
private getCollection;
|
|
11
|
+
init(): Promise<void>;
|
|
12
|
+
/**
|
|
13
|
+
* Returns default index definitions for the workflows domain collections.
|
|
14
|
+
*/
|
|
15
|
+
getDefaultIndexDefinitions(): MongoDBIndexConfig[];
|
|
16
|
+
/**
|
|
17
|
+
* Creates default indexes for optimal query performance.
|
|
18
|
+
*/
|
|
19
|
+
createDefaultIndexes(): Promise<void>;
|
|
20
|
+
/**
|
|
21
|
+
* Creates custom user-defined indexes for this domain's collections.
|
|
22
|
+
*/
|
|
23
|
+
createCustomIndexes(): Promise<void>;
|
|
24
|
+
dangerouslyClearAll(): Promise<void>;
|
|
10
25
|
updateWorkflowResults({}: {
|
|
11
26
|
workflowName: string;
|
|
12
27
|
runId: string;
|
|
@@ -19,11 +34,13 @@ export declare class WorkflowsStorageMongoDB extends WorkflowsStorage {
|
|
|
19
34
|
runId: string;
|
|
20
35
|
opts: UpdateWorkflowStateOptions;
|
|
21
36
|
}): Promise<WorkflowRunState | undefined>;
|
|
22
|
-
persistWorkflowSnapshot({ workflowName, runId, resourceId, snapshot, }: {
|
|
37
|
+
persistWorkflowSnapshot({ workflowName, runId, resourceId, snapshot, createdAt, updatedAt, }: {
|
|
23
38
|
workflowName: string;
|
|
24
39
|
runId: string;
|
|
25
40
|
resourceId?: string;
|
|
26
41
|
snapshot: WorkflowRunState;
|
|
42
|
+
createdAt?: Date;
|
|
43
|
+
updatedAt?: Date;
|
|
27
44
|
}): Promise<void>;
|
|
28
45
|
loadWorkflowSnapshot({ workflowName, runId, }: {
|
|
29
46
|
workflowName: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/workflows/index.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,gBAAgB,EAIjB,MAAM,sBAAsB,CAAC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HANGED
|
@@ -1,196 +1,40 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { SaveScorePayload, ScoreRowData, ScoringSource } from '@mastra/core/evals';
|
|
3
|
-
import type { MastraDBMessage, StorageThreadType } from '@mastra/core/memory';
|
|
4
|
-
import type { PaginationInfo, StorageColumn, StorageDomains, StoragePagination, StorageResourceType, TABLE_NAMES, WorkflowRun, WorkflowRuns, SpanRecord, TraceRecord, TracesPaginatedArg, CreateSpanRecord, UpdateSpanRecord, StorageListWorkflowRunsInput, UpdateWorkflowStateOptions } from '@mastra/core/storage';
|
|
1
|
+
import type { StorageDomains } from '@mastra/core/storage';
|
|
5
2
|
import { MastraStorage } from '@mastra/core/storage';
|
|
6
|
-
import
|
|
3
|
+
import { MongoDBAgentsStorage } from './domains/agents/index.js';
|
|
4
|
+
import { MemoryStorageMongoDB } from './domains/memory/index.js';
|
|
5
|
+
import { ObservabilityMongoDB } from './domains/observability/index.js';
|
|
6
|
+
import { ScoresStorageMongoDB } from './domains/scores/index.js';
|
|
7
|
+
import { WorkflowsStorageMongoDB } from './domains/workflows/index.js';
|
|
7
8
|
import type { MongoDBConfig } from './types.js';
|
|
9
|
+
export { MongoDBAgentsStorage, MemoryStorageMongoDB, ObservabilityMongoDB, ScoresStorageMongoDB, WorkflowsStorageMongoDB, };
|
|
10
|
+
export type { MongoDBDomainConfig } from './db/index.js';
|
|
11
|
+
/**
|
|
12
|
+
* MongoDB storage adapter for Mastra.
|
|
13
|
+
*
|
|
14
|
+
* Access domain-specific storage via `getStore()`:
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* const storage = new MongoDBStore({ id: 'my-store', uri: 'mongodb://...' });
|
|
19
|
+
*
|
|
20
|
+
* // Access memory domain
|
|
21
|
+
* const memory = await storage.getStore('memory');
|
|
22
|
+
* await memory?.saveThread({ thread });
|
|
23
|
+
*
|
|
24
|
+
* // Access workflows domain
|
|
25
|
+
* const workflows = await storage.getStore('workflows');
|
|
26
|
+
* await workflows?.persistWorkflowSnapshot({ workflowName, runId, snapshot });
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
8
29
|
export declare class MongoDBStore extends MastraStorage {
|
|
9
30
|
#private;
|
|
10
31
|
stores: StorageDomains;
|
|
11
|
-
get supports(): {
|
|
12
|
-
selectByIncludeResourceScope: boolean;
|
|
13
|
-
resourceWorkingMemory: boolean;
|
|
14
|
-
hasColumn: boolean;
|
|
15
|
-
createTable: boolean;
|
|
16
|
-
deleteMessages: boolean;
|
|
17
|
-
listScoresBySpan: boolean;
|
|
18
|
-
};
|
|
19
32
|
constructor(config: MongoDBConfig);
|
|
20
|
-
createTable({ tableName, schema, }: {
|
|
21
|
-
tableName: TABLE_NAMES;
|
|
22
|
-
schema: Record<string, StorageColumn>;
|
|
23
|
-
}): Promise<void>;
|
|
24
|
-
alterTable(_args: {
|
|
25
|
-
tableName: TABLE_NAMES;
|
|
26
|
-
schema: Record<string, StorageColumn>;
|
|
27
|
-
ifNotExists: string[];
|
|
28
|
-
}): Promise<void>;
|
|
29
|
-
dropTable({ tableName }: {
|
|
30
|
-
tableName: TABLE_NAMES;
|
|
31
|
-
}): Promise<void>;
|
|
32
|
-
clearTable({ tableName }: {
|
|
33
|
-
tableName: TABLE_NAMES;
|
|
34
|
-
}): Promise<void>;
|
|
35
|
-
insert({ tableName, record }: {
|
|
36
|
-
tableName: TABLE_NAMES;
|
|
37
|
-
record: Record<string, any>;
|
|
38
|
-
}): Promise<void>;
|
|
39
|
-
batchInsert({ tableName, records }: {
|
|
40
|
-
tableName: TABLE_NAMES;
|
|
41
|
-
records: Record<string, any>[];
|
|
42
|
-
}): Promise<void>;
|
|
43
|
-
load<R>({ tableName, keys }: {
|
|
44
|
-
tableName: TABLE_NAMES;
|
|
45
|
-
keys: Record<string, string>;
|
|
46
|
-
}): Promise<R | null>;
|
|
47
|
-
getThreadById({ threadId }: {
|
|
48
|
-
threadId: string;
|
|
49
|
-
}): Promise<StorageThreadType | null>;
|
|
50
|
-
saveThread({ thread }: {
|
|
51
|
-
thread: StorageThreadType;
|
|
52
|
-
}): Promise<StorageThreadType>;
|
|
53
|
-
updateThread({ id, title, metadata, }: {
|
|
54
|
-
id: string;
|
|
55
|
-
title: string;
|
|
56
|
-
metadata: Record<string, unknown>;
|
|
57
|
-
}): Promise<StorageThreadType>;
|
|
58
|
-
deleteThread({ threadId }: {
|
|
59
|
-
threadId: string;
|
|
60
|
-
}): Promise<void>;
|
|
61
|
-
listMessagesById({ messageIds }: {
|
|
62
|
-
messageIds: string[];
|
|
63
|
-
}): Promise<{
|
|
64
|
-
messages: MastraDBMessage[];
|
|
65
|
-
}>;
|
|
66
|
-
saveMessages(args: {
|
|
67
|
-
messages: MastraDBMessage[];
|
|
68
|
-
}): Promise<{
|
|
69
|
-
messages: MastraDBMessage[];
|
|
70
|
-
}>;
|
|
71
|
-
updateMessages(_args: {
|
|
72
|
-
messages: (Partial<Omit<MastraDBMessage, 'createdAt'>> & {
|
|
73
|
-
id: string;
|
|
74
|
-
content?: {
|
|
75
|
-
metadata?: MastraMessageContentV2['metadata'];
|
|
76
|
-
content?: MastraMessageContentV2['content'];
|
|
77
|
-
};
|
|
78
|
-
})[];
|
|
79
|
-
}): Promise<MastraDBMessage[]>;
|
|
80
|
-
listWorkflowRuns(args?: StorageListWorkflowRunsInput): Promise<WorkflowRuns>;
|
|
81
|
-
updateWorkflowResults({ workflowName, runId, stepId, result, requestContext, }: {
|
|
82
|
-
workflowName: string;
|
|
83
|
-
runId: string;
|
|
84
|
-
stepId: string;
|
|
85
|
-
result: StepResult<any, any, any, any>;
|
|
86
|
-
requestContext: Record<string, any>;
|
|
87
|
-
}): Promise<Record<string, StepResult<any, any, any, any>>>;
|
|
88
|
-
updateWorkflowState({ workflowName, runId, opts, }: {
|
|
89
|
-
workflowName: string;
|
|
90
|
-
runId: string;
|
|
91
|
-
opts: UpdateWorkflowStateOptions;
|
|
92
|
-
}): Promise<WorkflowRunState | undefined>;
|
|
93
|
-
persistWorkflowSnapshot({ workflowName, runId, resourceId, snapshot, }: {
|
|
94
|
-
workflowName: string;
|
|
95
|
-
runId: string;
|
|
96
|
-
resourceId?: string;
|
|
97
|
-
snapshot: WorkflowRunState;
|
|
98
|
-
}): Promise<void>;
|
|
99
|
-
loadWorkflowSnapshot({ workflowName, runId, }: {
|
|
100
|
-
workflowName: string;
|
|
101
|
-
runId: string;
|
|
102
|
-
}): Promise<WorkflowRunState | null>;
|
|
103
|
-
getWorkflowRunById({ runId, workflowName, }: {
|
|
104
|
-
runId: string;
|
|
105
|
-
workflowName?: string;
|
|
106
|
-
}): Promise<WorkflowRun | null>;
|
|
107
|
-
deleteWorkflowRunById({ runId, workflowName }: {
|
|
108
|
-
runId: string;
|
|
109
|
-
workflowName: string;
|
|
110
|
-
}): Promise<void>;
|
|
111
|
-
close(): Promise<void>;
|
|
112
|
-
/**
|
|
113
|
-
* SCORERS
|
|
114
|
-
*/
|
|
115
|
-
getScoreById({ id }: {
|
|
116
|
-
id: string;
|
|
117
|
-
}): Promise<ScoreRowData | null>;
|
|
118
|
-
saveScore(score: SaveScorePayload): Promise<{
|
|
119
|
-
score: ScoreRowData;
|
|
120
|
-
}>;
|
|
121
|
-
listScoresByRunId({ runId, pagination, }: {
|
|
122
|
-
runId: string;
|
|
123
|
-
pagination: StoragePagination;
|
|
124
|
-
}): Promise<{
|
|
125
|
-
pagination: PaginationInfo;
|
|
126
|
-
scores: ScoreRowData[];
|
|
127
|
-
}>;
|
|
128
|
-
listScoresByEntityId({ entityId, entityType, pagination, }: {
|
|
129
|
-
pagination: StoragePagination;
|
|
130
|
-
entityId: string;
|
|
131
|
-
entityType: string;
|
|
132
|
-
}): Promise<{
|
|
133
|
-
pagination: PaginationInfo;
|
|
134
|
-
scores: ScoreRowData[];
|
|
135
|
-
}>;
|
|
136
|
-
listScoresByScorerId({ scorerId, pagination, entityId, entityType, source, }: {
|
|
137
|
-
scorerId: string;
|
|
138
|
-
pagination: StoragePagination;
|
|
139
|
-
entityId?: string;
|
|
140
|
-
entityType?: string;
|
|
141
|
-
source?: ScoringSource;
|
|
142
|
-
}): Promise<{
|
|
143
|
-
pagination: PaginationInfo;
|
|
144
|
-
scores: ScoreRowData[];
|
|
145
|
-
}>;
|
|
146
|
-
listScoresBySpan({ traceId, spanId, pagination, }: {
|
|
147
|
-
traceId: string;
|
|
148
|
-
spanId: string;
|
|
149
|
-
pagination: StoragePagination;
|
|
150
|
-
}): Promise<{
|
|
151
|
-
pagination: PaginationInfo;
|
|
152
|
-
scores: ScoreRowData[];
|
|
153
|
-
}>;
|
|
154
33
|
/**
|
|
155
|
-
*
|
|
34
|
+
* Closes the MongoDB client connection.
|
|
35
|
+
*
|
|
36
|
+
* This will close the MongoDB client, including pre-configured clients.
|
|
156
37
|
*/
|
|
157
|
-
|
|
158
|
-
resourceId: string;
|
|
159
|
-
}): Promise<StorageResourceType | null>;
|
|
160
|
-
saveResource({ resource }: {
|
|
161
|
-
resource: StorageResourceType;
|
|
162
|
-
}): Promise<StorageResourceType>;
|
|
163
|
-
updateResource({ resourceId, workingMemory, metadata, }: {
|
|
164
|
-
resourceId: string;
|
|
165
|
-
workingMemory?: string;
|
|
166
|
-
metadata?: Record<string, unknown>;
|
|
167
|
-
}): Promise<StorageResourceType>;
|
|
168
|
-
/**
|
|
169
|
-
* Tracing/Observability
|
|
170
|
-
*/
|
|
171
|
-
createSpan(span: CreateSpanRecord): Promise<void>;
|
|
172
|
-
updateSpan({ spanId, traceId, updates, }: {
|
|
173
|
-
spanId: string;
|
|
174
|
-
traceId: string;
|
|
175
|
-
updates: Partial<UpdateSpanRecord>;
|
|
176
|
-
}): Promise<void>;
|
|
177
|
-
getTrace(traceId: string): Promise<TraceRecord | null>;
|
|
178
|
-
getTracesPaginated(args: TracesPaginatedArg): Promise<{
|
|
179
|
-
pagination: PaginationInfo;
|
|
180
|
-
spans: SpanRecord[];
|
|
181
|
-
}>;
|
|
182
|
-
batchCreateSpans(args: {
|
|
183
|
-
records: CreateSpanRecord[];
|
|
184
|
-
}): Promise<void>;
|
|
185
|
-
batchUpdateSpans(args: {
|
|
186
|
-
records: {
|
|
187
|
-
traceId: string;
|
|
188
|
-
spanId: string;
|
|
189
|
-
updates: Partial<UpdateSpanRecord>;
|
|
190
|
-
}[];
|
|
191
|
-
}): Promise<void>;
|
|
192
|
-
batchDeleteTraces(args: {
|
|
193
|
-
traceIds: string[];
|
|
194
|
-
}): Promise<void>;
|
|
38
|
+
close(): Promise<void>;
|
|
195
39
|
}
|
|
196
40
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/storage/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/storage/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAwB,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAG3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAG7C,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,uBAAuB,GACxB,CAAC;AACF,YAAY,EAAE,mBAAmB,EAAE,MAAM,MAAM,CAAC;AAEhD;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,YAAa,SAAQ,aAAa;;IAG7C,MAAM,EAAE,cAAc,CAAC;gBAEX,MAAM,EAAE,aAAa;IA8BjC;;;;OAIG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAc7B"}
|