@arcjet/astro 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 +1 -4
- package/dist/internal.d.ts +1 -1
- package/dist/internal.js +9 -6
- package/package.json +11 -11
package/dist/index.d.ts
CHANGED
|
@@ -334,7 +334,7 @@ type RemoteClientOptions = {
|
|
|
334
334
|
/**
|
|
335
335
|
* Timeout in milliseconds for the Decide API (optional).
|
|
336
336
|
*
|
|
337
|
-
* Defaults to `
|
|
337
|
+
* Defaults to `2000` (2 seconds) to allow for API cold starts.
|
|
338
338
|
*/
|
|
339
339
|
timeout?: number | undefined;
|
|
340
340
|
};
|
package/dist/index.js
CHANGED
|
@@ -78,10 +78,7 @@ const validateProtectSignupOptions = z.object({
|
|
|
78
78
|
bots: validateBotOptions,
|
|
79
79
|
email: validateEmailOptions
|
|
80
80
|
}).strict();
|
|
81
|
-
const validateDetectPromptInjectionOptions = z.object({
|
|
82
|
-
mode: validateMode.optional(),
|
|
83
|
-
threshold: z.number().optional()
|
|
84
|
-
}).strict();
|
|
81
|
+
const validateDetectPromptInjectionOptions = z.object({ mode: validateMode.optional() }).strict();
|
|
85
82
|
function validateAndSerialize(schema, value) {
|
|
86
83
|
const v = schema.parse(value);
|
|
87
84
|
return v ? JSON.stringify(v) : "";
|
package/dist/internal.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ type RemoteClientOptions = {
|
|
|
24
24
|
/**
|
|
25
25
|
* Timeout in milliseconds for the Decide API (optional).
|
|
26
26
|
*
|
|
27
|
-
* Defaults to `
|
|
27
|
+
* Defaults to `2000` (2 seconds) to allow for API cold starts.
|
|
28
28
|
*/
|
|
29
29
|
timeout?: number;
|
|
30
30
|
};
|
package/dist/internal.js
CHANGED
|
@@ -3,14 +3,14 @@ import { readBodyWeb } from "@arcjet/body";
|
|
|
3
3
|
import { baseUrl, isDevelopment, logLevel, platform } from "@arcjet/env";
|
|
4
4
|
import { ArcjetHeaders } from "@arcjet/headers";
|
|
5
5
|
import { Logger } from "@arcjet/logger";
|
|
6
|
-
import { createClient } from "@arcjet/protocol/client.js";
|
|
6
|
+
import { createClient, resolveClientTimeout } from "@arcjet/protocol/client.js";
|
|
7
7
|
import { createTransport } from "@arcjet/transport";
|
|
8
8
|
import core from "arcjet";
|
|
9
9
|
import { ARCJET_BASE_URL, ARCJET_ENV, ARCJET_KEY, ARCJET_LOG_LEVEL, FIREBASE_CONFIG, FLY_APP_NAME, RENDER, VERCEL } from "astro:env/server";
|
|
10
10
|
export * from "arcjet";
|
|
11
11
|
//#region src/internal.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
|
const ipSymbol = Symbol.for("arcjet.ip");
|
|
16
16
|
const env = {
|
|
@@ -34,9 +34,10 @@ const env = {
|
|
|
34
34
|
*/
|
|
35
35
|
function createRemoteClient(options) {
|
|
36
36
|
const url = options?.baseUrl ?? baseUrl(env);
|
|
37
|
-
const timeout = options?.timeout
|
|
37
|
+
const timeout = resolveClientTimeout(options?.timeout);
|
|
38
|
+
const transport = createTransport(url);
|
|
38
39
|
return createClient({
|
|
39
|
-
transport
|
|
40
|
+
transport,
|
|
40
41
|
baseUrl: url,
|
|
41
42
|
timeout,
|
|
42
43
|
sdkStack: "ASTRO",
|
|
@@ -74,8 +75,10 @@ function createArcjetClient(options) {
|
|
|
74
75
|
platform: platform(env),
|
|
75
76
|
proxies
|
|
76
77
|
});
|
|
77
|
-
if (ip === "")
|
|
78
|
-
|
|
78
|
+
if (ip === "") {
|
|
79
|
+
if (isDevelopment(env)) ip = "127.0.0.1";
|
|
80
|
+
else log.warn(`Client IP address is missing. If this is a dev environment set the ARCJET_ENV env var to "development"`);
|
|
81
|
+
}
|
|
79
82
|
return {
|
|
80
83
|
...props,
|
|
81
84
|
ip,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcjet/astro",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.11.0",
|
|
4
4
|
"description": "Arcjet runtime security SDK for Astro — bot protection, rate limiting, prompt injection detection, PII blocking, and WAF",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -62,18 +62,18 @@
|
|
|
62
62
|
"test": "npm run build && npm run test-coverage"
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@arcjet/body": "1.
|
|
66
|
-
"@arcjet/env": "1.
|
|
67
|
-
"@arcjet/headers": "1.
|
|
68
|
-
"@arcjet/ip": "1.
|
|
69
|
-
"@arcjet/logger": "1.
|
|
70
|
-
"@arcjet/protocol": "1.
|
|
71
|
-
"@arcjet/transport": "1.
|
|
72
|
-
"arcjet": "1.
|
|
65
|
+
"@arcjet/body": "1.11.0",
|
|
66
|
+
"@arcjet/env": "1.11.0",
|
|
67
|
+
"@arcjet/headers": "1.11.0",
|
|
68
|
+
"@arcjet/ip": "1.11.0",
|
|
69
|
+
"@arcjet/logger": "1.11.0",
|
|
70
|
+
"@arcjet/protocol": "1.11.0",
|
|
71
|
+
"@arcjet/transport": "1.11.0",
|
|
72
|
+
"arcjet": "1.11.0"
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
|
-
"astro": "7.
|
|
76
|
-
"tsdown": "0.22.
|
|
75
|
+
"astro": "7.2.2",
|
|
76
|
+
"tsdown": "0.22.14",
|
|
77
77
|
"typescript": "7.0.2"
|
|
78
78
|
},
|
|
79
79
|
"peerDependencies": {
|