@mastra/mssql 0.0.0-feat-support-ai-sdk-5-again-20250813225910 → 0.0.0-feat-add-query-option-to-playground-20251209160219
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 +1004 -3
- package/README.md +324 -37
- package/dist/index.cjs +1847 -756
- 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 +1848 -757
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/memory/index.d.ts +15 -36
- 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 +15 -6
- 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 +28 -10
- package/dist/storage/domains/workflows/index.d.ts.map +1 -1
- package/dist/storage/index.d.ts +116 -74
- package/dist/storage/index.d.ts.map +1 -1
- package/package.json +30 -12
- 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
- package/docker-compose.yaml +0 -14
- package/eslint.config.js +0 -6
- package/src/index.ts +0 -2
- package/src/storage/domains/legacy-evals/index.ts +0 -175
- package/src/storage/domains/memory/index.ts +0 -1024
- package/src/storage/domains/operations/index.ts +0 -401
- package/src/storage/domains/scores/index.ts +0 -316
- package/src/storage/domains/traces/index.ts +0 -212
- package/src/storage/domains/utils.ts +0 -12
- package/src/storage/domains/workflows/index.ts +0 -259
- package/src/storage/index.test.ts +0 -2228
- package/src/storage/index.ts +0 -448
- package/tsconfig.build.json +0 -9
- package/tsconfig.json +0 -5
- package/tsup.config.ts +0 -17
- package/vitest.config.ts +0 -12
package/dist/storage/index.d.ts
CHANGED
|
@@ -1,16 +1,36 @@
|
|
|
1
|
-
import type { MastraMessageContentV2,
|
|
2
|
-
|
|
1
|
+
import type { MastraMessageContentV2, MastraDBMessage } from '@mastra/core/agent';
|
|
2
|
+
import type { SaveScorePayload, 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 {
|
|
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';
|
|
10
|
-
import type { WorkflowRunState } from '@mastra/core/workflows';
|
|
8
|
+
import type { PaginationInfo, StorageColumn, StorageResourceType, TABLE_NAMES, WorkflowRun, WorkflowRuns, StoragePagination, StorageDomains, SpanRecord, TraceRecord, TracesPaginatedArg, UpdateSpanRecord, CreateIndexOptions, IndexInfo, StorageIndexStats, StorageListWorkflowRunsInput } from '@mastra/core/storage';
|
|
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
|
+
/**
|
|
15
|
+
* When true, automatic initialization (table creation/migrations) is disabled.
|
|
16
|
+
* This is useful for CI/CD pipelines where you want to:
|
|
17
|
+
* 1. Run migrations explicitly during deployment (not at runtime)
|
|
18
|
+
* 2. Use different credentials for schema changes vs runtime operations
|
|
19
|
+
*
|
|
20
|
+
* When disableInit is true:
|
|
21
|
+
* - The storage will not automatically create/alter tables on first use
|
|
22
|
+
* - You must call `storage.init()` explicitly in your CI/CD scripts
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* // In CI/CD script:
|
|
26
|
+
* const storage = new MSSQLStore({ ...config, disableInit: false });
|
|
27
|
+
* await storage.init(); // Explicitly run migrations
|
|
28
|
+
*
|
|
29
|
+
* // In runtime application:
|
|
30
|
+
* const storage = new MSSQLStore({ ...config, disableInit: true });
|
|
31
|
+
* // No auto-init, tables must already exist
|
|
32
|
+
*/
|
|
33
|
+
disableInit?: boolean;
|
|
14
34
|
} & ({
|
|
15
35
|
server: string;
|
|
16
36
|
port: number;
|
|
@@ -36,25 +56,10 @@ export declare class MSSQLStore extends MastraStorage {
|
|
|
36
56
|
hasColumn: boolean;
|
|
37
57
|
createTable: boolean;
|
|
38
58
|
deleteMessages: boolean;
|
|
59
|
+
listScoresBySpan: boolean;
|
|
60
|
+
observabilityInstance: boolean;
|
|
61
|
+
indexManagement: boolean;
|
|
39
62
|
};
|
|
40
|
-
/** @deprecated use getEvals instead */
|
|
41
|
-
getEvalsByAgentName(agentName: string, type?: 'test' | 'live'): Promise<EvalRow[]>;
|
|
42
|
-
getEvals(options?: {
|
|
43
|
-
agentName?: string;
|
|
44
|
-
type?: 'test' | 'live';
|
|
45
|
-
} & PaginationArgs): Promise<PaginationInfo & {
|
|
46
|
-
evals: EvalRow[];
|
|
47
|
-
}>;
|
|
48
|
-
/**
|
|
49
|
-
* @deprecated use getTracesPaginated instead
|
|
50
|
-
*/
|
|
51
|
-
getTraces(args: StorageGetTracesArg): Promise<Trace[]>;
|
|
52
|
-
getTracesPaginated(args: StorageGetTracesPaginatedArg): Promise<PaginationInfo & {
|
|
53
|
-
traces: Trace[];
|
|
54
|
-
}>;
|
|
55
|
-
batchTraceInsert({ records }: {
|
|
56
|
-
records: Record<string, any>[];
|
|
57
|
-
}): Promise<void>;
|
|
58
63
|
createTable({ tableName, schema, }: {
|
|
59
64
|
tableName: TABLE_NAMES;
|
|
60
65
|
schema: Record<string, StorageColumn>;
|
|
@@ -88,19 +93,6 @@ export declare class MSSQLStore extends MastraStorage {
|
|
|
88
93
|
getThreadById({ threadId }: {
|
|
89
94
|
threadId: string;
|
|
90
95
|
}): Promise<StorageThreadType | null>;
|
|
91
|
-
/**
|
|
92
|
-
* @deprecated use getThreadsByResourceIdPaginated instead
|
|
93
|
-
*/
|
|
94
|
-
getThreadsByResourceId(args: {
|
|
95
|
-
resourceId: string;
|
|
96
|
-
} & ThreadSortOptions): Promise<StorageThreadType[]>;
|
|
97
|
-
getThreadsByResourceIdPaginated(args: {
|
|
98
|
-
resourceId: string;
|
|
99
|
-
page: number;
|
|
100
|
-
perPage: number;
|
|
101
|
-
} & ThreadSortOptions): Promise<PaginationInfo & {
|
|
102
|
-
threads: StorageThreadType[];
|
|
103
|
-
}>;
|
|
104
96
|
saveThread({ thread }: {
|
|
105
97
|
thread: StorageThreadType;
|
|
106
98
|
}): Promise<StorageThreadType>;
|
|
@@ -112,37 +104,25 @@ export declare class MSSQLStore extends MastraStorage {
|
|
|
112
104
|
deleteThread({ threadId }: {
|
|
113
105
|
threadId: string;
|
|
114
106
|
}): Promise<void>;
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
format?: 'v1';
|
|
120
|
-
}): Promise<MastraMessageV1[]>;
|
|
121
|
-
getMessages(args: StorageGetMessagesArg & {
|
|
122
|
-
format: 'v2';
|
|
123
|
-
}): Promise<MastraMessageV2[]>;
|
|
124
|
-
getMessagesPaginated(args: StorageGetMessagesArg & {
|
|
125
|
-
format?: 'v1' | 'v2';
|
|
126
|
-
}): Promise<PaginationInfo & {
|
|
127
|
-
messages: MastraMessageV1[] | MastraMessageV2[];
|
|
107
|
+
listMessagesById({ messageIds }: {
|
|
108
|
+
messageIds: string[];
|
|
109
|
+
}): Promise<{
|
|
110
|
+
messages: MastraDBMessage[];
|
|
128
111
|
}>;
|
|
129
112
|
saveMessages(args: {
|
|
130
|
-
messages:
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
messages: MastraMessageV2[];
|
|
135
|
-
format: 'v2';
|
|
136
|
-
}): Promise<MastraMessageV2[]>;
|
|
113
|
+
messages: MastraDBMessage[];
|
|
114
|
+
}): Promise<{
|
|
115
|
+
messages: MastraDBMessage[];
|
|
116
|
+
}>;
|
|
137
117
|
updateMessages({ messages, }: {
|
|
138
|
-
messages: (Partial<Omit<
|
|
118
|
+
messages: (Partial<Omit<MastraDBMessage, 'createdAt'>> & {
|
|
139
119
|
id: string;
|
|
140
120
|
content?: {
|
|
141
121
|
metadata?: MastraMessageContentV2['metadata'];
|
|
142
122
|
content?: MastraMessageContentV2['content'];
|
|
143
123
|
};
|
|
144
124
|
})[];
|
|
145
|
-
}): Promise<
|
|
125
|
+
}): Promise<MastraDBMessage[]>;
|
|
146
126
|
deleteMessages(messageIds: string[]): Promise<void>;
|
|
147
127
|
getResourceById({ resourceId }: {
|
|
148
128
|
resourceId: string;
|
|
@@ -158,52 +138,106 @@ export declare class MSSQLStore extends MastraStorage {
|
|
|
158
138
|
/**
|
|
159
139
|
* Workflows
|
|
160
140
|
*/
|
|
161
|
-
|
|
141
|
+
updateWorkflowResults({ workflowName, runId, stepId, result, requestContext, }: {
|
|
142
|
+
workflowName: string;
|
|
143
|
+
runId: string;
|
|
144
|
+
stepId: string;
|
|
145
|
+
result: StepResult<any, any, any, any>;
|
|
146
|
+
requestContext: Record<string, any>;
|
|
147
|
+
}): Promise<Record<string, StepResult<any, any, any, any>>>;
|
|
148
|
+
updateWorkflowState({ workflowName, runId, opts, }: {
|
|
162
149
|
workflowName: string;
|
|
163
150
|
runId: string;
|
|
151
|
+
opts: {
|
|
152
|
+
status: string;
|
|
153
|
+
result?: StepResult<any, any, any, any>;
|
|
154
|
+
error?: string;
|
|
155
|
+
suspendedPaths?: Record<string, number[]>;
|
|
156
|
+
waitingPaths?: Record<string, number[]>;
|
|
157
|
+
};
|
|
158
|
+
}): Promise<WorkflowRunState | undefined>;
|
|
159
|
+
persistWorkflowSnapshot({ workflowName, runId, resourceId, snapshot, }: {
|
|
160
|
+
workflowName: string;
|
|
161
|
+
runId: string;
|
|
162
|
+
resourceId?: string;
|
|
164
163
|
snapshot: WorkflowRunState;
|
|
165
164
|
}): Promise<void>;
|
|
166
165
|
loadWorkflowSnapshot({ workflowName, runId, }: {
|
|
167
166
|
workflowName: string;
|
|
168
167
|
runId: string;
|
|
169
168
|
}): Promise<WorkflowRunState | null>;
|
|
170
|
-
|
|
171
|
-
workflowName?: string;
|
|
172
|
-
fromDate?: Date;
|
|
173
|
-
toDate?: Date;
|
|
174
|
-
limit?: number;
|
|
175
|
-
offset?: number;
|
|
176
|
-
resourceId?: string;
|
|
177
|
-
}): Promise<WorkflowRuns>;
|
|
169
|
+
listWorkflowRuns(args?: StorageListWorkflowRunsInput): Promise<WorkflowRuns>;
|
|
178
170
|
getWorkflowRunById({ runId, workflowName, }: {
|
|
179
171
|
runId: string;
|
|
180
172
|
workflowName?: string;
|
|
181
173
|
}): Promise<WorkflowRun | null>;
|
|
174
|
+
deleteWorkflowRunById({ runId, workflowName }: {
|
|
175
|
+
runId: string;
|
|
176
|
+
workflowName: string;
|
|
177
|
+
}): Promise<void>;
|
|
182
178
|
close(): Promise<void>;
|
|
179
|
+
/**
|
|
180
|
+
* Index Management
|
|
181
|
+
*/
|
|
182
|
+
createIndex(options: CreateIndexOptions): Promise<void>;
|
|
183
|
+
listIndexes(tableName?: string): Promise<IndexInfo[]>;
|
|
184
|
+
describeIndex(indexName: string): Promise<StorageIndexStats>;
|
|
185
|
+
dropIndex(indexName: string): Promise<void>;
|
|
186
|
+
/**
|
|
187
|
+
* Tracing / Observability
|
|
188
|
+
*/
|
|
189
|
+
private getObservabilityStore;
|
|
190
|
+
createSpan(span: SpanRecord): Promise<void>;
|
|
191
|
+
updateSpan({ spanId, traceId, updates, }: {
|
|
192
|
+
spanId: string;
|
|
193
|
+
traceId: string;
|
|
194
|
+
updates: Partial<UpdateSpanRecord>;
|
|
195
|
+
}): Promise<void>;
|
|
196
|
+
getTrace(traceId: string): Promise<TraceRecord | null>;
|
|
197
|
+
getTracesPaginated(args: TracesPaginatedArg): Promise<{
|
|
198
|
+
pagination: PaginationInfo;
|
|
199
|
+
spans: SpanRecord[];
|
|
200
|
+
}>;
|
|
201
|
+
batchCreateSpans(args: {
|
|
202
|
+
records: SpanRecord[];
|
|
203
|
+
}): Promise<void>;
|
|
204
|
+
batchUpdateSpans(args: {
|
|
205
|
+
records: {
|
|
206
|
+
traceId: string;
|
|
207
|
+
spanId: string;
|
|
208
|
+
updates: Partial<UpdateSpanRecord>;
|
|
209
|
+
}[];
|
|
210
|
+
}): Promise<void>;
|
|
211
|
+
batchDeleteTraces(args: {
|
|
212
|
+
traceIds: string[];
|
|
213
|
+
}): Promise<void>;
|
|
183
214
|
/**
|
|
184
215
|
* Scorers
|
|
185
216
|
*/
|
|
186
217
|
getScoreById({ id: _id }: {
|
|
187
218
|
id: string;
|
|
188
219
|
}): Promise<ScoreRowData | null>;
|
|
189
|
-
|
|
220
|
+
listScoresByScorerId({ scorerId: _scorerId, pagination: _pagination, entityId: _entityId, entityType: _entityType, source: _source, }: {
|
|
190
221
|
scorerId: string;
|
|
191
222
|
pagination: StoragePagination;
|
|
223
|
+
entityId?: string;
|
|
224
|
+
entityType?: string;
|
|
225
|
+
source?: ScoringSource;
|
|
192
226
|
}): Promise<{
|
|
193
227
|
pagination: PaginationInfo;
|
|
194
228
|
scores: ScoreRowData[];
|
|
195
229
|
}>;
|
|
196
|
-
saveScore(
|
|
230
|
+
saveScore(score: SaveScorePayload): Promise<{
|
|
197
231
|
score: ScoreRowData;
|
|
198
232
|
}>;
|
|
199
|
-
|
|
233
|
+
listScoresByRunId({ runId: _runId, pagination: _pagination, }: {
|
|
200
234
|
runId: string;
|
|
201
235
|
pagination: StoragePagination;
|
|
202
236
|
}): Promise<{
|
|
203
237
|
pagination: PaginationInfo;
|
|
204
238
|
scores: ScoreRowData[];
|
|
205
239
|
}>;
|
|
206
|
-
|
|
240
|
+
listScoresByEntityId({ entityId: _entityId, entityType: _entityType, pagination: _pagination, }: {
|
|
207
241
|
pagination: StoragePagination;
|
|
208
242
|
entityId: string;
|
|
209
243
|
entityType: string;
|
|
@@ -211,5 +245,13 @@ export declare class MSSQLStore extends MastraStorage {
|
|
|
211
245
|
pagination: PaginationInfo;
|
|
212
246
|
scores: ScoreRowData[];
|
|
213
247
|
}>;
|
|
248
|
+
listScoresBySpan({ traceId, spanId, pagination: _pagination, }: {
|
|
249
|
+
traceId: string;
|
|
250
|
+
spanId: string;
|
|
251
|
+
pagination: StoragePagination;
|
|
252
|
+
}): Promise<{
|
|
253
|
+
pagination: PaginationInfo;
|
|
254
|
+
scores: ScoreRowData[];
|
|
255
|
+
}>;
|
|
214
256
|
}
|
|
215
257
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/storage/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/storage/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAElF,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAwB,aAAa,EAAE,M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,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;IAQ7D,gBAAgB,CAAC,EACrB,OAAO,EACP,MAAM,EACN,UAAU,EAAE,WAAW,GACxB,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;CAGpE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/mssql",
|
|
3
|
-
"version": "0.0.0-feat-
|
|
3
|
+
"version": "0.0.0-feat-add-query-option-to-playground-20251209160219",
|
|
4
4
|
"description": "MSSQL provider for Mastra - db storage capabilities",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -18,25 +18,43 @@
|
|
|
18
18
|
},
|
|
19
19
|
"./package.json": "./package.json"
|
|
20
20
|
},
|
|
21
|
-
"license": "
|
|
21
|
+
"license": "Apache-2.0",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"mssql": "^
|
|
23
|
+
"mssql": "^11.0.1"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@microsoft/api-extractor": "^7.52.8",
|
|
27
|
-
"@types/mssql": "^9.1.
|
|
28
|
-
"@types/node": "
|
|
29
|
-
"
|
|
27
|
+
"@types/mssql": "^9.1.8",
|
|
28
|
+
"@types/node": "22.13.17",
|
|
29
|
+
"@vitest/coverage-v8": "4.0.12",
|
|
30
|
+
"@vitest/ui": "4.0.12",
|
|
31
|
+
"eslint": "^9.37.0",
|
|
30
32
|
"tsup": "^8.5.0",
|
|
31
33
|
"typescript": "^5.8.3",
|
|
32
|
-
"vitest": "
|
|
33
|
-
"@internal/lint": "0.0.0-feat-
|
|
34
|
-
"@internal/storage-test-utils": "0.0.
|
|
35
|
-
"@internal/types-builder": "0.0.0-feat-
|
|
36
|
-
"@mastra/core": "0.0.0-feat-
|
|
34
|
+
"vitest": "4.0.12",
|
|
35
|
+
"@internal/lint": "0.0.0-feat-add-query-option-to-playground-20251209160219",
|
|
36
|
+
"@internal/storage-test-utils": "0.0.49",
|
|
37
|
+
"@internal/types-builder": "0.0.0-feat-add-query-option-to-playground-20251209160219",
|
|
38
|
+
"@mastra/core": "0.0.0-feat-add-query-option-to-playground-20251209160219"
|
|
37
39
|
},
|
|
38
40
|
"peerDependencies": {
|
|
39
|
-
"@mastra/core": "0.0.0-feat-
|
|
41
|
+
"@mastra/core": "0.0.0-feat-add-query-option-to-playground-20251209160219"
|
|
42
|
+
},
|
|
43
|
+
"files": [
|
|
44
|
+
"dist",
|
|
45
|
+
"CHANGELOG.md"
|
|
46
|
+
],
|
|
47
|
+
"homepage": "https://mastra.ai",
|
|
48
|
+
"repository": {
|
|
49
|
+
"type": "git",
|
|
50
|
+
"url": "git+https://github.com/mastra-ai/mastra.git",
|
|
51
|
+
"directory": "stores/mssql"
|
|
52
|
+
},
|
|
53
|
+
"bugs": {
|
|
54
|
+
"url": "https://github.com/mastra-ai/mastra/issues"
|
|
55
|
+
},
|
|
56
|
+
"engines": {
|
|
57
|
+
"node": ">=22.13.0"
|
|
40
58
|
},
|
|
41
59
|
"scripts": {
|
|
42
60
|
"build": "tsup --silent --config tsup.config.ts",
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { LegacyEvalsStorage } from '@mastra/core/storage';
|
|
2
|
-
import type { PaginationArgs, PaginationInfo, EvalRow } from '@mastra/core/storage';
|
|
3
|
-
import sql from 'mssql';
|
|
4
|
-
export declare class LegacyEvalsMSSQL extends LegacyEvalsStorage {
|
|
5
|
-
private pool;
|
|
6
|
-
private schema;
|
|
7
|
-
constructor({ pool, schema }: {
|
|
8
|
-
pool: sql.ConnectionPool;
|
|
9
|
-
schema: string;
|
|
10
|
-
});
|
|
11
|
-
/** @deprecated use getEvals instead */
|
|
12
|
-
getEvalsByAgentName(agentName: string, type?: 'test' | 'live'): Promise<EvalRow[]>;
|
|
13
|
-
getEvals(options?: {
|
|
14
|
-
agentName?: string;
|
|
15
|
-
type?: 'test' | 'live';
|
|
16
|
-
} & PaginationArgs): Promise<PaginationInfo & {
|
|
17
|
-
evals: EvalRow[];
|
|
18
|
-
}>;
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/legacy-evals/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAe,MAAM,sBAAsB,CAAC;AACvE,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACpF,OAAO,GAAG,MAAM,OAAO,CAAC;AA8BxB,qBAAa,gBAAiB,SAAQ,kBAAkB;IACtD,OAAO,CAAC,IAAI,CAAqB;IACjC,OAAO,CAAC,MAAM,CAAS;gBACX,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE;QAAE,IAAI,EAAE,GAAG,CAAC,cAAc,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE;IAM1E,uCAAuC;IACjC,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IA0BlF,QAAQ,CACZ,OAAO,GAAE;QACP,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;KACxB,GAAG,cAAmB,GACtB,OAAO,CAAC,cAAc,GAAG;QAAE,KAAK,EAAE,OAAO,EAAE,CAAA;KAAE,CAAC;CAmGlD"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import type { PaginationInfo, PaginationArgs } from '@mastra/core/storage';
|
|
2
|
-
import { TracesStorage } from '@mastra/core/storage';
|
|
3
|
-
import sql from 'mssql';
|
|
4
|
-
import type { StoreOperationsMSSQL } from '../operations/index.js';
|
|
5
|
-
export declare class TracesMSSQL extends TracesStorage {
|
|
6
|
-
pool: sql.ConnectionPool;
|
|
7
|
-
private operations;
|
|
8
|
-
private schema?;
|
|
9
|
-
constructor({ pool, operations, schema, }: {
|
|
10
|
-
pool: sql.ConnectionPool;
|
|
11
|
-
operations: StoreOperationsMSSQL;
|
|
12
|
-
schema?: string;
|
|
13
|
-
});
|
|
14
|
-
/** @deprecated use getTracesPaginated instead*/
|
|
15
|
-
getTraces(args: {
|
|
16
|
-
name?: string;
|
|
17
|
-
scope?: string;
|
|
18
|
-
attributes?: Record<string, string>;
|
|
19
|
-
filters?: Record<string, any>;
|
|
20
|
-
page: number;
|
|
21
|
-
perPage?: number;
|
|
22
|
-
fromDate?: Date;
|
|
23
|
-
toDate?: Date;
|
|
24
|
-
}): Promise<any[]>;
|
|
25
|
-
getTracesPaginated(args: {
|
|
26
|
-
name?: string;
|
|
27
|
-
scope?: string;
|
|
28
|
-
attributes?: Record<string, string>;
|
|
29
|
-
filters?: Record<string, any>;
|
|
30
|
-
} & PaginationArgs): Promise<PaginationInfo & {
|
|
31
|
-
traces: any[];
|
|
32
|
-
}>;
|
|
33
|
-
batchTraceInsert({ records }: {
|
|
34
|
-
records: Record<string, any>[];
|
|
35
|
-
}): Promise<void>;
|
|
36
|
-
}
|
|
37
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/traces/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,cAA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C;KACf,CACF;IAgJK,gBAAgB,CAAC,EAAE,OAAO,EAAE,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAOvF"}
|
package/docker-compose.yaml
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
services:
|
|
2
|
-
mssql:
|
|
3
|
-
image: mcr.microsoft.com/mssql/server:2025-latest
|
|
4
|
-
environment:
|
|
5
|
-
- ACCEPT_EULA=Y
|
|
6
|
-
- SA_PASSWORD=Your_password123
|
|
7
|
-
ports:
|
|
8
|
-
- '1433:1433'
|
|
9
|
-
healthcheck:
|
|
10
|
-
test: ['CMD-SHELL', 'echo > /dev/tcp/localhost/1433']
|
|
11
|
-
interval: 10s
|
|
12
|
-
timeout: 5s
|
|
13
|
-
retries: 10
|
|
14
|
-
start_period: 20s
|
package/eslint.config.js
DELETED
package/src/index.ts
DELETED
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
import { ErrorCategory, ErrorDomain, MastraError } from '@mastra/core/error';
|
|
2
|
-
import type { MetricResult } from '@mastra/core/eval';
|
|
3
|
-
import { LegacyEvalsStorage, TABLE_EVALS } from '@mastra/core/storage';
|
|
4
|
-
import type { PaginationArgs, PaginationInfo, EvalRow } from '@mastra/core/storage';
|
|
5
|
-
import sql from 'mssql';
|
|
6
|
-
import { getSchemaName, getTableName } from '../utils';
|
|
7
|
-
|
|
8
|
-
function transformEvalRow(row: Record<string, any>): EvalRow {
|
|
9
|
-
let testInfoValue = null,
|
|
10
|
-
resultValue = null;
|
|
11
|
-
if (row.test_info) {
|
|
12
|
-
try {
|
|
13
|
-
testInfoValue = typeof row.test_info === 'string' ? JSON.parse(row.test_info) : row.test_info;
|
|
14
|
-
} catch {}
|
|
15
|
-
}
|
|
16
|
-
if (row.test_info) {
|
|
17
|
-
try {
|
|
18
|
-
resultValue = typeof row.result === 'string' ? JSON.parse(row.result) : row.result;
|
|
19
|
-
} catch {}
|
|
20
|
-
}
|
|
21
|
-
return {
|
|
22
|
-
agentName: row.agent_name as string,
|
|
23
|
-
input: row.input as string,
|
|
24
|
-
output: row.output as string,
|
|
25
|
-
result: resultValue as MetricResult,
|
|
26
|
-
metricName: row.metric_name as string,
|
|
27
|
-
instructions: row.instructions as string,
|
|
28
|
-
testInfo: testInfoValue,
|
|
29
|
-
globalRunId: row.global_run_id as string,
|
|
30
|
-
runId: row.run_id as string,
|
|
31
|
-
createdAt: row.created_at as string,
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export class LegacyEvalsMSSQL extends LegacyEvalsStorage {
|
|
36
|
-
private pool: sql.ConnectionPool;
|
|
37
|
-
private schema: string;
|
|
38
|
-
constructor({ pool, schema }: { pool: sql.ConnectionPool; schema: string }) {
|
|
39
|
-
super();
|
|
40
|
-
this.pool = pool;
|
|
41
|
-
this.schema = schema;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/** @deprecated use getEvals instead */
|
|
45
|
-
async getEvalsByAgentName(agentName: string, type?: 'test' | 'live'): Promise<EvalRow[]> {
|
|
46
|
-
try {
|
|
47
|
-
let query = `SELECT * FROM ${getTableName({ indexName: TABLE_EVALS, schemaName: getSchemaName(this.schema) })} WHERE agent_name = @p1`;
|
|
48
|
-
if (type === 'test') {
|
|
49
|
-
query += " AND test_info IS NOT NULL AND JSON_VALUE(test_info, '$.testPath') IS NOT NULL";
|
|
50
|
-
} else if (type === 'live') {
|
|
51
|
-
query += " AND (test_info IS NULL OR JSON_VALUE(test_info, '$.testPath') IS NULL)";
|
|
52
|
-
}
|
|
53
|
-
query += ' ORDER BY created_at DESC';
|
|
54
|
-
|
|
55
|
-
const request = this.pool.request();
|
|
56
|
-
request.input('p1', agentName);
|
|
57
|
-
const result = await request.query(query);
|
|
58
|
-
const rows = result.recordset;
|
|
59
|
-
return typeof transformEvalRow === 'function'
|
|
60
|
-
? (rows?.map((row: any) => transformEvalRow(row)) ?? [])
|
|
61
|
-
: (rows ?? []);
|
|
62
|
-
} catch (error: any) {
|
|
63
|
-
if (error && error.number === 208 && error.message && error.message.includes('Invalid object name')) {
|
|
64
|
-
return [];
|
|
65
|
-
}
|
|
66
|
-
console.error('Failed to get evals for the specified agent: ' + error?.message);
|
|
67
|
-
throw error;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
async getEvals(
|
|
72
|
-
options: {
|
|
73
|
-
agentName?: string;
|
|
74
|
-
type?: 'test' | 'live';
|
|
75
|
-
} & PaginationArgs = {},
|
|
76
|
-
): Promise<PaginationInfo & { evals: EvalRow[] }> {
|
|
77
|
-
const { agentName, type, page = 0, perPage = 100, dateRange } = options;
|
|
78
|
-
const fromDate = dateRange?.start;
|
|
79
|
-
const toDate = dateRange?.end;
|
|
80
|
-
|
|
81
|
-
const where: string[] = [];
|
|
82
|
-
const params: Record<string, any> = {};
|
|
83
|
-
|
|
84
|
-
if (agentName) {
|
|
85
|
-
where.push('agent_name = @agentName');
|
|
86
|
-
params['agentName'] = agentName;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
if (type === 'test') {
|
|
90
|
-
where.push("test_info IS NOT NULL AND JSON_VALUE(test_info, '$.testPath') IS NOT NULL");
|
|
91
|
-
} else if (type === 'live') {
|
|
92
|
-
where.push("(test_info IS NULL OR JSON_VALUE(test_info, '$.testPath') IS NULL)");
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
if (fromDate instanceof Date && !isNaN(fromDate.getTime())) {
|
|
96
|
-
where.push(`[created_at] >= @fromDate`);
|
|
97
|
-
params[`fromDate`] = fromDate.toISOString();
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
if (toDate instanceof Date && !isNaN(toDate.getTime())) {
|
|
101
|
-
where.push(`[created_at] <= @toDate`);
|
|
102
|
-
params[`toDate`] = toDate.toISOString();
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
const whereClause = where.length > 0 ? `WHERE ${where.join(' AND ')}` : '';
|
|
106
|
-
const tableName = getTableName({ indexName: TABLE_EVALS, schemaName: getSchemaName(this.schema) });
|
|
107
|
-
const offset = page * perPage;
|
|
108
|
-
|
|
109
|
-
const countQuery = `SELECT COUNT(*) as total FROM ${tableName} ${whereClause}`;
|
|
110
|
-
const dataQuery = `SELECT * FROM ${tableName} ${whereClause} ORDER BY seq_id DESC OFFSET @offset ROWS FETCH NEXT @perPage ROWS ONLY`;
|
|
111
|
-
|
|
112
|
-
try {
|
|
113
|
-
const countReq = this.pool.request();
|
|
114
|
-
Object.entries(params).forEach(([key, value]) => {
|
|
115
|
-
if (value instanceof Date) {
|
|
116
|
-
countReq.input(key, sql.DateTime, value);
|
|
117
|
-
} else {
|
|
118
|
-
countReq.input(key, value);
|
|
119
|
-
}
|
|
120
|
-
});
|
|
121
|
-
const countResult = await countReq.query(countQuery);
|
|
122
|
-
const total = countResult.recordset[0]?.total || 0;
|
|
123
|
-
|
|
124
|
-
if (total === 0) {
|
|
125
|
-
return {
|
|
126
|
-
evals: [],
|
|
127
|
-
total: 0,
|
|
128
|
-
page,
|
|
129
|
-
perPage,
|
|
130
|
-
hasMore: false,
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
const req = this.pool.request();
|
|
135
|
-
Object.entries(params).forEach(([key, value]) => {
|
|
136
|
-
if (value instanceof Date) {
|
|
137
|
-
req.input(key, sql.DateTime, value);
|
|
138
|
-
} else {
|
|
139
|
-
req.input(key, value);
|
|
140
|
-
}
|
|
141
|
-
});
|
|
142
|
-
req.input('offset', offset);
|
|
143
|
-
req.input('perPage', perPage);
|
|
144
|
-
|
|
145
|
-
const result = await req.query(dataQuery);
|
|
146
|
-
const rows = result.recordset;
|
|
147
|
-
|
|
148
|
-
return {
|
|
149
|
-
evals: rows?.map(row => transformEvalRow(row)) ?? [],
|
|
150
|
-
total,
|
|
151
|
-
page,
|
|
152
|
-
perPage,
|
|
153
|
-
hasMore: offset + (rows?.length ?? 0) < total,
|
|
154
|
-
};
|
|
155
|
-
} catch (error) {
|
|
156
|
-
const mastraError = new MastraError(
|
|
157
|
-
{
|
|
158
|
-
id: 'MASTRA_STORAGE_MSSQL_STORE_GET_EVALS_FAILED',
|
|
159
|
-
domain: ErrorDomain.STORAGE,
|
|
160
|
-
category: ErrorCategory.THIRD_PARTY,
|
|
161
|
-
details: {
|
|
162
|
-
agentName: agentName || 'all',
|
|
163
|
-
type: type || 'all',
|
|
164
|
-
page,
|
|
165
|
-
perPage,
|
|
166
|
-
},
|
|
167
|
-
},
|
|
168
|
-
error,
|
|
169
|
-
);
|
|
170
|
-
this.logger?.error?.(mastraError.toString());
|
|
171
|
-
this.logger?.trackException(mastraError);
|
|
172
|
-
throw mastraError;
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
}
|