nightingale-web-processor 15.0.0 → 17.0.0

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/CHANGELOG.md CHANGED
@@ -3,6 +3,24 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [17.0.0](https://github.com/christophehurpeau/nightingale/compare/v16.2.0...v17.0.0) (2025-10-20)
7
+
8
+ Version bump for dependency: nightingale-types
9
+
10
+
11
+ ## [16.0.0](https://github.com/christophehurpeau/nightingale/compare/v15.0.0...v16.0.0) (2025-03-30)
12
+
13
+ ### ⚠ BREAKING CHANGES
14
+
15
+ * drop node 18
16
+
17
+ ### Features
18
+
19
+ * drop node 18 ([1b11a55](https://github.com/christophehurpeau/nightingale/commit/1b11a55dd24c9435be50519a748316079f554414))
20
+
21
+ Version bump for dependency: nightingale-types
22
+
23
+
6
24
  ## [15.0.0](https://github.com/christophehurpeau/nightingale/compare/v14.2.1...v15.0.0) (2023-12-25)
7
25
 
8
26
 
package/README.md CHANGED
@@ -1,16 +1,16 @@
1
- <h3 align="center">
1
+ <h1 align="center">
2
2
  nightingale-web-processor
3
- </h3>
3
+ </h1>
4
4
 
5
5
  <p align="center">
6
6
  Nightingale web processor
7
7
  </p>
8
8
 
9
9
  <p align="center">
10
- <a href="https://npmjs.org/package/nightingale-web-processor"><img src="https://img.shields.io/npm/v/nightingale-web-processor.svg?style=flat-square"></a>
11
- <a href="https://npmjs.org/package/nightingale-web-processor"><img src="https://img.shields.io/npm/dw/nightingale-web-processor.svg?style=flat-square"></a>
12
- <a href="https://npmjs.org/package/nightingale-web-processor"><img src="https://img.shields.io/node/v/nightingale-web-processor.svg?style=flat-square"></a>
13
- <a href="https://npmjs.org/package/nightingale-web-processor"><img src="https://img.shields.io/npm/types/nightingale-web-processor.svg?style=flat-square"></a>
10
+ <a href="https://npmjs.org/package/nightingale-web-processor"><img src="https://img.shields.io/npm/v/nightingale-web-processor.svg?style=flat-square" alt="npm version"></a>
11
+ <a href="https://npmjs.org/package/nightingale-web-processor"><img src="https://img.shields.io/npm/dw/nightingale-web-processor.svg?style=flat-square" alt="npm downloads"></a>
12
+ <a href="https://npmjs.org/package/nightingale-web-processor"><img src="https://img.shields.io/node/v/nightingale-web-processor.svg?style=flat-square" alt="node version"></a>
13
+ <a href="https://npmjs.org/package/nightingale-web-processor"><img src="https://img.shields.io/npm/types/nightingale-web-processor.svg?style=flat-square" alt="types"></a>
14
14
  </p>
15
15
 
16
16
  ## Install
@@ -22,12 +22,12 @@ npm install --save nightingale-web-processor
22
22
  ## Usage
23
23
 
24
24
  ```js
25
- import Koa from 'koa';
26
- import webProcessor from 'nightingale-web-processor';
25
+ import Koa from "koa";
26
+ import webProcessor from "nightingale-web-processor";
27
27
 
28
28
  configure([
29
29
  {
30
- key: 'app',
30
+ key: "app",
31
31
  handlers: [new ConsoleHandler(Level.ALL)],
32
32
  processors: [webProcessor],
33
33
  },
@@ -41,7 +41,7 @@ app.use((ctx, next) => {
41
41
  });
42
42
 
43
43
  app.use(async (ctx) => {
44
- ctx.logger.info('got request !');
45
- ctx.body = 'ok';
44
+ ctx.logger.info("got request !");
45
+ ctx.body = "ok";
46
46
  });
47
47
  ```
@@ -1,6 +1,5 @@
1
- /// <reference types="node" />
2
- import type { IncomingMessage } from 'node:http';
3
- import type { LogRecord, Metadata } from 'nightingale-types';
1
+ import type { IncomingMessage } from "node:http";
2
+ import type { LogRecord, Metadata } from "nightingale-types";
4
3
  export interface ContextWithOptionalRequest {
5
4
  request?: IncomingMessage;
6
5
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7D,MAAM,WAAW,0BAA0B;IACzC,OAAO,CAAC,EAAE,eAAe,CAAC;CAC3B;AAED,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,CAAC,SAAS,QAAQ,EACrD,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,EACpB,OAAO,CAAC,EAAE,0BAA0B,GACnC,IAAI,CAYN"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7D,MAAM,WAAW,0BAA0B;IACzC,OAAO,CAAC,EAAE,eAAe,CAAC;CAC3B;AAED,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,CAAC,SAAS,QAAQ,EACrD,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,EACpB,OAAO,CAAC,EAAE,0BAA0B,GACnC,IAAI,CAWN"}
@@ -6,10 +6,10 @@ function webProcessor(record, context) {
6
6
  url: request.url,
7
7
  method: request.method,
8
8
  server: request.headers.host,
9
- ip: request.headers['x-forwarded-for'] || request.connection.remoteAddress
9
+ ip: request.headers["x-forwarded-for"] || request.socket.remoteAddress
10
10
  });
11
11
  }
12
12
  }
