@mastra/mssql 0.2.3 → 0.3.0-alpha.0
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/.turbo/turbo-build.log +2 -21
- package/CHANGELOG.md +28 -1
- package/dist/index.cjs +1568 -1104
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +2 -4
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1568 -1104
- package/dist/index.js.map +1 -0
- package/dist/storage/domains/legacy-evals/index.d.ts +20 -0
- package/dist/storage/domains/legacy-evals/index.d.ts.map +1 -0
- package/dist/storage/domains/memory/index.d.ts +90 -0
- package/dist/storage/domains/memory/index.d.ts.map +1 -0
- package/dist/storage/domains/operations/index.d.ts +51 -0
- package/dist/storage/domains/operations/index.d.ts.map +1 -0
- package/dist/storage/domains/scores/index.d.ts +46 -0
- package/dist/storage/domains/scores/index.d.ts.map +1 -0
- package/dist/storage/domains/traces/index.d.ts +37 -0
- package/dist/storage/domains/traces/index.d.ts.map +1 -0
- package/dist/storage/domains/utils.d.ts +6 -0
- package/dist/storage/domains/utils.d.ts.map +1 -0
- package/dist/storage/domains/workflows/index.d.ts +36 -0
- package/dist/storage/domains/workflows/index.d.ts.map +1 -0
- package/dist/{_tsup-dts-rollup.d.cts → storage/index.d.ts} +81 -117
- package/dist/storage/index.d.ts.map +1 -0
- package/package.json +6 -6
- package/src/storage/domains/legacy-evals/index.ts +175 -0
- package/src/storage/domains/memory/index.ts +1024 -0
- package/src/storage/domains/operations/index.ts +401 -0
- package/src/storage/domains/scores/index.ts +315 -0
- package/src/storage/domains/traces/index.ts +212 -0
- package/src/storage/domains/utils.ts +12 -0
- package/src/storage/domains/workflows/index.ts +259 -0
- package/src/storage/index.ts +147 -1835
- package/tsconfig.build.json +9 -0
- package/tsconfig.json +1 -1
- package/tsup.config.ts +22 -0
- package/dist/_tsup-dts-rollup.d.ts +0 -251
- package/dist/index.d.cts +0 -4
package/tsconfig.json
CHANGED
package/tsup.config.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { spawn } from 'child_process';
|
|
2
|
+
import { promisify } from 'util';
|
|
3
|
+
import { defineConfig } from 'tsup';
|
|
4
|
+
|
|
5
|
+
const exec = promisify(spawn);
|
|
6
|
+
|
|
7
|
+
export default defineConfig({
|
|
8
|
+
entry: ['src/index.ts'],
|
|
9
|
+
format: ['esm', 'cjs'],
|
|
10
|
+
clean: true,
|
|
11
|
+
dts: false,
|
|
12
|
+
splitting: true,
|
|
13
|
+
treeshake: {
|
|
14
|
+
preset: 'smallest',
|
|
15
|
+
},
|
|
16
|
+
sourcemap: true,
|
|
17
|
+
onSuccess: async () => {
|
|
18
|
+
await exec('pnpm', ['tsc', '-p', 'tsconfig.build.json'], {
|
|
19
|
+
stdio: 'inherit',
|
|
20
|
+
});
|
|
21
|
+
},
|
|
22
|
+
});
|
|
@@ -1,251 +0,0 @@
|
|
|
1
|
-
import type { EvalRow } from '@mastra/core/storage';
|
|
2
|
-
import type { MastraMessageContentV2 } from '@mastra/core/agent';
|
|
3
|
-
import type { MastraMessageV1 } from '@mastra/core/memory';
|
|
4
|
-
import type { MastraMessageV2 } from '@mastra/core/agent';
|
|
5
|
-
import { MastraStorage } from '@mastra/core/storage';
|
|
6
|
-
import type { PaginationArgs } from '@mastra/core/storage';
|
|
7
|
-
import type { PaginationInfo } from '@mastra/core/storage';
|
|
8
|
-
import type { ScoreRowData } from '@mastra/core/scores';
|
|
9
|
-
import sql from 'mssql';
|
|
10
|
-
import type { StorageColumn } from '@mastra/core/storage';
|
|
11
|
-
import type { StorageGetMessagesArg } from '@mastra/core/storage';
|
|
12
|
-
import type { StoragePagination } from '@mastra/core/storage';
|
|
13
|
-
import type { StorageResourceType } from '@mastra/core/storage';
|
|
14
|
-
import type { StorageThreadType } from '@mastra/core/memory';
|
|
15
|
-
import type { TABLE_NAMES } from '@mastra/core/storage';
|
|
16
|
-
import type { WorkflowRun } from '@mastra/core/storage';
|
|
17
|
-
import type { WorkflowRuns } from '@mastra/core/storage';
|
|
18
|
-
import type { WorkflowRunState } from '@mastra/core/workflows';
|
|
19
|
-
|
|
20
|
-
declare type MastraMessageV2WithTypedContent = Omit<MastraMessageV2, 'content'> & {
|
|
21
|
-
content: MastraMessageContentV2;
|
|
22
|
-
};
|
|
23
|
-
export { MastraMessageV2WithTypedContent }
|
|
24
|
-
export { MastraMessageV2WithTypedContent as MastraMessageV2WithTypedContent_alias_1 }
|
|
25
|
-
|
|
26
|
-
declare type MSSQLConfig = MSSQLConfigType;
|
|
27
|
-
export { MSSQLConfig }
|
|
28
|
-
export { MSSQLConfig as MSSQLConfig_alias_1 }
|
|
29
|
-
|
|
30
|
-
declare type MSSQLConfigType = {
|
|
31
|
-
schemaName?: string;
|
|
32
|
-
} & ({
|
|
33
|
-
server: string;
|
|
34
|
-
port: number;
|
|
35
|
-
database: string;
|
|
36
|
-
user: string;
|
|
37
|
-
password: string;
|
|
38
|
-
options?: sql.IOptions;
|
|
39
|
-
} | {
|
|
40
|
-
connectionString: string;
|
|
41
|
-
});
|
|
42
|
-
export { MSSQLConfigType }
|
|
43
|
-
export { MSSQLConfigType as MSSQLConfigType_alias_1 }
|
|
44
|
-
|
|
45
|
-
declare class MSSQLStore extends MastraStorage {
|
|
46
|
-
pool: sql.ConnectionPool;
|
|
47
|
-
private schema?;
|
|
48
|
-
private setupSchemaPromise;
|
|
49
|
-
private schemaSetupComplete;
|
|
50
|
-
private isConnected;
|
|
51
|
-
constructor(config: MSSQLConfigType);
|
|
52
|
-
init(): Promise<void>;
|
|
53
|
-
private _performInitializationAndStore;
|
|
54
|
-
get supports(): {
|
|
55
|
-
selectByIncludeResourceScope: boolean;
|
|
56
|
-
resourceWorkingMemory: boolean;
|
|
57
|
-
hasColumn: boolean;
|
|
58
|
-
createTable: boolean;
|
|
59
|
-
deleteMessages: boolean;
|
|
60
|
-
};
|
|
61
|
-
private getTableName;
|
|
62
|
-
private getSchemaName;
|
|
63
|
-
private transformEvalRow;
|
|
64
|
-
/** @deprecated use getEvals instead */
|
|
65
|
-
getEvalsByAgentName(agentName: string, type?: 'test' | 'live'): Promise<EvalRow[]>;
|
|
66
|
-
batchInsert({ tableName, records }: {
|
|
67
|
-
tableName: TABLE_NAMES;
|
|
68
|
-
records: Record<string, any>[];
|
|
69
|
-
}): Promise<void>;
|
|
70
|
-
/** @deprecated use getTracesPaginated instead*/
|
|
71
|
-
getTraces(args: {
|
|
72
|
-
name?: string;
|
|
73
|
-
scope?: string;
|
|
74
|
-
attributes?: Record<string, string>;
|
|
75
|
-
filters?: Record<string, any>;
|
|
76
|
-
page: number;
|
|
77
|
-
perPage?: number;
|
|
78
|
-
fromDate?: Date;
|
|
79
|
-
toDate?: Date;
|
|
80
|
-
}): Promise<any[]>;
|
|
81
|
-
getTracesPaginated(args: {
|
|
82
|
-
name?: string;
|
|
83
|
-
scope?: string;
|
|
84
|
-
attributes?: Record<string, string>;
|
|
85
|
-
filters?: Record<string, any>;
|
|
86
|
-
} & PaginationArgs): Promise<PaginationInfo & {
|
|
87
|
-
traces: any[];
|
|
88
|
-
}>;
|
|
89
|
-
private setupSchema;
|
|
90
|
-
protected getSqlType(type: StorageColumn['type'], isPrimaryKey?: boolean): string;
|
|
91
|
-
createTable({ tableName, schema, }: {
|
|
92
|
-
tableName: TABLE_NAMES;
|
|
93
|
-
schema: Record<string, StorageColumn>;
|
|
94
|
-
}): Promise<void>;
|
|
95
|
-
protected getDefaultValue(type: StorageColumn['type']): string;
|
|
96
|
-
alterTable({ tableName, schema, ifNotExists, }: {
|
|
97
|
-
tableName: TABLE_NAMES;
|
|
98
|
-
schema: Record<string, StorageColumn>;
|
|
99
|
-
ifNotExists: string[];
|
|
100
|
-
}): Promise<void>;
|
|
101
|
-
clearTable({ tableName }: {
|
|
102
|
-
tableName: TABLE_NAMES;
|
|
103
|
-
}): Promise<void>;
|
|
104
|
-
insert({ tableName, record }: {
|
|
105
|
-
tableName: TABLE_NAMES;
|
|
106
|
-
record: Record<string, any>;
|
|
107
|
-
}): Promise<void>;
|
|
108
|
-
load<R>({ tableName, keys }: {
|
|
109
|
-
tableName: TABLE_NAMES;
|
|
110
|
-
keys: Record<string, string>;
|
|
111
|
-
}): Promise<R | null>;
|
|
112
|
-
getThreadById({ threadId }: {
|
|
113
|
-
threadId: string;
|
|
114
|
-
}): Promise<StorageThreadType | null>;
|
|
115
|
-
getThreadsByResourceIdPaginated(args: {
|
|
116
|
-
resourceId: string;
|
|
117
|
-
} & PaginationArgs): Promise<PaginationInfo & {
|
|
118
|
-
threads: StorageThreadType[];
|
|
119
|
-
}>;
|
|
120
|
-
saveThread({ thread }: {
|
|
121
|
-
thread: StorageThreadType;
|
|
122
|
-
}): Promise<StorageThreadType>;
|
|
123
|
-
/**
|
|
124
|
-
* @deprecated use getThreadsByResourceIdPaginated instead
|
|
125
|
-
*/
|
|
126
|
-
getThreadsByResourceId(args: {
|
|
127
|
-
resourceId: string;
|
|
128
|
-
}): Promise<StorageThreadType[]>;
|
|
129
|
-
/**
|
|
130
|
-
* Updates a thread's title and metadata, merging with existing metadata. Returns the updated thread.
|
|
131
|
-
*/
|
|
132
|
-
updateThread({ id, title, metadata, }: {
|
|
133
|
-
id: string;
|
|
134
|
-
title: string;
|
|
135
|
-
metadata: Record<string, unknown>;
|
|
136
|
-
}): Promise<StorageThreadType>;
|
|
137
|
-
deleteThread({ threadId }: {
|
|
138
|
-
threadId: string;
|
|
139
|
-
}): Promise<void>;
|
|
140
|
-
private _getIncludedMessages;
|
|
141
|
-
/**
|
|
142
|
-
* @deprecated use getMessagesPaginated instead
|
|
143
|
-
*/
|
|
144
|
-
getMessages(args: StorageGetMessagesArg & {
|
|
145
|
-
format?: 'v1';
|
|
146
|
-
}): Promise<MastraMessageV1[]>;
|
|
147
|
-
getMessages(args: StorageGetMessagesArg & {
|
|
148
|
-
format: 'v2';
|
|
149
|
-
}): Promise<MastraMessageV2[]>;
|
|
150
|
-
getMessagesPaginated(args: StorageGetMessagesArg & {
|
|
151
|
-
format?: 'v1' | 'v2';
|
|
152
|
-
}): Promise<PaginationInfo & {
|
|
153
|
-
messages: MastraMessageV1[] | MastraMessageV2[];
|
|
154
|
-
}>;
|
|
155
|
-
private _parseAndFormatMessages;
|
|
156
|
-
saveMessages(args: {
|
|
157
|
-
messages: MastraMessageV1[];
|
|
158
|
-
format?: undefined | 'v1';
|
|
159
|
-
}): Promise<MastraMessageV1[]>;
|
|
160
|
-
saveMessages(args: {
|
|
161
|
-
messages: MastraMessageV2[];
|
|
162
|
-
format: 'v2';
|
|
163
|
-
}): Promise<MastraMessageV2[]>;
|
|
164
|
-
persistWorkflowSnapshot({ workflowName, runId, snapshot, }: {
|
|
165
|
-
workflowName: string;
|
|
166
|
-
runId: string;
|
|
167
|
-
snapshot: WorkflowRunState;
|
|
168
|
-
}): Promise<void>;
|
|
169
|
-
loadWorkflowSnapshot({ workflowName, runId, }: {
|
|
170
|
-
workflowName: string;
|
|
171
|
-
runId: string;
|
|
172
|
-
}): Promise<WorkflowRunState | null>;
|
|
173
|
-
private hasColumn;
|
|
174
|
-
private parseWorkflowRun;
|
|
175
|
-
getWorkflowRuns({ workflowName, fromDate, toDate, limit, offset, resourceId, }?: {
|
|
176
|
-
workflowName?: string;
|
|
177
|
-
fromDate?: Date;
|
|
178
|
-
toDate?: Date;
|
|
179
|
-
limit?: number;
|
|
180
|
-
offset?: number;
|
|
181
|
-
resourceId?: string;
|
|
182
|
-
}): Promise<WorkflowRuns>;
|
|
183
|
-
getWorkflowRunById({ runId, workflowName, }: {
|
|
184
|
-
runId: string;
|
|
185
|
-
workflowName?: string;
|
|
186
|
-
}): Promise<WorkflowRun | null>;
|
|
187
|
-
updateMessages({ messages, }: {
|
|
188
|
-
messages: (Partial<Omit<MastraMessageV2, 'createdAt'>> & {
|
|
189
|
-
id: string;
|
|
190
|
-
content?: {
|
|
191
|
-
metadata?: MastraMessageContentV2['metadata'];
|
|
192
|
-
content?: MastraMessageContentV2['content'];
|
|
193
|
-
};
|
|
194
|
-
})[];
|
|
195
|
-
}): Promise<MastraMessageV2[]>;
|
|
196
|
-
close(): Promise<void>;
|
|
197
|
-
getEvals(options?: {
|
|
198
|
-
agentName?: string;
|
|
199
|
-
type?: 'test' | 'live';
|
|
200
|
-
} & PaginationArgs): Promise<PaginationInfo & {
|
|
201
|
-
evals: EvalRow[];
|
|
202
|
-
}>;
|
|
203
|
-
saveResource({ resource }: {
|
|
204
|
-
resource: StorageResourceType;
|
|
205
|
-
}): Promise<StorageResourceType>;
|
|
206
|
-
updateResource({ resourceId, workingMemory, metadata, }: {
|
|
207
|
-
resourceId: string;
|
|
208
|
-
workingMemory?: string;
|
|
209
|
-
metadata?: Record<string, unknown>;
|
|
210
|
-
}): Promise<StorageResourceType>;
|
|
211
|
-
getResourceById({ resourceId }: {
|
|
212
|
-
resourceId: string;
|
|
213
|
-
}): Promise<StorageResourceType | null>;
|
|
214
|
-
getScoreById({ id }: {
|
|
215
|
-
id: string;
|
|
216
|
-
}): Promise<ScoreRowData | null>;
|
|
217
|
-
saveScore(_score: Omit<ScoreRowData, 'id' | 'createdAt' | 'updatedAt'>): Promise<{
|
|
218
|
-
score: ScoreRowData;
|
|
219
|
-
}>;
|
|
220
|
-
getScoresByScorerId({ scorerId, pagination: _pagination, entityId, entityType, }: {
|
|
221
|
-
scorerId: string;
|
|
222
|
-
pagination: StoragePagination;
|
|
223
|
-
entityId?: string;
|
|
224
|
-
entityType?: string;
|
|
225
|
-
}): Promise<{
|
|
226
|
-
pagination: PaginationInfo;
|
|
227
|
-
scores: ScoreRowData[];
|
|
228
|
-
}>;
|
|
229
|
-
getScoresByRunId({ runId, pagination: _pagination, }: {
|
|
230
|
-
runId: string;
|
|
231
|
-
pagination: StoragePagination;
|
|
232
|
-
}): Promise<{
|
|
233
|
-
pagination: PaginationInfo;
|
|
234
|
-
scores: ScoreRowData[];
|
|
235
|
-
}>;
|
|
236
|
-
getScoresByEntityId({ entityId, entityType, pagination: _pagination, }: {
|
|
237
|
-
pagination: StoragePagination;
|
|
238
|
-
entityId: string;
|
|
239
|
-
entityType: string;
|
|
240
|
-
}): Promise<{
|
|
241
|
-
pagination: PaginationInfo;
|
|
242
|
-
scores: ScoreRowData[];
|
|
243
|
-
}>;
|
|
244
|
-
dropTable({ tableName }: {
|
|
245
|
-
tableName: TABLE_NAMES;
|
|
246
|
-
}): Promise<void>;
|
|
247
|
-
}
|
|
248
|
-
export { MSSQLStore }
|
|
249
|
-
export { MSSQLStore as MSSQLStore_alias_1 }
|
|
250
|
-
|
|
251
|
-
export { }
|
package/dist/index.d.cts
DELETED