@healthzkit/redis 0.0.3 → 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.
@@ -1,4 +1,4 @@
1
- import { n as HealthAdapter, t as BaseRedisOptions } from "./shared-tv0dhEh3.mjs";
1
+ import { n as HealthAdapter, t as BaseRedisOptions } from "./shared-DNaBfhKs.mjs";
2
2
  import { Redis, RedisOptions } from "ioredis";
3
3
 
4
4
  //#region src/ioredis.d.ts
package/dist/ioredis.mjs CHANGED
@@ -1 +1 @@
1
- import{n as e,r as t}from"./shared-Ay4IMNoW.mjs";function n(n){let r=null;async function i(){if(`connectionString`in n&&n.connectionString){if(!r){let{Redis:e}=await import(`ioredis`);r=new e(n.connectionString,{maxRetriesPerRequest:1,enableReadyCheck:!1,...n.redisOptions})}return r}if(`client`in n&&n.client!==void 0)return n.client;throw Error(`ioredisAdapter: provide a non-empty connectionString or a client`)}return{async check(){try{let t=await i(),r=Date.now();await t.call(n.command??`PING`);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 ioredisAdapter};
1
+ import{n as e,r as t}from"./shared-DTLVNl-N.mjs";function n(n){let r=null;async function i(){if(`connectionString`in n&&n.connectionString){if(!r){let{Redis:e}=await import(`ioredis`);r=new e(n.connectionString,{maxRetriesPerRequest:1,enableReadyCheck:!1,...n.redisOptions})}return r}if(`client`in n&&n.client!==void 0)return n.client;throw Error(`ioredisAdapter: provide a non-empty connectionString or a client`)}return{async check(){try{let e=await i(),r=Date.now();await e.call(n.command??`PING`);let a=Date.now()-r,o=n.metadata?n.metadata(e):void 0;return t(a,o instanceof Promise?await o:o)}catch(t){return e(t)}}}}export{n as ioredisAdapter};
package/dist/redis.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { n as HealthAdapter, t as BaseRedisOptions } from "./shared-tv0dhEh3.mjs";
1
+ import { n as HealthAdapter, t as BaseRedisOptions } from "./shared-DNaBfhKs.mjs";
2
2
  import { RedisClientOptions, RedisClientType, RespVersions } from "redis";
3
3
 
4
4
  //#region src/redis.d.ts
package/dist/redis.mjs CHANGED
@@ -1 +1 @@
1
- import{n as e,r as t}from"./shared-Ay4IMNoW.mjs";function n(n){let r=null;async function i(){if(`connectionString`in n&&n.connectionString){if(!r){let{createClient:e}=await import(`redis`),t=e({url:n.connectionString,...n.redisOptions});await t.connect(),r=t}return r}if(`client`in n&&n.client!==void 0){let e=n.client;return e.isOpen||await e.connect(),e}throw Error(`nodeRedisAdapter: provide a non-empty connectionString or a client`)}return{async check(){try{let t=await i(),r=Date.now();await t.sendCommand((n.command??`PING`).split(` `));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 nodeRedisAdapter};
1
+ import{n as e,r as t}from"./shared-DTLVNl-N.mjs";function n(n){let r=null;async function i(){if(`connectionString`in n&&n.connectionString){if(!r){let{createClient:e}=await import(`redis`),t=e({url:n.connectionString,...n.redisOptions});await t.connect(),r=t}return r}if(`client`in n&&n.client!==void 0){let e=n.client;return e.isOpen||await e.connect(),e}throw Error(`nodeRedisAdapter: provide a non-empty connectionString or a client`)}return{async check(){try{let e=await i(),r=Date.now();await e.sendCommand((n.command??`PING`).split(` `));let a=Date.now()-r,o=n.metadata?n.metadata(e):void 0;return t(a,o instanceof Promise?await o:o)}catch(t){return e(t)}}}}export{n as nodeRedisAdapter};
@@ -1,9 +1,5 @@
1
- import { HealthAdapter } from "healthzkit";
1
+ import { HealthAdapter, MetadataFn } from "@healthzkit/shared";
2
2
 
3
- //#region ../../tools/shared/dist/index.d.mts
4
- //#region src/index.d.ts
5
- type MetadataFn<TClient> = (client: TClient) => Promise<Record<string, unknown>> | Record<string, unknown>;
6
- //#endregion
7
3
  //#region src/shared.d.ts
8
4
  interface BaseRedisOptions<TClient> {
9
5
  /**
@@ -0,0 +1 @@
1
+ import{buildErrorResult as e,buildResult as t}from"@healthzkit/shared";const n=`PING`;export{e as n,t as r,n as t};
@@ -1,4 +1,4 @@
1
- import { n as HealthAdapter, t as BaseRedisOptions } from "./shared-tv0dhEh3.mjs";
1
+ import { n as HealthAdapter, t as BaseRedisOptions } from "./shared-DNaBfhKs.mjs";
2
2
  import { Redis } from "@upstash/redis";
3
3
 
4
4
  //#region src/upstash.d.ts
package/dist/upstash.mjs CHANGED
@@ -1 +1 @@
1
- import{n as e,r as t}from"./shared-Ay4IMNoW.mjs";function n(n){let r=null;async function i(){if(`url`in n&&n.url){if(!r){let{Redis:e}=await import(`@upstash/redis`);r=new e({url:n.url,token:n.token})}return r}if(`client`in n&&n.client!==void 0)return n.client;throw Error(`upstashAdapter: provide url and token, or a client`)}return{async check(){try{let t=await i(),r=Date.now();if(n.command&&n.command!==`PING`){let[e,...r]=n.command.split(` `);await t.exec([e,...r])}else await t.ping();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 upstashAdapter};
1
+ import{n as e,r as t}from"./shared-DTLVNl-N.mjs";function n(n){let r=null;async function i(){if(`url`in n&&n.url){if(!r){let{Redis:e}=await import(`@upstash/redis`);r=new e({url:n.url,token:n.token})}return r}if(`client`in n&&n.client!==void 0)return n.client;throw Error(`upstashAdapter: provide url and token, or a client`)}return{async check(){try{let e=await i(),r=Date.now();if(n.command&&n.command!==`PING`){let[t,...r]=n.command.split(` `);await e.exec([t,...r])}else await e.ping();let a=Date.now()-r,o=n.metadata?n.metadata(e):void 0;return t(a,o instanceof Promise?await o:o)}catch(t){return e(t)}}}}export{n as upstashAdapter};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@healthzkit/redis",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "license": "AGPL-3.0-only",
5
5
  "repository": {
6
6
  "type": "git",
@@ -21,6 +21,9 @@
21
21
  "publishConfig": {
22
22
  "access": "public"
23
23
  },
24
+ "dependencies": {
25
+ "@healthzkit/shared": "0.0.0"
26
+ },
24
27
  "devDependencies": {
25
28
  "@types/node": "^24",
26
29
  "@typescript/native-preview": "7.0.0-dev.20260328.1",
@@ -30,7 +33,6 @@
30
33
  "redis": "^5.12.1",
31
34
  "typescript": "^5",
32
35
  "vite-plus": "latest",
33
- "@healthzkit/shared": "0.0.0",
34
36
  "healthzkit": "0.0.3"
35
37
  },
36
38
  "peerDependencies": {
@@ -1 +0,0 @@
1
- function e(e,t){return{status:`ok`,metadata:{...t,latencyMs:e}}}function t(e){return{status:`fail`,error:e instanceof Error?e:Error(String(e))}}const n=`PING`;export{e as n,t as r,n as t};