@adalo/metrics 0.1.126 → 0.1.127

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,8 +1,3 @@
1
- declare namespace _default {
2
- export { createHealthCheckWorkerClient };
3
- export { createHealthCheckEndpointClient };
4
- }
5
- export default _default;
6
1
  /**
7
2
  * Creates a health check client for worker process.
8
3
  * Worker needs database config to perform health checks and store results in Redis.
@@ -17,7 +12,7 @@ export default _default;
17
12
  * @param {number} [options.cacheTtlMs=60000] - Cache TTL in milliseconds
18
13
  * @returns {HealthCheckClient} Configured health check client instance for worker
19
14
  */
20
- declare function createHealthCheckWorkerClient(options: {
15
+ export function createHealthCheckWorkerClient(options: {
21
16
  databaseUrl: string;
22
17
  databaseName: string;
23
18
  redisClient: any;
@@ -38,7 +33,7 @@ declare function createHealthCheckWorkerClient(options: {
38
33
  * @param {number} [options.cacheTtlMs=60000] - Cache TTL in milliseconds
39
34
  * @returns {HealthCheckClient} Configured health check client instance for endpoints
40
35
  */
41
- declare function createHealthCheckEndpointClient(options: {
36
+ export function createHealthCheckEndpointClient(options: {
42
37
  redisClient: any;
43
38
  includeRedisCheck?: boolean | undefined;
44
39
  cacheTtlMs?: number | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"healthCheckUtils.d.ts","sourceRoot":"","sources":["../../src/health/healthCheckUtils.js"],"names":[],"mappings":";;;;;AAEA;;;;;;;;;;;;;GAaG;AACH;IAT2B,WAAW,EAA3B,MAAM;IACU,YAAY,EAA5B,MAAM;IACO,WAAW,EAAxB,GAAG;IACc,OAAO;IACS,sBAAsB;;;IACrC,iBAAiB;IAClB,UAAU;IACzB,iBAAiB,CA+B7B;AAED;;;;;;;;;GASG;AACH;IALwB,WAAW,EAAxB,GAAG;IACe,iBAAiB;IAClB,UAAU;IACzB,iBAAiB,CAiB7B"}
1
+ {"version":3,"file":"healthCheckUtils.d.ts","sourceRoot":"","sources":["../../src/health/healthCheckUtils.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AACH;IAT2B,WAAW,EAA3B,MAAM;IACU,YAAY,EAA5B,MAAM;IACO,WAAW,EAAxB,GAAG;IACc,OAAO;IACS,sBAAsB;;;IACrC,iBAAiB;IAClB,UAAU;IACzB,iBAAiB,CA+B7B;AAED;;;;;;;;;GASG;AACH;IALwB,WAAW,EAAxB,GAAG;IACe,iBAAiB;IAClB,UAAU;IACzB,iBAAiB,CAiB7B"}
@@ -1,10 +1,9 @@
1
1
  "use strict";
2
2
 
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _healthCheckClient = require("./healthCheckClient");
3
+ const {
4
+ HealthCheckClient
5
+ } = require('./healthCheckClient');
6
+
8
7
  /**
9
8
  * Creates a health check client for worker process.
10
9
  * Worker needs database config to perform health checks and store results in Redis.
@@ -43,7 +42,7 @@ function createHealthCheckWorkerClient(options) {
43
42
  if (additionalDatabaseUrls) {
44
43
  clientOptions.additionalDatabaseUrls = additionalDatabaseUrls;
45
44
  }
46
- return new _healthCheckClient.HealthCheckClient(clientOptions);
45
+ return new HealthCheckClient(clientOptions);
47
46
  }
48
47
 
49
48
  /**
@@ -65,14 +64,14 @@ function createHealthCheckEndpointClient(options) {
65
64
  if (!redisClient) {
66
65
  throw new Error('redisClient is required for createHealthCheckEndpointClient');
67
66
  }
68
- return new _healthCheckClient.HealthCheckClient({
67
+ return new HealthCheckClient({
69
68
  appName: process.env.BUILD_APP_NAME || 'unknown-app',
70
69
  redisClient,
71
70
  cacheTtlMs,
72
71
  includeRedisCheck
73
72
  });
74
73
  }
75
- var _default = exports.default = {
74
+ module.exports = {
76
75
  createHealthCheckWorkerClient,
77
76
  createHealthCheckEndpointClient
78
77
  };
@@ -1 +1 @@
1
- {"version":3,"file":"healthCheckUtils.js","names":["_healthCheckClient","require","createHealthCheckWorkerClient","options","databaseUrl","databaseName","redisClient","appName","additionalDatabaseUrls","includeRedisCheck","cacheTtlMs","Error","clientOptions","process","env","BUILD_APP_NAME","HealthCheckClient","createHealthCheckEndpointClient","_default","exports","default"],"sources":["../../src/health/healthCheckUtils.js"],"sourcesContent":["import { HealthCheckClient } from './healthCheckClient'\n\n/**\n * Creates a health check client for worker process.\n * Worker needs database config to perform health checks and store results in Redis.\n *\n * @param {Object} options\n * @param {string} options.databaseUrl - Main database URL\n * @param {string} options.databaseName - Database name\n * @param {any} options.redisClient - Redis client instance (from service config with appropriate name)\n * @param {string} [options.appName] - Application name (defaults to BUILD_APP_NAME)\n * @param {Object<string, string>} [options.additionalDatabaseUrls] - Additional database clusters (for database service)\n * @param {boolean} [options.includeRedisCheck=false] - Include Redis health check in response\n * @param {number} [options.cacheTtlMs=60000] - Cache TTL in milliseconds\n * @returns {HealthCheckClient} Configured health check client instance for worker\n */\nfunction createHealthCheckWorkerClient(options) {\n const {\n databaseUrl,\n databaseName,\n redisClient,\n appName,\n additionalDatabaseUrls,\n includeRedisCheck = false,\n cacheTtlMs = 60000,\n } = options\n\n if (!redisClient) {\n throw new Error('redisClient is required for createHealthCheckWorkerClient')\n }\n\n const clientOptions = {\n databaseUrl,\n databaseName,\n appName: appName || process.env.BUILD_APP_NAME || 'unknown-app',\n redisClient,\n includeRedisCheck,\n cacheTtlMs,\n }\n\n if (additionalDatabaseUrls) {\n clientOptions.additionalDatabaseUrls = additionalDatabaseUrls\n }\n\n return new HealthCheckClient(clientOptions)\n}\n\n/**\n * Creates a health check client for endpoint handlers.\n * Endpoints only read from cache, so they only need Redis client (no database config).\n *\n * @param {Object} options\n * @param {any} options.redisClient - Existing Redis client instance (from system) - REQUIRED\n * @param {boolean} [options.includeRedisCheck=false] - Include Redis health check in response (for backend)\n * @param {number} [options.cacheTtlMs=60000] - Cache TTL in milliseconds\n * @returns {HealthCheckClient} Configured health check client instance for endpoints\n */\nfunction createHealthCheckEndpointClient(options) {\n const { redisClient, includeRedisCheck = false, cacheTtlMs = 60000 } = options\n\n if (!redisClient) {\n throw new Error(\n 'redisClient is required for createHealthCheckEndpointClient'\n )\n }\n\n return new HealthCheckClient({\n appName: process.env.BUILD_APP_NAME || 'unknown-app',\n redisClient,\n cacheTtlMs,\n includeRedisCheck,\n })\n}\n\nexport default {\n createHealthCheckWorkerClient,\n createHealthCheckEndpointClient,\n}\n"],"mappings":";;;;;;AAAA,IAAAA,kBAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,6BAA6BA,CAACC,OAAO,EAAE;EAC9C,MAAM;IACJC,WAAW;IACXC,YAAY;IACZC,WAAW;IACXC,OAAO;IACPC,sBAAsB;IACtBC,iBAAiB,GAAG,KAAK;IACzBC,UAAU,GAAG;EACf,CAAC,GAAGP,OAAO;EAEX,IAAI,CAACG,WAAW,EAAE;IAChB,MAAM,IAAIK,KAAK,CAAC,2DAA2D,CAAC;EAC9E;EAEA,MAAMC,aAAa,GAAG;IACpBR,WAAW;IACXC,YAAY;IACZE,OAAO,EAAEA,OAAO,IAAIM,OAAO,CAACC,GAAG,CAACC,cAAc,IAAI,aAAa;IAC/DT,WAAW;IACXG,iBAAiB;IACjBC;EACF,CAAC;EAED,IAAIF,sBAAsB,EAAE;IAC1BI,aAAa,CAACJ,sBAAsB,GAAGA,sBAAsB;EAC/D;EAEA,OAAO,IAAIQ,oCAAiB,CAACJ,aAAa,CAAC;AAC7C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASK,+BAA+BA,CAACd,OAAO,EAAE;EAChD,MAAM;IAAEG,WAAW;IAAEG,iBAAiB,GAAG,KAAK;IAAEC,UAAU,GAAG;EAAM,CAAC,GAAGP,OAAO;EAE9E,IAAI,CAACG,WAAW,EAAE;IAChB,MAAM,IAAIK,KAAK,CACb,6DACF,CAAC;EACH;EAEA,OAAO,IAAIK,oCAAiB,CAAC;IAC3BT,OAAO,EAAEM,OAAO,CAACC,GAAG,CAACC,cAAc,IAAI,aAAa;IACpDT,WAAW;IACXI,UAAU;IACVD;EACF,CAAC,CAAC;AACJ;AAAC,IAAAS,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEc;EACblB,6BAA6B;EAC7Be;AACF,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"healthCheckUtils.js","names":["HealthCheckClient","require","createHealthCheckWorkerClient","options","databaseUrl","databaseName","redisClient","appName","additionalDatabaseUrls","includeRedisCheck","cacheTtlMs","Error","clientOptions","process","env","BUILD_APP_NAME","createHealthCheckEndpointClient","module","exports"],"sources":["../../src/health/healthCheckUtils.js"],"sourcesContent":["const { HealthCheckClient } = require('./healthCheckClient')\n\n/**\n * Creates a health check client for worker process.\n * Worker needs database config to perform health checks and store results in Redis.\n *\n * @param {Object} options\n * @param {string} options.databaseUrl - Main database URL\n * @param {string} options.databaseName - Database name\n * @param {any} options.redisClient - Redis client instance (from service config with appropriate name)\n * @param {string} [options.appName] - Application name (defaults to BUILD_APP_NAME)\n * @param {Object<string, string>} [options.additionalDatabaseUrls] - Additional database clusters (for database service)\n * @param {boolean} [options.includeRedisCheck=false] - Include Redis health check in response\n * @param {number} [options.cacheTtlMs=60000] - Cache TTL in milliseconds\n * @returns {HealthCheckClient} Configured health check client instance for worker\n */\nfunction createHealthCheckWorkerClient(options) {\n const {\n databaseUrl,\n databaseName,\n redisClient,\n appName,\n additionalDatabaseUrls,\n includeRedisCheck = false,\n cacheTtlMs = 60000,\n } = options\n\n if (!redisClient) {\n throw new Error('redisClient is required for createHealthCheckWorkerClient')\n }\n\n const clientOptions = {\n databaseUrl,\n databaseName,\n appName: appName || process.env.BUILD_APP_NAME || 'unknown-app',\n redisClient,\n includeRedisCheck,\n cacheTtlMs,\n }\n\n if (additionalDatabaseUrls) {\n clientOptions.additionalDatabaseUrls = additionalDatabaseUrls\n }\n\n return new HealthCheckClient(clientOptions)\n}\n\n/**\n * Creates a health check client for endpoint handlers.\n * Endpoints only read from cache, so they only need Redis client (no database config).\n *\n * @param {Object} options\n * @param {any} options.redisClient - Existing Redis client instance (from system) - REQUIRED\n * @param {boolean} [options.includeRedisCheck=false] - Include Redis health check in response (for backend)\n * @param {number} [options.cacheTtlMs=60000] - Cache TTL in milliseconds\n * @returns {HealthCheckClient} Configured health check client instance for endpoints\n */\nfunction createHealthCheckEndpointClient(options) {\n const { redisClient, includeRedisCheck = false, cacheTtlMs = 60000 } = options\n\n if (!redisClient) {\n throw new Error(\n 'redisClient is required for createHealthCheckEndpointClient'\n )\n }\n\n return new HealthCheckClient({\n appName: process.env.BUILD_APP_NAME || 'unknown-app',\n redisClient,\n cacheTtlMs,\n includeRedisCheck,\n })\n}\n\nmodule.exports = {\n createHealthCheckWorkerClient,\n createHealthCheckEndpointClient,\n}\n"],"mappings":";;AAAA,MAAM;EAAEA;AAAkB,CAAC,GAAGC,OAAO,CAAC,qBAAqB,CAAC;;AAE5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,6BAA6BA,CAACC,OAAO,EAAE;EAC9C,MAAM;IACJC,WAAW;IACXC,YAAY;IACZC,WAAW;IACXC,OAAO;IACPC,sBAAsB;IACtBC,iBAAiB,GAAG,KAAK;IACzBC,UAAU,GAAG;EACf,CAAC,GAAGP,OAAO;EAEX,IAAI,CAACG,WAAW,EAAE;IAChB,MAAM,IAAIK,KAAK,CAAC,2DAA2D,CAAC;EAC9E;EAEA,MAAMC,aAAa,GAAG;IACpBR,WAAW;IACXC,YAAY;IACZE,OAAO,EAAEA,OAAO,IAAIM,OAAO,CAACC,GAAG,CAACC,cAAc,IAAI,aAAa;IAC/DT,WAAW;IACXG,iBAAiB;IACjBC;EACF,CAAC;EAED,IAAIF,sBAAsB,EAAE;IAC1BI,aAAa,CAACJ,sBAAsB,GAAGA,sBAAsB;EAC/D;EAEA,OAAO,IAAIR,iBAAiB,CAACY,aAAa,CAAC;AAC7C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASI,+BAA+BA,CAACb,OAAO,EAAE;EAChD,MAAM;IAAEG,WAAW;IAAEG,iBAAiB,GAAG,KAAK;IAAEC,UAAU,GAAG;EAAM,CAAC,GAAGP,OAAO;EAE9E,IAAI,CAACG,WAAW,EAAE;IAChB,MAAM,IAAIK,KAAK,CACb,6DACF,CAAC;EACH;EAEA,OAAO,IAAIX,iBAAiB,CAAC;IAC3BO,OAAO,EAAEM,OAAO,CAACC,GAAG,CAACC,cAAc,IAAI,aAAa;IACpDT,WAAW;IACXI,UAAU;IACVD;EACF,CAAC,CAAC;AACJ;AAEAQ,MAAM,CAACC,OAAO,GAAG;EACfhB,6BAA6B;EAC7Bc;AACF,CAAC","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adalo/metrics",
3
- "version": "0.1.126",
3
+ "version": "0.1.127",
4
4
  "description": "Reusable metrics utilities for Node.js and Laravel apps",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -1,4 +1,4 @@
1
- import { HealthCheckClient } from './healthCheckClient'
1
+ const { HealthCheckClient } = require('./healthCheckClient')
2
2
 
3
3
  /**
4
4
  * Creates a health check client for worker process.
@@ -72,7 +72,7 @@ function createHealthCheckEndpointClient(options) {
72
72
  })
73
73
  }
74
74
 
75
- export default {
75
+ module.exports = {
76
76
  createHealthCheckWorkerClient,
77
77
  createHealthCheckEndpointClient,
78
78
  }