@mastra/mongodb 1.23.1-alpha.0 → 1.23.1

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.
@@ -20,9 +20,16 @@ export declare class MongoDBConnector {
20
20
  getCollection(collectionName: string): Promise<import("mongodb").Collection<import("mongodb").Document>>;
21
21
  collectionExists(collectionName: string): Promise<boolean>;
22
22
  /**
23
- * Returns true when the deployment supports multi-document transactions
24
- * (replica set or sharded cluster). Standalone servers and custom connector
25
- * handlers return false. Probed once and cached.
23
+ * Whether the deployment supports multi-document transactions (replica set
24
+ * or sharded cluster). Standalone servers and custom connector handlers
25
+ * don't. The answer is cached once a probe completes; a probe that fails
26
+ * rejects and is retried on the next call, so the answer never changes.
27
+ */
28
+ probeTransactions(): Promise<boolean>;
29
+ /**
30
+ * Like {@link probeTransactions}, but a failed probe reads as no
31
+ * transaction support (and is retried on the next call), so a momentary
32
+ * outage degrades writes to non-atomic instead of failing them.
26
33
  */
27
34
  supportsTransactions(): Promise<boolean>;
28
35
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"MongoDBConnector.d.ts","sourceRoot":"","sources":["../../../src/storage/connectors/MongoDBConnector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,KAAK,EAAE,aAAa,EAAM,MAAM,SAAS,CAAC;AAEjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAE/C,KAAK,uBAAuB,GACxB;IACE,MAAM,EAAE,WAAW,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,SAAS,CAAC;CACpB,GACD;IACE,MAAM,EAAE,SAAS,CAAC;IAClB,MAAM,EAAE,SAAS,CAAC;IAClB,OAAO,EAAE,gBAAgB,CAAC;CAC3B,CAAC;AAEN,qBAAa,gBAAgB;;IAQ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CAyBlE;IAED,MAAM,CAAC,qBAAqB,CAAC,OAAO,EAAE,gBAAgB,GAAG,gBAAgB,CAMxE;YAEa,aAAa;IAcrB,aAAa,CAAC,cAAc,EAAE,MAAM,qEAMzC;IAEK,gBAAgB,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAM/D;IAED;;;;;OAKG;IACG,iBAAiB,IAAI,OAAO,CAAC,OAAO,CAAC,CAa1C;IAED;;;;OAIG;IACG,oBAAoB,IAAI,OAAO,CAAC,OAAO,CAAC,CAM7C;IAED;;;;;OAKG;IACG,eAAe,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,aAAa,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAehF;IAEK,KAAK,kBAUV;CACF"}
@@ -2,7 +2,7 @@ import { type UpdateActiveObservationsResult, type UpdateBufferedObservationsRes
2
2
  import type { MastraMessageContentV2 } from '@mastra/core/agent';
3
3
  import type { MastraDBMessage, StorageThreadType } from '@mastra/core/memory';
4
4
  import { MemoryStorage } from '@mastra/core/storage';
5
- import type { PruneOptions, PruneResult, RetentionTablesDescriptor, TableRetentionPolicy, StorageResourceType, StorageListMessagesInput, StorageListMessagesByResourceIdInput, StorageListMessagesOutput, StorageListThreadsInput, StorageListThreadsOutput, StorageCloneThreadInput, StorageCloneThreadOutput, ObservationalMemoryRecord, ObservationalMemoryHistoryOptions, CreateObservationalMemoryInput, UpdateActiveObservationsInput, UpdateBufferedObservationsInput, SwapBufferedToActiveInput, SwapBufferedToActiveResult, UpdateBufferedReflectionInput, SwapBufferedReflectionToActiveInput, CreateReflectionGenerationInput, UpdateObservationalMemoryConfigInput } from '@mastra/core/storage';
5
+ import type { PruneOptions, PruneResult, RetentionTablesDescriptor, TableRetentionPolicy, StorageResourceType, StorageListMessagesInput, StorageListMessagesByResourceIdInput, StorageListMessagesOutput, StorageListThreadsInput, StorageListThreadsOutput, StorageCloneThreadInput, StorageCloneThreadOutput, ObservationalMemoryRecord, ObservationalMemoryHistoryOptions, CreateObservationalMemoryInput, UpdateActiveObservationsInput, UpdateBufferedObservationsInput, SwapBufferedToActiveInput, SwapBufferedToActiveResult, UpdateBufferedReflectionInput, SwapBufferedReflectionToActiveInput, CreateReflectionGenerationInput, UpdateObservationalMemoryConfigInput, RunFence } from '@mastra/core/storage';
6
6
  import type { MongoDBDomainConfig, MongoDBIndexConfig } from '../../types.js';
7
7
  export declare class MemoryStorageMongoDB extends MemoryStorage {
8
8
  #private;
@@ -10,21 +10,31 @@ export declare class MemoryStorageMongoDB extends MemoryStorage {
10
10
  readonly supportsObservationalMemory = true;
11
11
  readonly supportsObservationalMemoryHistorySearch = true;
12
12
  /** Collections managed by this domain */
13
- static readonly MANAGED_COLLECTIONS: readonly ["mastra_threads", "mastra_messages", "mastra_resources", "mastra_observational_memory"];
13
+ static readonly MANAGED_COLLECTIONS: readonly ["mastra_threads", "mastra_messages", "mastra_resources", "mastra_observational_memory", "mastra_memory_run_fences"];
14
14
  /**
15
15
  * Retention-eligible collections. The observational-memory collection is
16
16
  * excluded: it has no timestamp anchor to age on. All anchors are BSON dates.
17
+ * A run fence's `retiredAt` stays null until the execution holding it
18
+ * settles, and null is never pruned.
17
19
  */
18
20
  static readonly retentionTables: RetentionTablesDescriptor;
19
21
  constructor(config: MongoDBDomainConfig);
20
22
  private getCollection;
21
23
  init(): Promise<void>;
24
+ /**
25
+ * Fenced writes need multi-document transactions, so only replica sets and
26
+ * sharded clusters fence. Rejects while the deployment can't be probed.
27
+ */
28
+ supportsRunFencing(): Promise<boolean>;
29
+ raiseRunFence(fence: RunFence): Promise<boolean>;
30
+ retireRunFence(fence: RunFence): Promise<boolean>;
22
31
  /**
23
32
  * Delete memory rows older than each table's `maxAge`, batched. Order is
24
33
  * messages → resources → threads so child rows never outlive the delete of
25
- * their thread. Like `deleteThread()`, this does not sweep vector-store
26
- * embeddings — semantic-recall vectors live in a separate vector store the
27
- * memory domain cannot reach; cleaning those up is the operator's concern.
34
+ * their thread; run fences are independent and go last. Like
35
+ * `deleteThread()`, this does not sweep vector-store embeddings —
36
+ * semantic-recall vectors live in a separate vector store the memory domain
37
+ * cannot reach; cleaning those up is the operator's concern.
28
38
  */
29
39
  prune(policies: Record<string, TableRetentionPolicy>, options?: PruneOptions): Promise<PruneResult[]>;
30
40
  /**
@@ -57,12 +67,13 @@ export declare class MemoryStorageMongoDB extends MemoryStorage {
57
67
  }>;
58
68
  listMessages(args: StorageListMessagesInput): Promise<StorageListMessagesOutput>;
59
69
  listMessagesByResourceId(args: StorageListMessagesByResourceIdInput): Promise<StorageListMessagesOutput>;
60
- saveMessages({ messages }: {
70
+ saveMessages({ messages, fence, }: {
61
71
  messages: MastraDBMessage[];
72
+ fence?: RunFence;
62
73
  }): Promise<{
63
74
  messages: MastraDBMessage[];
64
75
  }>;
65
- updateMessages({ messages, }: {
76
+ updateMessages({ messages, fence, }: {
66
77
  messages: (Partial<Omit<MastraDBMessage, 'createdAt'>> & {
67
78
  id: string;
68
79
  content?: {
@@ -70,6 +81,7 @@ export declare class MemoryStorageMongoDB extends MemoryStorage {
70
81
  content?: MastraMessageContentV2['content'];
71
82
  };
72
83
  })[];
84
+ fence?: RunFence;
73
85
  }): Promise<MastraDBMessage[]>;
74
86
  getResourceById({ resourceId }: {
75
87
  resourceId: string;
@@ -77,28 +89,33 @@ export declare class MemoryStorageMongoDB extends MemoryStorage {
77
89
  saveResource({ resource }: {
78
90
  resource: StorageResourceType;
79
91
  }): Promise<StorageResourceType>;
80
- updateResource({ resourceId, workingMemory, metadata, }: {
92
+ updateResource({ resourceId, workingMemory, metadata, fence, }: {
81
93
  resourceId: string;
82
94
  workingMemory?: string;
83
95
  metadata?: Record<string, unknown>;
96
+ fence?: RunFence;
84
97
  }): Promise<StorageResourceType>;
85
98
  getThreadById({ threadId, resourceId, }: {
86
99
  threadId: string;
87
100
  resourceId?: string;
88
101
  }): Promise<StorageThreadType | null>;
89
102
  listThreads(args: StorageListThreadsInput): Promise<StorageListThreadsOutput>;
90
- saveThread({ thread }: {
103
+ saveThread({ thread, fence }: {
91
104
  thread: StorageThreadType;
105
+ fence?: RunFence;
92
106
  }): Promise<StorageThreadType>;
93
- updateThread({ id, title, metadata, }: {
107
+ updateThread({ id, title, metadata, fence, }: {
94
108
  id: string;
95
109
  title?: string;
96
110
  metadata?: Record<string, unknown>;
111
+ fence?: RunFence;
97
112
  }): Promise<StorageThreadType>;
98
113
  deleteThread({ threadId }: {
99
114
  threadId: string;
100
115
  }): Promise<void>;
101
- deleteMessages(messageIds: string[]): Promise<void>;
116
+ deleteMessages(messageIds: string[], options?: {
117
+ fence?: RunFence;
118
+ }): Promise<void>;
102
119
  cloneThread(args: StorageCloneThreadInput): Promise<StorageCloneThreadOutput>;
103
120
  private getOMKey;
104
121
  private parseOMDocument;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/memory/index.ts"],"names":[],"mappings":"AACA,OAAO,EAML,KAAK,8BAA8B,EACnC,KAAK,gCAAgC,EACtC,MAAM,uBAAuB,CAAC;AAG/B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAEjE,OAAO,KAAK,EAAmB,eAAe,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC/F,OAAO,EAEL,aAAa,EASd,MAAM,sBAAsB,CAAC;AAQ9B,OAAO,KAAK,EACV,YAAY,EACZ,WAAW,EACX,yBAAyB,EACzB,oBAAoB,EACpB,mBAAmB,EACnB,wBAAwB,EACxB,oCAAoC,EACpC,yBAAyB,EACzB,uBAAuB,EACvB,wBAAwB,EACxB,uBAAuB,EACvB,wBAAwB,EAExB,yBAAyB,EACzB,iCAAiC,EAEjC,8BAA8B,EAC9B,6BAA6B,EAC7B,+BAA+B,EAC/B,yBAAyB,EACzB,0BAA0B,EAC1B,6BAA6B,EAC7B,mCAAmC,EACnC,+BAA+B,EAC/B,o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OAAO,CAAC,IAAI,CAAC,CAEtF;IAEK,0BAA0B,CAAC,KAAK,EAAE,+BAA+B,GAAG,OAAO,CAAC,gCAAgC,CAAC,CAgIlH;IAEK,oBAAoB,CAAC,KAAK,EAAE,yBAAyB,GAAG,OAAO,CAAC,0BAA0B,CAAC,CA2MhG;IAEK,wBAAwB,CAAC,KAAK,EAAE,6BAA6B,GAAG,OAAO,CAAC,IAAI,CAAC,CAmElF;IAEK,8BAA8B,CAAC,KAAK,EAAE,mCAAmC,GAAG,OAAO,CAAC,yBAAyB,CAAC,CA2DnH;CA6LF"}
@@ -0,0 +1,39 @@
1
+ import type { RunFence } from '@mastra/core/storage';
2
+ import type { ClientSession, Collection } from 'mongodb';
3
+ import type { MongoDBConnector } from '../connectors/MongoDBConnector.js';
4
+ /** A write's fence, and the collection holding the run's current claim to check it against. */
5
+ export interface RunFenceCheck {
6
+ claims: string;
7
+ fence: RunFence;
8
+ operation: string;
9
+ }
10
+ /**
11
+ * A run's claim: its ownership document (workflows) or raised fence (memory),
12
+ * keyed by runId.
13
+ */
14
+ export interface RunClaimDocument {
15
+ _id: string;
16
+ generation: number;
17
+ ownerId: string;
18
+ leaseExpiresAt?: Date | null;
19
+ updatedAt?: Date;
20
+ retiredAt?: Date | null;
21
+ fencedWrites?: number;
22
+ }
23
+ export declare function getRunClaims(connector: MongoDBConnector, name: string): Promise<Collection<RunClaimDocument>>;
24
+ /** Duplicate-key error: an upsert lost the race to insert the document. */
25
+ export declare function isDuplicateKeyError(error: unknown): boolean;
26
+ /**
27
+ * Runs a write, fenced when `check` is set. A fenced write runs in a
28
+ * transaction that first updates the run's claim document, matching it on
29
+ * the fence. A fence that is no longer current matches nothing, and the write
30
+ * throws `RunFenceConflictError` before anything is written. A claim that
31
+ * changes while the transaction runs makes the update conflict, so the
32
+ * transaction retries and sees the new claim; a claim attempted after the
33
+ * update waits until the transaction commits. Updating the claim document,
34
+ * rather than reading it, is what makes concurrent claims conflict.
35
+ *
36
+ * Fencing is declared only on deployments that support transactions.
37
+ */
38
+ export declare function withRunFence<T>(connector: MongoDBConnector, check: RunFenceCheck | undefined, write: (session?: ClientSession) => Promise<T>): Promise<T>;
39
+ //# sourceMappingURL=run-fencing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run-fencing.d.ts","sourceRoot":"","sources":["../../../src/storage/domains/run-fencing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAEvE,+FAA+F;AAC/F,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,QAAQ,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IAC7B,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,SAAS,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,wBAAsB,YAAY,CAAC,SAAS,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC,CAGnH;AAED,2EAA2E;AAC3E,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAE3D;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,YAAY,CAAC,CAAC,EAClC,SAAS,EAAE,gBAAgB,EAC3B,KAAK,EAAE,aAAa,GAAG,SAAS,EAChC,KAAK,EAAE,CAAC,OAAO,CAAC,EAAE,aAAa,KAAK,OAAO,CAAC,CAAC,CAAC,GAC7C,OAAO,CAAC,CAAC,CAAC,CAaZ"}
@@ -1,22 +1,35 @@
1
1
  import { WorkflowsStorage } from '@mastra/core/storage';
2
- import type { PruneOptions, PruneResult, RetentionTablesDescriptor, TableRetentionPolicy, WorkflowRun, WorkflowRuns, StorageListWorkflowRunsInput, UpdateWorkflowStateOptions } from '@mastra/core/storage';
2
+ import type { ClaimRunOwnershipInput, ClaimRunOwnershipResult, PruneOptions, PruneResult, RenewRunOwnershipInput, RenewRunOwnershipResult, RetentionTablesDescriptor, RunFence, RunOwnershipRecord, TableRetentionPolicy, WorkflowRun, WorkflowRuns, StorageListWorkflowRunsInput, UpdateWorkflowStateOptions } from '@mastra/core/storage';
3
3
  import type { StepResult, WorkflowRunState } from '@mastra/core/workflows';
4
4
  import type { MongoDBDomainConfig, MongoDBIndexConfig } from '../../types.js';
5
5
  export declare class WorkflowsStorageMongoDB extends WorkflowsStorage {
6
6
  #private;
7
7
  /** Collections managed by this domain */
8
- static readonly MANAGED_COLLECTIONS: readonly ["mastra_workflow_snapshot"];
8
+ static readonly MANAGED_COLLECTIONS: readonly ["mastra_workflow_snapshot", "mastra_workflow_run_owners"];
9
9
  /**
10
- * Anchor is `updatedAt` (BSON date), so the policy reads as inactivity:
11
- * a run is pruned only after its snapshot has not been touched for `maxAge`.
10
+ * Both anchors are `updatedAt` (BSON date), so the policies read as
11
+ * inactivity: a run is pruned only after its snapshot has not been touched
12
+ * for `maxAge`, and an ownership document only after no claim, renewal or
13
+ * release has touched it for `maxAge`.
12
14
  */
13
15
  static readonly retentionTables: RetentionTablesDescriptor;
14
16
  constructor(config: MongoDBDomainConfig);
15
- /** Delete workflow snapshots idle for longer than the policy's `maxAge`, batched. */
17
+ /** Delete workflow snapshots and ownership documents idle for longer than each policy's `maxAge`, batched. */
16
18
  prune(policies: Record<string, TableRetentionPolicy>, options?: PruneOptions): Promise<PruneResult[]>;
17
19
  supportsConcurrentUpdates(): boolean;
20
+ /**
21
+ * Fenced writes need multi-document transactions, so only replica sets and
22
+ * sharded clusters fence. Rejects while the deployment can't be probed.
23
+ */
24
+ supportsRunFencing(): Promise<boolean>;
18
25
  private getCollection;
19
26
  init(): Promise<void>;
27
+ claimRunOwnership({ runId, ownerId, leaseMs, force, expectedGeneration, }: ClaimRunOwnershipInput): Promise<ClaimRunOwnershipResult>;
28
+ renewRunOwnership({ leaseMs, ...fence }: RenewRunOwnershipInput): Promise<RenewRunOwnershipResult>;
29
+ releaseRunOwnership(fence: RunFence): Promise<boolean>;
30
+ getRunOwnership({ runId }: {
31
+ runId: string;
32
+ }): Promise<RunOwnershipRecord | null>;
20
33
  /**
21
34
  * Returns default index definitions for the workflows domain collections.
22
35
  */
@@ -30,26 +43,29 @@ export declare class WorkflowsStorageMongoDB extends WorkflowsStorage {
30
43
  */
31
44
  createCustomIndexes(): Promise<void>;
32
45
  dangerouslyClearAll(): Promise<void>;
33
- updateWorkflowResults({ workflowName, runId, stepId, result, requestContext, state, }: {
46
+ updateWorkflowResults({ workflowName, runId, stepId, result, requestContext, state, fence, }: {
34
47
  workflowName: string;
35
48
  runId: string;
36
49
  stepId: string;
37
50
  result: StepResult<any, any, any, any>;
38
51
  requestContext: Record<string, any>;
39
52
  state?: Record<string, any>;
53
+ fence?: RunFence;
40
54
  }): Promise<Record<string, StepResult<any, any, any, any>>>;
41
- updateWorkflowState({ workflowName, runId, opts, }: {
55
+ updateWorkflowState({ workflowName, runId, opts, fence, }: {
42
56
  workflowName: string;
43
57
  runId: string;
44
58
  opts: UpdateWorkflowStateOptions;
59
+ fence?: RunFence;
45
60
  }): Promise<WorkflowRunState | undefined>;
46
- persistWorkflowSnapshot({ workflowName, runId, resourceId, snapshot, createdAt, updatedAt, }: {
61
+ persistWorkflowSnapshot({ workflowName, runId, resourceId, snapshot, createdAt, updatedAt, fence, }: {
47
62
  workflowName: string;
48
63
  runId: string;
49
64
  resourceId?: string;
50
65
  snapshot: WorkflowRunState;
51
66
  createdAt?: Date;
52
67
  updatedAt?: Date;
68
+ fence?: RunFence;
53
69
  }): Promise<void>;
54
70
  loadWorkflowSnapshot({ workflowName, runId, }: {
55
71
  workflowName: string;
@@ -60,9 +76,10 @@ export declare class WorkflowsStorageMongoDB extends WorkflowsStorage {
60
76
  runId: string;
61
77
  workflowName?: string;
62
78
  }): Promise<WorkflowRun | null>;
63
- deleteWorkflowRunById({ runId, workflowName }: {
79
+ deleteWorkflowRunById({ runId, workflowName, fence, }: {
64
80
  runId: string;
65
81
  workflowName: string;
82
+ fence?: RunFence;
66
83
  }): Promise<void>;
67
84
  private parseWorkflowRun;
68
85
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/workflows/index.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,gBAAgB,EAIjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EACV,YAAY,EACZ,WAAW,EACX,yBAAyB,EACzB,oBAAoB,EACpB,WAAW,EACX,YAAY,EACZ,4BAA4B,EAC5B,0BAA0B,EAC3B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAI3E,OAAO,KAAK,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAE3E,qBAAa,uBAAwB,SAAQ,gBAAgB;;IAK3D,yCAAyC;IACzC,MAAM,CAAC,QAAQ,CAAC,mBAAmB,wCAAsC;IAEzE;;;OAGG;IACH,gBAAyB,eAAe,EAAE,yBAAyB,CAEjE;IAEF,YAAY,MAAM,EAAE,mBAAmB,EAQtC;IAED,qFAAqF;IAC/E,KAAK,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAO1G;IAED,yBAAyB,IAAI,OAAO,CAEn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,CAmChB;IAEK,oBAAoB,CAAC,EACzB,YAAY,EACZ,KAAK,GACN,EAAE;QACD,YAAY,EAAE,MAAM,CAAC;QACrB,KAAK,EAAE,MAAM,CAAC;KACf,GAAG,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAwBnC;IAEK,gBAAgB,CAAC,IAAI,CAAC,EAAE,4BAA4B,GAAG,OAAO,CAAC,YAAY,CAAC,CA2EjF;IAEK,kBAAkB,CAAC,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CA4BpG;IAEK,qBAAqB,CAAC,EAC1B,KAAK,EACL,YAAY,EACZ,KAAK,GACN,EAAE;QACD,KAAK,EAAE,MAAM,CAAC;QACd,YAAY,EAAE,MAAM,CAAC;QACrB,KAAK,CAAC,EAAE,QAAQ,CAAC;KAClB,GAAG,OAAO,CAAC,IAAI,CAAC,CAmBhB;IAED,OAAO,CAAC,gBAAgB;CAoBzB"}
@@ -1,4 +1,4 @@
1
- import type { TABLE_NAMES, PruneOptions, PruneResult, TableRetentionPolicy } from '@mastra/core/storage';
1
+ import type { TABLE_MEMORY_RUN_FENCES, TABLE_NAMES, TABLE_WORKFLOW_RUN_OWNERS, PruneOptions, PruneResult, TableRetentionPolicy } from '@mastra/core/storage';
2
2
  import type { MongoDBConnector } from './connectors/MongoDBConnector.js';
3
3
  export declare const DEFAULT_PRUNE_BATCH_SIZE = 1000;
4
4
  /**
@@ -12,10 +12,12 @@ export declare const DEFAULT_PRUNE_BATCH_SIZE = 1000;
12
12
  * - `epoch-ms`: a raw millisecond number, e.g. `schedule_triggers.actual_fire_at`.
13
13
  */
14
14
  export type AnchorEncoding = 'date' | 'iso' | 'epoch-ms';
15
+ /** Collections `prune()` can target: the core tables plus the run fencing collections. */
16
+ export type PrunableTable = TABLE_NAMES | typeof TABLE_WORKFLOW_RUN_OWNERS | typeof TABLE_MEMORY_RUN_FENCES;
15
17
  /** One collection to prune, resolved from a policy + the domain's descriptor. */
16
18
  export interface PruneTarget {
17
19
  /** Physical collection name. */
18
- table: TABLE_NAMES;
20
+ table: PrunableTable;
19
21
  /** Anchor field for the age comparison. */
20
22
  column: string;
21
23
  /** Stored representation of the anchor field (decides the cutoff's type). */
@@ -47,12 +49,14 @@ export declare function cutoffFor(policy: TableRetentionPolicy, encoding: Anchor
47
49
  * Delete up to `limit` documents whose anchor field is older than `cutoff`.
48
50
  *
49
51
  * `deleteMany` has no limit clause, so each batch first collects `_id`s with a
50
- * bounded `find`, then deletes exactly that set — the Mongo equivalent of the
51
- * SQL stores' `DELETE ... WHERE rowid/ctid IN (SELECT ... LIMIT n)` pattern.
52
+ * bounded `find`, then deletes that set — the Mongo equivalent of the SQL
53
+ * stores' `DELETE ... WHERE rowid/ctid IN (SELECT ... LIMIT n)` pattern. The
54
+ * delete re-checks the anchor, so a document updated after the `find` (a
55
+ * renewed run ownership, a touched snapshot) survives.
52
56
  */
53
57
  export declare function pruneCollectionBatch({ connector, table, column, cutoff, limit, }: {
54
58
  connector: MongoDBConnector;
55
- table: TABLE_NAMES;
59
+ table: PrunableTable;
56
60
  column: string;
57
61
  cutoff: Date | string | number;
58
62
  limit: number;
@@ -1 +1 @@
1
- {"version":3,"file":"retention.d.ts","sourceRoot":"","sources":["../../src/storage/retention.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAEzG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEtE,eAAO,MAAM,wBAAwB,OAAO,CAAC;AAE7C;;;;;;;;;GASG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,KAAK,GAAG,UAAU,CAAC;AAEzD,iFAAiF;AACjF,MAAM,WAAW,WAAW;IAC1B,gCAAgC;IAChC,KAAK,EAAE,WA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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/mongodb",
3
- "version": "1.23.1-alpha.0",
3
+ "version": "1.23.1",
4
4
  "description": "MongoDB provider for Mastra - includes vector store capabilities",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -32,15 +32,15 @@
32
32
  "tsx": "^4.23.1",
33
33
  "typescript": "^7.0.2",
34
34
  "vitest": "4.1.11",
35
+ "@internal/lint": "0.0.143",
35
36
  "@internal/core": "0.1.2",
36
- "@internal/lint": "0.0.142",
37
- "@internal/storage-test-utils": "0.0.138",
38
- "@internal/types-builder": "0.0.117",
39
- "@mastra/memory": "1.37.1-alpha.0",
40
- "@mastra/core": "1.77.0-alpha.0"
37
+ "@mastra/core": "1.77.0",
38
+ "@internal/storage-test-utils": "0.0.139",
39
+ "@internal/types-builder": "0.0.118",
40
+ "@mastra/memory": "1.37.1"
41
41
  },
42
42
  "peerDependencies": {
43
- "@mastra/core": ">=1.68.0-0 <2.0.0-0"
43
+ "@mastra/core": ">=1.76.0-0 <2.0.0-0"
44
44
  },
45
45
  "files": [
46
46
  "dist"
@@ -63,7 +63,7 @@
63
63
  "pretest": "docker compose up -d --wait || (echo '--- docker compose up failed; dumping diagnostics ---' && docker compose ps -a && docker compose logs && df -h && exit 1)",
64
64
  "test": "vitest run && pnpm test:fidelity",
65
65
  "pretest:fidelity": "docker compose --profile fidelity up -d --wait mongodb-fidelity",
66
- "test:fidelity": "MONGODB_REPLICA_SET_URL='mongodb://localhost:27019/?directConnection=true' vitest run src/storage/dataset-fidelity.test.ts",
66
+ "test:fidelity": "MONGODB_REPLICA_SET_URL='mongodb://localhost:27019/?directConnection=true' vitest run src/storage/dataset-fidelity.test.ts src/storage/run-fencing.test.ts",
67
67
  "posttest:fidelity": "docker compose --profile fidelity stop mongodb-fidelity",
68
68
  "posttest": "docker compose down -v",
69
69
  "pretest:watch": "docker compose up -d",