@hmcts/opal-frontend-common-node 0.0.21 → 0.0.23
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,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hmcts/opal-frontend-common-node",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.23",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "Common nodejs library components for opal",
|
|
7
7
|
"repository": {
|
|
@@ -49,9 +49,9 @@
|
|
|
49
49
|
"@types/luxon": "^3.4.2",
|
|
50
50
|
"@types/node": "^24.0.0",
|
|
51
51
|
"@types/session-file-store": "^1.2.5",
|
|
52
|
-
"@typescript-eslint/eslint-plugin": "8.
|
|
53
|
-
"@typescript-eslint/parser": "8.
|
|
54
|
-
"eslint": "^
|
|
52
|
+
"@typescript-eslint/eslint-plugin": "8.56.0",
|
|
53
|
+
"@typescript-eslint/parser": "8.56.0",
|
|
54
|
+
"eslint": "^10.0.0",
|
|
55
55
|
"eslint-plugin-prettier": "^5.2.6",
|
|
56
56
|
"typescript": "~5.9.0",
|
|
57
57
|
"typescript-eslint": "^8.30.1"
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
declare const opalApiProxy: (opalApiTarget: string) => import("http-proxy-middleware").RequestHandler<any, import("http").ServerResponse<import("http").IncomingMessage>, (err?: any) => void>;
|
|
1
|
+
declare const opalApiProxy: (opalApiTarget: string, logEnabled: boolean) => import("http-proxy-middleware").RequestHandler<any, import("http").ServerResponse<import("http").IncomingMessage>, (err?: any) => void>;
|
|
2
2
|
export default opalApiProxy;
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/proxy/opal-api-proxy/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/proxy/opal-api-proxy/index.ts"],"names":[],"mappings":"AAKA,QAAA,MAAM,YAAY,GAAI,eAAe,MAAM,EAAE,YAAY,OAAO,4IAoB/D,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { createProxyMiddleware } from 'http-proxy-middleware';
|
|
2
|
-
|
|
2
|
+
import { Logger } from '@hmcts/nodejs-logging';
|
|
3
|
+
const logger = Logger.getLogger('opalApiProxy');
|
|
4
|
+
const opalApiProxy = (opalApiTarget, logEnabled) => {
|
|
3
5
|
return createProxyMiddleware({
|
|
4
6
|
target: opalApiTarget,
|
|
5
7
|
changeOrigin: true,
|
|
@@ -10,6 +12,11 @@ const opalApiProxy = (opalApiTarget) => {
|
|
|
10
12
|
if (req.session.securityToken?.access_token) {
|
|
11
13
|
proxyReq.setHeader('Authorization', `Bearer ${req.session.securityToken.access_token}`);
|
|
12
14
|
}
|
|
15
|
+
const requestIp = req.ip || 'unknown';
|
|
16
|
+
proxyReq.setHeader('x-user-ip', requestIp);
|
|
17
|
+
if (logEnabled) {
|
|
18
|
+
logger.info(`client ip: ${requestIp}`);
|
|
19
|
+
}
|
|
13
20
|
},
|
|
14
21
|
},
|
|
15
22
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/proxy/opal-api-proxy/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/proxy/opal-api-proxy/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE/C,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;AAEhD,MAAM,YAAY,GAAG,CAAC,aAAqB,EAAE,UAAmB,EAAE,EAAE;IAClE,OAAO,qBAAqB,CAAC;QAC3B,MAAM,EAAE,aAAa;QACrB,YAAY,EAAE,IAAI;QAClB,MAAM,EAAE,OAAO;QACf,EAAE,EAAE;YACF,8DAA8D;YAC9D,QAAQ,EAAE,CAAC,QAAQ,EAAE,GAAQ,EAAE,EAAE;gBAC/B,IAAI,GAAG,CAAC,OAAO,CAAC,aAAa,EAAE,YAAY,EAAE,CAAC;oBAC5C,QAAQ,CAAC,SAAS,CAAC,eAAe,EAAE,UAAU,GAAG,CAAC,OAAO,CAAC,aAAa,CAAC,YAAY,EAAE,CAAC,CAAC;gBAC1F,CAAC;gBAED,MAAM,SAAS,GAAG,GAAG,CAAC,EAAE,IAAI,SAAS,CAAC;gBACtC,QAAQ,CAAC,SAAS,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;gBAC3C,IAAI,UAAU,EAAE,CAAC;oBACf,MAAM,CAAC,IAAI,CAAC,cAAc,SAAS,EAAE,CAAC,CAAC;gBACzC,CAAC;YACH,CAAC;SACF;KACF,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,eAAe,YAAY,CAAC"}
|