@healthzkit/mongo 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/mongodb.d.mts +1 -1
- package/dist/mongodb.mjs +1 -1
- package/dist/mongoose.d.mts +1 -1
- package/dist/mongoose.mjs +1 -1
- package/dist/shared-BiUsKU63.mjs +1 -0
- package/dist/{shared-C_B8UrQ_.d.mts → shared-D2N9p6gZ.d.mts} +1 -2
- package/package.json +8 -5
- package/dist/shared-B-1hAtzF.mjs +0 -1
package/dist/mongodb.d.mts
CHANGED
package/dist/mongodb.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,t}from"./shared-
|
|
1
|
+
import{n as e,t}from"./shared-BiUsKU63.mjs";function n(n){let r=null,i=null,a=null;async function o(e,t){return i??=(async()=>{let{MongoClient:n}=await import(`mongodb`),i=new n(e,t);return await i.connect(),r=i,i})().catch(e=>{throw i=null,r=null,e}),i}async function s(){if(`connectionString`in n&&n.connectionString)return o(n.connectionString,n.mongoOptions);if(`client`in n&&n.client)return a??=n.client.connect().then(()=>void 0).catch(e=>{throw a=null,e}),await a,n.client;throw Error(`mongoAdapter: provide a non-empty connectionString or a client`)}return{async check(){try{let t=await s(),r=Date.now();await t.db(`admin`).command({ping:1});let i=Date.now()-r,a=n.metadata?n.metadata(t):void 0;return e(i,a instanceof Promise?await a:a)}catch(e){return t(e)}},async close(){r&&(await r.close(),r=null,i=null)}}}export{n as mongodbAdapter};
|
package/dist/mongoose.d.mts
CHANGED
package/dist/mongoose.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,t}from"./shared-
|
|
1
|
+
import{n as e,t}from"./shared-BiUsKU63.mjs";function n(n){let r=null;async function i(e,t){return r??=(async()=>{let{default:n}=await import(`mongoose`);return await n.connect(e,t),n})().catch(e=>{throw r=null,e}),r}async function a(){if(`connectionString`in n&&n.connectionString)return i(n.connectionString,n.mongooseOptions);let e=n.connection;if(!e)throw Error(`mongoose adapter requires connection or connectionString`);return`readyState`in e&&e.readyState!==1&&await e.asPromise(),e}return{async check(){try{let t=await a(),r=Date.now(),i=`db`in t?t.db:t.connection.db;if(!i)throw Error(`mongoose adapter: database unavailable`);await i.admin().command({ping:1});let o=Date.now()-r,s=n.metadata?n.metadata(t):void 0;return e(o,s instanceof Promise?await s:s)}catch(e){return t(e)}}}}export{n as mongooseAdapter};
|
|
@@ -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 BaseMongoOptions<TClient> {
|
|
6
5
|
/**
|
|
7
6
|
* Optional function to populate metadata in the check result.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@healthzkit/mongo",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"license": "AGPL-3.0-only",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -20,17 +20,20 @@
|
|
|
20
20
|
"publishConfig": {
|
|
21
21
|
"access": "public"
|
|
22
22
|
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@healthzkit/shared": "0.0.0"
|
|
25
|
+
},
|
|
23
26
|
"devDependencies": {
|
|
24
27
|
"@types/mongodb": "^4.0.7",
|
|
25
28
|
"@types/mongoose": "^5.11.97",
|
|
26
|
-
"@types/node": "^
|
|
29
|
+
"@types/node": "^24",
|
|
27
30
|
"@typescript/native-preview": "7.0.0-dev.20260509.2",
|
|
28
31
|
"bumpp": "^11.1.0",
|
|
29
32
|
"mongodb": "^7.2.0",
|
|
30
33
|
"mongoose": "^9.6.2",
|
|
31
|
-
"typescript": "^
|
|
32
|
-
"vite-plus": "
|
|
33
|
-
"healthzkit": "0.0.
|
|
34
|
+
"typescript": "^5",
|
|
35
|
+
"vite-plus": "latest",
|
|
36
|
+
"healthzkit": "0.0.3"
|
|
34
37
|
},
|
|
35
38
|
"peerDependencies": {
|
|
36
39
|
"mongodb": ">=6.0.0 || >=7.0.0",
|
package/dist/shared-B-1hAtzF.mjs
DELETED
|
@@ -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))}}export{e as n,t};
|