@lwrjs/core 0.17.2-alpha.8 → 0.17.2-alpha.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.
@@ -28,8 +28,8 @@ __export(exports, {
28
28
  });
29
29
  var import_diagnostics = __toModule(require("@lwrjs/diagnostics"));
30
30
  var import_shared_utils = __toModule(require("@lwrjs/shared-utils"));
31
- var MRT_REQUEST_CLASS = "X-Mobify-Request-Class";
32
- var MRT_REQUEST_CLASS_KEY = MRT_REQUEST_CLASS.toLowerCase();
31
+ var MRT_REQUEST_CLASS = "x-mobify-request-class";
32
+ var TRUE_CLIENT_IP = "true-client-ip";
33
33
  function requestProcessorMiddleware(app, context) {
34
34
  const {basePath} = context.runtimeEnvironment;
35
35
  app.use(async (req, res, next) => {
@@ -44,8 +44,9 @@ function requestProcessorMiddleware(app, context) {
44
44
  });
45
45
  }
46
46
  }
47
- requestClass = req.headers[MRT_REQUEST_CLASS_KEY];
47
+ requestClass = req.headers[MRT_REQUEST_CLASS];
48
48
  requestDepth = (0, import_shared_utils.parseRequestDepth)(req.headers, req.query);
49
+ const trueClientIP = req.headers[TRUE_CLIENT_IP];
49
50
  const forwarded = req.headers["forwarded"];
50
51
  const host = req.headers["host"];
51
52
  const forwardedProto = req.headers["x-forwarded-proto"];
@@ -53,7 +54,7 @@ function requestProcessorMiddleware(app, context) {
53
54
  if ((0, import_shared_utils.isLambdaEnv)()) {
54
55
  import_diagnostics.logger.info({
55
56
  label: `request-processor-middleware`,
56
- message: `Original Url: ${req.originalUrl}, Forwarded: ${forwarded}, X-Forwarded-Proto: ${forwardedProto}, Host: ${host}, Protocol: ${protocol}, ${MRT_REQUEST_CLASS}: ${requestClass}, ${import_shared_utils.REQUEST_DEPTH_HEADER}: ${requestDepth}`
57
+ message: `Original Url: ${req.originalUrl}, Forwarded: ${forwarded}, X-Forwarded-Proto: ${forwardedProto}, Host: ${host}, Protocol: ${protocol}, ${MRT_REQUEST_CLASS}: ${requestClass}, ${TRUE_CLIENT_IP}: ${trueClientIP}, ${import_shared_utils.REQUEST_DEPTH_HEADER}: ${requestDepth}`
57
58
  });
58
59
  }
59
60
  }
@@ -89,7 +90,7 @@ function requestProcessorMiddleware(app, context) {
89
90
  } else {
90
91
  import_diagnostics.logger.debug({
91
92
  label: `request-processor-middleware`,
92
- message: `${MRT_REQUEST_CLASS_KEY} ignored ${req.headers ? req.headers[MRT_REQUEST_CLASS_KEY] : "no-headers"}`
93
+ message: `${MRT_REQUEST_CLASS} ignored ${req.headers ? req.headers[MRT_REQUEST_CLASS] : "no-headers"}`
93
94
  });
94
95
  req.basePath = basePath;
95
96
  }
@@ -8,8 +8,8 @@
8
8
  */
9
9
  import { logger } from '@lwrjs/diagnostics';
10
10
  import { REQUEST_DEPTH_HEADER, isLambdaEnv, parseRequestDepth } from '@lwrjs/shared-utils';
11
- const MRT_REQUEST_CLASS = 'X-Mobify-Request-Class';
12
- const MRT_REQUEST_CLASS_KEY = MRT_REQUEST_CLASS.toLowerCase();
11
+ const MRT_REQUEST_CLASS = 'x-mobify-request-class';
12
+ const TRUE_CLIENT_IP = 'true-client-ip';
13
13
  export function requestProcessorMiddleware(app, context) {
14
14
  const { basePath } = context.runtimeEnvironment;
15
15
  app.use(async (req, res, next) => {
@@ -26,8 +26,9 @@ export function requestProcessorMiddleware(app, context) {
26
26
  });
27
27
  }
28
28
  }
