@tokenoftrust/storefront-runner 4.2.0 → 4.2.1
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.
|
@@ -167,13 +167,19 @@ async function authorize(context: APIContext): Promise<Response> {
|
|
|
167
167
|
const kv = await readKv("TENANT_CACHE");
|
|
168
168
|
const kvGet = async (key: string): Promise<string | null> => kv ? kv.get(key) : null;
|
|
169
169
|
const contentEnv = snapshot.stage === "publication" ? "live" : "test";
|
|
170
|
+
const contentVersionId = snapshot.stage === "preview" && snapshot.contentVersionId ? snapshot.contentVersionId : undefined;
|
|
170
171
|
let tenant: TenantConfig;
|
|
171
|
-
try {
|
|
172
|
+
try {
|
|
173
|
+
tenant = await withDeclaredTenantConfig(registered, kvGet, {
|
|
174
|
+
env: contentEnv,
|
|
175
|
+
...(contentVersionId ? { pinnedVersionId: contentVersionId } : {}),
|
|
176
|
+
});
|
|
177
|
+
} catch (err) {
|
|
172
178
|
if (err instanceof DeclaredTenantConfigUnreadError) return deny("config-unreadable", 503);
|
|
173
179
|
throw err;
|
|
174
180
|
}
|
|
175
|
-
const content =
|
|
176
|
-
? createContentProvider(tenant, undefined, { get: kvGet, versionId:
|
|
181
|
+
const content = contentVersionId
|
|
182
|
+
? createContentProvider(tenant, undefined, { get: kvGet, versionId: contentVersionId })
|
|
177
183
|
: createContentProvider(tenant, { get: kvGet, env: contentEnv });
|
|
178
184
|
const tot = await createToTClient(tenant, await readD1("CATALOG_DB"), content);
|
|
179
185
|
const authorityContext = { ...context, locals: { ...context.locals, tenant, tot, content } } as APIContext;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tokenoftrust/storefront-runner",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.1",
|
|
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",
|