@mastra/pg 1.16.0 → 1.16.1-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 +23 -0
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/docs-memory-working-memory.md +1 -1
- package/dist/docs/references/reference-storage-retention.md +1 -1
- package/dist/index.cjs +37 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +37 -2
- package/dist/index.js.map +1 -1
- package/dist/storage/db/index.d.ts.map +1 -1
- package/dist/storage/domains/observability/v-next/index.d.ts +1 -1
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/vector/index.d.ts.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -646,6 +646,14 @@ var PgVector = class extends MastraVector {
|
|
|
646
646
|
throw new Error("PgVector: invalid configuration provided");
|
|
647
647
|
}
|
|
648
648
|
this.pool = new pg.Pool(poolConfig);
|
|
649
|
+
this.pool.on("error", (err) => {
|
|
650
|
+
this.logger?.warn?.(
|
|
651
|
+
"PgVector: idle pool client error (pool discards the client and reconnects on next checkout)",
|
|
652
|
+
{
|
|
653
|
+
err: err instanceof Error ? err.message : err
|
|
654
|
+
}
|
|
655
|
+
);
|
|
656
|
+
});
|
|
649
657
|
this.cacheWarmupPromise = (async () => {
|
|
650
658
|
try {
|
|
651
659
|
const existingIndexes = await this.listIndexes();
|
|
@@ -2348,6 +2356,11 @@ function resolvePgConfig(config) {
|
|
|
2348
2356
|
ssl: config.ssl
|
|
2349
2357
|
});
|
|
2350
2358
|
}
|
|
2359
|
+
pool.on("error", (err) => {
|
|
2360
|
+
console.warn(
|
|
2361
|
+
`resolvePgConfig: idle pool client error (pool discards the client and reconnects on next checkout): ${err instanceof Error ? err.message : String(err)}`
|
|
2362
|
+
);
|
|
2363
|
+
});
|
|
2351
2364
|
return {
|
|
2352
2365
|
client: new PoolAdapter(pool),
|
|
2353
2366
|
schemaName: config.schemaName,
|
|
@@ -15553,8 +15566,8 @@ var ObservabilityStoragePostgresVNext = class _ObservabilityStoragePostgresVNext
|
|
|
15553
15566
|
return { preferred: "insert-only", supported: ["insert-only"] };
|
|
15554
15567
|
}
|
|
15555
15568
|
getFeatures() {
|
|
15556
|
-
if (!deltaPollingFeatureEnabled()) return
|
|
15557
|
-
return ["delta-polling"];
|
|
15569
|
+
if (!deltaPollingFeatureEnabled()) return ["metrics", "logs"];
|
|
15570
|
+
return ["metrics", "logs", "delta-polling"];
|
|
15558
15571
|
}
|
|
15559
15572
|
async #run(op, fn, details) {
|
|
15560
15573
|
try {
|
|
@@ -20284,6 +20297,18 @@ var PostgresStore = class extends MastraCompositeStore {
|
|
|
20284
20297
|
}
|
|
20285
20298
|
}
|
|
20286
20299
|
createPool(config) {
|
|
20300
|
+
const pool = this.#buildPool(config);
|
|
20301
|
+
pool.on("error", (err) => {
|
|
20302
|
+
this.logger?.warn?.(
|
|
20303
|
+
"PostgresStore: idle pool client error (pool discards the client and reconnects on next checkout)",
|
|
20304
|
+
{
|
|
20305
|
+
err: err instanceof Error ? err.message : err
|
|
20306
|
+
}
|
|
20307
|
+
);
|
|
20308
|
+
});
|
|
20309
|
+
return pool;
|
|
20310
|
+
}
|
|
20311
|
+
#buildPool(config) {
|
|
20287
20312
|
if (isConnectionStringConfig(config)) {
|
|
20288
20313
|
return createConnectionStringPool(config);
|
|
20289
20314
|
}
|
|
@@ -20391,6 +20416,16 @@ var PostgresStoreVNext = class extends PostgresStore {
|
|
|
20391
20416
|
const observabilityClient = built.client;
|
|
20392
20417
|
this.#observabilityPool = built.pool;
|
|
20393
20418
|
this.#ownsObservabilityPool = built.owned;
|
|
20419
|
+
if (built.owned) {
|
|
20420
|
+
built.pool.on("error", (err) => {
|
|
20421
|
+
this.logger?.warn?.(
|
|
20422
|
+
"PostgresStoreVNext: idle observability pool client error (pool discards the client and reconnects on next checkout)",
|
|
20423
|
+
{
|
|
20424
|
+
err: err instanceof Error ? err.message : err
|
|
20425
|
+
}
|
|
20426
|
+
);
|
|
20427
|
+
});
|
|
20428
|
+
}
|
|
20394
20429
|
const observability = new ObservabilityStoragePostgresVNext({
|
|
20395
20430
|
client: observabilityClient,
|
|
20396
20431
|
schemaName: obsConfig.schemaName ?? config.schemaName,
|