@arcjet/node 1.0.0 → 1.1.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
@@ -32,10 +32,21 @@ This is the [Arcjet][arcjet] SDK for [Node.js][node-js].
32
32
 
33
33
  Visit the [quick start guide][quick-start] to get started.
34
34
 
35
- ## Example app
35
+ ## Example
36
36
 
37
- Try an Arcjet protected app live at [https://example.arcjet.com][example-url]
38
- ([source code][example-source]).
37
+ Try an Arcjet protected Next.js app live at
38
+ [`example.arcjet.com`][example-next-url]
39
+ ([source code][example-next-source]).
40
+
41
+ <!--
42
+
43
+ TODO: Node.js example.
44
+
45
+ See [`arcjet/example-node`][example-astro-source] for a Node.js example.
46
+
47
+ [example-node-source]: https://github.com/arcjet/example-node
48
+
49
+ -->
39
50
 
40
51
  ## What is this?
41
52
 
@@ -111,9 +122,9 @@ see the [Arcjet Node.js SDK reference][arcjet-reference-node] on our website.
111
122
  [arcjet-get-started]: https://docs.arcjet.com/get-started
112
123
  [arcjet-reference-node]: https://docs.arcjet.com/reference/nodejs
113
124
  [arcjet]: https://arcjet.com
125
+ [example-next-source]: https://github.com/arcjet/example-nextjs
126
+ [example-next-url]: https://example.arcjet.com
114
127
  [node-js]: https://nodejs.org/
115
128
  [alt-sdk]: https://www.npmjs.com/package/@arcjet/next
116
- [example-url]: https://example.arcjet.com
117
129
  [quick-start]: https://docs.arcjet.com/get-started/nodejs
118
- [example-source]: https://github.com/arcjet/arcjet-js-example
119
130
  [apache-license]: http://www.apache.org/licenses/LICENSE-2.0
package/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { ArcjetDecision, ArcjetOptions as CoreOptions, Primitive, Product, ExtraProps, CharacteristicProps } from "arcjet";
1
+ import type { ArcjetDecision, ArcjetOptions as CoreOptions, ArcjetRule, Primitive, Product, ExtraProps, CharacteristicProps } from "arcjet";
2
2
  export * from "arcjet";
3
3
  type Simplify<T> = {
4
4
  [KeyType in keyof T]: T[KeyType];
@@ -164,7 +164,7 @@ export interface ArcjetNode<Props extends PlainObject> {
164
164
  * @returns
165
165
  * Arcjet instance augmented with the given rule.
166
166
  */
167
- withRule<ChildProperties extends PlainObject>(rule: Primitive<ChildProperties> | Product<ChildProperties>): ArcjetNode<Props & ChildProperties>;
167
+ withRule<Rule extends ArcjetRule>(rule: Array<Rule>): ArcjetNode<Props & (Rule extends ArcjetRule<infer P> ? P : {})>;
168
168
  }
169
169
  /**
170
170
  * Create a new Node.js integration of Arcjet.
package/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as core from 'arcjet';
2
2
  import core__default from 'arcjet';
3
3
  export * from 'arcjet';
4
- import findIp, { parseProxy } from '@arcjet/ip';
4
+ import { parseProxy, findIp } from '@arcjet/ip';
5
5
  import { ArcjetHeaders } from '@arcjet/headers';
6
6
  import { logLevel, isDevelopment, baseUrl, platform } from '@arcjet/env';
7
7
  import { Logger } from '@arcjet/logger';
@@ -56,7 +56,7 @@ function createRemoteClient(options) {
56
56
  // Transport is the HTTP client that the client uses to make requests.
57
57
  const transport = createTransport(url);
58
58
  const sdkStack = "NODEJS";
59
- const sdkVersion = "1.0.0";
59
+ const sdkVersion = "1.1.0";
60
60
  return createClient({
61
61
  transport,
62
62
  baseUrl: url,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcjet/node",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "Arcjet SDK for Node.js",
5
5
  "keywords": [
6
6
  "analyze",
@@ -43,27 +43,27 @@
43
43
  "scripts": {
44
44
  "build": "rollup --config rollup.config.js",
45
45
  "lint": "eslint .",
46
- "prepublishOnly": "npm run build",
47
46
  "test-api": "node --test -- test/*.test.js",
48
47
  "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
48
  "test-coverage": "node --experimental-test-coverage --test -- test/*.test.js",
50
49
  "test": "npm run build && npm run lint && npm run test-coverage"
51
50
  },
52
51
  "dependencies": {
53
- "@arcjet/env": "1.0.0",
54
- "@arcjet/headers": "1.0.0",
55
- "@arcjet/ip": "1.0.0",
56
- "@arcjet/logger": "1.0.0",
57
- "@arcjet/protocol": "1.0.0",
58
- "@arcjet/transport": "1.0.0",
59
- "@arcjet/body": "1.0.0",
60
- "arcjet": "1.0.0"
52
+ "@arcjet/env": "1.1.0",
53
+ "@arcjet/headers": "1.1.0",
54
+ "@arcjet/ip": "1.1.0",
55
+ "@arcjet/logger": "1.1.0",
56
+ "@arcjet/protocol": "1.1.0",
57
+ "@arcjet/transport": "1.1.0",
58
+ "@arcjet/body": "1.1.0",
59
+ "arcjet": "1.1.0"
61
60
  },
62
61
  "devDependencies": {
63
- "@arcjet/eslint-config": "1.0.0",
64
- "@arcjet/rollup-config": "1.0.0",
65
- "@types/node": "25.0.8",
66
- "@rollup/wasm-node": "4.55.1",
62
+ "@arcjet/cache": "1.1.0",
63
+ "@arcjet/eslint-config": "1.1.0",
64
+ "@arcjet/rollup-config": "1.1.0",
65
+ "@types/node": "25.1.0",
66
+ "@rollup/wasm-node": "4.57.0",
67
67
  "eslint": "9.39.2",
68
68
  "typescript": "5.9.3"
69
69
  },