@appwarden/middleware 3.8.0 → 3.9.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/cloudflare.d.ts CHANGED
@@ -1,15 +1,15 @@
1
- import { B as Bindings } from './use-content-security-policy-DUYpyUPy.js';
1
+ import { B as Bindings } from './use-content-security-policy-jlU0Hjj8.js';
2
+ export { u as useContentSecurityPolicy } from './use-content-security-policy-jlU0Hjj8.js';
2
3
  import { z } from 'zod';
3
- export { u as useContentSecurityPolicy } from './use-content-security-policy-Dvc-oObb.js';
4
4
 
5
5
  declare const UseAppwardenInputSchema: z.ZodObject<{
6
6
  debug: z.ZodDefault<z.ZodEffects<z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>, boolean, string | boolean | undefined>>;
7
7
  lockPageSlug: z.ZodOptional<z.ZodString>;
8
8
  multidomainConfig: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
9
9
  lockPageSlug: z.ZodString;
10
- contentSecurityPolicy: z.ZodOptional<z.ZodLazy<z.ZodEffects<z.ZodObject<{
11
- mode: z.ZodDefault<z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"disabled">, z.ZodLiteral<"report-only">, z.ZodLiteral<"enforced">]>>>;
12
- directives: z.ZodEffects<z.ZodEffects<z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
10
+ contentSecurityPolicy: z.ZodOptional<z.ZodLazy<z.ZodObject<{
11
+ mode: z.ZodUnion<[z.ZodLiteral<"disabled">, z.ZodLiteral<"report-only">, z.ZodLiteral<"enforced">]>;
12
+ directives: z.ZodEffects<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodObject<{
13
13
  "default-src": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
14
14
  "script-src": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
15
15
  "style-src": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
@@ -90,7 +90,7 @@ declare const UseAppwardenInputSchema: z.ZodObject<{
90
90
  "upgrade-insecure-requests"?: string | boolean | string[] | undefined;
91
91
  "trusted-types"?: string | boolean | string[] | undefined;
92
92
  "require-trusted-types-for"?: string | boolean | string[] | undefined;
93
- }>]>>, string | {
93
+ }>]>, string | {
94
94
  "default-src"?: string | boolean | string[] | undefined;
95
95
  "script-src"?: string | boolean | string[] | undefined;
96
96
  "style-src"?: string | boolean | string[] | undefined;
@@ -117,7 +117,7 @@ declare const UseAppwardenInputSchema: z.ZodObject<{
117
117
  "upgrade-insecure-requests"?: string | boolean | string[] | undefined;
118
118
  "trusted-types"?: string | boolean | string[] | undefined;
119
119
  "require-trusted-types-for"?: string | boolean | string[] | undefined;
120
- } | undefined, string | {
120
+ }, string | {
121
121
  "default-src"?: string | boolean | string[] | undefined;
122
122
  "script-src"?: string | boolean | string[] | undefined;
123
123
  "style-src"?: string | boolean | string[] | undefined;
@@ -144,7 +144,7 @@ declare const UseAppwardenInputSchema: z.ZodObject<{
144
144
  "upgrade-insecure-requests"?: string | boolean | string[] | undefined;
145
145
  "trusted-types"?: string | boolean | string[] | undefined;
146
146
  "require-trusted-types-for"?: string | boolean | string[] | undefined;
147
- } | undefined>, {
147
+ }>, {
148
148
  "default-src"?: string | boolean | string[] | undefined;
149
149
  "script-src"?: string | boolean | string[] | undefined;
150
150
  "style-src"?: string | boolean | string[] | undefined;
@@ -198,7 +198,7 @@ declare const UseAppwardenInputSchema: z.ZodObject<{
198
198
  "upgrade-insecure-requests"?: string | boolean | string[] | undefined;
199
199
  "trusted-types"?: string | boolean | string[] | undefined;
200
200
  "require-trusted-types-for"?: string | boolean | string[] | undefined;
201
- } | undefined>;
201
+ }>;
202
202
  }, "strip", z.ZodTypeAny, {
203
203
  mode: "disabled" | "report-only" | "enforced";
204
204
  directives?: {
@@ -230,68 +230,8 @@ declare const UseAppwardenInputSchema: z.ZodObject<{
230
230
  "require-trusted-types-for"?: string | boolean | string[] | undefined;
231
231
  } | undefined;
232
232
  }, {
233
- mode?: "disabled" | "report-only" | "enforced" | undefined;
234
- directives?: string | {
235
- "default-src"?: string | boolean | string[] | undefined;
236
- "script-src"?: string | boolean | string[] | undefined;
237
- "style-src"?: string | boolean | string[] | undefined;
238
- "img-src"?: string | boolean | string[] | undefined;
239
- "connect-src"?: string | boolean | string[] | undefined;
240
- "font-src"?: string | boolean | string[] | undefined;
241
- "object-src"?: string | boolean | string[] | undefined;
242
- "media-src"?: string | boolean | string[] | undefined;
243
- "frame-src"?: string | boolean | string[] | undefined;
244
- sandbox?: string | boolean | string[] | undefined;
245
- "report-uri"?: string | boolean | string[] | undefined;
246
- "child-src"?: string | boolean | string[] | undefined;
247
- "form-action"?: string | boolean | string[] | undefined;
248
- "frame-ancestors"?: string | boolean | string[] | undefined;
249
- "plugin-types"?: string | boolean | string[] | undefined;
250
- "base-uri"?: string | boolean | string[] | undefined;
251
- "report-to"?: string | boolean | string[] | undefined;
252
- "worker-src"?: string | boolean | string[] | undefined;
253
- "manifest-src"?: string | boolean | string[] | undefined;
254
- "prefetch-src"?: string | boolean | string[] | undefined;
255
- "navigate-to"?: string | boolean | string[] | undefined;
256
- "require-sri-for"?: string | boolean | string[] | undefined;
257
- "block-all-mixed-content"?: string | boolean | string[] | undefined;
258
- "upgrade-insecure-requests"?: string | boolean | string[] | undefined;
259
- "trusted-types"?: string | boolean | string[] | undefined;
260
- "require-trusted-types-for"?: string | boolean | string[] | undefined;
261
- } | undefined;
262
- }>, {
263
233
  mode: "disabled" | "report-only" | "enforced";
264
- directives?: {
265
- "default-src"?: string | boolean | string[] | undefined;
266
- "script-src"?: string | boolean | string[] | undefined;
267
- "style-src"?: string | boolean | string[] | undefined;
268
- "img-src"?: string | boolean | string[] | undefined;
269
- "connect-src"?: string | boolean | string[] | undefined;
270
- "font-src"?: string | boolean | string[] | undefined;
271
- "object-src"?: string | boolean | string[] | undefined;
272
- "media-src"?: string | boolean | string[] | undefined;
273
- "frame-src"?: string | boolean | string[] | undefined;
274
- sandbox?: string | boolean | string[] | undefined;
275
- "report-uri"?: string | boolean | string[] | undefined;
276
- "child-src"?: string | boolean | string[] | undefined;
277
- "form-action"?: string | boolean | string[] | undefined;
278
- "frame-ancestors"?: string | boolean | string[] | undefined;
279
- "plugin-types"?: string | boolean | string[] | undefined;
280
- "base-uri"?: string | boolean | string[] | undefined;
281
- "report-to"?: string | boolean | string[] | undefined;
282
- "worker-src"?: string | boolean | string[] | undefined;
283
- "manifest-src"?: string | boolean | string[] | undefined;
284
- "prefetch-src"?: string | boolean | string[] | undefined;
285
- "navigate-to"?: string | boolean | string[] | undefined;
286
- "require-sri-for"?: string | boolean | string[] | undefined;
287
- "block-all-mixed-content"?: string | boolean | string[] | undefined;
288
- "upgrade-insecure-requests"?: string | boolean | string[] | undefined;
289
- "trusted-types"?: string | boolean | string[] | undefined;
290
- "require-trusted-types-for"?: string | boolean | string[] | undefined;
291
- } | undefined;
292
- }, {
293
- mode?: "disabled" | "report-only" | "enforced" | undefined;
294
- directives?: string | {
234
+ directives: string | {
295
235
  "default-src"?: string | boolean | string[] | undefined;
296
236
  "script-src"?: string | boolean | string[] | undefined;
297
237
  "style-src"?: string | boolean | string[] | undefined;
@@ -318,7 +258,7 @@ declare const UseAppwardenInputSchema: z.ZodObject<{
318
258
  "upgrade-insecure-requests"?: string | boolean | string[] | undefined;
319
259
  "trusted-types"?: string | boolean | string[] | undefined;
320
260
  "require-trusted-types-for"?: string | boolean | string[] | undefined;
321
- } | undefined;
261
+ };
322
262
  }>>>;
323
263
  }, "strip", z.ZodTypeAny, {
324
264
  lockPageSlug: string;
@@ -356,8 +296,8 @@ declare const UseAppwardenInputSchema: z.ZodObject<{
356
296
  }, {
357
297
  lockPageSlug: string;
358
298
  contentSecurityPolicy?: {
359
- mode?: "disabled" | "report-only" | "enforced" | undefined;
360
- directives?: string | {
299
+ mode: "disabled" | "report-only" | "enforced";
300
+ directives: string | {
361
301
  "default-src"?: string | boolean | string[] | undefined;
362
302
  "script-src"?: string | boolean | string[] | undefined;
363
303
  "style-src"?: string | boolean | string[] | undefined;
@@ -384,7 +324,7 @@ declare const UseAppwardenInputSchema: z.ZodObject<{
384
324
  "upgrade-insecure-requests"?: string | boolean | string[] | undefined;
385
325
  "trusted-types"?: string | boolean | string[] | undefined;
386
326
  "require-trusted-types-for"?: string | boolean | string[] | undefined;
387
- } | undefined;
327
+ };
388
328
  } | undefined;
389
329
  }>>>;
390
330
  appwardenApiToken: z.ZodEffects<z.ZodString, string, string>;
@@ -435,8 +375,8 @@ declare const UseAppwardenInputSchema: z.ZodObject<{
435
375
  multidomainConfig?: Record<string, {
436
376
  lockPageSlug: string;
437
377
  contentSecurityPolicy?: {
438
- mode?: "disabled" | "report-only" | "enforced" | undefined;
439
- directives?: string | {
378
+ mode: "disabled" | "report-only" | "enforced";
379
+ directives: string | {
440
380
  "default-src"?: string | boolean | string[] | undefined;
441
381
  "script-src"?: string | boolean | string[] | undefined;
442
382
  "style-src"?: string | boolean | string[] | undefined;
@@ -463,7 +403,7 @@ declare const UseAppwardenInputSchema: z.ZodObject<{
463
403
  "upgrade-insecure-requests"?: string | boolean | string[] | undefined;
464
404
  "trusted-types"?: string | boolean | string[] | undefined;
465
405
  "require-trusted-types-for"?: string | boolean | string[] | undefined;
466
- } | undefined;
406
+ };
467
407
  } | undefined;
468
408
  }> | undefined;
469
409
  appwardenApiHostname?: string | undefined;
package/cloudflare.js CHANGED
@@ -1,28 +1,25 @@
1
1
  import {
2
2
  useContentSecurityPolicy
3
- } from "./chunk-52NBQDQT.js";
3
+ } from "./chunk-VSCXTBP6.js";
4
4
  import {
5
5
  checkLockStatus
6
- } from "./chunk-G5FWKV2Q.js";
6
+ } from "./chunk-MYIKUPTR.js";
7
7
  import {
8
8
  buildLockPageUrl,
9
9
  createRedirect,
10
10
  debug,
11
11
  isOnLockPage
12
- } from "./chunk-EPJ4ZVO6.js";
12
+ } from "./chunk-Z7FIMIZS.js";
13
13
  import {
14
- APPWARDEN_CACHE_KEY,
15
14
  UseCSPInputSchema,
16
15
  isHTMLRequest
17
- } from "./chunk-HCGLR3Z3.js";
16
+ } from "./chunk-UIIYORBW.js";
18
17
  import {
19
18
  AppwardenApiTokenSchema,
20
19
  BooleanSchema,
21
- getLockValue,
22
20
  insertErrorLogs,
23
- printMessage,
24
- store
25
- } from "./chunk-GK6JL5NZ.js";
21
+ printMessage
22
+ } from "./chunk-QGXPAVOA.js";
26
23
 
27
24
  // src/runners/appwarden-on-cloudflare.ts
28
25
  import { ZodError } from "zod";
@@ -78,43 +75,12 @@ var usePipeline = (...initMiddlewares) => {
78
75
  };
79
76
  };
80
77
 
81
- // src/handlers/reset-cache.ts
82
- var isResetCacheRequest = (request) => request.method === "POST" && new URL(request.url).pathname === "/__appwarden/reset-cache" && request.headers.get("content-type") === "application/json";
83
- var handleResetCache = async (keyName, provider, edgeCache, request) => {
84
- const { lockValue } = await getLockValue({
85
- keyName,
86
- provider,
87
- edgeCache
88
- });
89
- try {
90
- const body = await request.clone().json();
91
- if (body.code === lockValue?.code) {
92
- await edgeCache.deleteValue();
93
- }
94
- } catch (error) {
95
- }
96
- };
97
-
98
78
  // src/middlewares/use-appwarden.ts
99
79
  var useAppwarden = (input) => async (context, next) => {
100
80
  const { request } = context;
101
81
  let shouldCallNext = true;
102
82
  try {
103
83
  const requestUrl = new URL(request.url);
104
- if (isResetCacheRequest(request)) {
105
- const provider = "cloudflare-cache";
106
- const keyName = APPWARDEN_CACHE_KEY;
107
- const edgeCache = store.json(
108
- {
109
- serviceOrigin: requestUrl.origin,
110
- cache: await caches.open("appwarden:lock"),
111
- debug: context.debug
112
- },
113
- keyName
114
- );
115
- await handleResetCache(keyName, provider, edgeCache, request);
116
- return;
117
- }
118
84
  if (!isHTMLRequest(request)) {
119
85
  return;
120
86
  }
package/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
- export { B as Bindings, C as CSPDirectivesSchema, a as CSPModeSchema } from './use-content-security-policy-DUYpyUPy.js';
2
- export { M as Middleware, u as useContentSecurityPolicy } from './use-content-security-policy-Dvc-oObb.js';
1
+ export { B as Bindings, C as CSPDirectivesSchema, a as CSPModeSchema, M as Middleware, u as useContentSecurityPolicy } from './use-content-security-policy-jlU0Hjj8.js';
3
2
  import { z } from 'zod';
4
3
 
5
4
  declare const LOCKDOWN_TEST_EXPIRY_MS: number;
@@ -50,14 +49,11 @@ declare const LockValue: z.ZodObject<{
50
49
  isLocked: z.ZodNumber;
51
50
  isLockedTest: z.ZodNumber;
52
51
  lastCheck: z.ZodNumber;
53
- code: z.ZodString;
54
52
  }, "strip", z.ZodTypeAny, {
55
- code: string;
56
53
  isLocked: number;
57
54
  isLockedTest: number;
58
55
  lastCheck: number;
59
56
  }, {
60
- code: string;
61
57
  isLocked: number;
62
58
  isLockedTest: number;
63
59
  lastCheck: number;
package/index.js CHANGED
@@ -5,14 +5,14 @@ import {
5
5
  } from "./chunk-QEFORWCW.js";
6
6
  import {
7
7
  useContentSecurityPolicy
8
- } from "./chunk-52NBQDQT.js";
8
+ } from "./chunk-VSCXTBP6.js";
9
9
  import {
10
10
  APPWARDEN_CACHE_KEY,
11
11
  CSPDirectivesSchema,
12
12
  CSPModeSchema,
13
13
  LOCKDOWN_TEST_EXPIRY_MS
14
- } from "./chunk-HCGLR3Z3.js";
15
- import "./chunk-GK6JL5NZ.js";
14
+ } from "./chunk-UIIYORBW.js";
15
+ import "./chunk-QGXPAVOA.js";
16
16
  export {
17
17
  APPWARDEN_CACHE_KEY,
18
18
  CSPDirectivesSchema,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@appwarden/middleware",
3
- "version": "3.8.0",
4
- "description": "Instantly shut off access your app deployed on Cloudflare or Vercel",
3
+ "version": "3.9.0",
4
+ "description": "Instantly disable all user interaction with your app deployed on Cloudflare or Vercel",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "author": "Appwarden <support@appwarden.io>",
@@ -58,7 +58,7 @@
58
58
  "node": ">=24"
59
59
  },
60
60
  "dependencies": {
61
- "@upstash/redis": "^1.36.2",
61
+ "@upstash/redis": "^1.36.3",
62
62
  "@vercel/edge-config": "^1.4.3",
63
63
  "zod": "^3.25.76"
64
64
  },
@@ -117,7 +117,10 @@
117
117
  "h3@<=1.15.4": ">=1.15.5",
118
118
  "js-yaml@<3.14.2": ">=3.14.2",
119
119
  "fast-xml-parser@<5.3.8": ">=5.3.8",
120
- "serialize-javascript@<=7.0.2": ">=7.0.3"
120
+ "serialize-javascript@<=7.0.2": ">=7.0.3",
121
+ "svgo@=4.0.0": ">=4.0.1",
122
+ "@opennextjs/cloudflare@<1.17.1": ">=1.17.1",
123
+ "tar@<=7.5.9": ">=7.5.10"
121
124
  }
122
125
  }
