@mastra/mssql 0.0.0-monorepo-binary-20251013210052 → 0.0.0-netlify-no-bundle-20251127120354
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 +571 -3
- package/README.md +324 -37
- package/dist/index.cjs +1636 -766
- 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 +1637 -767
- 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 +64 -82
- package/dist/storage/index.d.ts.map +1 -1
- package/package.json +14 -9
- 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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5F,YAAY,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, TraceRecord, TracesPaginatedArg, 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
|
+
getTrace(traceId: string): Promise<TraceRecord | null>;
|
|
21
|
+
updateSpan({ spanId, traceId, updates, }: {
|
|
22
|
+
spanId: string;
|
|
23
|
+
traceId: string;
|
|
24
|
+
updates: Partial<UpdateSpanRecord>;
|
|
25
|
+
}): Promise<void>;
|
|
26
|
+
getTracesPaginated({ filters, pagination, }: TracesPaginatedArg): 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
|
+
batchDeleteTraces(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,EAAe,oBAAoB,EAAe,MAAM,sBAAsB,CAAC;AACtF,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EACX,kBAAkB,EAClB,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,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;IAgDtD,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,kBAAkB,CAAC,EACvB,OAAO,EACP,UAAU,GACX,EAAE,kBAAkB,GAAG,OAAO,CAAC;QAAE,UAAU,EAAE,cAAc,CAAC;QAAC,KAAK,EAAE,UAAU,EAAE,CAAA;KAAE,CAAC;IAoH9E,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,iBAAiB,CAAC,IAAI,EAAE;QAAE,QAAQ,EAAE,MAAM,EAAE,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CA0BrE"}
|
|
@@ -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,IAAI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,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,EAAE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,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, status, }?: 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,EACV,MAAM,GACP,GAAE,4BAAiC,GAAG,OAAO,CAAC,YAAY,CAAC;CA+E7D"}
|
package/dist/storage/index.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
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, TraceRecord, TracesPaginatedArg, 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 = {
|
|
12
|
+
id: string;
|
|
13
13
|
schemaName?: string;
|
|
14
14
|
} & ({
|
|
15
15
|
server: string;
|
|
@@ -36,26 +36,10 @@ export declare class MSSQLStore extends MastraStorage {
|
|
|
36
36
|
hasColumn: boolean;
|
|
37
37
|
createTable: boolean;
|
|
38
38
|
deleteMessages: boolean;
|
|
39
|
-
|
|
39
|
+
listScoresBySpan: boolean;
|
|
40
|
+
observabilityInstance: boolean;
|
|
41
|
+
indexManagement: boolean;
|
|
40
42
|
};
|
|
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
43
|
createTable({ tableName, schema, }: {
|
|
60
44
|
tableName: TABLE_NAMES;
|
|
61
45
|
schema: Record<string, StorageColumn>;
|
|
@@ -89,19 +73,6 @@ export declare class MSSQLStore extends MastraStorage {
|
|
|
89
73
|
getThreadById({ threadId }: {
|
|
90
74
|
threadId: string;
|
|
91
75
|
}): 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
76
|
saveThread({ thread }: {
|
|
106
77
|
thread: StorageThreadType;
|
|
107
78
|
}): Promise<StorageThreadType>;
|
|
@@ -113,45 +84,25 @@ export declare class MSSQLStore extends MastraStorage {
|
|
|
113
84
|
deleteThread({ threadId }: {
|
|
114
85
|
threadId: string;
|
|
115
86
|
}): 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 }: {
|
|
87
|
+
listMessagesById({ messageIds }: {
|
|
126
88
|
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[];
|
|
89
|
+
}): Promise<{
|
|
90
|
+
messages: MastraDBMessage[];
|
|
137
91
|
}>;
|
|
138
92
|
saveMessages(args: {
|
|
139
|
-
messages:
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
messages: MastraMessageV2[];
|
|
144
|
-
format: 'v2';
|
|
145
|
-
}): Promise<MastraMessageV2[]>;
|
|
93
|
+
messages: MastraDBMessage[];
|
|
94
|
+
}): Promise<{
|
|
95
|
+
messages: MastraDBMessage[];
|
|
96
|
+
}>;
|
|
146
97
|
updateMessages({ messages, }: {
|
|
147
|
-
messages: (Partial<Omit<
|
|
98
|
+
messages: (Partial<Omit<MastraDBMessage, 'createdAt'>> & {
|
|
148
99
|
id: string;
|
|
149
100
|
content?: {
|
|
150
101
|
metadata?: MastraMessageContentV2['metadata'];
|
|
151
102
|
content?: MastraMessageContentV2['content'];
|
|
152
103
|
};
|
|
153
104
|
})[];
|
|
154
|
-
}): Promise<
|
|
105
|
+
}): Promise<MastraDBMessage[]>;
|
|
155
106
|
deleteMessages(messageIds: string[]): Promise<void>;
|
|
156
107
|
getResourceById({ resourceId }: {
|
|
157
108
|
resourceId: string;
|
|
@@ -167,12 +118,12 @@ export declare class MSSQLStore extends MastraStorage {
|
|
|
167
118
|
/**
|
|
168
119
|
* Workflows
|
|
169
120
|
*/
|
|
170
|
-
updateWorkflowResults({ workflowName, runId, stepId, result,
|
|
121
|
+
updateWorkflowResults({ workflowName, runId, stepId, result, requestContext, }: {
|
|
171
122
|
workflowName: string;
|
|
172
123
|
runId: string;
|
|
173
124
|
stepId: string;
|
|
174
125
|
result: StepResult<any, any, any, any>;
|
|
175
|
-
|
|
126
|
+
requestContext: Record<string, any>;
|
|
176
127
|
}): Promise<Record<string, StepResult<any, any, any, any>>>;
|
|
177
128
|
updateWorkflowState({ workflowName, runId, opts, }: {
|
|
178
129
|
workflowName: string;
|
|
@@ -195,28 +146,59 @@ export declare class MSSQLStore extends MastraStorage {
|
|
|
195
146
|
workflowName: string;
|
|
196
147
|
runId: string;
|
|
197
148
|
}): 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>;
|
|
149
|
+
listWorkflowRuns(args?: StorageListWorkflowRunsInput): Promise<WorkflowRuns>;
|
|
206
150
|
getWorkflowRunById({ runId, workflowName, }: {
|
|
207
151
|
runId: string;
|
|
208
152
|
workflowName?: string;
|
|
209
153
|
}): Promise<WorkflowRun | null>;
|
|
210
154
|
close(): Promise<void>;
|
|
155
|
+
/**
|
|
156
|
+
* Index Management
|
|
157
|
+
*/
|
|
158
|
+
createIndex(options: CreateIndexOptions): Promise<void>;
|
|
159
|
+
listIndexes(tableName?: string): Promise<IndexInfo[]>;
|
|
160
|
+
describeIndex(indexName: string): Promise<StorageIndexStats>;
|
|
161
|
+
dropIndex(indexName: string): Promise<void>;
|
|
162
|
+
/**
|
|
163
|
+
* Tracing / Observability
|
|
164
|
+
*/
|
|
165
|
+
private getObservabilityStore;
|
|
166
|
+
createSpan(span: SpanRecord): Promise<void>;
|
|
167
|
+
updateSpan({ spanId, traceId, updates, }: {
|
|
168
|
+
spanId: string;
|
|
169
|
+
traceId: string;
|
|
170
|
+
updates: Partial<UpdateSpanRecord>;
|
|
171
|
+
}): Promise<void>;
|
|
172
|
+
getTrace(traceId: string): Promise<TraceRecord | null>;
|
|
173
|
+
getTracesPaginated(args: TracesPaginatedArg): Promise<{
|
|
174
|
+
pagination: PaginationInfo;
|
|
175
|
+
spans: SpanRecord[];
|
|
176
|
+
}>;
|
|
177
|
+
batchCreateSpans(args: {
|
|
178
|
+
records: SpanRecord[];
|
|
179
|
+
}): Promise<void>;
|
|
180
|
+
batchUpdateSpans(args: {
|
|
181
|
+
records: {
|
|
182
|
+
traceId: string;
|
|
183
|
+
spanId: string;
|
|
184
|
+
updates: Partial<UpdateSpanRecord>;
|
|
185
|
+
}[];
|
|
186
|
+
}): Promise<void>;
|
|
187
|
+
batchDeleteTraces(args: {
|
|
188
|
+
traceIds: string[];
|
|
189
|
+
}): Promise<void>;
|
|
211
190
|
/**
|
|
212
191
|
* Scorers
|
|
213
192
|
*/
|
|
214
193
|
getScoreById({ id: _id }: {
|
|
215
194
|
id: string;
|
|
216
195
|
}): Promise<ScoreRowData | null>;
|
|
217
|
-
|
|
196
|
+
listScoresByScorerId({ scorerId: _scorerId, pagination: _pagination, entityId: _entityId, entityType: _entityType, source: _source, }: {
|
|
218
197
|
scorerId: string;
|
|
219
198
|
pagination: StoragePagination;
|
|
199
|
+
entityId?: string;
|
|
200
|
+
entityType?: string;
|
|
201
|
+
source?: ScoringSource;
|
|
220
202
|
}): Promise<{
|
|
221
203
|
pagination: PaginationInfo;
|
|
222
204
|
scores: ScoreRowData[];
|
|
@@ -224,14 +206,14 @@ export declare class MSSQLStore extends MastraStorage {
|
|
|
224
206
|
saveScore(_score: ScoreRowData): Promise<{
|
|
225
207
|
score: ScoreRowData;
|
|
226
208
|
}>;
|
|
227
|
-
|
|
209
|
+
listScoresByRunId({ runId: _runId, pagination: _pagination, }: {
|
|
228
210
|
runId: string;
|
|
229
211
|
pagination: StoragePagination;
|
|
230
212
|
}): Promise<{
|
|
231
213
|
pagination: PaginationInfo;
|
|
232
214
|
scores: ScoreRowData[];
|
|
233
215
|
}>;
|
|
234
|
-
|
|
216
|
+
listScoresByEntityId({ entityId: _entityId, entityType: _entityType, pagination: _pagination, }: {
|
|
235
217
|
pagination: StoragePagination;
|
|
236
218
|
entityId: string;
|
|
237
219
|
entityType: string;
|
|
@@ -239,7 +221,7 @@ export declare class MSSQLStore extends MastraStorage {
|
|
|
239
221
|
pagination: PaginationInfo;
|
|
240
222
|
scores: ScoreRowData[];
|
|
241
223
|
}>;
|
|
242
|
-
|
|
224
|
+
listScoresBySpan({ traceId, spanId, pagination: _pagination, }: {
|
|
243
225
|
traceId: string;
|
|
244
226
|
spanId: string;
|
|
245
227
|
pagination: StoragePagination;
|