13
13
 
14
14
  export { webProcessor as default };
15
- //# sourceMappingURL=index-node18.mjs.map
15
+ //# sourceMappingURL=index-node20.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-node20.mjs","sources":["../src/index.ts"],"sourcesContent":["import type { IncomingMessage } from \"node:http\";\nimport type { LogRecord, Metadata } from \"nightingale-types\";\n\nexport interface ContextWithOptionalRequest {\n request?: IncomingMessage;\n}\n\nexport default function webProcessor<T extends Metadata>(\n record: LogRecord<T>,\n context?: ContextWithOptionalRequest,\n): void {\n const request = context?.request;\n if (request) {\n record.extra = record.extra || {};\n Object.assign(record.extra, {\n url: request.url,\n method: request.method,\n server: request.headers.host,\n ip: request.headers[\"x-forwarded-for\"] || request.socket.remoteAddress,\n });\n }\n}\n"],"names":[],"mappings":"AAOA,SAAwB,YAAA,CACtB,QACA,OAAA,EACM;AACN,EAAA,MAAM,UAAU,OAAA,EAAS,OAAA;AACzB,EAAA,IAAI,OAAA,EAAS;AACX,IAAA,MAAA,CAAO,KAAA,GAAQ,MAAA,CAAO,KAAA,IAAS,EAAC;AAChC,IAAA,MAAA,CAAO,MAAA,CAAO,OAAO,KAAA,EAAO;AAAA,MAC1B,KAAK,OAAA,CAAQ,GAAA;AAAA,MACb,QAAQ,OAAA,CAAQ,MAAA;AAAA,MAChB,MAAA,EAAQ,QAAQ,OAAA,CAAQ,IAAA;AAAA,MACxB,IAAI,OAAA,CAAQ,OAAA,CAAQ,iBAAiB,CAAA,IAAK,QAAQ,MAAA,CAAO;AAAA,KAC1D,CAAA;AAAA;AAEL;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nightingale-web-processor",
3
- "version": "15.0.0",
3
+ "version": "17.0.0",
4
4
  "description": "Nightingale web processor",
5
5
  "keywords": [
6
6
  "nightingale",
@@ -16,20 +16,20 @@
16
16
  "homepage": "https://github.com/christophehurpeau/nightingale",
17
17
  "type": "module",
18
18
  "engines": {
19
- "node": ">=18.12.0"
19
+ "node": ">=20.11.0"
20
20
  },
21
- "main": "./dist/index-node18.mjs",
21
+ "sideEffects": false,
22
+ "main": "./dist/index-node20.mjs",
22
23
  "types": "./dist/definitions/index.d.ts",
23
24
  "exports": {
24
25
  "./package.json": "./package.json",
25
26
  ".": {
26
27
  "types": "./dist/definitions/index.d.ts",
27
28
  "node": {
28
- "import": "./dist/index-node18.mjs"
29
+ "import": "./dist/index-node20.mjs"
29
30
  }
30
31
  }
31
32
  },
32
- "sideEffects": false,
33
33
  "files": [
34
34
  "src",
35
35
  "dist"
@@ -38,30 +38,31 @@
38
38
  "build": "yarn clean:build && rollup --config rollup.config.mjs && yarn run build:definitions",
39
39
  "build:definitions": "tsc -p tsconfig.json",
40
40
  "clean": "yarn clean:build",
41
- "clean:build": "pob-babel-clean-out dist",
41
+ "clean:build": "pob-esbuild-clean-out dist",
42
42
  "lint": "yarn run lint:eslint",
43
- "lint:eslint": "yarn ../.. run eslint --report-unused-disable-directives --resolve-plugins-relative-to . --quiet packages/nightingale-web-processor",
43
+ "lint:eslint": "yarn ../.. run eslint --quiet packages/nightingale-web-processor",
44
44
  "watch": "yarn clean:build && rollup --config rollup.config.mjs --watch"
45
45
  },
46
- "prettier": "@pob/root/prettier-config",
47
46
  "pob": {
48
- "babelEnvs": [
47
+ "bundler": "rollup-esbuild",
48
+ "entries": [
49
+ "index"
50
+ ],
51
+ "envs": [
49
52
  {
50
53
  "target": "node",
51
- "version": "18"
54
+ "version": "20"
52
55
  }
53
56
  ],
54
- "entries": [
55
- "index"
56
- ]
57
+ "typescript": true
57
58
  },
59
+ "prettier": "@pob/root/prettier-config",
58
60
  "dependencies": {
59
- "@types/node": ">=18.0.0",
60
- "nightingale-types": "15.0.0"
61
+ "@types/node": ">=20.0.0",
62
+ "nightingale-types": "17.0.0"
61
63
  },
62
64
  "devDependencies": {
63
- "@babel/core": "7.23.6",
64
- "pob-babel": "38.0.0",
65
- "typescript": "5.3.3"
65
+ "@pob/rollup-esbuild": "6.7.0",
66
+ "typescript": "5.9.2"
66
67
  }
67
68
  }
package/src/index.ts CHANGED
@@ -1,5 +1,5 @@
1
- import type { IncomingMessage } from 'node:http';
2
- import type { LogRecord, Metadata } from 'nightingale-types';
1
+ import type { IncomingMessage } from "node:http";
2
+ import type { LogRecord, Metadata } from "nightingale-types";
3
3
 
4
4
  export interface ContextWithOptionalRequest {
5
5
  request?: IncomingMessage;
@@ -16,8 +16,7 @@ export default function webProcessor<T extends Metadata>(
16
16
  url: request.url,
17
17
  method: request.method,
18
18
  server: request.headers.host,
19
- ip:
20
- request.headers['x-forwarded-for'] || request.connection.remoteAddress,
19
+ ip: request.headers["x-forwarded-for"] || request.socket.remoteAddress,
21
20
  });
22
21
  }