123
126
  }
@@ -97,6 +97,17 @@ 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
+ debug: (...msg: any[]) => void;
106
+ }
107
+ type Middleware = (context: MiddlewareContext, next: () => MiddlewareNextSchemaType) => MiddlewareNextSchemaType;
108
+ declare const MiddlewareNextSchema: z.ZodUnion<[z.ZodVoid, z.ZodNull, z.ZodPromise<z.ZodUnion<[z.ZodVoid, z.ZodNull]>>]>;
109
+ type MiddlewareNextSchemaType = z.infer<typeof MiddlewareNextSchema>;
110
+
100
111
  declare const CSPDirectivesSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
101
112
  "default-src": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
102
113
  "script-src": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
@@ -179,10 +190,10 @@ declare const CSPDirectivesSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
179
190
  "trusted-types"?: string | boolean | string[] | undefined;
180
191
  "require-trusted-types-for"?: string | boolean | string[] | undefined;
181
192
  }>]>;
182
- declare const CSPModeSchema: z.ZodDefault<z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"disabled">, z.ZodLiteral<"report-only">, z.ZodLiteral<"enforced">]>>>;
183
- declare const UseCSPInputSchema: z.ZodEffects<z.ZodObject<{
184
- mode: z.ZodDefault<z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"disabled">, z.ZodLiteral<"report-only">, z.ZodLiteral<"enforced">]>>>;
185
- directives: z.ZodEffects<z.ZodEffects<z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
193
+ declare const CSPModeSchema: z.ZodUnion<[z.ZodLiteral<"disabled">, z.ZodLiteral<"report-only">, z.ZodLiteral<"enforced">]>;
194
+ declare const UseCSPInputSchema: z.ZodObject<{
195
+ mode: z.ZodUnion<[z.ZodLiteral<"disabled">, z.ZodLiteral<"report-only">, z.ZodLiteral<"enforced">]>;
196
+ directives: z.ZodEffects<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodObject<{
186
197
  "default-src": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
187
198
  "script-src": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
188
199
  "style-src": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
@@ -263,7 +274,7 @@ declare const UseCSPInputSchema: z.ZodEffects<z.ZodObject<{
263
274
  "upgrade-insecure-requests"?: string | boolean | string[] | undefined;
264
275
  "trusted-types"?: string | boolean | string[] | undefined;
265
276
  "require-trusted-types-for"?: string | boolean | string[] | undefined;
266
- }>]>>, string | {
277
+ }>]>, string | {
267
278
  "default-src"?: string | boolean | string[] | undefined;
268
279
  "script-src"?: string | boolean | string[] | undefined;
269
280
  "style-src"?: string | boolean | string[] | undefined;
@@ -290,7 +301,7 @@ declare const UseCSPInputSchema: z.ZodEffects<z.ZodObject<{
290
301
  "upgrade-insecure-requests"?: string | boolean | string[] | undefined;
291
302
  "trusted-types"?: string | boolean | string[] | undefined;
292
303
  "require-trusted-types-for"?: string | boolean | string[] | undefined;
293
- } | undefined, string | {
304
+ }, string | {
294
305
  "default-src"?: string | boolean | string[] | undefined;
295
306
  "script-src"?: string | boolean | string[] | undefined;
296
307
  "style-src"?: string | boolean | string[] | undefined;
@@ -317,7 +328,7 @@ declare const UseCSPInputSchema: z.ZodEffects<z.ZodObject<{
317
328
  "upgrade-insecure-requests"?: string | boolean | string[] | undefined;
318
329
  "trusted-types"?: string | boolean | string[] | undefined;
319
330
  "require-trusted-types-for"?: string | boolean | string[] | undefined;
320
- } | undefined>, {
331
+ }>, {
321
332
  "default-src"?: string | boolean | string[] | undefined;
322
333
  "script-src"?: string | boolean | string[] | undefined;
323
334
  "style-src"?: string | boolean | string[] | undefined;
@@ -371,7 +382,7 @@ declare const UseCSPInputSchema: z.ZodEffects<z.ZodObject<{
371
382
  "upgrade-insecure-requests"?: string | boolean | string[] | undefined;
372
383
  "trusted-types"?: string | boolean | string[] | undefined;
373
384
  "require-trusted-types-for"?: string | boolean | string[] | undefined;
374
- } | undefined>;
385
+ }>;
375
386
  }, "strip", z.ZodTypeAny, {
376
387
  mode: "disabled" | "report-only" | "enforced";
377
388
  directives?: {
@@ -403,38 +414,8 @@ declare const UseCSPInputSchema: z.ZodEffects<z.ZodObject<{
403
414
  "require-trusted-types-for"?: string | boolean | string[] | undefined;
404
415
  } | undefined;
405
416
  }, {
406
- mode?: "disabled" | "report-only" | "enforced" | undefined;
407
- directives?: string | {
408
- "default-src"?: string | boolean | string[] | undefined;
409
- "script-src"?: string | boolean | string[] | undefined;
410
- "style-src"?: string | boolean | string[] | undefined;
411
- "img-src"?: string | boolean | string[] | undefined;
412
- "connect-src"?: string | boolean | string[] | undefined;
413
- "font-src"?: string | boolean | string[] | undefined;
414
- "object-src"?: string | boolean | string[] | undefined;
415
- "media-src"?: string | boolean | string[] | undefined;
416
- "frame-src"?: string | boolean | string[] | undefined;
417
- sandbox?: string | boolean | string[] | undefined;
418
- "report-uri"?: string | boolean | string[] | undefined;
419
- "child-src"?: string | boolean | string[] | undefined;
420
- "form-action"?: string | boolean | string[] | undefined;
421
- "frame-ancestors"?: string | boolean | string[] | undefined;
422
- "plugin-types"?: string | boolean | string[] | undefined;
423
- "base-uri"?: string | boolean | string[] | undefined;
424
- "report-to"?: string | boolean | string[] | undefined;
425
- "worker-src"?: string | boolean | string[] | undefined;
426
- "manifest-src"?: string | boolean | string[] | undefined;
427
- "prefetch-src"?: string | boolean | string[] | undefined;
428
- "navigate-to"?: string | boolean | string[] | undefined;
429
- "require-sri-for"?: string | boolean | string[] | undefined;
430
- "block-all-mixed-content"?: string | boolean | string[] | undefined;
431
- "upgrade-insecure-requests"?: string | boolean | string[] | undefined;
432
- "trusted-types"?: string | boolean | string[] | undefined;
433
- "require-trusted-types-for"?: string | boolean | string[] | undefined;
434
- } | undefined;
435
- }>, {
436
417
  mode: "disabled" | "report-only" | "enforced";
437
- directives?: {
418
+ directives: string | {
438
419
  "default-src"?: string | boolean | string[] | undefined;
439
420
  "script-src"?: string | boolean | string[] | undefined;
440
421
  "style-src"?: string | boolean | string[] | undefined;
@@ -461,38 +442,10 @@ declare const UseCSPInputSchema: z.ZodEffects<z.ZodObject<{
461
442
  "upgrade-insecure-requests"?: string | boolean | string[] | undefined;
462
443
  "trusted-types"?: string | boolean | string[] | undefined;
463
444
  "require-trusted-types-for"?: string | boolean | string[] | undefined;
464
- } | undefined;
465
- }, {
466
- mode?: "disabled" | "report-only" | "enforced" | undefined;
467
- directives?: string | {
468
- "default-src"?: string | boolean | string[] | undefined;
469
- "script-src"?: string | boolean | string[] | undefined;
470
- "style-src"?: string | boolean | string[] | undefined;
471
- "img-src"?: string | boolean | string[] | undefined;
472
- "connect-src"?: string | boolean | string[] | undefined;
473
- "font-src"?: string | boolean | string[] | undefined;
474
- "object-src"?: string | boolean | string[] | undefined;
475
- "media-src"?: string | boolean | string[] | undefined;
476
- "frame-src"?: string | boolean | string[] | undefined;
477
- sandbox?: string | boolean | string[] | undefined;
478
- "report-uri"?: string | boolean | string[] | undefined;
479
- "child-src"?: string | boolean | string[] | undefined;
480
- "form-action"?: string | boolean | string[] | undefined;
481
- "frame-ancestors"?: string | boolean | string[] | undefined;
482
- "plugin-types"?: string | boolean | string[] | undefined;
483
- "base-uri"?: string | boolean | string[] | undefined;
484
- "report-to"?: string | boolean | string[] | undefined;
485
- "worker-src"?: string | boolean | string[] | undefined;
486
- "manifest-src"?: string | boolean | string[] | undefined;
487
- "prefetch-src"?: string | boolean | string[] | undefined;
488
- "navigate-to"?: string | boolean | string[] | undefined;
489
- "require-sri-for"?: string | boolean | string[] | undefined;
490
- "block-all-mixed-content"?: string | boolean | string[] | undefined;
491
- "upgrade-insecure-requests"?: string | boolean | string[] | undefined;
492
- "trusted-types"?: string | boolean | string[] | undefined;
493
- "require-trusted-types-for"?: string | boolean | string[] | undefined;
494
- } | undefined;
445
+ };
495
446
  }>;
496
447
  type UseCSPInput = z.infer<typeof UseCSPInputSchema>;
497
448
 
498
- export { type Bindings as B, CSPDirectivesSchema as C, type UseCSPInput as U, CSPModeSchema as a };
449
+ declare const useContentSecurityPolicy: (input: UseCSPInput) => Middleware;
450
+
451
+ export { type Bindings as B, CSPDirectivesSchema as C, type Middleware as M, CSPModeSchema as a, useContentSecurityPolicy as u };