@mastra/mongodb 0.10.1-alpha.0 → 0.10.1-alpha.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.
@@ -1,23 +1,23 @@
1
1
 
2
- > @mastra/mongodb@0.10.1-alpha.0 build /home/runner/work/mastra/mastra/stores/mongodb
2
+ > @mastra/mongodb@0.10.1-alpha.1 build /home/runner/work/mastra/mastra/stores/mongodb
3
3
  > tsup src/index.ts --format esm,cjs --experimental-dts --clean --treeshake=smallest --splitting
4
4
 
5
5
  CLI Building entry: src/index.ts
6
6
  CLI Using tsconfig: tsconfig.json
7
7
  CLI tsup v8.4.0
8
8
  TSC Build start
9
- TSC ⚡️ Build success in 11126ms
9
+ TSC ⚡️ Build success in 9766ms
10
10
  DTS Build start
11
11
  CLI Target: es2022
12
12
  Analysis will use the bundled TypeScript version 5.8.3
13
13
  Writing package typings: /home/runner/work/mastra/mastra/stores/mongodb/dist/_tsup-dts-rollup.d.ts
14
14
  Analysis will use the bundled TypeScript version 5.8.3
15
15
  Writing package typings: /home/runner/work/mastra/mastra/stores/mongodb/dist/_tsup-dts-rollup.d.cts
16
- DTS ⚡️ Build success in 13746ms
16
+ DTS ⚡️ Build success in 12282ms
17
17
  CLI Cleaning output folder
18
18
  ESM Build start
19
19
  CJS Build start
20
- ESM dist/index.js 32.81 KB
21
- ESM ⚡️ Build success in 1273ms
22
- CJS dist/index.cjs 32.93 KB
23
- CJS ⚡️ Build success in 1273ms
20
+ ESM dist/index.js 32.83 KB
21
+ ESM ⚡️ Build success in 1065ms
22
+ CJS dist/index.cjs 32.94 KB
23
+ CJS ⚡️ Build success in 1092ms
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @mastra/mongodb
2
2
 
3
+ ## 0.10.1-alpha.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 4a8cd1c: MongoDBStore option support
8
+ - Updated dependencies [200d0da]
9
+ - Updated dependencies [bf5f17b]
10
+ - Updated dependencies [5343f93]
11
+ - Updated dependencies [38aee50]
12
+ - Updated dependencies [5c41100]
13
+ - Updated dependencies [d6a759b]
14
+ - @mastra/core@0.10.1-alpha.1
15
+
3
16
  ## 0.10.1-alpha.0
4
17
 
5
18
  ### Patch Changes
@@ -32,6 +32,7 @@ export { MONGODB_PROMPT as MONGODB_PROMPT_alias_1 }
32
32
  declare interface MongoDBConfig {
33
33
  url: string;
34
34
  dbName: string;
35
+ options?: MongoClientOptions;
35
36
  }
36
37
  export { MongoDBConfig }
37
38
  export { MongoDBConfig as MongoDBConfig_alias_1 }
@@ -32,6 +32,7 @@ export { MONGODB_PROMPT as MONGODB_PROMPT_alias_1 }
32
32
  declare interface MongoDBConfig {
33
33
  url: string;
34
34
  dbName: string;
35
+ options?: MongoClientOptions;
35
36
  }
36
37
  export { MongoDBConfig }
37
38
  export { MongoDBConfig as MongoDBConfig_alias_1 }
package/dist/index.cjs CHANGED
@@ -429,7 +429,7 @@ var MongoDBStore = class extends storage.MastraStorage {
429
429
  );
430
430
  }
431
431
  this.#dbName = config.dbName;
432
- this.#client = new mongodb.MongoClient(config.url);
432
+ this.#client = new mongodb.MongoClient(config.url, config.options);
433
433
  }
434
434
  async getConnection() {
435
435
  if (this.#isConnected) {
package/dist/index.js CHANGED
@@ -427,7 +427,7 @@ var MongoDBStore = class extends MastraStorage {
427
427
  );
428
428
  }
429
429
  this.#dbName = config.dbName;
430
- this.#client = new MongoClient(config.url);
430
+ this.#client = new MongoClient(config.url, config.options);
431
431
  }
