@appwarden/middleware 3.2.1 → 3.4.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 +257 -22
- package/chunk-3MKVGKH7.js +81 -0
- package/chunk-G4RRFNHY.js +332 -0
- package/chunk-HCGLR3Z3.js +97 -0
- package/{chunk-ZX5QO4Y2.js → chunk-QVRWMYGL.js} +31 -58
- package/{chunk-COV6SHCD.js → chunk-U3T4R5KZ.js} +2 -4
- package/chunk-YBWFEBZC.js +53 -0
- package/cloudflare/astro.d.ts +4 -0
- package/cloudflare/astro.js +54 -11
- package/cloudflare/nextjs.d.ts +4 -0
- package/cloudflare/nextjs.js +57 -10
- package/cloudflare/react-router.d.ts +5 -0
- package/cloudflare/react-router.js +54 -11
- package/cloudflare/tanstack-start.d.ts +5 -0
- package/cloudflare/tanstack-start.js +54 -11
- package/cloudflare-36BOGAYU.js +28 -0
- package/cloudflare.d.ts +440 -8
- package/cloudflare.js +44 -54
- package/index.d.ts +2 -1
- package/index.js +5 -4
- package/package.json +8 -3
- package/{use-content-security-policy-DjRTjIpm.d.ts → use-content-security-policy-DUYpyUPy.d.ts} +1 -18
- package/use-content-security-policy-Dvc-oObb.d.ts +17 -0
- package/vercel.d.ts +688 -0
- package/vercel.js +82 -13
- package/chunk-A5XGYLYS.js +0 -196
- package/chunk-L5EQIJZB.js +0 -54
- package/chunk-MDODCAA3.js +0 -232
package/index.js
CHANGED
|
@@ -4,14 +4,15 @@ import {
|
|
|
4
4
|
isValidCacheUrl
|
|
5
5
|
} from "./chunk-QEFORWCW.js";
|
|
6
6
|
import {
|
|
7
|
-
CSPDirectivesSchema,
|
|
8
|
-
CSPModeSchema,
|
|
9
7
|
useContentSecurityPolicy
|
|
10
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-YBWFEBZC.js";
|
|
11
9
|
import {
|
|
12
10
|
APPWARDEN_CACHE_KEY,
|
|
11
|
+
CSPDirectivesSchema,
|
|
12
|
+
CSPModeSchema,
|
|
13
13
|
LOCKDOWN_TEST_EXPIRY_MS
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-HCGLR3Z3.js";
|
|
15
|
+
import "./chunk-G4RRFNHY.js";
|
|
15
16
|
export {
|
|
16
17
|
APPWARDEN_CACHE_KEY,
|
|
17
18
|
CSPDirectivesSchema,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appwarden/middleware",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.4.0",
|
|
4
4
|
"description": "Instantly shut off access your app deployed on Cloudflare or Vercel",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
66
|
"@astrojs/cloudflare": ">=11.0.0",
|
|
67
|
-
"@opennextjs/cloudflare": ">=1.
|
|
67
|
+
"@opennextjs/cloudflare": ">=1.16.6",
|
|
68
68
|
"@vercel/functions": ">=1.0.0",
|
|
69
69
|
"astro": ">=4.0.0",
|
|
70
70
|
"next": ">=14"
|
|
@@ -103,7 +103,12 @@
|
|
|
103
103
|
"@smithy/config-resolver@<4.4.0": ">=4.4.0",
|
|
104
104
|
"@isaacs/brace-expansion@<=5.0.0": ">=5.0.1",
|
|
105
105
|
"npm@<=11.8.0": ">=11.9.0",
|
|
106
|
-
"wrangler@>=4.0.0 <4.59.1": ">=4.59.1"
|
|
106
|
+
"wrangler@>=4.0.0 <4.59.1": ">=4.59.1",
|
|
107
|
+
"qs@>=6.7.0 <=6.14.1": ">=6.14.2",
|
|
108
|
+
"devalue@<=5.6.2": ">=5.6.3",
|
|
109
|
+
"minimatch@<10.2.1": ">=10.2.1",
|
|
110
|
+
"tar@<7.5.8": ">=7.5.8",
|
|
111
|
+
"ajv@>=7.0.0-alpha.0 <8.18.0": ">=8.18.0"
|
|
107
112
|
}
|
|
108
113
|
}
|
|
109
114
|
}
|
package/{use-content-security-policy-DjRTjIpm.d.ts → use-content-security-policy-DUYpyUPy.d.ts}
RENAMED
|
@@ -97,16 +97,6 @@ declare global {
|
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
interface MiddlewareContext {
|
|
101
|
-
hostname: string;
|
|
102
|
-
request: Request;
|
|
103
|
-
response: Response;
|
|
104
|
-
waitUntil: ExecutionContext["waitUntil"];
|
|
105
|
-
}
|
|
106
|
-
type Middleware = (context: MiddlewareContext, next: () => MiddlewareNextSchemaType) => MiddlewareNextSchemaType;
|
|
107
|
-
declare const MiddlewareNextSchema: z.ZodUnion<[z.ZodVoid, z.ZodNull, z.ZodPromise<z.ZodUnion<[z.ZodVoid, z.ZodNull]>>]>;
|
|
108
|
-
type MiddlewareNextSchemaType = z.infer<typeof MiddlewareNextSchema>;
|
|
109
|
-
|
|
110
100
|
declare const CSPDirectivesSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
111
101
|
"default-src": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
112
102
|
"script-src": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
@@ -191,7 +181,6 @@ declare const CSPDirectivesSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
|
191
181
|
}>]>;
|
|
192
182
|
declare const CSPModeSchema: z.ZodDefault<z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"disabled">, z.ZodLiteral<"report-only">, z.ZodLiteral<"enforced">]>>>;
|
|
193
183
|
declare const UseCSPInputSchema: z.ZodEffects<z.ZodObject<{
|
|
194
|
-
hostname: z.ZodOptional<z.ZodString>;
|
|
195
184
|
mode: z.ZodDefault<z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"disabled">, z.ZodLiteral<"report-only">, z.ZodLiteral<"enforced">]>>>;
|
|
196
185
|
directives: z.ZodEffects<z.ZodEffects<z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
197
186
|
"default-src": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
@@ -413,7 +402,6 @@ declare const UseCSPInputSchema: z.ZodEffects<z.ZodObject<{
|
|
|
413
402
|
"trusted-types"?: string | boolean | string[] | undefined;
|
|
414
403
|
"require-trusted-types-for"?: string | boolean | string[] | undefined;
|
|
415
404
|
} | undefined;
|
|
416
|
-
hostname?: string | undefined;
|
|
417
405
|
}, {
|
|
418
406
|
mode?: "disabled" | "report-only" | "enforced" | undefined;
|
|
419
407
|
directives?: string | {
|
|
@@ -444,7 +432,6 @@ declare const UseCSPInputSchema: z.ZodEffects<z.ZodObject<{
|
|
|
444
432
|
"trusted-types"?: string | boolean | string[] | undefined;
|
|
445
433
|
"require-trusted-types-for"?: string | boolean | string[] | undefined;
|
|
446
434
|
} | undefined;
|
|
447
|
-
hostname?: string | undefined;
|
|
448
435
|
}>, {
|
|
449
436
|
mode: "disabled" | "report-only" | "enforced";
|
|
450
437
|
directives?: {
|
|
@@ -475,7 +462,6 @@ declare const UseCSPInputSchema: z.ZodEffects<z.ZodObject<{
|
|
|
475
462
|
"trusted-types"?: string | boolean | string[] | undefined;
|
|
476
463
|
"require-trusted-types-for"?: string | boolean | string[] | undefined;
|
|
477
464
|
} | undefined;
|
|
478
|
-
hostname?: string | undefined;
|
|
479
465
|
}, {
|
|
480
466
|
mode?: "disabled" | "report-only" | "enforced" | undefined;
|
|
481
467
|
directives?: string | {
|
|
@@ -506,10 +492,7 @@ declare const UseCSPInputSchema: z.ZodEffects<z.ZodObject<{
|
|
|
506
492
|
"trusted-types"?: string | boolean | string[] | undefined;
|
|
507
493
|
"require-trusted-types-for"?: string | boolean | string[] | undefined;
|
|
508
494
|
} | undefined;
|
|
509
|
-
hostname?: string | undefined;
|
|
510
495
|
}>;
|
|
511
496
|
type UseCSPInput = z.infer<typeof UseCSPInputSchema>;
|
|
512
497
|
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
export { type Bindings as B, CSPDirectivesSchema as C, type Middleware as M, CSPModeSchema as a, useContentSecurityPolicy as u };
|
|
498
|
+
export { type Bindings as B, CSPDirectivesSchema as C, type UseCSPInput as U, CSPModeSchema as a };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { U as UseCSPInput } from './use-content-security-policy-DUYpyUPy.js';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
interface MiddlewareContext {
|
|
5
|
+
hostname: string;
|
|
6
|
+
request: Request;
|
|
7
|
+
response: Response;
|
|
8
|
+
waitUntil: ExecutionContext["waitUntil"];
|
|
9
|
+
debug: (...msg: any[]) => void;
|
|
10
|
+
}
|
|
11
|
+
type Middleware = (context: MiddlewareContext, next: () => MiddlewareNextSchemaType) => MiddlewareNextSchemaType;
|
|
12
|
+
declare const MiddlewareNextSchema: z.ZodUnion<[z.ZodVoid, z.ZodNull, z.ZodPromise<z.ZodUnion<[z.ZodVoid, z.ZodNull]>>]>;
|
|
13
|
+
type MiddlewareNextSchemaType = z.infer<typeof MiddlewareNextSchema>;
|
|
14
|
+
|
|
15
|
+
declare const useContentSecurityPolicy: (input: UseCSPInput) => Middleware;
|
|
16
|
+
|
|
17
|
+
export { type Middleware as M, useContentSecurityPolicy as u };
|