@mastra/lance 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 +125 -105
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +126 -106
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/memory/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 +8 -0
- package/dist/storage/domains/scores/index.d.ts.map +1 -1
- package/dist/storage/domains/workflows/index.d.ts.map +1 -1
- package/dist/storage/index.d.ts +30 -2
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/vector/index.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -91,7 +91,7 @@ async function getTableSchema({
|
|
|
91
91
|
} catch (validationError) {
|
|
92
92
|
throw new error.MastraError(
|
|
93
93
|
{
|
|
94
|
-
id: "
|
|
94
|
+
id: storage.createStorageErrorId("LANCE", "GET_TABLE_SCHEMA", "INVALID_ARGS"),
|
|
95
95
|
domain: error.ErrorDomain.STORAGE,
|
|
96
96
|
category: error.ErrorCategory.USER,
|
|
97
97
|
text: validationError.message,
|
|
@@ -114,7 +114,7 @@ async function getTableSchema({
|
|
|
114
114
|
} catch (error$1) {
|
|
115
115
|
throw new error.MastraError(
|
|
116
116
|
{
|
|
117
|
-
id: "
|
|
117
|
+
id: storage.createStorageErrorId("LANCE", "GET_TABLE_SCHEMA", "FAILED"),
|
|
118
118
|
domain: error.ErrorDomain.STORAGE,
|
|
119
119
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
120
120
|
details: { tableName }
|
|
@@ -151,7 +151,7 @@ var StoreMemoryLance = class extends storage.MemoryStorage {
|
|
|
151
151
|
} catch (error$1) {
|
|
152
152
|
throw new error.MastraError(
|
|
153
153
|
{
|
|
154
|
-
id: "
|
|
154
|
+
id: storage.createStorageErrorId("LANCE", "GET_THREAD_BY_ID", "FAILED"),
|
|
155
155
|
domain: error.ErrorDomain.STORAGE,
|
|
156
156
|
category: error.ErrorCategory.THIRD_PARTY
|
|
157
157
|
},
|
|
@@ -173,7 +173,7 @@ var StoreMemoryLance = class extends storage.MemoryStorage {
|
|
|
173
173
|
} catch (error$1) {
|
|
174
174
|
throw new error.MastraError(
|
|
175
175
|
{
|
|
176
|
-
id: "
|
|
176
|
+
id: storage.createStorageErrorId("LANCE", "SAVE_THREAD", "FAILED"),
|
|
177
177
|
domain: error.ErrorDomain.STORAGE,
|
|
178
178
|
category: error.ErrorCategory.THIRD_PARTY
|
|
179
179
|
},
|
|
@@ -215,7 +215,7 @@ var StoreMemoryLance = class extends storage.MemoryStorage {
|
|
|
215
215
|
}
|
|
216
216
|
throw new error.MastraError(
|
|
217
217
|
{
|
|
218
|
-
id: "
|
|
218
|
+
id: storage.createStorageErrorId("LANCE", "UPDATE_THREAD", "FAILED"),
|
|
219
219
|
domain: error.ErrorDomain.STORAGE,
|
|
220
220
|
category: error.ErrorCategory.THIRD_PARTY
|
|
221
221
|
},
|
|
@@ -225,7 +225,7 @@ var StoreMemoryLance = class extends storage.MemoryStorage {
|
|
|
225
225
|
}
|
|
226
226
|
throw new error.MastraError(
|
|
227
227
|
{
|
|
228
|
-
id: "
|
|
228
|
+
id: storage.createStorageErrorId("LANCE", "UPDATE_THREAD", "FAILED"),
|
|
229
229
|
domain: error.ErrorDomain.STORAGE,
|
|
230
230
|
category: error.ErrorCategory.THIRD_PARTY
|
|
231
231
|
},
|
|
@@ -241,7 +241,7 @@ var StoreMemoryLance = class extends storage.MemoryStorage {
|
|
|
241
241
|
} catch (error$1) {
|
|
242
242
|
throw new error.MastraError(
|
|
243
243
|
{
|
|
244
|
-
id: "
|
|
244
|
+
id: storage.createStorageErrorId("LANCE", "DELETE_THREAD", "FAILED"),
|
|
245
245
|
domain: error.ErrorDomain.STORAGE,
|
|
246
246
|
category: error.ErrorCategory.THIRD_PARTY
|
|
247
247
|
},
|
|
@@ -281,7 +281,7 @@ var StoreMemoryLance = class extends storage.MemoryStorage {
|
|
|
281
281
|
} catch (error$1) {
|
|
282
282
|
throw new error.MastraError(
|
|
283
283
|
{
|
|
284
|
-
id: "
|
|
284
|
+
id: storage.createStorageErrorId("LANCE", "LIST_MESSAGES_BY_ID", "FAILED"),
|
|
285
285
|
domain: error.ErrorDomain.STORAGE,
|
|
286
286
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
287
287
|
details: {
|
|
@@ -294,15 +294,16 @@ var StoreMemoryLance = class extends storage.MemoryStorage {
|
|
|
294
294
|
}
|
|
295
295
|
async listMessages(args) {
|
|
296
296
|
const { threadId, resourceId, include, filter, perPage: perPageInput, page = 0, orderBy } = args;
|
|
297
|
-
|
|
297
|
+
const threadIds = Array.isArray(threadId) ? threadId : [threadId];
|
|
298
|
+
if (threadIds.length === 0 || threadIds.some((id) => !id.trim())) {
|
|
298
299
|
throw new error.MastraError(
|
|
299
300
|
{
|
|
300
|
-
id: "
|
|
301
|
+
id: storage.createStorageErrorId("LANCE", "LIST_MESSAGES", "INVALID_THREAD_ID"),
|
|
301
302
|
domain: error.ErrorDomain.STORAGE,
|
|
302
303
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
303
|
-
details: { threadId }
|
|
304
|
+
details: { threadId: Array.isArray(threadId) ? threadId.join(",") : threadId }
|
|
304
305
|
},
|
|
305
|
-
new Error("threadId must be a non-empty string")
|
|
306
|
+
new Error("threadId must be a non-empty string or array of non-empty strings")
|
|
306
307
|
);
|
|
307
308
|
}
|
|
308
309
|
const perPage = storage.normalizePerPage(perPageInput, 40);
|
|
@@ -311,7 +312,7 @@ var StoreMemoryLance = class extends storage.MemoryStorage {
|
|
|
311
312
|
if (page < 0) {
|
|
312
313
|
throw new error.MastraError(
|
|
313
314
|
{
|
|
314
|
-
id: "
|
|
315
|
+
id: storage.createStorageErrorId("LANCE", "LIST_MESSAGES", "INVALID_PAGE"),
|
|
315
316
|
domain: error.ErrorDomain.STORAGE,
|
|
316
317
|
category: error.ErrorCategory.USER,
|
|
317
318
|
details: { page }
|
|
@@ -321,7 +322,8 @@ var StoreMemoryLance = class extends storage.MemoryStorage {
|
|
|
321
322
|
}
|
|
322
323
|
const { field, direction } = this.parseOrderBy(orderBy, "ASC");
|
|
323
324
|
const table = await this.client.openTable(storage.TABLE_MESSAGES);
|
|
324
|
-
const
|
|
325
|
+
const threadCondition = threadIds.length === 1 ? `thread_id = '${this.escapeSql(threadIds[0])}'` : `thread_id IN (${threadIds.map((t) => `'${this.escapeSql(t)}'`).join(", ")})`;
|
|
326
|
+
const conditions = [threadCondition];
|
|
325
327
|
if (resourceId) {
|
|
326
328
|
conditions.push(`\`resourceId\` = '${this.escapeSql(resourceId)}'`);
|
|
327
329
|
}
|
|
@@ -361,9 +363,9 @@ var StoreMemoryLance = class extends storage.MemoryStorage {
|
|
|
361
363
|
}
|
|
362
364
|
const messageIds = new Set(messages.map((m) => m.id));
|
|
363
365
|
if (include && include.length > 0) {
|
|
364
|
-
const
|
|
366
|
+
const threadIds2 = [...new Set(include.map((item) => item.threadId || threadId))];
|
|
365
367
|
const allThreadMessages = [];
|
|
366
|
-
for (const tid of
|
|
368
|
+
for (const tid of threadIds2) {
|
|
367
369
|
const threadQuery = table.query().where(`thread_id = '${tid}'`);
|
|
368
370
|
let threadRecords = await threadQuery.toArray();
|
|
369
371
|
allThreadMessages.push(...threadRecords);
|
|
@@ -405,11 +407,11 @@ var StoreMemoryLance = class extends storage.MemoryStorage {
|
|
|
405
407
|
} catch (error$1) {
|
|
406
408
|
const mastraError = new error.MastraError(
|
|
407
409
|
{
|
|
408
|
-
id: "
|
|
410
|
+
id: storage.createStorageErrorId("LANCE", "LIST_MESSAGES", "FAILED"),
|
|
409
411
|
domain: error.ErrorDomain.STORAGE,
|
|
410
412
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
411
413
|
details: {
|
|
412
|
-
threadId,
|
|
414
|
+
threadId: Array.isArray(threadId) ? threadId.join(",") : threadId,
|
|
413
415
|
resourceId: resourceId ?? ""
|
|
414
416
|
}
|
|
415
417
|
},
|
|
@@ -470,7 +472,7 @@ var StoreMemoryLance = class extends storage.MemoryStorage {
|
|
|
470
472
|
} catch (error$1) {
|
|
471
473
|
throw new error.MastraError(
|
|
472
474
|
{
|
|
473
|
-
id: "
|
|
475
|
+
id: storage.createStorageErrorId("LANCE", "SAVE_MESSAGES", "FAILED"),
|
|
474
476
|
domain: error.ErrorDomain.STORAGE,
|
|
475
477
|
category: error.ErrorCategory.THIRD_PARTY
|
|
476
478
|
},
|
|
@@ -485,7 +487,7 @@ var StoreMemoryLance = class extends storage.MemoryStorage {
|
|
|
485
487
|
if (page < 0) {
|
|
486
488
|
throw new error.MastraError(
|
|
487
489
|
{
|
|
488
|
-
id: "
|
|
490
|
+
id: storage.createStorageErrorId("LANCE", "LIST_THREADS_BY_RESOURCE_ID", "INVALID_PAGE"),
|
|
489
491
|
domain: error.ErrorDomain.STORAGE,
|
|
490
492
|
category: error.ErrorCategory.USER,
|
|
491
493
|
details: { page }
|
|
@@ -525,7 +527,7 @@ var StoreMemoryLance = class extends storage.MemoryStorage {
|
|
|
525
527
|
} catch (error$1) {
|
|
526
528
|
throw new error.MastraError(
|
|
527
529
|
{
|
|
528
|
-
id: "
|
|
530
|
+
id: storage.createStorageErrorId("LANCE", "LIST_THREADS_BY_RESOURCE_ID", "FAILED"),
|
|
529
531
|
domain: error.ErrorDomain.STORAGE,
|
|
530
532
|
category: error.ErrorCategory.THIRD_PARTY
|
|
531
533
|
},
|
|
@@ -660,7 +662,7 @@ var StoreMemoryLance = class extends storage.MemoryStorage {
|
|
|
660
662
|
} catch (error$1) {
|
|
661
663
|
throw new error.MastraError(
|
|
662
664
|
{
|
|
663
|
-
id: "
|
|
665
|
+
id: storage.createStorageErrorId("LANCE", "UPDATE_MESSAGES", "FAILED"),
|
|
664
666
|
domain: error.ErrorDomain.STORAGE,
|
|
665
667
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
666
668
|
details: { count: messages.length }
|
|
@@ -737,7 +739,7 @@ var StoreMemoryLance = class extends storage.MemoryStorage {
|
|
|
737
739
|
} catch (error$1) {
|
|
738
740
|
throw new error.MastraError(
|
|
739
741
|
{
|
|
740
|
-
id: "
|
|
742
|
+
id: storage.createStorageErrorId("LANCE", "GET_RESOURCE_BY_ID", "FAILED"),
|
|
741
743
|
domain: error.ErrorDomain.STORAGE,
|
|
742
744
|
category: error.ErrorCategory.THIRD_PARTY
|
|
743
745
|
},
|
|
@@ -761,7 +763,7 @@ var StoreMemoryLance = class extends storage.MemoryStorage {
|
|
|
761
763
|
} catch (error$1) {
|
|
762
764
|
throw new error.MastraError(
|
|
763
765
|
{
|
|
764
|
-
id: "
|
|
766
|
+
id: storage.createStorageErrorId("LANCE", "SAVE_RESOURCE", "FAILED"),
|
|
765
767
|
domain: error.ErrorDomain.STORAGE,
|
|
766
768
|
category: error.ErrorCategory.THIRD_PARTY
|
|
767
769
|
},
|
|
@@ -815,7 +817,7 @@ var StoreMemoryLance = class extends storage.MemoryStorage {
|
|
|
815
817
|
}
|
|
816
818
|
throw new error.MastraError(
|
|
817
819
|
{
|
|
818
|
-
id: "
|
|
820
|
+
id: storage.createStorageErrorId("LANCE", "UPDATE_RESOURCE", "FAILED"),
|
|
819
821
|
domain: error.ErrorDomain.STORAGE,
|
|
820
822
|
category: error.ErrorCategory.THIRD_PARTY
|
|
821
823
|
},
|
|
@@ -906,7 +908,7 @@ var StoreOperationsLance = class extends storage.StoreOperations {
|
|
|
906
908
|
} catch (error$1) {
|
|
907
909
|
throw new error.MastraError(
|
|
908
910
|
{
|
|
909
|
-
id: "
|
|
911
|
+
id: storage.createStorageErrorId("LANCE", "CREATE_TABLE", "INVALID_ARGS"),
|
|
910
912
|
domain: error.ErrorDomain.STORAGE,
|
|
911
913
|
category: error.ErrorCategory.USER,
|
|
912
914
|
details: { tableName }
|
|
@@ -924,7 +926,7 @@ var StoreOperationsLance = class extends storage.StoreOperations {
|
|
|
924
926
|
}
|
|
925
927
|
throw new error.MastraError(
|
|
926
928
|
{
|
|
927
|
-
id: "
|
|
929
|
+
id: storage.createStorageErrorId("LANCE", "CREATE_TABLE", "FAILED"),
|
|
928
930
|
domain: error.ErrorDomain.STORAGE,
|
|
929
931
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
930
932
|
details: { tableName }
|
|
@@ -944,7 +946,7 @@ var StoreOperationsLance = class extends storage.StoreOperations {
|
|
|
944
946
|
} catch (validationError) {
|
|
945
947
|
throw new error.MastraError(
|
|
946
948
|
{
|
|
947
|
-
id: "
|
|
949
|
+
id: storage.createStorageErrorId("LANCE", "DROP_TABLE", "INVALID_ARGS"),
|
|
948
950
|
domain: error.ErrorDomain.STORAGE,
|
|
949
951
|
category: error.ErrorCategory.USER,
|
|
950
952
|
text: validationError.message,
|
|
@@ -962,7 +964,7 @@ var StoreOperationsLance = class extends storage.StoreOperations {
|
|
|
962
964
|
}
|
|
963
965
|
throw new error.MastraError(
|
|
964
966
|
{
|
|
965
|
-
id: "
|
|
967
|
+
id: storage.createStorageErrorId("LANCE", "DROP_TABLE", "FAILED"),
|
|
966
968
|
domain: error.ErrorDomain.STORAGE,
|
|
967
969
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
968
970
|
details: { tableName }
|
|
@@ -993,7 +995,7 @@ var StoreOperationsLance = class extends storage.StoreOperations {
|
|
|
993
995
|
} catch (validationError) {
|
|
994
996
|
throw new error.MastraError(
|
|
995
997
|
{
|
|
996
|
-
id: "
|
|
998
|
+
id: storage.createStorageErrorId("LANCE", "ALTER_TABLE", "INVALID_ARGS"),
|
|
997
999
|
domain: error.ErrorDomain.STORAGE,
|
|
998
1000
|
category: error.ErrorCategory.USER,
|
|
999
1001
|
text: validationError.message,
|
|
@@ -1028,7 +1030,7 @@ var StoreOperationsLance = class extends storage.StoreOperations {
|
|
|
1028
1030
|
} catch (error$1) {
|
|
1029
1031
|
throw new error.MastraError(
|
|
1030
1032
|
{
|
|
1031
|
-
id: "
|
|
1033
|
+
id: storage.createStorageErrorId("LANCE", "ALTER_TABLE", "FAILED"),
|
|
1032
1034
|
domain: error.ErrorDomain.STORAGE,
|
|
1033
1035
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
1034
1036
|
details: { tableName }
|
|
@@ -1048,7 +1050,7 @@ var StoreOperationsLance = class extends storage.StoreOperations {
|
|
|
1048
1050
|
} catch (validationError) {
|
|
1049
1051
|
throw new error.MastraError(
|
|
1050
1052
|
{
|
|
1051
|
-
id: "
|
|
1053
|
+
id: storage.createStorageErrorId("LANCE", "CLEAR_TABLE", "INVALID_ARGS"),
|
|
1052
1054
|
domain: error.ErrorDomain.STORAGE,
|
|
1053
1055
|
category: error.ErrorCategory.USER,
|
|
1054
1056
|
text: validationError.message,
|
|
@@ -1063,7 +1065,7 @@ var StoreOperationsLance = class extends storage.StoreOperations {
|
|
|
1063
1065
|
} catch (error$1) {
|
|
1064
1066
|
throw new error.MastraError(
|
|
1065
1067
|
{
|
|
1066
|
-
id: "
|
|
1068
|
+
id: storage.createStorageErrorId("LANCE", "CLEAR_TABLE", "FAILED"),
|
|
1067
1069
|
domain: error.ErrorDomain.STORAGE,
|
|
1068
1070
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
1069
1071
|
details: { tableName }
|
|
@@ -1086,7 +1088,7 @@ var StoreOperationsLance = class extends storage.StoreOperations {
|
|
|
1086
1088
|
} catch (validationError) {
|
|
1087
1089
|
throw new error.MastraError(
|
|
1088
1090
|
{
|
|
1089
|
-
id: "
|
|
1091
|
+
id: storage.createStorageErrorId("LANCE", "INSERT", "INVALID_ARGS"),
|
|
1090
1092
|
domain: error.ErrorDomain.STORAGE,
|
|
1091
1093
|
category: error.ErrorCategory.USER,
|
|
1092
1094
|
text: validationError.message,
|
|
@@ -1105,12 +1107,11 @@ var StoreOperationsLance = class extends storage.StoreOperations {
|
|
|
1105
1107
|
processedRecord[key] = JSON.stringify(processedRecord[key]);
|
|
1106
1108
|
}
|
|
1107
1109
|
}
|
|
1108
|
-
console.info(await table.schema());
|
|
1109
1110
|
await table.mergeInsert(primaryId).whenMatchedUpdateAll().whenNotMatchedInsertAll().execute([processedRecord]);
|
|
1110
1111
|
} catch (error$1) {
|
|
1111
1112
|
throw new error.MastraError(
|
|
1112
1113
|
{
|
|
1113
|
-
id: "
|
|
1114
|
+
id: storage.createStorageErrorId("LANCE", "INSERT", "FAILED"),
|
|
1114
1115
|
domain: error.ErrorDomain.STORAGE,
|
|
1115
1116
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
1116
1117
|
details: { tableName }
|
|
@@ -1133,7 +1134,7 @@ var StoreOperationsLance = class extends storage.StoreOperations {
|
|
|
1133
1134
|
} catch (validationError) {
|
|
1134
1135
|
throw new error.MastraError(
|
|
1135
1136
|
{
|
|
1136
|
-
id: "
|
|
1137
|
+
id: storage.createStorageErrorId("LANCE", "BATCH_INSERT", "INVALID_ARGS"),
|
|
1137
1138
|
domain: error.ErrorDomain.STORAGE,
|
|
1138
1139
|
category: error.ErrorCategory.USER,
|
|
1139
1140
|
text: validationError.message,
|
|
@@ -1159,7 +1160,7 @@ var StoreOperationsLance = class extends storage.StoreOperations {
|
|
|
1159
1160
|
} catch (error$1) {
|
|
1160
1161
|
throw new error.MastraError(
|
|
1161
1162
|
{
|
|
1162
|
-
id: "
|
|
1163
|
+
id: storage.createStorageErrorId("LANCE", "BATCH_INSERT", "FAILED"),
|
|
1163
1164
|
domain: error.ErrorDomain.STORAGE,
|
|
1164
1165
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
1165
1166
|
details: { tableName }
|
|
@@ -1182,7 +1183,7 @@ var StoreOperationsLance = class extends storage.StoreOperations {
|
|
|
1182
1183
|
} catch (validationError) {
|
|
1183
1184
|
throw new error.MastraError(
|
|
1184
1185
|
{
|
|
1185
|
-
id: "
|
|
1186
|
+
id: storage.createStorageErrorId("LANCE", "LOAD", "INVALID_ARGS"),
|
|
1186
1187
|
domain: error.ErrorDomain.STORAGE,
|
|
1187
1188
|
category: error.ErrorCategory.USER,
|
|
1188
1189
|
text: validationError.message,
|
|
@@ -1221,7 +1222,7 @@ var StoreOperationsLance = class extends storage.StoreOperations {
|
|
|
1221
1222
|
if (error$1 instanceof error.MastraError) throw error$1;
|
|
1222
1223
|
throw new error.MastraError(
|
|
1223
1224
|
{
|
|
1224
|
-
id: "
|
|
1225
|
+
id: storage.createStorageErrorId("LANCE", "LOAD", "FAILED"),
|
|
1225
1226
|
domain: error.ErrorDomain.STORAGE,
|
|
1226
1227
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
1227
1228
|
details: { tableName, keyCount: Object.keys(keys).length, firstKey: Object.keys(keys)[0] ?? "" }
|
|
@@ -1244,7 +1245,7 @@ var StoreScoresLance = class extends storage.ScoresStorage {
|
|
|
1244
1245
|
} catch (error$1) {
|
|
1245
1246
|
throw new error.MastraError(
|
|
1246
1247
|
{
|
|
1247
|
-
id: "
|
|
1248
|
+
id: storage.createStorageErrorId("LANCE", "SAVE_SCORE", "INVALID_PAYLOAD"),
|
|
1248
1249
|
text: "Failed to save score in LanceStorage",
|
|
1249
1250
|
domain: error.ErrorDomain.STORAGE,
|
|
1250
1251
|
category: error.ErrorCategory.THIRD_PARTY
|
|
@@ -1268,13 +1269,15 @@ var StoreScoresLance = class extends storage.ScoresStorage {
|
|
|
1268
1269
|
filteredScore[key] = JSON.stringify(filteredScore[key]);
|
|
1269
1270
|
}
|
|
1270
1271
|
}
|
|
1272
|
+
filteredScore.createdAt = /* @__PURE__ */ new Date();
|
|
1273
|
+
filteredScore.updatedAt = /* @__PURE__ */ new Date();
|
|
1271
1274
|
filteredScore.id = id;
|
|
1272
1275
|
await table.add([filteredScore], { mode: "append" });
|
|
1273
1276
|
return { score };
|
|
1274
1277
|
} catch (error$1) {
|
|
1275
1278
|
throw new error.MastraError(
|
|
1276
1279
|
{
|
|
1277
|
-
id: "
|
|
1280
|
+
id: storage.createStorageErrorId("LANCE", "SAVE_SCORE", "FAILED"),
|
|
1278
1281
|
text: "Failed to save score in LanceStorage",
|
|
1279
1282
|
domain: error.ErrorDomain.STORAGE,
|
|
1280
1283
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
@@ -1290,12 +1293,11 @@ var StoreScoresLance = class extends storage.ScoresStorage {
|
|
|
1290
1293
|
const query = table.query().where(`id = '${id}'`).limit(1);
|
|
1291
1294
|
const records = await query.toArray();
|
|
1292
1295
|
if (records.length === 0) return null;
|
|
1293
|
-
|
|
1294
|
-
return processResultWithTypeConversion(records[0], schema);
|
|
1296
|
+
return await this.transformScoreRow(records[0]);
|
|
1295
1297
|
} catch (error$1) {
|
|
1296
1298
|
throw new error.MastraError(
|
|
1297
1299
|
{
|
|
1298
|
-
id: "
|
|
1300
|
+
id: storage.createStorageErrorId("LANCE", "GET_SCORE_BY_ID", "FAILED"),
|
|
1299
1301
|
text: "Failed to get score by id in LanceStorage",
|
|
1300
1302
|
domain: error.ErrorDomain.STORAGE,
|
|
1301
1303
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
@@ -1305,6 +1307,22 @@ var StoreScoresLance = class extends storage.ScoresStorage {
|
|
|
1305
1307
|
);
|
|
1306
1308
|
}
|
|
1307
1309
|
}
|
|
1310
|
+
/**
|
|
1311
|
+
* LanceDB-specific score row transformation.
|
|
1312
|
+
*
|
|
1313
|
+
* Note: This implementation does NOT use coreTransformScoreRow because:
|
|
1314
|
+
* 1. LanceDB stores schema information in the table itself (requires async fetch)
|
|
1315
|
+
* 2. Uses processResultWithTypeConversion utility for LanceDB-specific type handling
|
|
1316
|
+
*/
|
|
1317
|
+
async transformScoreRow(row) {
|
|
1318
|
+
const schema = await getTableSchema({ tableName: storage.TABLE_SCORERS, client: this.client });
|
|
1319
|
+
const transformed = processResultWithTypeConversion(row, schema);
|
|
1320
|
+
return {
|
|
1321
|
+
...transformed,
|
|
1322
|
+
createdAt: row.createdAt,
|
|
1323
|
+
updatedAt: row.updatedAt
|
|
1324
|
+
};
|
|
1325
|
+
}
|
|
1308
1326
|
async listScoresByScorerId({
|
|
1309
1327
|
scorerId,
|
|
1310
1328
|
pagination,
|
|
@@ -1345,8 +1363,7 @@ var StoreScoresLance = class extends storage.ScoresStorage {
|
|
|
1345
1363
|
if (start > 0) query = query.offset(start);
|
|
1346
1364
|
}
|
|
1347
1365
|
const records = await query.toArray();
|
|
1348
|
-
const
|
|
1349
|
-
const scores = processResultWithTypeConversion(records, schema);
|
|
1366
|
+
const scores = await Promise.all(records.map(async (record) => await this.transformScoreRow(record)));
|
|
1350
1367
|
return {
|
|
1351
1368
|
pagination: {
|
|
1352
1369
|
page,
|
|
@@ -1359,7 +1376,7 @@ var StoreScoresLance = class extends storage.ScoresStorage {
|
|
|
1359
1376
|
} catch (error$1) {
|
|
1360
1377
|
throw new error.MastraError(
|
|
1361
1378
|
{
|
|
1362
|
-
id: "
|
|
1379
|
+
id: storage.createStorageErrorId("LANCE", "LIST_SCORES_BY_SCORER_ID", "FAILED"),
|
|
1363
1380
|
text: "Failed to get scores by scorerId in LanceStorage",
|
|
1364
1381
|
domain: error.ErrorDomain.STORAGE,
|
|
1365
1382
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
@@ -1387,8 +1404,7 @@ var StoreScoresLance = class extends storage.ScoresStorage {
|
|
|
1387
1404
|
if (start > 0) query = query.offset(start);
|
|
1388
1405
|
}
|
|
1389
1406
|
const records = await query.toArray();
|
|
1390
|
-
const
|
|
1391
|
-
const scores = processResultWithTypeConversion(records, schema);
|
|
1407
|
+
const scores = await Promise.all(records.map(async (record) => await this.transformScoreRow(record)));
|
|
1392
1408
|
return {
|
|
1393
1409
|
pagination: {
|
|
1394
1410
|
page,
|
|
@@ -1401,7 +1417,7 @@ var StoreScoresLance = class extends storage.ScoresStorage {
|
|
|
1401
1417
|
} catch (error$1) {
|
|
1402
1418
|
throw new error.MastraError(
|
|
1403
1419
|
{
|
|
1404
|
-
id: "
|
|
1420
|
+
id: storage.createStorageErrorId("LANCE", "LIST_SCORES_BY_RUN_ID", "FAILED"),
|
|
1405
1421
|
text: "Failed to get scores by runId in LanceStorage",
|
|
1406
1422
|
domain: error.ErrorDomain.STORAGE,
|
|
1407
1423
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
@@ -1430,8 +1446,7 @@ var StoreScoresLance = class extends storage.ScoresStorage {
|
|
|
1430
1446
|
if (start > 0) query = query.offset(start);
|
|
1431
1447
|
}
|
|
1432
1448
|
const records = await query.toArray();
|
|
1433
|
-
const
|
|
1434
|
-
const scores = processResultWithTypeConversion(records, schema);
|
|
1449
|
+
const scores = await Promise.all(records.map(async (record) => await this.transformScoreRow(record)));
|
|
1435
1450
|
return {
|
|
1436
1451
|
pagination: {
|
|
1437
1452
|
page,
|
|
@@ -1444,7 +1459,7 @@ var StoreScoresLance = class extends storage.ScoresStorage {
|
|
|
1444
1459
|
} catch (error$1) {
|
|
1445
1460
|
throw new error.MastraError(
|
|
1446
1461
|
{
|
|
1447
|
-
id: "
|
|
1462
|
+
id: storage.createStorageErrorId("LANCE", "LIST_SCORES_BY_ENTITY_ID", "FAILED"),
|
|
1448
1463
|
text: "Failed to get scores by entityId and entityType in LanceStorage",
|
|
1449
1464
|
domain: error.ErrorDomain.STORAGE,
|
|
1450
1465
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
@@ -1473,8 +1488,7 @@ var StoreScoresLance = class extends storage.ScoresStorage {
|
|
|
1473
1488
|
if (start > 0) query = query.offset(start);
|
|
1474
1489
|
}
|
|
1475
1490
|
const records = await query.toArray();
|
|
1476
|
-
const
|
|
1477
|
-
const scores = processResultWithTypeConversion(records, schema);
|
|
1491
|
+
const scores = await Promise.all(records.map(async (record) => await this.transformScoreRow(record)));
|
|
1478
1492
|
return {
|
|
1479
1493
|
pagination: {
|
|
1480
1494
|
page,
|
|
@@ -1487,7 +1501,7 @@ var StoreScoresLance = class extends storage.ScoresStorage {
|
|
|
1487
1501
|
} catch (error$1) {
|
|
1488
1502
|
throw new error.MastraError(
|
|
1489
1503
|
{
|
|
1490
|
-
id: "
|
|
1504
|
+
id: storage.createStorageErrorId("LANCE", "LIST_SCORES_BY_SPAN", "FAILED"),
|
|
1491
1505
|
text: "Failed to get scores by traceId and spanId in LanceStorage",
|
|
1492
1506
|
domain: error.ErrorDomain.STORAGE,
|
|
1493
1507
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
@@ -1569,7 +1583,7 @@ var StoreWorkflowsLance = class extends storage.WorkflowsStorage {
|
|
|
1569
1583
|
} catch (error$1) {
|
|
1570
1584
|
throw new error.MastraError(
|
|
1571
1585
|
{
|
|
1572
|
-
id: "
|
|
1586
|
+
id: storage.createStorageErrorId("LANCE", "PERSIST_WORKFLOW_SNAPSHOT", "FAILED"),
|
|
1573
1587
|
domain: error.ErrorDomain.STORAGE,
|
|
1574
1588
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
1575
1589
|
details: { workflowName, runId }
|
|
@@ -1590,7 +1604,7 @@ var StoreWorkflowsLance = class extends storage.WorkflowsStorage {
|
|
|
1590
1604
|
} catch (error$1) {
|
|
1591
1605
|
throw new error.MastraError(
|
|
1592
1606
|
{
|
|
1593
|
-
id: "
|
|
1607
|
+
id: storage.createStorageErrorId("LANCE", "LOAD_WORKFLOW_SNAPSHOT", "FAILED"),
|
|
1594
1608
|
domain: error.ErrorDomain.STORAGE,
|
|
1595
1609
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
1596
1610
|
details: { workflowName, runId }
|
|
@@ -1614,7 +1628,7 @@ var StoreWorkflowsLance = class extends storage.WorkflowsStorage {
|
|
|
1614
1628
|
} catch (error$1) {
|
|
1615
1629
|
throw new error.MastraError(
|
|
1616
1630
|
{
|
|
1617
|
-
id: "
|
|
1631
|
+
id: storage.createStorageErrorId("LANCE", "GET_WORKFLOW_RUN_BY_ID", "FAILED"),
|
|
1618
1632
|
domain: error.ErrorDomain.STORAGE,
|
|
1619
1633
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
1620
1634
|
details: { runId: args.runId, workflowName: args.workflowName ?? "" }
|
|
@@ -1656,7 +1670,7 @@ var StoreWorkflowsLance = class extends storage.WorkflowsStorage {
|
|
|
1656
1670
|
if (args.page < 0 || !Number.isInteger(args.page)) {
|
|
1657
1671
|
throw new error.MastraError(
|
|
1658
1672
|
{
|
|
1659
|
-
id: "
|
|
1673
|
+
id: storage.createStorageErrorId("LANCE", "LIST_WORKFLOW_RUNS", "INVALID_PAGINATION"),
|
|
1660
1674
|
domain: error.ErrorDomain.STORAGE,
|
|
1661
1675
|
category: error.ErrorCategory.USER,
|
|
1662
1676
|
details: { page: args.page, perPage: args.perPage }
|
|
@@ -1676,7 +1690,7 @@ var StoreWorkflowsLance = class extends storage.WorkflowsStorage {
|
|
|
1676
1690
|
} catch (error$1) {
|
|
1677
1691
|
throw new error.MastraError(
|
|
1678
1692
|
{
|
|
1679
|
-
id: "
|
|
1693
|
+
id: storage.createStorageErrorId("LANCE", "LIST_WORKFLOW_RUNS", "FAILED"),
|
|
1680
1694
|
domain: error.ErrorDomain.STORAGE,
|
|
1681
1695
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
1682
1696
|
details: { resourceId: args?.resourceId ?? "", workflowName: args?.workflowName ?? "" }
|
|
@@ -1696,7 +1710,8 @@ var LanceStorage = class _LanceStorage extends storage.MastraStorage {
|
|
|
1696
1710
|
* @param id The unique identifier for this storage instance
|
|
1697
1711
|
* @param name The name for this storage instance
|
|
1698
1712
|
* @param uri The URI to connect to LanceDB
|
|
1699
|
-
* @param
|
|
1713
|
+
* @param connectionOptions connection options for LanceDB
|
|
1714
|
+
* @param storageOptions storage options including disableInit
|
|
1700
1715
|
*
|
|
1701
1716
|
* Usage:
|
|
1702
1717
|
*
|
|
@@ -1714,11 +1729,16 @@ var LanceStorage = class _LanceStorage extends storage.MastraStorage {
|
|
|
1714
1729
|
* ```ts
|
|
1715
1730
|
* const store = await LanceStorage.create('my-storage-id', 'MyStorage', 's3://bucket/db', { storageOptions: { timeout: '60s' } });
|
|
1716
1731
|
* ```
|
|
1732
|
+
*
|
|
1733
|
+
* Disable auto-init for runtime (after CI/CD has run migrations)
|
|
1734
|
+
* ```ts
|
|
1735
|
+
* const store = await LanceStorage.create('my-storage-id', 'MyStorage', '/path/to/db', undefined, { disableInit: true });
|
|
1736
|
+
* ```
|
|
1717
1737
|
*/
|
|
1718
|
-
static async create(id, name, uri,
|
|
1719
|
-
const instance = new _LanceStorage(id, name);
|
|
1738
|
+
static async create(id, name, uri, connectionOptions, storageOptions) {
|
|
1739
|
+
const instance = new _LanceStorage(id, name, storageOptions?.disableInit);
|
|
1720
1740
|
try {
|
|
1721
|
-
instance.lanceClient = await lancedb.connect(uri,
|
|
1741
|
+
instance.lanceClient = await lancedb.connect(uri, connectionOptions);
|
|
1722
1742
|
const operations = new StoreOperationsLance({ client: instance.lanceClient });
|
|
1723
1743
|
instance.stores = {
|
|
1724
1744
|
operations: new StoreOperationsLance({ client: instance.lanceClient }),
|
|
@@ -1730,11 +1750,11 @@ var LanceStorage = class _LanceStorage extends storage.MastraStorage {
|
|
|
1730
1750
|
} catch (e) {
|
|
1731
1751
|
throw new error.MastraError(
|
|
1732
1752
|
{
|
|
1733
|
-
id: "
|
|
1753
|
+
id: storage.createStorageErrorId("LANCE", "CONNECT", "FAILED"),
|
|
1734
1754
|
domain: error.ErrorDomain.STORAGE,
|
|
1735
1755
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
1736
1756
|
text: `Failed to connect to LanceDB: ${e.message || e}`,
|
|
1737
|
-
details: { uri, optionsProvided: !!
|
|
1757
|
+
details: { uri, optionsProvided: !!connectionOptions }
|
|
1738
1758
|
},
|
|
1739
1759
|
e
|
|
1740
1760
|
);
|
|
@@ -1744,8 +1764,8 @@ var LanceStorage = class _LanceStorage extends storage.MastraStorage {
|
|
|
1744
1764
|
* @internal
|
|
1745
1765
|
* Private constructor to enforce using the create factory method
|
|
1746
1766
|
*/
|
|
1747
|
-
constructor(id, name) {
|
|
1748
|
-
super({ id, name });
|
|
1767
|
+
constructor(id, name, disableInit) {
|
|
1768
|
+
super({ id, name, disableInit });
|
|
1749
1769
|
const operations = new StoreOperationsLance({ client: this.lanceClient });
|
|
1750
1770
|
this.stores = {
|
|
1751
1771
|
operations: new StoreOperationsLance({ client: this.lanceClient }),
|
|
@@ -2308,7 +2328,7 @@ var LanceVectorStore = class _LanceVectorStore extends vector.MastraVector {
|
|
|
2308
2328
|
} catch (e) {
|
|
2309
2329
|
throw new error.MastraError(
|
|
2310
2330
|
{
|
|
2311
|
-
id: "
|
|
2331
|
+
id: storage.createVectorErrorId("LANCE", "CONNECT", "FAILED"),
|
|
2312
2332
|
domain: error.ErrorDomain.STORAGE,
|
|
2313
2333
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
2314
2334
|
details: { uri }
|
|
@@ -2351,7 +2371,7 @@ var LanceVectorStore = class _LanceVectorStore extends vector.MastraVector {
|
|
|
2351
2371
|
} catch (error$1) {
|
|
2352
2372
|
throw new error.MastraError(
|
|
2353
2373
|
{
|
|
2354
|
-
id: "
|
|
2374
|
+
id: storage.createVectorErrorId("LANCE", "QUERY", "INVALID_ARGS"),
|
|
2355
2375
|
domain: error.ErrorDomain.STORAGE,
|
|
2356
2376
|
category: error.ErrorCategory.USER,
|
|
2357
2377
|
text: "LanceDB client not initialized. Use LanceVectorStore.create() to create an instance",
|
|
@@ -2399,7 +2419,7 @@ var LanceVectorStore = class _LanceVectorStore extends vector.MastraVector {
|
|
|
2399
2419
|
} catch (error$1) {
|
|
2400
2420
|
throw new error.MastraError(
|
|
2401
2421
|
{
|
|
2402
|
-
id: "
|
|
2422
|
+
id: storage.createVectorErrorId("LANCE", "QUERY", "FAILED"),
|
|
2403
2423
|
domain: error.ErrorDomain.STORAGE,
|
|
2404
2424
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
2405
2425
|
details: { tableName, includeVector, columnsCount: columns?.length, includeAllColumns }
|
|
@@ -2451,7 +2471,7 @@ var LanceVectorStore = class _LanceVectorStore extends vector.MastraVector {
|
|
|
2451
2471
|
} catch (error$1) {
|
|
2452
2472
|
throw new error.MastraError(
|
|
2453
2473
|
{
|
|
2454
|
-
id: "
|
|
2474
|
+
id: storage.createVectorErrorId("LANCE", "UPSERT", "INVALID_ARGS"),
|
|
2455
2475
|
domain: error.ErrorDomain.STORAGE,
|
|
2456
2476
|
category: error.ErrorCategory.USER,
|
|
2457
2477
|
text: "LanceDB client not initialized. Use LanceVectorStore.create() to create an instance",
|
|
@@ -2487,7 +2507,7 @@ var LanceVectorStore = class _LanceVectorStore extends vector.MastraVector {
|
|
|
2487
2507
|
} catch (error$1) {
|
|
2488
2508
|
throw new error.MastraError(
|
|
2489
2509
|
{
|
|
2490
|
-
id: "
|
|
2510
|
+
id: storage.createVectorErrorId("LANCE", "UPSERT", "FAILED"),
|
|
2491
2511
|
domain: error.ErrorDomain.STORAGE,
|
|
2492
2512
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
2493
2513
|
details: { tableName, vectorCount: vectors.length, metadataCount: metadata.length, idsCount: ids.length }
|
|
@@ -2514,7 +2534,7 @@ var LanceVectorStore = class _LanceVectorStore extends vector.MastraVector {
|
|
|
2514
2534
|
async createTable(tableName, data, options) {
|
|
2515
2535
|
if (!this.lanceClient) {
|
|
2516
2536
|
throw new error.MastraError({
|
|
2517
|
-
id: "
|
|
2537
|
+
id: storage.createVectorErrorId("LANCE", "CREATE_TABLE", "INVALID_ARGS"),
|
|
2518
2538
|
domain: error.ErrorDomain.STORAGE,
|
|
2519
2539
|
category: error.ErrorCategory.USER,
|
|
2520
2540
|
text: "LanceDB client not initialized. Use LanceVectorStore.create() to create an instance",
|
|
@@ -2529,7 +2549,7 @@ var LanceVectorStore = class _LanceVectorStore extends vector.MastraVector {
|
|
|
2529
2549
|
} catch (error$1) {
|
|
2530
2550
|
throw new error.MastraError(
|
|
2531
2551
|
{
|
|
2532
|
-
id: "
|
|
2552
|
+
id: storage.createVectorErrorId("LANCE", "CREATE_TABLE", "FAILED"),
|
|
2533
2553
|
domain: error.ErrorDomain.STORAGE,
|
|
2534
2554
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
2535
2555
|
details: { tableName }
|
|
@@ -2541,7 +2561,7 @@ var LanceVectorStore = class _LanceVectorStore extends vector.MastraVector {
|
|
|
2541
2561
|
async listTables() {
|
|
2542
2562
|
if (!this.lanceClient) {
|
|
2543
2563
|
throw new error.MastraError({
|
|
2544
|
-
id: "
|
|
2564
|
+
id: storage.createVectorErrorId("LANCE", "LIST_TABLES", "INVALID_ARGS"),
|
|
2545
2565
|
domain: error.ErrorDomain.STORAGE,
|
|
2546
2566
|
category: error.ErrorCategory.USER,
|
|
2547
2567
|
text: "LanceDB client not initialized. Use LanceVectorStore.create() to create an instance",
|
|
@@ -2553,7 +2573,7 @@ var LanceVectorStore = class _LanceVectorStore extends vector.MastraVector {
|
|
|
2553
2573
|
} catch (error$1) {
|
|
2554
2574
|
throw new error.MastraError(
|
|
2555
2575
|
{
|
|
2556
|
-
id: "
|
|
2576
|
+
id: storage.createVectorErrorId("LANCE", "LIST_TABLES", "FAILED"),
|
|
2557
2577
|
domain: error.ErrorDomain.STORAGE,
|
|
2558
2578
|
category: error.ErrorCategory.THIRD_PARTY
|
|
2559
2579
|
},
|
|
@@ -2564,7 +2584,7 @@ var LanceVectorStore = class _LanceVectorStore extends vector.MastraVector {
|
|
|
2564
2584
|
async getTableSchema(tableName) {
|
|
2565
2585
|
if (!this.lanceClient) {
|
|
2566
2586
|
throw new error.MastraError({
|
|
2567
|
-
id: "
|
|
2587
|
+
id: storage.createVectorErrorId("LANCE", "GET_TABLE_SCHEMA", "INVALID_ARGS"),
|
|
2568
2588
|
domain: error.ErrorDomain.STORAGE,
|
|
2569
2589
|
category: error.ErrorCategory.USER,
|
|
2570
2590
|
text: "LanceDB client not initialized. Use LanceVectorStore.create() to create an instance",
|
|
@@ -2577,7 +2597,7 @@ var LanceVectorStore = class _LanceVectorStore extends vector.MastraVector {
|
|
|
2577
2597
|
} catch (error$1) {
|
|
2578
2598
|
throw new error.MastraError(
|
|
2579
2599
|
{
|
|
2580
|
-
id: "
|
|
2600
|
+
id: storage.createVectorErrorId("LANCE", "GET_TABLE_SCHEMA", "FAILED"),
|
|
2581
2601
|
domain: error.ErrorDomain.STORAGE,
|
|
2582
2602
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
2583
2603
|
details: { tableName }
|
|
@@ -2612,7 +2632,7 @@ var LanceVectorStore = class _LanceVectorStore extends vector.MastraVector {
|
|
|
2612
2632
|
} catch (err) {
|
|
2613
2633
|
throw new error.MastraError(
|
|
2614
2634
|
{
|
|
2615
|
-
id: "
|
|
2635
|
+
id: storage.createVectorErrorId("LANCE", "CREATE_INDEX", "INVALID_ARGS"),
|
|
2616
2636
|
domain: error.ErrorDomain.STORAGE,
|
|
2617
2637
|
category: error.ErrorCategory.USER,
|
|
2618
2638
|
details: { tableName: tableName || "", indexName, dimension, metric }
|
|
@@ -2657,7 +2677,7 @@ var LanceVectorStore = class _LanceVectorStore extends vector.MastraVector {
|
|
|
2657
2677
|
} catch (error$1) {
|
|
2658
2678
|
throw new error.MastraError(
|
|
2659
2679
|
{
|
|
2660
|
-
id: "
|
|
2680
|
+
id: storage.createVectorErrorId("LANCE", "CREATE_INDEX", "FAILED"),
|
|
2661
2681
|
domain: error.ErrorDomain.STORAGE,
|
|
2662
2682
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
2663
2683
|
details: { tableName: tableName || "", indexName, dimension }
|
|
@@ -2669,7 +2689,7 @@ var LanceVectorStore = class _LanceVectorStore extends vector.MastraVector {
|
|
|
2669
2689
|
async listIndexes() {
|
|
2670
2690
|
if (!this.lanceClient) {
|
|
2671
2691
|
throw new error.MastraError({
|
|
2672
|
-
id: "
|
|
2692
|
+
id: storage.createVectorErrorId("LANCE", "LIST_INDEXES", "INVALID_ARGS"),
|
|
2673
2693
|
domain: error.ErrorDomain.STORAGE,
|
|
2674
2694
|
category: error.ErrorCategory.USER,
|
|
2675
2695
|
text: "LanceDB client not initialized. Use LanceVectorStore.create() to create an instance",
|
|
@@ -2688,7 +2708,7 @@ var LanceVectorStore = class _LanceVectorStore extends vector.MastraVector {
|
|
|
2688
2708
|
} catch (error$1) {
|
|
2689
2709
|
throw new error.MastraError(
|
|
2690
2710
|
{
|
|
2691
|
-
id: "
|
|
2711
|
+
id: storage.createVectorErrorId("LANCE", "LIST_INDEXES", "FAILED"),
|
|
2692
2712
|
domain: error.ErrorDomain.STORAGE,
|
|
2693
2713
|
category: error.ErrorCategory.THIRD_PARTY
|
|
2694
2714
|
},
|
|
@@ -2707,7 +2727,7 @@ var LanceVectorStore = class _LanceVectorStore extends vector.MastraVector {
|
|
|
2707
2727
|
} catch (err) {
|
|
2708
2728
|
throw new error.MastraError(
|
|
2709
2729
|
{
|
|
2710
|
-
id: "
|
|
2730
|
+
id: storage.createVectorErrorId("LANCE", "DESCRIBE_INDEX", "INVALID_ARGS"),
|
|
2711
2731
|
domain: error.ErrorDomain.STORAGE,
|
|
2712
2732
|
category: error.ErrorCategory.USER,
|
|
2713
2733
|
details: { indexName }
|
|
@@ -2742,7 +2762,7 @@ var LanceVectorStore = class _LanceVectorStore extends vector.MastraVector {
|
|
|
2742
2762
|
} catch (error$1) {
|
|
2743
2763
|
throw new error.MastraError(
|
|
2744
2764
|
{
|
|
2745
|
-
id: "
|
|
2765
|
+
id: storage.createVectorErrorId("LANCE", "DESCRIBE_INDEX", "FAILED"),
|
|
2746
2766
|
domain: error.ErrorDomain.STORAGE,
|
|
2747
2767
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
2748
2768
|
details: { indexName }
|
|
@@ -2762,7 +2782,7 @@ var LanceVectorStore = class _LanceVectorStore extends vector.MastraVector {
|
|
|
2762
2782
|
} catch (err) {
|
|
2763
2783
|
throw new error.MastraError(
|
|
2764
2784
|
{
|
|
2765
|
-
id: "
|
|
2785
|
+
id: storage.createVectorErrorId("LANCE", "DELETE_INDEX", "INVALID_ARGS"),
|
|
2766
2786
|
domain: error.ErrorDomain.STORAGE,
|
|
2767
2787
|
category: error.ErrorCategory.USER,
|
|
2768
2788
|
details: { indexName }
|
|
@@ -2785,7 +2805,7 @@ var LanceVectorStore = class _LanceVectorStore extends vector.MastraVector {
|
|
|
2785
2805
|
} catch (error$1) {
|
|
2786
2806
|
throw new error.MastraError(
|
|
2787
2807
|
{
|
|
2788
|
-
id: "
|
|
2808
|
+
id: storage.createVectorErrorId("LANCE", "DELETE_INDEX", "FAILED"),
|
|
2789
2809
|
domain: error.ErrorDomain.STORAGE,
|
|
2790
2810
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
2791
2811
|
details: { indexName }
|
|
@@ -2800,7 +2820,7 @@ var LanceVectorStore = class _LanceVectorStore extends vector.MastraVector {
|
|
|
2800
2820
|
async deleteAllTables() {
|
|
2801
2821
|
if (!this.lanceClient) {
|
|
2802
2822
|
throw new error.MastraError({
|
|
2803
|
-
id: "
|
|
2823
|
+
id: storage.createVectorErrorId("LANCE", "DELETE_ALL_TABLES", "INVALID_ARGS"),
|
|
2804
2824
|
domain: error.ErrorDomain.STORAGE,
|
|
2805
2825
|
category: error.ErrorCategory.USER,
|
|
2806
2826
|
details: { methodName: "deleteAllTables" },
|
|
@@ -2812,7 +2832,7 @@ var LanceVectorStore = class _LanceVectorStore extends vector.MastraVector {
|
|
|
2812
2832
|
} catch (error$1) {
|
|
2813
2833
|
throw new error.MastraError(
|
|
2814
2834
|
{
|
|
2815
|
-
id: "
|
|
2835
|
+
id: storage.createVectorErrorId("LANCE", "DELETE_ALL_TABLES", "FAILED"),
|
|
2816
2836
|
domain: error.ErrorDomain.STORAGE,
|
|
2817
2837
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
2818
2838
|
details: { methodName: "deleteAllTables" }
|
|
@@ -2824,7 +2844,7 @@ var LanceVectorStore = class _LanceVectorStore extends vector.MastraVector {
|
|
|
2824
2844
|
async deleteTable(tableName) {
|
|
2825
2845
|
if (!this.lanceClient) {
|
|
2826
2846
|
throw new error.MastraError({
|
|
2827
|
-
id: "
|
|
2847
|
+
id: storage.createVectorErrorId("LANCE", "DELETE_TABLE", "INVALID_ARGS"),
|
|
2828
2848
|
domain: error.ErrorDomain.STORAGE,
|
|
2829
2849
|
category: error.ErrorCategory.USER,
|
|
2830
2850
|
details: { tableName },
|
|
@@ -2836,7 +2856,7 @@ var LanceVectorStore = class _LanceVectorStore extends vector.MastraVector {
|
|
|
2836
2856
|
} catch (error$1) {
|
|
2837
2857
|
throw new error.MastraError(
|
|
2838
2858
|
{
|
|
2839
|
-
id: "
|
|
2859
|
+
id: storage.createVectorErrorId("LANCE", "DELETE_TABLE", "FAILED"),
|
|
2840
2860
|
domain: error.ErrorDomain.STORAGE,
|
|
2841
2861
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
2842
2862
|
details: { tableName }
|
|
@@ -2849,7 +2869,7 @@ var LanceVectorStore = class _LanceVectorStore extends vector.MastraVector {
|
|
|
2849
2869
|
const { indexName, update } = params;
|
|
2850
2870
|
if ("id" in params && "filter" in params && params.id && params.filter) {
|
|
2851
2871
|
throw new error.MastraError({
|
|
2852
|
-
id: "
|
|
2872
|
+
id: storage.createVectorErrorId("LANCE", "UPDATE_VECTOR", "MUTUALLY_EXCLUSIVE"),
|
|
2853
2873
|
domain: error.ErrorDomain.STORAGE,
|
|
2854
2874
|
category: error.ErrorCategory.USER,
|
|
2855
2875
|
text: "id and filter are mutually exclusive",
|
|
@@ -2858,7 +2878,7 @@ var LanceVectorStore = class _LanceVectorStore extends vector.MastraVector {
|
|
|
2858
2878
|
}
|
|
2859
2879
|
if (!("id" in params || "filter" in params) || !params.id && !params.filter) {
|
|
2860
2880
|
throw new error.MastraError({
|
|
2861
|
-
id: "
|
|
2881
|
+
id: storage.createVectorErrorId("LANCE", "UPDATE_VECTOR", "NO_TARGET"),
|
|
2862
2882
|
domain: error.ErrorDomain.STORAGE,
|
|
2863
2883
|
category: error.ErrorCategory.USER,
|
|
2864
2884
|
text: "Either id or filter must be provided",
|
|
@@ -2867,7 +2887,7 @@ var LanceVectorStore = class _LanceVectorStore extends vector.MastraVector {
|
|
|
2867
2887
|
}
|
|
2868
2888
|
if ("filter" in params && params.filter && Object.keys(params.filter).length === 0) {
|
|
2869
2889
|
throw new error.MastraError({
|
|
2870
|
-
id: "
|
|
2890
|
+
id: storage.createVectorErrorId("LANCE", "UPDATE_VECTOR", "EMPTY_FILTER"),
|
|
2871
2891
|
domain: error.ErrorDomain.STORAGE,
|
|
2872
2892
|
category: error.ErrorCategory.USER,
|
|
2873
2893
|
text: "Cannot update with empty filter",
|
|
@@ -2876,7 +2896,7 @@ var LanceVectorStore = class _LanceVectorStore extends vector.MastraVector {
|
|
|
2876
2896
|
}
|
|
2877
2897
|
if (!update.vector && !update.metadata) {
|
|
2878
2898
|
throw new error.MastraError({
|
|
2879
|
-
id: "
|
|
2899
|
+
id: storage.createVectorErrorId("LANCE", "UPDATE_VECTOR", "NO_PAYLOAD"),
|
|
2880
2900
|
domain: error.ErrorDomain.STORAGE,
|
|
2881
2901
|
category: error.ErrorCategory.USER,
|
|
2882
2902
|
text: "No updates provided",
|
|
@@ -2971,7 +2991,7 @@ var LanceVectorStore = class _LanceVectorStore extends vector.MastraVector {
|
|
|
2971
2991
|
if (error$1 instanceof error.MastraError) throw error$1;
|
|
2972
2992
|
throw new error.MastraError(
|
|
2973
2993
|
{
|
|
2974
|
-
id: "
|
|
2994
|
+
id: storage.createVectorErrorId("LANCE", "UPDATE_VECTOR", "FAILED"),
|
|
2975
2995
|
domain: error.ErrorDomain.STORAGE,
|
|
2976
2996
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
2977
2997
|
details: {
|
|
@@ -3000,7 +3020,7 @@ var LanceVectorStore = class _LanceVectorStore extends vector.MastraVector {
|
|
|
3000
3020
|
} catch (err) {
|
|
3001
3021
|
throw new error.MastraError(
|
|
3002
3022
|
{
|
|
3003
|
-
id: "
|
|
3023
|
+
id: storage.createVectorErrorId("LANCE", "DELETE_VECTOR", "INVALID_ARGS"),
|
|
3004
3024
|
domain: error.ErrorDomain.STORAGE,
|
|
3005
3025
|
category: error.ErrorCategory.USER,
|
|
3006
3026
|
details: {
|
|
@@ -3033,7 +3053,7 @@ var LanceVectorStore = class _LanceVectorStore extends vector.MastraVector {
|
|
|
3033
3053
|
} catch (error$1) {
|
|
3034
3054
|
throw new error.MastraError(
|
|
3035
3055
|
{
|
|
3036
|
-
id: "
|
|
3056
|
+
id: storage.createVectorErrorId("LANCE", "DELETE_VECTOR", "FAILED"),
|
|
3037
3057
|
domain: error.ErrorDomain.STORAGE,
|
|
3038
3058
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
3039
3059
|
details: {
|
|
@@ -3073,7 +3093,7 @@ var LanceVectorStore = class _LanceVectorStore extends vector.MastraVector {
|
|
|
3073
3093
|
async deleteVectors({ indexName, filter, ids }) {
|
|
3074
3094
|
if (ids && filter) {
|
|
3075
3095
|
throw new error.MastraError({
|
|
3076
|
-
id: "
|
|
3096
|
+
id: storage.createVectorErrorId("LANCE", "DELETE_VECTORS", "MUTUALLY_EXCLUSIVE"),
|
|
3077
3097
|
domain: error.ErrorDomain.STORAGE,
|
|
3078
3098
|
category: error.ErrorCategory.USER,
|
|
3079
3099
|
text: "ids and filter are mutually exclusive",
|
|
@@ -3082,7 +3102,7 @@ var LanceVectorStore = class _LanceVectorStore extends vector.MastraVector {
|
|
|
3082
3102
|
}
|
|
3083
3103
|
if (!ids && !filter) {
|
|
3084
3104
|
throw new error.MastraError({
|
|
3085
|
-
id: "
|
|
3105
|
+
id: storage.createVectorErrorId("LANCE", "DELETE_VECTORS", "NO_TARGET"),
|
|
3086
3106
|
domain: error.ErrorDomain.STORAGE,
|
|
3087
3107
|
category: error.ErrorCategory.USER,
|
|
3088
3108
|
text: "Either filter or ids must be provided",
|
|
@@ -3091,7 +3111,7 @@ var LanceVectorStore = class _LanceVectorStore extends vector.MastraVector {
|
|
|
3091
3111
|
}
|
|
3092
3112
|
if (ids && ids.length === 0) {
|
|
3093
3113
|
throw new error.MastraError({
|
|
3094
|
-
id: "
|
|
3114
|
+
id: storage.createVectorErrorId("LANCE", "DELETE_VECTORS", "EMPTY_IDS"),
|
|
3095
3115
|
domain: error.ErrorDomain.STORAGE,
|
|
3096
3116
|
category: error.ErrorCategory.USER,
|
|
3097
3117
|
text: "Cannot delete with empty ids array",
|
|
@@ -3100,7 +3120,7 @@ var LanceVectorStore = class _LanceVectorStore extends vector.MastraVector {
|
|
|
3100
3120
|
}
|
|
3101
3121
|
if (filter && Object.keys(filter).length === 0) {
|
|
3102
3122
|
throw new error.MastraError({
|
|
3103
|
-
id: "
|
|
3123
|
+
id: storage.createVectorErrorId("LANCE", "DELETE_VECTORS", "EMPTY_FILTER"),
|
|
3104
3124
|
domain: error.ErrorDomain.STORAGE,
|
|
3105
3125
|
category: error.ErrorCategory.USER,
|
|
3106
3126
|
text: "Cannot delete with empty filter",
|
|
@@ -3160,7 +3180,7 @@ var LanceVectorStore = class _LanceVectorStore extends vector.MastraVector {
|
|
|
3160
3180
|
if (error$1 instanceof error.MastraError) throw error$1;
|
|
3161
3181
|
throw new error.MastraError(
|
|
3162
3182
|
{
|
|
3163
|
-
id: "
|
|
3183
|
+
id: storage.createVectorErrorId("LANCE", "DELETE_VECTORS", "FAILED"),
|
|
3164
3184
|
domain: error.ErrorDomain.STORAGE,
|
|
3165
3185
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
3166
3186
|
details: {
|