@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.
@@ -1,23 +1,23 @@
1
1
 
2
- > @mastra/pg@0.10.0-alpha.1 build /home/runner/work/mastra/mastra/stores/pg
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
  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 9529ms
9
+ TSC ⚡️ Build success in 11415ms
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/pg/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/pg/dist/_tsup-dts-rollup.d.cts
16
- DTS ⚡️ Build success in 11794ms
16
+ DTS ⚡️ Build success in 11422ms
17
17
  CLI Cleaning output folder
18
18
  ESM Build start
19
19
  CJS Build start
20
- CJS dist/index.cjs 57.80 KB
21
- CJS ⚡️ Build success in 1416ms
22
- ESM dist/index.js 57.30 KB
23
- ESM ⚡️ Build success in 1416ms
20
+ CJS dist/index.cjs 57.87 KB
21
+ CJS ⚡️ Build success in 1565ms
22
+ ESM dist/index.js 57.36 KB
23
+ ESM ⚡️ 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: MessageType[];
325
- }): Promise<MessageType[]>;
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: MessageType[];
325
- }): Promise<MessageType[]>;
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.0",
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
- "@internal/lint": "0.0.6",
37
- "@mastra/core": "0.10.0"
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",
@@ -53,6 +53,8 @@ const createSampleWorkflowSnapshot = (status: WorkflowRunState['context'][string
53
53
  status,
54
54
  payload: {},
55
55
  error: undefined,
56
+ startedAt: timestamp.getTime(),
57
+ endedAt: new Date(timestamp.getTime() + 15000).getTime(),
56
58
  },
57
59
  input: {},
58
60
  },
@@ -1,5 +1,6 @@
1
+ import type { MastraMessageV2 } from '@mastra/core/agent';
1
2
  import type { MetricResult } from '@mastra/core/eval';
2
- import type { MessageType, StorageThreadType } from '@mastra/core/memory';
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: MessageType[] }): Promise<MessageType[]> {
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
  }