@mastra/mongodb 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/dist/index.cjs CHANGED
@@ -1,11 +1,11 @@
1
1
  'use strict';
2
2
 
3
3
  var error = require('@mastra/core/error');
4
+ var storage = require('@mastra/core/storage');
4
5
  var vector = require('@mastra/core/vector');
5
6
  var mongodb = require('mongodb');
6
7
  var uuid = require('uuid');
7
8
  var filter = require('@mastra/core/vector/filter');
8
- var storage = require('@mastra/core/storage');
9
9
  var agent = require('@mastra/core/agent');
10
10
  var evals = require('@mastra/core/evals');
11
11
 
@@ -13,7 +13,7 @@ var evals = require('@mastra/core/evals');
13
13
 
14
14
  // package.json
15
15
  var package_default = {
16
- version: "1.0.0-beta.3"};
16
+ version: "1.0.0-beta.4"};
17
17
  var MongoDBFilterTranslator = class extends filter.BaseFilterTranslator {
18
18
  getSupportedOperators() {
19
19
  return {
@@ -136,7 +136,7 @@ var MongoDBVector = class extends vector.MastraVector {
136
136
  } catch (error$1) {
137
137
  throw new error.MastraError(
138
138
  {
139
- id: "STORAGE_MONGODB_VECTOR_CONNECT_FAILED",
139
+ id: storage.createVectorErrorId("MONGODB", "CONNECT", "FAILED"),
140
140
  domain: error.ErrorDomain.STORAGE,
141
141
  category: error.ErrorCategory.THIRD_PARTY
142
142
  },
@@ -150,7 +150,7 @@ var MongoDBVector = class extends vector.MastraVector {
150
150
  } catch (error$1) {
151
151
  throw new error.MastraError(
152
152
  {
153
- id: "STORAGE_MONGODB_VECTOR_DISCONNECT_FAILED",
153
+ id: storage.createVectorErrorId("MONGODB", "DISCONNECT", "FAILED"),
154
154
  domain: error.ErrorDomain.STORAGE,
155
155
  category: error.ErrorCategory.THIRD_PARTY
156
156
  },
@@ -171,7 +171,7 @@ var MongoDBVector = class extends vector.MastraVector {
171
171
  } catch (error$1) {
172
172
  throw new error.MastraError(
173
173
  {
174
- id: "STORAGE_MONGODB_VECTOR_CREATE_INDEX_INVALID_ARGS",
174
+ id: storage.createVectorErrorId("MONGODB", "CREATE_INDEX", "INVALID_ARGS"),
175
175
  domain: error.ErrorDomain.STORAGE,
176
176
  category: error.ErrorCategory.USER,
177
177
  details: {
@@ -224,7 +224,7 @@ var MongoDBVector = class extends vector.MastraVector {
224
224
  if (error$1.codeName !== "IndexAlreadyExists") {
225
225
  throw new error.MastraError(
226
226
  {
227
- id: "STORAGE_MONGODB_VECTOR_CREATE_INDEX_FAILED",
227
+ id: storage.createVectorErrorId("MONGODB", "CREATE_INDEX", "FAILED"),
228
228
  domain: error.ErrorDomain.STORAGE,
229
229
  category: error.ErrorCategory.THIRD_PARTY
230
230
  },
@@ -237,7 +237,7 @@ var MongoDBVector = class extends vector.MastraVector {
237
237
  } catch (error$1) {
238
238
  throw new error.MastraError(
239
239
  {
240
- id: "STORAGE_MONGODB_VECTOR_CREATE_INDEX_FAILED_STORE_METADATA",
240
+ id: storage.createVectorErrorId("MONGODB", "CREATE_INDEX", "STORE_METADATA_FAILED"),
241
241
  domain: error.ErrorDomain.STORAGE,
242
242
  category: error.ErrorCategory.THIRD_PARTY,
243
243
  details: {
@@ -314,7 +314,7 @@ var MongoDBVector = class extends vector.MastraVector {
314
314
  } catch (error$1) {
315
315
  throw new error.MastraError(
316
316
  {
317
- id: "STORAGE_MONGODB_VECTOR_UPSERT_FAILED",
317
+ id: storage.createVectorErrorId("MONGODB", "UPSERT", "FAILED"),
318
318
  domain: error.ErrorDomain.STORAGE,
319
319
  category: error.ErrorCategory.THIRD_PARTY,
320
320
  details: {
@@ -395,7 +395,7 @@ var MongoDBVector = class extends vector.MastraVector {
395
395
  } catch (error$1) {
396
396
  throw new error.MastraError(
397
397
  {
398
- id: "STORAGE_MONGODB_VECTOR_QUERY_FAILED",
398
+ id: storage.createVectorErrorId("MONGODB", "QUERY", "FAILED"),
399
399
  domain: error.ErrorDomain.STORAGE,
400
400
  category: error.ErrorCategory.THIRD_PARTY,
401
401
  details: {
@@ -413,7 +413,7 @@ var MongoDBVector = class extends vector.MastraVector {
413
413
  } catch (error$1) {
414
414
  throw new error.MastraError(
415
415
  {
416
- id: "STORAGE_MONGODB_VECTOR_LIST_INDEXES_FAILED",
416
+ id: storage.createVectorErrorId("MONGODB", "LIST_INDEXES", "FAILED"),
417
417
  domain: error.ErrorDomain.STORAGE,
418
418
  category: error.ErrorCategory.THIRD_PARTY
419
419
  },
@@ -442,7 +442,7 @@ var MongoDBVector = class extends vector.MastraVector {
442
442
  } catch (error$1) {
443
443
  throw new error.MastraError(
444
444
  {
445
- id: "STORAGE_MONGODB_VECTOR_DESCRIBE_INDEX_FAILED",
445
+ id: storage.createVectorErrorId("MONGODB", "DESCRIBE_INDEX", "FAILED"),
446
446
  domain: error.ErrorDomain.STORAGE,
447
447
  category: error.ErrorCategory.THIRD_PARTY,
448
448
  details: {
@@ -465,7 +465,7 @@ var MongoDBVector = class extends vector.MastraVector {
465
465
  } catch (error$1) {
466
466
  throw new error.MastraError(
467
467
  {
468
- id: "STORAGE_MONGODB_VECTOR_DELETE_INDEX_FAILED",
468
+ id: storage.createVectorErrorId("MONGODB", "DELETE_INDEX", "FAILED"),
469
469
  domain: error.ErrorDomain.STORAGE,
470
470
  category: error.ErrorCategory.THIRD_PARTY,
471
471
  details: {
@@ -490,7 +490,7 @@ var MongoDBVector = class extends vector.MastraVector {
490
490
  const { indexName, update } = params;
491
491
  if ("id" in params && params.id && "filter" in params && params.filter) {
492
492
  throw new error.MastraError({
493
- id: "STORAGE_MONGODB_VECTOR_UPDATE_MUTUALLY_EXCLUSIVE_PARAMS",
493
+ id: storage.createVectorErrorId("MONGODB", "UPDATE_VECTOR", "MUTUALLY_EXCLUSIVE"),
494
494
  domain: error.ErrorDomain.STORAGE,
495
495
  category: error.ErrorCategory.USER,
496
496
  details: { indexName },
@@ -499,7 +499,7 @@ var MongoDBVector = class extends vector.MastraVector {
499
499
  }
500
500
  if (!("id" in params || "filter" in params) || !params.id && !params.filter) {
501
501
  throw new error.MastraError({
502
- id: "STORAGE_MONGODB_VECTOR_UPDATE_MISSING_PARAMS",
502
+ id: storage.createVectorErrorId("MONGODB", "UPDATE_VECTOR", "NO_TARGET"),
503
503
  domain: error.ErrorDomain.STORAGE,
504
504
  category: error.ErrorCategory.USER,
505
505
  text: "Either id or filter must be provided",
@@ -533,7 +533,7 @@ var MongoDBVector = class extends vector.MastraVector {
533
533
  const filter = params.filter;
534
534
  if (!filter || Object.keys(filter).length === 0) {
535
535
  throw new error.MastraError({
536
- id: "STORAGE_MONGODB_VECTOR_UPDATE_EMPTY_FILTER",
536
+ id: storage.createVectorErrorId("MONGODB", "UPDATE_VECTOR", "EMPTY_FILTER"),
537
537
  domain: error.ErrorDomain.STORAGE,
538
538
  category: error.ErrorCategory.USER,
539
539
  details: { indexName },
@@ -544,7 +544,7 @@ var MongoDBVector = class extends vector.MastraVector {
544
544
  const transformedFilter = this.transformMetadataFilter(mongoFilter);
545
545
  if (!transformedFilter || Object.keys(transformedFilter).length === 0) {
546
546
  throw new error.MastraError({
547
- id: "STORAGE_MONGODB_VECTOR_UPDATE_INVALID_FILTER",
547
+ id: storage.createVectorErrorId("MONGODB", "UPDATE_VECTOR", "INVALID_FILTER"),
548
548
  domain: error.ErrorDomain.STORAGE,
549
549
  category: error.ErrorCategory.USER,
550
550
  details: { indexName },
@@ -566,7 +566,7 @@ var MongoDBVector = class extends vector.MastraVector {
566
566
  }
567
567
  throw new error.MastraError(
568
568
  {
569
- id: "STORAGE_MONGODB_VECTOR_UPDATE_VECTOR_FAILED",
569
+ id: storage.createVectorErrorId("MONGODB", "UPDATE_VECTOR", "FAILED"),
570
570
  domain: error.ErrorDomain.STORAGE,
571
571
  category: error.ErrorCategory.THIRD_PARTY,
572
572
  details: errorDetails
@@ -589,7 +589,7 @@ var MongoDBVector = class extends vector.MastraVector {
589
589
  } catch (error$1) {
590
590
  throw new error.MastraError(
591
591
  {
592
- id: "STORAGE_MONGODB_VECTOR_DELETE_VECTOR_FAILED",
592
+ id: storage.createVectorErrorId("MONGODB", "DELETE_VECTOR", "FAILED"),
593
593
  domain: error.ErrorDomain.STORAGE,
594
594
  category: error.ErrorCategory.THIRD_PARTY,
595
595
  details: {
@@ -604,7 +604,7 @@ var MongoDBVector = class extends vector.MastraVector {
604
604
  async deleteVectors({ indexName, filter, ids }) {
605
605
  if (!filter && !ids) {
606
606
  throw new error.MastraError({
607
- id: "STORAGE_MONGODB_VECTOR_DELETE_MISSING_PARAMS",
607
+ id: storage.createVectorErrorId("MONGODB", "DELETE_VECTORS", "NO_TARGET"),
608
608
  domain: error.ErrorDomain.STORAGE,
609
609
  category: error.ErrorCategory.USER,
610
610
  details: { indexName },
@@ -613,7 +613,7 @@ var MongoDBVector = class extends vector.MastraVector {
613
613
  }
614
614
  if (filter && ids) {
615
615
  throw new error.MastraError({
616
- id: "STORAGE_MONGODB_VECTOR_DELETE_CONFLICTING_PARAMS",
616
+ id: storage.createVectorErrorId("MONGODB", "DELETE_VECTORS", "MUTUALLY_EXCLUSIVE"),
617
617
  domain: error.ErrorDomain.STORAGE,
618
618
  category: error.ErrorCategory.USER,
619
619
  details: { indexName },
@@ -625,7 +625,7 @@ var MongoDBVector = class extends vector.MastraVector {
625
625
  if (ids) {
626
626
  if (ids.length === 0) {
627
627
  throw new error.MastraError({
628
- id: "STORAGE_MONGODB_VECTOR_DELETE_EMPTY_IDS",
628
+ id: storage.createVectorErrorId("MONGODB", "DELETE_VECTORS", "EMPTY_IDS"),
629
629
  domain: error.ErrorDomain.STORAGE,
630
630
  category: error.ErrorCategory.USER,
631
631
  details: { indexName },
@@ -636,7 +636,7 @@ var MongoDBVector = class extends vector.MastraVector {
636
636
  } else {
637
637
  if (!filter || Object.keys(filter).length === 0) {
638
638
  throw new error.MastraError({
639
- id: "STORAGE_MONGODB_VECTOR_DELETE_EMPTY_FILTER",
639
+ id: storage.createVectorErrorId("MONGODB", "DELETE_VECTORS", "EMPTY_FILTER"),
640
640
  domain: error.ErrorDomain.STORAGE,
641
641
  category: error.ErrorCategory.USER,
642
642
  details: { indexName },
@@ -647,7 +647,7 @@ var MongoDBVector = class extends vector.MastraVector {
647
647
  const transformedFilter = this.transformMetadataFilter(mongoFilter);
648
648
  if (!transformedFilter || Object.keys(transformedFilter).length === 0) {
649
649
  throw new error.MastraError({
650
- id: "STORAGE_MONGODB_VECTOR_DELETE_INVALID_FILTER",
650
+ id: storage.createVectorErrorId("MONGODB", "DELETE_VECTORS", "INVALID_FILTER"),
651
651
  domain: error.ErrorDomain.STORAGE,
652
652
  category: error.ErrorCategory.USER,
653
653
  details: { indexName },
@@ -665,7 +665,7 @@ var MongoDBVector = class extends vector.MastraVector {
665
665
  }
666
666
  throw new error.MastraError(
667
667
  {
668
- id: "STORAGE_MONGODB_VECTOR_DELETE_VECTORS_FAILED",
668
+ id: storage.createVectorErrorId("MONGODB", "DELETE_VECTORS", "FAILED"),
669
669
  domain: error.ErrorDomain.STORAGE,
670
670
  category: error.ErrorCategory.THIRD_PARTY,
671
671
  details: {
@@ -907,7 +907,7 @@ var MemoryStorageMongoDB = class extends storage.MemoryStorage {
907
907
  } catch (error$1) {
908
908
  throw new error.MastraError(
909
909
  {
910
- id: "MONGODB_STORE_LIST_MESSAGES_BY_ID_FAILED",
910
+ id: storage.createStorageErrorId("MONGODB", "LIST_MESSAGES_BY_ID", "FAILED"),
911
911
  domain: error.ErrorDomain.STORAGE,
912
912
  category: error.ErrorCategory.THIRD_PARTY,
913
913
  details: { messageIds: JSON.stringify(messageIds) }
@@ -922,7 +922,7 @@ var MemoryStorageMongoDB = class extends storage.MemoryStorage {
922
922
  if (threadIds.length === 0 || threadIds.some((id) => !id.trim())) {
923
923
  throw new error.MastraError(
924
924
  {
925
- id: "STORAGE_MONGODB_LIST_MESSAGES_INVALID_THREAD_ID",
925
+ id: storage.createStorageErrorId("MONGODB", "LIST_MESSAGES", "INVALID_THREAD_ID"),
926
926
  domain: error.ErrorDomain.STORAGE,
927
927
  category: error.ErrorCategory.THIRD_PARTY,
928
928
  details: { threadId: Array.isArray(threadId) ? threadId.join(",") : threadId }
@@ -933,7 +933,7 @@ var MemoryStorageMongoDB = class extends storage.MemoryStorage {
933
933
  if (page < 0) {
934
934
  throw new error.MastraError(
935
935
  {
936
- id: "STORAGE_MONGODB_LIST_MESSAGES_INVALID_PAGE",
936
+ id: storage.createStorageErrorId("MONGODB", "LIST_MESSAGES", "INVALID_PAGE"),
937
937
  domain: error.ErrorDomain.STORAGE,
938
938
  category: error.ErrorCategory.USER,
939
939
  details: { page }
@@ -1016,7 +1016,7 @@ var MemoryStorageMongoDB = class extends storage.MemoryStorage {
1016
1016
  } catch (error$1) {
1017
1017
  const mastraError = new error.MastraError(
1018
1018
  {
1019
- id: "MONGODB_STORE_LIST_MESSAGES_FAILED",
1019
+ id: storage.createStorageErrorId("MONGODB", "LIST_MESSAGES", "FAILED"),
1020
1020
  domain: error.ErrorDomain.STORAGE,
1021
1021
  category: error.ErrorCategory.THIRD_PARTY,
1022
1022
  details: {
@@ -1085,7 +1085,7 @@ var MemoryStorageMongoDB = class extends storage.MemoryStorage {
1085
1085
  } catch (error$1) {
1086
1086
  throw new error.MastraError(
1087
1087
  {
1088
- id: "MONGODB_STORE_SAVE_MESSAGES_FAILED",
1088
+ id: storage.createStorageErrorId("MONGODB", "SAVE_MESSAGES", "FAILED"),
1089
1089
  domain: error.ErrorDomain.STORAGE,
1090
1090
  category: error.ErrorCategory.THIRD_PARTY
1091
1091
  },
@@ -1183,7 +1183,7 @@ var MemoryStorageMongoDB = class extends storage.MemoryStorage {
1183
1183
  } catch (error$1) {
1184
1184
  throw new error.MastraError(
1185
1185
  {
1186
- id: "STORAGE_MONGODB_STORE_GET_RESOURCE_BY_ID_FAILED",
1186
+ id: storage.createStorageErrorId("MONGODB", "GET_RESOURCE_BY_ID", "FAILED"),
1187
1187
  domain: error.ErrorDomain.STORAGE,
1188
1188
  category: error.ErrorCategory.THIRD_PARTY,
1189
1189
  details: { resourceId }
@@ -1209,7 +1209,7 @@ var MemoryStorageMongoDB = class extends storage.MemoryStorage {
1209
1209
  } catch (error$1) {
1210
1210
  throw new error.MastraError(
1211
1211
  {
1212
- id: "STORAGE_MONGODB_STORE_SAVE_RESOURCE_FAILED",
1212
+ id: storage.createStorageErrorId("MONGODB", "SAVE_RESOURCE", "FAILED"),
1213
1213
  domain: error.ErrorDomain.STORAGE,
1214
1214
  category: error.ErrorCategory.THIRD_PARTY,
1215
1215
  details: { resourceId: resource.id }
@@ -1254,7 +1254,7 @@ var MemoryStorageMongoDB = class extends storage.MemoryStorage {
1254
1254
  } catch (error$1) {
1255
1255
  throw new error.MastraError(
1256
1256
  {
1257
- id: "STORAGE_MONGODB_STORE_UPDATE_RESOURCE_FAILED",
1257
+ id: storage.createStorageErrorId("MONGODB", "UPDATE_RESOURCE", "FAILED"),
1258
1258
  domain: error.ErrorDomain.STORAGE,
1259
1259
  category: error.ErrorCategory.THIRD_PARTY,
1260
1260
  details: { resourceId }
@@ -1277,7 +1277,7 @@ var MemoryStorageMongoDB = class extends storage.MemoryStorage {
1277
1277
  } catch (error$1) {
1278
1278
  throw new error.MastraError(
1279
1279
  {
1280
- id: "STORAGE_MONGODB_STORE_GET_THREAD_BY_ID_FAILED",
1280
+ id: storage.createStorageErrorId("MONGODB", "GET_THREAD_BY_ID", "FAILED"),
1281
1281
  domain: error.ErrorDomain.STORAGE,
1282
1282
  category: error.ErrorCategory.THIRD_PARTY,
1283
1283
  details: { threadId }
@@ -1292,7 +1292,7 @@ var MemoryStorageMongoDB = class extends storage.MemoryStorage {
1292
1292
  if (page < 0) {
1293
1293
  throw new error.MastraError(
1294
1294
  {
1295
- id: "STORAGE_MONGODB_LIST_THREADS_BY_RESOURCE_ID_INVALID_PAGE",
1295
+ id: storage.createStorageErrorId("MONGODB", "LIST_THREADS_BY_RESOURCE_ID", "INVALID_PAGE"),
1296
1296
  domain: error.ErrorDomain.STORAGE,
1297
1297
  category: error.ErrorCategory.USER,
1298
1298
  details: { page }
@@ -1338,7 +1338,7 @@ var MemoryStorageMongoDB = class extends storage.MemoryStorage {
1338
1338
  } catch (error$1) {
1339
1339
  throw new error.MastraError(
1340
1340
  {
1341
- id: "MONGODB_STORE_LIST_THREADS_BY_RESOURCE_ID_FAILED",
1341
+ id: storage.createStorageErrorId("MONGODB", "LIST_THREADS_BY_RESOURCE_ID", "FAILED"),
1342
1342
  domain: error.ErrorDomain.STORAGE,
1343
1343
  category: error.ErrorCategory.THIRD_PARTY,
1344
1344
  details: { resourceId: args.resourceId }
@@ -1364,7 +1364,7 @@ var MemoryStorageMongoDB = class extends storage.MemoryStorage {
1364
1364
  } catch (error$1) {
1365
1365
  throw new error.MastraError(
1366
1366
  {
1367
- id: "STORAGE_MONGODB_STORE_SAVE_THREAD_FAILED",
1367
+ id: storage.createStorageErrorId("MONGODB", "SAVE_THREAD", "FAILED"),
1368
1368
  domain: error.ErrorDomain.STORAGE,
1369
1369
  category: error.ErrorCategory.THIRD_PARTY,
1370
1370
  details: { threadId: thread.id }
@@ -1381,7 +1381,7 @@ var MemoryStorageMongoDB = class extends storage.MemoryStorage {
1381
1381
  const thread = await this.getThreadById({ threadId: id });
1382
1382
  if (!thread) {
1383
1383
  throw new error.MastraError({
1384
- id: "STORAGE_MONGODB_STORE_UPDATE_THREAD_NOT_FOUND",
1384
+ id: storage.createStorageErrorId("MONGODB", "UPDATE_THREAD", "NOT_FOUND"),
1385
1385
  domain: error.ErrorDomain.STORAGE,
1386
1386
  category: error.ErrorCategory.THIRD_PARTY,
1387
1387
  details: { threadId: id, status: 404 },
@@ -1410,7 +1410,7 @@ var MemoryStorageMongoDB = class extends storage.MemoryStorage {
1410
1410
  } catch (error$1) {
1411
1411
  throw new error.MastraError(
1412
1412
  {
1413
- id: "STORAGE_MONGODB_STORE_UPDATE_THREAD_FAILED",
1413
+ id: storage.createStorageErrorId("MONGODB", "UPDATE_THREAD", "FAILED"),
1414
1414
  domain: error.ErrorDomain.STORAGE,
1415
1415
  category: error.ErrorCategory.THIRD_PARTY,
1416
1416
  details: { threadId: id }
@@ -1429,7 +1429,7 @@ var MemoryStorageMongoDB = class extends storage.MemoryStorage {
1429
1429
  } catch (error$1) {
1430
1430
  throw new error.MastraError(
1431
1431
  {
1432
- id: "STORAGE_MONGODB_STORE_DELETE_THREAD_FAILED",
1432
+ id: storage.createStorageErrorId("MONGODB", "DELETE_THREAD", "FAILED"),
1433
1433
  domain: error.ErrorDomain.STORAGE,
1434
1434
  category: error.ErrorCategory.THIRD_PARTY,
1435
1435
  details: { threadId }
@@ -1466,7 +1466,7 @@ var ObservabilityMongoDB = class extends storage.ObservabilityStorage {
1466
1466
  } catch (error$1) {
1467
1467
  throw new error.MastraError(
1468
1468
  {
1469
- id: "MONGODB_STORE_CREATE_SPAN_FAILED",
1469
+ id: storage.createStorageErrorId("MONGODB", "CREATE_SPAN", "FAILED"),
1470
1470
  domain: error.ErrorDomain.STORAGE,
1471
1471
  category: error.ErrorCategory.USER,
1472
1472
  details: {
@@ -1494,7 +1494,7 @@ var ObservabilityMongoDB = class extends storage.ObservabilityStorage {
1494
1494
  } catch (error$1) {
1495
1495
  throw new error.MastraError(
1496
1496
  {
1497
- id: "MONGODB_STORE_GET_TRACE_FAILED",
1497
+ id: storage.createStorageErrorId("MONGODB", "GET_TRACE", "FAILED"),
1498
1498
  domain: error.ErrorDomain.STORAGE,
1499
1499
  category: error.ErrorCategory.USER,
1500
1500
  details: {
@@ -1530,7 +1530,7 @@ var ObservabilityMongoDB = class extends storage.ObservabilityStorage {
1530
1530
  } catch (error$1) {
1531
1531
  throw new error.MastraError(
1532
1532
  {
1533
- id: "MONGODB_STORE_UPDATE_SPAN_FAILED",
1533
+ id: storage.createStorageErrorId("MONGODB", "UPDATE_SPAN", "FAILED"),
1534
1534
  domain: error.ErrorDomain.STORAGE,
1535
1535
  category: error.ErrorCategory.USER,
1536
1536
  details: {
@@ -1576,7 +1576,7 @@ var ObservabilityMongoDB = class extends storage.ObservabilityStorage {
1576
1576
  name = `agent run: '${entityId}'`;
1577
1577
  } else {
1578
1578
  const error$1 = new error.MastraError({
1579
- id: "MONGODB_STORE_GET_TRACES_PAGINATED_FAILED",
1579
+ id: storage.createStorageErrorId("MONGODB", "GET_TRACES_PAGINATED", "INVALID_ENTITY_TYPE"),
1580
1580
  domain: error.ErrorDomain.STORAGE,
1581
1581
  category: error.ErrorCategory.USER,
1582
1582
  details: {
@@ -1613,7 +1613,7 @@ var ObservabilityMongoDB = class extends storage.ObservabilityStorage {
1613
1613
  } catch (error$1) {
1614
1614
  throw new error.MastraError(
1615
1615
  {
1616
- id: "MONGODB_STORE_GET_TRACES_PAGINATED_FAILED",
1616
+ id: storage.createStorageErrorId("MONGODB", "GET_TRACES_PAGINATED", "FAILED"),
1617
1617
  domain: error.ErrorDomain.STORAGE,
1618
1618
  category: error.ErrorCategory.USER
1619
1619
  },
@@ -1641,7 +1641,7 @@ var ObservabilityMongoDB = class extends storage.ObservabilityStorage {
1641
1641
  } catch (error$1) {
1642
1642
  throw new error.MastraError(
1643
1643
  {
1644
- id: "MONGODB_STORE_BATCH_CREATE_SPANS_FAILED",
1644
+ id: storage.createStorageErrorId("MONGODB", "BATCH_CREATE_SPANS", "FAILED"),
1645
1645
  domain: error.ErrorDomain.STORAGE,
1646
1646
  category: error.ErrorCategory.USER
1647
1647
  },
@@ -1674,7 +1674,7 @@ var ObservabilityMongoDB = class extends storage.ObservabilityStorage {
1674
1674
  } catch (error$1) {
1675
1675
  throw new error.MastraError(
1676
1676
  {
1677
- id: "MONGODB_STORE_BATCH_UPDATE_SPANS_FAILED",
1677
+ id: storage.createStorageErrorId("MONGODB", "BATCH_UPDATE_SPANS", "FAILED"),
1678
1678
  domain: error.ErrorDomain.STORAGE,
1679
1679
  category: error.ErrorCategory.USER
1680
1680
  },
@@ -1691,7 +1691,7 @@ var ObservabilityMongoDB = class extends storage.ObservabilityStorage {
1691
1691
  } catch (error$1) {
1692
1692
  throw new error.MastraError(
1693
1693
  {
1694
- id: "MONGODB_STORE_BATCH_DELETE_TRACES_FAILED",
1694
+ id: storage.createStorageErrorId("MONGODB", "BATCH_DELETE_TRACES", "FAILED"),
1695
1695
  domain: error.ErrorDomain.STORAGE,
1696
1696
  category: error.ErrorCategory.USER
1697
1697
  },
@@ -1742,7 +1742,7 @@ var StoreOperationsMongoDB = class extends storage.StoreOperations {
1742
1742
  } catch (error$1) {
1743
1743
  const mastraError = new error.MastraError(
1744
1744
  {
1745
- id: "STORAGE_MONGODB_STORE_CLEAR_TABLE_FAILED",
1745
+ id: storage.createStorageErrorId("MONGODB", "CLEAR_TABLE", "FAILED"),
1746
1746
  domain: error.ErrorDomain.STORAGE,
1747
1747
  category: error.ErrorCategory.THIRD_PARTY,
1748
1748
  details: { tableName }
@@ -1764,7 +1764,7 @@ var StoreOperationsMongoDB = class extends storage.StoreOperations {
1764
1764
  }
1765
1765
  throw new error.MastraError(
1766
1766
  {
1767
- id: "MONGODB_STORE_DROP_TABLE_FAILED",
1767
+ id: storage.createStorageErrorId("MONGODB", "DROP_TABLE", "FAILED"),
1768
1768
  domain: error.ErrorDomain.STORAGE,
1769
1769
  category: error.ErrorCategory.THIRD_PARTY,
1770
1770
  details: { tableName }
@@ -1795,7 +1795,7 @@ var StoreOperationsMongoDB = class extends storage.StoreOperations {
1795
1795
  } catch (error$1) {
1796
1796
  const mastraError = new error.MastraError(
1797
1797
  {
1798
- id: "STORAGE_MONGODB_STORE_INSERT_FAILED",
1798
+ id: storage.createStorageErrorId("MONGODB", "INSERT", "FAILED"),
1799
1799
  domain: error.ErrorDomain.STORAGE,
1800
1800
  category: error.ErrorCategory.THIRD_PARTY,
1801
1801
  details: { tableName }
@@ -1818,7 +1818,7 @@ var StoreOperationsMongoDB = class extends storage.StoreOperations {
1818
1818
  } catch (error$1) {
1819
1819
  throw new error.MastraError(
1820
1820
  {
1821
- id: "STORAGE_MONGODB_STORE_BATCH_INSERT_FAILED",
1821
+ id: storage.createStorageErrorId("MONGODB", "BATCH_INSERT", "FAILED"),
1822
1822
  domain: error.ErrorDomain.STORAGE,
1823
1823
  category: error.ErrorCategory.THIRD_PARTY,
1824
1824
  details: { tableName }
@@ -1835,7 +1835,7 @@ var StoreOperationsMongoDB = class extends storage.StoreOperations {
1835
1835
  } catch (error$1) {
1836
1836
  throw new error.MastraError(
1837
1837
  {
1838
- id: "STORAGE_MONGODB_STORE_LOAD_FAILED",
1838
+ id: storage.createStorageErrorId("MONGODB", "LOAD", "FAILED"),
1839
1839
  domain: error.ErrorDomain.STORAGE,
1840
1840
  category: error.ErrorCategory.THIRD_PARTY,
1841
1841
  details: { tableName }
@@ -1857,7 +1857,7 @@ var StoreOperationsMongoDB = class extends storage.StoreOperations {
1857
1857
  } catch (error$1) {
1858
1858
  throw new error.MastraError(
1859
1859
  {
1860
- id: "STORAGE_MONGODB_STORE_UPDATE_FAILED",
1860
+ id: storage.createStorageErrorId("MONGODB", "UPDATE", "FAILED"),
1861
1861
  domain: error.ErrorDomain.STORAGE,
1862
1862
  category: error.ErrorCategory.THIRD_PARTY,
1863
1863
  details: { tableName }
@@ -1889,7 +1889,7 @@ var StoreOperationsMongoDB = class extends storage.StoreOperations {
1889
1889
  } catch (error$1) {
1890
1890
  throw new error.MastraError(
1891
1891
  {
1892
- id: "STORAGE_MONGODB_STORE_BATCH_UPDATE_FAILED",
1892
+ id: storage.createStorageErrorId("MONGODB", "BATCH_UPDATE", "FAILED"),
1893
1893
  domain: error.ErrorDomain.STORAGE,
1894
1894
  category: error.ErrorCategory.THIRD_PARTY,
1895
1895
  details: { tableName }
@@ -1921,7 +1921,7 @@ var ScoresStorageMongoDB = class extends storage.ScoresStorage {
1921
1921
  } catch (error$1) {
1922
1922
  throw new error.MastraError(
1923
1923
  {
1924
- id: "STORAGE_MONGODB_STORE_GET_SCORE_BY_ID_FAILED",
1924
+ id: storage.createStorageErrorId("MONGODB", "GET_SCORE_BY_ID", "FAILED"),
1925
1925
  domain: error.ErrorDomain.STORAGE,
1926
1926
  category: error.ErrorCategory.THIRD_PARTY,
1927
1927
  details: { id }
@@ -1937,7 +1937,7 @@ var ScoresStorageMongoDB = class extends storage.ScoresStorage {
1937
1937
  } catch (error$1) {
1938
1938
  throw new error.MastraError(
1939
1939
  {
1940
- id: "STORAGE_MONGODB_STORE_SAVE_SCORE_VALIDATION_FAILED",
1940
+ id: storage.createStorageErrorId("MONGODB", "SAVE_SCORE", "VALIDATION_FAILED"),
1941
1941
  domain: error.ErrorDomain.STORAGE,
1942
1942
  category: error.ErrorCategory.THIRD_PARTY
1943
1943
  },
@@ -1980,7 +1980,7 @@ var ScoresStorageMongoDB = class extends storage.ScoresStorage {
1980
1980
  } catch (error$1) {
1981
1981
  throw new error.MastraError(
1982
1982
  {
1983
- id: "STORAGE_MONGODB_STORE_SAVE_SCORE_FAILED",
1983
+ id: storage.createStorageErrorId("MONGODB", "SAVE_SCORE", "FAILED"),
1984
1984
  domain: error.ErrorDomain.STORAGE,
1985
1985
  category: error.ErrorCategory.THIRD_PARTY,
1986
1986
  details: { scorerId: score.scorerId, runId: score.runId }
@@ -2042,7 +2042,7 @@ var ScoresStorageMongoDB = class extends storage.ScoresStorage {
2042
2042
  } catch (error$1) {
2043
2043
  throw new error.MastraError(
2044
2044
  {
2045
- id: "STORAGE_MONGODB_STORE_GET_SCORES_BY_SCORER_ID_FAILED",
2045
+ id: storage.createStorageErrorId("MONGODB", "LIST_SCORES_BY_SCORER_ID", "FAILED"),
2046
2046
  domain: error.ErrorDomain.STORAGE,
2047
2047
  category: error.ErrorCategory.THIRD_PARTY,
2048
2048
  details: { scorerId, page: pagination.page, perPage: pagination.perPage }
@@ -2091,7 +2091,7 @@ var ScoresStorageMongoDB = class extends storage.ScoresStorage {
2091
2091
  } catch (error$1) {
2092
2092
  throw new error.MastraError(
2093
2093
  {
2094
- id: "STORAGE_MONGODB_STORE_GET_SCORES_BY_RUN_ID_FAILED",
2094
+ id: storage.createStorageErrorId("MONGODB", "LIST_SCORES_BY_RUN_ID", "FAILED"),
2095
2095
  domain: error.ErrorDomain.STORAGE,
2096
2096
  category: error.ErrorCategory.THIRD_PARTY,
2097
2097
  details: { runId, page: pagination.page, perPage: pagination.perPage }
@@ -2141,7 +2141,7 @@ var ScoresStorageMongoDB = class extends storage.ScoresStorage {
2141
2141
  } catch (error$1) {
2142
2142
  throw new error.MastraError(
2143
2143
  {
2144
- id: "STORAGE_MONGODB_STORE_GET_SCORES_BY_ENTITY_ID_FAILED",
2144
+ id: storage.createStorageErrorId("MONGODB", "LIST_SCORES_BY_ENTITY_ID", "FAILED"),
2145
2145
  domain: error.ErrorDomain.STORAGE,
2146
2146
  category: error.ErrorCategory.THIRD_PARTY,
2147
2147
  details: { entityId, entityType, page: pagination.page, perPage: pagination.perPage }
@@ -2192,7 +2192,7 @@ var ScoresStorageMongoDB = class extends storage.ScoresStorage {
2192
2192
  } catch (error$1) {
2193
2193
  throw new error.MastraError(
2194
2194
  {
2195
- id: "STORAGE_MONGODB_STORE_GET_SCORES_BY_SPAN_FAILED",
2195
+ id: storage.createStorageErrorId("MONGODB", "LIST_SCORES_BY_SPAN", "FAILED"),
2196
2196
  domain: error.ErrorDomain.STORAGE,
2197
2197
  category: error.ErrorCategory.THIRD_PARTY,
2198
2198
  details: { traceId, spanId, page: pagination.page, perPage: pagination.perPage }
@@ -2249,7 +2249,7 @@ var WorkflowsStorageMongoDB = class extends storage.WorkflowsStorage {
2249
2249
  } catch (error$1) {
2250
2250
  throw new error.MastraError(
2251
2251
  {
2252
- id: "STORAGE_MONGODB_STORE_PERSIST_WORKFLOW_SNAPSHOT_FAILED",
2252
+ id: storage.createStorageErrorId("MONGODB", "PERSIST_WORKFLOW_SNAPSHOT", "FAILED"),
2253
2253
  domain: error.ErrorDomain.STORAGE,
2254
2254
  category: error.ErrorCategory.THIRD_PARTY,
2255
2255
  details: { workflowName, runId }
@@ -2277,7 +2277,7 @@ var WorkflowsStorageMongoDB = class extends storage.WorkflowsStorage {
2277
2277
  } catch (error$1) {
2278
2278
  throw new error.MastraError(
2279
2279
  {
2280
- id: "STORAGE_MONGODB_STORE_LOAD_WORKFLOW_SNAPSHOT_FAILED",
2280
+ id: storage.createStorageErrorId("MONGODB", "LOAD_WORKFLOW_SNAPSHOT", "FAILED"),
2281
2281
  domain: error.ErrorDomain.STORAGE,
2282
2282
  category: error.ErrorCategory.THIRD_PARTY,
2283
2283
  details: { workflowName, runId }
@@ -2316,7 +2316,7 @@ var WorkflowsStorageMongoDB = class extends storage.WorkflowsStorage {
2316
2316
  if (options.page < 0) {
2317
2317
  throw new error.MastraError(
2318
2318
  {
2319
- id: "STORAGE_MONGODB_INVALID_PAGE",
2319
+ id: storage.createStorageErrorId("MONGODB", "LIST_WORKFLOW_RUNS", "INVALID_PAGE"),
2320
2320
  domain: error.ErrorDomain.STORAGE,
2321
2321
  category: error.ErrorCategory.USER,
2322
2322
  details: { page: options.page }
@@ -2342,7 +2342,7 @@ var WorkflowsStorageMongoDB = class extends storage.WorkflowsStorage {
2342
2342
  } catch (error$1) {
2343
2343
  throw new error.MastraError(
2344
2344
  {
2345
- id: "STORAGE_MONGODB_STORE_LIST_WORKFLOW_RUNS_FAILED",
2345
+ id: storage.createStorageErrorId("MONGODB", "LIST_WORKFLOW_RUNS", "FAILED"),
2346
2346
  domain: error.ErrorDomain.STORAGE,
2347
2347
  category: error.ErrorCategory.THIRD_PARTY,
2348
2348
  details: { workflowName: options.workflowName || "unknown" }
@@ -2369,7 +2369,7 @@ var WorkflowsStorageMongoDB = class extends storage.WorkflowsStorage {
2369
2369
  } catch (error$1) {
2370
2370
  throw new error.MastraError(
2371
2371
  {
2372
- id: "STORAGE_MONGODB_STORE_GET_WORKFLOW_RUN_BY_ID_FAILED",
2372
+ id: storage.createStorageErrorId("MONGODB", "GET_WORKFLOW_RUN_BY_ID", "FAILED"),
2373
2373
  domain: error.ErrorDomain.STORAGE,
2374
2374
  category: error.ErrorCategory.THIRD_PARTY,
2375
2375
  details: { runId: args.runId }
@@ -2407,7 +2407,7 @@ var loadConnector = (config) => {
2407
2407
  } catch (error$1) {
2408
2408
  throw new error.MastraError(
2409
2409
  {
2410
- id: "STORAGE_MONGODB_STORE_CONSTRUCTOR_FAILED",
2410
+ id: storage.createStorageErrorId("MONGODB", "CONSTRUCTOR", "FAILED"),
2411
2411
  domain: error.ErrorDomain.STORAGE,
2412
2412
  category: error.ErrorCategory.USER,
2413
2413
  details: { connectionHandler: true }
@@ -2425,7 +2425,7 @@ var loadConnector = (config) => {
2425
2425
  } catch (error$1) {
2426
2426
  throw new error.MastraError(
2427
2427
  {
2428
- id: "STORAGE_MONGODB_STORE_CONSTRUCTOR_FAILED",
2428
+ id: storage.createStorageErrorId("MONGODB", "CONSTRUCTOR", "FAILED"),
2429
2429
  domain: error.ErrorDomain.STORAGE,
2430
2430
  category: error.ErrorCategory.USER,
2431
2431
  details: { url: config?.url, dbName: config?.dbName }
@@ -2448,7 +2448,7 @@ var MongoDBStore = class extends storage.MastraStorage {
2448
2448
  };
2449
2449
  }
2450
2450
  constructor(config) {
2451
- super({ id: config.id, name: "MongoDBStore" });
2451
+ super({ id: config.id, name: "MongoDBStore", disableInit: config.disableInit });
2452
2452
  this.stores = {};
2453
2453
  this.#connector = loadConnector(config);
2454
2454
  const operations = new StoreOperationsMongoDB({
@@ -2568,7 +2568,7 @@ var MongoDBStore = class extends storage.MastraStorage {
2568
2568
  } catch (error$1) {
2569
2569
  throw new error.MastraError(
2570
2570
  {
2571
- id: "STORAGE_MONGODB_STORE_CLOSE_FAILED",
2571
+ id: storage.createStorageErrorId("MONGODB", "CLOSE", "FAILED"),
2572
2572
  domain: error.ErrorDomain.STORAGE,
2573
2573
  category: error.ErrorCategory.USER
2574
2574
  },
@@ -2640,7 +2640,7 @@ var MongoDBStore = class extends storage.MastraStorage {
2640
2640
  async createSpan(span) {
2641
2641
  if (!this.stores.observability) {
2642
2642
  throw new error.MastraError({
2643
- id: "MONGODB_STORE_OBSERVABILITY_NOT_INITIALIZED",
2643
+ id: storage.createStorageErrorId("MONGODB", "OBSERVABILITY", "NOT_INITIALIZED"),
2644
2644
  domain: error.ErrorDomain.STORAGE,
2645
2645
  category: error.ErrorCategory.SYSTEM,
2646
2646
  text: "Observability storage is not initialized"
@@ -2655,7 +2655,7 @@ var MongoDBStore = class extends storage.MastraStorage {
2655
2655
  }) {
2656
2656
  if (!this.stores.observability) {
2657
2657
  throw new error.MastraError({
2658
- id: "MONGODB_STORE_OBSERVABILITY_NOT_INITIALIZED",
2658
+ id: storage.createStorageErrorId("MONGODB", "OBSERVABILITY", "NOT_INITIALIZED"),
2659
2659
  domain: error.ErrorDomain.STORAGE,
2660
2660
  category: error.ErrorCategory.SYSTEM,
2661
2661
  text: "Observability storage is not initialized"
@@ -2666,7 +2666,7 @@ var MongoDBStore = class extends storage.MastraStorage {
2666
2666
  async getTrace(traceId) {
2667
2667
  if (!this.stores.observability) {
2668
2668
  throw new error.MastraError({
2669
- id: "MONGODB_STORE_OBSERVABILITY_NOT_INITIALIZED",
2669
+ id: storage.createStorageErrorId("MONGODB", "OBSERVABILITY", "NOT_INITIALIZED"),
2670
2670
  domain: error.ErrorDomain.STORAGE,
2671
2671
  category: error.ErrorCategory.SYSTEM,
2672
2672
  text: "Observability storage is not initialized"
@@ -2677,7 +2677,7 @@ var MongoDBStore = class extends storage.MastraStorage {
2677
2677
  async getTracesPaginated(args) {
2678
2678
  if (!this.stores.observability) {
2679
2679
  throw new error.MastraError({
2680
- id: "MONGODB_STORE_OBSERVABILITY_NOT_INITIALIZED",
2680
+ id: storage.createStorageErrorId("MONGODB", "OBSERVABILITY", "NOT_INITIALIZED"),
2681
2681
  domain: error.ErrorDomain.STORAGE,
2682
2682
  category: error.ErrorCategory.SYSTEM,
2683
2683
  text: "Observability storage is not initialized"
@@ -2688,7 +2688,7 @@ var MongoDBStore = class extends storage.MastraStorage {
2688
2688
  async batchCreateSpans(args) {
2689
2689
  if (!this.stores.observability) {
2690
2690
  throw new error.MastraError({
2691
- id: "MONGODB_STORE_OBSERVABILITY_NOT_INITIALIZED",
2691
+ id: storage.createStorageErrorId("MONGODB", "OBSERVABILITY", "NOT_INITIALIZED"),
2692
2692
  domain: error.ErrorDomain.STORAGE,
2693
2693
  category: error.ErrorCategory.SYSTEM,
2694
2694
  text: "Observability storage is not initialized"
@@ -2699,7 +2699,7 @@ var MongoDBStore = class extends storage.MastraStorage {
2699
2699
  async batchUpdateSpans(args) {
2700
2700
  if (!this.stores.observability) {
2701
2701
  throw new error.MastraError({
2702
- id: "MONGODB_STORE_OBSERVABILITY_NOT_INITIALIZED",
2702
+ id: storage.createStorageErrorId("MONGODB", "OBSERVABILITY", "NOT_INITIALIZED"),
2703
2703
  domain: error.ErrorDomain.STORAGE,
2704
2704
  category: error.ErrorCategory.SYSTEM,
2705
2705
  text: "Observability storage is not initialized"
@@ -2710,7 +2710,7 @@ var MongoDBStore = class extends storage.MastraStorage {
2710
2710
  async batchDeleteTraces(args) {
2711
2711
  if (!this.stores.observability) {
2712
2712
  throw new error.MastraError({
2713
- id: "MONGODB_STORE_OBSERVABILITY_NOT_INITIALIZED",
2713
+ id: storage.createStorageErrorId("MONGODB", "OBSERVABILITY", "NOT_INITIALIZED"),
2714
2714
  domain: error.ErrorDomain.STORAGE,
2715
2715
  category: error.ErrorCategory.SYSTEM,
2716
2716
  text: "Observability storage is not initialized"