29
- requestClass = req.headers[MRT_REQUEST_CLASS_KEY];
29
+ requestClass = req.headers[MRT_REQUEST_CLASS];
30
30
  requestDepth = parseRequestDepth(req.headers, req.query);
31
+ const trueClientIP = req.headers[TRUE_CLIENT_IP];
31
32
  const forwarded = req.headers['forwarded'];
32
33
  const host = req.headers['host'];
33
34
  const forwardedProto = req.headers['x-forwarded-proto'];
@@ -36,7 +37,7 @@ export function requestProcessorMiddleware(app, context) {
36
37
  if (isLambdaEnv()) {
37
38
  logger.info({
38
39
  label: `request-processor-middleware`,
39
- message: `Original Url: ${req.originalUrl}, Forwarded: ${forwarded}, X-Forwarded-Proto: ${forwardedProto}, Host: ${host}, Protocol: ${protocol}, ${MRT_REQUEST_CLASS}: ${requestClass}, ${REQUEST_DEPTH_HEADER}: ${requestDepth}`,
40
+ message: `Original Url: ${req.originalUrl}, Forwarded: ${forwarded}, X-Forwarded-Proto: ${forwardedProto}, Host: ${host}, Protocol: ${protocol}, ${MRT_REQUEST_CLASS}: ${requestClass}, ${TRUE_CLIENT_IP}: ${trueClientIP}, ${REQUEST_DEPTH_HEADER}: ${requestDepth}`,
40
41
  });
41
42
  }
42
43
  }
