@mastra/mssql 0.0.0-just-snapshot-20251014192224 → 0.0.0-main-test-20251105183450
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 +275 -3
- package/README.md +315 -37
- package/dist/index.cjs +1595 -774
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1596 -775
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/memory/index.d.ts +14 -43
- package/dist/storage/domains/memory/index.d.ts.map +1 -1
- package/dist/storage/domains/observability/index.d.ts +44 -0
- package/dist/storage/domains/observability/index.d.ts.map +1 -0
- package/dist/storage/domains/operations/index.d.ts +67 -4
- package/dist/storage/domains/operations/index.d.ts.map +1 -1
- package/dist/storage/domains/scores/index.d.ts +6 -5
- package/dist/storage/domains/scores/index.d.ts.map +1 -1
- package/dist/storage/domains/utils.d.ts +19 -0
- package/dist/storage/domains/utils.d.ts.map +1 -1
- package/dist/storage/domains/workflows/index.d.ts +7 -12
- package/dist/storage/domains/workflows/index.d.ts.map +1 -1
- package/dist/storage/index.d.ts +63 -82
- package/dist/storage/index.d.ts.map +1 -1
- package/package.json +10 -7
- package/dist/storage/domains/legacy-evals/index.d.ts +0 -20
- package/dist/storage/domains/legacy-evals/index.d.ts.map +0 -1
- package/dist/storage/domains/traces/index.d.ts +0 -37
- package/dist/storage/domains/traces/index.d.ts.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { MastraMessageContentV2 } from '@mastra/core/agent';
|
|
2
|
-
import type {
|
|
2
|
+
import type { MastraDBMessage, StorageThreadType } from '@mastra/core/memory';
|
|
3
3
|
import { MemoryStorage } from '@mastra/core/storage';
|
|
4
|
-
import type {
|
|
4
|
+
import type { StorageResourceType, StorageListMessagesInput, StorageListMessagesOutput, StorageListThreadsByResourceIdInput, StorageListThreadsByResourceIdOutput } from '@mastra/core/storage';
|
|
5
5
|
import sql from 'mssql';
|
|
6
6
|
import type { StoreOperationsMSSQL } from '../operations/index.js';
|
|
7
7
|
export declare class MemoryMSSQL extends MemoryStorage {
|
|
@@ -17,20 +17,10 @@ export declare class MemoryMSSQL extends MemoryStorage {
|
|
|
17
17
|
getThreadById({ threadId }: {
|
|
18
18
|
threadId: string;
|
|
19
19
|
}): Promise<StorageThreadType | null>;
|
|
20
|
-
|
|
21
|
-
resourceId: string;
|
|
22
|
-
} & PaginationArgs & ThreadSortOptions): Promise<PaginationInfo & {
|
|
23
|
-
threads: StorageThreadType[];
|
|
24
|
-
}>;
|
|
20
|
+
listThreadsByResourceId(args: StorageListThreadsByResourceIdInput): Promise<StorageListThreadsByResourceIdOutput>;
|
|
25
21
|
saveThread({ thread }: {
|
|
26
22
|
thread: StorageThreadType;
|
|
27
23
|
}): Promise<StorageThreadType>;
|
|
28
|
-
/**
|
|
29
|
-
* @deprecated use getThreadsByResourceIdPaginated instead
|
|
30
|
-
*/
|
|
31
|
-
getThreadsByResourceId(args: {
|
|
32
|
-
resourceId: string;
|
|
33
|
-
} & ThreadSortOptions): Promise<StorageThreadType[]>;
|
|
34
24
|
/**
|
|
35
25
|
* Updates a thread's title and metadata, merging with existing metadata. Returns the updated thread.
|
|
36
26
|
*/
|
|
@@ -43,45 +33,26 @@ export declare class MemoryMSSQL extends MemoryStorage {
|
|
|
43
33
|
threadId: string;
|
|
44
34
|
}): Promise<void>;
|
|
45
35
|
private _getIncludedMessages;
|
|
46
|
-
|
|
47
|
-
* @deprecated use getMessagesPaginated instead
|
|
48
|
-
*/
|
|
49
|
-
getMessages(args: StorageGetMessagesArg & {
|
|
50
|
-
format?: 'v1';
|
|
51
|
-
}): Promise<MastraMessageV1[]>;
|
|
52
|
-
getMessages(args: StorageGetMessagesArg & {
|
|
53
|
-
format: 'v2';
|
|
54
|
-
}): Promise<MastraMessageV2[]>;
|
|
55
|
-
getMessagesById({ messageIds, format, }: {
|
|
36
|
+
listMessagesById({ messageIds }: {
|
|
56
37
|
messageIds: string[];
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}): Promise<PaginationInfo & {
|
|
66
|
-
messages: MastraMessageV1[] | MastraMessageV2[];
|
|
38
|
+
}): Promise<{
|
|
39
|
+
messages: MastraDBMessage[];
|
|
40
|
+
}>;
|
|
41
|
+
listMessages(args: StorageListMessagesInput): Promise<StorageListMessagesOutput>;
|
|
42
|
+
saveMessages({ messages }: {
|
|
43
|
+
messages: MastraDBMessage[];
|
|
44
|
+
}): Promise<{
|
|
45
|
+
messages: MastraDBMessage[];
|
|
67
46
|
}>;
|
|
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
47
|
updateMessages({ messages, }: {
|
|
77
|
-
messages: (Partial<Omit<
|
|
48
|
+
messages: (Partial<Omit<MastraDBMessage, 'createdAt'>> & {
|
|
78
49
|
id: string;
|
|
79
50
|
content?: {
|
|
80
51
|
metadata?: MastraMessageContentV2['metadata'];
|
|
81
52
|
content?: MastraMessageContentV2['content'];
|
|
82
53
|
};
|
|
83
54
|
})[];
|
|
84
|
-
}): Promise<
|
|
55
|
+
}): Promise<MastraDBMessage[]>;
|
|
85
56
|
deleteMessages(messageIds: string[]): Promise<void>;
|
|
86
57
|
getResourceById({ resourceId }: {
|
|
87
58
|
resourceId: string;
|
|
@@ -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,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,CAAC,EAAE,QAAQ,EAAE,EAAE;QAAE,QAAQ,EAAE,mBAAmB,CAAA;KAAE,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAY3F,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;CA8DjC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { TracingStorageStrategy } from '@mastra/core/observability';
|
|
2
|
+
import { ObservabilityStorage } from '@mastra/core/storage';
|
|
3
|
+
import type { SpanRecord, AITraceRecord, AITracesPaginatedArg, CreateSpanRecord, PaginationInfo, UpdateSpanRecord } from '@mastra/core/storage';
|
|
4
|
+
import type { ConnectionPool } from 'mssql';
|
|
5
|
+
import type { StoreOperationsMSSQL } from '../operations/index.js';
|
|
6
|
+
export declare class ObservabilityMSSQL extends ObservabilityStorage {
|
|
7
|
+
pool: ConnectionPool;
|
|
8
|
+
private operations;
|
|
9
|
+
private schema?;
|
|
10
|
+
constructor({ pool, operations, schema, }: {
|
|
11
|
+
pool: ConnectionPool;
|
|
12
|
+
operations: StoreOperationsMSSQL;
|
|
13
|
+
schema?: string;
|
|
14
|
+
});
|
|
15
|
+
get tracingStrategy(): {
|
|
16
|
+
preferred: TracingStorageStrategy;
|
|
17
|
+
supported: TracingStorageStrategy[];
|
|
18
|
+
};
|
|
19
|
+
createSpan(span: CreateSpanRecord): Promise<void>;
|
|
20
|
+
getAITrace(traceId: string): Promise<AITraceRecord | null>;
|
|
21
|
+
updateSpan({ spanId, traceId, updates, }: {
|
|
22
|
+
spanId: string;
|
|
23
|
+
traceId: string;
|
|
24
|
+
updates: Partial<UpdateSpanRecord>;
|
|
25
|
+
}): Promise<void>;
|
|
26
|
+
getAITracesPaginated({ filters, pagination, }: AITracesPaginatedArg): Promise<{
|
|
27
|
+
pagination: PaginationInfo;
|
|
28
|
+
spans: SpanRecord[];
|
|
29
|
+
}>;
|
|
30
|
+
batchCreateSpans(args: {
|
|
31
|
+
records: CreateSpanRecord[];
|
|
32
|
+
}): Promise<void>;
|
|
33
|
+
batchUpdateSpans(args: {
|
|
34
|
+
records: {
|
|
35
|
+
traceId: string;
|
|
36
|
+
spanId: string;
|
|
37
|
+
updates: Partial<UpdateSpanRecord>;
|
|
38
|
+
}[];
|
|
39
|
+
}): Promise<void>;
|
|
40
|
+
batchDeleteAITraces(args: {
|
|
41
|
+
traceIds: string[];
|
|
42
|
+
}): Promise<void>;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/observability/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,EAAkB,oBAAoB,EAAkB,MAAM,sBAAsB,CAAC;AAC5F,OAAO,KAAK,EACV,UAAU,EACV,aAAa,EACb,oBAAoB,EACpB,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EACjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAG1D,qBAAa,kBAAmB,SAAQ,oBAAoB;IACnD,IAAI,EAAE,cAAc,CAAC;IAC5B,OAAO,CAAC,UAAU,CAAuB;IACzC,OAAO,CAAC,MAAM,CAAC,CAAS;gBAEZ,EACV,IAAI,EACJ,UAAU,EACV,MAAM,GACP,EAAE;QACD,IAAI,EAAE,cAAc,CAAC;QACrB,UAAU,EAAE,oBAAoB,CAAC;QACjC,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB;IAOD,IAAW,eAAe,IAAI;QAC5B,SAAS,EAAE,sBAAsB,CAAC;QAClC,SAAS,EAAE,sBAAsB,EAAE,CAAC;KACrC,CAKA;IAEK,UAAU,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IA+BjD,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;IAgD1D,UAAU,CAAC,EACf,MAAM,EACN,OAAO,EACP,OAAO,GACR,EAAE;QACD,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAC;KACpC,GAAG,OAAO,CAAC,IAAI,CAAC;IAgCX,oBAAoB,CAAC,EACzB,OAAO,EACP,UAAU,GACX,EAAE,oBAAoB,GAAG,OAAO,CAAC;QAAE,UAAU,EAAE,cAAc,CAAC;QAAC,KAAK,EAAE,UAAU,EAAE,CAAA;KAAE,CAAC;IAoHhF,gBAAgB,CAAC,IAAI,EAAE;QAAE,OAAO,EAAE,gBAAgB,EAAE,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IA6BtE,gBAAgB,CAAC,IAAI,EAAE;QAC3B,OAAO,EAAE;YACP,OAAO,EAAE,MAAM,CAAC;YAChB,MAAM,EAAE,MAAM,CAAC;YACf,OAAO,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAC;SACpC,EAAE,CAAC;KACL,GAAG,OAAO,CAAC,IAAI,CAAC;IAwCX,mBAAmB,CAAC,IAAI,EAAE;QAAE,QAAQ,EAAE,MAAM,EAAE,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CA0BvE"}
|
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
import { StoreOperations } from '@mastra/core/storage';
|
|
2
|
-
import type { StorageColumn, TABLE_NAMES } from '@mastra/core/storage';
|
|
2
|
+
import type { StorageColumn, TABLE_NAMES, CreateIndexOptions, IndexInfo, StorageIndexStats } from '@mastra/core/storage';
|
|
3
3
|
import sql from 'mssql';
|
|
4
|
+
export type { CreateIndexOptions, IndexInfo, StorageIndexStats };
|
|
4
5
|
export declare class StoreOperationsMSSQL extends StoreOperations {
|
|
5
6
|
pool: sql.ConnectionPool;
|
|
6
7
|
schemaName?: string;
|
|
7
8
|
private setupSchemaPromise;
|
|
8
9
|
private schemaSetupComplete;
|
|
9
|
-
protected getSqlType(type: StorageColumn['type'], isPrimaryKey?: boolean): string;
|
|
10
|
+
protected getSqlType(type: StorageColumn['type'], isPrimaryKey?: boolean, useLargeStorage?: boolean): string;
|
|
10
11
|
constructor({ pool, schemaName }: {
|
|
11
12
|
pool: sql.ConnectionPool;
|
|
12
13
|
schemaName?: string;
|
|
13
14
|
});
|
|
14
15
|
hasColumn(table: string, column: string): Promise<boolean>;
|
|
15
16
|
private setupSchema;
|
|
16
|
-
insert({ tableName, record }: {
|
|
17
|
+
insert({ tableName, record, transaction, }: {
|
|
17
18
|
tableName: TABLE_NAMES;
|
|
18
19
|
record: Record<string, any>;
|
|
20
|
+
transaction?: sql.Transaction;
|
|
19
21
|
}): Promise<void>;
|
|
20
22
|
clearTable({ tableName }: {
|
|
21
23
|
tableName: TABLE_NAMES;
|
|
@@ -38,7 +40,7 @@ export declare class StoreOperationsMSSQL extends StoreOperations {
|
|
|
38
40
|
}): Promise<void>;
|
|
39
41
|
load<R>({ tableName, keys }: {
|
|
40
42
|
tableName: TABLE_NAMES;
|
|
41
|
-
keys: Record<string,
|
|
43
|
+
keys: Record<string, any>;
|
|
42
44
|
}): Promise<R | null>;
|
|
43
45
|
batchInsert({ tableName, records }: {
|
|
44
46
|
tableName: TABLE_NAMES;
|
|
@@ -47,5 +49,66 @@ export declare class StoreOperationsMSSQL extends StoreOperations {
|
|
|
47
49
|
dropTable({ tableName }: {
|
|
48
50
|
tableName: TABLE_NAMES;
|
|
49
51
|
}): Promise<void>;
|
|
52
|
+
/**
|
|
53
|
+
* Prepares a value for database operations, handling Date objects and JSON serialization
|
|
54
|
+
*/
|
|
55
|
+
private prepareValue;
|
|
56
|
+
/**
|
|
57
|
+
* Maps TABLE_SCHEMAS types to mssql param types (used when value is null)
|
|
58
|
+
*/
|
|
59
|
+
private getMssqlType;
|
|
60
|
+
/**
|
|
61
|
+
* Update a single record in the database
|
|
62
|
+
*/
|
|
63
|
+
update({ tableName, keys, data, transaction, }: {
|
|
64
|
+
tableName: TABLE_NAMES;
|
|
65
|
+
keys: Record<string, any>;
|
|
66
|
+
data: Record<string, any>;
|
|
67
|
+
transaction?: sql.Transaction;
|
|
68
|
+
}): Promise<void>;
|
|
69
|
+
/**
|
|
70
|
+
* Update multiple records in a single batch transaction
|
|
71
|
+
*/
|
|
72
|
+
batchUpdate({ tableName, updates, }: {
|
|
73
|
+
tableName: TABLE_NAMES;
|
|
74
|
+
updates: Array<{
|
|
75
|
+
keys: Record<string, any>;
|
|
76
|
+
data: Record<string, any>;
|
|
77
|
+
}>;
|
|
78
|
+
}): Promise<void>;
|
|
79
|
+
/**
|
|
80
|
+
* Delete multiple records by keys
|
|
81
|
+
*/
|
|
82
|
+
batchDelete({ tableName, keys }: {
|
|
83
|
+
tableName: TABLE_NAMES;
|
|
84
|
+
keys: Record<string, any>[];
|
|
85
|
+
}): Promise<void>;
|
|
86
|
+
/**
|
|
87
|
+
* Create a new index on a table
|
|
88
|
+
*/
|
|
89
|
+
createIndex(options: CreateIndexOptions): Promise<void>;
|
|
90
|
+
/**
|
|
91
|
+
* Drop an existing index
|
|
92
|
+
*/
|
|
93
|
+
dropIndex(indexName: string): Promise<void>;
|
|
94
|
+
/**
|
|
95
|
+
* List indexes for a specific table or all tables
|
|
96
|
+
*/
|
|
97
|
+
listIndexes(tableName?: string): Promise<IndexInfo[]>;
|
|
98
|
+
/**
|
|
99
|
+
* Get detailed statistics for a specific index
|
|
100
|
+
*/
|
|
101
|
+
describeIndex(indexName: string): Promise<StorageIndexStats>;
|
|
102
|
+
/**
|
|
103
|
+
* Returns definitions for automatic performance indexes
|
|
104
|
+
* IMPORTANT: Uses seq_id DESC instead of createdAt DESC for MSSQL due to millisecond accuracy limitations
|
|
105
|
+
* NOTE: Using NVARCHAR(400) for text columns (800 bytes) leaves room for composite indexes
|
|
106
|
+
*/
|
|
107
|
+
protected getAutomaticIndexDefinitions(): CreateIndexOptions[];
|
|
108
|
+
/**
|
|
109
|
+
* Creates automatic indexes for optimal query performance
|
|
110
|
+
* Uses getAutomaticIndexDefinitions() to determine which indexes to create
|
|
111
|
+
*/
|
|
112
|
+
createAutomaticIndexes(): Promise<void>;
|
|
50
113
|
}
|
|
51
114
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/operations/index.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/operations/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,eAAe,EAQhB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EACV,aAAa,EACb,WAAW,EACX,kBAAkB,EAClB,SAAS,EACT,iBAAiB,EAClB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,GAAG,MAAM,OAAO,CAAC;AAIxB,YAAY,EAAE,kBAAkB,EAAE,SAAS,EAAE,iBAAiB,EAAE,CAAC;AAEjE,qBAAa,oBAAqB,SAAQ,eAAe;IAChD,IAAI,EAAE,GAAG,CAAC,cAAc,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IAC3B,OAAO,CAAC,kBAAkB,CAA8B;IACxD,OAAO,CAAC,mBAAmB,CAAkC;IAE7D,SAAS,CAAC,UAAU,CAAC,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,EAAE,YAAY,UAAQ,EAAE,eAAe,UAAQ,GAAG,MAAM;gBAmC5F,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE;QAAE,IA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AW,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAqE7D;;OAEG;IACG,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA2DjD;;OAEG;IACG,WAAW,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;IA2F3D;;OAEG;IACG,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAgFlE;;;;OAIG;IACH,SAAS,CAAC,4BAA4B,IAAI,kBAAkB,EAAE;IAiD9D;;;OAGG;IACG,sBAAsB,IAAI,OAAO,CAAC,IAAI,CAAC;CAuB9C"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ScoreRowData } from '@mastra/core/
|
|
1
|
+
import type { ScoreRowData, ScoringSource } from '@mastra/core/evals';
|
|
2
2
|
import type { PaginationInfo, StoragePagination } from '@mastra/core/storage';
|
|
3
3
|
import { ScoresStorage } from '@mastra/core/storage';
|
|
4
4
|
import type { ConnectionPool } from 'mssql';
|
|
@@ -18,23 +18,24 @@ export declare class ScoresMSSQL extends ScoresStorage {
|
|
|
18
18
|
saveScore(score: Omit<ScoreRowData, 'id' | 'createdAt' | 'updatedAt'>): Promise<{
|
|
19
19
|
score: ScoreRowData;
|
|
20
20
|
}>;
|
|
21
|
-
|
|
21
|
+
listScoresByScorerId({ scorerId, pagination, entityId, entityType, source, }: {
|
|
22
22
|
scorerId: string;
|
|
23
23
|
pagination: StoragePagination;
|
|
24
24
|
entityId?: string;
|
|
25
25
|
entityType?: string;
|
|
26
|
+
source?: ScoringSource;
|
|
26
27
|
}): Promise<{
|
|
27
28
|
pagination: PaginationInfo;
|
|
28
29
|
scores: ScoreRowData[];
|
|
29
30
|
}>;
|
|
30
|
-
|
|
31
|
+
listScoresByRunId({ runId, pagination, }: {
|
|
31
32
|
runId: string;
|
|
32
33
|
pagination: StoragePagination;
|
|
33
34
|
}): Promise<{
|
|
34
35
|
pagination: PaginationInfo;
|
|
35
36
|
scores: ScoreRowData[];
|
|
36
37
|
}>;
|
|
37
|
-
|
|
38
|
+
listScoresByEntityId({ entityId, entityType, pagination, }: {
|
|
38
39
|
pagination: StoragePagination;
|
|
39
40
|
entityId: string;
|
|
40
41
|
entityType: string;
|
|
@@ -42,7 +43,7 @@ export declare class ScoresMSSQL extends ScoresStorage {
|
|
|
42
43
|
pagination: PaginationInfo;
|
|
43
44
|
scores: ScoreRowData[];
|
|
44
45
|
}>;
|
|
45
|
-
|
|
46
|
+
listScoresBySpan({ traceId, spanId, pagination, }: {
|
|
46
47
|
traceId: string;
|
|
47
48
|
spanId: string;
|
|
48
49
|
pagination: StoragePagination;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/scores/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/scores/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAA6B,MAAM,oBAAoB,CAAC;AAEjG,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC9E,OAAO,EACL,aAAa,EAKd,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAoB1D,qBAAa,WAAY,SAAQ,aAAa;IACrC,IAAI,EAAE,cAAc,CAAC;IAC5B,OAAO,CAAC,UAAU,CAAuB;IACzC,OAAO,CAAC,MAAM,CAAC,CAAS;gBAEZ,EACV,IAAI,EACJ,UAAU,EACV,MAAM,GACP,EAAE;QACD,IAAI,EAAE,cAAc,CAAC;QACrB,UAAU,EAAE,oBAAoB,CAAC;QACjC,MAAM,CAAC,EA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AM,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;CA6DpE"}
|
|
@@ -1,6 +1,25 @@
|
|
|
1
|
+
import type { PaginationArgs, StorageColumn, TABLE_NAMES } from '@mastra/core/storage';
|
|
1
2
|
export declare function getSchemaName(schema?: string): string | undefined;
|
|
2
3
|
export declare function getTableName({ indexName, schemaName }: {
|
|
3
4
|
indexName: string;
|
|
4
5
|
schemaName?: string;
|
|
5
6
|
}): string;
|
|
7
|
+
/**
|
|
8
|
+
* Build date range filter for queries
|
|
9
|
+
*/
|
|
10
|
+
export declare function buildDateRangeFilter(dateRange: PaginationArgs['dateRange'], fieldName: string): Record<string, any>;
|
|
11
|
+
/**
|
|
12
|
+
* Prepare WHERE clause for MSSQL queries with @param substitution
|
|
13
|
+
*/
|
|
14
|
+
export declare function prepareWhereClause(filters: Record<string, any>, _schema?: Record<string, StorageColumn>): {
|
|
15
|
+
sql: string;
|
|
16
|
+
params: Record<string, any>;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Transform SQL row to record format, handling JSON columns
|
|
20
|
+
*/
|
|
21
|
+
export declare function transformFromSqlRow<T>({ tableName, sqlRow, }: {
|
|
22
|
+
tableName: TABLE_NAMES;
|
|
23
|
+
sqlRow: Record<string, any>;
|
|
24
|
+
}): T;
|
|
6
25
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/storage/domains/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/storage/domains/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAIvF,wBAAgB,aAAa,CAAC,MAAM,CAAC,EAAE,MAAM,sBAE5C;AAED,wBAAgB,YAAY,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,EAAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,UAKjG;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,cAAc,CAAC,WAAW,CAAC,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CASnH;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC5B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,GACtC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAAE,CA+B9C;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,EACrC,SAAS,EACT,MAAM,GACP,EAAE;IACD,SAAS,EAAE,WAAW,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC7B,GAAG,CAAC,CA8BJ"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { StepResult, WorkflowRun, WorkflowRuns, WorkflowRunState } from '@mastra/core';
|
|
2
1
|
import { WorkflowsStorage } from '@mastra/core/storage';
|
|
2
|
+
import type { StorageListWorkflowRunsInput, WorkflowRun, WorkflowRuns } from '@mastra/core/storage';
|
|
3
|
+
import type { StepResult, WorkflowRunState } from '@mastra/core/workflows';
|
|
3
4
|
import sql from 'mssql';
|
|
4
5
|
import type { StoreOperationsMSSQL } from '../operations/index.js';
|
|
5
6
|
export declare class WorkflowsMSSQL extends WorkflowsStorage {
|
|
@@ -11,14 +12,15 @@ export declare class WorkflowsMSSQL extends WorkflowsStorage {
|
|
|
11
12
|
operations: StoreOperationsMSSQL;
|
|
12
13
|
schema: string;
|
|
13
14
|
});
|
|
14
|
-
|
|
15
|
+
private parseWorkflowRun;
|
|
16
|
+
updateWorkflowResults({ workflowName, runId, stepId, result, requestContext, }: {
|
|
15
17
|
workflowName: string;
|
|
16
18
|
runId: string;
|
|
17
19
|
stepId: string;
|
|
18
20
|
result: StepResult<any, any, any, any>;
|
|
19
|
-
|
|
21
|
+
requestContext: Record<string, any>;
|
|
20
22
|
}): Promise<Record<string, StepResult<any, any, any, any>>>;
|
|
21
|
-
updateWorkflowState({}: {
|
|
23
|
+
updateWorkflowState({ workflowName, runId, opts, }: {
|
|
22
24
|
workflowName: string;
|
|
23
25
|
runId: string;
|
|
24
26
|
opts: {
|
|
@@ -43,13 +45,6 @@ export declare class WorkflowsMSSQL extends WorkflowsStorage {
|
|
|
43
45
|
runId: string;
|
|
44
46
|
workflowName?: string;
|
|
45
47
|
}): Promise<WorkflowRun | null>;
|
|
46
|
-
|
|
47
|
-
workflowName?: string;
|
|
48
|
-
fromDate?: Date;
|
|
49
|
-
toDate?: Date;
|
|
50
|
-
limit?: number;
|
|
51
|
-
offset?: number;
|
|
52
|
-
resourceId?: string;
|
|
53
|
-
}): Promise<WorkflowRuns>;
|
|
48
|
+
listWorkflowRuns({ workflowName, fromDate, toDate, page, perPage, resourceId, }?: StorageListWorkflowRunsInput): Promise<WorkflowRuns>;
|
|
54
49
|
}
|
|
55
50
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/workflows/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/workflows/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAA6C,MAAM,sBAAsB,CAAC;AACnG,OAAO,KAAK,EAAE,4BAA4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E,GAAG,CAAC,CAAC;YACxC,KAAK,CAAC,EAAE,MAAM,CAAC;YACf,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;YAC1C,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;SACzC,CAAC;KACH,GAAG,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC;IA8EnC,uBAAuB,CAAC,EAC5B,YAAY,EACZ,KAAK,EACL,UAAU,EACV,QAAQ,GACT,EAAE;QACD,YAAY,EAAE,MAAM,CAAC;QACrB,KAAK,EAAE,MAAM,CAAC;QACd,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,QAAQ,EAAE,gBAAgB,CAAC;KAC5B,GAAG,OAAO,CAAC,IAAI,CAAC;IAqCX,oBAAoB,CAAC,EACzB,YAAY,EACZ,KAAK,GACN,EAAE;QACD,YAAY,EAAE,MAAM,CAAC;QACrB,KAAK,EAAE,MAAM,CAAC;KACf,GAAG,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;IA6B9B,kBAAkB,CAAC,EACvB,KAAK,EACL,YAAY,GACb,EAAE;QACD,KAAK,EAAE,MAAM,CAAC;QACd,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;IA2CzB,gBAAgB,CAAC,EACrB,YAAY,EACZ,QAAQ,EACR,MAAM,EACN,IAAI,EACJ,OAAO,EACP,UAAU,GACX,GAAE,4BAAiC,GAAG,OAAO,CAAC,YAAY,CAAC;CA0E7D"}
|
package/dist/storage/index.d.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import type { MastraMessageContentV2,
|
|
2
|
-
|
|
1
|
+
import type { MastraMessageContentV2, MastraDBMessage } from '@mastra/core/agent';
|
|
2
|
+
import type { ScoreRowData, ScoringSource } from '@mastra/core/evals';
|
|
3
|
+
import type { StorageThreadType } from '@mastra/core/memory';
|
|
4
|
+
import { MastraStorage } from '@mastra/core/storage';
|
|
5
|
+
export type MastraDBMessageWithTypedContent = Omit<MastraDBMessage, 'content'> & {
|
|
3
6
|
content: MastraMessageContentV2;
|
|
4
7
|
};
|
|
5
|
-
import type {
|
|
6
|
-
import type { ScoreRowData } from '@mastra/core/scores';
|
|
7
|
-
import { MastraStorage } from '@mastra/core/storage';
|
|
8
|
-
import type { EvalRow, PaginationInfo, StorageColumn, StorageGetMessagesArg, StorageResourceType, TABLE_NAMES, WorkflowRun, WorkflowRuns, PaginationArgs, StoragePagination, ThreadSortOptions, StorageDomains, StorageGetTracesArg, StorageGetTracesPaginatedArg } from '@mastra/core/storage';
|
|
9
|
-
import type { Trace } from '@mastra/core/telemetry';
|
|
8
|
+
import type { PaginationInfo, StorageColumn, StorageResourceType, TABLE_NAMES, WorkflowRun, WorkflowRuns, StoragePagination, StorageDomains, SpanRecord, AITraceRecord, AITracesPaginatedArg, UpdateSpanRecord, CreateIndexOptions, IndexInfo, StorageIndexStats, StorageListWorkflowRunsInput } from '@mastra/core/storage';
|
|
10
9
|
import type { StepResult, WorkflowRunState } from '@mastra/core/workflows';
|
|
11
10
|
import sql from 'mssql';
|
|
12
11
|
export type MSSQLConfigType = {
|
|
@@ -36,26 +35,10 @@ export declare class MSSQLStore extends MastraStorage {
|
|
|
36
35
|
hasColumn: boolean;
|
|
37
36
|
createTable: boolean;
|
|
38
37
|
deleteMessages: boolean;
|
|
39
|
-
|
|
38
|
+
listScoresBySpan: boolean;
|
|
39
|
+
observabilityInstance: boolean;
|
|
40
|
+
indexManagement: boolean;
|
|
40
41
|
};
|
|
41
|
-
/** @deprecated use getEvals instead */
|
|
42
|
-
getEvalsByAgentName(agentName: string, type?: 'test' | 'live'): Promise<EvalRow[]>;
|
|
43
|
-
getEvals(options?: {
|
|
44
|
-
agentName?: string;
|
|
45
|
-
type?: 'test' | 'live';
|
|
46
|
-
} & PaginationArgs): Promise<PaginationInfo & {
|
|
47
|
-
evals: EvalRow[];
|
|
48
|
-
}>;
|
|
49
|
-
/**
|
|
50
|
-
* @deprecated use getTracesPaginated instead
|
|
51
|
-
*/
|
|
52
|
-
getTraces(args: StorageGetTracesArg): Promise<Trace[]>;
|
|
53
|
-
getTracesPaginated(args: StorageGetTracesPaginatedArg): Promise<PaginationInfo & {
|
|
54
|
-
traces: Trace[];
|
|
55
|
-
}>;
|
|
56
|
-
batchTraceInsert({ records }: {
|
|
57
|
-
records: Record<string, any>[];
|
|
58
|
-
}): Promise<void>;
|
|
59
42
|
createTable({ tableName, schema, }: {
|
|
60
43
|
tableName: TABLE_NAMES;
|
|
61
44
|
schema: Record<string, StorageColumn>;
|
|
@@ -89,19 +72,6 @@ export declare class MSSQLStore extends MastraStorage {
|
|
|
89
72
|
getThreadById({ threadId }: {
|
|
90
73
|
threadId: string;
|
|
91
74
|
}): Promise<StorageThreadType | null>;
|
|
92
|
-
/**
|
|
93
|
-
* @deprecated use getThreadsByResourceIdPaginated instead
|
|
94
|
-
*/
|
|
95
|
-
getThreadsByResourceId(args: {
|
|
96
|
-
resourceId: string;
|
|
97
|
-
} & ThreadSortOptions): Promise<StorageThreadType[]>;
|
|
98
|
-
getThreadsByResourceIdPaginated(args: {
|
|
99
|
-
resourceId: string;
|
|
100
|
-
page: number;
|
|
101
|
-
perPage: number;
|
|
102
|
-
} & ThreadSortOptions): Promise<PaginationInfo & {
|
|
103
|
-
threads: StorageThreadType[];
|
|
104
|
-
}>;
|
|
105
75
|
saveThread({ thread }: {
|
|
106
76
|
thread: StorageThreadType;
|
|
107
77
|
}): Promise<StorageThreadType>;
|
|
@@ -113,45 +83,25 @@ export declare class MSSQLStore extends MastraStorage {
|
|
|
113
83
|
deleteThread({ threadId }: {
|
|
114
84
|
threadId: string;
|
|
115
85
|
}): Promise<void>;
|
|
116
|
-
|
|
117
|
-
* @deprecated use getMessagesPaginated instead
|
|
118
|
-
*/
|
|
119
|
-
getMessages(args: StorageGetMessagesArg & {
|
|
120
|
-
format?: 'v1';
|
|
121
|
-
}): Promise<MastraMessageV1[]>;
|
|
122
|
-
getMessages(args: StorageGetMessagesArg & {
|
|
123
|
-
format: 'v2';
|
|
124
|
-
}): Promise<MastraMessageV2[]>;
|
|
125
|
-
getMessagesById({ messageIds, format }: {
|
|
86
|
+
listMessagesById({ messageIds }: {
|
|
126
87
|
messageIds: string[];
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
getMessagesById({ messageIds, format }: {
|
|
130
|
-
messageIds: string[];
|
|
131
|
-
format?: 'v2';
|
|
132
|
-
}): Promise<MastraMessageV2[]>;
|
|
133
|
-
getMessagesPaginated(args: StorageGetMessagesArg & {
|
|
134
|
-
format?: 'v1' | 'v2';
|
|
135
|
-
}): Promise<PaginationInfo & {
|
|
136
|
-
messages: MastraMessageV1[] | MastraMessageV2[];
|
|
88
|
+
}): Promise<{
|
|
89
|
+
messages: MastraDBMessage[];
|
|
137
90
|
}>;
|
|
138
91
|
saveMessages(args: {
|
|
139
|
-
messages:
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
messages: MastraMessageV2[];
|
|
144
|
-
format: 'v2';
|
|
145
|
-
}): Promise<MastraMessageV2[]>;
|
|
92
|
+
messages: MastraDBMessage[];
|
|
93
|
+
}): Promise<{
|
|
94
|
+
messages: MastraDBMessage[];
|
|
95
|
+
}>;
|
|
146
96
|
updateMessages({ messages, }: {
|
|
147
|
-
messages: (Partial<Omit<
|
|
97
|
+
messages: (Partial<Omit<MastraDBMessage, 'createdAt'>> & {
|
|
148
98
|
id: string;
|
|
149
99
|
content?: {
|
|
150
100
|
metadata?: MastraMessageContentV2['metadata'];
|
|
151
101
|
content?: MastraMessageContentV2['content'];
|
|
152
102
|
};
|
|
153
103
|
})[];
|
|
154
|
-
}): Promise<
|
|
104
|
+
}): Promise<MastraDBMessage[]>;
|
|
155
105
|
deleteMessages(messageIds: string[]): Promise<void>;
|
|
156
106
|
getResourceById({ resourceId }: {
|
|
157
107
|
resourceId: string;
|
|
@@ -167,12 +117,12 @@ export declare class MSSQLStore extends MastraStorage {
|
|
|
167
117
|
/**
|
|
168
118
|
* Workflows
|
|
169
119
|
*/
|
|
170
|
-
updateWorkflowResults({ workflowName, runId, stepId, result,
|
|
120
|
+
updateWorkflowResults({ workflowName, runId, stepId, result, requestContext, }: {
|
|
171
121
|
workflowName: string;
|
|
172
122
|
runId: string;
|
|
173
123
|
stepId: string;
|
|
174
124
|
result: StepResult<any, any, any, any>;
|
|
175
|
-
|
|
125
|
+
requestContext: Record<string, any>;
|
|
176
126
|
}): Promise<Record<string, StepResult<any, any, any, any>>>;
|
|
177
127
|
updateWorkflowState({ workflowName, runId, opts, }: {
|
|
178
128
|
workflowName: string;
|
|
@@ -195,28 +145,59 @@ export declare class MSSQLStore extends MastraStorage {
|
|
|
195
145
|
workflowName: string;
|
|
196
146
|
runId: string;
|
|
197
147
|
}): Promise<WorkflowRunState | null>;
|
|
198
|
-
|
|
199
|
-
workflowName?: string;
|
|
200
|
-
fromDate?: Date;
|
|
201
|
-
toDate?: Date;
|
|
202
|
-
limit?: number;
|
|
203
|
-
offset?: number;
|
|
204
|
-
resourceId?: string;
|
|
205
|
-
}): Promise<WorkflowRuns>;
|
|
148
|
+
listWorkflowRuns({ workflowName, fromDate, toDate, perPage, page, resourceId, }?: StorageListWorkflowRunsInput): Promise<WorkflowRuns>;
|
|
206
149
|
getWorkflowRunById({ runId, workflowName, }: {
|
|
207
150
|
runId: string;
|
|
208
151
|
workflowName?: string;
|
|
209
152
|
}): Promise<WorkflowRun | null>;
|
|
210
153
|
close(): Promise<void>;
|
|
154
|
+
/**
|
|
155
|
+
* Index Management
|
|
156
|
+
*/
|
|
157
|
+
createIndex(options: CreateIndexOptions): Promise<void>;
|
|
158
|
+
listIndexes(tableName?: string): Promise<IndexInfo[]>;
|
|
159
|
+
describeIndex(indexName: string): Promise<StorageIndexStats>;
|
|
160
|
+
dropIndex(indexName: string): Promise<void>;
|
|
161
|
+
/**
|
|
162
|
+
* Tracing / Observability
|
|
163
|
+
*/
|
|
164
|
+
private getObservabilityStore;
|
|
165
|
+
createSpan(span: SpanRecord): Promise<void>;
|
|
166
|
+
updateSpan({ spanId, traceId, updates, }: {
|
|
167
|
+
spanId: string;
|
|
168
|
+
traceId: string;
|
|
169
|
+
updates: Partial<UpdateSpanRecord>;
|
|
170
|
+
}): Promise<void>;
|
|
171
|
+
getAITrace(traceId: string): Promise<AITraceRecord | null>;
|
|
172
|
+
getAITracesPaginated(args: AITracesPaginatedArg): Promise<{
|
|
173
|
+
pagination: PaginationInfo;
|
|
174
|
+
spans: SpanRecord[];
|
|
175
|
+
}>;
|
|
176
|
+
batchCreateSpans(args: {
|
|
177
|
+
records: SpanRecord[];
|
|
178
|
+
}): Promise<void>;
|
|
179
|
+
batchUpdateSpans(args: {
|
|
180
|
+
records: {
|
|
181
|
+
traceId: string;
|
|
182
|
+
spanId: string;
|
|
183
|
+
updates: Partial<UpdateSpanRecord>;
|
|
184
|
+
}[];
|
|
185
|
+
}): Promise<void>;
|
|
186
|
+
batchDeleteAITraces(args: {
|
|
187
|
+
traceIds: string[];
|
|
188
|
+
}): Promise<void>;
|
|
211
189
|
/**
|
|
212
190
|
* Scorers
|
|
213
191
|
*/
|
|
214
192
|
getScoreById({ id: _id }: {
|
|
215
193
|
id: string;
|
|
216
194
|
}): Promise<ScoreRowData | null>;
|
|
217
|
-
|
|
195
|
+
listScoresByScorerId({ scorerId: _scorerId, pagination: _pagination, entityId: _entityId, entityType: _entityType, source: _source, }: {
|
|
218
196
|
scorerId: string;
|
|
219
197
|
pagination: StoragePagination;
|
|
198
|
+
entityId?: string;
|
|
199
|
+
entityType?: string;
|
|
200
|
+
source?: ScoringSource;
|
|
220
201
|
}): Promise<{
|
|
221
202
|
pagination: PaginationInfo;
|
|
222
203
|
scores: ScoreRowData[];
|
|
@@ -224,14 +205,14 @@ export declare class MSSQLStore extends MastraStorage {
|
|
|
224
205
|
saveScore(_score: ScoreRowData): Promise<{
|
|
225
206
|
score: ScoreRowData;
|
|
226
207
|
}>;
|
|
227
|
-
|
|
208
|
+
listScoresByRunId({ runId: _runId, pagination: _pagination, }: {
|
|
228
209
|
runId: string;
|
|
229
210
|
pagination: StoragePagination;
|
|
230
211
|
}): Promise<{
|
|
231
212
|
pagination: PaginationInfo;
|
|
232
213
|
scores: ScoreRowData[];
|
|
233
214
|
}>;
|
|
234
|
-
|
|
215
|
+
listScoresByEntityId({ entityId: _entityId, entityType: _entityType, pagination: _pagination, }: {
|
|
235
216
|
pagination: StoragePagination;
|
|
236
217
|
entityId: string;
|
|
237
218
|
entityType: string;
|
|
@@ -239,7 +220,7 @@ export declare class MSSQLStore extends MastraStorage {
|
|
|
239
220
|
pagination: PaginationInfo;
|
|
240
221
|
scores: ScoreRowData[];
|
|
241
222
|
}>;
|
|
242
|
-
|
|
223
|
+
listScoresBySpan({ traceId, spanId, pagination: _pagination, }: {
|
|
243
224
|
traceId: string;
|
|
244
225
|
spanId: string;
|
|
245
226
|
pagination: StoragePagination;
|