@healthzkit/postgres 0.0.2 → 0.0.4

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/dist/pg.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { n as HealthAdapter, t as BasePostgresOptions } from "./shared-CTJ6HzL3.mjs";
1
+ import { n as HealthAdapter, t as BasePostgresOptions } from "./shared-DrvDn_UQ.mjs";
2
2
  import { ClientBase, Pool, PoolClient } from "pg";
3
3
 
4
4
  //#region src/pg.d.ts
package/dist/pg.mjs CHANGED
@@ -1 +1 @@
1
- import{n as e,t}from"./shared-BhE-9Ws4.mjs";function n(n){let r=null;async function i(){if(`connectionString`in n&&n.connectionString){let{Pool:e}=await import(`pg`);r||=new e({connectionString:n.connectionString,max:1});let t=await r.connect();return{client:t,release:()=>t.release()}}let e=n.client;if(`connect`in e&&typeof e.connect==`function`){let t=await e.connect();return{client:t,release:()=>t.release()}}return{client:n.client,release:()=>{}}}return{async check(){let r=()=>{};try{let t=Date.now(),{client:a,release:o}=await i();return r=o,await a.query(n.query??`SELECT 1`),e(Date.now()-t,n.metadata?await n.metadata(a):void 0)}catch(e){return t(e)}finally{r()}}}}export{n as pgAdapter};
1
+ import{n as e,t}from"./shared-BiUsKU63.mjs";function n(n){let r=null;async function i(){if(`connectionString`in n&&n.connectionString){let{Pool:e}=await import(`pg`);r||=new e({connectionString:n.connectionString,max:1});let t=await r.connect();return{client:t,release:()=>t.release()}}let e=n.client;if(`connect`in e&&typeof e.connect==`function`){let t=await e.connect();return{client:t,release:()=>t.release()}}return{client:n.client,release:()=>{}}}return{async check(){let r=()=>{};try{let t=Date.now(),{client:a,release:o}=await i();r=o,await a.query(n.query??`SELECT 1`);let s=Date.now()-t,c=n.metadata?n.metadata(a):void 0;return e(s,c instanceof Promise?await c:c)}catch(e){return t(e)}finally{r()}}}}export{n as pgAdapter};
@@ -1,4 +1,4 @@
1
- import { n as HealthAdapter, t as BasePostgresOptions } from "./shared-CTJ6HzL3.mjs";
1
+ import { n as HealthAdapter, t as BasePostgresOptions } from "./shared-DrvDn_UQ.mjs";
2
2
  import { Sql, TransactionSql } from "postgres";
3
3
 
4
4
  //#region src/postgres.d.ts
package/dist/postgres.mjs CHANGED
@@ -1 +1 @@
1
- import{n as e,t}from"./shared-BhE-9Ws4.mjs";function n(n){let r=null;async function i(){if(`connectionString`in n&&n.connectionString){let e=await import(`postgres`),t=e.default??e;return r||=t(n.connectionString,{max:1}),r}return n.client}return{async check(){try{let t=await i(),r=Date.now();return await t.unsafe(n.query??`SELECT 1`),e(Date.now()-r,n.metadata?await n.metadata(t):void 0)}catch(e){return t(e)}}}}export{n as postgresJsAdapter};
1
+ import{n as e,t}from"./shared-BiUsKU63.mjs";function n(n){let r=null;async function i(){if(`connectionString`in n&&n.connectionString){let e=await import(`postgres`),t=e.default??e;return r||=t(n.connectionString,{max:1}),r}return n.client}return{async check(){try{let t=await i(),r=Date.now();await t.unsafe(n.query??`SELECT 1`);let a=Date.now()-r,o=n.metadata?n.metadata(t):void 0;return e(a,o instanceof Promise?await o:o)}catch(e){return t(e)}}}}export{n as postgresJsAdapter};
@@ -0,0 +1 @@
1
+ import{buildErrorResult as e,buildResult as t}from"@healthzkit/shared";export{t as n,e as t};
@@ -1,7 +1,6 @@
1
- import { HealthAdapter } from "healthzkit";
1
+ import { HealthAdapter, MetadataFn } from "@healthzkit/shared";
2
2
 
3
3
  //#region src/shared.d.ts
4
- type MetadataFn<TClient> = (client: TClient) => Promise<Record<string, unknown>>;
5
4
  interface BasePostgresOptions<TClient> {
6
5
  /**
7
6
  * Query to run as the healthcheck.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@healthzkit/postgres",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "license": "AGPL-3.0-only",
5
5
  "repository": {
6
6
  "type": "git",
@@ -20,16 +20,19 @@
20
20
  "publishConfig": {
21
21
  "access": "public"
22
22
  },
23
+ "dependencies": {
24
+ "@healthzkit/shared": "0.0.0"
25
+ },
23
26
  "devDependencies": {
24
- "@types/node": "^25.5.0",
27
+ "@types/node": "^24",
25
28
  "@types/pg": "^8.20.0",
26
29
  "@typescript/native-preview": "7.0.0-dev.20260328.1",
27
30
  "bumpp": "^11.0.1",
28
31
  "pg": "^8.20.0",
29
32
  "postgres": "^3.4.9",
30
- "typescript": "^6.0.2",
31
- "vite-plus": "^0.1.14",
32
- "healthzkit": "0.0.2"
33
+ "typescript": "^5",
34
+ "vite-plus": "latest",
35
+ "healthzkit": "0.0.3"
33
36
  },
34
37
  "peerDependencies": {
35
38
  "pg": ">=8.0.0",
@@ -1 +0,0 @@
1
- function e(e,t){return{status:`ok`,metadata:{latencyMs:e,...t}}}function t(e){return{status:`fail`,error:e instanceof Error?e:Error(String(e))}}export{e as n,t};