@arcjet/bun 1.5.0 → 1.6.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/README.md CHANGED
@@ -31,9 +31,9 @@ an HTTP request), see [`@arcjet/guard`](https://github.com/arcjet/arcjet-js/tree
31
31
  ```sh
32
32
  npx @arcjet/cli auth login
33
33
  ```
34
- 2. Install the request protection skill to give your coding agent the docs it needs:
34
+ 2. Install the Arcjet skill to give your coding agent the docs it needs:
35
35
  ```sh
36
- npx skills add arcjet/skills --skill add-request-protection
36
+ npx skills add arcjet/skills
37
37
  ```
38
38
  3. Tell your agent what to protect — it handles the rest.
39
39
 
package/index.d.ts CHANGED
@@ -97,7 +97,9 @@ export interface ArcjetBun<Props extends PlainObject> {
97
97
  * Promise that resolves to an {@linkcode ArcjetDecision} indicating
98
98
  * Arcjet’s decision about the request.
99
99
  */
100
- protect(request: Request, ...properties: MaybeProperties<Props>): Promise<ArcjetDecision>;
100
+ protect(request: Request, ...properties: MaybeProperties<Props & {
101
+ correlationId?: string;
102
+ }>): Promise<ArcjetDecision>;
101
103
  /**
102
104
  * Augment the client with another rule.
103
105
  *
package/index.js CHANGED
@@ -27,7 +27,7 @@ function createRemoteClient(options) {
27
27
  // Transport is the HTTP client that the client uses to make requests.
28
28
  const transport = createTransport(url);
29
29
  const sdkStack = "BUN";
30
- const sdkVersion = "1.5.0";
30
+ const sdkVersion = "1.6.0";
31
31
  return createClient({
32
32
  transport,
33
33
  baseUrl: url,
@@ -110,8 +110,11 @@ function arcjet(options) {
110
110
  return withClient(client);
111
111
  },
112
112
  async protect(request, props) {
113
+ // `correlationId` is a request-independent option, not a rule prop, so
114
+ // pull it out before building the request from the rule properties.
115
+ const { correlationId, ...properties } = props ?? {};
113
116
  // Cast of `{}` because here we switch from `undefined` to `Properties`.
114
- const req = toArcjetRequest(request, props || {});
117
+ const req = toArcjetRequest(request, (properties || {}));
115
118
  const getBody = async () => {
116
119
  if (request.bodyUsed) {
117
120
  throw new Error("Cannot read body: already read");
@@ -132,7 +135,7 @@ function arcjet(options) {
132
135
  }
133
136
  return readBodyWeb(clonedRequest.body, { expectedLength });
134
137
  };
135
- return aj.protect({ getBody }, req);
138
+ return aj.protect({ getBody }, { ...req, correlationId });
136
139
  },
137
140
  handler(fetch) {
138
141
  return async function (request, server) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcjet/bun",
3
- "version": "1.5.0",
3
+ "version": "1.6.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",
@@ -51,23 +51,23 @@
51
51
  "test": "npm run build && npm run lint"
52
52
  },
53
53
  "dependencies": {
54
- "@arcjet/body": "1.5.0",
55
- "@arcjet/env": "1.5.0",
56
- "@arcjet/headers": "1.5.0",
57
- "@arcjet/ip": "1.5.0",
58
- "@arcjet/logger": "1.5.0",
59
- "@arcjet/protocol": "1.5.0",
60
- "@arcjet/transport": "1.5.0",
61
- "arcjet": "1.5.0"
54
+ "@arcjet/body": "1.6.0",
55
+ "@arcjet/env": "1.6.0",
56
+ "@arcjet/headers": "1.6.0",
57
+ "@arcjet/ip": "1.6.0",
58
+ "@arcjet/logger": "1.6.0",
59
+ "@arcjet/protocol": "1.6.0",
60
+ "@arcjet/transport": "1.6.0",
61
+ "arcjet": "1.6.0"
62
62
  },
63
63
  "devDependencies": {
64
- "@arcjet/eslint-config": "1.5.0",
65
- "@arcjet/rollup-config": "1.5.0",
66
- "@rollup/wasm-node": "4.61.0",
64
+ "@arcjet/eslint-config": "1.6.0",
65
+ "@arcjet/rollup-config": "1.6.0",
66
+ "@rollup/wasm-node": "4.62.2",
67
67
  "bun-types": "1.3.14",
68
68
  "eslint": "9.39.4",
69
69
  "typescript": "5.9.3",
70
- "undici-types": "7.27.0"
70
+ "undici-types": "7.28.0"
71
71
  },
72
72
  "publishConfig": {
73
73
  "access": "public",