@openapi-typescript-infra/service 4.8.7 → 4.9.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openapi-typescript-infra/service",
3
- "version": "4.8.7",
3
+ "version": "4.9.1",
4
4
  "description": "An opinionated framework for building configuration driven services - web, api, or ob. Uses OpenAPI, pino logging, express, confit, Typescript and vitest.",
5
5
  "main": "build/index.js",
6
6
  "scripts": {
@@ -86,17 +86,18 @@
86
86
  "cookie-parser": "^1.4.6",
87
87
  "dotenv": "^16.3.1",
88
88
  "express": "next",
89
- "express-openapi-validator": "^5.1.0",
89
+ "express-openapi-validator": "^5.1.1",
90
90
  "glob": "^8.1.0",
91
91
  "lodash": "^4.17.21",
92
92
  "minimist": "^1.2.8",
93
93
  "opentelemetry-instrumentation-fetch-node": "^1.1.2",
94
94
  "pino": "^8.16.2",
95
- "read-pkg-up": "^7.0.1"
95
+ "read-pkg-up": "^7.0.1",
96
+ "request-ip": "^3.3.0"
96
97
  },
97
98
  "devDependencies": {
98
- "@commitlint/cli": "^18.4.2",
99
- "@commitlint/config-conventional": "^18.4.2",
99
+ "@commitlint/cli": "^18.4.3",
100
+ "@commitlint/config-conventional": "^18.4.3",
100
101
  "@openapi-typescript-infra/coconfig": "^4.2.2",
101
102
  "@semantic-release/changelog": "^6.0.3",
102
103
  "@semantic-release/commit-analyzer": "^11.1.0",
@@ -106,14 +107,15 @@
106
107
  "@types/cookie-parser": "^1.4.6",
107
108
  "@types/express": "^4.17.21",
108
109
  "@types/glob": "^8.1.0",
109
- "@types/lodash": "^4.14.201",
110
+ "@types/lodash": "^4.14.202",
110
111
  "@types/minimist": "^1.2.5",
111
- "@types/node": "^20.9.1",
112
+ "@types/node": "^20.10.0",
113
+ "@types/request-ip": "^0.0.41",
112
114
  "@types/supertest": "^2.0.16",
113
- "@typescript-eslint/eslint-plugin": "^6.11.0",
114
- "@typescript-eslint/parser": "^6.11.0",
115
+ "@typescript-eslint/eslint-plugin": "^6.12.0",
116
+ "@typescript-eslint/parser": "^6.12.0",
115
117
  "coconfig": "^1.0.0",
116
- "eslint": "^8.53.0",
118
+ "eslint": "^8.54.0",
117
119
  "eslint-config-prettier": "^9.0.0",
118
120
  "eslint-plugin-import": "^2.29.0",
119
121
  "pino-pretty": "^10.2.3",
@@ -121,7 +123,7 @@
121
123
  "supertest": "^6.3.3",
122
124
  "ts-node": "^10.9.1",
123
125
  "tsconfig-paths": "^4.2.0",
124
- "typescript": "^5.2.2",
126
+ "typescript": "^5.3.2",
125
127
  "vitest": "^0.34.6"
126
128
  },
127
129
  "resolutions": {
@@ -1,4 +1,5 @@
1
1
  import type { RequestHandler, Request, Response, ErrorRequestHandler } from 'express';
2
+ import requestip from 'request-ip';
2
3
  import { Histogram } from '@opentelemetry/api';
3
4
 
4
5
  import { ServiceError } from '../error';
@@ -34,9 +35,15 @@ function getBasicInfo(req: Request) {
34
35
 
35
36
  const preInfo: Record<string, string> = {
36
37
  url,
38
+ ip: requestip.getClientIp(req) || '',
37
39
  m: req.method,
38
40
  };
39
41
 
42
+ const sessionReq = req as WithIdentifiedSession;
43
+ if (sessionReq.session?.id) {
44
+ preInfo.sid = sessionReq.session.id;
45
+ }
46
+
40
47
  return preInfo;
41
48
  }
42
49