@mastra/pg 0.17.3-alpha.1 → 0.17.4-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.
- package/CHANGELOG.md +31 -0
- package/README.md +75 -5
- package/dist/storage/test-utils.d.ts.map +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# @mastra/pg
|
|
2
2
|
|
|
3
|
+
## 0.17.4-alpha.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Add configuration documentation and tests for PgVector and PostgresStore, including examples for connection methods, SSL configuration, and pool options ([#8723](https://github.com/mastra-ai/mastra/pull/8723))
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`ca85c93`](https://github.com/mastra-ai/mastra/commit/ca85c932b232e6ad820c811ec176d98e68c59b0a), [`a1d40f8`](https://github.com/mastra-ai/mastra/commit/a1d40f88d4ce42c4508774ad22e38ac582157af2), [`01c4a25`](https://github.com/mastra-ai/mastra/commit/01c4a2506c514d5e861c004d3d2fb3791c6391f3), [`cce8aad`](https://github.com/mastra-ai/mastra/commit/cce8aad878a0dd98e5647680f3765caba0b1701c)]:
|
|
10
|
+
- @mastra/core@0.21.1-alpha.0
|
|
11
|
+
|
|
12
|
+
## 0.17.3
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- feat(pg): add flexible PostgreSQL configuration with shared types ([#8103](https://github.com/mastra-ai/mastra/pull/8103))
|
|
17
|
+
- Add support for multiple connection methods: connectionString, host/port/database, and Cloud SQL
|
|
18
|
+
- Introduce shared PostgresConfig type with generic SSL support (ISSLConfig for pg-promise, ConnectionOptions for pg)
|
|
19
|
+
- Add pgPoolOptions support to PgVector for advanced pool configuration
|
|
20
|
+
- Create shared validation helpers to reduce code duplication
|
|
21
|
+
- Maintain backward compatibility with existing configurations
|
|
22
|
+
|
|
23
|
+
- Update peer dependencies to match core package version bump (0.21.0) ([#8619](https://github.com/mastra-ai/mastra/pull/8619))
|
|
24
|
+
|
|
25
|
+
- Update peer dependencies to match core package version bump (0.21.0) ([#8557](https://github.com/mastra-ai/mastra/pull/8557))
|
|
26
|
+
|
|
27
|
+
- Update peer dependencies to match core package version bump (0.21.0) ([#8626](https://github.com/mastra-ai/mastra/pull/8626))
|
|
28
|
+
|
|
29
|
+
- Update peer dependencies to match core package version bump (0.21.0) ([#8686](https://github.com/mastra-ai/mastra/pull/8686))
|
|
30
|
+
|
|
31
|
+
- Updated dependencies [[`1ed9670`](https://github.com/mastra-ai/mastra/commit/1ed9670d3ca50cb60dc2e517738c5eef3968ed27), [`b5a66b7`](https://github.com/mastra-ai/mastra/commit/b5a66b748a14fc8b3f63b04642ddb9621fbcc9e0), [`f59fc1e`](https://github.com/mastra-ai/mastra/commit/f59fc1e406b8912e692f6bff6cfd4754cc8d165c), [`158381d`](https://github.com/mastra-ai/mastra/commit/158381d39335be934b81ef8a1947bccace492c25), [`a1799bc`](https://github.com/mastra-ai/mastra/commit/a1799bcc1b5a1cdc188f2ac0165f17a1c4ac6f7b), [`6ff6094`](https://github.com/mastra-ai/mastra/commit/6ff60946f4ecfebdeef6e21d2b230c2204f2c9b8), [`fb703b9`](https://github.com/mastra-ai/mastra/commit/fb703b9634eeaff1a6eb2b5531ce0f9e8fb04727), [`37a2314`](https://github.com/mastra-ai/mastra/commit/37a23148e0e5a3b40d4f9f098b194671a8a49faf), [`7b1ef57`](https://github.com/mastra-ai/mastra/commit/7b1ef57fc071c2aa2a2e32905b18cd88719c5a39), [`05a9dee`](https://github.com/mastra-ai/mastra/commit/05a9dee3d355694d28847bfffb6289657fcf7dfa), [`e3c1077`](https://github.com/mastra-ai/mastra/commit/e3c107763aedd1643d3def5df450c235da9ff76c), [`1908ca0`](https://github.com/mastra-ai/mastra/commit/1908ca0521f90e43779cc29ab590173ca560443c), [`1bccdb3`](https://github.com/mastra-ai/mastra/commit/1bccdb33eb90cbeba2dc5ece1c2561fb774b26b6), [`5ef944a`](https://github.com/mastra-ai/mastra/commit/5ef944a3721d93105675cac2b2311432ff8cc393), [`d6b186f`](https://github.com/mastra-ai/mastra/commit/d6b186fb08f1caf1b86f73d3a5ee88fb999ca3be), [`ee68e82`](https://github.com/mastra-ai/mastra/commit/ee68e8289ea4408d29849e899bc6e78b3bd4e843), [`228228b`](https://github.com/mastra-ai/mastra/commit/228228b0b1de9291cb8887587f5cea1a8757ebad), [`ea33930`](https://github.com/mastra-ai/mastra/commit/ea339301e82d6318257720d811b043014ee44064), [`65493b3`](https://github.com/mastra-ai/mastra/commit/65493b31c36f6fdb78f9679f7e1ecf0c250aa5ee), [`a998b8f`](https://github.com/mastra-ai/mastra/commit/a998b8f858091c2ec47683e60766cf12d03001e4), [`b5a66b7`](https://github.com/mastra-ai/mastra/commit/b5a66b748a14fc8b3f63b04642ddb9621fbcc9e0), [`8a37bdd`](https://github.com/mastra-ai/mastra/commit/8a37bddb6d8614a32c5b70303d583d80c620ea61), [`135d6f2`](https://github.com/mastra-ai/mastra/commit/135d6f22a326ed1dffff858700669dff09d2c9eb)]:
|
|
32
|
+
- @mastra/core@0.21.0
|
|
33
|
+
|
|
3
34
|
## 0.17.3-alpha.1
|
|
4
35
|
|
|
5
36
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -17,11 +17,53 @@ npm install @mastra/pg
|
|
|
17
17
|
|
|
18
18
|
### Vector Store
|
|
19
19
|
|
|
20
|
+
#### Basic Configuration
|
|
21
|
+
|
|
22
|
+
PgVector supports multiple connection methods:
|
|
23
|
+
|
|
24
|
+
**1. Connection String (Recommended)**
|
|
25
|
+
|
|
20
26
|
```typescript
|
|
21
27
|
import { PgVector } from '@mastra/pg';
|
|
22
28
|
|
|
23
|
-
const vectorStore = new PgVector({
|
|
29
|
+
const vectorStore = new PgVector({
|
|
30
|
+
connectionString: 'postgresql://user:pass@localhost:5432/db',
|
|
31
|
+
});
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
**2. Host/Port/Database Configuration**
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
const vectorStore = new PgVector({
|
|
38
|
+
host: 'localhost',
|
|
39
|
+
port: 5432,
|
|
40
|
+
database: 'mydb',
|
|
41
|
+
user: 'postgres',
|
|
42
|
+
password: 'password',
|
|
43
|
+
});
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
> **Note:** PgVector also supports advanced configurations like Google Cloud SQL Connector via `pg.ClientConfig`.
|
|
24
47
|
|
|
48
|
+
#### Advanced Options
|
|
49
|
+
|
|
50
|
+
```typescript
|
|
51
|
+
const vectorStore = new PgVector({
|
|
52
|
+
connectionString: 'postgresql://user:pass@localhost:5432/db',
|
|
53
|
+
schemaName: 'custom_schema', // Use custom schema (default: public)
|
|
54
|
+
max: 30, // Max pool connections (default: 20)
|
|
55
|
+
idleTimeoutMillis: 60000, // Idle timeout (default: 30000)
|
|
56
|
+
pgPoolOptions: {
|
|
57
|
+
// Additional pg pool options
|
|
58
|
+
connectionTimeoutMillis: 5000,
|
|
59
|
+
allowExitOnIdle: true,
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
#### Usage Example
|
|
65
|
+
|
|
66
|
+
```typescript
|
|
25
67
|
// Create a new table with vector support
|
|
26
68
|
await vectorStore.createIndex({
|
|
27
69
|
indexName: 'my_vectors',
|
|
@@ -97,12 +139,40 @@ const messages = await store.getMessages('thread-123');
|
|
|
97
139
|
|
|
98
140
|
## Configuration
|
|
99
141
|
|
|
100
|
-
|
|
142
|
+
### Connection Methods
|
|
143
|
+
|
|
144
|
+
Both `PgVector` and `PostgresStore` support multiple connection methods:
|
|
145
|
+
|
|
146
|
+
1. **Connection String**
|
|
147
|
+
|
|
148
|
+
```typescript
|
|
149
|
+
{
|
|
150
|
+
connectionString: 'postgresql://user:pass@localhost:5432/db';
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
2. **Host/Port/Database**
|
|
155
|
+
```typescript
|
|
156
|
+
{
|
|
157
|
+
host: 'localhost',
|
|
158
|
+
port: 5432,
|
|
159
|
+
database: 'mydb',
|
|
160
|
+
user: 'postgres',
|
|
161
|
+
password: 'password'
|
|
162
|
+
}
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
> **Advanced:** Also supports `pg.ClientConfig` for use cases like Google Cloud SQL Connector with IAM authentication.
|
|
166
|
+
|
|
167
|
+
### Optional Configuration
|
|
101
168
|
|
|
102
|
-
- `
|
|
103
|
-
-
|
|
169
|
+
- `schemaName`: Custom PostgreSQL schema (default: `public`)
|
|
170
|
+
- `ssl`: Enable SSL or provide custom SSL options (`true` | `false` | `ConnectionOptions`)
|
|
171
|
+
- `max`: Maximum pool connections (default: `20`)
|
|
172
|
+
- `idleTimeoutMillis`: Idle connection timeout (default: `30000`)
|
|
173
|
+
- `pgPoolOptions`: Additional pg pool options (PgVector only)
|
|
104
174
|
|
|
105
|
-
Connection
|
|
175
|
+
### Default Connection Pool Settings
|
|
106
176
|
|
|
107
177
|
- Maximum connections: 20
|
|
108
178
|
- Idle timeout: 30 seconds
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-utils.d.ts","sourceRoot":"","sources":["../../src/storage/test-utils.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAG5D,eAAO,MAAM,WAAW,EAAE,mBAMzB,CAAC;AAEF,eAAO,MAAM,gBAAgB,QAA6H,CAAC;AAE3J,wBAAgB,OAAO,
|
|
1
|
+
{"version":3,"file":"test-utils.d.ts","sourceRoot":"","sources":["../../src/storage/test-utils.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAG5D,eAAO,MAAM,WAAW,EAAE,mBAMzB,CAAC;AAEF,eAAO,MAAM,gBAAgB,QAA6H,CAAC;AAE3J,wBAAgB,OAAO,SA8dtB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/pg",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.4-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",
|
|
@@ -33,10 +33,10 @@
|
|
|
33
33
|
"tsup": "^8.5.0",
|
|
34
34
|
"typescript": "^5.8.3",
|
|
35
35
|
"vitest": "^3.2.4",
|
|
36
|
-
"@
|
|
37
|
-
"@internal/
|
|
38
|
-
"@internal/
|
|
39
|
-
"@
|
|
36
|
+
"@mastra/core": "0.21.1-alpha.0",
|
|
37
|
+
"@internal/types-builder": "0.0.24",
|
|
38
|
+
"@internal/storage-test-utils": "0.0.45",
|
|
39
|
+
"@internal/lint": "0.0.49"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
42
|
"@mastra/core": ">=0.20.1-0 <0.22.0-0"
|