diff --git a/arcjet-next/index.ts b/arcjet-next/index.ts index d86514755..287640bae 100644 --- a/arcjet-next/index.ts +++ b/arcjet-next/index.ts @@ -11,8 +11,6 @@ import type { NextMiddlewareResult } from "next/dist/server/web/types.js"; import arcjet, { ArcjetDecision, ArcjetOptions, - Primitive, - Product, ArcjetHeaders, Runtime, ArcjetRequest, @@ -21,6 +19,8 @@ import arcjet, { RemoteClientOptions, defaultBaseUrl, createRemoteClient, + ArcjetPrimitive, + ArcjetProduct, } from "arcjet"; import findIP from "@arcjet/ip"; @@ -64,6 +64,14 @@ type PlainObject = { [key: string]: unknown; }; +// Primitives and Products can be specified in a variety of ways and are +// externally grouped as `rules` +// See ExtraRules below for further explanation on why we define them like this. +type PrimitivesOrProduct = + | ArcjetPrimitive + | ArcjetPrimitive[] + | ArcjetProduct; + /** * Ensures redirects are followed to properly support the Next.js/Vercel Edge * Runtime. @@ -157,7 +165,7 @@ export interface ArcjetNext { * These can be overriden on a per-request basis by providing them to the * `protect()` or `protectApi` methods. */ -export default function arcjetNext( +export default function arcjetNext( options: ArcjetOptions, ): ArcjetNext>> { const client = options.client ?? createNextRemoteClient(); diff --git a/examples/nextjs-13-pages-wrap/pages/api/arcjet.ts b/examples/nextjs-13-pages-wrap/pages/api/arcjet.ts index c1e9f5b53..76873e31b 100644 --- a/examples/nextjs-13-pages-wrap/pages/api/arcjet.ts +++ b/examples/nextjs-13-pages-wrap/pages/api/arcjet.ts @@ -14,7 +14,6 @@ const aj = arcjet({ //characteristics: ["ip.src"], window: "1m", max: 1, - timeout: "10m", }), ], }); diff --git a/examples/nextjs-14-app-dir-rl/app/api/arcjet/route.ts b/examples/nextjs-14-app-dir-rl/app/api/arcjet/route.ts index 9e7add54f..b625c301f 100644 --- a/examples/nextjs-14-app-dir-rl/app/api/arcjet/route.ts +++ b/examples/nextjs-14-app-dir-rl/app/api/arcjet/route.ts @@ -12,7 +12,6 @@ const aj = arcjet({ characteristics: ["ip.src"], window: "1h", max: 1, - timeout: "10m", }), ], });