@arcjet/astro 1.0.0-beta.16 → 1.0.0-beta.17
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/internal.js +11 -23
- package/package.json +14 -13
package/index.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ type IntegrationRule<Characteristics extends readonly string[]> = {
|
|
|
14
14
|
options: FilterOptions;
|
|
15
15
|
} | {
|
|
16
16
|
type: "sensitiveInfo";
|
|
17
|
-
options: SensitiveInfoOptions<
|
|
17
|
+
options: SensitiveInfoOptions<undefined>;
|
|
18
18
|
} | {
|
|
19
19
|
type: "fixedWindow";
|
|
20
20
|
options: FixedWindowRateLimitOptions<Characteristics>;
|
package/internal.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import core__default from 'arcjet';
|
|
2
2
|
export * from 'arcjet';
|
|
3
|
+
import { readBodyWeb } from '@arcjet/body';
|
|
3
4
|
import findIp, { parseProxy } from '@arcjet/ip';
|
|
4
5
|
import { ArcjetHeaders } from '@arcjet/headers';
|
|
5
6
|
import { baseUrl, isDevelopment, logLevel, platform } from '@arcjet/env';
|
|
@@ -24,20 +25,6 @@ const env = {
|
|
|
24
25
|
RENDER,
|
|
25
26
|
VERCEL,
|
|
26
27
|
};
|
|
27
|
-
// TODO: Deduplicate with other packages
|
|
28
|
-
function errorMessage(err) {
|
|
29
|
-
if (err) {
|
|
30
|
-
if (typeof err === "string") {
|
|
31
|
-
return err;
|
|
32
|
-
}
|
|
33
|
-
if (typeof err === "object" &&
|
|
34
|
-
"message" in err &&
|
|
35
|
-
typeof err.message === "string") {
|
|
36
|
-
return err.message;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
return "Unknown problem";
|
|
40
|
-
}
|
|
41
28
|
/**
|
|
42
29
|
* Create a remote client.
|
|
43
30
|
*
|
|
@@ -52,7 +39,7 @@ function createRemoteClient(options) {
|
|
|
52
39
|
// Transport is the HTTP client that the client uses to make requests.
|
|
53
40
|
const transport = createTransport(url);
|
|
54
41
|
const sdkStack = "ASTRO";
|
|
55
|
-
const sdkVersion = "1.0.0-beta.
|
|
42
|
+
const sdkVersion = "1.0.0-beta.17";
|
|
56
43
|
return createClient({
|
|
57
44
|
transport,
|
|
58
45
|
baseUrl: url,
|
|
@@ -134,16 +121,17 @@ function createArcjetClient(options) {
|
|
|
134
121
|
// the definition of `props` in the signature but it's hard to track down
|
|
135
122
|
const req = toArcjetRequest(request, props ?? {});
|
|
136
123
|
const getBody = async () => {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
124
|
+
const clonedRequest = request.clone();
|
|
125
|
+
let expectedLength;
|
|
126
|
+
const expectedLengthString = request.headers.get("content-length");
|
|
127
|
+
if (typeof expectedLengthString === "string") {
|
|
128
|
+
expectedLength = parseInt(expectedLengthString, 10);
|
|
142
129
|
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
130
|
+
// HEAD and GET requests do not have a body.
|
|
131
|
+
if (!clonedRequest.body) {
|
|
132
|
+
throw new Error("Cannot read body: body is missing");
|
|
146
133
|
}
|
|
134
|
+
return readBodyWeb(clonedRequest.body, { expectedLength });
|
|
147
135
|
};
|
|
148
136
|
return aj.protect({ getBody }, req);
|
|
149
137
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcjet/astro",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.17",
|
|
4
4
|
"description": "Arcjet helps developers protect their Astro sites in just a few lines of code. Bot detection. Rate limiting. Email validation. Attack protection. Data redaction. A developer-first approach to security.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"analyze",
|
|
@@ -47,26 +47,27 @@
|
|
|
47
47
|
"build": "rollup --config rollup.config.js",
|
|
48
48
|
"lint": "eslint .",
|
|
49
49
|
"prepublishOnly": "npm run build",
|
|
50
|
-
"test-api": "node --test",
|
|
51
|
-
"test-coverage": "node --experimental-test-coverage --test",
|
|
50
|
+
"test-api": "node --test -- test/*.test.js",
|
|
51
|
+
"test-coverage": "node --experimental-test-coverage --test -- test/*.test.js",
|
|
52
52
|
"test": "npm run build && npm run lint && npm run test-coverage"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@arcjet/
|
|
56
|
-
"@arcjet/
|
|
57
|
-
"@arcjet/
|
|
58
|
-
"@arcjet/
|
|
59
|
-
"@arcjet/
|
|
60
|
-
"@arcjet/
|
|
61
|
-
"arcjet": "1.0.0-beta.
|
|
55
|
+
"@arcjet/body": "1.0.0-beta.17",
|
|
56
|
+
"@arcjet/env": "1.0.0-beta.17",
|
|
57
|
+
"@arcjet/headers": "1.0.0-beta.17",
|
|
58
|
+
"@arcjet/ip": "1.0.0-beta.17",
|
|
59
|
+
"@arcjet/logger": "1.0.0-beta.17",
|
|
60
|
+
"@arcjet/protocol": "1.0.0-beta.17",
|
|
61
|
+
"@arcjet/transport": "1.0.0-beta.17",
|
|
62
|
+
"arcjet": "1.0.0-beta.17"
|
|
62
63
|
},
|
|
63
64
|
"peerDependencies": {
|
|
64
65
|
"astro": "^5.9.3"
|
|
65
66
|
},
|
|
66
67
|
"devDependencies": {
|
|
67
|
-
"@arcjet/eslint-config": "1.0.0-beta.
|
|
68
|
-
"@arcjet/rollup-config": "1.0.0-beta.
|
|
69
|
-
"@rollup/wasm-node": "4.
|
|
68
|
+
"@arcjet/eslint-config": "1.0.0-beta.17",
|
|
69
|
+
"@arcjet/rollup-config": "1.0.0-beta.17",
|
|
70
|
+
"@rollup/wasm-node": "4.55.1",
|
|
70
71
|
"astro": "5.16.6",
|
|
71
72
|
"eslint": "9.39.2",
|
|
72
73
|
"typescript": "5.9.3"
|