analytics-platform 0.0.0-stage → 0.2.2

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/next.d.ts ADDED
@@ -0,0 +1,36 @@
1
+ export interface NextFirewallOptions {
2
+ siteId: string;
3
+ /** The site secret (site settings). Keep it in an environment variable. */
4
+ secret: string;
5
+ /** The collector's URL. */
6
+ endpoint: string;
7
+ /**
8
+ * How to find the visitor's address. Default on Vercel: "vercel". Self-hosted
9
+ * Next.js has no connection address in middleware: set the number of proxies
10
+ * in X-Forwarded-For, "cloudflare", or a function.
11
+ */
12
+ trustProxy?: "vercel" | "cloudflare" | number | ((request: Request) => string);
13
+ /** Overrides the mode set in the dashboard. */
14
+ mode?: "monitor" | "block";
15
+ /** Return true to leave a request unchecked. */
16
+ skip?: (request: Request) => boolean;
17
+ /** A rate-limit counter shared between instances (e.g. Upstash Redis): returns the hits so far. */
18
+ counter?: (key: string, ttlSeconds: number) => Promise<number> | number;
19
+ debug?: boolean;
20
+ }
21
+
22
+ /** Next.js middleware: returns a Response when blocked, else undefined (the request goes on). */
23
+ export function createNextFirewall(options: NextFirewallOptions):
24
+ (request: Request, event?: { waitUntil(promise: Promise<unknown>): void }) => Promise<Response | undefined>;
25
+
26
+ export interface OnRequestErrorOptions {
27
+ siteId: string;
28
+ secret: string;
29
+ endpoint: string;
30
+ debug?: boolean;
31
+ }
32
+
33
+ /** For instrumentation.ts: export const onRequestError = createOnRequestError({...}). */
34
+ export function createOnRequestError(options: OnRequestErrorOptions):
35
+ (error: unknown, request: { path: string; method: string; headers: Record<string, string | string[] | undefined> },
36
+ context: { routePath?: string; routerKind?: string; routeType?: string }) => Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,43 @@
1
1
  {
2
2
  "name": "analytics-platform",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.2.2",
4
+ "description": "Firewall, error monitoring and server analytics for your Node server, run from your analytics dashboard.",
5
+ "author": "steviec87",
6
+ "license": "MIT",
7
+ "keywords": [
8
+ "firewall",
9
+ "waf",
10
+ "rate-limit",
11
+ "error-monitoring",
12
+ "analytics",
13
+ "server-monitoring",
14
+ "express",
15
+ "nextjs"
16
+ ],
17
+ "main": "index.js",
18
+ "types": "index.d.ts",
19
+ "files": [
20
+ "index.js",
21
+ "index.d.ts",
22
+ "next.d.ts",
23
+ "lib/",
24
+ "README.md",
25
+ "LICENSE"
26
+ ],
27
+ "engines": {
28
+ "node": ">=18"
29
+ },
30
+ "exports": {
31
+ ".": {
32
+ "types": "./index.d.ts",
33
+ "default": "./index.js"
34
+ },
35
+ "./next": {
36
+ "types": "./next.d.ts",
37
+ "default": "./lib/next.js"
38
+ }
39
+ },
40
+ "scripts": {
41
+ "test": "node --test test/*.test.js"
42
+ }
43
+ }