@appwarden/middleware 3.13.1 → 3.13.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/{chunk-Q5LVKCWK.js → chunk-7FPMUPAS.js} +1 -1
- package/{chunk-U7E4KM2B.js → chunk-EG6TX7RH.js} +52 -9
- package/{chunk-CVOSFBOE.js → chunk-OGQHDOKS.js} +1 -1
- package/{chunk-QM56445N.js → chunk-QABXSPGV.js} +1 -1
- package/cloudflare/astro.js +4 -4
- package/cloudflare/nextjs.js +2 -2
- package/cloudflare/react-router.js +4 -4
- package/cloudflare/tanstack-start.js +4 -4
- package/cloudflare.js +3 -3
- package/package.json +12 -3
- package/vercel.js +1 -1
|
@@ -122,7 +122,7 @@ var MemoryCache = class {
|
|
|
122
122
|
};
|
|
123
123
|
|
|
124
124
|
// src/version.ts
|
|
125
|
-
var MIDDLEWARE_VERSION = "3.13.
|
|
125
|
+
var MIDDLEWARE_VERSION = "3.13.1";
|
|
126
126
|
|
|
127
127
|
// src/utils/heartbeat.ts
|
|
128
128
|
var DEFAULT_HEARTBEAT_CONFIG_ERROR_CODE = "custom";
|
|
@@ -130,23 +130,66 @@ var DEFAULT_HEARTBEAT_CONFIG_ERROR_MESSAGE = "Appwarden configuration validation
|
|
|
130
130
|
var HEARTBEAT_CONSTRUCTION_FAILURE_BODY = JSON.stringify({
|
|
131
131
|
error: "appwarden_heartbeat_construction_failed"
|
|
132
132
|
});
|
|
133
|
-
function
|
|
133
|
+
function getExpectedType(issue) {
|
|
134
|
+
if ("expected" in issue && typeof issue.expected === "string") {
|
|
135
|
+
return issue.expected;
|
|
136
|
+
}
|
|
137
|
+
if (issue.code === "invalid_union" && "unionErrors" in issue && Array.isArray(issue.unionErrors) && issue.unionErrors.length > 0) {
|
|
138
|
+
const literalValues = [];
|
|
139
|
+
let allAreLiterals = true;
|
|
140
|
+
for (const unionError of issue.unionErrors) {
|
|
141
|
+
if (unionError && "issues" in unionError && Array.isArray(unionError.issues) && unionError.issues.length > 0) {
|
|
142
|
+
const firstIssue = unionError.issues[0];
|
|
143
|
+
if (firstIssue.code === "invalid_literal" && "expected" in firstIssue) {
|
|
144
|
+
literalValues.push(String(firstIssue.expected));
|
|
145
|
+
} else {
|
|
146
|
+
allAreLiterals = false;
|
|
147
|
+
break;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
if (allAreLiterals && literalValues.length > 0) {
|
|
152
|
+
return literalValues.join(" | ");
|
|
153
|
+
}
|
|
154
|
+
const expectedTypes = /* @__PURE__ */ new Set();
|
|
155
|
+
for (const unionError of issue.unionErrors) {
|
|
156
|
+
if (unionError && "issues" in unionError && Array.isArray(unionError.issues) && unionError.issues.length > 0) {
|
|
157
|
+
const firstIssue = unionError.issues[0];
|
|
158
|
+
if (typeof firstIssue.expected === "string") {
|
|
159
|
+
expectedTypes.add(firstIssue.expected);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
if (expectedTypes.size > 0) {
|
|
164
|
+
return Array.from(expectedTypes).join(" | ");
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
return void 0;
|
|
168
|
+
}
|
|
169
|
+
function createSanitizedMessage(issue, path) {
|
|
134
170
|
const fieldName = path.length > 0 ? path[path.length - 1] : "field";
|
|
171
|
+
const code = issue.code;
|
|
135
172
|
switch (code) {
|
|
136
|
-
case "invalid_type":
|
|
137
|
-
|
|
173
|
+
case "invalid_type": {
|
|
174
|
+
const expectedType = getExpectedType(issue);
|
|
175
|
+
return expectedType ? `Invalid type for ${fieldName}. Expected ${expectedType}` : `Invalid type for ${fieldName}`;
|
|
176
|
+
}
|
|
138
177
|
case "invalid_literal":
|
|
139
178
|
return `Invalid value for ${fieldName}`;
|
|
140
179
|
case "unrecognized_keys":
|
|
141
180
|
return `Unrecognized keys in ${fieldName}`;
|
|
142
|
-
case "invalid_union":
|
|
143
|
-
|
|
181
|
+
case "invalid_union": {
|
|
182
|
+
const expectedType = getExpectedType(issue);
|
|
183
|
+
return expectedType ? `Invalid type for ${fieldName}. Expected ${expectedType}` : `Invalid union value for ${fieldName}`;
|
|
184
|
+
}
|
|
144
185
|
case "invalid_enum_value":
|
|
145
186
|
return `Invalid enum value for ${fieldName}`;
|
|
146
187
|
case "invalid_arguments":
|
|
147
188
|
return `Invalid arguments for ${fieldName}`;
|
|
148
|
-
case "invalid_return_type":
|
|
149
|
-
|
|
189
|
+
case "invalid_return_type": {
|
|
190
|
+
const expectedType = getExpectedType(issue);
|
|
191
|
+
return expectedType ? `Invalid return type for ${fieldName}. Expected ${expectedType}` : `Invalid return type for ${fieldName}`;
|
|
192
|
+
}
|
|
150
193
|
case "invalid_date":
|
|
151
194
|
return `Invalid date for ${fieldName}`;
|
|
152
195
|
case "invalid_string":
|
|
@@ -251,7 +294,7 @@ function sanitizeConfigErrors(error) {
|
|
|
251
294
|
for (const issue of issues) {
|
|
252
295
|
const sanitizedPath = sanitizePath(issue.path);
|
|
253
296
|
const message = truncateMessage(
|
|
254
|
-
createSanitizedMessage(issue
|
|
297
|
+
createSanitizedMessage(issue, sanitizedPath)
|
|
255
298
|
);
|
|
256
299
|
errors.push({
|
|
257
300
|
path: sanitizedPath,
|
package/cloudflare/astro.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
applyContentSecurityPolicyToResponse,
|
|
3
3
|
isResponseLike
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-QABXSPGV.js";
|
|
5
|
+
import "../chunk-7FPMUPAS.js";
|
|
6
6
|
import {
|
|
7
7
|
getNowMs,
|
|
8
8
|
logElapsed
|
|
9
9
|
} from "../chunk-G6BMPIYD.js";
|
|
10
10
|
import {
|
|
11
11
|
checkLockStatus
|
|
12
|
-
} from "../chunk-
|
|
12
|
+
} from "../chunk-OGQHDOKS.js";
|
|
13
13
|
import {
|
|
14
14
|
TEMPORARY_REDIRECT_STATUS,
|
|
15
15
|
buildLockPageUrl,
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
isOnLockPage,
|
|
23
23
|
printMessage,
|
|
24
24
|
sanitizeConfigErrors
|
|
25
|
-
} from "../chunk-
|
|
25
|
+
} from "../chunk-EG6TX7RH.js";
|
|
26
26
|
import {
|
|
27
27
|
AppwardenApiHostnameSchema,
|
|
28
28
|
AppwardenApiTokenSchema,
|
package/cloudflare/nextjs.js
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
} from "../chunk-G6BMPIYD.js";
|
|
8
8
|
import {
|
|
9
9
|
checkLockStatus
|
|
10
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-OGQHDOKS.js";
|
|
11
11
|
import {
|
|
12
12
|
TEMPORARY_REDIRECT_STATUS,
|
|
13
13
|
buildLockPageUrl,
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
makeCSPHeader,
|
|
21
21
|
printMessage,
|
|
22
22
|
sanitizeConfigErrors
|
|
23
|
-
} from "../chunk-
|
|
23
|
+
} from "../chunk-EG6TX7RH.js";
|
|
24
24
|
import {
|
|
25
25
|
AppwardenApiHostnameSchema,
|
|
26
26
|
AppwardenApiTokenSchema,
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
applyContentSecurityPolicyToResponse,
|
|
3
3
|
isResponseLike
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-QABXSPGV.js";
|
|
5
|
+
import "../chunk-7FPMUPAS.js";
|
|
6
6
|
import {
|
|
7
7
|
getNowMs,
|
|
8
8
|
logElapsed
|
|
9
9
|
} from "../chunk-G6BMPIYD.js";
|
|
10
10
|
import {
|
|
11
11
|
checkLockStatus
|
|
12
|
-
} from "../chunk-
|
|
12
|
+
} from "../chunk-OGQHDOKS.js";
|
|
13
13
|
import {
|
|
14
14
|
buildLockPageUrl,
|
|
15
15
|
createHeartbeatConfigError,
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
isOnLockPage,
|
|
22
22
|
printMessage,
|
|
23
23
|
sanitizeConfigErrors
|
|
24
|
-
} from "../chunk-
|
|
24
|
+
} from "../chunk-EG6TX7RH.js";
|
|
25
25
|
import {
|
|
26
26
|
AppwardenApiHostnameSchema,
|
|
27
27
|
AppwardenApiTokenSchema,
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
applyContentSecurityPolicyToResponse,
|
|
3
3
|
isResponseLike
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-QABXSPGV.js";
|
|
5
|
+
import "../chunk-7FPMUPAS.js";
|
|
6
6
|
import {
|
|
7
7
|
getNowMs,
|
|
8
8
|
logElapsed
|
|
9
9
|
} from "../chunk-G6BMPIYD.js";
|
|
10
10
|
import {
|
|
11
11
|
checkLockStatus
|
|
12
|
-
} from "../chunk-
|
|
12
|
+
} from "../chunk-OGQHDOKS.js";
|
|
13
13
|
import {
|
|
14
14
|
buildLockPageUrl,
|
|
15
15
|
createHeartbeatConfigError,
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
isOnLockPage,
|
|
22
22
|
printMessage,
|
|
23
23
|
sanitizeConfigErrors
|
|
24
|
-
} from "../chunk-
|
|
24
|
+
} from "../chunk-EG6TX7RH.js";
|
|
25
25
|
import {
|
|
26
26
|
AppwardenApiHostnameSchema,
|
|
27
27
|
AppwardenApiTokenSchema,
|
package/cloudflare.js
CHANGED
|
@@ -7,10 +7,10 @@ import {
|
|
|
7
7
|
} from "./chunk-NV7K5PRA.js";
|
|
8
8
|
import {
|
|
9
9
|
useContentSecurityPolicy
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-7FPMUPAS.js";
|
|
11
11
|
import {
|
|
12
12
|
checkLockStatus
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-OGQHDOKS.js";
|
|
14
14
|
import {
|
|
15
15
|
buildLockPageUrl,
|
|
16
16
|
createHeartbeatConfigError,
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
isOnLockPage,
|
|
23
23
|
printMessage,
|
|
24
24
|
sanitizeConfigErrors
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-EG6TX7RH.js";
|
|
26
26
|
import {
|
|
27
27
|
HEARTBEAT_SERVICES
|
|
28
28
|
} from "./chunk-OIEAURS7.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appwarden/middleware",
|
|
3
|
-
"version": "3.13.
|
|
3
|
+
"version": "3.13.2",
|
|
4
4
|
"description": "Instantly disable all user interaction with your app deployed on Cloudflare or Vercel",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"node": ">=24"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@upstash/redis": "^1.
|
|
61
|
+
"@upstash/redis": "^1.37.0",
|
|
62
62
|
"@vercel/edge-config": "^1.4.3",
|
|
63
63
|
"zod": "^3.25.76"
|
|
64
64
|
},
|
|
@@ -118,7 +118,16 @@
|
|
|
118
118
|
"serialize-javascript@<=7.0.2": ">=7.0.3",
|
|
119
119
|
"svgo@=4.0.0": ">=4.0.1",
|
|
120
120
|
"@opennextjs/cloudflare@<1.17.1": ">=1.17.1",
|
|
121
|
-
"tar@<=7.5.10": ">=7.5.11"
|
|
121
|
+
"tar@<=7.5.10": ">=7.5.11",
|
|
122
|
+
"devalue@<5.6.4": ">=5.6.4",
|
|
123
|
+
"undici@>=7.0.0 <7.24.0": ">=7.24.0",
|
|
124
|
+
"next@>=10.0.0 <16.1.7": ">=16.1.7",
|
|
125
|
+
"fast-xml-parser@>=4.0.0-beta.3 <=5.5.5": ">=5.5.6",
|
|
126
|
+
"h3@<1.15.6": ">=1.15.6",
|
|
127
|
+
"h3@>=2.0.0-0 <2.0.1-rc.15": ">=2.0.1-rc.15",
|
|
128
|
+
"next@>=16.0.0-beta.0 <16.1.7": ">=16.1.7",
|
|
129
|
+
"h3@>=2.0.0 <=2.0.1-rc.14": ">=2.0.1-rc.15",
|
|
130
|
+
"@tanstack/start-server-core@1.163.2>h3-v2": "npm:h3@2.0.1-rc.16"
|
|
122
131
|
}
|
|
123
132
|
}
|
|
124
133
|
}
|