@arcjet/bun
Advanced tools
+8
-1
| import type { ArcjetDecision, ArcjetOptions as CoreOptions, ArcjetRule, Primitive, Product, ExtraProps, CharacteristicProps } from "arcjet"; | ||
| import { type ProxyService } from "@arcjet/ip"; | ||
| export { cloudflare } from "@arcjet/ip"; | ||
| export type { ProxyService } from "@arcjet/ip"; | ||
| import type { Server } from "bun"; | ||
@@ -63,4 +66,8 @@ export * from "arcjet"; | ||
| * (optional, example: `["100.100.100.100", "100.100.100.0/24"]`). | ||
| * | ||
| * Proxy services such as {@linkcode cloudflare} can also be included to read | ||
| * the real client IP from a service-specific header when the request comes | ||
| * from that service. | ||
| */ | ||
| proxies?: Array<string>; | ||
| proxies?: Array<string | ProxyService>; | ||
| }>; | ||
@@ -67,0 +74,0 @@ /** |
+4
-3
| import * as core from 'arcjet'; | ||
| import core__default from 'arcjet'; | ||
| export * from 'arcjet'; | ||
| import { parseProxy, findIp } from '@arcjet/ip'; | ||
| import { parseProxies, findIp } from '@arcjet/ip'; | ||
| export { cloudflare } from '@arcjet/ip'; | ||
| import { ArcjetHeaders } from '@arcjet/headers'; | ||
@@ -29,3 +30,3 @@ import { env } from 'bun'; | ||
| const sdkStack = "BUN"; | ||
| const sdkVersion = "1.4.0"; | ||
| const sdkVersion = "1.5.0"; | ||
| return createClient({ | ||
@@ -63,3 +64,3 @@ transport, | ||
| const proxies = Array.isArray(options.proxies) | ||
| ? options.proxies.map(parseProxy) | ||
| ? parseProxies(options.proxies) | ||
| : undefined; | ||
@@ -66,0 +67,0 @@ if (isDevelopment(env)) { |
+15
-15
| { | ||
| "name": "@arcjet/bun", | ||
| "version": "1.4.0", | ||
| "version": "1.5.0", | ||
| "description": "Arcjet runtime security SDK for Bun — bot protection, rate limiting, prompt injection detection, PII blocking, and WAF", | ||
@@ -54,19 +54,19 @@ "keywords": [ | ||
| "dependencies": { | ||
| "@arcjet/body": "1.4.0", | ||
| "@arcjet/env": "1.4.0", | ||
| "@arcjet/headers": "1.4.0", | ||
| "@arcjet/ip": "1.4.0", | ||
| "@arcjet/logger": "1.4.0", | ||
| "@arcjet/protocol": "1.4.0", | ||
| "@arcjet/transport": "1.4.0", | ||
| "arcjet": "1.4.0" | ||
| "@arcjet/body": "1.5.0", | ||
| "@arcjet/env": "1.5.0", | ||
| "@arcjet/headers": "1.5.0", | ||
| "@arcjet/ip": "1.5.0", | ||
| "@arcjet/logger": "1.5.0", | ||
| "@arcjet/protocol": "1.5.0", | ||
| "@arcjet/transport": "1.5.0", | ||
| "arcjet": "1.5.0" | ||
| }, | ||
| "devDependencies": { | ||
| "@arcjet/eslint-config": "1.4.0", | ||
| "@arcjet/rollup-config": "1.4.0", | ||
| "@rollup/wasm-node": "4.59.0", | ||
| "bun-types": "1.3.10", | ||
| "eslint": "9.39.3", | ||
| "@arcjet/eslint-config": "1.5.0", | ||
| "@arcjet/rollup-config": "1.5.0", | ||
| "@rollup/wasm-node": "4.61.0", | ||
| "bun-types": "1.3.14", | ||
| "eslint": "9.39.4", | ||
| "typescript": "5.9.3", | ||
| "undici-types": "7.22.0" | ||
| "undici-types": "7.27.0" | ||
| }, | ||
@@ -73,0 +73,0 @@ "publishConfig": { |
+40
-3
@@ -21,7 +21,27 @@ <a href="https://arcjet.com" target="_arcjet-home"> | ||
| This is the [Arcjet][arcjet] SDK for [Bun][bun-sh]. | ||
| This is the [Arcjet][arcjet] SDK for [Bun][bun-sh] **request protection** — | ||
| use it to protect HTTP route handlers and API endpoints. If you need to protect | ||
| AI agent tool calls, MCP server handlers, or background jobs (anything without | ||
| an HTTP request), see [`@arcjet/guard`](https://github.com/arcjet/arcjet-js/tree/main/arcjet-guard). | ||
| ## Getting started | ||
| 1. Get your API key at [`app.arcjet.com`](https://app.arcjet.com) | ||
| ### Quick setup with an AI agent | ||
| 1. Log in with the CLI: | ||
| ```sh | ||
| npx @arcjet/cli auth login | ||
| ``` | ||
| 2. Install the request protection skill to give your coding agent the docs it needs: | ||
| ```sh | ||
| npx skills add arcjet/skills --skill add-request-protection | ||
| ``` | ||
| 3. Tell your agent what to protect — it handles the rest. | ||
| ### Manual setup | ||
| 1. **Log in** with the CLI (or at [`app.arcjet.com`](https://app.arcjet.com?utm_campaign=arcjet-js)): | ||
| ```sh | ||
| npx @arcjet/cli auth login | ||
| ``` | ||
| 2. `bun add @arcjet/bun` | ||
@@ -38,2 +58,19 @@ 3. Set `ARCJET_KEY=ajkey_yourkey` in your environment | ||
| All features below are available with `@arcjet/bun` for request protection. | ||
| For guard protection (tool calls, MCP servers, queues) see | ||
| [`@arcjet/guard`](https://github.com/arcjet/arcjet-js/tree/main/arcjet-guard). | ||
| | Feature | `@arcjet/bun` | `@arcjet/guard` | | ||
| | ------------------------------- | :-----------: | :-------------: | | ||
| | Rate Limiting | ✅ | ✅ | | ||
| | Prompt Injection Detection | ✅ | ✅ | | ||
| | Sensitive Information Detection | ✅ | ✅ | | ||
| | Bot Protection | ✅ | — | | ||
| | Shield WAF | ✅ | — | | ||
| | Email Validation | ✅ | — | | ||
| | Signup Form Protection | ✅ | — | | ||
| | Request Filters | ✅ | — | | ||
| | IP Analysis | ✅ | — | | ||
| | Custom Rules | — | ✅ | | ||
| - 🔒 [Prompt Injection Detection](#prompt-injection-detection) — detect and block | ||
@@ -70,3 +107,3 @@ prompt injection attacks before they reach your LLM. | ||
| const aj = arcjet({ | ||
| key: env.ARCJET_KEY!, // Get your site key from https://app.arcjet.com | ||
| key: env.ARCJET_KEY!, // Get your key with: npx @arcjet/cli sites get-key | ||
| rules: [ | ||
@@ -73,0 +110,0 @@ // Shield protects your app from common attacks e.g. SQL injection |
42064
5.49%289
2.85%595
6.63%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated
Updated
Updated
Updated
Updated
Updated
Updated
Updated