@arcjet/bun 1.0.0-beta.13 → 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.
- package/index.d.ts +1 -1
- package/index.js +12 -8
- package/package.json +14 -14
package/index.d.ts
CHANGED
|
@@ -104,7 +104,7 @@ export interface ArcjetBun<Props extends PlainObject> {
|
|
|
104
104
|
* @returns
|
|
105
105
|
* Wrapped `fetch` handler.
|
|
106
106
|
*/
|
|
107
|
-
handler(fetch: (this: Server
|
|
107
|
+
handler(fetch: (this: Server<any>, request: Request, server: Server<any>) => Response | Promise<Response>): (this: Server<any>, request: Request, server: Server<any>) => Response | Promise<Response>;
|
|
108
108
|
}
|
|
109
109
|
/**
|
|
110
110
|
* Create a new Bun integration of Arcjet.
|
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.
|
|
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
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
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.
|
|
3
|
+
"version": "1.0.0-beta.15",
|
|
4
4
|
"description": "Arcjet SDK for Bun",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"analyze",
|
|
@@ -45,21 +45,21 @@
|
|
|
45
45
|
"test": "npm run build && npm run lint"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@arcjet/env": "1.0.0-beta.
|
|
49
|
-
"@arcjet/headers": "1.0.0-beta.
|
|
50
|
-
"@arcjet/ip": "1.0.0-beta.
|
|
51
|
-
"@arcjet/logger": "1.0.0-beta.
|
|
52
|
-
"@arcjet/protocol": "1.0.0-beta.
|
|
53
|
-
"@arcjet/transport": "1.0.0-beta.
|
|
54
|
-
"arcjet": "1.0.0-beta.
|
|
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.
|
|
58
|
-
"@arcjet/rollup-config": "1.0.0-beta.
|
|
59
|
-
"@rollup/wasm-node": "4.52.
|
|
60
|
-
"bun-types": "1.
|
|
61
|
-
"eslint": "9.
|
|
62
|
-
"typescript": "5.9.
|
|
57
|
+
"@arcjet/eslint-config": "1.0.0-beta.15",
|
|
58
|
+
"@arcjet/rollup-config": "1.0.0-beta.15",
|
|
59
|
+
"@rollup/wasm-node": "4.52.5",
|
|
60
|
+
"bun-types": "1.3.1",
|
|
61
|
+
"eslint": "9.38.0",
|
|
62
|
+
"typescript": "5.9.3",
|
|
63
63
|
"undici-types": "7.15.0"
|
|
64
64
|
},
|
|
65
65
|
"publishConfig": {
|