@mastra/pg 0.12.2-alpha.0 → 0.12.3-alpha.0

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.12.2-alpha.0 build /home/runner/work/mastra/mastra/stores/pg
2
+ > @mastra/pg@0.12.3-alpha.0 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.5.0
8
8
  TSC Build start
9
- TSC ⚡️ Build success in 11277ms
9
+ TSC ⚡️ Build success in 11580ms
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 12318ms
16
+ DTS ⚡️ Build success in 11970ms
17
17
  CLI Cleaning output folder
18
18
  ESM Build start
19
19
  CJS Build start
20
- CJS dist/index.cjs 88.25 KB
21
- CJS ⚡️ Build success in 1573ms
22
- ESM dist/index.js 86.87 KB
23
- ESM ⚡️ Build success in 1574ms
20
+ ESM dist/index.js 86.90 KB
21
+ ESM ⚡️ Build success in 1842ms
22
+ CJS dist/index.cjs 88.28 KB
23
+ CJS ⚡️ Build success in 1845ms
package/CHANGELOG.md CHANGED
@@ -1,5 +1,45 @@
1
1
  # @mastra/pg
2
2
 
3
+ ## 0.12.3-alpha.0
4
+
5
+ ### Patch Changes
6
+
7
+ - ca52f88: dependencies updates:
8
+ - Updated dependency [`pg-promise@^11.15.0` ↗︎](https://www.npmjs.com/package/pg-promise/v/11.15.0) (from `^11.14.0`, in `dependencies`)
9
+ - 00c57ff: fix: pg storage should select resourceId when getMessages
10
+ - Updated dependencies [db5cc15]
11
+ - Updated dependencies [5237998]
12
+ - Updated dependencies [37c1acd]
13
+ - Updated dependencies [1aa60b1]
14
+ - Updated dependencies [89ec9d4]
15
+ - Updated dependencies [626b0f4]
16
+ - Updated dependencies [c22a91f]
17
+ - Updated dependencies [f7403ab]
18
+ - Updated dependencies [6c89d7f]
19
+ - @mastra/core@0.10.15-alpha.0
20
+
21
+ ## 0.12.2
22
+
23
+ ### Patch Changes
24
+
25
+ - fb2a1b9: dependencies updates:
26
+ - Updated dependency [`pg@^8.16.3` ↗︎](https://www.npmjs.com/package/pg/v/8.16.3) (from `^8.16.0`, in `dependencies`)
27
+ - Updated dependencies [2873c7f]
28
+ - Updated dependencies [1c1c6a1]
29
+ - Updated dependencies [f8ce2cc]
30
+ - Updated dependencies [8c846b6]
31
+ - Updated dependencies [c7bbf1e]
32
+ - Updated dependencies [8722d53]
33
+ - Updated dependencies [565cc0c]
34
+ - Updated dependencies [b790fd1]
35
+ - Updated dependencies [132027f]
36
+ - Updated dependencies [0c85311]
37
+ - Updated dependencies [d7ed04d]
38
+ - Updated dependencies [cb16baf]
39
+ - Updated dependencies [f36e4f1]
40
+ - Updated dependencies [7f6e403]
41
+ - @mastra/core@0.10.11
42
+
3
43
  ## 0.12.2-alpha.0
4
44
 
5
45
  ### Patch Changes
package/LICENSE.md CHANGED
@@ -1,7 +1,15 @@
1
- Copyright 2025 Mastra AI, Inc.
1
+ # Apache License 2.0
2
2
 
3
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
3
+ Copyright (c) 2025 Kepler Software, Inc.
4
4
 
5
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
5
+ Licensed under the Apache License, Version 2.0 (the "License");
6
+ you may not use this file except in compliance with the License.
7
+ You may obtain a copy of the License at
6
8
 
7
- THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
9
+ http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+ Unless required by applicable law or agreed to in writing, software
12
+ distributed under the License is distributed on an "AS IS" BASIS,
13
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ See the License for the specific language governing permissions and
15
+ limitations under the License.
package/dist/index.cjs CHANGED
@@ -1850,7 +1850,7 @@ var PostgresStore = class extends storage.MastraStorage {
1850
1850
  }
1851
1851
  async getMessages(args) {
1852
1852
  const { threadId, format, selectBy } = args;
1853
- const selectStatement = `SELECT id, content, role, type, "createdAt", thread_id AS "threadId"`;
1853
+ const selectStatement = `SELECT id, content, role, type, "createdAt", thread_id AS "threadId", "resourceId"`;
1854
1854
  const orderByStatement = `ORDER BY "createdAt" DESC`;
1855
1855
  const limit = this.resolveMessageLimit({ last: selectBy?.last, defaultLimit: 40 });
1856
1856
  try {
@@ -1910,7 +1910,7 @@ var PostgresStore = class extends storage.MastraStorage {
1910
1910
  const { page = 0, perPage: perPageInput, dateRange } = selectBy?.pagination || {};
1911
1911
  const fromDate = dateRange?.start;
1912
1912
  const toDate = dateRange?.end;
1913
- const selectStatement = `SELECT id, content, role, type, "createdAt", thread_id AS "threadId"`;
1913
+ const selectStatement = `SELECT id, content, role, type, "createdAt", thread_id AS "threadId", "resourceId"`;
1914
1914
  const orderByStatement = `ORDER BY "createdAt" DESC`;
1915
1915
  const messages = [];
1916
1916
  if (selectBy?.include?.length) {
package/dist/index.js CHANGED
@@ -1842,7 +1842,7 @@ var PostgresStore = class extends MastraStorage {
1842
1842
  }
1843
1843
  async getMessages(args) {
1844
1844
  const { threadId, format, selectBy } = args;
1845
- const selectStatement = `SELECT id, content, role, type, "createdAt", thread_id AS "threadId"`;
1845
+ const selectStatement = `SELECT id, content, role, type, "createdAt", thread_id AS "threadId", "resourceId"`;
1846
1846
  const orderByStatement = `ORDER BY "createdAt" DESC`;
1847
1847
  const limit = this.resolveMessageLimit({ last: selectBy?.last, defaultLimit: 40 });
1848
1848
  try {
@@ -1902,7 +1902,7 @@ var PostgresStore = class extends MastraStorage {
1902
1902
  const { page = 0, perPage: perPageInput, dateRange } = selectBy?.pagination || {};
1903
1903
  const fromDate = dateRange?.start;
1904
1904
  const toDate = dateRange?.end;
1905
- const selectStatement = `SELECT id, content, role, type, "createdAt", thread_id AS "threadId"`;
1905
+ const selectStatement = `SELECT id, content, role, type, "createdAt", thread_id AS "threadId", "resourceId"`;
1906
1906
  const orderByStatement = `ORDER BY "createdAt" DESC`;
1907
1907
  const messages = [];
1908
1908
  if (selectBy?.include?.length) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/pg",
3
- "version": "0.12.2-alpha.0",
3
+ "version": "0.12.3-alpha.0",
4
4
  "description": "Postgres provider for Mastra - includes both vector and db storage capabilities",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -22,20 +22,20 @@
22
22
  "dependencies": {
23
23
  "async-mutex": "^0.5.0",
24
24
  "pg": "^8.16.3",
25
- "pg-promise": "^11.14.0",
25
+ "pg-promise": "^11.15.0",
26
26
  "xxhash-wasm": "^1.1.0"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@microsoft/api-extractor": "^7.52.8",
30
30
  "@types/node": "^20.19.0",
31
31
  "@types/pg": "^8.15.4",
32
- "eslint": "^9.29.0",
32
+ "eslint": "^9.30.1",
33
33
  "tsup": "^8.5.0",
34
34
  "typescript": "^5.8.3",
35
35
  "vitest": "^3.2.4",
36
- "@internal/lint": "0.0.17",
37
- "@internal/storage-test-utils": "0.0.13",
38
- "@mastra/core": "0.10.11-alpha.0"
36
+ "@internal/storage-test-utils": "0.0.15",
37
+ "@internal/lint": "0.0.19",
38
+ "@mastra/core": "0.10.15-alpha.0"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "@mastra/core": ">=0.10.7-0 <0.11.0-0"
@@ -258,7 +258,10 @@ describe('PostgresStore', () => {
258
258
  const thread = createSampleThread();
259
259
  await store.saveThread({ thread });
260
260
 
261
- const messages = [createSampleMessageV1({ threadId: thread.id }), createSampleMessageV1({ threadId: thread.id })];
261
+ const messages = [
262
+ createSampleMessageV1({ threadId: thread.id, resourceId: thread.resourceId }),
263
+ createSampleMessageV1({ threadId: thread.id, resourceId: thread.resourceId }),
264
+ ];
262
265
 
263
266
  // Save messages
264
267
  const savedMessages = await store.saveMessages({ messages });
@@ -267,11 +270,7 @@ describe('PostgresStore', () => {
267
270
  // Retrieve messages
268
271
  const retrievedMessages = await store.getMessages({ threadId: thread.id, format: 'v1' });
269
272
  expect(retrievedMessages).toHaveLength(2);
270
- const checkMessages = messages.map(m => {
271
- const { resourceId, ...rest } = m;
272
- return rest;
273
- });
274
- expect(retrievedMessages).toEqual(expect.arrayContaining(checkMessages));
273
+ expect(retrievedMessages).toEqual(expect.arrayContaining(messages));
275
274
  });
276
275
 
277
276
  it('should handle empty message array', async () => {
@@ -1821,8 +1820,8 @@ describe('PostgresStore', () => {
1821
1820
  await store.saveThread({ thread });
1822
1821
 
1823
1822
  const messages = [
1824
- createSampleMessageV1({ threadId: thread.id }),
1825
- createSampleMessageV1({ threadId: thread.id }),
1823
+ createSampleMessageV1({ threadId: thread.id, resourceId: thread.resourceId }),
1824
+ createSampleMessageV1({ threadId: thread.id, resourceId: thread.resourceId }),
1826
1825
  ];
1827
1826
 
1828
1827
  // Save messages
@@ -1832,11 +1831,7 @@ describe('PostgresStore', () => {
1832
1831
  // Retrieve messages
1833
1832
  const retrievedMessages = await store.getMessagesPaginated({ threadId: thread.id, format: 'v1' });
1834
1833
  expect(retrievedMessages.messages).toHaveLength(2);
1835
- const checkMessages = messages.map(m => {
1836
- const { resourceId, ...rest } = m;
1837
- return rest;
1838
- });
1839
- expect(retrievedMessages.messages).toEqual(expect.arrayContaining(checkMessages));
1834
+ expect(retrievedMessages.messages).toEqual(expect.arrayContaining(messages));
1840
1835
  });
1841
1836
 
1842
1837
  it('should maintain message order', async () => {
@@ -938,7 +938,7 @@ export class PostgresStore extends MastraStorage {
938
938
  ): Promise<MastraMessageV1[] | MastraMessageV2[]> {
939
939
  const { threadId, format, selectBy } = args;
940
940
 
941
- const selectStatement = `SELECT id, content, role, type, "createdAt", thread_id AS "threadId"`;
941
+ const selectStatement = `SELECT id, content, role, type, "createdAt", thread_id AS "threadId", "resourceId"`;
942
942
  const orderByStatement = `ORDER BY "createdAt" DESC`;
943
943
  const limit = this.resolveMessageLimit({ last: selectBy?.last, defaultLimit: 40 });
944
944
 
@@ -1015,7 +1015,7 @@ export class PostgresStore extends MastraStorage {
1015
1015
  const fromDate = dateRange?.start;
1016
1016
  const toDate = dateRange?.end;
1017
1017
 
1018
- const selectStatement = `SELECT id, content, role, type, "createdAt", thread_id AS "threadId"`;
1018
+ const selectStatement = `SELECT id, content, role, type, "createdAt", thread_id AS "threadId", "resourceId"`;
1019
1019
  const orderByStatement = `ORDER BY "createdAt" DESC`;
1020
1020
 
1021
1021
  const messages: MastraMessageV2[] = [];