432
432
  async getConnection() {
433
433
  if (this.#isConnected) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/mongodb",
3
- "version": "0.10.1-alpha.0",
3
+ "version": "0.10.1-alpha.1",
4
4
  "description": "MongoDB provider for Mastra - includes vector store capabilities",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -32,7 +32,7 @@
32
32
  "typescript": "^5.8.2",
33
33
  "vitest": "^3.1.2",
34
34
  "@internal/lint": "0.0.6",
35
- "@mastra/core": "0.10.1-alpha.0"
35
+ "@mastra/core": "0.10.1-alpha.1"
36
36
  },
37
37
  "peerDependencies": {
38
38
  "@mastra/core": "^0.10.0"
@@ -79,15 +79,14 @@ class Test {
79
79
  result: { success: true },
80
80
  value: {},
81
81
  context: {
82
- steps: {
83
- [stepId]: {
84
- status: options.status,
85
- payload: {},
86
- error: undefined,
87
- },
82
+ [stepId]: {
83
+ status: options.status,
84
+ payload: {},
85
+ error: undefined,
86
+ startedAt: timestamp.getTime(),
87
+ endedAt: new Date(timestamp.getTime() + 15000).getTime(),
88
88
  },
89
- triggerData: {},
90
- attempts: {},
89
+ input: {},
91
90
  },
92
91
  activePaths: [],
93
92
  suspendedPaths: {},
@@ -538,8 +537,8 @@ describe('MongoDBStore', () => {
538
537
  expect(runs[1]!.workflowName).toBe(workflowName1);
539
538
  const firstSnapshot = runs[0]!.snapshot as WorkflowRunState;
540
539
  const secondSnapshot = runs[1]!.snapshot as WorkflowRunState;
541
- expect(firstSnapshot.context?.steps[stepId2]?.status).toBe('running');
542
- expect(secondSnapshot.context?.steps[stepId1]?.status).toBe('completed');
540
+ expect(firstSnapshot.context?.[stepId2]?.status).toBe('running');
541
+ expect(secondSnapshot.context?.[stepId1]?.status).toBe('completed');
543
542
  });
544
543
 
545
544
  it('filters by workflow name', async () => {
@@ -564,7 +563,7 @@ describe('MongoDBStore', () => {
564
563
  expect(total).toBe(1);
565
564
  expect(runs[0]!.workflowName).toBe(workflowName1);
566
565
  const snapshot = runs[0]!.snapshot as WorkflowRunState;
567
- expect(snapshot.context?.steps[stepId1]?.status).toBe('completed');
566
+ expect(snapshot.context?.[stepId1]?.status).toBe('completed');
568
567
  });
569
568
 
570
569
  it('filters by date range', async () => {
@@ -630,8 +629,8 @@ describe('MongoDBStore', () => {
630
629
  expect(runs[1]!.workflowName).toBe(workflowName2);
631
630
  const firstSnapshot = runs[0]!.snapshot as WorkflowRunState;
632
631
  const secondSnapshot = runs[1]!.snapshot as WorkflowRunState;
633
- expect(firstSnapshot.context?.steps[stepId3]?.status).toBe('waiting');
634
- expect(secondSnapshot.context?.steps[stepId2]?.status).toBe('running');
632
+ expect(firstSnapshot.context?.[stepId3]?.status).toBe('waiting');
633
+ expect(secondSnapshot.context?.[stepId2]?.status).toBe('running');
635
634
  });
636
635
 
637
636
  it('handles pagination', async () => {
@@ -671,8 +670,8 @@ describe('MongoDBStore', () => {
671
670
  expect(page1.runs[1]!.workflowName).toBe(workflowName2);
672
671
  const firstSnapshot = page1.runs[0]!.snapshot as WorkflowRunState;
673
672
  const secondSnapshot = page1.runs[1]!.snapshot as WorkflowRunState;
674
- expect(firstSnapshot.context?.steps[stepId3]?.status).toBe('waiting');
675
- expect(secondSnapshot.context?.steps[stepId2]?.status).toBe('running');
673
+ expect(firstSnapshot.context?.[stepId3]?.status).toBe('waiting');
674
+ expect(secondSnapshot.context?.[stepId2]?.status).toBe('running');
676
675
 
677
676
  // Get second page
678
677
  const page2 = await store.getWorkflowRuns({ limit: 2, offset: 2 });
@@ -680,7 +679,7 @@ describe('MongoDBStore', () => {
680
679
  expect(page2.total).toBe(3);
681
680
  expect(page2.runs[0]!.workflowName).toBe(workflowName1);
682
681
  const snapshot = page2.runs[0]!.snapshot as WorkflowRunState;
683
- expect(snapshot.context?.steps[stepId1]?.status).toBe('completed');
682
+ expect(snapshot.context?.[stepId1]?.status).toBe('completed');
684
683
  });
685
684
  });
686
685
 
@@ -10,7 +10,7 @@ import {
10
10
  TABLE_WORKFLOW_SNAPSHOT,
11
11
  } from '@mastra/core/storage';
12
12
  import type { WorkflowRunState } from '@mastra/core/workflows';
13
- import type { Db } from 'mongodb';
13
+ import type { Db, MongoClientOptions } from 'mongodb';
14
14
  import { MongoClient } from 'mongodb';
15
15
 
16
16
  function safelyParseJSON(jsonString: string): any {
@@ -24,6 +24,7 @@ function safelyParseJSON(jsonString: string): any {
24
24
  export interface MongoDBConfig {
25
25
  url: string;
26
26
  dbName: string;
27
+ options?: MongoClientOptions;
27
28
  }
28
29
 
29
30
  export class MongoDBStore extends MastraStorage {
@@ -49,7 +50,7 @@ export class MongoDBStore extends MastraStorage {
49
50
  }
50
51
 
51
52
  this.#dbName = config.dbName;
52
- this.#client = new MongoClient(config.url);
53
+ this.#client = new MongoClient(config.url, config.options);
53
54
  }
54
55
 
55
56
  private async getConnection(): Promise<Db> {