@unchainedshop/utils 2.8.10 → 2.8.11

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.
@@ -26,9 +26,9 @@ export const resolveBestCountry = (localeCountry, shopCountry, countries) => {
26
26
  export const resolveUserRemoteAddress = (req) => {
27
27
  const remoteAddress = req.headers['x-real-ip'] ||
28
28
  req.headers['x-forwarded-for'] ||
29
- req.connection.remoteAddress ||
30
- req.socket.remoteAddress ||
31
- req.connection.socket.remoteAddress;
29
+ req.connection?.remoteAddress ||
30
+ req.socket?.remoteAddress ||
31
+ req.connection?.socket?.remoteAddress;
32
32
  const remotePort = req.connection?.remotePort || req.socket?.remotePort || req.connection?.socket?.remotePort;
33
33
  return { remoteAddress, remotePort };
34
34
  };
@@ -1 +1 @@
1
- {"version":3,"file":"locale-helpers.js","sourceRoot":"","sources":["../src/locale-helpers.ts"],"names":[],"mappings":"AACA,OAAO,SAAS,MAAM,QAAQ,CAAC;AAE/B,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;AAEtC,MAAM,EAAE,cAAc,GAAG,IAAI,EAAE,iBAAiB,GAAG,IAAI,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC;AAExE,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,MAAM,CAAC,GAAG,cAAc,IAAI,iBAAiB,EAAE,CAAC,CAAC;AAEjF,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAClC,cAAsB,EACtB,gBAA6B,EACjB,EAAE;IACd,MAAM,YAAY,GAAG,IAAI,OAAO,CAAC,cAAc,CAAC,CAAC;IACjD,MAAM,UAAU,GAAG,YAAY,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IACvD,IAAI,CAAC,UAAU;QAAE,OAAO,YAAY,CAAC;IACrC,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,aAAa,EAAE,WAAW,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U,EAAE,UAAU,IAAI,GAAG,CAAC,MAAM,EAAE,UAAU,IAAI,GAAG,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,CAAC;IAE7F,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,CAAC;AACvC,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unchainedshop/utils",
3
- "version": "2.8.10",
3
+ "version": "2.8.11",
4
4
  "main": "lib/utils-index.js",
5
5
  "exports": {
6
6
  ".": "./lib/utils-index.js",
@@ -30,16 +30,16 @@
30
30
  },
31
31
  "homepage": "https://github.com/unchainedshop/unchained#readme",
32
32
  "dependencies": {
33
- "@unchainedshop/logger": "^2.8.10",
33
+ "@unchainedshop/logger": "^2.8.11",
34
34
  "abort-controller": "3.0.0",
35
35
  "hashids": "^2.3.0",
36
36
  "locale": "0.1.0",
37
37
  "simpl-schema": "^3.4.6"
38
38
  },
39
39
  "devDependencies": {
40
- "@types/node": "^20.12.5",
41
- "@unchainedshop/types": "^2.8.10",
40
+ "@types/node": "^20.12.7",
41
+ "@unchainedshop/types": "^2.8.11",
42
42
  "jest": "^29.7.0",
43
- "typescript": "^5.4.4"
43
+ "typescript": "^5.4.5"
44
44
  }
45
45
  }
@@ -36,9 +36,9 @@ export const resolveUserRemoteAddress = (req) => {
36
36
  const remoteAddress =
37
37
  req.headers['x-real-ip'] ||
38
38
  req.headers['x-forwarded-for'] ||
39
- req.connection.remoteAddress ||
40
- req.socket.remoteAddress ||
41
- req.connection.socket.remoteAddress;
39
+ req.connection?.remoteAddress ||
40
+ req.socket?.remoteAddress ||
41
+ req.connection?.socket?.remoteAddress;
42
42
 
43
43
  const remotePort =
44
44
  req.connection?.remotePort || req.socket?.remotePort || req.connection?.socket?.remotePort;