@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.
- package/.turbo/turbo-build.log +10 -10
- package/CHANGELOG.md +26 -0
- package/dist/index.cjs +9 -0
- package/dist/index.js +9 -0
- package/package.json +2 -2
- package/src/vector/index.test.ts +5 -2
- package/src/vector/index.ts +10 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
|
|
2
|
-
> @mastra/pg@0.2.
|
|
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
|
[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 10660ms
|
|
10
10
|
[34mDTS[39m Build start
|
|
11
11
|
[34mCLI[39m Target: es2022
|
|
12
|
+
[34mCLI[39m Cleaning output folder
|
|
13
|
+
[34mESM[39m Build start
|
|
14
|
+
[34mCJS[39m Build start
|
|
12
15
|
Analysis will use the bundled TypeScript version 5.8.2
|
|
13
16
|
[36mWriting package typings: /home/runner/work/mastra/mastra/stores/pg/dist/_tsup-dts-rollup.d.ts[39m
|
|
14
17
|
Analysis will use the bundled TypeScript version 5.8.2
|
|
15
18
|
[36mWriting package typings: /home/runner/work/mastra/mastra/stores/pg/dist/_tsup-dts-rollup.d.cts[39m
|
|
16
|
-
[32mDTS[39m ⚡️ Build success in
|
|
17
|
-
[
|
|
18
|
-
[
|
|
19
|
-
[
|
|
20
|
-
[32mCJS[39m
|
|
21
|
-
[32mCJS[39m ⚡️ Build success in 1339ms
|
|
22
|
-
[32mESM[39m [1mdist/index.js [22m[32m36.43 KB[39m
|
|
23
|
-
[32mESM[39m ⚡️ Build success in 1339ms
|
|
19
|
+
[32mDTS[39m ⚡️ Build success in 11910ms
|
|
20
|
+
[32mESM[39m [1mdist/index.js [22m[32m36.97 KB[39m
|
|
21
|
+
[32mESM[39m ⚡️ Build success in 13035ms
|
|
22
|
+
[32mCJS[39m [1mdist/index.cjs [22m[32m37.38 KB[39m
|
|
23
|
+
[32mCJS[39m ⚡️ 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.
|
|
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.
|
|
24
|
+
"@mastra/core": "^0.8.0-alpha.1"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@microsoft/api-extractor": "^7.52.1",
|
package/src/vector/index.test.ts
CHANGED
|
@@ -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 = [
|
|
313
|
+
const newVector = [4, 4, 4];
|
|
311
314
|
|
|
312
315
|
const update = {
|
|
313
316
|
vector: newVector,
|
package/src/vector/index.ts
CHANGED
|
@@ -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();
|