@appwarden/middleware 3.11.0 → 3.11.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 +1 -1
- package/{chunk-KE2UVIYR.js → chunk-6JYUNSUJ.js} +1 -1
- package/{chunk-QUVGY2YI.js → chunk-ASH6UZ27.js} +6 -0
- package/{chunk-K7ZIT3FM.js → chunk-RQLMO5FA.js} +1 -1
- package/{chunk-ZOYE6D3A.js → chunk-VQIRZMED.js} +2 -2
- package/cloudflare/astro.d.ts +1 -1
- package/cloudflare/astro.js +6 -5
- package/cloudflare/nextjs.d.ts +1 -1
- package/cloudflare/nextjs.js +6 -5
- package/cloudflare/react-router.d.ts +1 -1
- package/cloudflare/react-router.js +6 -5
- package/cloudflare/tanstack-start.d.ts +1 -1
- package/cloudflare/tanstack-start.js +6 -5
- package/{cloudflare-JVRRPVRP.js → cloudflare-TJXWELMX.js} +1 -1
- package/cloudflare.d.ts +1 -1
- package/cloudflare.js +6 -5
- package/index.js +2 -2
- package/package.json +1 -1
- package/vercel.d.ts +11 -0
- package/vercel.js +7 -3
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
[](https://github.com/appwarden/middleware)
|
|
5
5
|
[](https://www.npmjs.com/package/@appwarden/middleware)
|
|
6
6
|
[](https://docs.npmjs.com/generating-provenance-statements)
|
|
7
|
-

|
|
8
8
|
[](https://opensource.org/licenses/MIT)
|
|
9
9
|
|
|
10
10
|
## Core Features
|
|
@@ -113,6 +113,11 @@ var BooleanSchema = BoolOrStringSchema.transform((val) => {
|
|
|
113
113
|
throw new Error("Invalid value");
|
|
114
114
|
});
|
|
115
115
|
var AppwardenApiTokenSchema = z.string().refine((val) => !!val, { message: "appwardenApiToken is required" });
|
|
116
|
+
var AppwardenApiHostnameSchema = z.string().url({
|
|
117
|
+
message: "Invalid `appwardenApiHostname`. Please provide an absolute URL (e.g. https://api.appwarden.io)."
|
|
118
|
+
}).refine((value) => value.startsWith("https://"), {
|
|
119
|
+
message: "`appwardenApiHostname` must use the https:// scheme (e.g. https://api.appwarden.io)."
|
|
120
|
+
});
|
|
116
121
|
var LockValue = z.object({
|
|
117
122
|
isLocked: z.number(),
|
|
118
123
|
isLockedTest: z.number(),
|
|
@@ -306,6 +311,7 @@ export {
|
|
|
306
311
|
getErrors,
|
|
307
312
|
BooleanSchema,
|
|
308
313
|
AppwardenApiTokenSchema,
|
|
314
|
+
AppwardenApiHostnameSchema,
|
|
309
315
|
LockValue,
|
|
310
316
|
store,
|
|
311
317
|
CSP_KEYWORDS,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MemoryCache,
|
|
3
3
|
debug
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-6JYUNSUJ.js";
|
|
5
5
|
import {
|
|
6
6
|
APPWARDEN_CACHE_KEY,
|
|
7
7
|
APPWARDEN_TEST_ROUTE
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
getLockValue,
|
|
12
12
|
store,
|
|
13
13
|
syncEdgeValue
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-ASH6UZ27.js";
|
|
15
15
|
|
|
16
16
|
// src/core/check-lock-status.ts
|
|
17
17
|
var createContext = async (config) => {
|
package/cloudflare/astro.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ declare const AstroCloudflareConfigSchema: z.ZodObject<{
|
|
|
12
12
|
/** The Appwarden API token for authentication */
|
|
13
13
|
appwardenApiToken: z.ZodEffects<z.ZodString, string, string>;
|
|
14
14
|
/** Optional custom API hostname (defaults to https://api.appwarden.io) */
|
|
15
|
-
appwardenApiHostname: z.ZodOptional<z.ZodString
|
|
15
|
+
appwardenApiHostname: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
16
16
|
/** Enable debug logging */
|
|
17
17
|
debug: z.ZodDefault<z.ZodEffects<z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>, boolean, string | boolean | undefined>>;
|
|
18
18
|
/** Optional Content Security Policy configuration */
|
package/cloudflare/astro.js
CHANGED
|
@@ -3,29 +3,30 @@ import {
|
|
|
3
3
|
} from "../chunk-XFG6SUSV.js";
|
|
4
4
|
import {
|
|
5
5
|
useContentSecurityPolicy
|
|
6
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-RQLMO5FA.js";
|
|
7
7
|
import {
|
|
8
8
|
getNowMs
|
|
9
9
|
} from "../chunk-X7WZVYQS.js";
|
|
10
10
|
import {
|
|
11
11
|
checkLockStatus
|
|
12
|
-
} from "../chunk-
|
|
12
|
+
} from "../chunk-VQIRZMED.js";
|
|
13
13
|
import {
|
|
14
14
|
TEMPORARY_REDIRECT_STATUS,
|
|
15
15
|
buildLockPageUrl,
|
|
16
16
|
createRedirect,
|
|
17
17
|
debug,
|
|
18
18
|
isOnLockPage
|
|
19
|
-
} from "../chunk-
|
|
19
|
+
} from "../chunk-6JYUNSUJ.js";
|
|
20
20
|
import {
|
|
21
21
|
UseCSPInputSchema,
|
|
22
22
|
isHTMLRequest
|
|
23
23
|
} from "../chunk-2WPLLVUI.js";
|
|
24
24
|
import {
|
|
25
|
+
AppwardenApiHostnameSchema,
|
|
25
26
|
AppwardenApiTokenSchema,
|
|
26
27
|
BooleanSchema,
|
|
27
28
|
printMessage
|
|
28
|
-
} from "../chunk-
|
|
29
|
+
} from "../chunk-ASH6UZ27.js";
|
|
29
30
|
|
|
30
31
|
// src/adapters/astro-cloudflare.ts
|
|
31
32
|
import { waitUntil } from "cloudflare:workers";
|
|
@@ -38,7 +39,7 @@ var AstroCloudflareConfigSchema = z.object({
|
|
|
38
39
|
/** The Appwarden API token for authentication */
|
|
39
40
|
appwardenApiToken: AppwardenApiTokenSchema,
|
|
40
41
|
/** Optional custom API hostname (defaults to https://api.appwarden.io) */
|
|
41
|
-
appwardenApiHostname:
|
|
42
|
+
appwardenApiHostname: AppwardenApiHostnameSchema.optional(),
|
|
42
43
|
/** Enable debug logging */
|
|
43
44
|
debug: BooleanSchema.default(false),
|
|
44
45
|
/** Optional Content Security Policy configuration */
|
package/cloudflare/nextjs.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ declare const NextJsCloudflareConfigSchema: z.ZodObject<{
|
|
|
11
11
|
/** The Appwarden API token for authentication */
|
|
12
12
|
appwardenApiToken: z.ZodEffects<z.ZodString, string, string>;
|
|
13
13
|
/** Optional custom API hostname (defaults to https://api.appwarden.io) */
|
|
14
|
-
appwardenApiHostname: z.ZodOptional<z.ZodString
|
|
14
|
+
appwardenApiHostname: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
15
15
|
/** Enable debug logging */
|
|
16
16
|
debug: z.ZodDefault<z.ZodEffects<z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>, boolean, string | boolean | undefined>>;
|
|
17
17
|
/** Optional Content Security Policy configuration (headers only, no HTML rewriting; '{{nonce}}' is not supported) */
|
package/cloudflare/nextjs.js
CHANGED
|
@@ -3,22 +3,23 @@ import {
|
|
|
3
3
|
} from "../chunk-X7WZVYQS.js";
|
|
4
4
|
import {
|
|
5
5
|
checkLockStatus
|
|
6
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-VQIRZMED.js";
|
|
7
7
|
import {
|
|
8
8
|
TEMPORARY_REDIRECT_STATUS,
|
|
9
9
|
buildLockPageUrl,
|
|
10
10
|
debug,
|
|
11
11
|
isOnLockPage
|
|
12
|
-
} from "../chunk-
|
|
12
|
+
} from "../chunk-6JYUNSUJ.js";
|
|
13
13
|
import {
|
|
14
14
|
UseCSPInputSchema,
|
|
15
15
|
isHTMLRequest
|
|
16
16
|
} from "../chunk-2WPLLVUI.js";
|
|
17
17
|
import {
|
|
18
|
+
AppwardenApiHostnameSchema,
|
|
18
19
|
AppwardenApiTokenSchema,
|
|
19
20
|
BooleanSchema,
|
|
20
21
|
printMessage
|
|
21
|
-
} from "../chunk-
|
|
22
|
+
} from "../chunk-ASH6UZ27.js";
|
|
22
23
|
|
|
23
24
|
// src/adapters/nextjs-cloudflare.ts
|
|
24
25
|
import {
|
|
@@ -44,7 +45,7 @@ var NextJsCloudflareConfigSchema = z.object({
|
|
|
44
45
|
/** The Appwarden API token for authentication */
|
|
45
46
|
appwardenApiToken: AppwardenApiTokenSchema,
|
|
46
47
|
/** Optional custom API hostname (defaults to https://api.appwarden.io) */
|
|
47
|
-
appwardenApiHostname:
|
|
48
|
+
appwardenApiHostname: AppwardenApiHostnameSchema.optional(),
|
|
48
49
|
/** Enable debug logging */
|
|
49
50
|
debug: BooleanSchema.default(false),
|
|
50
51
|
/** Optional Content Security Policy configuration (headers only, no HTML rewriting; '{{nonce}}' is not supported) */
|
|
@@ -101,7 +102,7 @@ function createAppwardenMiddleware(configFn) {
|
|
|
101
102
|
debugFn(
|
|
102
103
|
`Applying CSP headers in ${config.contentSecurityPolicy.mode} mode`
|
|
103
104
|
);
|
|
104
|
-
const { makeCSPHeader } = await import("../cloudflare-
|
|
105
|
+
const { makeCSPHeader } = await import("../cloudflare-TJXWELMX.js");
|
|
105
106
|
const [headerName, headerValue] = makeCSPHeader(
|
|
106
107
|
"",
|
|
107
108
|
config.contentSecurityPolicy.directives,
|
|
@@ -10,7 +10,7 @@ declare const ReactRouterCloudflareConfigSchema: z.ZodObject<{
|
|
|
10
10
|
/** The Appwarden API token for authentication */
|
|
11
11
|
appwardenApiToken: z.ZodEffects<z.ZodString, string, string>;
|
|
12
12
|
/** Optional custom API hostname (defaults to https://api.appwarden.io) */
|
|
13
|
-
appwardenApiHostname: z.ZodOptional<z.ZodString
|
|
13
|
+
appwardenApiHostname: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
14
14
|
/** Enable debug logging */
|
|
15
15
|
debug: z.ZodDefault<z.ZodEffects<z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>, boolean, string | boolean | undefined>>;
|
|
16
16
|
/** Optional Content Security Policy configuration */
|
|
@@ -3,28 +3,29 @@ import {
|
|
|
3
3
|
} from "../chunk-XFG6SUSV.js";
|
|
4
4
|
import {
|
|
5
5
|
useContentSecurityPolicy
|
|
6
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-RQLMO5FA.js";
|
|
7
7
|
import {
|
|
8
8
|
getNowMs
|
|
9
9
|
} from "../chunk-X7WZVYQS.js";
|
|
10
10
|
import {
|
|
11
11
|
checkLockStatus
|
|
12
|
-
} from "../chunk-
|
|
12
|
+
} from "../chunk-VQIRZMED.js";
|
|
13
13
|
import {
|
|
14
14
|
buildLockPageUrl,
|
|
15
15
|
createRedirect,
|
|
16
16
|
debug,
|
|
17
17
|
isOnLockPage
|
|
18
|
-
} from "../chunk-
|
|
18
|
+
} from "../chunk-6JYUNSUJ.js";
|
|
19
19
|
import {
|
|
20
20
|
UseCSPInputSchema,
|
|
21
21
|
isHTMLRequest
|
|
22
22
|
} from "../chunk-2WPLLVUI.js";
|
|
23
23
|
import {
|
|
24
|
+
AppwardenApiHostnameSchema,
|
|
24
25
|
AppwardenApiTokenSchema,
|
|
25
26
|
BooleanSchema,
|
|
26
27
|
printMessage
|
|
27
|
-
} from "../chunk-
|
|
28
|
+
} from "../chunk-ASH6UZ27.js";
|
|
28
29
|
|
|
29
30
|
// src/adapters/react-router-cloudflare.ts
|
|
30
31
|
import { waitUntil } from "cloudflare:workers";
|
|
@@ -37,7 +38,7 @@ var ReactRouterCloudflareConfigSchema = z.object({
|
|
|
37
38
|
/** The Appwarden API token for authentication */
|
|
38
39
|
appwardenApiToken: AppwardenApiTokenSchema,
|
|
39
40
|
/** Optional custom API hostname (defaults to https://api.appwarden.io) */
|
|
40
|
-
appwardenApiHostname:
|
|
41
|
+
appwardenApiHostname: AppwardenApiHostnameSchema.optional(),
|
|
41
42
|
/** Enable debug logging */
|
|
42
43
|
debug: BooleanSchema.default(false),
|
|
43
44
|
/** Optional Content Security Policy configuration */
|
|
@@ -10,7 +10,7 @@ declare const TanStackStartCloudflareConfigSchema: z.ZodObject<{
|
|
|
10
10
|
/** The Appwarden API token for authentication */
|
|
11
11
|
appwardenApiToken: z.ZodEffects<z.ZodString, string, string>;
|
|
12
12
|
/** Optional custom API hostname (defaults to https://api.appwarden.io) */
|
|
13
|
-
appwardenApiHostname: z.ZodOptional<z.ZodString
|
|
13
|
+
appwardenApiHostname: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
14
14
|
/** Enable debug logging */
|
|
15
15
|
debug: z.ZodDefault<z.ZodEffects<z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>, boolean, string | boolean | undefined>>;
|
|
16
16
|
/** Optional Content Security Policy configuration */
|
|
@@ -3,28 +3,29 @@ import {
|
|
|
3
3
|
} from "../chunk-XFG6SUSV.js";
|
|
4
4
|
import {
|
|
5
5
|
useContentSecurityPolicy
|
|
6
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-RQLMO5FA.js";
|
|
7
7
|
import {
|
|
8
8
|
getNowMs
|
|
9
9
|
} from "../chunk-X7WZVYQS.js";
|
|
10
10
|
import {
|
|
11
11
|
checkLockStatus
|
|
12
|
-
} from "../chunk-
|
|
12
|
+
} from "../chunk-VQIRZMED.js";
|
|
13
13
|
import {
|
|
14
14
|
buildLockPageUrl,
|
|
15
15
|
createRedirect,
|
|
16
16
|
debug,
|
|
17
17
|
isOnLockPage
|
|
18
|
-
} from "../chunk-
|
|
18
|
+
} from "../chunk-6JYUNSUJ.js";
|
|
19
19
|
import {
|
|
20
20
|
UseCSPInputSchema,
|
|
21
21
|
isHTMLRequest
|
|
22
22
|
} from "../chunk-2WPLLVUI.js";
|
|
23
23
|
import {
|
|
24
|
+
AppwardenApiHostnameSchema,
|
|
24
25
|
AppwardenApiTokenSchema,
|
|
25
26
|
BooleanSchema,
|
|
26
27
|
printMessage
|
|
27
|
-
} from "../chunk-
|
|
28
|
+
} from "../chunk-ASH6UZ27.js";
|
|
28
29
|
|
|
29
30
|
// src/adapters/tanstack-start-cloudflare.ts
|
|
30
31
|
import { waitUntil } from "cloudflare:workers";
|
|
@@ -37,7 +38,7 @@ var TanStackStartCloudflareConfigSchema = z.object({
|
|
|
37
38
|
/** The Appwarden API token for authentication */
|
|
38
39
|
appwardenApiToken: AppwardenApiTokenSchema,
|
|
39
40
|
/** Optional custom API hostname (defaults to https://api.appwarden.io) */
|
|
40
|
-
appwardenApiHostname:
|
|
41
|
+
appwardenApiHostname: AppwardenApiHostnameSchema.optional(),
|
|
41
42
|
/** Enable debug logging */
|
|
42
43
|
debug: BooleanSchema.default(false),
|
|
43
44
|
/** Optional Content Security Policy configuration */
|
package/cloudflare.d.ts
CHANGED
|
@@ -331,7 +331,7 @@ declare const UseAppwardenInputSchema: z.ZodObject<{
|
|
|
331
331
|
} | undefined;
|
|
332
332
|
}>>>;
|
|
333
333
|
appwardenApiToken: z.ZodEffects<z.ZodString, string, string>;
|
|
334
|
-
appwardenApiHostname: z.ZodOptional<z.ZodString
|
|
334
|
+
appwardenApiHostname: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
335
335
|
}, "strip", z.ZodTypeAny, {
|
|
336
336
|
debug: boolean;
|
|
337
337
|
appwardenApiToken: string;
|
package/cloudflare.js
CHANGED
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useContentSecurityPolicy
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-RQLMO5FA.js";
|
|
4
4
|
import {
|
|
5
5
|
checkLockStatus
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-VQIRZMED.js";
|
|
7
7
|
import {
|
|
8
8
|
buildLockPageUrl,
|
|
9
9
|
createRedirect,
|
|
10
10
|
debug,
|
|
11
11
|
isOnLockPage
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-6JYUNSUJ.js";
|
|
13
13
|
import {
|
|
14
14
|
UseCSPInputSchema,
|
|
15
15
|
isHTMLRequest
|
|
16
16
|
} from "./chunk-2WPLLVUI.js";
|
|
17
17
|
import {
|
|
18
|
+
AppwardenApiHostnameSchema,
|
|
18
19
|
AppwardenApiTokenSchema,
|
|
19
20
|
BooleanSchema,
|
|
20
21
|
insertErrorLogs,
|
|
21
22
|
printMessage
|
|
22
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-ASH6UZ27.js";
|
|
23
24
|
|
|
24
25
|
// src/runners/appwarden-on-cloudflare.ts
|
|
25
26
|
import { ZodError } from "zod";
|
|
@@ -42,7 +43,7 @@ var UseAppwardenInputSchema = z.object({
|
|
|
42
43
|
lockPageSlug: z.string().optional(),
|
|
43
44
|
multidomainConfig: AppwardenMultidomainConfigSchema.optional(),
|
|
44
45
|
appwardenApiToken: AppwardenApiTokenSchema,
|
|
45
|
-
appwardenApiHostname:
|
|
46
|
+
appwardenApiHostname: AppwardenApiHostnameSchema.optional()
|
|
46
47
|
});
|
|
47
48
|
var lockPageSlugRefinement = (schema) => schema.refine(
|
|
48
49
|
(data) => data.lockPageSlug || data.multidomainConfig,
|
package/index.js
CHANGED
|
@@ -5,14 +5,14 @@ import {
|
|
|
5
5
|
} from "./chunk-QEFORWCW.js";
|
|
6
6
|
import {
|
|
7
7
|
useContentSecurityPolicy
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-RQLMO5FA.js";
|
|
9
9
|
import {
|
|
10
10
|
APPWARDEN_CACHE_KEY,
|
|
11
11
|
CSPDirectivesSchema,
|
|
12
12
|
CSPModeSchema,
|
|
13
13
|
LOCKDOWN_TEST_EXPIRY_MS
|
|
14
14
|
} from "./chunk-2WPLLVUI.js";
|
|
15
|
-
import "./chunk-
|
|
15
|
+
import "./chunk-ASH6UZ27.js";
|
|
16
16
|
export {
|
|
17
17
|
APPWARDEN_CACHE_KEY,
|
|
18
18
|
CSPDirectivesSchema,
|
package/package.json
CHANGED
package/vercel.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { z } from 'zod';
|
|
|
3
3
|
declare const AppwardenConfigSchema: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
4
4
|
cacheUrl: z.ZodString;
|
|
5
5
|
appwardenApiToken: z.ZodString;
|
|
6
|
+
appwardenApiHostname: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
6
7
|
vercelApiToken: z.ZodOptional<z.ZodString>;
|
|
7
8
|
debug: z.ZodOptional<z.ZodBoolean>;
|
|
8
9
|
lockPageSlug: z.ZodEffects<z.ZodDefault<z.ZodString>, string, string | undefined>;
|
|
@@ -349,6 +350,7 @@ declare const AppwardenConfigSchema: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.Zo
|
|
|
349
350
|
"require-trusted-types-for"?: string | boolean | string[] | undefined;
|
|
350
351
|
} | undefined;
|
|
351
352
|
} | undefined;
|
|
353
|
+
appwardenApiHostname?: string | undefined;
|
|
352
354
|
vercelApiToken?: string | undefined;
|
|
353
355
|
}, {
|
|
354
356
|
appwardenApiToken: string;
|
|
@@ -386,6 +388,7 @@ declare const AppwardenConfigSchema: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.Zo
|
|
|
386
388
|
"require-trusted-types-for"?: string | boolean | string[] | undefined;
|
|
387
389
|
};
|
|
388
390
|
} | undefined;
|
|
391
|
+
appwardenApiHostname?: string | undefined;
|
|
389
392
|
vercelApiToken?: string | undefined;
|
|
390
393
|
}>, {
|
|
391
394
|
lockPageSlug: string;
|
|
@@ -423,6 +426,7 @@ declare const AppwardenConfigSchema: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.Zo
|
|
|
423
426
|
"require-trusted-types-for"?: string | boolean | string[] | undefined;
|
|
424
427
|
} | undefined;
|
|
425
428
|
} | undefined;
|
|
429
|
+
appwardenApiHostname?: string | undefined;
|
|
426
430
|
vercelApiToken?: string | undefined;
|
|
427
431
|
}, {
|
|
428
432
|
appwardenApiToken: string;
|
|
@@ -460,6 +464,7 @@ declare const AppwardenConfigSchema: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.Zo
|
|
|
460
464
|
"require-trusted-types-for"?: string | boolean | string[] | undefined;
|
|
461
465
|
};
|
|
462
466
|
} | undefined;
|
|
467
|
+
appwardenApiHostname?: string | undefined;
|
|
463
468
|
vercelApiToken?: string | undefined;
|
|
464
469
|
}>, {
|
|
465
470
|
lockPageSlug: string;
|
|
@@ -497,6 +502,7 @@ declare const AppwardenConfigSchema: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.Zo
|
|
|
497
502
|
"require-trusted-types-for"?: string | boolean | string[] | undefined;
|
|
498
503
|
} | undefined;
|
|
499
504
|
} | undefined;
|
|
505
|
+
appwardenApiHostname?: string | undefined;
|
|
500
506
|
vercelApiToken?: string | undefined;
|
|
501
507
|
}, {
|
|
502
508
|
appwardenApiToken: string;
|
|
@@ -534,6 +540,7 @@ declare const AppwardenConfigSchema: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.Zo
|
|
|
534
540
|
"require-trusted-types-for"?: string | boolean | string[] | undefined;
|
|
535
541
|
};
|
|
536
542
|
} | undefined;
|
|
543
|
+
appwardenApiHostname?: string | undefined;
|
|
537
544
|
vercelApiToken?: string | undefined;
|
|
538
545
|
}>, {
|
|
539
546
|
lockPageSlug: string;
|
|
@@ -571,6 +578,7 @@ declare const AppwardenConfigSchema: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.Zo
|
|
|
571
578
|
"require-trusted-types-for"?: string | boolean | string[] | undefined;
|
|
572
579
|
} | undefined;
|
|
573
580
|
} | undefined;
|
|
581
|
+
appwardenApiHostname?: string | undefined;
|
|
574
582
|
vercelApiToken?: string | undefined;
|
|
575
583
|
}, {
|
|
576
584
|
appwardenApiToken: string;
|
|
@@ -608,6 +616,7 @@ declare const AppwardenConfigSchema: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.Zo
|
|
|
608
616
|
"require-trusted-types-for"?: string | boolean | string[] | undefined;
|
|
609
617
|
};
|
|
610
618
|
} | undefined;
|
|
619
|
+
appwardenApiHostname?: string | undefined;
|
|
611
620
|
vercelApiToken?: string | undefined;
|
|
612
621
|
}>, {
|
|
613
622
|
lockPageSlug: string;
|
|
@@ -645,6 +654,7 @@ declare const AppwardenConfigSchema: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.Zo
|
|
|
645
654
|
"require-trusted-types-for"?: string | boolean | string[] | undefined;
|
|
646
655
|
} | undefined;
|
|
647
656
|
} | undefined;
|
|
657
|
+
appwardenApiHostname?: string | undefined;
|
|
648
658
|
vercelApiToken?: string | undefined;
|
|
649
659
|
}, {
|
|
650
660
|
appwardenApiToken: string;
|
|
@@ -682,6 +692,7 @@ declare const AppwardenConfigSchema: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.Zo
|
|
|
682
692
|
"require-trusted-types-for"?: string | boolean | string[] | undefined;
|
|
683
693
|
};
|
|
684
694
|
} | undefined;
|
|
695
|
+
appwardenApiHostname?: string | undefined;
|
|
685
696
|
vercelApiToken?: string | undefined;
|
|
686
697
|
}>;
|
|
687
698
|
type VercelAppwardenConfig = z.input<typeof AppwardenConfigSchema>;
|
package/vercel.js
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
buildLockPageUrl,
|
|
9
9
|
debug,
|
|
10
10
|
isOnLockPage
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-6JYUNSUJ.js";
|
|
12
12
|
import {
|
|
13
13
|
APPWARDEN_CACHE_KEY,
|
|
14
14
|
CSPDirectivesSchema,
|
|
@@ -18,11 +18,12 @@ import {
|
|
|
18
18
|
isHTMLRequest
|
|
19
19
|
} from "./chunk-2WPLLVUI.js";
|
|
20
20
|
import {
|
|
21
|
+
AppwardenApiHostnameSchema,
|
|
21
22
|
LockValue,
|
|
22
23
|
getErrors,
|
|
23
24
|
makeCSPHeader,
|
|
24
25
|
printMessage
|
|
25
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-ASH6UZ27.js";
|
|
26
27
|
|
|
27
28
|
// src/runners/appwarden-on-vercel.ts
|
|
28
29
|
import { waitUntil } from "@vercel/functions";
|
|
@@ -105,7 +106,8 @@ var APIError = class extends Error {
|
|
|
105
106
|
var syncEdgeValue = async (context) => {
|
|
106
107
|
context.debug("syncing with api");
|
|
107
108
|
try {
|
|
108
|
-
const
|
|
109
|
+
const apiHostname = context.appwardenApiHostname ?? "https://api.appwarden.io";
|
|
110
|
+
const response = await fetch(new URL("/v1/appwarden/status", apiHostname), {
|
|
109
111
|
method: "POST",
|
|
110
112
|
headers: { "content-type": "application/json" },
|
|
111
113
|
body: JSON.stringify({
|
|
@@ -182,6 +184,7 @@ var VercelCSPSchema = z.object({
|
|
|
182
184
|
var BaseNextJsConfigSchema = z.object({
|
|
183
185
|
cacheUrl: z.string(),
|
|
184
186
|
appwardenApiToken: z.string(),
|
|
187
|
+
appwardenApiHostname: AppwardenApiHostnameSchema.optional(),
|
|
185
188
|
vercelApiToken: z.string().optional(),
|
|
186
189
|
debug: z.boolean().optional(),
|
|
187
190
|
lockPageSlug: z.string().default("").transform((val) => val.replace(/^\/?/, "/")),
|
|
@@ -295,6 +298,7 @@ function createAppwardenMiddleware(config) {
|
|
|
295
298
|
requestUrl,
|
|
296
299
|
cacheUrl: parsedConfig.cacheUrl,
|
|
297
300
|
appwardenApiToken: parsedConfig.appwardenApiToken,
|
|
301
|
+
appwardenApiHostname: parsedConfig.appwardenApiHostname,
|
|
298
302
|
vercelApiToken: parsedConfig.vercelApiToken,
|
|
299
303
|
debug: debugFn
|
|
300
304
|
})
|