@mastra/mongodb 1.28.0-alpha.2 → 1.28.0-alpha.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.
@@ -305,6 +305,16 @@ export declare function legacyKnowledgeTablesToDrop(snapshot: {
305
305
  }): string[];
306
306
  /** Message for the error an adapter throws on `incompatible-reset-required`. */
307
307
  export declare function knowledgePagesResetMessage(reason: string): string;
308
+ /**
309
+ * A list cursor the store cannot decode (malformed, or from another store or version). Defined
310
+ * here so every adapter can throw it on any core version; core re-exports it from
311
+ * `@mastra/core/storage`. Recognise it by `name`.
312
+ * @experimental
313
+ */
314
+ export declare class KnowledgeInvalidCursorError extends Error {
315
+ readonly cursor: string;
316
+ constructor(cursor: string);
317
+ }
308
318
  /**
309
319
  * The page-store runtime pieces adapters take from `@mastra/core/storage`. They are loaded through
310
320
  * `createKnowledgePagesCoreLoader` instead of static imports so adapters keep loading on cores
@@ -3,7 +3,7 @@ name: mastra-mongodb
3
3
  description: Documentation for @mastra/mongodb. Use when working with @mastra/mongodb APIs, configuration, or implementation.
4
4
  metadata:
5
5
  package: "@mastra/mongodb"
6
- version: "1.28.0-alpha.2"
6
+ version: "1.28.0-alpha.4"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,76 +1,76 @@
1
1
  {
2
- "version": "1.28.0-alpha.2",
2
+ "version": "1.28.0-alpha.4",
3
3
  "package": "@mastra/mongodb",
4
4
  "exports": {
5
5
  "BackgroundTasksStorageMongoDB": {
6
6
  "types": "dist/storage/domains/background-tasks/index.d.ts",
7
7
  "implementation": "dist/index.js",
8
- "line": 4690
8
+ "line": 4692
9
9
  },
10
10
  "KnowledgeMongoDB": {
11
11
  "types": "dist/storage/domains/knowledge/index.d.ts",
12
12
  "implementation": "dist/index.js",
13
- "line": 9074
13
+ "line": 9090
14
14
  },
15
15
  "MONGODB_PROMPT": {
16
16
  "types": "dist/vector/prompt.d.ts",
17
17
  "implementation": "dist/index.js",
18
- "line": 16763
18
+ "line": 16779
19
19
  },
20
20
  "MemoryStorageMongoDB": {
21
21
  "types": "dist/storage/domains/memory/index.d.ts",
22
22
  "implementation": "dist/index.js",
23
- "line": 10341
23
+ "line": 10357
24
24
  },
25
25
  "MongoDBAgentsStorage": {
26
26
  "types": "dist/storage/domains/agents/index.d.ts",
27
27
  "implementation": "dist/index.js",
28
- "line": 3964
28
+ "line": 3966
29
29
  },
30
30
  "MongoDBBlobStore": {
31
31
  "types": "dist/storage/domains/blobs/index.d.ts",
32
32
  "implementation": "dist/index.js",
33
- "line": 4896
33
+ "line": 4898
34
34
  },
35
35
  "MongoDBDatasetsStorage": {
36
36
  "types": "dist/storage/domains/datasets/index.d.ts",
37
37
  "implementation": "dist/index.js",
38
- "line": 5075
38
+ "line": 5077
39
39
  },
40
40
  "MongoDBExperimentsStorage": {
41
41
  "types": "dist/storage/domains/experiments/index.d.ts",
42
42
  "implementation": "dist/index.js",
43
- "line": 6326
43
+ "line": 6328
44
44
  },
45
45
  "MongoDBMCPClientsStorage": {
46
46
  "types": "dist/storage/domains/mcp-clients/index.d.ts",
47
47
  "implementation": "dist/index.js",
48
- "line": 9228
48
+ "line": 9244
49
49
  },
50
50
  "MongoDBMCPServersStorage": {
51
51
  "types": "dist/storage/domains/mcp-servers/index.d.ts",
52
52
  "implementation": "dist/index.js",
53
- "line": 9681
53
+ "line": 9697
54
54
  },
55
55
  "MongoDBPromptBlocksStorage": {
56
56
  "types": "dist/storage/domains/prompt-blocks/index.d.ts",
57
57
  "implementation": "dist/index.js",
58
- "line": 13433
58
+ "line": 13449
59
59
  },
60
60
  "MongoDBScorerDefinitionsStorage": {
61
61
  "types": "dist/storage/domains/scorer-definitions/index.d.ts",
62
62
  "implementation": "dist/index.js",
63
- "line": 14143
63
+ "line": 14159
64
64
  },
65
65
  "MongoDBSkillsStorage": {
66
66
  "types": "dist/storage/domains/skills/index.d.ts",
67
67
  "implementation": "dist/index.js",
68
- "line": 14973
68
+ "line": 14989
69
69
  },
70
70
  "MongoDBStore": {
71
71
  "types": "dist/storage/index.d.ts",
72
72
  "implementation": "dist/index.js",
73
- "line": 16684
73
+ "line": 16700
74
74
  },
75
75
  "MongoDBVector": {
76
76
  "types": "dist/vector/index.d.ts",
@@ -80,37 +80,37 @@
80
80
  "MongoDBWorkflowDefinitionsStore": {
81
81
  "types": "dist/storage/domains/workflow-definitions/index.d.ts",
82
82
  "implementation": "dist/index.js",
83
- "line": 15474
83
+ "line": 15490
84
84
  },
85
85
  "MongoDBWorkspacesStorage": {
86
86
  "types": "dist/storage/domains/workspaces/index.d.ts",
87
87
  "implementation": "dist/index.js",
88
- "line": 16182
88
+ "line": 16198
89
89
  },
90
90
  "NotificationsMongoDB": {
91
91
  "types": "dist/storage/domains/notifications/index.d.ts",
92
92
  "implementation": "dist/index.js",
93
- "line": 12461
93
+ "line": 12477
94
94
  },
95
95
  "ObservabilityMongoDB": {
96
96
  "types": "dist/storage/domains/observability/index.d.ts",
97
97
  "implementation": "dist/index.js",
98
- "line": 12751
98
+ "line": 12767
99
99
  },
100
100
  "SchedulesMongoDB": {
101
101
  "types": "dist/storage/domains/schedules/index.d.ts",
102
102
  "implementation": "dist/index.js",
103
- "line": 13940
103
+ "line": 13956
104
104
  },
105
105
  "ScoresStorageMongoDB": {
106
106
  "types": "dist/storage/domains/scores/index.d.ts",
107
107
  "implementation": "dist/index.js",
108
- "line": 14592
108
+ "line": 14608
109
109
  },
110
110
  "WorkflowsStorageMongoDB": {
111
111
  "types": "dist/storage/domains/workflows/index.d.ts",
112
112
  "implementation": "dist/index.js",
113
- "line": 15644
113
+ "line": 15660
114
114
  }
115
115
  },
116
116
  "modules": {}
package/dist/index.cjs CHANGED
@@ -11,7 +11,7 @@ let _mastra_core_agent = require("@mastra/core/agent");
11
11
  let _mastra_core_evals = require("@mastra/core/evals");
12
12
  let _mastra_core_storage_domains_skills = require("@mastra/core/storage/domains/skills");
13
13
  // package.json
14
- var version = "1.28.0-alpha.2";
14
+ var version = "1.28.0-alpha.4";
15
15
  // src/vector/filter.ts
16
16
  /**
17
17
  * Translator for MongoDB filter queries.
@@ -2460,12 +2460,14 @@ var MongoDBVector = class MongoDBVector extends _mastra_core_vector.MastraVector
2460
2460
  const ours = sameName && previous?.ownsTextIndex || previous?.retiredTextIndexNames?.includes(name);
2461
2461
  const listedId = created.outcome === "attached" ? created.row?.id : void 0;
2462
2462
  const recordedId = ours ? (await this.readRegistryEntry(indexName))?.indexIds?.find((e) => e.name === name)?.id : void 0;
2463
- if (created.outcome === "owned") {} else if (listedId && listedId === recordedId) await this.runSearchIndexCommand({
2464
- updateSearchIndex: collection.collectionName,
2465
- id: listedId,
2466
- definition
2467
- });
2468
- else {
2463
+ if (created.outcome === "owned") {} else if (listedId && listedId === recordedId) {
2464
+ const row = created.outcome === "attached" ? created.row : void 0;
2465
+ if (!((row?.status === "PENDING" || row?.status === "BUILDING" || row?.status === "READY") && !!row.latestDefinition && searchDefinitionsEquivalent(row.latestDefinition, definition))) await this.runSearchIndexCommand({
2466
+ updateSearchIndex: collection.collectionName,
2467
+ id: listedId,
2468
+ definition
2469
+ });
2470
+ } else {
2469
2471
  if (ours) this.logger.warn(`search index "${name}" on "${collectionName}" is ${listedId ? `listed with id ${listedId}` : "not listed"} but recorded with ${recordedId ? `id ${recordedId}` : "no id"}; treated as not created by Mastra and not modified`);
2470
2472
  const [existing] = await this.listSearchIndexRows(collection, name, "P1");
2471
2473
  if (!searchDefinitionsEquivalent(existing?.latestDefinition, definition)) {
@@ -7076,6 +7078,20 @@ function legacyKnowledgeTablesToDrop(snapshot) {
7076
7078
  function knowledgePagesResetMessage(reason) {
7077
7079
  return `Knowledge storage needs a reset before this version can use it: ${reason}. Knowledge data has no migration; run \`await storage.stores?.knowledge?.dangerouslyReset()\` to drop the Knowledge tables (Memory tables are untouched).`;
7078
7080
  }
7081
+ /**
7082
+ * A list cursor the store cannot decode (malformed, or from another store or version). Defined
7083
+ * here so every adapter can throw it on any core version; core re-exports it from
7084
+ * `@mastra/core/storage`. Recognise it by `name`.
7085
+ * @experimental
7086
+ */
7087
+ var KnowledgeInvalidCursorError = class extends Error {
7088
+ cursor;
7089
+ constructor(cursor) {
7090
+ super("Invalid Knowledge cursor: this store cannot decode it");
7091
+ this.cursor = cursor;
7092
+ this.name = "KnowledgeInvalidCursorError";
7093
+ }
7094
+ };
7079
7095
  const KNOWLEDGE_PAGES_CORE_FUNCTIONS = [
7080
7096
  "assertKnowledgePageDescriptionWithinBound",
7081
7097
  "assertKnowledgeNoteTextWithinBound",
@@ -7173,7 +7189,7 @@ function decodeCursor(cursor) {
7173
7189
  const parts = JSON.parse(Buffer.from(cursor, "base64url").toString("utf8"));
7174
7190
  if (Array.isArray(parts) && parts.length === 2 && parts.every((part) => typeof part === "string")) return parts;
7175
7191
  } catch {}
7176
- throw new Error("Invalid Knowledge cursor");
7192
+ throw new KnowledgeInvalidCursorError(cursor);
7177
7193
  }
