@tokenoftrust/storefront-runner 6.12.9 → 6.12.10
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.
|
@@ -83,7 +83,7 @@ export async function serveControlPlane(input: ControlPlaneInput): Promise<Respo
|
|
|
83
83
|
nowSeconds: Math.floor(Date.now() / 1000),
|
|
84
84
|
});
|
|
85
85
|
if (preview.context.status === "refused") {
|
|
86
|
-
return previewContextRefusalResponse(preview.context
|
|
86
|
+
return previewContextRefusalResponse(preview.context);
|
|
87
87
|
}
|
|
88
88
|
// A pinned route rewrite arrives here without the outer preview route's
|
|
89
89
|
// session. Verify its tenant-bound grant before the host login gate runs.
|
|
@@ -220,7 +220,7 @@ export async function runRenderChain(input: RenderChainInput): Promise<Response>
|
|
|
220
220
|
nowSeconds,
|
|
221
221
|
});
|
|
222
222
|
if (preview.context.status === "refused") {
|
|
223
|
-
return previewContextRefusalResponse(preview.context
|
|
223
|
+
return previewContextRefusalResponse(preview.context);
|
|
224
224
|
}
|
|
225
225
|
const verifiedPreview = preview.context.status === "valid" ? preview.context : null;
|
|
226
226
|
const queryToken = verifiedPreview?.source === "query" ? verifiedPreview.token : null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tokenoftrust/storefront-runner",
|
|
3
|
-
"version": "6.12.
|
|
3
|
+
"version": "6.12.10",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE",
|
|
5
5
|
"description": "World-shareable storefront runner: multi-tenant renderer on Astro/Cloudflare. No control plane.",
|
|
6
6
|
"packageManager": "pnpm@11.9.0",
|
|
@@ -328,14 +328,22 @@ export async function requireValidPreviewToken(input: PreviewContextInput): Prom
|
|
|
328
328
|
}
|
|
329
329
|
|
|
330
330
|
/**
|
|
331
|
-
* The one refusal for a presented preview context:
|
|
332
|
-
* {@link PREVIEW_CONTEXT_REFUSED} and
|
|
331
|
+
* The one refusal for a presented preview context: no-store JSON carrying
|
|
332
|
+
* {@link PREVIEW_CONTEXT_REFUSED} and the closed-set `reason` that refused it. Nothing
|
|
333
|
+
* else is derived from the request.
|
|
333
334
|
*/
|
|
334
|
-
export function previewContextRefusalResponse(
|
|
335
|
+
export function previewContextRefusalResponse(
|
|
336
|
+
refusal: { httpStatus: 401 | 403 | 503; reason: PreviewContextRefusalReason },
|
|
337
|
+
): Response {
|
|
335
338
|
return new Response(
|
|
336
|
-
JSON.stringify({
|
|
339
|
+
JSON.stringify({
|
|
340
|
+
ok: false,
|
|
341
|
+
error: PREVIEW_CONTEXT_REFUSED,
|
|
342
|
+
code: PREVIEW_CONTEXT_REFUSED,
|
|
343
|
+
reason: refusal.reason,
|
|
344
|
+
}),
|
|
337
345
|
{
|
|
338
|
-
status,
|
|
346
|
+
status: refusal.httpStatus,
|
|
339
347
|
headers: {
|
|
340
348
|
"content-type": "application/json; charset=utf-8",
|
|
341
349
|
"cache-control": "no-store",
|