@mastra/lance 1.0.0-beta.3 → 1.0.0-beta.5
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 +47 -0
- package/dist/index.cjs +111 -98
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +112 -99
- 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 +2 -2
- 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 +32 -4
- 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.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { connect, Index } from '@lancedb/lancedb';
|
|
2
2
|
import { MastraError, ErrorCategory, ErrorDomain } from '@mastra/core/error';
|
|
3
|
-
import { MastraStorage, StoreOperations, MemoryStorage, TABLE_THREADS, TABLE_MESSAGES, normalizePerPage, calculatePagination, TABLE_RESOURCES, ScoresStorage, TABLE_SCORERS, WorkflowsStorage, TABLE_WORKFLOW_SNAPSHOT, ensureDate } from '@mastra/core/storage';
|
|
3
|
+
import { MastraStorage, createStorageErrorId, createVectorErrorId, StoreOperations, MemoryStorage, TABLE_THREADS, TABLE_MESSAGES, normalizePerPage, calculatePagination, TABLE_RESOURCES, ScoresStorage, TABLE_SCORERS, WorkflowsStorage, TABLE_WORKFLOW_SNAPSHOT, ensureDate } from '@mastra/core/storage';
|
|
4
4
|
import { MessageList } from '@mastra/core/agent';
|
|
5
5
|
import { Utf8, Float64, Binary, Float32, Int32, Field, Schema } from 'apache-arrow';
|
|
6
6
|
import { saveScorePayloadSchema } from '@mastra/core/evals';
|
|
@@ -89,7 +89,7 @@ async function getTableSchema({
|
|
|
89
89
|
} catch (validationError) {
|
|
90
90
|
throw new MastraError(
|
|
91
91
|
{
|
|
92
|
-
id: "
|
|
92
|
+
id: createStorageErrorId("LANCE", "GET_TABLE_SCHEMA", "INVALID_ARGS"),
|
|
93
93
|
domain: ErrorDomain.STORAGE,
|
|
94
94
|
category: ErrorCategory.USER,
|
|
95
95
|
text: validationError.message,
|
|
@@ -112,7 +112,7 @@ async function getTableSchema({
|
|
|
112
112
|
} catch (error) {
|
|
113
113
|
throw new MastraError(
|
|
114
114
|
{
|
|
115
|
-
id: "
|
|
115
|
+
id: createStorageErrorId("LANCE", "GET_TABLE_SCHEMA", "FAILED"),
|
|
116
116
|
domain: ErrorDomain.STORAGE,
|
|
117
117
|
category: ErrorCategory.THIRD_PARTY,
|
|
118
118
|
details: { tableName }
|
|
@@ -149,7 +149,7 @@ var StoreMemoryLance = class extends MemoryStorage {
|
|
|
149
149
|
} catch (error) {
|
|
150
150
|
throw new MastraError(
|
|
151
151
|
{
|
|
152
|
-
id: "
|
|
152
|
+
id: createStorageErrorId("LANCE", "GET_THREAD_BY_ID", "FAILED"),
|
|
153
153
|
domain: ErrorDomain.STORAGE,
|
|
154
154
|
category: ErrorCategory.THIRD_PARTY
|
|
155
155
|
},
|
|
@@ -171,7 +171,7 @@ var StoreMemoryLance = class extends MemoryStorage {
|
|
|
171
171
|
} catch (error) {
|
|
172
172
|
throw new MastraError(
|
|
173
173
|
{
|
|
174
|
-
id: "
|
|
174
|
+
id: createStorageErrorId("LANCE", "SAVE_THREAD", "FAILED"),
|
|
175
175
|
domain: ErrorDomain.STORAGE,
|
|
176
176
|
category: ErrorCategory.THIRD_PARTY
|
|
177
177
|
},
|
|
@@ -213,7 +213,7 @@ var StoreMemoryLance = class extends MemoryStorage {
|
|
|
213
213
|
}
|
|
214
214
|
throw new MastraError(
|
|
215
215
|
{
|
|
216
|
-
id: "
|
|
216
|
+
id: createStorageErrorId("LANCE", "UPDATE_THREAD", "FAILED"),
|
|
217
217
|
domain: ErrorDomain.STORAGE,
|
|
218
218
|
category: ErrorCategory.THIRD_PARTY
|
|
219
219
|
},
|
|
@@ -223,7 +223,7 @@ var StoreMemoryLance = class extends MemoryStorage {
|
|
|
223
223
|
}
|
|
224
224
|
throw new MastraError(
|
|
225
225
|
{
|
|
226
|
-
id: "
|
|
226
|
+
id: createStorageErrorId("LANCE", "UPDATE_THREAD", "FAILED"),
|
|
227
227
|
domain: ErrorDomain.STORAGE,
|
|
228
228
|
category: ErrorCategory.THIRD_PARTY
|
|
229
229
|
},
|
|
@@ -239,7 +239,7 @@ var StoreMemoryLance = class extends MemoryStorage {
|
|
|
239
239
|
} catch (error) {
|
|
240
240
|
throw new MastraError(
|
|
241
241
|
{
|
|
242
|
-
id: "
|
|
242
|
+
id: createStorageErrorId("LANCE", "DELETE_THREAD", "FAILED"),
|
|
243
243
|
domain: ErrorDomain.STORAGE,
|
|
244
244
|
category: ErrorCategory.THIRD_PARTY
|
|
245
245
|
},
|
|
@@ -279,7 +279,7 @@ var StoreMemoryLance = class extends MemoryStorage {
|
|
|
279
279
|
} catch (error) {
|
|
280
280
|
throw new MastraError(
|
|
281
281
|
{
|
|
282
|
-
id: "
|
|
282
|
+
id: createStorageErrorId("LANCE", "LIST_MESSAGES_BY_ID", "FAILED"),
|
|
283
283
|
domain: ErrorDomain.STORAGE,
|
|
284
284
|
category: ErrorCategory.THIRD_PARTY,
|
|
285
285
|
details: {
|
|
@@ -296,7 +296,7 @@ var StoreMemoryLance = class extends MemoryStorage {
|
|
|
296
296
|
if (threadIds.length === 0 || threadIds.some((id) => !id.trim())) {
|
|
297
297
|
throw new MastraError(
|
|
298
298
|
{
|
|
299
|
-
id: "
|
|
299
|
+
id: createStorageErrorId("LANCE", "LIST_MESSAGES", "INVALID_THREAD_ID"),
|
|
300
300
|
domain: ErrorDomain.STORAGE,
|
|
301
301
|
category: ErrorCategory.THIRD_PARTY,
|
|
302
302
|
details: { threadId: Array.isArray(threadId) ? threadId.join(",") : threadId }
|
|
@@ -310,7 +310,7 @@ var StoreMemoryLance = class extends MemoryStorage {
|
|
|
310
310
|
if (page < 0) {
|
|
311
311
|
throw new MastraError(
|
|
312
312
|
{
|
|
313
|
-
id: "
|
|
313
|
+
id: createStorageErrorId("LANCE", "LIST_MESSAGES", "INVALID_PAGE"),
|
|
314
314
|
domain: ErrorDomain.STORAGE,
|
|
315
315
|
category: ErrorCategory.USER,
|
|
316
316
|
details: { page }
|
|
@@ -405,7 +405,7 @@ var StoreMemoryLance = class extends MemoryStorage {
|
|
|
405
405
|
} catch (error) {
|
|
406
406
|
const mastraError = new MastraError(
|
|
407
407
|
{
|
|
408
|
-
id: "
|
|
408
|
+
id: createStorageErrorId("LANCE", "LIST_MESSAGES", "FAILED"),
|
|
409
409
|
domain: ErrorDomain.STORAGE,
|
|
410
410
|
category: ErrorCategory.THIRD_PARTY,
|
|
411
411
|
details: {
|
|
@@ -470,7 +470,7 @@ var StoreMemoryLance = class extends MemoryStorage {
|
|
|
470
470
|
} catch (error) {
|
|
471
471
|
throw new MastraError(
|
|
472
472
|
{
|
|
473
|
-
id: "
|
|
473
|
+
id: createStorageErrorId("LANCE", "SAVE_MESSAGES", "FAILED"),
|
|
474
474
|
domain: ErrorDomain.STORAGE,
|
|
475
475
|
category: ErrorCategory.THIRD_PARTY
|
|
476
476
|
},
|
|
@@ -485,7 +485,7 @@ var StoreMemoryLance = class extends MemoryStorage {
|
|
|
485
485
|
if (page < 0) {
|
|
486
486
|
throw new MastraError(
|
|
487
487
|
{
|
|
488
|
-
id: "
|
|
488
|
+
id: createStorageErrorId("LANCE", "LIST_THREADS_BY_RESOURCE_ID", "INVALID_PAGE"),
|
|
489
489
|
domain: ErrorDomain.STORAGE,
|
|
490
490
|
category: ErrorCategory.USER,
|
|
491
491
|
details: { page }
|
|
@@ -525,7 +525,7 @@ var StoreMemoryLance = class extends MemoryStorage {
|
|
|
525
525
|
} catch (error) {
|
|
526
526
|
throw new MastraError(
|
|
527
527
|
{
|
|
528
|
-
id: "
|
|
528
|
+
id: createStorageErrorId("LANCE", "LIST_THREADS_BY_RESOURCE_ID", "FAILED"),
|
|
529
529
|
domain: ErrorDomain.STORAGE,
|
|
530
530
|
category: ErrorCategory.THIRD_PARTY
|
|
531
531
|
},
|
|
@@ -660,7 +660,7 @@ var StoreMemoryLance = class extends MemoryStorage {
|
|
|
660
660
|
} catch (error) {
|
|
661
661
|
throw new MastraError(
|
|
662
662
|
{
|
|
663
|
-
id: "
|
|
663
|
+
id: createStorageErrorId("LANCE", "UPDATE_MESSAGES", "FAILED"),
|
|
664
664
|
domain: ErrorDomain.STORAGE,
|
|
665
665
|
category: ErrorCategory.THIRD_PARTY,
|
|
666
666
|
details: { count: messages.length }
|
|
@@ -737,7 +737,7 @@ var StoreMemoryLance = class extends MemoryStorage {
|
|
|
737
737
|
} catch (error) {
|
|
738
738
|
throw new MastraError(
|
|
739
739
|
{
|
|
740
|
-
id: "
|
|
740
|
+
id: createStorageErrorId("LANCE", "GET_RESOURCE_BY_ID", "FAILED"),
|
|
741
741
|
domain: ErrorDomain.STORAGE,
|
|
742
742
|
category: ErrorCategory.THIRD_PARTY
|
|
743
743
|
},
|
|
@@ -761,7 +761,7 @@ var StoreMemoryLance = class extends MemoryStorage {
|
|
|
761
761
|
} catch (error) {
|
|
762
762
|
throw new MastraError(
|
|
763
763
|
{
|
|
764
|
-
id: "
|
|
764
|
+
id: createStorageErrorId("LANCE", "SAVE_RESOURCE", "FAILED"),
|
|
765
765
|
domain: ErrorDomain.STORAGE,
|
|
766
766
|
category: ErrorCategory.THIRD_PARTY
|
|
767
767
|
},
|
|
@@ -815,7 +815,7 @@ var StoreMemoryLance = class extends MemoryStorage {
|
|
|
815
815
|
}
|
|
816
816
|
throw new MastraError(
|
|
817
817
|
{
|
|
818
|
-
id: "
|
|
818
|
+
id: createStorageErrorId("LANCE", "UPDATE_RESOURCE", "FAILED"),
|
|
819
819
|
domain: ErrorDomain.STORAGE,
|
|
820
820
|
category: ErrorCategory.THIRD_PARTY
|
|
821
821
|
},
|
|
@@ -906,7 +906,7 @@ var StoreOperationsLance = class extends StoreOperations {
|
|
|
906
906
|
} catch (error) {
|
|
907
907
|
throw new MastraError(
|
|
908
908
|
{
|
|
909
|
-
id: "
|
|
909
|
+
id: createStorageErrorId("LANCE", "CREATE_TABLE", "INVALID_ARGS"),
|
|
910
910
|
domain: ErrorDomain.STORAGE,
|
|
911
911
|
category: ErrorCategory.USER,
|
|
912
912
|
details: { tableName }
|
|
@@ -924,7 +924,7 @@ var StoreOperationsLance = class extends StoreOperations {
|
|
|
924
924
|
}
|
|
925
925
|
throw new MastraError(
|
|
926
926
|
{
|
|
927
|
-
id: "
|
|
927
|
+
id: createStorageErrorId("LANCE", "CREATE_TABLE", "FAILED"),
|
|
928
928
|
domain: ErrorDomain.STORAGE,
|
|
929
929
|
category: ErrorCategory.THIRD_PARTY,
|
|
930
930
|
details: { tableName }
|
|
@@ -944,7 +944,7 @@ var StoreOperationsLance = class extends StoreOperations {
|
|
|
944
944
|
} catch (validationError) {
|
|
945
945
|
throw new MastraError(
|
|
946
946
|
{
|
|
947
|
-
id: "
|
|
947
|
+
id: createStorageErrorId("LANCE", "DROP_TABLE", "INVALID_ARGS"),
|
|
948
948
|
domain: ErrorDomain.STORAGE,
|
|
949
949
|
category: ErrorCategory.USER,
|
|
950
950
|
text: validationError.message,
|
|
@@ -962,7 +962,7 @@ var StoreOperationsLance = class extends StoreOperations {
|
|
|
962
962
|
}
|
|
963
963
|
throw new MastraError(
|
|
964
964
|
{
|
|
965
|
-
id: "
|
|
965
|
+
id: createStorageErrorId("LANCE", "DROP_TABLE", "FAILED"),
|
|
966
966
|
domain: ErrorDomain.STORAGE,
|
|
967
967
|
category: ErrorCategory.THIRD_PARTY,
|
|
968
968
|
details: { tableName }
|
|
@@ -993,7 +993,7 @@ var StoreOperationsLance = class extends StoreOperations {
|
|
|
993
993
|
} catch (validationError) {
|
|
994
994
|
throw new MastraError(
|
|
995
995
|
{
|
|
996
|
-
id: "
|
|
996
|
+
id: createStorageErrorId("LANCE", "ALTER_TABLE", "INVALID_ARGS"),
|
|
997
997
|
domain: ErrorDomain.STORAGE,
|
|
998
998
|
category: ErrorCategory.USER,
|
|
999
999
|
text: validationError.message,
|
|
@@ -1028,7 +1028,7 @@ var StoreOperationsLance = class extends StoreOperations {
|
|
|
1028
1028
|
} catch (error) {
|
|
1029
1029
|
throw new MastraError(
|
|
1030
1030
|
{
|
|
1031
|
-
id: "
|
|
1031
|
+
id: createStorageErrorId("LANCE", "ALTER_TABLE", "FAILED"),
|
|
1032
1032
|
domain: ErrorDomain.STORAGE,
|
|
1033
1033
|
category: ErrorCategory.THIRD_PARTY,
|
|
1034
1034
|
details: { tableName }
|
|
@@ -1048,7 +1048,7 @@ var StoreOperationsLance = class extends StoreOperations {
|
|
|
1048
1048
|
} catch (validationError) {
|
|
1049
1049
|
throw new MastraError(
|
|
1050
1050
|
{
|
|
1051
|
-
id: "
|
|
1051
|
+
id: createStorageErrorId("LANCE", "CLEAR_TABLE", "INVALID_ARGS"),
|
|
1052
1052
|
domain: ErrorDomain.STORAGE,
|
|
1053
1053
|
category: ErrorCategory.USER,
|
|
1054
1054
|
text: validationError.message,
|
|
@@ -1063,7 +1063,7 @@ var StoreOperationsLance = class extends StoreOperations {
|
|
|
1063
1063
|
} catch (error) {
|
|
1064
1064
|
throw new MastraError(
|
|
1065
1065
|
{
|
|
1066
|
-
id: "
|
|
1066
|
+
id: createStorageErrorId("LANCE", "CLEAR_TABLE", "FAILED"),
|
|
1067
1067
|
domain: ErrorDomain.STORAGE,
|
|
1068
1068
|
category: ErrorCategory.THIRD_PARTY,
|
|
1069
1069
|
details: { tableName }
|
|
@@ -1086,7 +1086,7 @@ var StoreOperationsLance = class extends StoreOperations {
|
|
|
1086
1086
|
} catch (validationError) {
|
|
1087
1087
|
throw new MastraError(
|
|
1088
1088
|
{
|
|
1089
|
-
id: "
|
|
1089
|
+
id: createStorageErrorId("LANCE", "INSERT", "INVALID_ARGS"),
|
|
1090
1090
|
domain: ErrorDomain.STORAGE,
|
|
1091
1091
|
category: ErrorCategory.USER,
|
|
1092
1092
|
text: validationError.message,
|
|
@@ -1105,12 +1105,11 @@ var StoreOperationsLance = class extends StoreOperations {
|
|
|
1105
1105
|
processedRecord[key] = JSON.stringify(processedRecord[key]);
|
|
1106
1106
|
}
|
|
1107
1107
|
}
|
|
1108
|
-
console.info(await table.schema());
|
|
1109
1108
|
await table.mergeInsert(primaryId).whenMatchedUpdateAll().whenNotMatchedInsertAll().execute([processedRecord]);
|
|
1110
1109
|
} catch (error) {
|
|
1111
1110
|
throw new MastraError(
|
|
1112
1111
|
{
|
|
1113
|
-
id: "
|
|
1112
|
+
id: createStorageErrorId("LANCE", "INSERT", "FAILED"),
|
|
1114
1113
|
domain: ErrorDomain.STORAGE,
|
|
1115
1114
|
category: ErrorCategory.THIRD_PARTY,
|
|
1116
1115
|
details: { tableName }
|
|
@@ -1133,7 +1132,7 @@ var StoreOperationsLance = class extends StoreOperations {
|
|
|
1133
1132
|
} catch (validationError) {
|
|
1134
1133
|
throw new MastraError(
|
|
1135
1134
|
{
|
|
1136
|
-
id: "
|
|
1135
|
+
id: createStorageErrorId("LANCE", "BATCH_INSERT", "INVALID_ARGS"),
|
|
1137
1136
|
domain: ErrorDomain.STORAGE,
|
|
1138
1137
|
category: ErrorCategory.USER,
|
|
1139
1138
|
text: validationError.message,
|
|
@@ -1159,7 +1158,7 @@ var StoreOperationsLance = class extends StoreOperations {
|
|
|
1159
1158
|
} catch (error) {
|
|
1160
1159
|
throw new MastraError(
|
|
1161
1160
|
{
|
|
1162
|
-
id: "
|
|
1161
|
+
id: createStorageErrorId("LANCE", "BATCH_INSERT", "FAILED"),
|
|
1163
1162
|
domain: ErrorDomain.STORAGE,
|
|
1164
1163
|
category: ErrorCategory.THIRD_PARTY,
|
|
1165
1164
|
details: { tableName }
|
|
@@ -1182,7 +1181,7 @@ var StoreOperationsLance = class extends StoreOperations {
|
|
|
1182
1181
|
} catch (validationError) {
|
|
1183
1182
|
throw new MastraError(
|
|
1184
1183
|
{
|
|
1185
|
-
id: "
|
|
1184
|
+
id: createStorageErrorId("LANCE", "LOAD", "INVALID_ARGS"),
|
|
1186
1185
|
domain: ErrorDomain.STORAGE,
|
|
1187
1186
|
category: ErrorCategory.USER,
|
|
1188
1187
|
text: validationError.message,
|
|
@@ -1221,7 +1220,7 @@ var StoreOperationsLance = class extends StoreOperations {
|
|
|
1221
1220
|
if (error instanceof MastraError) throw error;
|
|
1222
1221
|
throw new MastraError(
|
|
1223
1222
|
{
|
|
1224
|
-
id: "
|
|
1223
|
+
id: createStorageErrorId("LANCE", "LOAD", "FAILED"),
|
|
1225
1224
|
domain: ErrorDomain.STORAGE,
|
|
1226
1225
|
category: ErrorCategory.THIRD_PARTY,
|
|
1227
1226
|
details: { tableName, keyCount: Object.keys(keys).length, firstKey: Object.keys(keys)[0] ?? "" }
|
|
@@ -1244,39 +1243,47 @@ var StoreScoresLance = class extends ScoresStorage {
|
|
|
1244
1243
|
} catch (error) {
|
|
1245
1244
|
throw new MastraError(
|
|
1246
1245
|
{
|
|
1247
|
-
id: "
|
|
1246
|
+
id: createStorageErrorId("LANCE", "SAVE_SCORE", "VALIDATION_FAILED"),
|
|
1248
1247
|
text: "Failed to save score in LanceStorage",
|
|
1249
1248
|
domain: ErrorDomain.STORAGE,
|
|
1250
|
-
category: ErrorCategory.
|
|
1249
|
+
category: ErrorCategory.USER,
|
|
1250
|
+
details: {
|
|
1251
|
+
scorer: score.scorer?.id ?? "unknown",
|
|
1252
|
+
entityId: score.entityId ?? "unknown",
|
|
1253
|
+
entityType: score.entityType ?? "unknown",
|
|
1254
|
+
traceId: score.traceId ?? "",
|
|
1255
|
+
spanId: score.spanId ?? ""
|
|
1256
|
+
}
|
|
1251
1257
|
},
|
|
1252
1258
|
error
|
|
1253
1259
|
);
|
|
1254
1260
|
}
|
|
1261
|
+
const id = crypto.randomUUID();
|
|
1262
|
+
const now = /* @__PURE__ */ new Date();
|
|
1255
1263
|
try {
|
|
1256
|
-
const id = crypto.randomUUID();
|
|
1257
1264
|
const table = await this.client.openTable(TABLE_SCORERS);
|
|
1258
1265
|
const schema = await getTableSchema({ tableName: TABLE_SCORERS, client: this.client });
|
|
1259
1266
|
const allowedFields = new Set(schema.fields.map((f) => f.name));
|
|
1260
1267
|
const filteredScore = {};
|
|
1261
|
-
Object.keys(validatedScore)
|
|
1268
|
+
for (const key of Object.keys(validatedScore)) {
|
|
1262
1269
|
if (allowedFields.has(key)) {
|
|
1263
|
-
filteredScore[key] =
|
|
1270
|
+
filteredScore[key] = validatedScore[key];
|
|
1264
1271
|
}
|
|
1265
|
-
}
|
|
1272
|
+
}
|
|
1266
1273
|
for (const key in filteredScore) {
|
|
1267
1274
|
if (filteredScore[key] !== null && typeof filteredScore[key] === "object" && !(filteredScore[key] instanceof Date)) {
|
|
1268
1275
|
filteredScore[key] = JSON.stringify(filteredScore[key]);
|
|
1269
1276
|
}
|
|
1270
1277
|
}
|
|
1271
|
-
filteredScore.createdAt = /* @__PURE__ */ new Date();
|
|
1272
|
-
filteredScore.updatedAt = /* @__PURE__ */ new Date();
|
|
1273
1278
|
filteredScore.id = id;
|
|
1279
|
+
filteredScore.createdAt = now;
|
|
1280
|
+
filteredScore.updatedAt = now;
|
|
1274
1281
|
await table.add([filteredScore], { mode: "append" });
|
|
1275
|
-
return { score };
|
|
1282
|
+
return { score: { ...validatedScore, id, createdAt: now, updatedAt: now } };
|
|
1276
1283
|
} catch (error) {
|
|
1277
1284
|
throw new MastraError(
|
|
1278
1285
|
{
|
|
1279
|
-
id: "
|
|
1286
|
+
id: createStorageErrorId("LANCE", "SAVE_SCORE", "FAILED"),
|
|
1280
1287
|
text: "Failed to save score in LanceStorage",
|
|
1281
1288
|
domain: ErrorDomain.STORAGE,
|
|
1282
1289
|
category: ErrorCategory.THIRD_PARTY,
|
|
@@ -1296,7 +1303,7 @@ var StoreScoresLance = class extends ScoresStorage {
|
|
|
1296
1303
|
} catch (error) {
|
|
1297
1304
|
throw new MastraError(
|
|
1298
1305
|
{
|
|
1299
|
-
id: "
|
|
1306
|
+
id: createStorageErrorId("LANCE", "GET_SCORE_BY_ID", "FAILED"),
|
|
1300
1307
|
text: "Failed to get score by id in LanceStorage",
|
|
1301
1308
|
domain: ErrorDomain.STORAGE,
|
|
1302
1309
|
category: ErrorCategory.THIRD_PARTY,
|
|
@@ -1375,7 +1382,7 @@ var StoreScoresLance = class extends ScoresStorage {
|
|
|
1375
1382
|
} catch (error) {
|
|
1376
1383
|
throw new MastraError(
|
|
1377
1384
|
{
|
|
1378
|
-
id: "
|
|
1385
|
+
id: createStorageErrorId("LANCE", "LIST_SCORES_BY_SCORER_ID", "FAILED"),
|
|
1379
1386
|
text: "Failed to get scores by scorerId in LanceStorage",
|
|
1380
1387
|
domain: ErrorDomain.STORAGE,
|
|
1381
1388
|
category: ErrorCategory.THIRD_PARTY,
|
|
@@ -1416,7 +1423,7 @@ var StoreScoresLance = class extends ScoresStorage {
|
|
|
1416
1423
|
} catch (error) {
|
|
1417
1424
|
throw new MastraError(
|
|
1418
1425
|
{
|
|
1419
|
-
id: "
|
|
1426
|
+
id: createStorageErrorId("LANCE", "LIST_SCORES_BY_RUN_ID", "FAILED"),
|
|
1420
1427
|
text: "Failed to get scores by runId in LanceStorage",
|
|
1421
1428
|
domain: ErrorDomain.STORAGE,
|
|
1422
1429
|
category: ErrorCategory.THIRD_PARTY,
|
|
@@ -1458,7 +1465,7 @@ var StoreScoresLance = class extends ScoresStorage {
|
|
|
1458
1465
|
} catch (error) {
|
|
1459
1466
|
throw new MastraError(
|
|
1460
1467
|
{
|
|
1461
|
-
id: "
|
|
1468
|
+
id: createStorageErrorId("LANCE", "LIST_SCORES_BY_ENTITY_ID", "FAILED"),
|
|
1462
1469
|
text: "Failed to get scores by entityId and entityType in LanceStorage",
|
|
1463
1470
|
domain: ErrorDomain.STORAGE,
|
|
1464
1471
|
category: ErrorCategory.THIRD_PARTY,
|
|
@@ -1500,7 +1507,7 @@ var StoreScoresLance = class extends ScoresStorage {
|
|
|
1500
1507
|
} catch (error) {
|
|
1501
1508
|
throw new MastraError(
|
|
1502
1509
|
{
|
|
1503
|
-
id: "
|
|
1510
|
+
id: createStorageErrorId("LANCE", "LIST_SCORES_BY_SPAN", "FAILED"),
|
|
1504
1511
|
text: "Failed to get scores by traceId and spanId in LanceStorage",
|
|
1505
1512
|
domain: ErrorDomain.STORAGE,
|
|
1506
1513
|
category: ErrorCategory.THIRD_PARTY,
|
|
@@ -1582,7 +1589,7 @@ var StoreWorkflowsLance = class extends WorkflowsStorage {
|
|
|
1582
1589
|
} catch (error) {
|
|
1583
1590
|
throw new MastraError(
|
|
1584
1591
|
{
|
|
1585
|
-
id: "
|
|
1592
|
+
id: createStorageErrorId("LANCE", "PERSIST_WORKFLOW_SNAPSHOT", "FAILED"),
|
|
1586
1593
|
domain: ErrorDomain.STORAGE,
|
|
1587
1594
|
category: ErrorCategory.THIRD_PARTY,
|
|
1588
1595
|
details: { workflowName, runId }
|
|
@@ -1603,7 +1610,7 @@ var StoreWorkflowsLance = class extends WorkflowsStorage {
|
|
|
1603
1610
|
} catch (error) {
|
|
1604
1611
|
throw new MastraError(
|
|
1605
1612
|
{
|
|
1606
|
-
id: "
|
|
1613
|
+
id: createStorageErrorId("LANCE", "LOAD_WORKFLOW_SNAPSHOT", "FAILED"),
|
|
1607
1614
|
domain: ErrorDomain.STORAGE,
|
|
1608
1615
|
category: ErrorCategory.THIRD_PARTY,
|
|
1609
1616
|
details: { workflowName, runId }
|
|
@@ -1627,7 +1634,7 @@ var StoreWorkflowsLance = class extends WorkflowsStorage {
|
|
|
1627
1634
|
} catch (error) {
|
|
1628
1635
|
throw new MastraError(
|
|
1629
1636
|
{
|
|
1630
|
-
id: "
|
|
1637
|
+
id: createStorageErrorId("LANCE", "GET_WORKFLOW_RUN_BY_ID", "FAILED"),
|
|
1631
1638
|
domain: ErrorDomain.STORAGE,
|
|
1632
1639
|
category: ErrorCategory.THIRD_PARTY,
|
|
1633
1640
|
details: { runId: args.runId, workflowName: args.workflowName ?? "" }
|
|
@@ -1669,7 +1676,7 @@ var StoreWorkflowsLance = class extends WorkflowsStorage {
|
|
|
1669
1676
|
if (args.page < 0 || !Number.isInteger(args.page)) {
|
|
1670
1677
|
throw new MastraError(
|
|
1671
1678
|
{
|
|
1672
|
-
id: "
|
|
1679
|
+
id: createStorageErrorId("LANCE", "LIST_WORKFLOW_RUNS", "INVALID_PAGINATION"),
|
|
1673
1680
|
domain: ErrorDomain.STORAGE,
|
|
1674
1681
|
category: ErrorCategory.USER,
|
|
1675
1682
|
details: { page: args.page, perPage: args.perPage }
|
|
@@ -1689,7 +1696,7 @@ var StoreWorkflowsLance = class extends WorkflowsStorage {
|
|
|
1689
1696
|
} catch (error) {
|
|
1690
1697
|
throw new MastraError(
|
|
1691
1698
|
{
|
|
1692
|
-
id: "
|
|
1699
|
+
id: createStorageErrorId("LANCE", "LIST_WORKFLOW_RUNS", "FAILED"),
|
|
1693
1700
|
domain: ErrorDomain.STORAGE,
|
|
1694
1701
|
category: ErrorCategory.THIRD_PARTY,
|
|
1695
1702
|
details: { resourceId: args?.resourceId ?? "", workflowName: args?.workflowName ?? "" }
|
|
@@ -1709,7 +1716,8 @@ var LanceStorage = class _LanceStorage extends MastraStorage {
|
|
|
1709
1716
|
* @param id The unique identifier for this storage instance
|
|
1710
1717
|
* @param name The name for this storage instance
|
|
1711
1718
|
* @param uri The URI to connect to LanceDB
|
|
1712
|
-
* @param
|
|
1719
|
+
* @param connectionOptions connection options for LanceDB
|
|
1720
|
+
* @param storageOptions storage options including disableInit
|
|
1713
1721
|
*
|
|
1714
1722
|
* Usage:
|
|
1715
1723
|
*
|
|
@@ -1727,11 +1735,16 @@ var LanceStorage = class _LanceStorage extends MastraStorage {
|
|
|
1727
1735
|
* ```ts
|
|
1728
1736
|
* const store = await LanceStorage.create('my-storage-id', 'MyStorage', 's3://bucket/db', { storageOptions: { timeout: '60s' } });
|
|
1729
1737
|
* ```
|
|
1738
|
+
*
|
|
1739
|
+
* Disable auto-init for runtime (after CI/CD has run migrations)
|
|
1740
|
+
* ```ts
|
|
1741
|
+
* const store = await LanceStorage.create('my-storage-id', 'MyStorage', '/path/to/db', undefined, { disableInit: true });
|
|
1742
|
+
* ```
|
|
1730
1743
|
*/
|
|
1731
|
-
static async create(id, name, uri,
|
|
1732
|
-
const instance = new _LanceStorage(id, name);
|
|
1744
|
+
static async create(id, name, uri, connectionOptions, storageOptions) {
|
|
1745
|
+
const instance = new _LanceStorage(id, name, storageOptions?.disableInit);
|
|
1733
1746
|
try {
|
|
1734
|
-
instance.lanceClient = await connect(uri,
|
|
1747
|
+
instance.lanceClient = await connect(uri, connectionOptions);
|
|
1735
1748
|
const operations = new StoreOperationsLance({ client: instance.lanceClient });
|
|
1736
1749
|
instance.stores = {
|
|
1737
1750
|
operations: new StoreOperationsLance({ client: instance.lanceClient }),
|
|
@@ -1743,11 +1756,11 @@ var LanceStorage = class _LanceStorage extends MastraStorage {
|
|
|
1743
1756
|
} catch (e) {
|
|
1744
1757
|
throw new MastraError(
|
|
1745
1758
|
{
|
|
1746
|
-
id: "
|
|
1759
|
+
id: createStorageErrorId("LANCE", "CONNECT", "FAILED"),
|
|
1747
1760
|
domain: ErrorDomain.STORAGE,
|
|
1748
1761
|
category: ErrorCategory.THIRD_PARTY,
|
|
1749
1762
|
text: `Failed to connect to LanceDB: ${e.message || e}`,
|
|
1750
|
-
details: { uri, optionsProvided: !!
|
|
1763
|
+
details: { uri, optionsProvided: !!connectionOptions }
|
|
1751
1764
|
},
|
|
1752
1765
|
e
|
|
1753
1766
|
);
|
|
@@ -1757,8 +1770,8 @@ var LanceStorage = class _LanceStorage extends MastraStorage {
|
|
|
1757
1770
|
* @internal
|
|
1758
1771
|
* Private constructor to enforce using the create factory method
|
|
1759
1772
|
*/
|
|
1760
|
-
constructor(id, name) {
|
|
1761
|
-
super({ id, name });
|
|
1773
|
+
constructor(id, name, disableInit) {
|
|
1774
|
+
super({ id, name, disableInit });
|
|
1762
1775
|
const operations = new StoreOperationsLance({ client: this.lanceClient });
|
|
1763
1776
|
this.stores = {
|
|
1764
1777
|
operations: new StoreOperationsLance({ client: this.lanceClient }),
|
|
@@ -1944,8 +1957,8 @@ var LanceStorage = class _LanceStorage extends MastraStorage {
|
|
|
1944
1957
|
}) {
|
|
1945
1958
|
return this.stores.scores.listScoresByScorerId({ scorerId, source, pagination, entityId, entityType });
|
|
1946
1959
|
}
|
|
1947
|
-
async saveScore(
|
|
1948
|
-
return this.stores.scores.saveScore(
|
|
1960
|
+
async saveScore(score) {
|
|
1961
|
+
return this.stores.scores.saveScore(score);
|
|
1949
1962
|
}
|
|
1950
1963
|
async listScoresByRunId({
|
|
1951
1964
|
runId,
|
|
@@ -2321,7 +2334,7 @@ var LanceVectorStore = class _LanceVectorStore extends MastraVector {
|
|
|
2321
2334
|
} catch (e) {
|
|
2322
2335
|
throw new MastraError(
|
|
2323
2336
|
{
|
|
2324
|
-
id: "
|
|
2337
|
+
id: createVectorErrorId("LANCE", "CONNECT", "FAILED"),
|
|
2325
2338
|
domain: ErrorDomain.STORAGE,
|
|
2326
2339
|
category: ErrorCategory.THIRD_PARTY,
|
|
2327
2340
|
details: { uri }
|
|
@@ -2364,7 +2377,7 @@ var LanceVectorStore = class _LanceVectorStore extends MastraVector {
|
|
|
2364
2377
|
} catch (error) {
|
|
2365
2378
|
throw new MastraError(
|
|
2366
2379
|
{
|
|
2367
|
-
id: "
|
|
2380
|
+
id: createVectorErrorId("LANCE", "QUERY", "INVALID_ARGS"),
|
|
2368
2381
|
domain: ErrorDomain.STORAGE,
|
|
2369
2382
|
category: ErrorCategory.USER,
|
|
2370
2383
|
text: "LanceDB client not initialized. Use LanceVectorStore.create() to create an instance",
|
|
@@ -2412,7 +2425,7 @@ var LanceVectorStore = class _LanceVectorStore extends MastraVector {
|
|
|
2412
2425
|
} catch (error) {
|
|
2413
2426
|
throw new MastraError(
|
|
2414
2427
|
{
|
|
2415
|
-
id: "
|
|
2428
|
+
id: createVectorErrorId("LANCE", "QUERY", "FAILED"),
|
|
2416
2429
|
domain: ErrorDomain.STORAGE,
|
|
2417
2430
|
category: ErrorCategory.THIRD_PARTY,
|
|
2418
2431
|
details: { tableName, includeVector, columnsCount: columns?.length, includeAllColumns }
|
|
@@ -2464,7 +2477,7 @@ var LanceVectorStore = class _LanceVectorStore extends MastraVector {
|
|
|
2464
2477
|
} catch (error) {
|
|
2465
2478
|
throw new MastraError(
|
|
2466
2479
|
{
|
|
2467
|
-
id: "
|
|
2480
|
+
id: createVectorErrorId("LANCE", "UPSERT", "INVALID_ARGS"),
|
|
2468
2481
|
domain: ErrorDomain.STORAGE,
|
|
2469
2482
|
category: ErrorCategory.USER,
|
|
2470
2483
|
text: "LanceDB client not initialized. Use LanceVectorStore.create() to create an instance",
|
|
@@ -2500,7 +2513,7 @@ var LanceVectorStore = class _LanceVectorStore extends MastraVector {
|
|
|
2500
2513
|
} catch (error) {
|
|
2501
2514
|
throw new MastraError(
|
|
2502
2515
|
{
|
|
2503
|
-
id: "
|
|
2516
|
+
id: createVectorErrorId("LANCE", "UPSERT", "FAILED"),
|
|
2504
2517
|
domain: ErrorDomain.STORAGE,
|
|
2505
2518
|
category: ErrorCategory.THIRD_PARTY,
|
|
2506
2519
|
details: { tableName, vectorCount: vectors.length, metadataCount: metadata.length, idsCount: ids.length }
|
|
@@ -2527,7 +2540,7 @@ var LanceVectorStore = class _LanceVectorStore extends MastraVector {
|
|
|
2527
2540
|
async createTable(tableName, data, options) {
|
|
2528
2541
|
if (!this.lanceClient) {
|
|
2529
2542
|
throw new MastraError({
|
|
2530
|
-
id: "
|
|
2543
|
+
id: createVectorErrorId("LANCE", "CREATE_TABLE", "INVALID_ARGS"),
|
|
2531
2544
|
domain: ErrorDomain.STORAGE,
|
|
2532
2545
|
category: ErrorCategory.USER,
|
|
2533
2546
|
text: "LanceDB client not initialized. Use LanceVectorStore.create() to create an instance",
|
|
@@ -2542,7 +2555,7 @@ var LanceVectorStore = class _LanceVectorStore extends MastraVector {
|
|
|
2542
2555
|
} catch (error) {
|
|
2543
2556
|
throw new MastraError(
|
|
2544
2557
|
{
|
|
2545
|
-
id: "
|
|
2558
|
+
id: createVectorErrorId("LANCE", "CREATE_TABLE", "FAILED"),
|
|
2546
2559
|
domain: ErrorDomain.STORAGE,
|
|
2547
2560
|
category: ErrorCategory.THIRD_PARTY,
|
|
2548
2561
|
details: { tableName }
|
|
@@ -2554,7 +2567,7 @@ var LanceVectorStore = class _LanceVectorStore extends MastraVector {
|
|
|
2554
2567
|
async listTables() {
|
|
2555
2568
|
if (!this.lanceClient) {
|
|
2556
2569
|
throw new MastraError({
|
|
2557
|
-
id: "
|
|
2570
|
+
id: createVectorErrorId("LANCE", "LIST_TABLES", "INVALID_ARGS"),
|
|
2558
2571
|
domain: ErrorDomain.STORAGE,
|
|
2559
2572
|
category: ErrorCategory.USER,
|
|
2560
2573
|
text: "LanceDB client not initialized. Use LanceVectorStore.create() to create an instance",
|
|
@@ -2566,7 +2579,7 @@ var LanceVectorStore = class _LanceVectorStore extends MastraVector {
|
|
|
2566
2579
|
} catch (error) {
|
|
2567
2580
|
throw new MastraError(
|
|
2568
2581
|
{
|
|
2569
|
-
id: "
|
|
2582
|
+
id: createVectorErrorId("LANCE", "LIST_TABLES", "FAILED"),
|
|
2570
2583
|
domain: ErrorDomain.STORAGE,
|
|
2571
2584
|
category: ErrorCategory.THIRD_PARTY
|
|
2572
2585
|
},
|
|
@@ -2577,7 +2590,7 @@ var LanceVectorStore = class _LanceVectorStore extends MastraVector {
|
|
|
2577
2590
|
async getTableSchema(tableName) {
|
|
2578
2591
|
if (!this.lanceClient) {
|
|
2579
2592
|
throw new MastraError({
|
|
2580
|
-
id: "
|
|
2593
|
+
id: createVectorErrorId("LANCE", "GET_TABLE_SCHEMA", "INVALID_ARGS"),
|
|
2581
2594
|
domain: ErrorDomain.STORAGE,
|
|
2582
2595
|
category: ErrorCategory.USER,
|
|
2583
2596
|
text: "LanceDB client not initialized. Use LanceVectorStore.create() to create an instance",
|
|
@@ -2590,7 +2603,7 @@ var LanceVectorStore = class _LanceVectorStore extends MastraVector {
|
|
|
2590
2603
|
} catch (error) {
|
|
2591
2604
|
throw new MastraError(
|
|
2592
2605
|
{
|
|
2593
|
-
id: "
|
|
2606
|
+
id: createVectorErrorId("LANCE", "GET_TABLE_SCHEMA", "FAILED"),
|
|
2594
2607
|
domain: ErrorDomain.STORAGE,
|
|
2595
2608
|
category: ErrorCategory.THIRD_PARTY,
|
|
2596
2609
|
details: { tableName }
|
|
@@ -2625,7 +2638,7 @@ var LanceVectorStore = class _LanceVectorStore extends MastraVector {
|
|
|
2625
2638
|
} catch (err) {
|
|
2626
2639
|
throw new MastraError(
|
|
2627
2640
|
{
|
|
2628
|
-
id: "
|
|
2641
|
+
id: createVectorErrorId("LANCE", "CREATE_INDEX", "INVALID_ARGS"),
|
|
2629
2642
|
domain: ErrorDomain.STORAGE,
|
|
2630
2643
|
category: ErrorCategory.USER,
|
|
2631
2644
|
details: { tableName: tableName || "", indexName, dimension, metric }
|
|
@@ -2670,7 +2683,7 @@ var LanceVectorStore = class _LanceVectorStore extends MastraVector {
|
|
|
2670
2683
|
} catch (error) {
|
|
2671
2684
|
throw new MastraError(
|
|
2672
2685
|
{
|
|
2673
|
-
id: "
|
|
2686
|
+
id: createVectorErrorId("LANCE", "CREATE_INDEX", "FAILED"),
|
|
2674
2687
|
domain: ErrorDomain.STORAGE,
|
|
2675
2688
|
category: ErrorCategory.THIRD_PARTY,
|
|
2676
2689
|
details: { tableName: tableName || "", indexName, dimension }
|
|
@@ -2682,7 +2695,7 @@ var LanceVectorStore = class _LanceVectorStore extends MastraVector {
|
|
|
2682
2695
|
async listIndexes() {
|
|
2683
2696
|
if (!this.lanceClient) {
|
|
2684
2697
|
throw new MastraError({
|
|
2685
|
-
id: "
|
|
2698
|
+
id: createVectorErrorId("LANCE", "LIST_INDEXES", "INVALID_ARGS"),
|
|
2686
2699
|
domain: ErrorDomain.STORAGE,
|
|
2687
2700
|
category: ErrorCategory.USER,
|
|
2688
2701
|
text: "LanceDB client not initialized. Use LanceVectorStore.create() to create an instance",
|
|
@@ -2701,7 +2714,7 @@ var LanceVectorStore = class _LanceVectorStore extends MastraVector {
|
|
|
2701
2714
|
} catch (error) {
|
|
2702
2715
|
throw new MastraError(
|
|
2703
2716
|
{
|
|
2704
|
-
id: "
|
|
2717
|
+
id: createVectorErrorId("LANCE", "LIST_INDEXES", "FAILED"),
|
|
2705
2718
|
domain: ErrorDomain.STORAGE,
|
|
2706
2719
|
category: ErrorCategory.THIRD_PARTY
|
|
2707
2720
|
},
|
|
@@ -2720,7 +2733,7 @@ var LanceVectorStore = class _LanceVectorStore extends MastraVector {
|
|
|
2720
2733
|
} catch (err) {
|
|
2721
2734
|
throw new MastraError(
|
|
2722
2735
|
{
|
|
2723
|
-
id: "
|
|
2736
|
+
id: createVectorErrorId("LANCE", "DESCRIBE_INDEX", "INVALID_ARGS"),
|
|
2724
2737
|
domain: ErrorDomain.STORAGE,
|
|
2725
2738
|
category: ErrorCategory.USER,
|
|
2726
2739
|
details: { indexName }
|
|
@@ -2755,7 +2768,7 @@ var LanceVectorStore = class _LanceVectorStore extends MastraVector {
|
|
|
2755
2768
|
} catch (error) {
|
|
2756
2769
|
throw new MastraError(
|
|
2757
2770
|
{
|
|
2758
|
-
id: "
|
|
2771
|
+
id: createVectorErrorId("LANCE", "DESCRIBE_INDEX", "FAILED"),
|
|
2759
2772
|
domain: ErrorDomain.STORAGE,
|
|
2760
2773
|
category: ErrorCategory.THIRD_PARTY,
|
|
2761
2774
|
details: { indexName }
|
|
@@ -2775,7 +2788,7 @@ var LanceVectorStore = class _LanceVectorStore extends MastraVector {
|
|
|
2775
2788
|
} catch (err) {
|
|
2776
2789
|
throw new MastraError(
|
|
2777
2790
|
{
|
|
2778
|
-
id: "
|
|
2791
|
+
id: createVectorErrorId("LANCE", "DELETE_INDEX", "INVALID_ARGS"),
|
|
2779
2792
|
domain: ErrorDomain.STORAGE,
|
|
2780
2793
|
category: ErrorCategory.USER,
|
|
2781
2794
|
details: { indexName }
|
|
@@ -2798,7 +2811,7 @@ var LanceVectorStore = class _LanceVectorStore extends MastraVector {
|
|
|
2798
2811
|
} catch (error) {
|
|
2799
2812
|
throw new MastraError(
|
|
2800
2813
|
{
|
|
2801
|
-
id: "
|
|
2814
|
+
id: createVectorErrorId("LANCE", "DELETE_INDEX", "FAILED"),
|
|
2802
2815
|
domain: ErrorDomain.STORAGE,
|
|
2803
2816
|
category: ErrorCategory.THIRD_PARTY,
|
|
2804
2817
|
details: { indexName }
|
|
@@ -2813,7 +2826,7 @@ var LanceVectorStore = class _LanceVectorStore extends MastraVector {
|
|
|
2813
2826
|
async deleteAllTables() {
|
|
2814
2827
|
if (!this.lanceClient) {
|
|
2815
2828
|
throw new MastraError({
|
|
2816
|
-
id: "
|
|
2829
|
+
id: createVectorErrorId("LANCE", "DELETE_ALL_TABLES", "INVALID_ARGS"),
|
|
2817
2830
|
domain: ErrorDomain.STORAGE,
|
|
2818
2831
|
category: ErrorCategory.USER,
|
|
2819
2832
|
details: { methodName: "deleteAllTables" },
|
|
@@ -2825,7 +2838,7 @@ var LanceVectorStore = class _LanceVectorStore extends MastraVector {
|
|
|
2825
2838
|
} catch (error) {
|
|
2826
2839
|
throw new MastraError(
|
|
2827
2840
|
{
|
|
2828
|
-
id: "
|
|
2841
|
+
id: createVectorErrorId("LANCE", "DELETE_ALL_TABLES", "FAILED"),
|
|
2829
2842
|
domain: ErrorDomain.STORAGE,
|
|
2830
2843
|
category: ErrorCategory.THIRD_PARTY,
|
|
2831
2844
|
details: { methodName: "deleteAllTables" }
|
|
@@ -2837,7 +2850,7 @@ var LanceVectorStore = class _LanceVectorStore extends MastraVector {
|
|
|
2837
2850
|
async deleteTable(tableName) {
|
|
2838
2851
|
if (!this.lanceClient) {
|
|
2839
2852
|
throw new MastraError({
|
|
2840
|
-
id: "
|
|
2853
|
+
id: createVectorErrorId("LANCE", "DELETE_TABLE", "INVALID_ARGS"),
|
|
2841
2854
|
domain: ErrorDomain.STORAGE,
|
|
2842
2855
|
category: ErrorCategory.USER,
|
|
2843
2856
|
details: { tableName },
|
|
@@ -2849,7 +2862,7 @@ var LanceVectorStore = class _LanceVectorStore extends MastraVector {
|
|
|
2849
2862
|
} catch (error) {
|
|
2850
2863
|
throw new MastraError(
|
|
2851
2864
|
{
|
|
2852
|
-
id: "
|
|
2865
|
+
id: createVectorErrorId("LANCE", "DELETE_TABLE", "FAILED"),
|
|
2853
2866
|
domain: ErrorDomain.STORAGE,
|
|
2854
2867
|
category: ErrorCategory.THIRD_PARTY,
|
|
2855
2868
|
details: { tableName }
|
|
@@ -2862,7 +2875,7 @@ var LanceVectorStore = class _LanceVectorStore extends MastraVector {
|
|
|
2862
2875
|
const { indexName, update } = params;
|
|
2863
2876
|
if ("id" in params && "filter" in params && params.id && params.filter) {
|
|
2864
2877
|
throw new MastraError({
|
|
2865
|
-
id: "
|
|
2878
|
+
id: createVectorErrorId("LANCE", "UPDATE_VECTOR", "MUTUALLY_EXCLUSIVE"),
|
|
2866
2879
|
domain: ErrorDomain.STORAGE,
|
|
2867
2880
|
category: ErrorCategory.USER,
|
|
2868
2881
|
text: "id and filter are mutually exclusive",
|
|
@@ -2871,7 +2884,7 @@ var LanceVectorStore = class _LanceVectorStore extends MastraVector {
|
|
|
2871
2884
|
}
|
|
2872
2885
|
if (!("id" in params || "filter" in params) || !params.id && !params.filter) {
|
|
2873
2886
|
throw new MastraError({
|
|
2874
|
-
id: "
|
|
2887
|
+
id: createVectorErrorId("LANCE", "UPDATE_VECTOR", "NO_TARGET"),
|
|
2875
2888
|
domain: ErrorDomain.STORAGE,
|
|
2876
2889
|
category: ErrorCategory.USER,
|
|
2877
2890
|
text: "Either id or filter must be provided",
|
|
@@ -2880,7 +2893,7 @@ var LanceVectorStore = class _LanceVectorStore extends MastraVector {
|
|
|
2880
2893
|
}
|
|
2881
2894
|
if ("filter" in params && params.filter && Object.keys(params.filter).length === 0) {
|
|
2882
2895
|
throw new MastraError({
|
|
2883
|
-
id: "
|
|
2896
|
+
id: createVectorErrorId("LANCE", "UPDATE_VECTOR", "EMPTY_FILTER"),
|
|
2884
2897
|
domain: ErrorDomain.STORAGE,
|
|
2885
2898
|
category: ErrorCategory.USER,
|
|
2886
2899
|
text: "Cannot update with empty filter",
|
|
@@ -2889,7 +2902,7 @@ var LanceVectorStore = class _LanceVectorStore extends MastraVector {
|
|
|
2889
2902
|
}
|
|
2890
2903
|
if (!update.vector && !update.metadata) {
|
|
2891
2904
|
throw new MastraError({
|
|
2892
|
-
id: "
|
|
2905
|
+
id: createVectorErrorId("LANCE", "UPDATE_VECTOR", "NO_PAYLOAD"),
|
|
2893
2906
|
domain: ErrorDomain.STORAGE,
|
|
2894
2907
|
category: ErrorCategory.USER,
|
|
2895
2908
|
text: "No updates provided",
|
|
@@ -2984,7 +2997,7 @@ var LanceVectorStore = class _LanceVectorStore extends MastraVector {
|
|
|
2984
2997
|
if (error instanceof MastraError) throw error;
|
|
2985
2998
|
throw new MastraError(
|
|
2986
2999
|
{
|
|
2987
|
-
id: "
|
|
3000
|
+
id: createVectorErrorId("LANCE", "UPDATE_VECTOR", "FAILED"),
|
|
2988
3001
|
domain: ErrorDomain.STORAGE,
|
|
2989
3002
|
category: ErrorCategory.THIRD_PARTY,
|
|
2990
3003
|
details: {
|
|
@@ -3013,7 +3026,7 @@ var LanceVectorStore = class _LanceVectorStore extends MastraVector {
|
|
|
3013
3026
|
} catch (err) {
|
|
3014
3027
|
throw new MastraError(
|
|
3015
3028
|
{
|
|
3016
|
-
id: "
|
|
3029
|
+
id: createVectorErrorId("LANCE", "DELETE_VECTOR", "INVALID_ARGS"),
|
|
3017
3030
|
domain: ErrorDomain.STORAGE,
|
|
3018
3031
|
category: ErrorCategory.USER,
|
|
3019
3032
|
details: {
|
|
@@ -3046,7 +3059,7 @@ var LanceVectorStore = class _LanceVectorStore extends MastraVector {
|
|
|
3046
3059
|
} catch (error) {
|
|
3047
3060
|
throw new MastraError(
|
|
3048
3061
|
{
|
|
3049
|
-
id: "
|
|
3062
|
+
id: createVectorErrorId("LANCE", "DELETE_VECTOR", "FAILED"),
|
|
3050
3063
|
domain: ErrorDomain.STORAGE,
|
|
3051
3064
|
category: ErrorCategory.THIRD_PARTY,
|
|
3052
3065
|
details: {
|
|
@@ -3086,7 +3099,7 @@ var LanceVectorStore = class _LanceVectorStore extends MastraVector {
|
|
|
3086
3099
|
async deleteVectors({ indexName, filter, ids }) {
|
|
3087
3100
|
if (ids && filter) {
|
|
3088
3101
|
throw new MastraError({
|
|
3089
|
-
id: "
|
|
3102
|
+
id: createVectorErrorId("LANCE", "DELETE_VECTORS", "MUTUALLY_EXCLUSIVE"),
|
|
3090
3103
|
domain: ErrorDomain.STORAGE,
|
|
3091
3104
|
category: ErrorCategory.USER,
|
|
3092
3105
|
text: "ids and filter are mutually exclusive",
|
|
@@ -3095,7 +3108,7 @@ var LanceVectorStore = class _LanceVectorStore extends MastraVector {
|
|
|
3095
3108
|
}
|
|
3096
3109
|
if (!ids && !filter) {
|
|
3097
3110
|
throw new MastraError({
|
|
3098
|
-
id: "
|
|
3111
|
+
id: createVectorErrorId("LANCE", "DELETE_VECTORS", "NO_TARGET"),
|
|
3099
3112
|
domain: ErrorDomain.STORAGE,
|
|
3100
3113
|
category: ErrorCategory.USER,
|
|
3101
3114
|
text: "Either filter or ids must be provided",
|
|
@@ -3104,7 +3117,7 @@ var LanceVectorStore = class _LanceVectorStore extends MastraVector {
|
|
|
3104
3117
|
}
|
|
3105
3118
|
if (ids && ids.length === 0) {
|
|
3106
3119
|
throw new MastraError({
|
|
3107
|
-
id: "
|
|
3120
|
+
id: createVectorErrorId("LANCE", "DELETE_VECTORS", "EMPTY_IDS"),
|
|
3108
3121
|
domain: ErrorDomain.STORAGE,
|
|
3109
3122
|
category: ErrorCategory.USER,
|
|
3110
3123
|
text: "Cannot delete with empty ids array",
|
|
@@ -3113,7 +3126,7 @@ var LanceVectorStore = class _LanceVectorStore extends MastraVector {
|
|
|
3113
3126
|
}
|
|
3114
3127
|
if (filter && Object.keys(filter).length === 0) {
|
|
3115
3128
|
throw new MastraError({
|
|
3116
|
-
id: "
|
|
3129
|
+
id: createVectorErrorId("LANCE", "DELETE_VECTORS", "EMPTY_FILTER"),
|
|
3117
3130
|
domain: ErrorDomain.STORAGE,
|
|
3118
3131
|
category: ErrorCategory.USER,
|
|
3119
3132
|
text: "Cannot delete with empty filter",
|
|
@@ -3173,7 +3186,7 @@ var LanceVectorStore = class _LanceVectorStore extends MastraVector {
|
|
|
3173
3186
|
if (error instanceof MastraError) throw error;
|
|
3174
3187
|
throw new MastraError(
|
|
3175
3188
|
{
|
|
3176
|
-
id: "
|
|
3189
|
+
id: createVectorErrorId("LANCE", "DELETE_VECTORS", "FAILED"),
|
|
3177
3190
|
domain: ErrorDomain.STORAGE,
|
|
3178
3191
|
category: ErrorCategory.THIRD_PARTY,
|
|
3179
3192
|
details: {
|