23
22
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-node18.mjs","sources":["../src/index.ts"],"sourcesContent":["import type { IncomingMessage } from 'node:http';\nimport type { LogRecord, Metadata } from 'nightingale-types';\n\nexport interface ContextWithOptionalRequest {\n request?: IncomingMessage;\n}\n\nexport default function webProcessor<T extends Metadata>(\n record: LogRecord<T>,\n context?: ContextWithOptionalRequest,\n): void {\n const request = context?.request;\n if (request) {\n record.extra = record.extra || {};\n Object.assign(record.extra, {\n url: request.url,\n method: request.method,\n server: request.headers.host,\n ip:\n request.headers['x-forwarded-for'] || request.connection.remoteAddress,\n });\n }\n}\n"],"names":["webProcessor","record","context","request","extra","Object","assign","url","method","server","headers","host","ip","connection","remoteAddress"],"mappings":"AAOe,SAASA,YAAYA,CAClCC,MAAoB,EACpBC,OAAoC,EAC9B;AACN,EAAA,MAAMC,OAAO,GAAGD,OAAO,EAAEC,OAAO,CAAA;AAChC,EAAA,IAAIA,OAAO,EAAE;IACXF,MAAM,CAACG,KAAK,GAAGH,MAAM,CAACG,KAAK,IAAI,EAAE,CAAA;AACjCC,IAAAA,MAAM,CAACC,MAAM,CAACL,MAAM,CAACG,KAAK,EAAE;MAC1BG,GAAG,EAAEJ,OAAO,CAACI,GAAG;MAChBC,MAAM,EAAEL,OAAO,CAACK,MAAM;AACtBC,MAAAA,MAAM,EAAEN,OAAO,CAACO,OAAO,CAACC,IAAI;MAC5BC,EAAE,EACAT,OAAO,CAACO,OAAO,CAAC,iBAAiB,CAAC,IAAIP,OAAO,CAACU,UAAU,CAACC,aAAAA;AAC7D,KAAC,CAAC,CAAA;AACJ,GAAA;AACF;;;;"}
@@ -1,30 +0,0 @@
1
- {
2
- "root": true,
3
- "parser": "@typescript-eslint/parser",
4
- "parserOptions": {
5
- "project": "packages/nightingale-web-processor/tsconfig.json"
6
- },
7
- "plugins": ["@typescript-eslint"],
8
- "extends": [
9
- "@pob/eslint-config-typescript",
10
- "@pob/eslint-config-typescript/node"
11
- ],
12
- "ignorePatterns": ["*.d.ts"],
13
- "overrides": [
14
- {
15
- "files": ["**/*.test.ts", "__tests__/**/*.ts"],
16
- "extends": ["@pob/eslint-config-typescript/test"],
17
- "env": {
18
- "jest": true
19
- },
20
- "rules": {
21
- "import/no-extraneous-dependencies": [
22
- "error",
23
- {
24
- "devDependencies": true
25
- }
26
- ]
27
- }
28
- }
29
- ]
30
- }