@arcjet/bun 1.0.0-beta.14 → 1.0.0-beta.15

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.
Files changed (2) hide show
  1. package/index.js +12 -8
  2. package/package.json +10 -10
package/index.js CHANGED
@@ -37,7 +37,7 @@ function createRemoteClient(options) {
37
37
  // Transport is the HTTP client that the client uses to make requests.
38
38
  const transport = createTransport(url);
39
39
  const sdkStack = "BUN";
40
- const sdkVersion = "1.0.0-beta.14";
40
+ const sdkVersion = "1.0.0-beta.15";
41
41
  return createClient({
42
42
  transport,
43
43
  baseUrl: url,
@@ -80,13 +80,17 @@ function arcjet(options) {
80
80
  // We construct an ArcjetHeaders to normalize over Headers
81
81
  const headers = new ArcjetHeaders(request.headers);
82
82
  const url = new URL(request.url);
83
- let ip = findIp({
84
- // This attempts to lookup the IP in the `ipCache`. This is primarily a
85
- // workaround to the API design in Bun that requires access to the
86
- // `Server` to lookup an IP.
87
- ip: ipCache.get(request),
88
- headers,
89
- }, { platform: platform(env), proxies });
83
+ const xArcjetIp = isDevelopment(env)
84
+ ? headers.get("x-arcjet-ip")
85
+ : undefined;
86
+ let ip = xArcjetIp ||
87
+ findIp({
88
+ // This attempts to lookup the IP in the `ipCache`. This is primarily a
89
+ // workaround to the API design in Bun that requires access to the
90
+ // `Server` to lookup an IP.
91
+ ip: ipCache.get(request),
92
+ headers,
93
+ }, { platform: platform(env), proxies });
90
94
  if (ip === "") {
91
95
  // If the `ip` is empty but we're in development mode, we default the IP
92
96
  // so the request doesn't fail.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcjet/bun",
3
- "version": "1.0.0-beta.14",
3
+ "version": "1.0.0-beta.15",
4
4
  "description": "Arcjet SDK for Bun",
5
5
  "keywords": [
6
6
  "analyze",
@@ -45,17 +45,17 @@
45
45
  "test": "npm run build && npm run lint"
46
46
  },
47
47
  "dependencies": {
48
- "@arcjet/env": "1.0.0-beta.14",
49
- "@arcjet/headers": "1.0.0-beta.14",
50
- "@arcjet/ip": "1.0.0-beta.14",
51
- "@arcjet/logger": "1.0.0-beta.14",
52
- "@arcjet/protocol": "1.0.0-beta.14",
53
- "@arcjet/transport": "1.0.0-beta.14",
54
- "arcjet": "1.0.0-beta.14"
48
+ "@arcjet/env": "1.0.0-beta.15",
49
+ "@arcjet/headers": "1.0.0-beta.15",
50
+ "@arcjet/ip": "1.0.0-beta.15",
51
+ "@arcjet/logger": "1.0.0-beta.15",
52
+ "@arcjet/protocol": "1.0.0-beta.15",
53
+ "@arcjet/transport": "1.0.0-beta.15",
54
+ "arcjet": "1.0.0-beta.15"
55
55
  },
56
56
  "devDependencies": {
57
- "@arcjet/eslint-config": "1.0.0-beta.14",
58
- "@arcjet/rollup-config": "1.0.0-beta.14",
57
+ "@arcjet/eslint-config": "1.0.0-beta.15",
58
+ "@arcjet/rollup-config": "1.0.0-beta.15",
59
59
  "@rollup/wasm-node": "4.52.5",
60
60
  "bun-types": "1.3.1",
61
61
  "eslint": "9.38.0",