@mastra/pg 0.2.6 → 0.2.7-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.2.6-alpha.4 build /home/runner/work/mastra/mastra/stores/pg
2
+ > @mastra/pg@0.2.7-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 10437ms
9
+ TSC ⚡️ Build success in 10660ms
10
10
  DTS Build start
11
11
  CLI Target: es2022
12
+ CLI Cleaning output folder
13
+ ESM Build start
14
+ CJS Build start
12
15
  Analysis will use the bundled TypeScript version 5.8.2
13
16
  Writing package typings: /home/runner/work/mastra/mastra/stores/pg/dist/_tsup-dts-rollup.d.ts
14
17
  Analysis will use the bundled TypeScript version 5.8.2
15
18
  Writing package typings: /home/runner/work/mastra/mastra/stores/pg/dist/_tsup-dts-rollup.d.cts
16
- DTS ⚡️ Build success in 10976ms
17
- CLI Cleaning output folder
18
- ESM Build start
19
- CJS Build start
20
- CJS dist/index.cjs 36.85 KB
21
- CJS ⚡️ Build success in 1339ms
22
- ESM dist/index.js 36.43 KB
23
- ESM ⚡️ Build success in 1339ms
19
+ DTS ⚡️ Build success in 11910ms
20
+ ESM dist/index.js 36.97 KB
21
+ ESM ⚡️ Build success in 13035ms
22
+ CJS dist/index.cjs 37.38 KB
23
+ CJS ⚡️ Build success in 13036ms
package/CHANGELOG.md CHANGED
@@ -1,5 +1,31 @@
1
1
  # @mastra/pg
2
2
 
3
+ ## 0.2.7-alpha.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 7071597: Update pinecone to include namespace and hybrid search
8
+ - Updated dependencies [619c39d]
9
+ - Updated dependencies [fe56be0]
10
+ - Updated dependencies [a0967a0]
11
+ - Updated dependencies [fca3b21]
12
+ - Updated dependencies [0118361]
13
+ - Updated dependencies [619c39d]
14
+ - @mastra/core@0.8.0-alpha.1
15
+
16
+ ## 0.2.7-alpha.0
17
+
18
+ ### Patch Changes
19
+
20
+ - cafae83: Changed error messages for vector mismatch with index
21
+ - Updated dependencies [107bcfe]
22
+ - Updated dependencies [5b4e19f]
23
+ - Updated dependencies [7599d77]
24
+ - Updated dependencies [cafae83]
25
+ - Updated dependencies [8076ecf]
26
+ - Updated dependencies [304397c]
27
+ - @mastra/core@0.7.1-alpha.0
28
+
3
29
  ## 0.2.6
4
30
 
5
31
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -394,6 +394,15 @@ var PgVector = class extends vector.MastraVector {
394
394
  return vectorIds;
395
395
  } catch (error) {
396
396
  await client.query("ROLLBACK");
397
+ if (error instanceof Error && error.message?.includes("expected") && error.message?.includes("dimensions")) {
398
+ const match = error.message.match(/expected (\d+) dimensions, not (\d+)/);
399
+ if (match) {
400
+ const [, expected, actual] = match;
401
+ throw new Error(
402
+ `Vector dimension mismatch: Index "${params.indexName}" expects ${expected} dimensions but got ${actual} dimensions. Either use a matching embedding model or delete and recreate the index with the new dimension.`
403
+ );
404
+ }
405
+ }
397
406
  throw error;
398
407
  } finally {
399
408
  client.release();
package/dist/index.js CHANGED
@@ -387,6 +387,15 @@ var PgVector = class extends MastraVector {
387
387
  return vectorIds;
388
388
  } catch (error) {
389
389
  await client.query("ROLLBACK");
390
+ if (error instanceof Error && error.message?.includes("expected") && error.message?.includes("dimensions")) {
391
+ const match = error.message.match(/expected (\d+) dimensions, not (\d+)/);
392
+ if (match) {
393
+ const [, expected, actual] = match;
394
+ throw new Error(
395
+ `Vector dimension mismatch: Index "${params.indexName}" expects ${expected} dimensions but got ${actual} dimensions. Either use a matching embedding model or delete and recreate the index with the new dimension.`
396
+ );
397
+ }
398
+ }
390
399
  throw error;
391
400
  } finally {
392
401
  client.release();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/pg",
3
- "version": "0.2.6",
3
+ "version": "0.2.7-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",
@@ -21,7 +21,7 @@
21
21
  "dependencies": {
22
22
  "pg": "^8.13.3",
23
23
  "pg-promise": "^11.11.0",
24
- "@mastra/core": "^0.7.0"
24
+ "@mastra/core": "^0.8.0-alpha.1"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@microsoft/api-extractor": "^7.52.1",
@@ -229,7 +229,10 @@ describe('PgVector', () => {
229
229
 
230
230
  it('should throw error if vector dimensions dont match', async () => {
231
231
  const vectors = [[1, 2, 3, 4]]; // 4D vector for 3D index
232
- await expect(vectorDB.upsert({ indexName: testIndexName, vectors })).rejects.toThrow();
232
+ await expect(vectorDB.upsert({ indexName: testIndexName, vectors })).rejects.toThrow(
233
+ `Vector dimension mismatch: Index "${testIndexName}" expects 3 dimensions but got 4 dimensions. ` +
234
+ `Either use a matching embedding model or delete and recreate the index with the new dimension.`,
235
+ );
233
236
  });
234
237
  });
235
238
 
@@ -307,7 +310,7 @@ describe('PgVector', () => {
307
310
  expect(ids).toHaveLength(3);
308
311
 
309
312
  const idToBeUpdated = ids[0];
310
- const newVector = [1, 2, 3];
313
+ const newVector = [4, 4, 4];
311
314
 
312
315
  const update = {
313
316
  vector: newVector,
@@ -181,6 +181,16 @@ export class PgVector extends MastraVector {
181
181
  return vectorIds;
182
182
  } catch (error) {
183
183
  await client.query('ROLLBACK');
184
+ if (error instanceof Error && error.message?.includes('expected') && error.message?.includes('dimensions')) {
185
+ const match = error.message.match(/expected (\d+) dimensions, not (\d+)/);
186
+ if (match) {
187
+ const [, expected, actual] = match;
188
+ throw new Error(
189
+ `Vector dimension mismatch: Index "${params.indexName}" expects ${expected} dimensions but got ${actual} dimensions. ` +
190
+ `Either use a matching embedding model or delete and recreate the index with the new dimension.`,
191
+ );
192
+ }
193
+ }
184
194
  throw error;
185
195
  } finally {
186
196
  client.release();