@mastra/mssql 1.0.0-beta.2 → 1.0.0-beta.4
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 +56 -0
- package/dist/index.cjs +130 -105
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +131 -106
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/memory/index.d.ts.map +1 -1
- package/dist/storage/domains/observability/index.d.ts.map +1 -1
- package/dist/storage/domains/operations/index.d.ts.map +1 -1
- package/dist/storage/domains/scores/index.d.ts.map +1 -1
- package/dist/storage/domains/utils.d.ts.map +1 -1
- package/dist/storage/domains/workflows/index.d.ts.map +1 -1
- package/dist/storage/index.d.ts +20 -0
- package/dist/storage/index.d.ts.map +1 -1
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MastraError, ErrorCategory, ErrorDomain } from '@mastra/core/error';
|
|
2
|
-
import { MastraStorage, StoreOperations, TABLE_WORKFLOW_SNAPSHOT, TABLE_SCHEMAS, TABLE_THREADS, TABLE_MESSAGES, TABLE_TRACES, TABLE_SCORERS, TABLE_SPANS, ScoresStorage, normalizePerPage, calculatePagination, WorkflowsStorage, MemoryStorage, TABLE_RESOURCES, ObservabilityStorage,
|
|
2
|
+
import { MastraStorage, createStorageErrorId, StoreOperations, TABLE_WORKFLOW_SNAPSHOT, TABLE_SCHEMAS, TABLE_THREADS, TABLE_MESSAGES, TABLE_TRACES, TABLE_SCORERS, TABLE_SPANS, ScoresStorage, normalizePerPage, calculatePagination, WorkflowsStorage, MemoryStorage, TABLE_RESOURCES, ObservabilityStorage, transformScoreRow as transformScoreRow$1 } from '@mastra/core/storage';
|
|
3
3
|
import sql2 from 'mssql';
|
|
4
4
|
import { MessageList } from '@mastra/core/agent';
|
|
5
5
|
import { parseSqlIdentifier } from '@mastra/core/utils';
|
|
@@ -26,24 +26,62 @@ function buildDateRangeFilter(dateRange, fieldName) {
|
|
|
26
26
|
}
|
|
27
27
|
return filters;
|
|
28
28
|
}
|
|
29
|
+
function isInOperator(value) {
|
|
30
|
+
return typeof value === "object" && value !== null && "$in" in value && Array.isArray(value.$in);
|
|
31
|
+
}
|
|
29
32
|
function prepareWhereClause(filters, _schema) {
|
|
30
33
|
const conditions = [];
|
|
31
34
|
const params = {};
|
|
32
35
|
let paramIndex = 1;
|
|
33
36
|
Object.entries(filters).forEach(([key, value]) => {
|
|
34
37
|
if (value === void 0) return;
|
|
35
|
-
const paramName = `p${paramIndex++}`;
|
|
36
38
|
if (key.endsWith("_gte")) {
|
|
39
|
+
const paramName = `p${paramIndex++}`;
|
|
37
40
|
const fieldName = key.slice(0, -4);
|
|
38
41
|
conditions.push(`[${parseSqlIdentifier(fieldName, "field name")}] >= @${paramName}`);
|
|
39
42
|
params[paramName] = value instanceof Date ? value.toISOString() : value;
|
|
40
43
|
} else if (key.endsWith("_lte")) {
|
|
44
|
+
const paramName = `p${paramIndex++}`;
|
|
41
45
|
const fieldName = key.slice(0, -4);
|
|
42
46
|
conditions.push(`[${parseSqlIdentifier(fieldName, "field name")}] <= @${paramName}`);
|
|
43
47
|
params[paramName] = value instanceof Date ? value.toISOString() : value;
|
|
44
48
|
} else if (value === null) {
|
|
45
49
|
conditions.push(`[${parseSqlIdentifier(key, "field name")}] IS NULL`);
|
|
50
|
+
} else if (isInOperator(value)) {
|
|
51
|
+
const inValues = value.$in;
|
|
52
|
+
if (inValues.length === 0) {
|
|
53
|
+
conditions.push("1 = 0");
|
|
54
|
+
} else if (inValues.length === 1) {
|
|
55
|
+
const paramName = `p${paramIndex++}`;
|
|
56
|
+
conditions.push(`[${parseSqlIdentifier(key, "field name")}] = @${paramName}`);
|
|
57
|
+
params[paramName] = inValues[0] instanceof Date ? inValues[0].toISOString() : inValues[0];
|
|
58
|
+
} else {
|
|
59
|
+
const inParamNames = [];
|
|
60
|
+
for (const item of inValues) {
|
|
61
|
+
const paramName = `p${paramIndex++}`;
|
|
62
|
+
inParamNames.push(`@${paramName}`);
|
|
63
|
+
params[paramName] = item instanceof Date ? item.toISOString() : item;
|
|
64
|
+
}
|
|
65
|
+
conditions.push(`[${parseSqlIdentifier(key, "field name")}] IN (${inParamNames.join(", ")})`);
|
|
66
|
+
}
|
|
67
|
+
} else if (Array.isArray(value)) {
|
|
68
|
+
if (value.length === 0) {
|
|
69
|
+
conditions.push("1 = 0");
|
|
70
|
+
} else if (value.length === 1) {
|
|
71
|
+
const paramName = `p${paramIndex++}`;
|
|
72
|
+
conditions.push(`[${parseSqlIdentifier(key, "field name")}] = @${paramName}`);
|
|
73
|
+
params[paramName] = value[0] instanceof Date ? value[0].toISOString() : value[0];
|
|
74
|
+
} else {
|
|
75
|
+
const inParamNames = [];
|
|
76
|
+
for (const item of value) {
|
|
77
|
+
const paramName = `p${paramIndex++}`;
|
|
78
|
+
inParamNames.push(`@${paramName}`);
|
|
79
|
+
params[paramName] = item instanceof Date ? item.toISOString() : item;
|
|
80
|
+
}
|
|
81
|
+
conditions.push(`[${parseSqlIdentifier(key, "field name")}] IN (${inParamNames.join(", ")})`);
|
|
82
|
+
}
|
|
46
83
|
} else {
|
|
84
|
+
const paramName = `p${paramIndex++}`;
|
|
47
85
|
conditions.push(`[${parseSqlIdentifier(key, "field name")}] = @${paramName}`);
|
|
48
86
|
params[paramName] = value instanceof Date ? value.toISOString() : value;
|
|
49
87
|
}
|
|
@@ -137,7 +175,7 @@ var MemoryMSSQL = class extends MemoryStorage {
|
|
|
137
175
|
} catch (error) {
|
|
138
176
|
throw new MastraError(
|
|
139
177
|
{
|
|
140
|
-
id: "
|
|
178
|
+
id: createStorageErrorId("MSSQL", "GET_THREAD_BY_ID", "FAILED"),
|
|
141
179
|
domain: ErrorDomain.STORAGE,
|
|
142
180
|
category: ErrorCategory.THIRD_PARTY,
|
|
143
181
|
details: {
|
|
@@ -152,7 +190,7 @@ var MemoryMSSQL = class extends MemoryStorage {
|
|
|
152
190
|
const { resourceId, page = 0, perPage: perPageInput, orderBy } = args;
|
|
153
191
|
if (page < 0) {
|
|
154
192
|
throw new MastraError({
|
|
155
|
-
id: "
|
|
193
|
+
id: createStorageErrorId("MSSQL", "LIST_THREADS_BY_RESOURCE_ID", "INVALID_PAGE"),
|
|
156
194
|
domain: ErrorDomain.STORAGE,
|
|
157
195
|
category: ErrorCategory.USER,
|
|
158
196
|
text: "Page number must be non-negative",
|
|
@@ -211,7 +249,7 @@ var MemoryMSSQL = class extends MemoryStorage {
|
|
|
211
249
|
} catch (error) {
|
|
212
250
|
const mastraError = new MastraError(
|
|
213
251
|
{
|
|
214
|
-
id: "
|
|
252
|
+
id: createStorageErrorId("MSSQL", "LIST_THREADS_BY_RESOURCE_ID", "FAILED"),
|
|
215
253
|
domain: ErrorDomain.STORAGE,
|
|
216
254
|
category: ErrorCategory.THIRD_PARTY,
|
|
217
255
|
details: {
|
|
@@ -264,7 +302,7 @@ var MemoryMSSQL = class extends MemoryStorage {
|
|
|
264
302
|
} catch (error) {
|
|
265
303
|
throw new MastraError(
|
|
266
304
|
{
|
|
267
|
-
id: "
|
|
305
|
+
id: createStorageErrorId("MSSQL", "SAVE_THREAD", "FAILED"),
|
|
268
306
|
domain: ErrorDomain.STORAGE,
|
|
269
307
|
category: ErrorCategory.THIRD_PARTY,
|
|
270
308
|
details: {
|
|
@@ -286,7 +324,7 @@ var MemoryMSSQL = class extends MemoryStorage {
|
|
|
286
324
|
const existingThread = await this.getThreadById({ threadId: id });
|
|
287
325
|
if (!existingThread) {
|
|
288
326
|
throw new MastraError({
|
|
289
|
-
id: "
|
|
327
|
+
id: createStorageErrorId("MSSQL", "UPDATE_THREAD", "NOT_FOUND"),
|
|
290
328
|
domain: ErrorDomain.STORAGE,
|
|
291
329
|
category: ErrorCategory.USER,
|
|
292
330
|
text: `Thread ${id} not found`,
|
|
@@ -321,7 +359,7 @@ var MemoryMSSQL = class extends MemoryStorage {
|
|
|
321
359
|
}
|
|
322
360
|
if (!thread) {
|
|
323
361
|
throw new MastraError({
|
|
324
|
-
id: "
|
|
362
|
+
id: createStorageErrorId("MSSQL", "UPDATE_THREAD", "NOT_FOUND"),
|
|
325
363
|
domain: ErrorDomain.STORAGE,
|
|
326
364
|
category: ErrorCategory.USER,
|
|
327
365
|
text: `Thread ${id} not found after update`,
|
|
@@ -340,7 +378,7 @@ var MemoryMSSQL = class extends MemoryStorage {
|
|
|
340
378
|
} catch (error) {
|
|
341
379
|
throw new MastraError(
|
|
342
380
|
{
|
|
343
|
-
id: "
|
|
381
|
+
id: createStorageErrorId("MSSQL", "UPDATE_THREAD", "FAILED"),
|
|
344
382
|
domain: ErrorDomain.STORAGE,
|
|
345
383
|
category: ErrorCategory.THIRD_PARTY,
|
|
346
384
|
details: {
|
|
@@ -370,7 +408,7 @@ var MemoryMSSQL = class extends MemoryStorage {
|
|
|
370
408
|
});
|
|
371
409
|
throw new MastraError(
|
|
372
410
|
{
|
|
373
|
-
id: "
|
|
411
|
+
id: createStorageErrorId("MSSQL", "DELETE_THREAD", "FAILED"),
|
|
374
412
|
domain: ErrorDomain.STORAGE,
|
|
375
413
|
category: ErrorCategory.THIRD_PARTY,
|
|
376
414
|
details: {
|
|
@@ -381,23 +419,18 @@ var MemoryMSSQL = class extends MemoryStorage {
|
|
|
381
419
|
);
|
|
382
420
|
}
|
|
383
421
|
}
|
|
384
|
-
async _getIncludedMessages({
|
|
385
|
-
|
|
386
|
-
include
|
|
387
|
-
}) {
|
|
388
|
-
if (!threadId.trim()) throw new Error("threadId must be a non-empty string");
|
|
389
|
-
if (!include) return null;
|
|
422
|
+
async _getIncludedMessages({ include }) {
|
|
423
|
+
if (!include || include.length === 0) return null;
|
|
390
424
|
const unionQueries = [];
|
|
391
425
|
const paramValues = [];
|
|
392
426
|
let paramIdx = 1;
|
|
393
427
|
const paramNames = [];
|
|
428
|
+
const tableName = getTableName({ indexName: TABLE_MESSAGES, schemaName: getSchemaName(this.schema) });
|
|
394
429
|
for (const inc of include) {
|
|
395
430
|
const { id, withPreviousMessages = 0, withNextMessages = 0 } = inc;
|
|
396
|
-
const
|
|
397
|
-
const
|
|
398
|
-
const
|
|
399
|
-
const pPrev = `@p${paramIdx + 2}`;
|
|
400
|
-
const pNext = `@p${paramIdx + 3}`;
|
|
431
|
+
const pId = `@p${paramIdx}`;
|
|
432
|
+
const pPrev = `@p${paramIdx + 1}`;
|
|
433
|
+
const pNext = `@p${paramIdx + 2}`;
|
|
401
434
|
unionQueries.push(
|
|
402
435
|
`
|
|
403
436
|
SELECT
|
|
@@ -411,16 +444,16 @@ var MemoryMSSQL = class extends MemoryStorage {
|
|
|
411
444
|
m.seq_id
|
|
412
445
|
FROM (
|
|
413
446
|
SELECT *, ROW_NUMBER() OVER (ORDER BY [createdAt] ASC) as row_num
|
|
414
|
-
FROM ${
|
|
415
|
-
WHERE [thread_id] = ${
|
|
447
|
+
FROM ${tableName}
|
|
448
|
+
WHERE [thread_id] = (SELECT thread_id FROM ${tableName} WHERE id = ${pId})
|
|
416
449
|
) AS m
|
|
417
450
|
WHERE m.id = ${pId}
|
|
418
451
|
OR EXISTS (
|
|
419
452
|
SELECT 1
|
|
420
453
|
FROM (
|
|
421
454
|
SELECT *, ROW_NUMBER() OVER (ORDER BY [createdAt] ASC) as row_num
|
|
422
|
-
FROM ${
|
|
423
|
-
WHERE [thread_id] = ${
|
|
455
|
+
FROM ${tableName}
|
|
456
|
+
WHERE [thread_id] = (SELECT thread_id FROM ${tableName} WHERE id = ${pId})
|
|
424
457
|
) AS target
|
|
425
458
|
WHERE target.id = ${pId}
|
|
426
459
|
AND (
|
|
@@ -433,9 +466,9 @@ var MemoryMSSQL = class extends MemoryStorage {
|
|
|
433
466
|
)
|
|
434
467
|
`
|
|
435
468
|
);
|
|
436
|
-
paramValues.push(
|
|
437
|
-
paramNames.push(`p${paramIdx}`, `p${paramIdx + 1}`, `p${paramIdx + 2}
|
|
438
|
-
paramIdx +=
|
|
469
|
+
paramValues.push(id, withPreviousMessages, withNextMessages);
|
|
470
|
+
paramNames.push(`p${paramIdx}`, `p${paramIdx + 1}`, `p${paramIdx + 2}`);
|
|
471
|
+
paramIdx += 3;
|
|
439
472
|
}
|
|
440
473
|
const finalQuery = `
|
|
441
474
|
SELECT * FROM (
|
|
@@ -490,7 +523,7 @@ var MemoryMSSQL = class extends MemoryStorage {
|
|
|
490
523
|
} catch (error) {
|
|
491
524
|
const mastraError = new MastraError(
|
|
492
525
|
{
|
|
493
|
-
id: "
|
|
526
|
+
id: createStorageErrorId("MSSQL", "LIST_MESSAGES_BY_ID", "FAILED"),
|
|
494
527
|
domain: ErrorDomain.STORAGE,
|
|
495
528
|
category: ErrorCategory.THIRD_PARTY,
|
|
496
529
|
details: {
|
|
@@ -506,25 +539,26 @@ var MemoryMSSQL = class extends MemoryStorage {
|
|
|
506
539
|
}
|
|
507
540
|
async listMessages(args) {
|
|
508
541
|
const { threadId, resourceId, include, filter, perPage: perPageInput, page = 0, orderBy } = args;
|
|
509
|
-
|
|
542
|
+
const threadIds = Array.isArray(threadId) ? threadId : [threadId];
|
|
543
|
+
if (threadIds.length === 0 || threadIds.some((id) => !id.trim())) {
|
|
510
544
|
throw new MastraError(
|
|
511
545
|
{
|
|
512
|
-
id: "
|
|
546
|
+
id: createStorageErrorId("MSSQL", "LIST_MESSAGES", "INVALID_THREAD_ID"),
|
|
513
547
|
domain: ErrorDomain.STORAGE,
|
|
514
548
|
category: ErrorCategory.THIRD_PARTY,
|
|
515
|
-
details: { threadId }
|
|
549
|
+
details: { threadId: Array.isArray(threadId) ? threadId.join(",") : threadId }
|
|
516
550
|
},
|
|
517
|
-
new Error("threadId must be a non-empty string")
|
|
551
|
+
new Error("threadId must be a non-empty string or array of non-empty strings")
|
|
518
552
|
);
|
|
519
553
|
}
|
|
520
554
|
if (page < 0) {
|
|
521
555
|
throw new MastraError({
|
|
522
|
-
id: "
|
|
556
|
+
id: createStorageErrorId("MSSQL", "LIST_MESSAGES", "INVALID_PAGE"),
|
|
523
557
|
domain: ErrorDomain.STORAGE,
|
|
524
558
|
category: ErrorCategory.USER,
|
|
525
559
|
text: "Page number must be non-negative",
|
|
526
560
|
details: {
|
|
527
|
-
threadId,
|
|
561
|
+
threadId: Array.isArray(threadId) ? threadId.join(",") : threadId,
|
|
528
562
|
page
|
|
529
563
|
}
|
|
530
564
|
});
|
|
@@ -537,7 +571,7 @@ var MemoryMSSQL = class extends MemoryStorage {
|
|
|
537
571
|
const tableName = getTableName({ indexName: TABLE_MESSAGES, schemaName: getSchemaName(this.schema) });
|
|
538
572
|
const baseQuery = `SELECT seq_id, id, content, role, type, [createdAt], thread_id AS threadId, resourceId FROM ${tableName}`;
|
|
539
573
|
const filters = {
|
|
540
|
-
thread_id:
|
|
574
|
+
thread_id: threadIds.length === 1 ? threadIds[0] : { $in: threadIds },
|
|
541
575
|
...resourceId ? { resourceId } : {},
|
|
542
576
|
...buildDateRangeFilter(filter?.dateRange, "createdAt")
|
|
543
577
|
};
|
|
@@ -581,7 +615,7 @@ var MemoryMSSQL = class extends MemoryStorage {
|
|
|
581
615
|
}
|
|
582
616
|
if (include?.length) {
|
|
583
617
|
const messageIds = new Set(messages.map((m) => m.id));
|
|
584
|
-
const includeMessages = await this._getIncludedMessages({
|
|
618
|
+
const includeMessages = await this._getIncludedMessages({ include });
|
|
585
619
|
includeMessages?.forEach((msg) => {
|
|
586
620
|
if (!messageIds.has(msg.id)) {
|
|
587
621
|
messages.push(msg);
|
|
@@ -604,7 +638,8 @@ var MemoryMSSQL = class extends MemoryStorage {
|
|
|
604
638
|
const seqB = seqById.get(b.id);
|
|
605
639
|
return seqA != null && seqB != null ? (seqA - seqB) * mult : a.id.localeCompare(b.id);
|
|
606
640
|
});
|
|
607
|
-
const
|
|
641
|
+
const threadIdSet = new Set(threadIds);
|
|
642
|
+
const returnedThreadMessageCount = finalMessages.filter((m) => m.threadId && threadIdSet.has(m.threadId)).length;
|
|
608
643
|
const hasMore = perPageInput !== false && returnedThreadMessageCount < total && offset + perPage < total;
|
|
609
644
|
return {
|
|
610
645
|
messages: finalMessages,
|
|
@@ -616,11 +651,11 @@ var MemoryMSSQL = class extends MemoryStorage {
|
|
|
616
651
|
} catch (error) {
|
|
617
652
|
const mastraError = new MastraError(
|
|
618
653
|
{
|
|
619
|
-
id: "
|
|
654
|
+
id: createStorageErrorId("MSSQL", "LIST_MESSAGES", "FAILED"),
|
|
620
655
|
domain: ErrorDomain.STORAGE,
|
|
621
656
|
category: ErrorCategory.THIRD_PARTY,
|
|
622
657
|
details: {
|
|
623
|
-
threadId,
|
|
658
|
+
threadId: Array.isArray(threadId) ? threadId.join(",") : threadId,
|
|
624
659
|
resourceId: resourceId ?? ""
|
|
625
660
|
}
|
|
626
661
|
},
|
|
@@ -642,7 +677,7 @@ var MemoryMSSQL = class extends MemoryStorage {
|
|
|
642
677
|
const threadId = messages[0]?.threadId;
|
|
643
678
|
if (!threadId) {
|
|
644
679
|
throw new MastraError({
|
|
645
|
-
id: "
|
|
680
|
+
id: createStorageErrorId("MSSQL", "SAVE_MESSAGES", "INVALID_THREAD_ID"),
|
|
646
681
|
domain: ErrorDomain.STORAGE,
|
|
647
682
|
category: ErrorCategory.THIRD_PARTY,
|
|
648
683
|
text: `Thread ID is required`
|
|
@@ -651,7 +686,7 @@ var MemoryMSSQL = class extends MemoryStorage {
|
|
|
651
686
|
const thread = await this.getThreadById({ threadId });
|
|
652
687
|
if (!thread) {
|
|
653
688
|
throw new MastraError({
|
|
654
|
-
id: "
|
|
689
|
+
id: createStorageErrorId("MSSQL", "SAVE_MESSAGES", "THREAD_NOT_FOUND"),
|
|
655
690
|
domain: ErrorDomain.STORAGE,
|
|
656
691
|
category: ErrorCategory.THIRD_PARTY,
|
|
657
692
|
text: `Thread ${threadId} not found`,
|
|
@@ -724,7 +759,7 @@ var MemoryMSSQL = class extends MemoryStorage {
|
|
|
724
759
|
} catch (error) {
|
|
725
760
|
throw new MastraError(
|
|
726
761
|
{
|
|
727
|
-
id: "
|
|
762
|
+
id: createStorageErrorId("MSSQL", "SAVE_MESSAGES", "FAILED"),
|
|
728
763
|
domain: ErrorDomain.STORAGE,
|
|
729
764
|
category: ErrorCategory.THIRD_PARTY,
|
|
730
765
|
details: { threadId }
|
|
@@ -815,7 +850,7 @@ var MemoryMSSQL = class extends MemoryStorage {
|
|
|
815
850
|
await transaction.rollback();
|
|
816
851
|
throw new MastraError(
|
|
817
852
|
{
|
|
818
|
-
id: "
|
|
853
|
+
id: createStorageErrorId("MSSQL", "UPDATE_MESSAGES", "FAILED"),
|
|
819
854
|
domain: ErrorDomain.STORAGE,
|
|
820
855
|
category: ErrorCategory.THIRD_PARTY
|
|
821
856
|
},
|
|
@@ -877,7 +912,7 @@ var MemoryMSSQL = class extends MemoryStorage {
|
|
|
877
912
|
} catch (error) {
|
|
878
913
|
throw new MastraError(
|
|
879
914
|
{
|
|
880
|
-
id: "
|
|
915
|
+
id: createStorageErrorId("MSSQL", "DELETE_MESSAGES", "FAILED"),
|
|
881
916
|
domain: ErrorDomain.STORAGE,
|
|
882
917
|
category: ErrorCategory.THIRD_PARTY,
|
|
883
918
|
details: { messageIds: messageIds.join(", ") }
|
|
@@ -905,7 +940,7 @@ var MemoryMSSQL = class extends MemoryStorage {
|
|
|
905
940
|
} catch (error) {
|
|
906
941
|
const mastraError = new MastraError(
|
|
907
942
|
{
|
|
908
|
-
id: "
|
|
943
|
+
id: createStorageErrorId("MSSQL", "GET_RESOURCE_BY_ID", "FAILED"),
|
|
909
944
|
domain: ErrorDomain.STORAGE,
|
|
910
945
|
category: ErrorCategory.THIRD_PARTY,
|
|
911
946
|
details: { resourceId }
|
|
@@ -972,7 +1007,7 @@ var MemoryMSSQL = class extends MemoryStorage {
|
|
|
972
1007
|
} catch (error) {
|
|
973
1008
|
const mastraError = new MastraError(
|
|
974
1009
|
{
|
|
975
|
-
id: "
|
|
1010
|
+
id: createStorageErrorId("MSSQL", "UPDATE_RESOURCE", "FAILED"),
|
|
976
1011
|
domain: ErrorDomain.STORAGE,
|
|
977
1012
|
category: ErrorCategory.THIRD_PARTY,
|
|
978
1013
|
details: { resourceId }
|
|
@@ -1019,7 +1054,7 @@ var ObservabilityMSSQL = class extends ObservabilityStorage {
|
|
|
1019
1054
|
} catch (error) {
|
|
1020
1055
|
throw new MastraError(
|
|
1021
1056
|
{
|
|
1022
|
-
id: "
|
|
1057
|
+
id: createStorageErrorId("MSSQL", "CREATE_SPAN", "FAILED"),
|
|
1023
1058
|
domain: ErrorDomain.STORAGE,
|
|
1024
1059
|
category: ErrorCategory.USER,
|
|
1025
1060
|
details: {
|
|
@@ -1065,7 +1100,7 @@ var ObservabilityMSSQL = class extends ObservabilityStorage {
|
|
|
1065
1100
|
} catch (error) {
|
|
1066
1101
|
throw new MastraError(
|
|
1067
1102
|
{
|
|
1068
|
-
id: "
|
|
1103
|
+
id: createStorageErrorId("MSSQL", "GET_TRACE", "FAILED"),
|
|
1069
1104
|
domain: ErrorDomain.STORAGE,
|
|
1070
1105
|
category: ErrorCategory.USER,
|
|
1071
1106
|
details: {
|
|
@@ -1097,7 +1132,7 @@ var ObservabilityMSSQL = class extends ObservabilityStorage {
|
|
|
1097
1132
|
} catch (error) {
|
|
1098
1133
|
throw new MastraError(
|
|
1099
1134
|
{
|
|
1100
|
-
id: "
|
|
1135
|
+
id: createStorageErrorId("MSSQL", "UPDATE_SPAN", "FAILED"),
|
|
1101
1136
|
domain: ErrorDomain.STORAGE,
|
|
1102
1137
|
category: ErrorCategory.USER,
|
|
1103
1138
|
details: {
|
|
@@ -1134,7 +1169,7 @@ var ObservabilityMSSQL = class extends ObservabilityStorage {
|
|
|
1134
1169
|
name = `agent run: '${entityId}'`;
|
|
1135
1170
|
} else {
|
|
1136
1171
|
const error = new MastraError({
|
|
1137
|
-
id: "
|
|
1172
|
+
id: createStorageErrorId("MSSQL", "GET_TRACES_PAGINATED", "INVALID_ENTITY_TYPE"),
|
|
1138
1173
|
domain: ErrorDomain.STORAGE,
|
|
1139
1174
|
category: ErrorCategory.USER,
|
|
1140
1175
|
details: {
|
|
@@ -1203,7 +1238,7 @@ var ObservabilityMSSQL = class extends ObservabilityStorage {
|
|
|
1203
1238
|
} catch (error) {
|
|
1204
1239
|
throw new MastraError(
|
|
1205
1240
|
{
|
|
1206
|
-
id: "
|
|
1241
|
+
id: createStorageErrorId("MSSQL", "GET_TRACES_PAGINATED", "FAILED"),
|
|
1207
1242
|
domain: ErrorDomain.STORAGE,
|
|
1208
1243
|
category: ErrorCategory.USER
|
|
1209
1244
|
},
|
|
@@ -1227,7 +1262,7 @@ var ObservabilityMSSQL = class extends ObservabilityStorage {
|
|
|
1227
1262
|
} catch (error) {
|
|
1228
1263
|
throw new MastraError(
|
|
1229
1264
|
{
|
|
1230
|
-
id: "
|
|
1265
|
+
id: createStorageErrorId("MSSQL", "BATCH_CREATE_SPANS", "FAILED"),
|
|
1231
1266
|
domain: ErrorDomain.STORAGE,
|
|
1232
1267
|
category: ErrorCategory.USER,
|
|
1233
1268
|
details: {
|
|
@@ -1263,7 +1298,7 @@ var ObservabilityMSSQL = class extends ObservabilityStorage {
|
|
|
1263
1298
|
} catch (error) {
|
|
1264
1299
|
throw new MastraError(
|
|
1265
1300
|
{
|
|
1266
|
-
id: "
|
|
1301
|
+
id: createStorageErrorId("MSSQL", "BATCH_UPDATE_SPANS", "FAILED"),
|
|
1267
1302
|
domain: ErrorDomain.STORAGE,
|
|
1268
1303
|
category: ErrorCategory.USER,
|
|
1269
1304
|
details: {
|
|
@@ -1287,7 +1322,7 @@ var ObservabilityMSSQL = class extends ObservabilityStorage {
|
|
|
1287
1322
|
} catch (error) {
|
|
1288
1323
|
throw new MastraError(
|
|
1289
1324
|
{
|
|
1290
|
-
id: "
|
|
1325
|
+
id: createStorageErrorId("MSSQL", "BATCH_DELETE_TRACES", "FAILED"),
|
|
1291
1326
|
domain: ErrorDomain.STORAGE,
|
|
1292
1327
|
category: ErrorCategory.USER,
|
|
1293
1328
|
details: {
|
|
@@ -1327,7 +1362,7 @@ var StoreOperationsMSSQL = class extends StoreOperations {
|
|
|
1327
1362
|
return "BIT";
|
|
1328
1363
|
default:
|
|
1329
1364
|
throw new MastraError({
|
|
1330
|
-
id: "
|
|
1365
|
+
id: createStorageErrorId("MSSQL", "TYPE", "NOT_SUPPORTED"),
|
|
1331
1366
|
domain: ErrorDomain.STORAGE,
|
|
1332
1367
|
category: ErrorCategory.THIRD_PARTY
|
|
1333
1368
|
});
|
|
@@ -1413,7 +1448,7 @@ var StoreOperationsMSSQL = class extends StoreOperations {
|
|
|
1413
1448
|
} catch (error) {
|
|
1414
1449
|
throw new MastraError(
|
|
1415
1450
|
{
|
|
1416
|
-
id: "
|
|
1451
|
+
id: createStorageErrorId("MSSQL", "INSERT", "FAILED"),
|
|
1417
1452
|
domain: ErrorDomain.STORAGE,
|
|
1418
1453
|
category: ErrorCategory.THIRD_PARTY,
|
|
1419
1454
|
details: {
|
|
@@ -1439,7 +1474,7 @@ var StoreOperationsMSSQL = class extends StoreOperations {
|
|
|
1439
1474
|
} catch (error) {
|
|
1440
1475
|
throw new MastraError(
|
|
1441
1476
|
{
|
|
1442
|
-
id: "
|
|
1477
|
+
id: createStorageErrorId("MSSQL", "CLEAR_TABLE", "FAILED"),
|
|
1443
1478
|
domain: ErrorDomain.STORAGE,
|
|
1444
1479
|
category: ErrorCategory.THIRD_PARTY,
|
|
1445
1480
|
details: {
|
|
@@ -1542,7 +1577,7 @@ ${columns}
|
|
|
1542
1577
|
} catch (error) {
|
|
1543
1578
|
throw new MastraError(
|
|
1544
1579
|
{
|
|
1545
|
-
id: "
|
|
1580
|
+
id: createStorageErrorId("MSSQL", "CREATE_TABLE", "FAILED"),
|
|
1546
1581
|
domain: ErrorDomain.STORAGE,
|
|
1547
1582
|
category: ErrorCategory.THIRD_PARTY,
|
|
1548
1583
|
details: {
|
|
@@ -1602,7 +1637,7 @@ ${columns}
|
|
|
1602
1637
|
} catch (error) {
|
|
1603
1638
|
throw new MastraError(
|
|
1604
1639
|
{
|
|
1605
|
-
id: "
|
|
1640
|
+
id: createStorageErrorId("MSSQL", "ALTER_TABLE", "FAILED"),
|
|
1606
1641
|
domain: ErrorDomain.STORAGE,
|
|
1607
1642
|
category: ErrorCategory.THIRD_PARTY,
|
|
1608
1643
|
details: {
|
|
@@ -1643,7 +1678,7 @@ ${columns}
|
|
|
1643
1678
|
} catch (error) {
|
|
1644
1679
|
throw new MastraError(
|
|
1645
1680
|
{
|
|
1646
|
-
id: "
|
|
1681
|
+
id: createStorageErrorId("MSSQL", "LOAD", "FAILED"),
|
|
1647
1682
|
domain: ErrorDomain.STORAGE,
|
|
1648
1683
|
category: ErrorCategory.THIRD_PARTY,
|
|
1649
1684
|
details: {
|
|
@@ -1666,7 +1701,7 @@ ${columns}
|
|
|
1666
1701
|
await transaction.rollback();
|
|
1667
1702
|
throw new MastraError(
|
|
1668
1703
|
{
|
|
1669
|
-
id: "
|
|
1704
|
+
id: createStorageErrorId("MSSQL", "BATCH_INSERT", "FAILED"),
|
|
1670
1705
|
domain: ErrorDomain.STORAGE,
|
|
1671
1706
|
category: ErrorCategory.THIRD_PARTY,
|
|
1672
1707
|
details: {
|
|
@@ -1685,7 +1720,7 @@ ${columns}
|
|
|
1685
1720
|
} catch (error) {
|
|
1686
1721
|
throw new MastraError(
|
|
1687
1722
|
{
|
|
1688
|
-
id: "
|
|
1723
|
+
id: createStorageErrorId("MSSQL", "DROP_TABLE", "FAILED"),
|
|
1689
1724
|
domain: ErrorDomain.STORAGE,
|
|
1690
1725
|
category: ErrorCategory.THIRD_PARTY,
|
|
1691
1726
|
details: {
|
|
@@ -1771,7 +1806,7 @@ ${columns}
|
|
|
1771
1806
|
try {
|
|
1772
1807
|
if (!data || Object.keys(data).length === 0) {
|
|
1773
1808
|
throw new MastraError({
|
|
1774
|
-
id: "
|
|
1809
|
+
id: createStorageErrorId("MSSQL", "UPDATE", "EMPTY_DATA"),
|
|
1775
1810
|
domain: ErrorDomain.STORAGE,
|
|
1776
1811
|
category: ErrorCategory.USER,
|
|
1777
1812
|
text: "Cannot update with empty data payload"
|
|
@@ -1779,7 +1814,7 @@ ${columns}
|
|
|
1779
1814
|
}
|
|
1780
1815
|
if (!keys || Object.keys(keys).length === 0) {
|
|
1781
1816
|
throw new MastraError({
|
|
1782
|
-
id: "
|
|
1817
|
+
id: createStorageErrorId("MSSQL", "UPDATE", "EMPTY_KEYS"),
|
|
1783
1818
|
domain: ErrorDomain.STORAGE,
|
|
1784
1819
|
category: ErrorCategory.USER,
|
|
1785
1820
|
text: "Cannot update without keys to identify records"
|
|
@@ -1820,7 +1855,7 @@ ${columns}
|
|
|
1820
1855
|
} catch (error) {
|
|
1821
1856
|
throw new MastraError(
|
|
1822
1857
|
{
|
|
1823
|
-
id: "
|
|
1858
|
+
id: createStorageErrorId("MSSQL", "UPDATE", "FAILED"),
|
|
1824
1859
|
domain: ErrorDomain.STORAGE,
|
|
1825
1860
|
category: ErrorCategory.THIRD_PARTY,
|
|
1826
1861
|
details: {
|
|
@@ -1849,7 +1884,7 @@ ${columns}
|
|
|
1849
1884
|
await transaction.rollback();
|
|
1850
1885
|
throw new MastraError(
|
|
1851
1886
|
{
|
|
1852
|
-
id: "
|
|
1887
|
+
id: createStorageErrorId("MSSQL", "BATCH_UPDATE", "FAILED"),
|
|
1853
1888
|
domain: ErrorDomain.STORAGE,
|
|
1854
1889
|
category: ErrorCategory.THIRD_PARTY,
|
|
1855
1890
|
details: {
|
|
@@ -1898,7 +1933,7 @@ ${columns}
|
|
|
1898
1933
|
await transaction.rollback();
|
|
1899
1934
|
throw new MastraError(
|
|
1900
1935
|
{
|
|
1901
|
-
id: "
|
|
1936
|
+
id: createStorageErrorId("MSSQL", "BATCH_DELETE", "FAILED"),
|
|
1902
1937
|
domain: ErrorDomain.STORAGE,
|
|
1903
1938
|
category: ErrorCategory.THIRD_PARTY,
|
|
1904
1939
|
details: {
|
|
@@ -1955,7 +1990,7 @@ ${columns}
|
|
|
1955
1990
|
} catch (error) {
|
|
1956
1991
|
throw new MastraError(
|
|
1957
1992
|
{
|
|
1958
|
-
id: "
|
|
1993
|
+
id: createStorageErrorId("MSSQL", "INDEX_CREATE", "FAILED"),
|
|
1959
1994
|
domain: ErrorDomain.STORAGE,
|
|
1960
1995
|
category: ErrorCategory.THIRD_PARTY,
|
|
1961
1996
|
details: {
|
|
@@ -1991,7 +2026,7 @@ ${columns}
|
|
|
1991
2026
|
if (result.recordset.length > 1) {
|
|
1992
2027
|
const tables = result.recordset.map((r) => r.table_name).join(", ");
|
|
1993
2028
|
throw new MastraError({
|
|
1994
|
-
id: "
|
|
2029
|
+
id: createStorageErrorId("MSSQL", "INDEX", "AMBIGUOUS"),
|
|
1995
2030
|
domain: ErrorDomain.STORAGE,
|
|
1996
2031
|
category: ErrorCategory.USER,
|
|
1997
2032
|
text: `Index "${indexNameSafe}" exists on multiple tables (${tables}) in schema "${schemaName}". Please drop indexes manually or ensure unique index names.`
|
|
@@ -2007,7 +2042,7 @@ ${columns}
|
|
|
2007
2042
|
} catch (error) {
|
|
2008
2043
|
throw new MastraError(
|
|
2009
2044
|
{
|
|
2010
|
-
id: "
|
|
2045
|
+
id: createStorageErrorId("MSSQL", "INDEX_DROP", "FAILED"),
|
|
2011
2046
|
domain: ErrorDomain.STORAGE,
|
|
2012
2047
|
category: ErrorCategory.THIRD_PARTY,
|
|
2013
2048
|
details: {
|
|
@@ -2091,7 +2126,7 @@ ${columns}
|
|
|
2091
2126
|
} catch (error) {
|
|
2092
2127
|
throw new MastraError(
|
|
2093
2128
|
{
|
|
2094
|
-
id: "
|
|
2129
|
+
id: createStorageErrorId("MSSQL", "INDEX_LIST", "FAILED"),
|
|
2095
2130
|
domain: ErrorDomain.STORAGE,
|
|
2096
2131
|
category: ErrorCategory.THIRD_PARTY,
|
|
2097
2132
|
details: tableName ? {
|
|
@@ -2164,7 +2199,7 @@ ${columns}
|
|
|
2164
2199
|
} catch (error) {
|
|
2165
2200
|
throw new MastraError(
|
|
2166
2201
|
{
|
|
2167
|
-
id: "
|
|
2202
|
+
id: createStorageErrorId("MSSQL", "INDEX_DESCRIBE", "FAILED"),
|
|
2168
2203
|
domain: ErrorDomain.STORAGE,
|
|
2169
2204
|
category: ErrorCategory.THIRD_PARTY,
|
|
2170
2205
|
details: {
|
|
@@ -2245,7 +2280,7 @@ ${columns}
|
|
|
2245
2280
|
} catch (error) {
|
|
2246
2281
|
throw new MastraError(
|
|
2247
2282
|
{
|
|
2248
|
-
id: "
|
|
2283
|
+
id: createStorageErrorId("MSSQL", "CREATE_PERFORMANCE_INDEXES", "FAILED"),
|
|
2249
2284
|
domain: ErrorDomain.STORAGE,
|
|
2250
2285
|
category: ErrorCategory.THIRD_PARTY
|
|
2251
2286
|
},
|
|
@@ -2255,20 +2290,9 @@ ${columns}
|
|
|
2255
2290
|
}
|
|
2256
2291
|
};
|
|
2257
2292
|
function transformScoreRow(row) {
|
|
2258
|
-
return {
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
scorer: safelyParseJSON(row.scorer),
|
|
2262
|
-
preprocessStepResult: safelyParseJSON(row.preprocessStepResult),
|
|
2263
|
-
analyzeStepResult: safelyParseJSON(row.analyzeStepResult),
|
|
2264
|
-
metadata: safelyParseJSON(row.metadata),
|
|
2265
|
-
output: safelyParseJSON(row.output),
|
|
2266
|
-
additionalContext: safelyParseJSON(row.additionalContext),
|
|
2267
|
-
requestContext: safelyParseJSON(row.requestContext),
|
|
2268
|
-
entity: safelyParseJSON(row.entity),
|
|
2269
|
-
createdAt: row.createdAt,
|
|
2270
|
-
updatedAt: row.updatedAt
|
|
2271
|
-
};
|
|
2293
|
+
return transformScoreRow$1(row, {
|
|
2294
|
+
convertTimestamps: true
|
|
2295
|
+
});
|
|
2272
2296
|
}
|
|
2273
2297
|
var ScoresMSSQL = class extends ScoresStorage {
|
|
2274
2298
|
pool;
|
|
@@ -2298,7 +2322,7 @@ var ScoresMSSQL = class extends ScoresStorage {
|
|
|
2298
2322
|
} catch (error) {
|
|
2299
2323
|
throw new MastraError(
|
|
2300
2324
|
{
|
|
2301
|
-
id: "
|
|
2325
|
+
id: createStorageErrorId("MSSQL", "GET_SCORE_BY_ID", "FAILED"),
|
|
2302
2326
|
domain: ErrorDomain.STORAGE,
|
|
2303
2327
|
category: ErrorCategory.THIRD_PARTY,
|
|
2304
2328
|
details: { id }
|
|
@@ -2314,7 +2338,7 @@ var ScoresMSSQL = class extends ScoresStorage {
|
|
|
2314
2338
|
} catch (error) {
|
|
2315
2339
|
throw new MastraError(
|
|
2316
2340
|
{
|
|
2317
|
-
id: "
|
|
2341
|
+
id: createStorageErrorId("MSSQL", "SAVE_SCORE", "VALIDATION_FAILED"),
|
|
2318
2342
|
domain: ErrorDomain.STORAGE,
|
|
2319
2343
|
category: ErrorCategory.THIRD_PARTY
|
|
2320
2344
|
},
|
|
@@ -2358,7 +2382,7 @@ var ScoresMSSQL = class extends ScoresStorage {
|
|
|
2358
2382
|
} catch (error) {
|
|
2359
2383
|
throw new MastraError(
|
|
2360
2384
|
{
|
|
2361
|
-
id: "
|
|
2385
|
+
id: createStorageErrorId("MSSQL", "SAVE_SCORE", "FAILED"),
|
|
2362
2386
|
domain: ErrorDomain.STORAGE,
|
|
2363
2387
|
category: ErrorCategory.THIRD_PARTY
|
|
2364
2388
|
},
|
|
@@ -2436,7 +2460,7 @@ var ScoresMSSQL = class extends ScoresStorage {
|
|
|
2436
2460
|
} catch (error) {
|
|
2437
2461
|
throw new MastraError(
|
|
2438
2462
|
{
|
|
2439
|
-
id: "
|
|
2463
|
+
id: createStorageErrorId("MSSQL", "LIST_SCORES_BY_SCORER_ID", "FAILED"),
|
|
2440
2464
|
domain: ErrorDomain.STORAGE,
|
|
2441
2465
|
category: ErrorCategory.THIRD_PARTY,
|
|
2442
2466
|
details: { scorerId }
|
|
@@ -2491,7 +2515,7 @@ var ScoresMSSQL = class extends ScoresStorage {
|
|
|
2491
2515
|
} catch (error) {
|
|
2492
2516
|
throw new MastraError(
|
|
2493
2517
|
{
|
|
2494
|
-
id: "
|
|
2518
|
+
id: createStorageErrorId("MSSQL", "LIST_SCORES_BY_RUN_ID", "FAILED"),
|
|
2495
2519
|
domain: ErrorDomain.STORAGE,
|
|
2496
2520
|
category: ErrorCategory.THIRD_PARTY,
|
|
2497
2521
|
details: { runId }
|
|
@@ -2549,7 +2573,7 @@ var ScoresMSSQL = class extends ScoresStorage {
|
|
|
2549
2573
|
} catch (error) {
|
|
2550
2574
|
throw new MastraError(
|
|
2551
2575
|
{
|
|
2552
|
-
id: "
|
|
2576
|
+
id: createStorageErrorId("MSSQL", "LIST_SCORES_BY_ENTITY_ID", "FAILED"),
|
|
2553
2577
|
domain: ErrorDomain.STORAGE,
|
|
2554
2578
|
category: ErrorCategory.THIRD_PARTY,
|
|
2555
2579
|
details: { entityId, entityType }
|
|
@@ -2607,7 +2631,7 @@ var ScoresMSSQL = class extends ScoresStorage {
|
|
|
2607
2631
|
} catch (error) {
|
|
2608
2632
|
throw new MastraError(
|
|
2609
2633
|
{
|
|
2610
|
-
id: "
|
|
2634
|
+
id: createStorageErrorId("MSSQL", "LIST_SCORES_BY_SPAN", "FAILED"),
|
|
2611
2635
|
domain: ErrorDomain.STORAGE,
|
|
2612
2636
|
category: ErrorCategory.THIRD_PARTY,
|
|
2613
2637
|
details: { traceId, spanId }
|
|
@@ -2711,7 +2735,7 @@ var WorkflowsMSSQL = class extends WorkflowsStorage {
|
|
|
2711
2735
|
}
|
|
2712
2736
|
throw new MastraError(
|
|
2713
2737
|
{
|
|
2714
|
-
id: "
|
|
2738
|
+
id: createStorageErrorId("MSSQL", "UPDATE_WORKFLOW_RESULTS", "FAILED"),
|
|
2715
2739
|
domain: ErrorDomain.STORAGE,
|
|
2716
2740
|
category: ErrorCategory.THIRD_PARTY,
|
|
2717
2741
|
details: {
|
|
@@ -2749,7 +2773,7 @@ var WorkflowsMSSQL = class extends WorkflowsStorage {
|
|
|
2749
2773
|
await transaction.rollback();
|
|
2750
2774
|
throw new MastraError(
|
|
2751
2775
|
{
|
|
2752
|
-
id: "
|
|
2776
|
+
id: createStorageErrorId("MSSQL", "UPDATE_WORKFLOW_STATE", "SNAPSHOT_NOT_FOUND"),
|
|
2753
2777
|
domain: ErrorDomain.STORAGE,
|
|
2754
2778
|
category: ErrorCategory.SYSTEM,
|
|
2755
2779
|
details: {
|
|
@@ -2776,9 +2800,10 @@ var WorkflowsMSSQL = class extends WorkflowsStorage {
|
|
|
2776
2800
|
await transaction.rollback();
|
|
2777
2801
|
} catch {
|
|
2778
2802
|
}
|
|
2803
|
+
if (error instanceof MastraError) throw error;
|
|
2779
2804
|
throw new MastraError(
|
|
2780
2805
|
{
|
|
2781
|
-
id: "
|
|
2806
|
+
id: createStorageErrorId("MSSQL", "UPDATE_WORKFLOW_STATE", "FAILED"),
|
|
2782
2807
|
domain: ErrorDomain.STORAGE,
|
|
2783
2808
|
category: ErrorCategory.THIRD_PARTY,
|
|
2784
2809
|
details: {
|
|
@@ -2819,7 +2844,7 @@ var WorkflowsMSSQL = class extends WorkflowsStorage {
|
|
|
2819
2844
|
} catch (error) {
|
|
2820
2845
|
throw new MastraError(
|
|
2821
2846
|
{
|
|
2822
|
-
id: "
|
|
2847
|
+
id: createStorageErrorId("MSSQL", "PERSIST_WORKFLOW_SNAPSHOT", "FAILED"),
|
|
2823
2848
|
domain: ErrorDomain.STORAGE,
|
|
2824
2849
|
category: ErrorCategory.THIRD_PARTY,
|
|
2825
2850
|
details: {
|
|
@@ -2850,7 +2875,7 @@ var WorkflowsMSSQL = class extends WorkflowsStorage {
|
|
|
2850
2875
|
} catch (error) {
|
|
2851
2876
|
throw new MastraError(
|
|
2852
2877
|
{
|
|
2853
|
-
id: "
|
|
2878
|
+
id: createStorageErrorId("MSSQL", "LOAD_WORKFLOW_SNAPSHOT", "FAILED"),
|
|
2854
2879
|
domain: ErrorDomain.STORAGE,
|
|
2855
2880
|
category: ErrorCategory.THIRD_PARTY,
|
|
2856
2881
|
details: {
|
|
@@ -2890,7 +2915,7 @@ var WorkflowsMSSQL = class extends WorkflowsStorage {
|
|
|
2890
2915
|
} catch (error) {
|
|
2891
2916
|
throw new MastraError(
|
|
2892
2917
|
{
|
|
2893
|
-
id: "
|
|
2918
|
+
id: createStorageErrorId("MSSQL", "GET_WORKFLOW_RUN_BY_ID", "FAILED"),
|
|
2894
2919
|
domain: ErrorDomain.STORAGE,
|
|
2895
2920
|
category: ErrorCategory.THIRD_PARTY,
|
|
2896
2921
|
details: {
|
|
@@ -2970,7 +2995,7 @@ var WorkflowsMSSQL = class extends WorkflowsStorage {
|
|
|
2970
2995
|
} catch (error) {
|
|
2971
2996
|
throw new MastraError(
|
|
2972
2997
|
{
|
|
2973
|
-
id: "
|
|
2998
|
+
id: createStorageErrorId("MSSQL", "LIST_WORKFLOW_RUNS", "FAILED"),
|
|
2974
2999
|
domain: ErrorDomain.STORAGE,
|
|
2975
3000
|
category: ErrorCategory.THIRD_PARTY,
|
|
2976
3001
|
details: {
|
|
@@ -2993,7 +3018,7 @@ var MSSQLStore = class extends MastraStorage {
|
|
|
2993
3018
|
if (!config.id || typeof config.id !== "string" || config.id.trim() === "") {
|
|
2994
3019
|
throw new Error("MSSQLStore: id must be provided and cannot be empty.");
|
|
2995
3020
|
}
|
|
2996
|
-
super({ id: config.id, name: "MSSQLStore" });
|
|
3021
|
+
super({ id: config.id, name: "MSSQLStore", disableInit: config.disableInit });
|
|
2997
3022
|
try {
|
|
2998
3023
|
if ("connectionString" in config) {
|
|
2999
3024
|
if (!config.connectionString || typeof config.connectionString !== "string" || config.connectionString.trim() === "") {
|
|
@@ -3031,7 +3056,7 @@ var MSSQLStore = class extends MastraStorage {
|
|
|
3031
3056
|
} catch (e) {
|
|
3032
3057
|
throw new MastraError(
|
|
3033
3058
|
{
|
|
3034
|
-
id: "
|
|
3059
|
+
id: createStorageErrorId("MSSQL", "INITIALIZATION", "FAILED"),
|
|
3035
3060
|
domain: ErrorDomain.STORAGE,
|
|
3036
3061
|
category: ErrorCategory.USER
|
|
3037
3062
|
},
|
|
@@ -3055,7 +3080,7 @@ var MSSQLStore = class extends MastraStorage {
|
|
|
3055
3080
|
this.isConnected = null;
|
|
3056
3081
|
throw new MastraError(
|
|
3057
3082
|
{
|
|
3058
|
-
id: "
|
|
3083
|
+
id: createStorageErrorId("MSSQL", "INIT", "FAILED"),
|
|
3059
3084
|
domain: ErrorDomain.STORAGE,
|
|
3060
3085
|
category: ErrorCategory.THIRD_PARTY
|
|
3061
3086
|
},
|
|
@@ -3223,7 +3248,7 @@ var MSSQLStore = class extends MastraStorage {
|
|
|
3223
3248
|
getObservabilityStore() {
|
|
3224
3249
|
if (!this.stores.observability) {
|
|
3225
3250
|
throw new MastraError({
|
|
3226
|
-
id: "
|
|
3251
|
+
id: createStorageErrorId("MSSQL", "OBSERVABILITY", "NOT_INITIALIZED"),
|
|
3227
3252
|
domain: ErrorDomain.STORAGE,
|
|
3228
3253
|
category: ErrorCategory.SYSTEM,
|
|
3229
3254
|
text: "Observability storage is not initialized"
|