7178
7194
  function clampLimit(limit, max) {
7179
7195
  const value = limit ?? DEFAULT_LIST_LIMIT;
package/dist/index.js CHANGED
@@ -10,7 +10,7 @@ import { MessageList } from "@mastra/core/agent";
10
10
  import { saveScorePayloadSchema } from "@mastra/core/evals";
11
11
  import { skillSnapshotFieldValuesEqual } from "@mastra/core/storage/domains/skills";
12
12
  // package.json
13
- var version = "1.28.0-alpha.2";
13
+ var version = "1.28.0-alpha.4";
14
14
  // src/vector/filter.ts
15
15
  /**
16
16
  * Translator for MongoDB filter queries.
@@ -2459,12 +2459,14 @@ var MongoDBVector = class MongoDBVector extends MastraVector {
2459
2459
  const ours = sameName && previous?.ownsTextIndex || previous?.retiredTextIndexNames?.includes(name);
2460
2460
  const listedId = created.outcome === "attached" ? created.row?.id : void 0;
2461
2461
  const recordedId = ours ? (await this.readRegistryEntry(indexName))?.indexIds?.find((e) => e.name === name)?.id : void 0;
2462
- if (created.outcome === "owned") {} else if (listedId && listedId === recordedId) await this.runSearchIndexCommand({
2463
- updateSearchIndex: collection.collectionName,
2464
- id: listedId,
2465
- definition
2466
- });
2467
- else {
2462
+ if (created.outcome === "owned") {} else if (listedId && listedId === recordedId) {
2463
+ const row = created.outcome === "attached" ? created.row : void 0;
2464
+ if (!((row?.status === "PENDING" || row?.status === "BUILDING" || row?.status === "READY") && !!row.latestDefinition && searchDefinitionsEquivalent(row.latestDefinition, definition))) await this.runSearchIndexCommand({
2465
+ updateSearchIndex: collection.collectionName,
2466
+ id: listedId,
2467
+ definition
2468
+ });
2469
+ } else {
2468
2470
  if (ours) this.logger.warn(`search index "${name}" on "${collectionName}" is ${listedId ? `listed with id ${listedId}` : "not listed"} but recorded with ${recordedId ? `id ${recordedId}` : "no id"}; treated as not created by Mastra and not modified`);
2469
2471
  const [existing] = await this.listSearchIndexRows(collection, name, "P1");
2470
2472
  if (!searchDefinitionsEquivalent(existing?.latestDefinition, definition)) {
@@ -7075,6 +7077,20 @@ function legacyKnowledgeTablesToDrop(snapshot) {
7075
7077
  function knowledgePagesResetMessage(reason) {
7076
7078
  return `Knowledge storage needs a reset before this version can use it: ${reason}. Knowledge data has no migration; run \`await storage.stores?.knowledge?.dangerouslyReset()\` to drop the Knowledge tables (Memory tables are untouched).`;
7077
7079
  }
7080
+ /**
7081
+ * A list cursor the store cannot decode (malformed, or from another store or version). Defined
7082
+ * here so every adapter can throw it on any core version; core re-exports it from
7083
+ * `@mastra/core/storage`. Recognise it by `name`.
7084
+ * @experimental
7085
+ */
7086
+ var KnowledgeInvalidCursorError = class extends Error {
7087
+ cursor;
7088
+ constructor(cursor) {
7089
+ super("Invalid Knowledge cursor: this store cannot decode it");
7090
+ this.cursor = cursor;
7091
+ this.name = "KnowledgeInvalidCursorError";
7092
+ }
7093
+ };
7078
7094
  const KNOWLEDGE_PAGES_CORE_FUNCTIONS = [
7079
7095
  "assertKnowledgePageDescriptionWithinBound",
7080
7096
  "assertKnowledgeNoteTextWithinBound",
@@ -7172,7 +7188,7 @@ function decodeCursor(cursor) {
7172
7188
  const parts = JSON.parse(Buffer.from(cursor, "base64url").toString("utf8"));
7173
7189
  if (Array.isArray(parts) && parts.length === 2 && parts.every((part) => typeof part === "string")) return parts;
7174
7190
  } catch {}
7175
- throw new Error("Invalid Knowledge cursor");
7191
+ throw new KnowledgeInvalidCursorError(cursor);
7176
7192
  }
7177
7193
  function clampLimit(limit, max) {
7178
7194
  const value = limit ?? DEFAULT_LIST_LIMIT;
@@ -8,6 +8,9 @@ export declare class KnowledgeMongoDB extends KnowledgeStorage {
8
8
  constructor(config: MongoDBDomainConfig);
9
9
  getCapabilities(): {
10
10
  readonly contractVersion: typeof import("@mastra/core/knowledge").KNOWLEDGE_STORAGE_CONTRACT_VERSION;
11
+ readonly supportsTransactions?: boolean;
12
+ readonly enforcesTransactionDeadline?: boolean;
13
+ readonly supportsActivityDateRange?: boolean;
11
14
  readonly schemaVersion: 4;
12
15
  readonly supportsSchemaInspection: true;
13
16
  readonly supportsExplicitReset: true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/mongodb",
3
- "version": "1.28.0-alpha.2",
3
+ "version": "1.28.0-alpha.4",
4
4
  "description": "MongoDB provider for Mastra - includes vector store capabilities",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -32,12 +32,12 @@
32
32
  "tsx": "^4.23.15",
33
33
  "typescript": "^7.0.2",
34
34
  "vitest": "5.1.0",
35
+ "@internal/core": "0.1.4",
35
36
  "@internal/lint": "0.0.151",
37
+ "@internal/storage-test-utils": "0.0.147",
36
38
  "@internal/types-builder": "0.0.126",
37
- "@internal/core": "0.1.4",
38
- "@mastra/core": "1.86.0-alpha.7",
39
- "@mastra/memory": "1.41.3-alpha.3",
40
- "@internal/storage-test-utils": "0.0.147"
39
+ "@mastra/core": "1.86.0-alpha.9",
40
+ "@mastra/memory": "1.41.3-alpha.5"
41
41
  },
42
42
  "peerDependencies": {
43
43
  "@mastra/core": ">=1.76.0-0 <2.0.0-0"