@tokenoftrust/storefront-runner 6.14.4 → 6.15.0
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.
|
@@ -159,7 +159,8 @@ export async function readTenantCatalogFiles(
|
|
|
159
159
|
return { products, collections, productDetail };
|
|
160
160
|
}
|
|
161
161
|
|
|
162
|
-
|
|
162
|
+
const perRequest = (await source.perRequestArtifactReads?.()) === true;
|
|
163
|
+
if (perRequest && paths.length > CATALOG_REQUEST_READ_BUDGET) {
|
|
163
164
|
throw new Error(
|
|
164
165
|
`catalog: ${tenant.tenant_id} has ${paths.length} files in content/catalog/ and this preview ` +
|
|
165
166
|
`version has no catalog listing; reconcile the preview again to build it.`,
|
|
@@ -167,7 +168,7 @@ export async function readTenantCatalogFiles(
|
|
|
167
168
|
}
|
|
168
169
|
|
|
169
170
|
const entries = await Promise.all(paths.map(async (path) => ({ path, raw: await source.readArtifact(path) })));
|
|
170
|
-
return
|
|
171
|
+
return perRequest
|
|
171
172
|
? readCatalogFiles(entries, store)
|
|
172
173
|
: readBuildCatalog(tenant.tenant_id, entries, store);
|
|
173
174
|
}
|
|
@@ -86,10 +86,11 @@ export interface ContentProvider {
|
|
|
86
86
|
/** Artifact paths relative to `content/`; null means use a legacy fallback. */
|
|
87
87
|
listArtifactPaths(prefix?: string): Promise<string[] | null>;
|
|
88
88
|
/**
|
|
89
|
-
*
|
|
90
|
-
*
|
|
89
|
+
* Resolves true when each `readArtifact` this request makes is its own request-time store
|
|
90
|
+
* read (a KV-backed version), so a caller that reads many artifacts in one request budgets
|
|
91
|
+
* against it. A provider whose reads resolve to build-time content resolves false.
|
|
91
92
|
*/
|
|
92
|
-
|
|
93
|
+
perRequestArtifactReads?(): Promise<boolean>;
|
|
93
94
|
/**
|
|
94
95
|
* A document the reconcile derived for the selected version (`derivedArtifactPath`), as its
|
|
95
96
|
* immutable KV key plus a reader, or null when the version has none. The key names
|
|
@@ -627,7 +628,6 @@ export interface ContentCustomization {
|
|
|
627
628
|
}
|
|
628
629
|
|
|
629
630
|
export class PublishedContentProvider implements ContentProvider {
|
|
630
|
-
readonly perRequestArtifactReads = true;
|
|
631
631
|
private versionedPathsPromise: Promise<string[] | null> | null = null;
|
|
632
632
|
constructor(
|
|
633
633
|
private readonly base: ContentProvider,
|
|
@@ -756,6 +756,12 @@ export class PublishedContentProvider implements ContentProvider {
|
|
|
756
756
|
return (await this.usesVersionedContent()) ? null : this.base.readArtifact(relative);
|
|
757
757
|
}
|
|
758
758
|
|
|
759
|
+
/** A selected version reads KV per artifact; with none, reads are the base chain's. */
|
|
760
|
+
async perRequestArtifactReads(): Promise<boolean> {
|
|
761
|
+
if (await this.usesVersionedContent()) return true;
|
|
762
|
+
return (await this.base.perRequestArtifactReads?.()) === true;
|
|
763
|
+
}
|
|
764
|
+
|
|
759
765
|
async derivedArtifact(name: string): Promise<DerivedArtifact | null> {
|
|
760
766
|
const get = this.cust.get;
|
|
761
767
|
const key = await resolvePublishedArtifactKey(
|
|
@@ -780,7 +786,9 @@ export class PublishedContentProvider implements ContentProvider {
|
|
|
780
786
|
// ---------------------------------------------------------------------------
|
|
781
787
|
|
|
782
788
|
export class VersionPinnedContentProvider implements ContentProvider {
|
|
783
|
-
|
|
789
|
+
async perRequestArtifactReads(): Promise<boolean> {
|
|
790
|
+
return true;
|
|
791
|
+
}
|
|
784
792
|
constructor(
|
|
785
793
|
private readonly tenantId: string,
|
|
786
794
|
private readonly get: KvGet,
|
|
@@ -935,8 +943,8 @@ export class DevDraftContentProvider implements ContentProvider {
|
|
|
935
943
|
listArtifactPaths(prefix?: string): Promise<string[] | null> {
|
|
936
944
|
return this.base.listArtifactPaths(prefix);
|
|
937
945
|
}
|
|
938
|
-
|
|
939
|
-
return this.base.perRequestArtifactReads;
|
|
946
|
+
async perRequestArtifactReads(): Promise<boolean> {
|
|
947
|
+
return (await this.base.perRequestArtifactReads?.()) === true;
|
|
940
948
|
}
|
|
941
949
|
derivedArtifact(name: string): Promise<DerivedArtifact | null> {
|
|
942
950
|
return this.base.derivedArtifact?.(name) ?? Promise.resolve(null);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tokenoftrust/storefront-runner",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.15.0",
|
|
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",
|