@mastra/mssql 0.0.0-vector-query-tool-provider-options-20250828222356 → 0.0.0-vector-extension-schema-20250922130418
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 +148 -3
- package/dist/index.cjs +32 -29
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +32 -29
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/memory/index.d.ts.map +1 -1
- package/dist/storage/domains/workflows/index.d.ts +2 -1
- package/dist/storage/domains/workflows/index.d.ts.map +1 -1
- package/dist/storage/index.d.ts +2 -1
- package/dist/storage/index.d.ts.map +1 -1
- package/package.json +23 -10
- 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 -1084
- 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 -296
- package/src/storage/index.test.ts +0 -2228
- package/src/storage/index.ts +0 -494
- package/tsconfig.build.json +0 -9
- package/tsconfig.json +0 -5
- package/tsup.config.ts +0 -17
- package/vitest.config.ts +0 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,156 @@
|
|
|
1
1
|
# @mastra/mssql
|
|
2
2
|
|
|
3
|
-
## 0.0.0-vector-
|
|
3
|
+
## 0.0.0-vector-extension-schema-20250922130418
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
|
|
7
|
+
- Update Peerdeps for packages based on core minor bump ([#8025](https://github.com/mastra-ai/mastra/pull/8025))
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`cf34503`](https://github.com/mastra-ai/mastra/commit/cf345031de4e157f29087946449e60b965e9c8a9), [`6b4b1e4`](https://github.com/mastra-ai/mastra/commit/6b4b1e4235428d39e51cbda9832704c0ba70ab32), [`3469fca`](https://github.com/mastra-ai/mastra/commit/3469fca7bb7e5e19369ff9f7044716a5e4b02585), [`a61f23f`](https://github.com/mastra-ai/mastra/commit/a61f23fbbca4b88b763d94f1d784c47895ed72d7), [`d1dc606`](https://github.com/mastra-ai/mastra/commit/d1dc6067b0557a71190b68d56ee15b48c26d2411), [`c45298a`](https://github.com/mastra-ai/mastra/commit/c45298a0a0791db35cf79f1199d77004da0704cb), [`c4a8204`](https://github.com/mastra-ai/mastra/commit/c4a82046bfd241d6044e234bc5917d5a01fe6b55), [`d3bd4d4`](https://github.com/mastra-ai/mastra/commit/d3bd4d482a685bbb67bfa89be91c90dca3fa71ad)]:
|
|
10
|
+
- @mastra/core@0.0.0-vector-extension-schema-20250922130418
|
|
11
|
+
|
|
12
|
+
## 0.4.1
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Update peerdep of @mastra/core ([#7619](https://github.com/mastra-ai/mastra/pull/7619))
|
|
17
|
+
|
|
18
|
+
- Add resource id to workflow run snapshots ([#7740](https://github.com/mastra-ai/mastra/pull/7740))
|
|
19
|
+
|
|
20
|
+
- Updated dependencies [[`197cbb2`](https://github.com/mastra-ai/mastra/commit/197cbb248fc8cb4bbf61bf70b770f1388b445df2), [`a1bb887`](https://github.com/mastra-ai/mastra/commit/a1bb887e8bfae44230f487648da72e96ef824561), [`6590763`](https://github.com/mastra-ai/mastra/commit/65907630ef4bf4127067cecd1cb21b56f55d5f1b), [`fb84c21`](https://github.com/mastra-ai/mastra/commit/fb84c21859d09bdc8f158bd5412bdc4b5835a61c), [`5802bf5`](https://github.com/mastra-ai/mastra/commit/5802bf57f6182e4b67c28d7d91abed349a8d14f3), [`5bda53a`](https://github.com/mastra-ai/mastra/commit/5bda53a9747bfa7d876d754fc92c83a06e503f62), [`c2eade3`](https://github.com/mastra-ai/mastra/commit/c2eade3508ef309662f065e5f340d7840295dd53), [`f26a8fd`](https://github.com/mastra-ai/mastra/commit/f26a8fd99fcb0497a5d86c28324430d7f6a5fb83), [`222965a`](https://github.com/mastra-ai/mastra/commit/222965a98ce8197b86673ec594244650b5960257), [`6047778`](https://github.com/mastra-ai/mastra/commit/6047778e501df460648f31decddf8e443f36e373), [`a0f5f1c`](https://github.com/mastra-ai/mastra/commit/a0f5f1ca39c3c5c6d26202e9fcab986b4fe14568), [`9d4fc09`](https://github.com/mastra-ai/mastra/commit/9d4fc09b2ad55caa7738c7ceb3a905e454f74cdd), [`05c7abf`](https://github.com/mastra-ai/mastra/commit/05c7abfe105a015b7760c9bf33ff4419727502a0), [`0324ceb`](https://github.com/mastra-ai/mastra/commit/0324ceb8af9d16c12a531f90e575f6aab797ac81), [`d75ccf0`](https://github.com/mastra-ai/mastra/commit/d75ccf06dfd2582b916aa12624e3cd61b279edf1), [`0f9d227`](https://github.com/mastra-ai/mastra/commit/0f9d227890a98db33865abbea39daf407cd55ef7), [`b356f5f`](https://github.com/mastra-ai/mastra/commit/b356f5f7566cb3edb755d91f00b72fc1420b2a37), [`de056a0`](https://github.com/mastra-ai/mastra/commit/de056a02cbb43f6aa0380ab2150ea404af9ec0dd), [`f5ce05f`](https://github.com/mastra-ai/mastra/commit/f5ce05f831d42c69559bf4c0fdb46ccb920fc3a3), [`60c9cec`](https://github.com/mastra-ai/mastra/commit/60c9cec7048a79a87440f7840c383875bd710d93), [`c93532a`](https://github.com/mastra-ai/mastra/commit/c93532a340b80e4dd946d4c138d9381de5f70399), [`6cb1fcb`](https://github.com/mastra-ai/mastra/commit/6cb1fcbc8d0378ffed0d17784c96e68f30cb0272), [`aee4f00`](https://github.com/mastra-ai/mastra/commit/aee4f00e61e1a42e81a6d74ff149dbe69e32695a), [`9f6f30f`](https://github.com/mastra-ai/mastra/commit/9f6f30f04ec6648bbca798ea8aad59317c40d8db), [`547c621`](https://github.com/mastra-ai/mastra/commit/547c62104af3f7a551b3754e9cbdf0a3fbba15e4), [`897995e`](https://github.com/mastra-ai/mastra/commit/897995e630d572fe2891e7ede817938cabb43251), [`0fed8f2`](https://github.com/mastra-ai/mastra/commit/0fed8f2aa84b167b3415ea6f8f70755775132c8d), [`4f9ea8c`](https://github.com/mastra-ai/mastra/commit/4f9ea8c95ea74ba9abbf3b2ab6106c7d7bc45689), [`1a1fbe6`](https://github.com/mastra-ai/mastra/commit/1a1fbe66efb7d94abc373ed0dd9676adb8122454), [`d706fad`](https://github.com/mastra-ai/mastra/commit/d706fad6e6e4b72357b18d229ba38e6c913c0e70), [`87fd07f`](https://github.com/mastra-ai/mastra/commit/87fd07ff35387a38728967163460231b5d33ae3b), [`5c3768f`](https://github.com/mastra-ai/mastra/commit/5c3768fa959454232ad76715c381f4aac00c6881), [`2685a78`](https://github.com/mastra-ai/mastra/commit/2685a78f224b8b04e20d4fab5ac1adb638190071), [`36f39c0`](https://github.com/mastra-ai/mastra/commit/36f39c00dc794952dc3c11aab91c2fa8bca74b11), [`239b5a4`](https://github.com/mastra-ai/mastra/commit/239b5a497aeae2e8b4d764f46217cfff2284788e), [`8a3f5e4`](https://github.com/mastra-ai/mastra/commit/8a3f5e4212ec36b302957deb4bd47005ab598382)]:
|
|
21
|
+
- @mastra/core@0.17.0
|
|
22
|
+
|
|
23
|
+
## 0.4.1-alpha.1
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- Update peerdep of @mastra/core ([#7619](https://github.com/mastra-ai/mastra/pull/7619))
|
|
28
|
+
|
|
29
|
+
- Updated dependencies [[`a1bb887`](https://github.com/mastra-ai/mastra/commit/a1bb887e8bfae44230f487648da72e96ef824561), [`a0f5f1c`](https://github.com/mastra-ai/mastra/commit/a0f5f1ca39c3c5c6d26202e9fcab986b4fe14568), [`b356f5f`](https://github.com/mastra-ai/mastra/commit/b356f5f7566cb3edb755d91f00b72fc1420b2a37), [`f5ce05f`](https://github.com/mastra-ai/mastra/commit/f5ce05f831d42c69559bf4c0fdb46ccb920fc3a3), [`9f6f30f`](https://github.com/mastra-ai/mastra/commit/9f6f30f04ec6648bbca798ea8aad59317c40d8db), [`d706fad`](https://github.com/mastra-ai/mastra/commit/d706fad6e6e4b72357b18d229ba38e6c913c0e70), [`5c3768f`](https://github.com/mastra-ai/mastra/commit/5c3768fa959454232ad76715c381f4aac00c6881), [`8a3f5e4`](https://github.com/mastra-ai/mastra/commit/8a3f5e4212ec36b302957deb4bd47005ab598382)]:
|
|
30
|
+
- @mastra/core@0.17.0-alpha.3
|
|
31
|
+
|
|
32
|
+
## 0.4.1-alpha.0
|
|
33
|
+
|
|
34
|
+
### Patch Changes
|
|
35
|
+
|
|
36
|
+
- Add resource id to workflow run snapshots ([#7740](https://github.com/mastra-ai/mastra/pull/7740))
|
|
37
|
+
|
|
38
|
+
- Updated dependencies [[`547c621`](https://github.com/mastra-ai/mastra/commit/547c62104af3f7a551b3754e9cbdf0a3fbba15e4)]:
|
|
39
|
+
- @mastra/core@0.16.4-alpha.1
|
|
40
|
+
|
|
41
|
+
## 0.4.0
|
|
42
|
+
|
|
43
|
+
### Minor Changes
|
|
44
|
+
|
|
45
|
+
- 376913a: Update peerdeps of @mastra/core
|
|
46
|
+
|
|
47
|
+
### Patch Changes
|
|
48
|
+
|
|
49
|
+
- 6f5eb7a: Throw if an empty or whitespace-only threadId is passed when getting messages
|
|
50
|
+
- Updated dependencies [8fbf79e]
|
|
51
|
+
- Updated dependencies [fd83526]
|
|
52
|
+
- Updated dependencies [d0b90ab]
|
|
53
|
+
- Updated dependencies [6f5eb7a]
|
|
54
|
+
- Updated dependencies [a01cf14]
|
|
55
|
+
- Updated dependencies [a9e50ee]
|
|
56
|
+
- Updated dependencies [5397eb4]
|
|
57
|
+
- Updated dependencies [c9f4e4a]
|
|
58
|
+
- Updated dependencies [0acbc80]
|
|
59
|
+
- @mastra/core@0.16.0
|
|
60
|
+
|
|
61
|
+
## 0.4.0-alpha.1
|
|
62
|
+
|
|
63
|
+
### Minor Changes
|
|
64
|
+
|
|
65
|
+
- 376913a: Update peerdeps of @mastra/core
|
|
66
|
+
|
|
67
|
+
### Patch Changes
|
|
68
|
+
|
|
69
|
+
- Updated dependencies [8fbf79e]
|
|
70
|
+
- @mastra/core@0.16.0-alpha.1
|
|
71
|
+
|
|
72
|
+
## 0.3.7-alpha.0
|
|
73
|
+
|
|
74
|
+
### Patch Changes
|
|
75
|
+
|
|
76
|
+
- 6f5eb7a: Throw if an empty or whitespace-only threadId is passed when getting messages
|
|
77
|
+
- Updated dependencies [fd83526]
|
|
78
|
+
- Updated dependencies [d0b90ab]
|
|
79
|
+
- Updated dependencies [6f5eb7a]
|
|
80
|
+
- Updated dependencies [a01cf14]
|
|
81
|
+
- Updated dependencies [a9e50ee]
|
|
82
|
+
- Updated dependencies [5397eb4]
|
|
83
|
+
- Updated dependencies [c9f4e4a]
|
|
84
|
+
- Updated dependencies [0acbc80]
|
|
85
|
+
- @mastra/core@0.16.0-alpha.0
|
|
86
|
+
|
|
87
|
+
## 0.3.6
|
|
88
|
+
|
|
89
|
+
### Patch Changes
|
|
90
|
+
|
|
91
|
+
- de3cbc6: Update the `package.json` file to include additional fields like `repository`, `homepage` or `files`.
|
|
92
|
+
- f0dfcac: updated core peerdep
|
|
93
|
+
- Updated dependencies [ab48c97]
|
|
94
|
+
- Updated dependencies [85ef90b]
|
|
95
|
+
- Updated dependencies [aedbbfa]
|
|
96
|
+
- Updated dependencies [ff89505]
|
|
97
|
+
- Updated dependencies [637f323]
|
|
98
|
+
- Updated dependencies [de3cbc6]
|
|
99
|
+
- Updated dependencies [c19bcf7]
|
|
100
|
+
- Updated dependencies [4474d04]
|
|
101
|
+
- Updated dependencies [183dc95]
|
|
102
|
+
- Updated dependencies [a1111e2]
|
|
103
|
+
- Updated dependencies [b42a961]
|
|
104
|
+
- Updated dependencies [61debef]
|
|
105
|
+
- Updated dependencies [9beaeff]
|
|
106
|
+
- Updated dependencies [29de0e1]
|
|
107
|
+
- Updated dependencies [f643c65]
|
|
108
|
+
- Updated dependencies [00c74e7]
|
|
109
|
+
- Updated dependencies [fef7375]
|
|
110
|
+
- Updated dependencies [e3d8fea]
|
|
111
|
+
- Updated dependencies [45e4d39]
|
|
112
|
+
- Updated dependencies [9eee594]
|
|
113
|
+
- Updated dependencies [7149d8d]
|
|
114
|
+
- Updated dependencies [822c2e8]
|
|
115
|
+
- Updated dependencies [979912c]
|
|
116
|
+
- Updated dependencies [7dcf4c0]
|
|
117
|
+
- Updated dependencies [4106a58]
|
|
118
|
+
- Updated dependencies [ad78bfc]
|
|
119
|
+
- Updated dependencies [0302f50]
|
|
120
|
+
- Updated dependencies [6ac697e]
|
|
121
|
+
- Updated dependencies [74db265]
|
|
122
|
+
- Updated dependencies [0ce418a]
|
|
123
|
+
- Updated dependencies [af90672]
|
|
124
|
+
- Updated dependencies [8387952]
|
|
125
|
+
- Updated dependencies [7f3b8da]
|
|
126
|
+
- Updated dependencies [905352b]
|
|
127
|
+
- Updated dependencies [599d04c]
|
|
128
|
+
- Updated dependencies [56041d0]
|
|
129
|
+
- Updated dependencies [3412597]
|
|
130
|
+
- Updated dependencies [5eca5d2]
|
|
131
|
+
- Updated dependencies [f2cda47]
|
|
132
|
+
- Updated dependencies [5de1555]
|
|
133
|
+
- Updated dependencies [cfd377a]
|
|
134
|
+
- Updated dependencies [1ed5a3e]
|
|
135
|
+
- @mastra/core@0.15.3
|
|
136
|
+
|
|
137
|
+
## 0.3.6-alpha.1
|
|
138
|
+
|
|
139
|
+
### Patch Changes
|
|
140
|
+
|
|
141
|
+
- [#7394](https://github.com/mastra-ai/mastra/pull/7394) [`f0dfcac`](https://github.com/mastra-ai/mastra/commit/f0dfcac4458bdf789b975e2d63e984f5d1e7c4d3) Thanks [@NikAiyer](https://github.com/NikAiyer)! - updated core peerdep
|
|
142
|
+
|
|
143
|
+
- Updated dependencies [[`7149d8d`](https://github.com/mastra-ai/mastra/commit/7149d8d4bdc1edf0008e0ca9b7925eb0b8b60dbe)]:
|
|
144
|
+
- @mastra/core@0.15.3-alpha.7
|
|
145
|
+
|
|
146
|
+
## 0.3.6-alpha.0
|
|
147
|
+
|
|
148
|
+
### Patch Changes
|
|
149
|
+
|
|
150
|
+
- [#7343](https://github.com/mastra-ai/mastra/pull/7343) [`de3cbc6`](https://github.com/mastra-ai/mastra/commit/de3cbc61079211431bd30487982ea3653517278e) Thanks [@LekoArts](https://github.com/LekoArts)! - Update the `package.json` file to include additional fields like `repository`, `homepage` or `files`.
|
|
151
|
+
|
|
152
|
+
- Updated dependencies [[`85ef90b`](https://github.com/mastra-ai/mastra/commit/85ef90bb2cd4ae4df855c7ac175f7d392c55c1bf), [`de3cbc6`](https://github.com/mastra-ai/mastra/commit/de3cbc61079211431bd30487982ea3653517278e)]:
|
|
153
|
+
- @mastra/core@0.15.3-alpha.5
|
|
9
154
|
|
|
10
155
|
## 0.3.5
|
|
11
156
|
|
package/dist/index.cjs
CHANGED
|
@@ -467,6 +467,7 @@ var MemoryMSSQL = class extends storage.MemoryStorage {
|
|
|
467
467
|
selectBy,
|
|
468
468
|
orderByStatement
|
|
469
469
|
}) {
|
|
470
|
+
if (!threadId.trim()) throw new Error("threadId must be a non-empty string");
|
|
470
471
|
const include = selectBy?.include;
|
|
471
472
|
if (!include) return null;
|
|
472
473
|
const unionQueries = [];
|
|
@@ -538,11 +539,12 @@ var MemoryMSSQL = class extends storage.MemoryStorage {
|
|
|
538
539
|
return dedupedRows;
|
|
539
540
|
}
|
|
540
541
|
async getMessages(args) {
|
|
541
|
-
const { threadId, format, selectBy } = args;
|
|
542
|
+
const { threadId, resourceId, format, selectBy } = args;
|
|
542
543
|
const selectStatement = `SELECT seq_id, id, content, role, type, [createdAt], thread_id AS threadId, resourceId`;
|
|
543
544
|
const orderByStatement = `ORDER BY [seq_id] DESC`;
|
|
544
545
|
const limit = storage.resolveMessageLimit({ last: selectBy?.last, defaultLimit: 40 });
|
|
545
546
|
try {
|
|
547
|
+
if (!threadId.trim()) throw new Error("threadId must be a non-empty string");
|
|
546
548
|
let rows = [];
|
|
547
549
|
const include = selectBy?.include || [];
|
|
548
550
|
if (include?.length) {
|
|
@@ -580,7 +582,8 @@ var MemoryMSSQL = class extends storage.MemoryStorage {
|
|
|
580
582
|
domain: error.ErrorDomain.STORAGE,
|
|
581
583
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
582
584
|
details: {
|
|
583
|
-
threadId
|
|
585
|
+
threadId,
|
|
586
|
+
resourceId: resourceId ?? ""
|
|
584
587
|
}
|
|
585
588
|
},
|
|
586
589
|
error$1
|
|
@@ -631,29 +634,24 @@ var MemoryMSSQL = class extends storage.MemoryStorage {
|
|
|
631
634
|
}
|
|
632
635
|
}
|
|
633
636
|
async getMessagesPaginated(args) {
|
|
634
|
-
const { threadId, selectBy } = args;
|
|
635
|
-
const { page = 0, perPage: perPageInput } = selectBy?.pagination || {};
|
|
636
|
-
const orderByStatement = `ORDER BY [seq_id] DESC`;
|
|
637
|
-
if (selectBy?.include?.length) {
|
|
638
|
-
await this._getIncludedMessages({ threadId, selectBy, orderByStatement });
|
|
639
|
-
}
|
|
637
|
+
const { threadId, resourceId, format, selectBy } = args;
|
|
638
|
+
const { page = 0, perPage: perPageInput, dateRange } = selectBy?.pagination || {};
|
|
640
639
|
try {
|
|
641
|
-
|
|
642
|
-
const { page: page2 = 0, perPage: perPageInput2, dateRange } = selectBy2?.pagination || {};
|
|
640
|
+
if (!threadId.trim()) throw new Error("threadId must be a non-empty string");
|
|
643
641
|
const fromDate = dateRange?.start;
|
|
644
642
|
const toDate = dateRange?.end;
|
|
645
643
|
const selectStatement = `SELECT seq_id, id, content, role, type, [createdAt], thread_id AS threadId, resourceId`;
|
|
646
|
-
const
|
|
647
|
-
let
|
|
648
|
-
if (
|
|
649
|
-
const includeMessages = await this._getIncludedMessages({ threadId
|
|
650
|
-
if (includeMessages)
|
|
644
|
+
const orderByStatement = `ORDER BY [seq_id] DESC`;
|
|
645
|
+
let messages = [];
|
|
646
|
+
if (selectBy?.include?.length) {
|
|
647
|
+
const includeMessages = await this._getIncludedMessages({ threadId, selectBy, orderByStatement });
|
|
648
|
+
if (includeMessages) messages.push(...includeMessages);
|
|
651
649
|
}
|
|
652
|
-
const perPage =
|
|
653
|
-
const currentOffset =
|
|
650
|
+
const perPage = perPageInput !== void 0 ? perPageInput : storage.resolveMessageLimit({ last: selectBy?.last, defaultLimit: 40 });
|
|
651
|
+
const currentOffset = page * perPage;
|
|
654
652
|
const conditions = ["[thread_id] = @threadId"];
|
|
655
653
|
const request = this.pool.request();
|
|
656
|
-
request.input("threadId",
|
|
654
|
+
request.input("threadId", threadId);
|
|
657
655
|
if (fromDate instanceof Date && !isNaN(fromDate.getTime())) {
|
|
658
656
|
conditions.push("[createdAt] >= @fromDate");
|
|
659
657
|
request.input("fromDate", fromDate.toISOString());
|
|
@@ -666,35 +664,35 @@ var MemoryMSSQL = class extends storage.MemoryStorage {
|
|
|
666
664
|
const countQuery = `SELECT COUNT(*) as total FROM ${getTableName({ indexName: storage.TABLE_MESSAGES, schemaName: getSchemaName(this.schema) })} ${whereClause}`;
|
|
667
665
|
const countResult = await request.query(countQuery);
|
|
668
666
|
const total = parseInt(countResult.recordset[0]?.total, 10) || 0;
|
|
669
|
-
if (total === 0 &&
|
|
670
|
-
const parsedIncluded = this._parseAndFormatMessages(
|
|
667
|
+
if (total === 0 && messages.length > 0) {
|
|
668
|
+
const parsedIncluded = this._parseAndFormatMessages(messages, format);
|
|
671
669
|
return {
|
|
672
670
|
messages: parsedIncluded,
|
|
673
671
|
total: parsedIncluded.length,
|
|
674
|
-
page
|
|
672
|
+
page,
|
|
675
673
|
perPage,
|
|
676
674
|
hasMore: false
|
|
677
675
|
};
|
|
678
676
|
}
|
|
679
|
-
const excludeIds =
|
|
677
|
+
const excludeIds = messages.map((m) => m.id);
|
|
680
678
|
if (excludeIds.length > 0) {
|
|
681
679
|
const excludeParams = excludeIds.map((_, idx) => `@id${idx}`);
|
|
682
680
|
conditions.push(`id NOT IN (${excludeParams.join(", ")})`);
|
|
683
681
|
excludeIds.forEach((id, idx) => request.input(`id${idx}`, id));
|
|
684
682
|
}
|
|
685
683
|
const finalWhereClause = `WHERE ${conditions.join(" AND ")}`;
|
|
686
|
-
const dataQuery = `${selectStatement} FROM ${getTableName({ indexName: storage.TABLE_MESSAGES, schemaName: getSchemaName(this.schema) })} ${finalWhereClause} ${
|
|
684
|
+
const dataQuery = `${selectStatement} FROM ${getTableName({ indexName: storage.TABLE_MESSAGES, schemaName: getSchemaName(this.schema) })} ${finalWhereClause} ${orderByStatement} OFFSET @offset ROWS FETCH NEXT @limit ROWS ONLY`;
|
|
687
685
|
request.input("offset", currentOffset);
|
|
688
686
|
request.input("limit", perPage);
|
|
689
687
|
const rowsResult = await request.query(dataQuery);
|
|
690
688
|
const rows = rowsResult.recordset || [];
|
|
691
689
|
rows.sort((a, b) => a.seq_id - b.seq_id);
|
|
692
|
-
|
|
693
|
-
const parsed = this._parseAndFormatMessages(
|
|
690
|
+
messages.push(...rows);
|
|
691
|
+
const parsed = this._parseAndFormatMessages(messages, format);
|
|
694
692
|
return {
|
|
695
693
|
messages: parsed,
|
|
696
694
|
total: total + excludeIds.length,
|
|
697
|
-
page
|
|
695
|
+
page,
|
|
698
696
|
perPage,
|
|
699
697
|
hasMore: currentOffset + rows.length < total
|
|
700
698
|
};
|
|
@@ -706,6 +704,7 @@ var MemoryMSSQL = class extends storage.MemoryStorage {
|
|
|
706
704
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
707
705
|
details: {
|
|
708
706
|
threadId,
|
|
707
|
+
resourceId: resourceId ?? "",
|
|
709
708
|
page
|
|
710
709
|
}
|
|
711
710
|
},
|
|
@@ -1897,6 +1896,7 @@ var WorkflowsMSSQL = class extends storage.WorkflowsStorage {
|
|
|
1897
1896
|
async persistWorkflowSnapshot({
|
|
1898
1897
|
workflowName,
|
|
1899
1898
|
runId,
|
|
1899
|
+
resourceId,
|
|
1900
1900
|
snapshot
|
|
1901
1901
|
}) {
|
|
1902
1902
|
const table = getTableName({ indexName: storage.TABLE_WORKFLOW_SNAPSHOT, schemaName: getSchemaName(this.schema) });
|
|
@@ -1905,6 +1905,7 @@ var WorkflowsMSSQL = class extends storage.WorkflowsStorage {
|
|
|
1905
1905
|
const request = this.pool.request();
|
|
1906
1906
|
request.input("workflow_name", workflowName);
|
|
1907
1907
|
request.input("run_id", runId);
|
|
1908
|
+
request.input("resourceId", resourceId);
|
|
1908
1909
|
request.input("snapshot", JSON.stringify(snapshot));
|
|
1909
1910
|
request.input("createdAt", sql2__default.default.DateTime2, new Date(now));
|
|
1910
1911
|
request.input("updatedAt", sql2__default.default.DateTime2, new Date(now));
|
|
@@ -1912,10 +1913,11 @@ var WorkflowsMSSQL = class extends storage.WorkflowsStorage {
|
|
|
1912
1913
|
USING (SELECT @workflow_name AS workflow_name, @run_id AS run_id) AS src
|
|
1913
1914
|
ON target.workflow_name = src.workflow_name AND target.run_id = src.run_id
|
|
1914
1915
|
WHEN MATCHED THEN UPDATE SET
|
|
1916
|
+
resourceId = @resourceId,
|
|
1915
1917
|
snapshot = @snapshot,
|
|
1916
1918
|
[updatedAt] = @updatedAt
|
|
1917
|
-
WHEN NOT MATCHED THEN INSERT (workflow_name, run_id, snapshot, [createdAt], [updatedAt])
|
|
1918
|
-
VALUES (@workflow_name, @run_id, @snapshot, @createdAt, @updatedAt);`;
|
|
1919
|
+
WHEN NOT MATCHED THEN INSERT (workflow_name, run_id, resourceId, snapshot, [createdAt], [updatedAt])
|
|
1920
|
+
VALUES (@workflow_name, @run_id, @resourceId, @snapshot, @createdAt, @updatedAt);`;
|
|
1919
1921
|
await request.query(mergeSql);
|
|
1920
1922
|
} catch (error$1) {
|
|
1921
1923
|
throw new error.MastraError(
|
|
@@ -2300,9 +2302,10 @@ var MSSQLStore = class extends storage.MastraStorage {
|
|
|
2300
2302
|
async persistWorkflowSnapshot({
|
|
2301
2303
|
workflowName,
|
|
2302
2304
|
runId,
|
|
2305
|
+
resourceId,
|
|
2303
2306
|
snapshot
|
|
2304
2307
|
}) {
|
|
2305
|
-
return this.stores.workflows.persistWorkflowSnapshot({ workflowName, runId, snapshot });
|
|
2308
|
+
return this.stores.workflows.persistWorkflowSnapshot({ workflowName, runId, resourceId, snapshot });
|
|
2306
2309
|
}
|
|
2307
2310
|
async loadWorkflowSnapshot({
|
|
2308
2311
|
workflowName,
|