@devmoods/express-extras 0.13.8 → 0.13.9
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/listen.js +7 -1
- package/dist/logger.d.ts +3 -2
- package/dist/logger.js +20 -3
- package/dist/redis.d.ts +32 -2
- package/dist/sentry.d.ts +1 -0
- package/package.json +6 -6
package/dist/listen.js
CHANGED
|
@@ -36,7 +36,13 @@ function listen(server, options) {
|
|
|
36
36
|
if (state.isShuttingDown) {
|
|
37
37
|
return false;
|
|
38
38
|
}
|
|
39
|
-
|
|
39
|
+
try {
|
|
40
|
+
await ((_a = options === null || options === void 0 ? void 0 : options.healthCheck) === null || _a === void 0 ? void 0 : _a.call(options));
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
options.logger.error(error, 'health check failed');
|
|
44
|
+
throw error;
|
|
45
|
+
}
|
|
40
46
|
},
|
|
41
47
|
},
|
|
42
48
|
});
|
package/dist/logger.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CreateSentry } from './sentry';
|
|
1
2
|
export interface LoggerOptions {
|
|
2
3
|
/**
|
|
3
4
|
* Name of the logger
|
|
@@ -14,7 +15,8 @@ export interface LoggerOptions {
|
|
|
14
15
|
*/
|
|
15
16
|
silent?: () => boolean;
|
|
16
17
|
}
|
|
17
|
-
declare
|
|
18
|
+
export declare function attachSentryClientToLoggers(sentryClient: CreateSentry['client']): void;
|
|
19
|
+
export declare type Logger = ReturnType<typeof createLogger>;
|
|
18
20
|
export declare function createLogger({ name, getContext, silent, }: LoggerOptions): {
|
|
19
21
|
debug(message: string, context?: {
|
|
20
22
|
[key: string]: any;
|
|
@@ -42,4 +44,3 @@ export declare function getLoggers(): Map<string, {
|
|
|
42
44
|
error(error: Error | null, message?: string | undefined): void;
|
|
43
45
|
fatal(error: Error | null, message?: string | undefined): void;
|
|
44
46
|
}>;
|
|
45
|
-
export {};
|
package/dist/logger.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getLoggers = exports.getLogger = exports.createLogger = void 0;
|
|
6
|
+
exports.getLoggers = exports.getLogger = exports.createLogger = exports.attachSentryClientToLoggers = void 0;
|
|
7
7
|
const bunyan_1 = __importDefault(require("bunyan"));
|
|
8
8
|
const context_1 = require("./context");
|
|
9
9
|
function defaultGetContext() {
|
|
@@ -12,6 +12,11 @@ function defaultGetContext() {
|
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
14
|
const _loggers = new Map();
|
|
15
|
+
let _sentryClient;
|
|
16
|
+
function attachSentryClientToLoggers(sentryClient) {
|
|
17
|
+
_sentryClient = sentryClient;
|
|
18
|
+
}
|
|
19
|
+
exports.attachSentryClientToLoggers = attachSentryClientToLoggers;
|
|
15
20
|
function createLogger({ name, getContext, silent = () => process.env.NODE_ENV === 'test', }) {
|
|
16
21
|
if (_loggers.has(name)) {
|
|
17
22
|
throw new Error(`A logger named ${name} already exists`);
|
|
@@ -41,12 +46,24 @@ function createLogger({ name, getContext, silent = () => process.env.NODE_ENV ==
|
|
|
41
46
|
return logger.child(getFinalContext(), true).warn(context, message);
|
|
42
47
|
},
|
|
43
48
|
error(error, message) {
|
|
49
|
+
const context = getFinalContext();
|
|
50
|
+
if (_sentryClient != null) {
|
|
51
|
+
_sentryClient.captureException(error, {
|
|
52
|
+
tags: context,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
44
55
|
return logger
|
|
45
|
-
.child(
|
|
56
|
+
.child(context, true)
|
|
46
57
|
.error(error, message || (error === null || error === void 0 ? void 0 : error.message));
|
|
47
58
|
},
|
|
48
59
|
fatal(error, message) {
|
|
49
|
-
|
|
60
|
+
const context = getFinalContext();
|
|
61
|
+
if (_sentryClient != null) {
|
|
62
|
+
_sentryClient.captureException(error, {
|
|
63
|
+
tags: context,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
return logger.child(context, true).fatal(error, message);
|
|
50
67
|
},
|
|
51
68
|
};
|
|
52
69
|
}
|
package/dist/redis.d.ts
CHANGED
|
@@ -17,10 +17,10 @@ export declare function createRedis({ url, onError, }: RedisOptions): import("@r
|
|
|
17
17
|
list: typeof import("@redis/graph/dist/commands/LIST");
|
|
18
18
|
PROFILE: typeof import("@redis/graph/dist/commands/PROFILE");
|
|
19
19
|
profile: typeof import("@redis/graph/dist/commands/PROFILE");
|
|
20
|
-
QUERY_RO: typeof import("@redis/graph/dist/commands/QUERY_RO");
|
|
21
|
-
queryRo: typeof import("@redis/graph/dist/commands/QUERY_RO");
|
|
22
20
|
QUERY: typeof import("@redis/graph/dist/commands/QUERY");
|
|
23
21
|
query: typeof import("@redis/graph/dist/commands/QUERY");
|
|
22
|
+
RO_QUERY: typeof import("@redis/graph/dist/commands/RO_QUERY");
|
|
23
|
+
roQuery: typeof import("@redis/graph/dist/commands/RO_QUERY");
|
|
24
24
|
SLOWLOG: typeof import("@redis/graph/dist/commands/SLOWLOG");
|
|
25
25
|
slowLog: typeof import("@redis/graph/dist/commands/SLOWLOG");
|
|
26
26
|
};
|
|
@@ -236,6 +236,36 @@ export declare function createRedis({ url, onError, }: RedisOptions): import("@r
|
|
|
236
236
|
SCANDUMP: typeof import("@redis/bloom/dist/commands/cuckoo/SCANDUMP");
|
|
237
237
|
scanDump: typeof import("@redis/bloom/dist/commands/cuckoo/SCANDUMP");
|
|
238
238
|
};
|
|
239
|
+
tDigest: {
|
|
240
|
+
ADD: typeof import("@redis/bloom/dist/commands/t-digest/ADD");
|
|
241
|
+
add: typeof import("@redis/bloom/dist/commands/t-digest/ADD");
|
|
242
|
+
BYRANK: typeof import("@redis/bloom/dist/commands/t-digest/BYRANK");
|
|
243
|
+
byRank: typeof import("@redis/bloom/dist/commands/t-digest/BYRANK");
|
|
244
|
+
BYREVRANK: typeof import("@redis/bloom/dist/commands/t-digest/BYREVRANK");
|
|
245
|
+
byRevRank: typeof import("@redis/bloom/dist/commands/t-digest/BYREVRANK");
|
|
246
|
+
CDF: typeof import("@redis/bloom/dist/commands/t-digest/CDF");
|
|
247
|
+
cdf: typeof import("@redis/bloom/dist/commands/t-digest/CDF");
|
|
248
|
+
CREATE: typeof import("@redis/bloom/dist/commands/t-digest/CREATE");
|
|
249
|
+
create: typeof import("@redis/bloom/dist/commands/t-digest/CREATE");
|
|
250
|
+
INFO: typeof import("@redis/bloom/dist/commands/t-digest/INFO");
|
|
251
|
+
info: typeof import("@redis/bloom/dist/commands/t-digest/INFO");
|
|
252
|
+
MAX: typeof import("@redis/bloom/dist/commands/t-digest/MAX");
|
|
253
|
+
max: typeof import("@redis/bloom/dist/commands/t-digest/MAX");
|
|
254
|
+
MERGE: typeof import("@redis/bloom/dist/commands/t-digest/MERGE");
|
|
255
|
+
merge: typeof import("@redis/bloom/dist/commands/t-digest/MERGE");
|
|
256
|
+
MIN: typeof import("@redis/bloom/dist/commands/t-digest/MIN");
|
|
257
|
+
min: typeof import("@redis/bloom/dist/commands/t-digest/MIN");
|
|
258
|
+
QUANTILE: typeof import("@redis/bloom/dist/commands/t-digest/QUANTILE");
|
|
259
|
+
quantile: typeof import("@redis/bloom/dist/commands/t-digest/QUANTILE");
|
|
260
|
+
RANK: typeof import("@redis/bloom/dist/commands/t-digest/RANK");
|
|
261
|
+
rank: typeof import("@redis/bloom/dist/commands/t-digest/RANK");
|
|
262
|
+
RESET: typeof import("@redis/bloom/dist/commands/t-digest/RESET");
|
|
263
|
+
reset: typeof import("@redis/bloom/dist/commands/t-digest/RESET");
|
|
264
|
+
REVRANK: typeof import("@redis/bloom/dist/commands/t-digest/REVRANK");
|
|
265
|
+
revRank: typeof import("@redis/bloom/dist/commands/t-digest/REVRANK");
|
|
266
|
+
TRIMMED_MEAN: typeof import("@redis/bloom/dist/commands/t-digest/TRIMMED_MEAN");
|
|
267
|
+
trimmedMean: typeof import("@redis/bloom/dist/commands/t-digest/TRIMMED_MEAN");
|
|
268
|
+
};
|
|
239
269
|
topK: {
|
|
240
270
|
ADD: typeof import("@redis/bloom/dist/commands/top-k/ADD");
|
|
241
271
|
add: typeof import("@redis/bloom/dist/commands/top-k/ADD");
|
package/dist/sentry.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devmoods/express-extras",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.9",
|
|
4
4
|
"description": "Kubernetes-ready utilities for rapid Node.js application development",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
],
|
|
33
33
|
"license": "ISC",
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@types/jest": "29.2.
|
|
36
|
-
"@types/node": "18.11.
|
|
35
|
+
"@types/jest": "29.2.2",
|
|
36
|
+
"@types/node": "18.11.9",
|
|
37
37
|
"@types/supertest": "2.0.12",
|
|
38
38
|
"import-sort-cli": "6.0.0",
|
|
39
39
|
"import-sort-style-module": "6.0.0",
|
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@devmoods/fetch": "^3.3.0",
|
|
50
50
|
"@godaddy/terminus": "^4.11.2",
|
|
51
|
-
"@sentry/node": "^7.
|
|
52
|
-
"@sentry/tracing": "^7.17.
|
|
51
|
+
"@sentry/node": "^7.17.4",
|
|
52
|
+
"@sentry/tracing": "^7.17.4",
|
|
53
53
|
"@types/bcrypt": "^5.0.0",
|
|
54
54
|
"@types/bunyan": "^1.8.8",
|
|
55
55
|
"@types/cls-hooked": "^4.3.3",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"meow": "^9.0.0",
|
|
73
73
|
"nodemailer": "^6.8.0",
|
|
74
74
|
"pg": "^8.8.0",
|
|
75
|
-
"redis": "^4.
|
|
75
|
+
"redis": "^4.4.0",
|
|
76
76
|
"sql-template-strings": "^2.2.2",
|
|
77
77
|
"uuid": "^8.3.2"
|
|
78
78
|
},
|