@@ -81,7 +82,7 @@ export function requestProcessorMiddleware(app, context) {
81
82
  else {
82
83
  logger.debug({
83
84
  label: `request-processor-middleware`,
84
- message: `${MRT_REQUEST_CLASS_KEY} ignored ${req.headers ? req.headers[MRT_REQUEST_CLASS_KEY] : 'no-headers'}`,
85
+ message: `${MRT_REQUEST_CLASS} ignored ${req.headers ? req.headers[MRT_REQUEST_CLASS] : 'no-headers'}`,
85
86
  });
86
87
  req.basePath = basePath;
87
88
  }
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "0.17.2-alpha.8",
7
+ "version": "0.17.2-alpha.9",
8
8
  "homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
9
9
  "repository": {
10
10
  "type": "git",
@@ -43,34 +43,34 @@
43
43
  "build": "tsc -b"
44
44
  },
45
45
  "dependencies": {
46
- "@lwrjs/app-service": "0.17.2-alpha.8",
47
- "@lwrjs/asset-registry": "0.17.2-alpha.8",
48
- "@lwrjs/asset-transformer": "0.17.2-alpha.8",
49
- "@lwrjs/base-view-provider": "0.17.2-alpha.8",
50
- "@lwrjs/base-view-transformer": "0.17.2-alpha.8",
51
- "@lwrjs/client-modules": "0.17.2-alpha.8",
52
- "@lwrjs/config": "0.17.2-alpha.8",
53
- "@lwrjs/diagnostics": "0.17.2-alpha.8",
54
- "@lwrjs/esbuild": "0.17.2-alpha.8",
55
- "@lwrjs/fs-asset-provider": "0.17.2-alpha.8",
56
- "@lwrjs/fs-watch": "0.17.2-alpha.8",
57
- "@lwrjs/html-view-provider": "0.17.2-alpha.8",
58
- "@lwrjs/instrumentation": "0.17.2-alpha.8",
59
- "@lwrjs/loader": "0.17.2-alpha.8",
60
- "@lwrjs/lwc-module-provider": "0.17.2-alpha.8",
61
- "@lwrjs/lwc-ssr": "0.17.2-alpha.8",
62
- "@lwrjs/markdown-view-provider": "0.17.2-alpha.8",
63
- "@lwrjs/module-bundler": "0.17.2-alpha.8",
64
- "@lwrjs/module-registry": "0.17.2-alpha.8",
65
- "@lwrjs/npm-module-provider": "0.17.2-alpha.8",
66
- "@lwrjs/nunjucks-view-provider": "0.17.2-alpha.8",
67
- "@lwrjs/o11y": "0.17.2-alpha.8",
68
- "@lwrjs/resource-registry": "0.17.2-alpha.8",
69
- "@lwrjs/router": "0.17.2-alpha.8",
70
- "@lwrjs/server": "0.17.2-alpha.8",
71
- "@lwrjs/shared-utils": "0.17.2-alpha.8",
72
- "@lwrjs/static": "0.17.2-alpha.8",
73
- "@lwrjs/view-registry": "0.17.2-alpha.8",
46
+ "@lwrjs/app-service": "0.17.2-alpha.9",
47
+ "@lwrjs/asset-registry": "0.17.2-alpha.9",
48
+ "@lwrjs/asset-transformer": "0.17.2-alpha.9",
49
+ "@lwrjs/base-view-provider": "0.17.2-alpha.9",
50
+ "@lwrjs/base-view-transformer": "0.17.2-alpha.9",
51
+ "@lwrjs/client-modules": "0.17.2-alpha.9",
52
+ "@lwrjs/config": "0.17.2-alpha.9",
53
+ "@lwrjs/diagnostics": "0.17.2-alpha.9",
54
+ "@lwrjs/esbuild": "0.17.2-alpha.9",
55
+ "@lwrjs/fs-asset-provider": "0.17.2-alpha.9",
56
+ "@lwrjs/fs-watch": "0.17.2-alpha.9",
57
+ "@lwrjs/html-view-provider": "0.17.2-alpha.9",
58
+ "@lwrjs/instrumentation": "0.17.2-alpha.9",
59
+ "@lwrjs/loader": "0.17.2-alpha.9",
60
+ "@lwrjs/lwc-module-provider": "0.17.2-alpha.9",
61
+ "@lwrjs/lwc-ssr": "0.17.2-alpha.9",
62
+ "@lwrjs/markdown-view-provider": "0.17.2-alpha.9",
63
+ "@lwrjs/module-bundler": "0.17.2-alpha.9",
64
+ "@lwrjs/module-registry": "0.17.2-alpha.9",
65
+ "@lwrjs/npm-module-provider": "0.17.2-alpha.9",
66
+ "@lwrjs/nunjucks-view-provider": "0.17.2-alpha.9",
67
+ "@lwrjs/o11y": "0.17.2-alpha.9",
68
+ "@lwrjs/resource-registry": "0.17.2-alpha.9",
69
+ "@lwrjs/router": "0.17.2-alpha.9",
70
+ "@lwrjs/server": "0.17.2-alpha.9",
71
+ "@lwrjs/shared-utils": "0.17.2-alpha.9",
72
+ "@lwrjs/static": "0.17.2-alpha.9",
73
+ "@lwrjs/view-registry": "0.17.2-alpha.9",
74
74
  "chokidar": "^3.6.0",
75
75
  "esbuild": "^0.9.7",
76
76
  "fs-extra": "^11.2.0",
@@ -80,7 +80,7 @@
80
80
  "ws": "^8.18.0"
81
81
  },
82
82
  "devDependencies": {
83
- "@lwrjs/types": "0.17.2-alpha.8",
83
+ "@lwrjs/types": "0.17.2-alpha.9",
84
84
  "@types/ws": "^8.5.12",
85
85
  "memfs": "^4.13.0"
86
86
  },
@@ -93,5 +93,5 @@
93
93
  "volta": {
94
94
  "extends": "../../../package.json"
95
95
  },
96
- "gitHead": "ee1182e7d876cf92e579ee88c48b25047486b4f8"
96
+ "gitHead": "7ede5d04a97513b9869b13e66155bc4f3920bb99"
97
97
  }