fastify-txstate 3.1.4 → 3.1.6

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/lib/index.js CHANGED
@@ -10,7 +10,7 @@ const http_1 = __importDefault(require("http"));
10
10
  const http_status_codes_1 = require("http-status-codes");
11
11
  exports.devLogger = {
12
12
  level: 'info',
13
- info: (msg) => console.info(msg.req ? `${msg.req.method} ${msg.req.url}` : msg.res ? `${msg.res.statusCode} - ${msg.responseTime}` : msg),
13
+ info: (msg) => { console.info(msg.req ? `${msg.req.method} ${msg.req.url}` : msg.res ? `${msg.res.statusCode} - ${msg.responseTime}` : msg); },
14
14
  error: console.error,
15
15
  debug: console.debug,
16
16
  fatal: console.error,
@@ -25,7 +25,7 @@ exports.prodLogger = {
25
25
  req(req) {
26
26
  return {
27
27
  method: req.method,
28
- url: req.url,
28
+ url: req.url.replace(/token=[\w.]+/, 'token=redacted'),
29
29
  remoteAddress: req.ip,
30
30
  traceparent: req.headers.traceparent
31
31
  };
@@ -34,7 +34,8 @@ exports.prodLogger = {
34
34
  var _a;
35
35
  return {
36
36
  statusCode: res.statusCode,
37
- url: (_a = res.request) === null || _a === void 0 ? void 0 : _a.url,
37
+ url: (_a = res.request) === null || _a === void 0 ? void 0 : _a.url.replace(/token=[\w.]+/, 'token=redacted'),
38
+ length: res.getHeader('content-length'),
38
39
  ...res.extraLogInfo
39
40
  };
40
41
  }
@@ -171,7 +172,7 @@ class Server {
171
172
  this.sigHandler = () => {
172
173
  this.close().then(() => {
173
174
  process.exit();
174
- }).catch(e => console.error(e));
175
+ }).catch(e => { console.error(e); });
175
176
  };
176
177
  process.on('SIGTERM', this.sigHandler);
177
178
  process.on('SIGINT', this.sigHandler);
@@ -1,6 +1,6 @@
1
1
  /// <reference types="node" />
2
- import { FastifyInstance, FastifyRequest, FastifyReply, FastifyServerOptions, FastifyLoggerOptions } from 'fastify';
3
- import http2 from 'http2';
2
+ import { type FastifyInstance, type FastifyRequest, type FastifyReply, type FastifyServerOptions, type FastifyLoggerOptions } from 'fastify';
3
+ import type http2 from 'http2';
4
4
  type ErrorHandler = (error: Error, req: FastifyRequest, res: FastifyReply) => Promise<void>;
5
5
  export interface FastifyTxStateOptions extends Partial<FastifyServerOptions> {
6
6
  https?: http2.SecureServerOptions;
@@ -68,9 +68,7 @@ export declare class HttpError extends Error {
68
68
  statusCode: number;
69
69
  constructor(statusCode: number, message?: string);
70
70
  }
71
- interface ValidationErrors {
72
- [keys: string]: string[];
73
- }
71
+ type ValidationErrors = Record<string, string[]>;
74
72
  export declare class FailedValidationError extends HttpError {
75
73
  errors: ValidationErrors;
76
74
  constructor(errors: ValidationErrors);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fastify-txstate",
3
- "version": "3.1.4",
3
+ "version": "3.1.6",
4
4
  "description": "A small wrapper for fastify providing a set of common conventions & utility functions we use.",
5
5
  "exports": {
6
6
  "types": "./lib-esm/index.d.ts",
@@ -25,10 +25,10 @@
25
25
  "@types/node": "^16.7.2",
26
26
  "axios": ">=0.20.0",
27
27
  "chai": "^4.2.0",
28
- "eslint-config-standard-with-typescript": "^23.0.0",
28
+ "eslint-config-standard-with-typescript": "^34.0.0",
29
29
  "mocha": "^10.0.0",
30
30
  "ts-node": "^10.2.1",
31
- "typescript": "^4.4.2"
31
+ "typescript": "^5.0.4"
32
32
  },
33
33
  "repository": {
34
34
  "type": "git",