@bbloker/sdk 0.3.0 → 0.4.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.
|
@@ -45,7 +45,7 @@ function normalizeExpressRequest(req) {
|
|
|
45
45
|
headerNames.push(lower);
|
|
46
46
|
}
|
|
47
47
|
const forwarded = _optionalChain([headers, 'access', _ => _["x-forwarded-for"], 'optionalAccess', _2 => _2.split, 'call', _3 => _3(","), 'access', _4 => _4[0], 'optionalAccess', _5 => _5.trim, 'call', _6 => _6()]);
|
|
48
|
-
const ip = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(
|
|
48
|
+
const ip = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(forwarded, () => ( req.ip)), () => ( _optionalChain([req, 'access', _7 => _7.socket, 'optionalAccess', _8 => _8.remoteAddress]))), () => ( "0.0.0.0"));
|
|
49
49
|
return {
|
|
50
50
|
ip,
|
|
51
51
|
userAgent: _nullishCoalesce(headers["user-agent"], () => ( "")),
|
package/dist/adapters/express.js
CHANGED
|
@@ -45,7 +45,7 @@ function normalizeExpressRequest(req) {
|
|
|
45
45
|
headerNames.push(lower);
|
|
46
46
|
}
|
|
47
47
|
const forwarded = headers["x-forwarded-for"]?.split(",")[0]?.trim();
|
|
48
|
-
const ip = req.ip ??
|
|
48
|
+
const ip = forwarded ?? req.ip ?? req.socket?.remoteAddress ?? "0.0.0.0";
|
|
49
49
|
return {
|
|
50
50
|
ip,
|
|
51
51
|
userAgent: headers["user-agent"] ?? "",
|
|
@@ -48,7 +48,7 @@ function normalizeFastifyRequest(req) {
|
|
|
48
48
|
headerNames.push(lower);
|
|
49
49
|
}
|
|
50
50
|
const forwarded = _optionalChain([headers, 'access', _ => _["x-forwarded-for"], 'optionalAccess', _2 => _2.split, 'call', _3 => _3(","), 'access', _4 => _4[0], 'optionalAccess', _5 => _5.trim, 'call', _6 => _6()]);
|
|
51
|
-
const ip = _nullishCoalesce(_nullishCoalesce(
|
|
51
|
+
const ip = _nullishCoalesce(_nullishCoalesce(forwarded, () => ( req.ip)), () => ( "0.0.0.0"));
|
|
52
52
|
return {
|
|
53
53
|
ip,
|
|
54
54
|
userAgent: _nullishCoalesce(headers["user-agent"], () => ( "")),
|
package/dist/adapters/fastify.js
CHANGED
|
@@ -48,7 +48,7 @@ function normalizeFastifyRequest(req) {
|
|
|
48
48
|
headerNames.push(lower);
|
|
49
49
|
}
|
|
50
50
|
const forwarded = headers["x-forwarded-for"]?.split(",")[0]?.trim();
|
|
51
|
-
const ip = req.ip ??
|
|
51
|
+
const ip = forwarded ?? req.ip ?? "0.0.0.0";
|
|
52
52
|
return {
|
|
53
53
|
ip,
|
|
54
54
|
userAgent: headers["user-agent"] ?? "",
|
package/dist/adapters/nextjs.cjs
CHANGED
|
@@ -39,7 +39,7 @@ function normalizeNextRequest(req) {
|
|
|
39
39
|
headerNames.push(lower);
|
|
40
40
|
});
|
|
41
41
|
return {
|
|
42
|
-
ip: _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(
|
|
42
|
+
ip: _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_optionalChain([headers, 'access', _ => _["x-forwarded-for"], 'optionalAccess', _2 => _2.split, 'call', _3 => _3(","), 'access', _4 => _4[0], 'optionalAccess', _5 => _5.trim, 'call', _6 => _6()]), () => ( headers["x-real-ip"])), () => ( req.ip)), () => ( "0.0.0.0")),
|
|
43
43
|
userAgent: _nullishCoalesce(headers["user-agent"], () => ( "")),
|
|
44
44
|
headers,
|
|
45
45
|
headerNames,
|
package/dist/adapters/nextjs.js
CHANGED
|
@@ -39,7 +39,7 @@ function normalizeNextRequest(req) {
|
|
|
39
39
|
headerNames.push(lower);
|
|
40
40
|
});
|
|
41
41
|
return {
|
|
42
|
-
ip:
|
|
42
|
+
ip: headers["x-forwarded-for"]?.split(",")[0]?.trim() ?? headers["x-real-ip"] ?? req.ip ?? "0.0.0.0",
|
|
43
43
|
userAgent: headers["user-agent"] ?? "",
|
|
44
44
|
headers,
|
|
45
45
|
headerNames,
|