@appwarden/middleware 1.4.0 → 1.4.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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @appwarden/middleware
2
2
 
3
- ![Test Coverage](https://img.shields.io/badge/coverage-90.01%25-brightgreen)
3
+ ![Test Coverage](https://img.shields.io/badge/coverage-92.74%25-brightgreen)
4
4
  [![npm version](https://img.shields.io/npm/v/@appwarden/middleware.svg)](https://www.npmjs.com/package/@appwarden/middleware)
5
5
  [![npm provenance](https://img.shields.io/badge/npm-provenance-green)](https://docs.npmjs.com/generating-provenance-statements)
6
6
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
@@ -14,15 +14,11 @@
14
14
  - **Instant Quarantine**: Immediately redirects all visitors to a maintenance page when activated
15
15
  - **Discord Integration**: Trigger lockdowns via Discord commands (`/quarantine lock your.app.io`)
16
16
  - **Nonce-based Content Security Policy**: On Cloudflare, deploy a nonce-based Content Security Policy to supercharge your website security
17
-
18
- ### Performance Optimizations
19
-
20
- - **Background Synchronization**: Uses `waitUntil()` to update cache state without blocking responses
21
- - **Minimal Runtime Overhead**: Lightweight implementation with negligible performance impact
17
+ - **Minimal Runtime Overhead**: Negligible performance impact by using `event.waitUntil` for status checks
22
18
 
23
19
  ## Installation
24
20
 
25
- Compatible with websites powered by [Cloudflare](https://developers.cloudflare.com/pages/) or [Vercel](https://vercel.com).
21
+ Compatible with websites powered by [Cloudflare](https://developers.cloudflare.com/workers/static-assets/) or [Vercel](https://vercel.com).
26
22
 
27
23
  For detailed usage instructions, please refer to our [documentation](https://appwarden.io/docs).
28
24
 
@@ -111,7 +107,7 @@ pnpm test
111
107
 
112
108
  ## Security
113
109
 
114
- This package is published with npm provenance enabled, which provides a verifiable link between the published package and its source code. For more information, see [npm provenance documentation](https://docs.npmjs.com/generating-provenance-statements).
110
+ This package is published with npm trusted publishers, to prevent npm token exfiltration, and provenance enabled, which provides a verifiable link between the published package and its source code. For more information, see [npm provenance documentation](https://docs.npmjs.com/generating-provenance-statements).
115
111
 
116
112
  ## License
117
113
 
package/cloudflare.js CHANGED
@@ -201,7 +201,7 @@ var APIError = class extends Error {
201
201
  var syncEdgeValue = async (context) => {
202
202
  debug(`syncing with api`);
203
203
  try {
204
- const response = await fetch(new URL("/v1/status/check", "https://bot-gateway.appwarden.io"), {
204
+ const response = await fetch(new URL("/v1/status/check", "https://api.appwarden.io"), {
205
205
  method: "POST",
206
206
  headers: { "content-type": "application/json" },
207
207
  body: JSON.stringify({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appwarden/middleware",
3
- "version": "1.4.0",
3
+ "version": "1.4.2",
4
4
  "description": "Instantly shut off access your app deployed on Cloudflare or Vercel",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -37,29 +37,38 @@
37
37
  "default": "./cloudflare.js"
38
38
  }
39
39
  },
40
+ "packageManager": "pnpm@10.4.1",
40
41
  "engines": {
41
- "node": ">=20"
42
+ "node": ">=24"
42
43
  },
43
44
  "dependencies": {
44
45
  "@cloudflare/next-on-pages": "1.13.12",
45
- "@upstash/redis": "^1.34.0",
46
- "@vercel/edge-config": "^1.4.0",
47
- "zod": "^3.25.30"
46
+ "@upstash/redis": "^1.36.1",
47
+ "@vercel/edge-config": "^1.4.3",
48
+ "zod": "^3.25.76"
48
49
  },
49
50
  "peerDependencies": {
50
- "next": ">=13"
51
+ "next": ">=14"
51
52
  },
52
53
  "peerDependenciesMeta": {
53
54
  "next": {
54
55
  "optional": true
55
56
  }
56
57
  },
58
+ "lint-staged": {
59
+ "*.{ts,tsx,js,jsx,json,md,yml,yaml}": [
60
+ "prettier --write"
61
+ ]
62
+ },
57
63
  "pnpm": {
58
64
  "overrides": {
59
- "undici@>=4.5.0 <5.28.5": ">=5.28.5",
60
- "esbuild@<=0.24.2": ">=0.25.0",
61
65
  "cookie@<0.7.0": ">=0.7.0",
62
- "undici@<5.29.0": ">=5.29.0"
66
+ "esbuild@<=0.24.2": ">=0.25.0",
67
+ "path-to-regexp@>=4.0.0 <6.3.0": ">=6.3.0",
68
+ "tar@<7.5.7": ">=7.5.7",
69
+ "undici@<6.23.0": ">=6.23.0",
70
+ "body-parser@>=2.2.0 <2.2.1": ">=2.2.1",
71
+ "jws@=4.0.0": ">=4.0.1"
63
72
  }
64
73
  }
65
74
  }
package/vercel.js CHANGED
@@ -161,7 +161,7 @@ var APIError = class extends Error {
161
161
  var syncEdgeValue = async (context) => {
162
162
  debug(`syncing with api`);
163
163
  try {
164
- const response = await fetch(new URL("/v1/status/check", "https://bot-gateway.appwarden.io"), {
164
+ const response = await fetch(new URL("/v1/status/check", "https://api.appwarden.io"), {
165
165
  method: "POST",
166
166
  headers: { "content-type": "application/json" },
167
167
  body: JSON.stringify({
@@ -229,7 +229,7 @@ var AppwardenConfigSchema = BaseNextJsConfigSchema.refine(
229
229
  path: ["cacheUrl"]
230
230
  }
231
231
  ).superRefine((data, ctx) => {
232
- if (!isValidCacheUrl.edgeConfig(data.cacheUrl) && isValidCacheUrl.upstash(data.cacheUrl)) {
232
+ if (isCacheUrl.edgeConfig(data.cacheUrl) && !isValidCacheUrl.edgeConfig(data.cacheUrl)) {
233
233
  ctx.addIssue({
234
234
  code: "custom",
235
235
  message: printMessage(
@@ -239,7 +239,7 @@ var AppwardenConfigSchema = BaseNextJsConfigSchema.refine(
239
239
  });
240
240
  return false;
241
241
  }
242
- if (!isValidCacheUrl.upstash(data.cacheUrl) && isValidCacheUrl.edgeConfig(data.cacheUrl)) {
242
+ if (isCacheUrl.upstash(data.cacheUrl) && !isValidCacheUrl.upstash(data.cacheUrl)) {
243
243
  ctx.addIssue({
244
244
  code: "custom",
245
245
  message: printMessage(