@arcjet/node 1.0.0-beta.14 → 1.0.0-beta.16
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.js +13 -8
- package/package.json +18 -15
package/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as core from 'arcjet';
|
|
1
2
|
import core__default from 'arcjet';
|
|
2
3
|
export * from 'arcjet';
|
|
3
4
|
import findIp, { parseProxy } from '@arcjet/ip';
|
|
@@ -27,9 +28,6 @@ const env = {
|
|
|
27
28
|
get NODE_ENV() {
|
|
28
29
|
return process.env.NODE_ENV;
|
|
29
30
|
},
|
|
30
|
-
get ARCJET_KEY() {
|
|
31
|
-
return process.env.ARCJET_KEY;
|
|
32
|
-
},
|
|
33
31
|
get ARCJET_ENV() {
|
|
34
32
|
return process.env.ARCJET_ENV;
|
|
35
33
|
},
|
|
@@ -39,6 +37,9 @@ const env = {
|
|
|
39
37
|
get ARCJET_BASE_URL() {
|
|
40
38
|
return process.env.ARCJET_BASE_URL;
|
|
41
39
|
},
|
|
40
|
+
get FIREBASE_CONFIG() {
|
|
41
|
+
return process.env.FIREBASE_CONFIG;
|
|
42
|
+
},
|
|
42
43
|
};
|
|
43
44
|
// TODO: Deduplicate with other packages
|
|
44
45
|
function errorMessage(err) {
|
|
@@ -68,7 +69,7 @@ function createRemoteClient(options) {
|
|
|
68
69
|
// Transport is the HTTP client that the client uses to make requests.
|
|
69
70
|
const transport = createTransport(url);
|
|
70
71
|
const sdkStack = "NODEJS";
|
|
71
|
-
const sdkVersion = "1.0.0-beta.
|
|
72
|
+
const sdkVersion = "1.0.0-beta.16";
|
|
72
73
|
return createClient({
|
|
73
74
|
transport,
|
|
74
75
|
baseUrl: url,
|
|
@@ -123,10 +124,14 @@ function arcjet(options) {
|
|
|
123
124
|
const cookies = cookiesToString(request.headers?.cookie);
|
|
124
125
|
// We construct an ArcjetHeaders to normalize over Headers
|
|
125
126
|
const headers = new ArcjetHeaders(request.headers);
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
127
|
+
const xArcjetIp = isDevelopment(env)
|
|
128
|
+
? headers.get("x-arcjet-ip")
|
|
129
|
+
: undefined;
|
|
130
|
+
let ip = xArcjetIp ||
|
|
131
|
+
findIp({
|
|
132
|
+
socket: request.socket,
|
|
133
|
+
headers,
|
|
134
|
+
}, { platform: platform(env), proxies });
|
|
130
135
|
if (ip === "") {
|
|
131
136
|
// If the `ip` is empty but we're in development mode, we default the IP
|
|
132
137
|
// so the request doesn't fail.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcjet/node",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.16",
|
|
4
4
|
"description": "Arcjet SDK for Node.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"analyze",
|
|
@@ -44,24 +44,27 @@
|
|
|
44
44
|
"build": "rollup --config rollup.config.js",
|
|
45
45
|
"lint": "eslint .",
|
|
46
46
|
"prepublishOnly": "npm run build",
|
|
47
|
-
"test": "
|
|
47
|
+
"test-api": "node --test -- test/*.test.js",
|
|
48
|
+
"test-coverage#": "TODO: after node 20, use: ` --test-coverage-branches=100 --test-coverage-exclude \"../{analyze-wasm,analyze,arcjet,cache,duration,env,headers,ip,logger,protocol,runtime,sprintf,stable-hash,transport}/**/*.{js,ts}\" --test-coverage-exclude \"test/**/*.{js,ts}\" --test-coverage-functions=100 --test-coverage-lines=100`",
|
|
49
|
+
"test-coverage": "node --experimental-test-coverage --test -- test/*.test.js",
|
|
50
|
+
"test": "npm run build && npm run lint && npm run test-coverage"
|
|
48
51
|
},
|
|
49
52
|
"dependencies": {
|
|
50
|
-
"@arcjet/env": "1.0.0-beta.
|
|
51
|
-
"@arcjet/headers": "1.0.0-beta.
|
|
52
|
-
"@arcjet/ip": "1.0.0-beta.
|
|
53
|
-
"@arcjet/logger": "1.0.0-beta.
|
|
54
|
-
"@arcjet/protocol": "1.0.0-beta.
|
|
55
|
-
"@arcjet/transport": "1.0.0-beta.
|
|
56
|
-
"@arcjet/body": "1.0.0-beta.
|
|
57
|
-
"arcjet": "1.0.0-beta.
|
|
53
|
+
"@arcjet/env": "1.0.0-beta.16",
|
|
54
|
+
"@arcjet/headers": "1.0.0-beta.16",
|
|
55
|
+
"@arcjet/ip": "1.0.0-beta.16",
|
|
56
|
+
"@arcjet/logger": "1.0.0-beta.16",
|
|
57
|
+
"@arcjet/protocol": "1.0.0-beta.16",
|
|
58
|
+
"@arcjet/transport": "1.0.0-beta.16",
|
|
59
|
+
"@arcjet/body": "1.0.0-beta.16",
|
|
60
|
+
"arcjet": "1.0.0-beta.16"
|
|
58
61
|
},
|
|
59
62
|
"devDependencies": {
|
|
60
|
-
"@arcjet/eslint-config": "1.0.0-beta.
|
|
61
|
-
"@arcjet/rollup-config": "1.0.0-beta.
|
|
62
|
-
"@types/node": "
|
|
63
|
-
"@rollup/wasm-node": "4.
|
|
64
|
-
"eslint": "9.
|
|
63
|
+
"@arcjet/eslint-config": "1.0.0-beta.16",
|
|
64
|
+
"@arcjet/rollup-config": "1.0.0-beta.16",
|
|
65
|
+
"@types/node": "25.0.3",
|
|
66
|
+
"@rollup/wasm-node": "4.54.0",
|
|
67
|
+
"eslint": "9.39.2",
|
|
65
68
|
"typescript": "5.9.3"
|
|
66
69
|
},
|
|
67
70
|
"publishConfig": {
|