@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.
- package/.turbo/turbo-build.log +7 -7
- package/CHANGELOG.md +13 -0
- package/dist/_tsup-dts-rollup.d.cts +1 -0
- package/dist/_tsup-dts-rollup.d.ts +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
- package/src/storage/index.test.ts +15 -16
- package/src/storage/index.ts +3 -2
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
|
|
2
|
-
> @mastra/mongodb@0.10.1-alpha.
|
|
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
|
[34mCLI[39m Building entry: src/index.ts
|
|
6
6
|
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
7
7
|
[34mCLI[39m tsup v8.4.0
|
|
8
8
|
[34mTSC[39m Build start
|
|
9
|
-
[32mTSC[39m ⚡️ Build success in
|
|
9
|
+
[32mTSC[39m ⚡️ Build success in 9766ms
|
|
10
10
|
[34mDTS[39m Build start
|
|
11
11
|
[34mCLI[39m Target: es2022
|
|
12
12
|
Analysis will use the bundled TypeScript version 5.8.3
|
|
13
13
|
[36mWriting package typings: /home/runner/work/mastra/mastra/stores/mongodb/dist/_tsup-dts-rollup.d.ts[39m
|
|
14
14
|
Analysis will use the bundled TypeScript version 5.8.3
|
|
15
15
|
[36mWriting package typings: /home/runner/work/mastra/mastra/stores/mongodb/dist/_tsup-dts-rollup.d.cts[39m
|
|
16
|
-
[32mDTS[39m ⚡️ Build success in
|
|
16
|
+
[32mDTS[39m ⚡️ Build success in 12282ms
|
|
17
17
|
[34mCLI[39m Cleaning output folder
|
|
18
18
|
[34mESM[39m Build start
|
|
19
19
|
[34mCJS[39m Build start
|
|
20
|
-
[32mESM[39m [1mdist/index.js [22m[32m32.
|
|
21
|
-
[32mESM[39m ⚡️ Build success in
|
|
22
|
-
[32mCJS[39m [1mdist/index.cjs [22m[32m32.
|
|
23
|
-
[32mCJS[39m ⚡️ Build success in
|
|
20
|
+
[32mESM[39m [1mdist/index.js [22m[32m32.83 KB[39m
|
|
21
|
+
[32mESM[39m ⚡️ Build success in 1065ms
|
|
22
|
+
[32mCJS[39m [1mdist/index.cjs [22m[32m32.94 KB[39m
|
|
23
|
+
[32mCJS[39m ⚡️ 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
|
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.
|
|
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.
|
|
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
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
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
|
-
|
|
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?.
|
|
542
|
-
expect(secondSnapshot.context?.
|
|
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?.
|
|
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?.
|
|
634
|
-
expect(secondSnapshot.context?.
|
|
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?.
|
|
675
|
-
expect(secondSnapshot.context?.
|
|
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?.
|
|
682
|
+
expect(snapshot.context?.[stepId1]?.status).toBe('completed');
|
|
684
683
|
});
|
|
685
684
|
});
|
|
686
685
|
|
package/src/storage/index.ts
CHANGED
|
@@ -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> {
|