@arcjet/bun 1.10.0 → 1.11.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.
- package/dist/index.d.ts +1 -1
- package/dist/index.js +9 -6
- package/package.json +11 -11
package/dist/index.d.ts
CHANGED
|
@@ -26,7 +26,7 @@ type RemoteClientOptions = {
|
|
|
26
26
|
/**
|
|
27
27
|
* Timeout in milliseconds for the Decide API (optional).
|
|
28
28
|
*
|
|
29
|
-
* Defaults to `
|
|
29
|
+
* Defaults to `2000` (2 seconds) to allow for API cold starts.
|
|
30
30
|
*/
|
|
31
31
|
timeout?: number;
|
|
32
32
|
};
|
package/dist/index.js
CHANGED
|
@@ -4,13 +4,13 @@ import { readBodyWeb } from "@arcjet/body";
|
|
|
4
4
|
import { baseUrl, isDevelopment, logLevel, platform } from "@arcjet/env";
|
|
5
5
|
import { ArcjetHeaders } from "@arcjet/headers";
|
|
6
6
|
import { Logger } from "@arcjet/logger";
|
|
7
|
-
import { createClient } from "@arcjet/protocol/client.js";
|
|
7
|
+
import { createClient, resolveClientTimeout } from "@arcjet/protocol/client.js";
|
|
8
8
|
import { createTransport } from "@arcjet/transport";
|
|
9
9
|
import { env } from "bun";
|
|
10
10
|
export * from "arcjet";
|
|
11
11
|
//#region src/index.ts
|
|
12
12
|
/** SDK version. Updated by the release process. */
|
|
13
|
-
const VERSION = "1.
|
|
13
|
+
const VERSION = "1.11.0";
|
|
14
14
|
let warnedForAutomaticBodyRead = false;
|
|
15
15
|
/**
|
|
16
16
|
* Create a remote client.
|
|
@@ -22,9 +22,10 @@ let warnedForAutomaticBodyRead = false;
|
|
|
22
22
|
*/
|
|
23
23
|
function createRemoteClient(options) {
|
|
24
24
|
const url = options?.baseUrl ?? baseUrl(env);
|
|
25
|
-
const timeout = options?.timeout
|
|
25
|
+
const timeout = resolveClientTimeout(options?.timeout);
|
|
26
|
+
const transport = createTransport(url);
|
|
26
27
|
return createClient({
|
|
27
|
-
transport
|
|
28
|
+
transport,
|
|
28
29
|
baseUrl: url,
|
|
29
30
|
timeout,
|
|
30
31
|
sdkStack: "BUN",
|
|
@@ -61,8 +62,10 @@ function arcjet(options) {
|
|
|
61
62
|
platform: platform(env),
|
|
62
63
|
proxies
|
|
63
64
|
});
|
|
64
|
-
if (ip === "")
|
|
65
|
-
|
|
65
|
+
if (ip === "") {
|
|
66
|
+
if (isDevelopment(env)) ip = "127.0.0.1";
|
|
67
|
+
else log.warn(`Client IP address is missing. If this is a dev environment set the ARCJET_ENV env var to "development"`);
|
|
68
|
+
}
|
|
66
69
|
return {
|
|
67
70
|
...props,
|
|
68
71
|
ip,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcjet/bun",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.11.0",
|
|
4
4
|
"description": "Arcjet runtime security SDK for Bun — bot protection, rate limiting, prompt injection detection, PII blocking, and WAF",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -59,20 +59,20 @@
|
|
|
59
59
|
"test": "npm run build"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@arcjet/body": "1.
|
|
63
|
-
"@arcjet/env": "1.
|
|
64
|
-
"@arcjet/headers": "1.
|
|
65
|
-
"@arcjet/ip": "1.
|
|
66
|
-
"@arcjet/logger": "1.
|
|
67
|
-
"@arcjet/protocol": "1.
|
|
68
|
-
"@arcjet/transport": "1.
|
|
69
|
-
"arcjet": "1.
|
|
62
|
+
"@arcjet/body": "1.11.0",
|
|
63
|
+
"@arcjet/env": "1.11.0",
|
|
64
|
+
"@arcjet/headers": "1.11.0",
|
|
65
|
+
"@arcjet/ip": "1.11.0",
|
|
66
|
+
"@arcjet/logger": "1.11.0",
|
|
67
|
+
"@arcjet/protocol": "1.11.0",
|
|
68
|
+
"@arcjet/transport": "1.11.0",
|
|
69
|
+
"arcjet": "1.11.0"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"bun-types": "1.3.14",
|
|
73
|
-
"tsdown": "0.22.
|
|
73
|
+
"tsdown": "0.22.14",
|
|
74
74
|
"typescript": "7.0.2",
|
|
75
|
-
"undici-types": "7.
|
|
75
|
+
"undici-types": "7.29.0"
|
|
76
76
|
},
|
|
77
77
|
"engines": {}
|
|
78
78
|
}
|