@mastra/cloudflare 0.0.0-update-stores-peerDeps-20250723031338 → 0.0.0-usechat-duplicate-20251016110554

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.
@@ -0,0 +1,107 @@
1
+ import type { MastraMessageContentV2 } from '@mastra/core/agent';
2
+ import type { MastraMessageV1, MastraMessageV2, StorageThreadType } from '@mastra/core/memory';
3
+ import type { PaginationInfo, StorageGetMessagesArg, StorageResourceType } from '@mastra/core/storage';
4
+ import { MemoryStorage } from '@mastra/core/storage';
5
+ import type { StoreOperationsCloudflare } from '../operations/index.js';
6
+ export declare class MemoryStorageCloudflare extends MemoryStorage {
7
+ operations: StoreOperationsCloudflare;
8
+ constructor({ operations }: {
9
+ operations: StoreOperationsCloudflare;
10
+ });
11
+ private ensureMetadata;
12
+ getThreadById({ threadId }: {
13
+ threadId: string;
14
+ }): Promise<StorageThreadType | null>;
15
+ getThreadsByResourceId({ resourceId }: {
16
+ resourceId: string;
17
+ }): Promise<StorageThreadType[]>;
18
+ getThreadsByResourceIdPaginated(args: {
19
+ resourceId: string;
20
+ page?: number;
21
+ perPage?: number;
22
+ }): Promise<PaginationInfo & {
23
+ threads: StorageThreadType[];
24
+ }>;
25
+ saveThread({ thread }: {
26
+ thread: StorageThreadType;
27
+ }): Promise<StorageThreadType>;
28
+ updateThread({ id, title, metadata, }: {
29
+ id: string;
30
+ title: string;
31
+ metadata: Record<string, unknown>;
32
+ }): Promise<StorageThreadType>;
33
+ private getMessageKey;
34
+ private getThreadMessagesKey;
35
+ deleteThread({ threadId }: {
36
+ threadId: string;
37
+ }): Promise<void>;
38
+ private findMessageInAnyThread;
39
+ /**
40
+ * Queue for serializing sorted order updates.
41
+ * Updates the sorted order for a given key. This operation is eventually consistent.
42
+ */
43
+ private updateQueue;
44
+ private updateSorting;
45
+ /**
46
+ * Updates the sorted order for a given key. This operation is eventually consistent.
47
+ * Note: Operations on the same orderKey are serialized using a queue to prevent
48
+ * concurrent updates from conflicting with each other.
49
+ */
50
+ private updateSortedMessages;
51
+ private getSortedMessages;
52
+ private migrateMessage;
53
+ saveMessages(args: {
54
+ messages: MastraMessageV1[];
55
+ format?: undefined | 'v1';
56
+ }): Promise<MastraMessageV1[]>;
57
+ saveMessages(args: {
58
+ messages: MastraMessageV2[];
59
+ format: 'v2';
60
+ }): Promise<MastraMessageV2[]>;
61
+ private getRank;
62
+ private getRange;
63
+ private getLastN;
64
+ private getFullOrder;
65
+ private getIncludedMessagesWithContext;
66
+ private getRecentMessages;
67
+ private fetchAndParseMessagesFromMultipleThreads;
68
+ getMessages(args: StorageGetMessagesArg & {
69
+ format?: 'v1';
70
+ }): Promise<MastraMessageV1[]>;
71
+ getMessages(args: StorageGetMessagesArg & {
72
+ format: 'v2';
73
+ }): Promise<MastraMessageV2[]>;
74
+ getMessagesById({ messageIds, format, }: {
75
+ messageIds: string[];
76
+ format: 'v1';
77
+ }): Promise<MastraMessageV1[]>;
78
+ getMessagesById({ messageIds, format, }: {
79
+ messageIds: string[];
80
+ format?: 'v2';
81
+ }): Promise<MastraMessageV2[]>;
82
+ getMessagesPaginated(args: StorageGetMessagesArg): Promise<PaginationInfo & {
83
+ messages: MastraMessageV1[] | MastraMessageV2[];
84
+ }>;
85
+ updateMessages(args: {
86
+ messages: (Partial<Omit<MastraMessageV2, 'createdAt'>> & {
87
+ id: string;
88
+ threadId?: string;
89
+ content?: {
90
+ metadata?: MastraMessageContentV2['metadata'];
91
+ content?: MastraMessageContentV2['content'];
92
+ };
93
+ })[];
94
+ }): Promise<MastraMessageV2[]>;
95
+ getResourceById({ resourceId }: {
96
+ resourceId: string;
97
+ }): Promise<StorageResourceType | null>;
98
+ saveResource({ resource }: {
99
+ resource: StorageResourceType;
100
+ }): Promise<StorageResourceType>;
101
+ updateResource({ resourceId, workingMemory, metadata, }: {
102
+ resourceId: string;
103
+ workingMemory?: string;
104
+ metadata?: Record<string, unknown>;
105
+ }): Promise<StorageResourceType>;
106
+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;KACpC,GAAG,OAAO,CAAC,mBAAmB,CAAC;CA4BjC"}
@@ -0,0 +1,83 @@
1
+ import type { KVNamespace } from '@cloudflare/workers-types';
2
+ import { StoreOperations } from '@mastra/core/storage';
3
+ import type { StorageColumn, TABLE_NAMES } from '@mastra/core/storage';
4
+ import type Cloudflare from 'cloudflare';
5
+ import type { ListOptions, RecordTypes } from '../../types.js';
6
+ export declare class StoreOperationsCloudflare extends StoreOperations {
7
+ private bindings?;
8
+ client?: Cloudflare;
9
+ accountId?: string;
10
+ namespacePrefix: string;
11
+ constructor({ namespacePrefix, bindings, client, accountId, }: {
12
+ bindings?: Record<TABLE_NAMES, KVNamespace>;
13
+ namespacePrefix: string;
14
+ client?: Cloudflare;
15
+ accountId?: string;
16
+ });
17
+ hasColumn(): Promise<boolean>;
18
+ alterTable(_args: {
19
+ tableName: TABLE_NAMES;
20
+ schema: Record<string, StorageColumn>;
21
+ ifNotExists: string[];
22
+ }): Promise<void>;
23
+ clearTable({ tableName }: {
24
+ tableName: TABLE_NAMES;
25
+ }): Promise<void>;
26
+ dropTable({ tableName }: {
27
+ tableName: TABLE_NAMES;
28
+ }): Promise<void>;
29
+ private getBinding;
30
+ getKey<T extends TABLE_NAMES>(tableName: T, record: Record<string, string>): string;
31
+ private getSchemaKey;
32
+ /**
33
+ * Helper to safely parse data from KV storage
34
+ */
35
+ private safeParse;
36
+ private createNamespaceById;
37
+ private createNamespace;
38
+ private listNamespaces;
39
+ private getNamespaceIdByName;
40
+ private getOrCreateNamespaceId;
41
+ private getNamespaceId;
42
+ private getNamespaceValue;
43
+ getKV(tableName: TABLE_NAMES, key: string): Promise<any>;
44
+ private getTableSchema;
45
+ private validateColumnValue;
46
+ private validateAgainstSchema;
47
+ private validateRecord;
48
+ insert({ tableName, record }: {
49
+ tableName: TABLE_NAMES;
50
+ record: Record<string, any>;
51
+ }): Promise<void>;
52
+ private ensureMetadata;
53
+ load<R>({ tableName, keys }: {
54
+ tableName: TABLE_NAMES;
55
+ keys: Record<string, string>;
56
+ }): Promise<R | null>;
57
+ batchInsert<T extends TABLE_NAMES>(input: {
58
+ tableName: T;
59
+ records: Partial<RecordTypes[T]>[];
60
+ }): Promise<void>;
61
+ /**
62
+ * Helper to safely serialize data for KV storage
63
+ */
64
+ private safeSerialize;
65
+ private putNamespaceValue;
66
+ putKV({ tableName, key, value, metadata, }: {
67
+ tableName: TABLE_NAMES;
68
+ key: string;
69
+ value: any;
70
+ metadata?: any;
71
+ }): Promise<void>;
72
+ createTable({ tableName, schema, }: {
73
+ tableName: TABLE_NAMES;
74
+ schema: Record<string, StorageColumn>;
75
+ }): Promise<void>;
76
+ listNamespaceKeys(tableName: TABLE_NAMES, options?: ListOptions): Promise<import("@cloudflare/workers-types").KVNamespaceListKey<unknown, string>[]>;
77
+ private deleteNamespaceValue;
78
+ deleteKV(tableName: TABLE_NAMES, key: string): Promise<void>;
79
+ listKV(tableName: TABLE_NAMES, options?: ListOptions): Promise<Array<{
80
+ name: string;
81
+ }>>;
82
+ }
83
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/operations/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAE7D,OAAO,EAGL,eAAe,EAOhB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,KAAK,UAAU,MAAM,YAAY,CAAC;AACzC,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE5D,qBAAa,yBAA0B,SAAQ,eAAe;IAC5D,OAAO,CAAC,QAAQ,CAAC,CAAmC;IACpD,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;gBACZ,EACV,eA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,CAAC,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAQ9F"}
@@ -0,0 +1,50 @@
1
+ import type { ScoreRowData, ScoringSource } from '@mastra/core/scores';
2
+ import { ScoresStorage } from '@mastra/core/storage';
3
+ import type { StoragePagination, PaginationInfo } from '@mastra/core/storage';
4
+ import type { StoreOperationsCloudflare } from '../operations/index.js';
5
+ export declare class ScoresStorageCloudflare extends ScoresStorage {
6
+ private operations;
7
+ constructor({ operations }: {
8
+ operations: StoreOperationsCloudflare;
9
+ });
10
+ getScoreById({ id }: {
11
+ id: string;
12
+ }): Promise<ScoreRowData | null>;
13
+ saveScore(score: Omit<ScoreRowData, 'createdAt' | 'updatedAt'>): Promise<{
14
+ score: ScoreRowData;
15
+ }>;
16
+ getScoresByScorerId({ scorerId, entityId, entityType, source, pagination, }: {
17
+ scorerId: string;
18
+ entityId?: string;
19
+ entityType?: string;
20
+ source?: ScoringSource;
21
+ pagination: StoragePagination;
22
+ }): Promise<{
23
+ pagination: PaginationInfo;
24
+ scores: ScoreRowData[];
25
+ }>;
26
+ getScoresByRunId({ runId, pagination, }: {
27
+ runId: string;
28
+ pagination: StoragePagination;
29
+ }): Promise<{
30
+ pagination: PaginationInfo;
31
+ scores: ScoreRowData[];
32
+ }>;
33
+ getScoresByEntityId({ entityId, entityType, pagination, }: {
34
+ pagination: StoragePagination;
35
+ entityId: string;
36
+ entityType: string;
37
+ }): Promise<{
38
+ pagination: PaginationInfo;
39
+ scores: ScoreRowData[];
40
+ }>;
41
+ getScoresBySpan({ traceId, spanId, pagination, }: {
42
+ traceId: string;
43
+ spanId: string;
44
+ pagination: StoragePagination;
45
+ }): Promise<{
46
+ pagination: PaginationInfo;
47
+ scores: ScoreRowData[];
48
+ }>;
49
+ }
50
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/scores/index.ts"],"names":[],"mapp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AE,CAAC;IAiD7D,mBAAmB,CAAC,EACxB,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;QAAE,UAAU,EAAE,cAAc,CAAC;QAAC,MAAM,EAAE,YAAY,EAAE,CAAA;KAAE,CAAC;IAiD7D,eAAe,CAAC,EACpB,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;QAAE,UAAU,EAAE,cAAc,CAAC;QAAC,MAAM,EAAE,YAAY,EAAE,CAAA;KAAE,CAAC;CA6CpE"}
@@ -0,0 +1,18 @@
1
+ import { TracesStorage } from '@mastra/core/storage';
2
+ import type { StorageGetTracesArg, StorageGetTracesPaginatedArg, PaginationInfo } from '@mastra/core/storage';
3
+ import type { Trace } from '@mastra/core/telemetry';
4
+ import type { StoreOperationsCloudflare } from '../operations/index.js';
5
+ export declare class TracesStorageCloudflare extends TracesStorage {
6
+ private operations;
7
+ constructor({ operations }: {
8
+ operations: StoreOperationsCloudflare;
9
+ });
10
+ getTraces(args: StorageGetTracesArg): Promise<Trace[]>;
11
+ getTracesPaginated(args: StorageGetTracesPaginatedArg): Promise<PaginationInfo & {
12
+ traces: Trace[];
13
+ }>;
14
+ batchTraceInsert({ records }: {
15
+ records: Record<string, any>[];
16
+ }): Promise<void>;
17
+ }
18
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/traces/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAgB,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,KAAK,EAAE,mBAAmB,EAAE,4BAA4B,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC9G,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAE/D,qBAAa,uBAAwB,SAAQ,aAAa;IACxD,OAAO,CAAC,UAAU,CAA4B;gBAElC,EAAE,UAAU,EAAE,EAAE;QAAE,UAAU,EAAE,yBAAyB,CAAA;KAAE;IAK/D,SAAS,CAAC,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;IAsCtD,kBAAkB,CAAC,IAAI,EAAE,4BAA4B,GAAG,OAAO,CAAC,cAAc,GAAG;QAAE,MAAM,EAAE,KAAK,EAAE,CAAA;KAAE,CAAC;IA+FrG,gBAAgB,CAAC,EAAE,OAAO,EAAE,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAOvF"}
@@ -0,0 +1,54 @@
1
+ import { WorkflowsStorage } from '@mastra/core/storage';
2
+ import type { WorkflowRun, WorkflowRuns } from '@mastra/core/storage';
3
+ import type { StepResult, WorkflowRunState } from '@mastra/core/workflows';
4
+ import type { StoreOperationsCloudflare } from '../operations/index.js';
5
+ export declare class WorkflowsStorageCloudflare extends WorkflowsStorage {
6
+ private operations;
7
+ constructor({ operations }: {
8
+ operations: StoreOperationsCloudflare;
9
+ });
10
+ private validateWorkflowParams;
11
+ updateWorkflowResults({}: {
12
+ workflowName: string;
13
+ runId: string;
14
+ stepId: string;
15
+ result: StepResult<any, any, any, any>;
16
+ runtimeContext: Record<string, any>;
17
+ }): Promise<Record<string, StepResult<any, any, any, any>>>;
18
+ updateWorkflowState({}: {
19
+ workflowName: string;
20
+ runId: string;
21
+ opts: {
22
+ status: string;
23
+ result?: StepResult<any, any, any, any>;
24
+ error?: string;
25
+ suspendedPaths?: Record<string, number[]>;
26
+ waitingPaths?: Record<string, number[]>;
27
+ };
28
+ }): Promise<WorkflowRunState | undefined>;
29
+ persistWorkflowSnapshot(params: {
30
+ workflowName: string;
31
+ runId: string;
32
+ resourceId?: string;
33
+ snapshot: WorkflowRunState;
34
+ }): Promise<void>;
35
+ loadWorkflowSnapshot(params: {
36
+ workflowName: string;
37
+ runId: string;
38
+ }): Promise<WorkflowRunState | null>;
39
+ private parseWorkflowRun;
40
+ private buildWorkflowSnapshotPrefix;
41
+ getWorkflowRuns({ workflowName, limit, offset, resourceId, fromDate, toDate, }?: {
42
+ workflowName?: string;
43
+ limit?: number;
44
+ offset?: number;
45
+ resourceId?: string;
46
+ fromDate?: Date;
47
+ toDate?: Date;
48
+ }): Promise<WorkflowRuns>;
49
+ getWorkflowRunById({ runId, workflowName, }: {
50
+ runId: string;
51
+ workflowName: string;
52
+ }): Promise<WorkflowRun | null>;
53
+ }
54
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/workflows/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAuC,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7F,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACtE,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC3E,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAE/D,qBAAa,0BAA2B,SAAQ,gBAAgB;IAC9D,OAAO,CAAC,UAAU,CAA4B;gBAElC,EAAE,UAAU,EAAE,EAAE;QAAE,UAAU,EAAE,yBAAyB,CAAA;KAAE;IAKrE,OAAO,CAAC,sBAAsB;IAO9B,qBAAqB,CACnB,EAMC,EAAE;QACD,YAAY,EAAE,MAAM,CAAC;QACrB,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;Q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QACD,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,QAAQ,CAAC,EAAE,IAAI,CAAC;QAChB,MAAM,CAAC,EAAE,IAAI,CAAC;KACV,GAAG,OAAO,CAAC,YAAY,CAAC;IAsExB,kBAAkB,CAAC,EACvB,KAAK,EACL,YAAY,GACb,EAAE;QACD,KAAK,EAAE,MAAM,CAAC;QACd,YAAY,EAAE,MAAM,CAAC;KACtB,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;CA4ChC"}
@@ -0,0 +1,228 @@
1
+ import type { MastraMessageContentV2 } from '@mastra/core/agent';
2
+ import type { StorageThreadType, MastraMessageV1, MastraMessageV2 } from '@mastra/core/memory';
3
+ import type { ScoreRowData, ScoringSource } from '@mastra/core/scores';
4
+ import { MastraStorage } from '@mastra/core/storage';
5
+ import type { TABLE_NAMES, StorageColumn, StorageGetMessagesArg, EvalRow, WorkflowRuns, WorkflowRun, StorageGetTracesPaginatedArg, PaginationInfo, StoragePagination, PaginationArgs, StorageDomains, StorageResourceType } from '@mastra/core/storage';
6
+ import type { Trace } from '@mastra/core/telemetry';
7
+ import type { StepResult, WorkflowRunState } from '@mastra/core/workflows';
8
+ import type { CloudflareStoreConfig, RecordTypes } from './types.js';
9
+ export declare class CloudflareStore extends MastraStorage {
10
+ stores: StorageDomains;
11
+ private client?;
12
+ private accountId?;
13
+ private namespacePrefix;
14
+ private bindings?;
15
+ private validateWorkersConfig;
16
+ private validateRestConfig;
17
+ get supports(): {
18
+ selectByIncludeResourceScope: boolean;
19
+ resourceWorkingMemory: boolean;
20
+ hasColumn: boolean;
21
+ createTable: boolean;
22
+ deleteMessages: boolean;
23
+ aiTracing?: boolean;
24
+ indexManagement?: boolean;
25
+ getScoresBySpan?: boolean;
26
+ };
27
+ constructor(config: CloudflareStoreConfig);
28
+ createTable({ tableName, schema, }: {
29
+ tableName: TABLE_NAMES;
30
+ schema: Record<string, StorageColumn>;
31
+ }): Promise<void>;
32
+ alterTable(_args: {
33
+ tableName: TABLE_NAMES;
34
+ schema: Record<string, StorageColumn>;
35
+ ifNotExists: string[];
36
+ }): Promise<void>;
37
+ clearTable({ tableName }: {
38
+ tableName: TABLE_NAMES;
39
+ }): Promise<void>;
40
+ dropTable({ tableName }: {
41
+ tableName: TABLE_NAMES;
42
+ }): Promise<void>;
43
+ insert<T extends TABLE_NAMES>({ tableName, record, }: {
44
+ tableName: T;
45
+ record: Record<string, any>;
46
+ }): Promise<void>;
47
+ load<R>({ tableName, keys }: {
48
+ tableName: TABLE_NAMES;
49
+ keys: Record<string, string>;
50
+ }): Promise<R | null>;
51
+ getThreadById({ threadId }: {
52
+ threadId: string;
53
+ }): Promise<StorageThreadType | null>;
54
+ getThreadsByResourceId({ resourceId }: {
55
+ resourceId: string;
56
+ }): Promise<StorageThreadType[]>;
57
+ saveThread({ thread }: {
58
+ thread: StorageThreadType;
59
+ }): Promise<StorageThreadType>;
60
+ updateThread({ id, title, metadata, }: {
61
+ id: string;
62
+ title: string;
63
+ metadata: Record<string, unknown>;
64
+ }): Promise<StorageThreadType>;
65
+ deleteThread({ threadId }: {
66
+ threadId: string;
67
+ }): Promise<void>;
68
+ saveMessages(args: {
69
+ messages: MastraMessageV1[];
70
+ format?: undefined | 'v1';
71
+ }): Promise<MastraMessageV1[]>;
72
+ saveMessages(args: {
73
+ messages: MastraMessageV2[];
74
+ format: 'v2';
75
+ }): Promise<MastraMessageV2[]>;
76
+ getMessages(args: StorageGetMessagesArg & {
77
+ format?: 'v1';
78
+ }): Promise<MastraMessageV1[]>;
79
+ getMessages(args: StorageGetMessagesArg & {
80
+ format: 'v2';
81
+ }): Promise<MastraMessageV2[]>;
82
+ updateWorkflowResults({ workflowName, runId, stepId, result, runtimeContext, }: {
83
+ workflowName: string;
84
+ runId: string;
85
+ stepId: string;
86
+ result: StepResult<any, any, any, any>;
87
+ runtimeContext: Record<string, any>;
88
+ }): Promise<Record<string, StepResult<any, any, any, any>>>;
89
+ updateWorkflowState({ workflowName, runId, opts, }: {
90
+ workflowName: string;
91
+ runId: string;
92
+ opts: {
93
+ status: string;
94
+ result?: StepResult<any, any, any, any>;
95
+ error?: string;
96
+ suspendedPaths?: Record<string, number[]>;
97
+ waitingPaths?: Record<string, number[]>;
98
+ };
99
+ }): Promise<WorkflowRunState | undefined>;
100
+ getMessagesById({ messageIds, format }: {
101
+ messageIds: string[];
102
+ format: 'v1';
103
+ }): Promise<MastraMessageV1[]>;
104
+ getMessagesById({ messageIds, format }: {
105
+ messageIds: string[];
106
+ format?: 'v2';
107
+ }): Promise<MastraMessageV2[]>;
108
+ persistWorkflowSnapshot(params: {
109
+ workflowName: string;
110
+ runId: string;
111
+ resourceId?: string;
112
+ snapshot: WorkflowRunState;
113
+ }): Promise<void>;
114
+ loadWorkflowSnapshot(params: {
115
+ workflowName: string;
116
+ runId: string;
117
+ }): Promise<WorkflowRunState | null>;
118
+ batchInsert<T extends TABLE_NAMES>(input: {
119
+ tableName: T;
120
+ records: Partial<RecordTypes[T]>[];
121
+ }): Promise<void>;
122
+ getTraces({ name, scope, page, perPage, attributes, fromDate, toDate, }: {
123
+ name?: string;
124
+ scope?: string;
125
+ page: number;
126
+ perPage: number;
127
+ attributes?: Record<string, string>;
128
+ fromDate?: Date;
129
+ toDate?: Date;
130
+ }): Promise<any[]>;
131
+ getEvalsByAgentName(agentName: string, type?: 'test' | 'live'): Promise<EvalRow[]>;
132
+ getEvals(options: {
133
+ agentName?: string;
134
+ type?: 'test' | 'live';
135
+ dateRange?: {
136
+ start?: Date;
137
+ end?: Date;
138
+ };
139
+ } & PaginationArgs): Promise<PaginationInfo & {
140
+ evals: EvalRow[];
141
+ }>;
142
+ getWorkflowRuns({ workflowName, limit, offset, resourceId, fromDate, toDate, }?: {
143
+ workflowName?: string;
144
+ limit?: number;
145
+ offset?: number;
146
+ resourceId?: string;
147
+ fromDate?: Date;
148
+ toDate?: Date;
149
+ }): Promise<WorkflowRuns>;
150
+ getWorkflowRunById({ runId, workflowName, }: {
151
+ runId: string;
152
+ workflowName: string;
153
+ }): Promise<WorkflowRun | null>;
154
+ getTracesPaginated(args: StorageGetTracesPaginatedArg): Promise<PaginationInfo & {
155
+ traces: Trace[];
156
+ }>;
157
+ getThreadsByResourceIdPaginated(args: {
158
+ resourceId: string;
159
+ page: number;
160
+ perPage: number;
161
+ }): Promise<PaginationInfo & {
162
+ threads: StorageThreadType[];
163
+ }>;
164
+ getMessagesPaginated(args: StorageGetMessagesArg): Promise<PaginationInfo & {
165
+ messages: MastraMessageV1[] | MastraMessageV2[];
166
+ }>;
167
+ updateMessages(args: {
168
+ messages: Partial<Omit<MastraMessageV2, 'createdAt'>> & {
169
+ id: string;
170
+ content?: {
171
+ metadata?: MastraMessageContentV2['metadata'];
172
+ content?: MastraMessageContentV2['content'];
173
+ };
174
+ }[];
175
+ }): Promise<MastraMessageV2[]>;
176
+ getScoreById({ id }: {
177
+ id: string;
178
+ }): Promise<ScoreRowData | null>;
179
+ saveScore(score: ScoreRowData): Promise<{
180
+ score: ScoreRowData;
181
+ }>;
182
+ getScoresByRunId({ runId, pagination, }: {
183
+ runId: string;
184
+ pagination: StoragePagination;
185
+ }): Promise<{
186
+ pagination: PaginationInfo;
187
+ scores: ScoreRowData[];
188
+ }>;
189
+ getScoresByEntityId({ entityId, entityType, pagination, }: {
190
+ pagination: StoragePagination;
191
+ entityId: string;
192
+ entityType: string;
193
+ }): Promise<{
194
+ pagination: PaginationInfo;
195
+ scores: ScoreRowData[];
196
+ }>;
197
+ getScoresByScorerId({ scorerId, entityId, entityType, source, pagination, }: {
198
+ scorerId: string;
199
+ entityId?: string;
200
+ entityType?: string;
201
+ source?: ScoringSource;
202
+ pagination: StoragePagination;
203
+ }): Promise<{
204
+ pagination: PaginationInfo;
205
+ scores: ScoreRowData[];
206
+ }>;
207
+ getScoresBySpan({ traceId, spanId, pagination, }: {
208
+ traceId: string;
209
+ spanId: string;
210
+ pagination: StoragePagination;
211
+ }): Promise<{
212
+ pagination: PaginationInfo;
213
+ scores: ScoreRowData[];
214
+ }>;
215
+ getResourceById({ resourceId }: {
216
+ resourceId: string;
217
+ }): Promise<StorageResourceType | null>;
218
+ saveResource({ resource }: {
219
+ resource: StorageResourceType;
220
+ }): Promise<StorageResourceType>;
221
+ updateResource({ resourceId, workingMemory, metadata, }: {
222
+ resourceId: string;
223
+ workingMemory?: string;
224
+ metadata?: Record<string, unknown>;
225
+ }): Promise<StorageResourceType>;
226
+ close(): Promise<void>;
227
+ }
228
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/storage/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAEjE,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC/F,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,EACL,aAAa,EAOd,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EACV,WAAW,EACX,aAAa,EACb,qBAAqB,EACrB,OAAO,EACP,YAAY,EACZ,WAAW,EAEX,4BAA4B,EAC5B,cAAc,EACd,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,mBAAmB,EACpB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAS3E,OAAO,KAAK,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAElE,qBAAa,eAAgB,SAAQ,aAAa;IAChD,MAAM,EAAE,cAAc,CAAC;IACvB,OAAO,CAA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AC,EAAE,aAAa,CAAC;QACvB,UAAU,EAAE,iBAAiB,CAAC;KAC/B,GAAG,OAAO,CAAC;QAAE,UAAU,EAAE,cAAc,CAAC;QAAC,MAAM,EAAE,YAAY,EAAE,CAAA;KAAE,CAAC;IAI7D,eAAe,CAAC,EACpB,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;QAAE,UAAU,EAAE,cAAc,CAAC;QAAC,MAAM,EAAE,YAAY,EAAE,CAAA;KAAE,CAAC;IAI7D,eAAe,CAAC,EAAE,UAAU,EAAE,EAAE;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;IAI5F,YAAY,CAAC,EAAE,QAAQ,EAAE,EAAE;QAAE,QAAQ,EAAE,mBAAmB,CAAA;KAAE,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAI3F,cAAc,CAAC,EACnB,UAAU,EACV,aAAa,EACb,QAAQ,GACT,EAAE;QACD,UAAU,EAAE,MAAM,CAAC;QACnB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACpC,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAI1B,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAG7B"}
@@ -0,0 +1,25 @@
1
+ import type { WorkflowRunState } from '@mastra/core/workflows';
2
+ export declare const createSampleTrace: (name: string, scope?: string, attributes?: Record<string, string>) => {
3
+ id: string;
4
+ parentSpanId: string;
5
+ traceId: string;
6
+ name: string;
7
+ scope: string | undefined;
8
+ kind: string;
9
+ status: string;
10
+ events: string;
11
+ links: string;
12
+ attributes: string | undefined;
13
+ startTime: string;
14
+ endTime: string;
15
+ other: string;
16
+ createdAt: string;
17
+ };
18
+ export declare const createSampleWorkflowSnapshot: (threadId: string, status: string, createdAt?: Date) => {
19
+ snapshot: WorkflowRunState;
20
+ runId: string;
21
+ stepId: string;
22
+ };
23
+ export declare const retryUntil: <T>(fn: () => Promise<T>, condition: (result: T) => boolean, timeout?: number, // REST API needs longer timeout due to higher latency
24
+ interval?: number) => Promise<T>;
25
+ //# sourceMappingURL=test-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-utils.d.ts","sourceRoot":"","sources":["../../src/storage/test-utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE/D,eAAO,MAAM,iBAAiB,GAAI,MAAM,MAAM,EAAE,QAAQ,MAAM,EAAE,aAAa,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;;;;;;;;;;;;;;;CAejG,CAAC;AAEH,eAAO,MAAM,4BAA4B,GAAI,UAAU,MAAM,EAAE,QAAQ,MAAM,EAAE,YAAY,IAAI;;;;CA0B9F,CAAC;AAGF,eAAO,MAAM,UAAU,GAAU,CAAC,EAChC,IAAI,MAAM,OAAO,CAAC,CAAC,CAAC,EACpB,WAAW,CAAC,MAAM,EAAE,CAAC,KAAK,OAAO,EACjC,gBAAe,EAAE,sDAAsD;AACvE,iBAAe,KACd,OAAO,CAAC,CAAC,CAYX,CAAC"}