orez-sync-cf-host 0.12.16 → 0.12.17
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/dist/host.js +20 -1
- package/package.json +2 -2
package/dist/host.js
CHANGED
|
@@ -88,6 +88,12 @@ function errorBody(error) {
|
|
|
88
88
|
retryAfterMs: error.retryAfterMs,
|
|
89
89
|
};
|
|
90
90
|
}
|
|
91
|
+
if (typeof error === 'object' &&
|
|
92
|
+
error !== null &&
|
|
93
|
+
'retryAfterMs' in error &&
|
|
94
|
+
typeof error.retryAfterMs === 'number') {
|
|
95
|
+
return { error: errorMessage(error), retryAfterMs: error.retryAfterMs };
|
|
96
|
+
}
|
|
91
97
|
return { error: errorMessage(error) };
|
|
92
98
|
}
|
|
93
99
|
// one response builder for every refusal, so a rejection that tells the caller
|
|
@@ -298,7 +304,20 @@ export function createSyncWorker(config) {
|
|
|
298
304
|
route !== '/wake' &&
|
|
299
305
|
route !== '/notify' &&
|
|
300
306
|
route !== '/realtime/produce') {
|
|
301
|
-
|
|
307
|
+
// an authenticate throw is an availability answer, not an identity
|
|
308
|
+
// verdict: the identity callback was reachable but told us to come
|
|
309
|
+
// back (e.g. a just-created namespace whose row is still committing).
|
|
310
|
+
// letting it propagate used to kill the whole request as an unhandled
|
|
311
|
+
// exception, which reached clients as an opaque 500 with no
|
|
312
|
+
// retry-after. map it through errorResponse so a status/retryAfterMs
|
|
313
|
+
// the callback attached survives to the wire.
|
|
314
|
+
let claims;
|
|
315
|
+
try {
|
|
316
|
+
claims = await config.authenticate(request, env);
|
|
317
|
+
}
|
|
318
|
+
catch (error) {
|
|
319
|
+
return errorResponse(error);
|
|
320
|
+
}
|
|
302
321
|
if (!claims ||
|
|
303
322
|
typeof claims.userID !== 'string' ||
|
|
304
323
|
claims.userID.length === 0) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "orez-sync-cf-host",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.17",
|
|
4
4
|
"description": "Internal orez Cloudflare sync host. Do not import directly: consumers use orez-lite/cloudflare/sync.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"test:large-data": "bun run build:dist && bun large-data-test.mjs"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"orez-sync-executor": "0.12.
|
|
61
|
+
"orez-sync-executor": "0.12.17"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
64
|
"@cloudflare/workers-types": "4.20260617.1",
|