@mastra/pg 1.20.1-alpha.2 → 1.20.1-alpha.3
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 +13 -0
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/index.cjs +33 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +33 -0
- package/dist/index.js.map +1 -1
- package/dist/storage/factory-storage.d.ts +22 -0
- package/dist/storage/factory-storage.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { FactoryStorage } from '@mastra/core/storage';
|
|
2
2
|
import type { CollectionSchema, FactoryAuthDatabase, FactoryStorageOps, MastraCompositeStore, RetentionConfig } from '@mastra/core/storage';
|
|
3
|
+
import type { Pool } from 'pg';
|
|
3
4
|
import { PostgresStore } from './index.js';
|
|
4
5
|
export type PgFactoryStorageConfig = {
|
|
5
6
|
connectionString: string;
|
|
@@ -19,6 +20,27 @@ export type PgFactoryStorageConfig = {
|
|
|
19
20
|
* Supports serializable app-table transactions for cross-replica invariant
|
|
20
21
|
* enforcement and `authDatabase()` exposing the shared pool.
|
|
21
22
|
*/
|
|
23
|
+
/**
|
|
24
|
+
* A pool-level `error` listener only covers *idle* clients: pg hands ownership
|
|
25
|
+
* of a client to the borrower for the duration of a checkout and takes its own
|
|
26
|
+
* listener off. So a backend restart or network blip that lands on a client
|
|
27
|
+
* mid-transaction reaches an emitter with no listener, and Node escalates that
|
|
28
|
+
* to an uncaughtException that kills the process — the pool handler logs the
|
|
29
|
+
* idle siblings and the borrowed one still brings everything down.
|
|
30
|
+
*
|
|
31
|
+
* Attach a listener once per physical connection instead. `connect` fires when
|
|
32
|
+
* the pool establishes a client, so the client stays covered for its whole life
|
|
33
|
+
* and there is nothing to remove on release.
|
|
34
|
+
*
|
|
35
|
+
* That listener outlives the checkout, so it also sees the failures the pool is
|
|
36
|
+
* already reporting through its own idle listener. Follow `acquire`/`release`
|
|
37
|
+
* to tell the two apart and stay quiet while the client is idle — otherwise one
|
|
38
|
+
* dropped connection is announced twice, the second time as the wrong thing.
|
|
39
|
+
*
|
|
40
|
+
* The pool still discards the failed connection; this only keeps the failure
|
|
41
|
+
* reportable instead of fatal.
|
|
42
|
+
*/
|
|
43
|
+
export declare function guardCheckedOutClientErrors(pool: Pool, warn?: (message?: any, ...optionalParams: any[]) => void): void;
|
|
22
44
|
export declare class PgFactoryStorage extends FactoryStorage {
|
|
23
45
|
#private;
|
|
24
46
|
readonly ops: FactoryStorageOps;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory-storage.d.ts","sourceRoot":"","sources":["../../src/storage/factory-storage.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAwB,MAAM,sBAAsB,CAAC;AAC5E,OAAO,KAAK,EAGV,gBAAgB,EAGhB,mBAAmB,EACnB,iBAAiB,EACjB,oBAAoB,EACpB,eAAe,EAChB,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"factory-storage.d.ts","sourceRoot":"","sources":["../../src/storage/factory-storage.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAwB,MAAM,sBAAsB,CAAC;AAC5E,OAAO,KAAK,EAGV,gBAAgB,EAGhB,mBAAmB,EACnB,iBAAiB,EACjB,oBAAoB,EACpB,eAAe,EAChB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EAAE,IAAI,EAAc,MAAM,IAAI,CAAC;AAE3C,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExC,MAAM,MAAM,sBAAsB,GAC9B;IACE,gBAAgB,EAAE,MAAM,CAAC;IACzB,0EAA0E;IAC1E,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,uEAAuE;IACvE,SAAS,CAAC,EAAE,eAAe,CAAC;CAC7B,GACD;IACE,oEAAoE;IACpE,KAAK,EAAE,aAAa,CAAC;CACtB,CAAC;AA0YN;;;;;;;GAOG;AACH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,oDAAe,GAAG,IAAI,CAgBjF;AAED,qBAAa,gBAAiB,SAAQ,cAAc;;IAClD,QAAQ,CAAC,GAAG,EAAE,iBAAiB,CAAC;gBAQpB,MAAM,EAAE,sBAAsB;IAyB1C,gBAAgB,IAAI,oBAAoB;cAYxB,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAItC,eAAe,CAAC,CAAC,EACrB,EAAE,EAAE,CAAC,GAAG,EAAE,iBAAiB,KAAK,OAAO,CAAC,CAAC,CAAC,EAC1C,OAAO,CAAC,EAAE;QAAE,cAAc,CAAC,EAAE,cAAc,CAAA;KAAE,GAC5C,OAAO,CAAC,CAAC,CAAC;IAiCP,iBAAiB,CAAC,OAAO,EAAE,gBAAgB,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAO7D,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAQ5B,YAAY,IAAI,mBAAmB;CA4DpC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/pg",
|
|
3
|
-
"version": "1.20.1-alpha.
|
|
3
|
+
"version": "1.20.1-alpha.3",
|
|
4
4
|
"description": "Postgres provider for Mastra - includes both vector and db storage capabilities",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -36,9 +36,9 @@
|
|
|
36
36
|
"typescript": "^6.0.3",
|
|
37
37
|
"vitest": "4.1.10",
|
|
38
38
|
"@internal/lint": "0.0.123",
|
|
39
|
-
"@internal/types-builder": "0.0.98",
|
|
40
39
|
"@internal/storage-test-utils": "0.0.119",
|
|
41
|
-
"@
|
|
40
|
+
"@internal/types-builder": "0.0.98",
|
|
41
|
+
"@mastra/core": "1.60.0-alpha.12"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"@mastra/core": ">=1.53.0-0 <2.0.0-0"
|