@mastra/libsql 1.0.0-beta.3 → 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 +31 -0
- package/dist/index.cjs +62 -62
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +62 -62
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/memory/index.d.ts.map +1 -1
- package/dist/storage/domains/observability/index.d.ts.map +1 -1
- package/dist/storage/domains/operations/index.d.ts.map +1 -1
- package/dist/storage/domains/scores/index.d.ts.map +1 -1
- package/dist/storage/domains/workflows/index.d.ts.map +1 -1
- package/dist/storage/index.d.ts +30 -8
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/vector/index.d.ts.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createClient } from '@libsql/client';
|
|
2
2
|
import { MastraError, ErrorCategory, ErrorDomain } from '@mastra/core/error';
|
|
3
|
+
import { createVectorErrorId, MastraStorage, StoreOperations, TABLE_WORKFLOW_SNAPSHOT, TABLE_SPANS, createStorageErrorId, ScoresStorage, TABLE_SCORERS, normalizePerPage, calculatePagination, transformScoreRow, WorkflowsStorage, MemoryStorage, TABLE_MESSAGES, TABLE_THREADS, TABLE_RESOURCES, ObservabilityStorage, TABLE_SCHEMAS, safelyParseJSON, SPAN_SCHEMA } from '@mastra/core/storage';
|
|
3
4
|
import { parseSqlIdentifier, parseFieldKey } from '@mastra/core/utils';
|
|
4
5
|
import { MastraVector } from '@mastra/core/vector';
|
|
5
6
|
import { BaseFilterTranslator } from '@mastra/core/vector/filter';
|
|
6
|
-
import { MastraStorage, StoreOperations, TABLE_WORKFLOW_SNAPSHOT, TABLE_SPANS, ScoresStorage, TABLE_SCORERS, normalizePerPage, calculatePagination, transformScoreRow, WorkflowsStorage, MemoryStorage, TABLE_MESSAGES, TABLE_THREADS, TABLE_RESOURCES, ObservabilityStorage, TABLE_SCHEMAS, safelyParseJSON, SPAN_SCHEMA } from '@mastra/core/storage';
|
|
7
7
|
import { MessageList } from '@mastra/core/agent';
|
|
8
8
|
import { saveScorePayloadSchema } from '@mastra/core/evals';
|
|
9
9
|
|
|
@@ -581,7 +581,7 @@ var LibSQLVector = class extends MastraVector {
|
|
|
581
581
|
} catch (error) {
|
|
582
582
|
throw new MastraError(
|
|
583
583
|
{
|
|
584
|
-
id: "
|
|
584
|
+
id: createVectorErrorId("LIBSQL", "QUERY", "INVALID_ARGS"),
|
|
585
585
|
domain: ErrorDomain.STORAGE,
|
|
586
586
|
category: ErrorCategory.USER
|
|
587
587
|
},
|
|
@@ -623,7 +623,7 @@ var LibSQLVector = class extends MastraVector {
|
|
|
623
623
|
} catch (error) {
|
|
624
624
|
throw new MastraError(
|
|
625
625
|
{
|
|
626
|
-
id: "
|
|
626
|
+
id: createVectorErrorId("LIBSQL", "QUERY", "FAILED"),
|
|
627
627
|
domain: ErrorDomain.STORAGE,
|
|
628
628
|
category: ErrorCategory.THIRD_PARTY
|
|
629
629
|
},
|
|
@@ -637,7 +637,7 @@ var LibSQLVector = class extends MastraVector {
|
|
|
637
637
|
} catch (error) {
|
|
638
638
|
throw new MastraError(
|
|
639
639
|
{
|
|
640
|
-
id: "
|
|
640
|
+
id: createVectorErrorId("LIBSQL", "UPSERT", "FAILED"),
|
|
641
641
|
domain: ErrorDomain.STORAGE,
|
|
642
642
|
category: ErrorCategory.THIRD_PARTY
|
|
643
643
|
},
|
|
@@ -691,7 +691,7 @@ var LibSQLVector = class extends MastraVector {
|
|
|
691
691
|
} catch (error) {
|
|
692
692
|
throw new MastraError(
|
|
693
693
|
{
|
|
694
|
-
id: "
|
|
694
|
+
id: createVectorErrorId("LIBSQL", "CREATE_INDEX", "FAILED"),
|
|
695
695
|
domain: ErrorDomain.STORAGE,
|
|
696
696
|
category: ErrorCategory.THIRD_PARTY,
|
|
697
697
|
details: { indexName: args.indexName, dimension: args.dimension }
|
|
@@ -730,7 +730,7 @@ var LibSQLVector = class extends MastraVector {
|
|
|
730
730
|
} catch (error) {
|
|
731
731
|
throw new MastraError(
|
|
732
732
|
{
|
|
733
|
-
id: "
|
|
733
|
+
id: createVectorErrorId("LIBSQL", "DELETE_INDEX", "FAILED"),
|
|
734
734
|
domain: ErrorDomain.STORAGE,
|
|
735
735
|
category: ErrorCategory.THIRD_PARTY,
|
|
736
736
|
details: { indexName: args.indexName }
|
|
@@ -761,7 +761,7 @@ var LibSQLVector = class extends MastraVector {
|
|
|
761
761
|
} catch (error) {
|
|
762
762
|
throw new MastraError(
|
|
763
763
|
{
|
|
764
|
-
id: "
|
|
764
|
+
id: createVectorErrorId("LIBSQL", "LIST_INDEXES", "FAILED"),
|
|
765
765
|
domain: ErrorDomain.STORAGE,
|
|
766
766
|
category: ErrorCategory.THIRD_PARTY
|
|
767
767
|
},
|
|
@@ -809,7 +809,7 @@ var LibSQLVector = class extends MastraVector {
|
|
|
809
809
|
} catch (e) {
|
|
810
810
|
throw new MastraError(
|
|
811
811
|
{
|
|
812
|
-
id: "
|
|
812
|
+
id: createVectorErrorId("LIBSQL", "DESCRIBE_INDEX", "FAILED"),
|
|
813
813
|
domain: ErrorDomain.STORAGE,
|
|
814
814
|
category: ErrorCategory.THIRD_PARTY,
|
|
815
815
|
details: { indexName }
|
|
@@ -837,7 +837,7 @@ var LibSQLVector = class extends MastraVector {
|
|
|
837
837
|
const parsedIndexName = parseSqlIdentifier(indexName, "index name");
|
|
838
838
|
if ("id" in params && params.id && "filter" in params && params.filter) {
|
|
839
839
|
throw new MastraError({
|
|
840
|
-
id: "
|
|
840
|
+
id: createVectorErrorId("LIBSQL", "UPDATE_VECTOR", "MUTUALLY_EXCLUSIVE"),
|
|
841
841
|
domain: ErrorDomain.STORAGE,
|
|
842
842
|
category: ErrorCategory.USER,
|
|
843
843
|
details: { indexName },
|
|
@@ -846,7 +846,7 @@ var LibSQLVector = class extends MastraVector {
|
|
|
846
846
|
}
|
|
847
847
|
if (!update.vector && !update.metadata) {
|
|
848
848
|
throw new MastraError({
|
|
849
|
-
id: "
|
|
849
|
+
id: createVectorErrorId("LIBSQL", "UPDATE_VECTOR", "NO_PAYLOAD"),
|
|
850
850
|
domain: ErrorDomain.STORAGE,
|
|
851
851
|
category: ErrorCategory.USER,
|
|
852
852
|
details: { indexName },
|
|
@@ -875,7 +875,7 @@ var LibSQLVector = class extends MastraVector {
|
|
|
875
875
|
const filter = params.filter;
|
|
876
876
|
if (!filter || Object.keys(filter).length === 0) {
|
|
877
877
|
throw new MastraError({
|
|
878
|
-
id: "
|
|
878
|
+
id: createVectorErrorId("LIBSQL", "UPDATE_VECTOR", "EMPTY_FILTER"),
|
|
879
879
|
domain: ErrorDomain.STORAGE,
|
|
880
880
|
category: ErrorCategory.USER,
|
|
881
881
|
details: { indexName },
|
|
@@ -886,7 +886,7 @@ var LibSQLVector = class extends MastraVector {
|
|
|
886
886
|
const { sql: filterSql, values: filterValues } = buildFilterQuery(translatedFilter);
|
|
887
887
|
if (!filterSql || filterSql.trim() === "") {
|
|
888
888
|
throw new MastraError({
|
|
889
|
-
id: "
|
|
889
|
+
id: createVectorErrorId("LIBSQL", "UPDATE_VECTOR", "INVALID_FILTER"),
|
|
890
890
|
domain: ErrorDomain.STORAGE,
|
|
891
891
|
category: ErrorCategory.USER,
|
|
892
892
|
details: { indexName },
|
|
@@ -897,7 +897,7 @@ var LibSQLVector = class extends MastraVector {
|
|
|
897
897
|
const matchAllPatterns = ["true", "1 = 1", "1=1"];
|
|
898
898
|
if (matchAllPatterns.includes(normalizedCondition)) {
|
|
899
899
|
throw new MastraError({
|
|
900
|
-
id: "
|
|
900
|
+
id: createVectorErrorId("LIBSQL", "UPDATE_VECTOR", "MATCH_ALL_FILTER"),
|
|
901
901
|
domain: ErrorDomain.STORAGE,
|
|
902
902
|
category: ErrorCategory.USER,
|
|
903
903
|
details: { indexName, filterSql: normalizedCondition },
|
|
@@ -908,7 +908,7 @@ var LibSQLVector = class extends MastraVector {
|
|
|
908
908
|
whereValues = filterValues;
|
|
909
909
|
} else {
|
|
910
910
|
throw new MastraError({
|
|
911
|
-
id: "
|
|
911
|
+
id: createVectorErrorId("LIBSQL", "UPDATE_VECTOR", "NO_TARGET"),
|
|
912
912
|
domain: ErrorDomain.STORAGE,
|
|
913
913
|
category: ErrorCategory.USER,
|
|
914
914
|
details: { indexName },
|
|
@@ -935,7 +935,7 @@ var LibSQLVector = class extends MastraVector {
|
|
|
935
935
|
}
|
|
936
936
|
throw new MastraError(
|
|
937
937
|
{
|
|
938
|
-
id: "
|
|
938
|
+
id: createVectorErrorId("LIBSQL", "UPDATE_VECTOR", "FAILED"),
|
|
939
939
|
domain: ErrorDomain.STORAGE,
|
|
940
940
|
category: ErrorCategory.THIRD_PARTY,
|
|
941
941
|
details: errorDetails
|
|
@@ -957,7 +957,7 @@ var LibSQLVector = class extends MastraVector {
|
|
|
957
957
|
} catch (error) {
|
|
958
958
|
throw new MastraError(
|
|
959
959
|
{
|
|
960
|
-
id: "
|
|
960
|
+
id: createVectorErrorId("LIBSQL", "DELETE_VECTOR", "FAILED"),
|
|
961
961
|
domain: ErrorDomain.STORAGE,
|
|
962
962
|
category: ErrorCategory.THIRD_PARTY,
|
|
963
963
|
details: {
|
|
@@ -983,7 +983,7 @@ var LibSQLVector = class extends MastraVector {
|
|
|
983
983
|
const parsedIndexName = parseSqlIdentifier(indexName, "index name");
|
|
984
984
|
if (!filter && !ids) {
|
|
985
985
|
throw new MastraError({
|
|
986
|
-
id: "
|
|
986
|
+
id: createVectorErrorId("LIBSQL", "DELETE_VECTORS", "NO_TARGET"),
|
|
987
987
|
domain: ErrorDomain.STORAGE,
|
|
988
988
|
category: ErrorCategory.USER,
|
|
989
989
|
details: { indexName },
|
|
@@ -992,7 +992,7 @@ var LibSQLVector = class extends MastraVector {
|
|
|
992
992
|
}
|
|
993
993
|
if (filter && ids) {
|
|
994
994
|
throw new MastraError({
|
|
995
|
-
id: "
|
|
995
|
+
id: createVectorErrorId("LIBSQL", "DELETE_VECTORS", "MUTUALLY_EXCLUSIVE"),
|
|
996
996
|
domain: ErrorDomain.STORAGE,
|
|
997
997
|
category: ErrorCategory.USER,
|
|
998
998
|
details: { indexName },
|
|
@@ -1004,7 +1004,7 @@ var LibSQLVector = class extends MastraVector {
|
|
|
1004
1004
|
if (ids) {
|
|
1005
1005
|
if (ids.length === 0) {
|
|
1006
1006
|
throw new MastraError({
|
|
1007
|
-
id: "
|
|
1007
|
+
id: createVectorErrorId("LIBSQL", "DELETE_VECTORS", "EMPTY_IDS"),
|
|
1008
1008
|
domain: ErrorDomain.STORAGE,
|
|
1009
1009
|
category: ErrorCategory.USER,
|
|
1010
1010
|
details: { indexName },
|
|
@@ -1017,7 +1017,7 @@ var LibSQLVector = class extends MastraVector {
|
|
|
1017
1017
|
} else {
|
|
1018
1018
|
if (!filter || Object.keys(filter).length === 0) {
|
|
1019
1019
|
throw new MastraError({
|
|
1020
|
-
id: "
|
|
1020
|
+
id: createVectorErrorId("LIBSQL", "DELETE_VECTORS", "EMPTY_FILTER"),
|
|
1021
1021
|
domain: ErrorDomain.STORAGE,
|
|
1022
1022
|
category: ErrorCategory.USER,
|
|
1023
1023
|
details: { indexName },
|
|
@@ -1028,7 +1028,7 @@ var LibSQLVector = class extends MastraVector {
|
|
|
1028
1028
|
const { sql: filterSql, values: filterValues } = buildFilterQuery(translatedFilter);
|
|
1029
1029
|
if (!filterSql || filterSql.trim() === "") {
|
|
1030
1030
|
throw new MastraError({
|
|
1031
|
-
id: "
|
|
1031
|
+
id: createVectorErrorId("LIBSQL", "DELETE_VECTORS", "INVALID_FILTER"),
|
|
1032
1032
|
domain: ErrorDomain.STORAGE,
|
|
1033
1033
|
category: ErrorCategory.USER,
|
|
1034
1034
|
details: { indexName },
|
|
@@ -1039,7 +1039,7 @@ var LibSQLVector = class extends MastraVector {
|
|
|
1039
1039
|
const matchAllPatterns = ["true", "1 = 1", "1=1"];
|
|
1040
1040
|
if (matchAllPatterns.includes(normalizedCondition)) {
|
|
1041
1041
|
throw new MastraError({
|
|
1042
|
-
id: "
|
|
1042
|
+
id: createVectorErrorId("LIBSQL", "DELETE_VECTORS", "MATCH_ALL_FILTER"),
|
|
1043
1043
|
domain: ErrorDomain.STORAGE,
|
|
1044
1044
|
category: ErrorCategory.USER,
|
|
1045
1045
|
details: { indexName, filterSql: normalizedCondition },
|
|
@@ -1057,7 +1057,7 @@ var LibSQLVector = class extends MastraVector {
|
|
|
1057
1057
|
} catch (error) {
|
|
1058
1058
|
throw new MastraError(
|
|
1059
1059
|
{
|
|
1060
|
-
id: "
|
|
1060
|
+
id: createVectorErrorId("LIBSQL", "DELETE_VECTORS", "FAILED"),
|
|
1061
1061
|
domain: ErrorDomain.STORAGE,
|
|
1062
1062
|
category: ErrorCategory.THIRD_PARTY,
|
|
1063
1063
|
details: {
|
|
@@ -1076,7 +1076,7 @@ var LibSQLVector = class extends MastraVector {
|
|
|
1076
1076
|
} catch (error) {
|
|
1077
1077
|
throw new MastraError(
|
|
1078
1078
|
{
|
|
1079
|
-
id: "
|
|
1079
|
+
id: createVectorErrorId("LIBSQL", "TRUNCATE_INDEX", "FAILED"),
|
|
1080
1080
|
domain: ErrorDomain.STORAGE,
|
|
1081
1081
|
category: ErrorCategory.THIRD_PARTY,
|
|
1082
1082
|
details: { indexName: args.indexName }
|
|
@@ -1185,7 +1185,7 @@ var MemoryLibSQL = class extends MemoryStorage {
|
|
|
1185
1185
|
} catch (error) {
|
|
1186
1186
|
throw new MastraError(
|
|
1187
1187
|
{
|
|
1188
|
-
id: "
|
|
1188
|
+
id: createStorageErrorId("LIBSQL", "LIST_MESSAGES_BY_ID", "FAILED"),
|
|
1189
1189
|
domain: ErrorDomain.STORAGE,
|
|
1190
1190
|
category: ErrorCategory.THIRD_PARTY,
|
|
1191
1191
|
details: { messageIds: JSON.stringify(messageIds) }
|
|
@@ -1200,7 +1200,7 @@ var MemoryLibSQL = class extends MemoryStorage {
|
|
|
1200
1200
|
if (threadIds.length === 0 || threadIds.some((id) => !id.trim())) {
|
|
1201
1201
|
throw new MastraError(
|
|
1202
1202
|
{
|
|
1203
|
-
id: "
|
|
1203
|
+
id: createStorageErrorId("LIBSQL", "LIST_MESSAGES", "INVALID_THREAD_ID"),
|
|
1204
1204
|
domain: ErrorDomain.STORAGE,
|
|
1205
1205
|
category: ErrorCategory.THIRD_PARTY,
|
|
1206
1206
|
details: { threadId: Array.isArray(threadId) ? threadId.join(",") : threadId }
|
|
@@ -1211,7 +1211,7 @@ var MemoryLibSQL = class extends MemoryStorage {
|
|
|
1211
1211
|
if (page < 0) {
|
|
1212
1212
|
throw new MastraError(
|
|
1213
1213
|
{
|
|
1214
|
-
id: "
|
|
1214
|
+
id: createStorageErrorId("LIBSQL", "LIST_MESSAGES", "INVALID_PAGE"),
|
|
1215
1215
|
domain: ErrorDomain.STORAGE,
|
|
1216
1216
|
category: ErrorCategory.USER,
|
|
1217
1217
|
details: { page }
|
|
@@ -1303,7 +1303,7 @@ var MemoryLibSQL = class extends MemoryStorage {
|
|
|
1303
1303
|
} catch (error) {
|
|
1304
1304
|
const mastraError = new MastraError(
|
|
1305
1305
|
{
|
|
1306
|
-
id: "
|
|
1306
|
+
id: createStorageErrorId("LIBSQL", "LIST_MESSAGES", "FAILED"),
|
|
1307
1307
|
domain: ErrorDomain.STORAGE,
|
|
1308
1308
|
category: ErrorCategory.THIRD_PARTY,
|
|
1309
1309
|
details: {
|
|
@@ -1386,7 +1386,7 @@ var MemoryLibSQL = class extends MemoryStorage {
|
|
|
1386
1386
|
} catch (error) {
|
|
1387
1387
|
throw new MastraError(
|
|
1388
1388
|
{
|
|
1389
|
-
id: "
|
|
1389
|
+
id: createStorageErrorId("LIBSQL", "SAVE_MESSAGES", "FAILED"),
|
|
1390
1390
|
domain: ErrorDomain.STORAGE,
|
|
1391
1391
|
category: ErrorCategory.THIRD_PARTY
|
|
1392
1392
|
},
|
|
@@ -1514,7 +1514,7 @@ var MemoryLibSQL = class extends MemoryStorage {
|
|
|
1514
1514
|
} catch (error) {
|
|
1515
1515
|
throw new MastraError(
|
|
1516
1516
|
{
|
|
1517
|
-
id: "
|
|
1517
|
+
id: createStorageErrorId("LIBSQL", "DELETE_MESSAGES", "FAILED"),
|
|
1518
1518
|
domain: ErrorDomain.STORAGE,
|
|
1519
1519
|
category: ErrorCategory.THIRD_PARTY,
|
|
1520
1520
|
details: { messageIds: messageIds.join(", ") }
|
|
@@ -1612,7 +1612,7 @@ var MemoryLibSQL = class extends MemoryStorage {
|
|
|
1612
1612
|
} catch (error) {
|
|
1613
1613
|
throw new MastraError(
|
|
1614
1614
|
{
|
|
1615
|
-
id: "
|
|
1615
|
+
id: createStorageErrorId("LIBSQL", "GET_THREAD_BY_ID", "FAILED"),
|
|
1616
1616
|
domain: ErrorDomain.STORAGE,
|
|
1617
1617
|
category: ErrorCategory.THIRD_PARTY,
|
|
1618
1618
|
details: { threadId }
|
|
@@ -1626,7 +1626,7 @@ var MemoryLibSQL = class extends MemoryStorage {
|
|
|
1626
1626
|
if (page < 0) {
|
|
1627
1627
|
throw new MastraError(
|
|
1628
1628
|
{
|
|
1629
|
-
id: "
|
|
1629
|
+
id: createStorageErrorId("LIBSQL", "LIST_THREADS_BY_RESOURCE_ID", "INVALID_PAGE"),
|
|
1630
1630
|
domain: ErrorDomain.STORAGE,
|
|
1631
1631
|
category: ErrorCategory.USER,
|
|
1632
1632
|
details: { page }
|
|
@@ -1680,7 +1680,7 @@ var MemoryLibSQL = class extends MemoryStorage {
|
|
|
1680
1680
|
} catch (error) {
|
|
1681
1681
|
const mastraError = new MastraError(
|
|
1682
1682
|
{
|
|
1683
|
-
id: "
|
|
1683
|
+
id: createStorageErrorId("LIBSQL", "LIST_THREADS_BY_RESOURCE_ID", "FAILED"),
|
|
1684
1684
|
domain: ErrorDomain.STORAGE,
|
|
1685
1685
|
category: ErrorCategory.THIRD_PARTY,
|
|
1686
1686
|
details: { resourceId }
|
|
@@ -1711,7 +1711,7 @@ var MemoryLibSQL = class extends MemoryStorage {
|
|
|
1711
1711
|
} catch (error) {
|
|
1712
1712
|
const mastraError = new MastraError(
|
|
1713
1713
|
{
|
|
1714
|
-
id: "
|
|
1714
|
+
id: createStorageErrorId("LIBSQL", "SAVE_THREAD", "FAILED"),
|
|
1715
1715
|
domain: ErrorDomain.STORAGE,
|
|
1716
1716
|
category: ErrorCategory.THIRD_PARTY,
|
|
1717
1717
|
details: { threadId: thread.id }
|
|
@@ -1731,7 +1731,7 @@ var MemoryLibSQL = class extends MemoryStorage {
|
|
|
1731
1731
|
const thread = await this.getThreadById({ threadId: id });
|
|
1732
1732
|
if (!thread) {
|
|
1733
1733
|
throw new MastraError({
|
|
1734
|
-
id: "
|
|
1734
|
+
id: createStorageErrorId("LIBSQL", "UPDATE_THREAD", "NOT_FOUND"),
|
|
1735
1735
|
domain: ErrorDomain.STORAGE,
|
|
1736
1736
|
category: ErrorCategory.USER,
|
|
1737
1737
|
text: `Thread ${id} not found`,
|
|
@@ -1758,7 +1758,7 @@ var MemoryLibSQL = class extends MemoryStorage {
|
|
|
1758
1758
|
} catch (error) {
|
|
1759
1759
|
throw new MastraError(
|
|
1760
1760
|
{
|
|
1761
|
-
id: "
|
|
1761
|
+
id: createStorageErrorId("LIBSQL", "UPDATE_THREAD", "FAILED"),
|
|
1762
1762
|
domain: ErrorDomain.STORAGE,
|
|
1763
1763
|
category: ErrorCategory.THIRD_PARTY,
|
|
1764
1764
|
text: `Failed to update thread ${id}`,
|
|
@@ -1781,7 +1781,7 @@ var MemoryLibSQL = class extends MemoryStorage {
|
|
|
1781
1781
|
} catch (error) {
|
|
1782
1782
|
throw new MastraError(
|
|
1783
1783
|
{
|
|
1784
|
-
id: "
|
|
1784
|
+
id: createStorageErrorId("LIBSQL", "DELETE_THREAD", "FAILED"),
|
|
1785
1785
|
domain: ErrorDomain.STORAGE,
|
|
1786
1786
|
category: ErrorCategory.THIRD_PARTY,
|
|
1787
1787
|
details: { threadId }
|
|
@@ -1978,7 +1978,7 @@ var ObservabilityLibSQL = class extends ObservabilityStorage {
|
|
|
1978
1978
|
} catch (error) {
|
|
1979
1979
|
throw new MastraError(
|
|
1980
1980
|
{
|
|
1981
|
-
id: "
|
|
1981
|
+
id: createStorageErrorId("LIBSQL", "CREATE_SPAN", "FAILED"),
|
|
1982
1982
|
domain: ErrorDomain.STORAGE,
|
|
1983
1983
|
category: ErrorCategory.USER,
|
|
1984
1984
|
details: {
|
|
@@ -2009,7 +2009,7 @@ var ObservabilityLibSQL = class extends ObservabilityStorage {
|
|
|
2009
2009
|
} catch (error) {
|
|
2010
2010
|
throw new MastraError(
|
|
2011
2011
|
{
|
|
2012
|
-
id: "
|
|
2012
|
+
id: createStorageErrorId("LIBSQL", "GET_TRACE", "FAILED"),
|
|
2013
2013
|
domain: ErrorDomain.STORAGE,
|
|
2014
2014
|
category: ErrorCategory.USER,
|
|
2015
2015
|
details: {
|
|
@@ -2034,7 +2034,7 @@ var ObservabilityLibSQL = class extends ObservabilityStorage {
|
|
|
2034
2034
|
} catch (error) {
|
|
2035
2035
|
throw new MastraError(
|
|
2036
2036
|
{
|
|
2037
|
-
id: "
|
|
2037
|
+
id: createStorageErrorId("LIBSQL", "UPDATE_SPAN", "FAILED"),
|
|
2038
2038
|
domain: ErrorDomain.STORAGE,
|
|
2039
2039
|
category: ErrorCategory.USER,
|
|
2040
2040
|
details: {
|
|
@@ -2069,7 +2069,7 @@ var ObservabilityLibSQL = class extends ObservabilityStorage {
|
|
|
2069
2069
|
name = `agent run: '${entityId}'`;
|
|
2070
2070
|
} else {
|
|
2071
2071
|
const error = new MastraError({
|
|
2072
|
-
id: "
|
|
2072
|
+
id: createStorageErrorId("LIBSQL", "GET_TRACES_PAGINATED", "INVALID_ENTITY_TYPE"),
|
|
2073
2073
|
domain: ErrorDomain.STORAGE,
|
|
2074
2074
|
category: ErrorCategory.USER,
|
|
2075
2075
|
details: {
|
|
@@ -2097,7 +2097,7 @@ var ObservabilityLibSQL = class extends ObservabilityStorage {
|
|
|
2097
2097
|
} catch (error) {
|
|
2098
2098
|
throw new MastraError(
|
|
2099
2099
|
{
|
|
2100
|
-
id: "
|
|
2100
|
+
id: createStorageErrorId("LIBSQL", "GET_TRACES_PAGINATED", "COUNT_FAILED"),
|
|
2101
2101
|
domain: ErrorDomain.STORAGE,
|
|
2102
2102
|
category: ErrorCategory.USER
|
|
2103
2103
|
},
|
|
@@ -2138,7 +2138,7 @@ var ObservabilityLibSQL = class extends ObservabilityStorage {
|
|
|
2138
2138
|
} catch (error) {
|
|
2139
2139
|
throw new MastraError(
|
|
2140
2140
|
{
|
|
2141
|
-
id: "
|
|
2141
|
+
id: createStorageErrorId("LIBSQL", "GET_TRACES_PAGINATED", "FAILED"),
|
|
2142
2142
|
domain: ErrorDomain.STORAGE,
|
|
2143
2143
|
category: ErrorCategory.USER
|
|
2144
2144
|
},
|
|
@@ -2160,7 +2160,7 @@ var ObservabilityLibSQL = class extends ObservabilityStorage {
|
|
|
2160
2160
|
} catch (error) {
|
|
2161
2161
|
throw new MastraError(
|
|
2162
2162
|
{
|
|
2163
|
-
id: "
|
|
2163
|
+
id: createStorageErrorId("LIBSQL", "BATCH_CREATE_SPANS", "FAILED"),
|
|
2164
2164
|
domain: ErrorDomain.STORAGE,
|
|
2165
2165
|
category: ErrorCategory.USER
|
|
2166
2166
|
},
|
|
@@ -2180,7 +2180,7 @@ var ObservabilityLibSQL = class extends ObservabilityStorage {
|
|
|
2180
2180
|
} catch (error) {
|
|
2181
2181
|
throw new MastraError(
|
|
2182
2182
|
{
|
|
2183
|
-
id: "
|
|
2183
|
+
id: createStorageErrorId("LIBSQL", "BATCH_UPDATE_SPANS", "FAILED"),
|
|
2184
2184
|
domain: ErrorDomain.STORAGE,
|
|
2185
2185
|
category: ErrorCategory.USER
|
|
2186
2186
|
},
|
|
@@ -2198,7 +2198,7 @@ var ObservabilityLibSQL = class extends ObservabilityStorage {
|
|
|
2198
2198
|
} catch (error) {
|
|
2199
2199
|
throw new MastraError(
|
|
2200
2200
|
{
|
|
2201
|
-
id: "
|
|
2201
|
+
id: createStorageErrorId("LIBSQL", "BATCH_DELETE_TRACES", "FAILED"),
|
|
2202
2202
|
domain: ErrorDomain.STORAGE,
|
|
2203
2203
|
category: ErrorCategory.USER
|
|
2204
2204
|
},
|
|
@@ -2274,7 +2274,7 @@ var StoreOperationsLibSQL = class extends StoreOperations {
|
|
|
2274
2274
|
} catch (error) {
|
|
2275
2275
|
throw new MastraError(
|
|
2276
2276
|
{
|
|
2277
|
-
id: "
|
|
2277
|
+
id: createStorageErrorId("LIBSQL", "CREATE_TABLE", "FAILED"),
|
|
2278
2278
|
domain: ErrorDomain.STORAGE,
|
|
2279
2279
|
category: ErrorCategory.THIRD_PARTY,
|
|
2280
2280
|
details: {
|
|
@@ -2418,7 +2418,7 @@ var StoreOperationsLibSQL = class extends StoreOperations {
|
|
|
2418
2418
|
).catch((error) => {
|
|
2419
2419
|
throw new MastraError(
|
|
2420
2420
|
{
|
|
2421
|
-
id: "
|
|
2421
|
+
id: createStorageErrorId("LIBSQL", "BATCH_INSERT", "FAILED"),
|
|
2422
2422
|
domain: ErrorDomain.STORAGE,
|
|
2423
2423
|
category: ErrorCategory.THIRD_PARTY,
|
|
2424
2424
|
details: {
|
|
@@ -2444,7 +2444,7 @@ var StoreOperationsLibSQL = class extends StoreOperations {
|
|
|
2444
2444
|
).catch((error) => {
|
|
2445
2445
|
throw new MastraError(
|
|
2446
2446
|
{
|
|
2447
|
-
id: "
|
|
2447
|
+
id: createStorageErrorId("LIBSQL", "BATCH_UPDATE", "FAILED"),
|
|
2448
2448
|
domain: ErrorDomain.STORAGE,
|
|
2449
2449
|
category: ErrorCategory.THIRD_PARTY,
|
|
2450
2450
|
details: {
|
|
@@ -2487,7 +2487,7 @@ var StoreOperationsLibSQL = class extends StoreOperations {
|
|
|
2487
2487
|
).catch((error) => {
|
|
2488
2488
|
throw new MastraError(
|
|
2489
2489
|
{
|
|
2490
|
-
id: "
|
|
2490
|
+
id: createStorageErrorId("LIBSQL", "BATCH_DELETE", "FAILED"),
|
|
2491
2491
|
domain: ErrorDomain.STORAGE,
|
|
2492
2492
|
category: ErrorCategory.THIRD_PARTY,
|
|
2493
2493
|
details: {
|
|
@@ -2544,7 +2544,7 @@ var StoreOperationsLibSQL = class extends StoreOperations {
|
|
|
2544
2544
|
} catch (error) {
|
|
2545
2545
|
throw new MastraError(
|
|
2546
2546
|
{
|
|
2547
|
-
id: "
|
|
2547
|
+
id: createStorageErrorId("LIBSQL", "ALTER_TABLE", "FAILED"),
|
|
2548
2548
|
domain: ErrorDomain.STORAGE,
|
|
2549
2549
|
category: ErrorCategory.THIRD_PARTY,
|
|
2550
2550
|
details: {
|
|
@@ -2562,7 +2562,7 @@ var StoreOperationsLibSQL = class extends StoreOperations {
|
|
|
2562
2562
|
} catch (e) {
|
|
2563
2563
|
const mastraError = new MastraError(
|
|
2564
2564
|
{
|
|
2565
|
-
id: "
|
|
2565
|
+
id: createStorageErrorId("LIBSQL", "CLEAR_TABLE", "FAILED"),
|
|
2566
2566
|
domain: ErrorDomain.STORAGE,
|
|
2567
2567
|
category: ErrorCategory.THIRD_PARTY,
|
|
2568
2568
|
details: {
|
|
@@ -2582,7 +2582,7 @@ var StoreOperationsLibSQL = class extends StoreOperations {
|
|
|
2582
2582
|
} catch (e) {
|
|
2583
2583
|
throw new MastraError(
|
|
2584
2584
|
{
|
|
2585
|
-
id: "
|
|
2585
|
+
id: createStorageErrorId("LIBSQL", "DROP_TABLE", "FAILED"),
|
|
2586
2586
|
domain: ErrorDomain.STORAGE,
|
|
2587
2587
|
category: ErrorCategory.THIRD_PARTY,
|
|
2588
2588
|
details: {
|
|
@@ -2645,7 +2645,7 @@ var ScoresLibSQL = class extends ScoresStorage {
|
|
|
2645
2645
|
} catch (error) {
|
|
2646
2646
|
throw new MastraError(
|
|
2647
2647
|
{
|
|
2648
|
-
id: "
|
|
2648
|
+
id: createStorageErrorId("LIBSQL", "LIST_SCORES_BY_RUN_ID", "FAILED"),
|
|
2649
2649
|
domain: ErrorDomain.STORAGE,
|
|
2650
2650
|
category: ErrorCategory.THIRD_PARTY
|
|
2651
2651
|
},
|
|
@@ -2718,7 +2718,7 @@ var ScoresLibSQL = class extends ScoresStorage {
|
|
|
2718
2718
|
} catch (error) {
|
|
2719
2719
|
throw new MastraError(
|
|
2720
2720
|
{
|
|
2721
|
-
id: "
|
|
2721
|
+
id: createStorageErrorId("LIBSQL", "LIST_SCORES_BY_SCORER_ID", "FAILED"),
|
|
2722
2722
|
domain: ErrorDomain.STORAGE,
|
|
2723
2723
|
category: ErrorCategory.THIRD_PARTY
|
|
2724
2724
|
},
|
|
@@ -2749,7 +2749,7 @@ var ScoresLibSQL = class extends ScoresStorage {
|
|
|
2749
2749
|
} catch (error) {
|
|
2750
2750
|
throw new MastraError(
|
|
2751
2751
|
{
|
|
2752
|
-
id: "
|
|
2752
|
+
id: createStorageErrorId("LIBSQL", "SAVE_SCORE", "VALIDATION_FAILED"),
|
|
2753
2753
|
domain: ErrorDomain.STORAGE,
|
|
2754
2754
|
category: ErrorCategory.USER,
|
|
2755
2755
|
details: {
|
|
@@ -2779,7 +2779,7 @@ var ScoresLibSQL = class extends ScoresStorage {
|
|
|
2779
2779
|
} catch (error) {
|
|
2780
2780
|
throw new MastraError(
|
|
2781
2781
|
{
|
|
2782
|
-
id: "
|
|
2782
|
+
id: createStorageErrorId("LIBSQL", "SAVE_SCORE", "FAILED"),
|
|
2783
2783
|
domain: ErrorDomain.STORAGE,
|
|
2784
2784
|
category: ErrorCategory.THIRD_PARTY
|
|
2785
2785
|
},
|
|
@@ -2831,7 +2831,7 @@ var ScoresLibSQL = class extends ScoresStorage {
|
|
|
2831
2831
|
} catch (error) {
|
|
2832
2832
|
throw new MastraError(
|
|
2833
2833
|
{
|
|
2834
|
-
id: "
|
|
2834
|
+
id: createStorageErrorId("LIBSQL", "LIST_SCORES_BY_ENTITY_ID", "FAILED"),
|
|
2835
2835
|
domain: ErrorDomain.STORAGE,
|
|
2836
2836
|
category: ErrorCategory.THIRD_PARTY
|
|
2837
2837
|
},
|
|
@@ -2872,7 +2872,7 @@ var ScoresLibSQL = class extends ScoresStorage {
|
|
|
2872
2872
|
} catch (error) {
|
|
2873
2873
|
throw new MastraError(
|
|
2874
2874
|
{
|
|
2875
|
-
id: "
|
|
2875
|
+
id: createStorageErrorId("LIBSQL", "LIST_SCORES_BY_SPAN", "FAILED"),
|
|
2876
2876
|
domain: ErrorDomain.STORAGE,
|
|
2877
2877
|
category: ErrorCategory.THIRD_PARTY
|
|
2878
2878
|
},
|
|
@@ -3122,7 +3122,7 @@ var WorkflowsLibSQL = class extends WorkflowsStorage {
|
|
|
3122
3122
|
} catch (error) {
|
|
3123
3123
|
throw new MastraError(
|
|
3124
3124
|
{
|
|
3125
|
-
id: "
|
|
3125
|
+
id: createStorageErrorId("LIBSQL", "GET_WORKFLOW_RUN_BY_ID", "FAILED"),
|
|
3126
3126
|
domain: ErrorDomain.STORAGE,
|
|
3127
3127
|
category: ErrorCategory.THIRD_PARTY
|
|
3128
3128
|
},
|
|
@@ -3188,7 +3188,7 @@ var WorkflowsLibSQL = class extends WorkflowsStorage {
|
|
|
3188
3188
|
} catch (error) {
|
|
3189
3189
|
throw new MastraError(
|
|
3190
3190
|
{
|
|
3191
|
-
id: "
|
|
3191
|
+
id: createStorageErrorId("LIBSQL", "LIST_WORKFLOW_RUNS", "FAILED"),
|
|
3192
3192
|
domain: ErrorDomain.STORAGE,
|
|
3193
3193
|
category: ErrorCategory.THIRD_PARTY
|
|
3194
3194
|
},
|
|
@@ -3208,7 +3208,7 @@ var LibSQLStore = class extends MastraStorage {
|
|
|
3208
3208
|
if (!config.id || typeof config.id !== "string" || config.id.trim() === "") {
|
|
3209
3209
|
throw new Error("LibSQLStore: id must be provided and cannot be empty.");
|
|
3210
3210
|
}
|
|
3211
|
-
super({ id: config.id, name: `LibSQLStore
|
|
3211
|
+
super({ id: config.id, name: `LibSQLStore`, disableInit: config.disableInit });
|
|
3212
3212
|
this.maxRetries = config.maxRetries ?? 5;
|
|
3213
3213
|
this.initialBackoffMs = config.initialBackoffMs ?? 100;
|
|
3214
3214
|
if ("url" in config) {
|