@mastra/pg 0.10.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 +17 -0
- package/dist/_tsup-dts-rollup.d.cts +3 -3
- package/dist/_tsup-dts-rollup.d.ts +3 -3
- package/dist/index.cjs +2 -1
- package/dist/index.js +2 -1
- package/package.json +4 -4
- package/src/storage/index.test.ts +2 -0
- package/src/storage/index.ts +5 -3
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
|
|
2
|
-
> @mastra/pg@0.10.
|
|
2
|
+
> @mastra/pg@0.10.1-alpha.1 build /home/runner/work/mastra/mastra/stores/pg
|
|
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 11415ms
|
|
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/pg/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/pg/dist/_tsup-dts-rollup.d.cts[39m
|
|
16
|
-
[32mDTS[39m ⚡️ Build success in
|
|
16
|
+
[32mDTS[39m ⚡️ Build success in 11422ms
|
|
17
17
|
[34mCLI[39m Cleaning output folder
|
|
18
18
|
[34mESM[39m Build start
|
|
19
19
|
[34mCJS[39m Build start
|
|
20
|
-
[32mCJS[39m [1mdist/index.cjs [22m[32m57.
|
|
21
|
-
[32mCJS[39m ⚡️ Build success in
|
|
22
|
-
[32mESM[39m [1mdist/index.js [22m[32m57.
|
|
23
|
-
[32mESM[39m ⚡️ Build success in
|
|
20
|
+
[32mCJS[39m [1mdist/index.cjs [22m[32m57.87 KB[39m
|
|
21
|
+
[32mCJS[39m ⚡️ Build success in 1565ms
|
|
22
|
+
[32mESM[39m [1mdist/index.js [22m[32m57.36 KB[39m
|
|
23
|
+
[32mESM[39m ⚡️ Build success in 1566ms
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @mastra/pg
|
|
2
2
|
|
|
3
|
+
## 0.10.1-alpha.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- f0d559f: Fix peerdeps for alpha channel
|
|
8
|
+
- Updated dependencies [1e8bb40]
|
|
9
|
+
- @mastra/core@0.10.2-alpha.2
|
|
10
|
+
|
|
11
|
+
## 0.10.1-alpha.0
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- e5dc18d: Added a backwards compatible layer to begin storing/retrieving UIMessages in storage instead of CoreMessages
|
|
16
|
+
- Updated dependencies [592a2db]
|
|
17
|
+
- Updated dependencies [e5dc18d]
|
|
18
|
+
- @mastra/core@0.10.2-alpha.0
|
|
19
|
+
|
|
3
20
|
## 0.10.0
|
|
4
21
|
|
|
5
22
|
### Minor Changes
|
|
@@ -6,9 +6,9 @@ import type { DescribeIndexParams } from '@mastra/core/vector';
|
|
|
6
6
|
import type { EvalRow } from '@mastra/core/storage';
|
|
7
7
|
import type { IndexStats } from '@mastra/core/vector';
|
|
8
8
|
import type { ISSLConfig } from 'pg-promise/typescript/pg-subset';
|
|
9
|
+
import type { MastraMessageV2 } from '@mastra/core/agent';
|
|
9
10
|
import { MastraStorage } from '@mastra/core/storage';
|
|
10
11
|
import { MastraVector } from '@mastra/core/vector';
|
|
11
|
-
import type { MessageType } from '@mastra/core/memory';
|
|
12
12
|
import type { OperatorSupport } from '@mastra/core/vector/filter';
|
|
13
13
|
import pg from 'pg';
|
|
14
14
|
import type { QueryResult } from '@mastra/core/vector';
|
|
@@ -321,8 +321,8 @@ declare class PostgresStore extends MastraStorage {
|
|
|
321
321
|
}): Promise<void>;
|
|
322
322
|
getMessages<T = unknown>({ threadId, selectBy }: StorageGetMessagesArg): Promise<T[]>;
|
|
323
323
|
saveMessages({ messages }: {
|
|
324
|
-
messages:
|
|
325
|
-
}): Promise<
|
|
324
|
+
messages: MastraMessageV2[];
|
|
325
|
+
}): Promise<MastraMessageV2[]>;
|
|
326
326
|
persistWorkflowSnapshot({ workflowName, runId, snapshot, }: {
|
|
327
327
|
workflowName: string;
|
|
328
328
|
runId: string;
|
|
@@ -6,9 +6,9 @@ import type { DescribeIndexParams } from '@mastra/core/vector';
|
|
|
6
6
|
import type { EvalRow } from '@mastra/core/storage';
|
|
7
7
|
import type { IndexStats } from '@mastra/core/vector';
|
|
8
8
|
import type { ISSLConfig } from 'pg-promise/typescript/pg-subset';
|
|
9
|
+
import type { MastraMessageV2 } from '@mastra/core/agent';
|
|
9
10
|
import { MastraStorage } from '@mastra/core/storage';
|
|
10
11
|
import { MastraVector } from '@mastra/core/vector';
|
|
11
|
-
import type { MessageType } from '@mastra/core/memory';
|
|
12
12
|
import type { OperatorSupport } from '@mastra/core/vector/filter';
|
|
13
13
|
import pg from 'pg';
|
|
14
14
|
import type { QueryResult } from '@mastra/core/vector';
|
|
@@ -321,8 +321,8 @@ declare class PostgresStore extends MastraStorage {
|
|
|
321
321
|
}): Promise<void>;
|
|
322
322
|
getMessages<T = unknown>({ threadId, selectBy }: StorageGetMessagesArg): Promise<T[]>;
|
|
323
323
|
saveMessages({ messages }: {
|
|
324
|
-
messages:
|
|
325
|
-
}): Promise<
|
|
324
|
+
messages: MastraMessageV2[];
|
|
325
|
+
}): Promise<MastraMessageV2[]>;
|
|
326
326
|
persistWorkflowSnapshot({ workflowName, runId, snapshot, }: {
|
|
327
327
|
workflowName: string;
|
|
328
328
|
runId: string;
|
package/dist/index.cjs
CHANGED
|
@@ -1410,6 +1410,7 @@ var PostgresStore = class extends storage.MastraStorage {
|
|
|
1410
1410
|
} catch {
|
|
1411
1411
|
}
|
|
1412
1412
|
}
|
|
1413
|
+
if (message.type === `v2`) delete message.type;
|
|
1413
1414
|
});
|
|
1414
1415
|
return messages;
|
|
1415
1416
|
} catch (error) {
|
|
@@ -1439,7 +1440,7 @@ var PostgresStore = class extends storage.MastraStorage {
|
|
|
1439
1440
|
typeof message.content === "string" ? message.content : JSON.stringify(message.content),
|
|
1440
1441
|
message.createdAt || (/* @__PURE__ */ new Date()).toISOString(),
|
|
1441
1442
|
message.role,
|
|
1442
|
-
message.type
|
|
1443
|
+
message.type || "v2"
|
|
1443
1444
|
]
|
|
1444
1445
|
);
|
|
1445
1446
|
}
|
package/dist/index.js
CHANGED
|
@@ -1402,6 +1402,7 @@ var PostgresStore = class extends MastraStorage {
|
|
|
1402
1402
|
} catch {
|
|
1403
1403
|
}
|
|
1404
1404
|
}
|
|
1405
|
+
if (message.type === `v2`) delete message.type;
|
|
1405
1406
|
});
|
|
1406
1407
|
return messages;
|
|
1407
1408
|
} catch (error) {
|
|
@@ -1431,7 +1432,7 @@ var PostgresStore = class extends MastraStorage {
|
|
|
1431
1432
|
typeof message.content === "string" ? message.content : JSON.stringify(message.content),
|
|
1432
1433
|
message.createdAt || (/* @__PURE__ */ new Date()).toISOString(),
|
|
1433
1434
|
message.role,
|
|
1434
|
-
message.type
|
|
1435
|
+
message.type || "v2"
|
|
1435
1436
|
]
|
|
1436
1437
|
);
|
|
1437
1438
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/pg",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.1-alpha.1",
|
|
4
4
|
"description": "Postgres provider for Mastra - includes both vector and db storage capabilities",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -33,11 +33,11 @@
|
|
|
33
33
|
"tsup": "^8.4.0",
|
|
34
34
|
"typescript": "^5.8.2",
|
|
35
35
|
"vitest": "^3.1.2",
|
|
36
|
-
"@
|
|
37
|
-
"@
|
|
36
|
+
"@mastra/core": "0.10.2-alpha.2",
|
|
37
|
+
"@internal/lint": "0.0.7"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
|
-
"@mastra/core": "^0.10.0"
|
|
40
|
+
"@mastra/core": "^0.10.0-alpha.0"
|
|
41
41
|
},
|
|
42
42
|
"scripts": {
|
|
43
43
|
"build": "tsup src/index.ts --format esm,cjs --experimental-dts --clean --treeshake=smallest --splitting",
|
package/src/storage/index.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import type { MastraMessageV2 } from '@mastra/core/agent';
|
|
1
2
|
import type { MetricResult } from '@mastra/core/eval';
|
|
2
|
-
import type {
|
|
3
|
+
import type { StorageThreadType } from '@mastra/core/memory';
|
|
3
4
|
import {
|
|
4
5
|
MastraStorage,
|
|
5
6
|
TABLE_MESSAGES,
|
|
@@ -666,6 +667,7 @@ export class PostgresStore extends MastraStorage {
|
|
|
666
667
|
// If parsing fails, leave as string
|
|
667
668
|
}
|
|
668
669
|
}
|
|
670
|
+
if (message.type === `v2`) delete message.type;
|
|
669
671
|
});
|
|
670
672
|
|
|
671
673
|
return messages as T[];
|
|
@@ -675,7 +677,7 @@ export class PostgresStore extends MastraStorage {
|
|
|
675
677
|
}
|
|
676
678
|
}
|
|
677
679
|
|
|
678
|
-
async saveMessages({ messages }: { messages:
|
|
680
|
+
async saveMessages({ messages }: { messages: MastraMessageV2[] }): Promise<MastraMessageV2[]> {
|
|
679
681
|
if (messages.length === 0) return messages;
|
|
680
682
|
|
|
681
683
|
try {
|
|
@@ -701,7 +703,7 @@ export class PostgresStore extends MastraStorage {
|
|
|
701
703
|
typeof message.content === 'string' ? message.content : JSON.stringify(message.content),
|
|
702
704
|
message.createdAt || new Date().toISOString(),
|
|
703
705
|
message.role,
|
|
704
|
-
message.type,
|
|
706
|
+
message.type || 'v2',
|
|
705
707
|
],
|
|
706
708
|
);
|
|
707
709
|
}
|