@tokenoftrust/storefront-runner 2.2.89 → 2.2.91
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/agency-kit/tools/lib/catalog-model/files.d.mts +48 -0
- package/agency-kit/tools/lib/catalog-model/files.mjs +263 -0
- package/agency-kit/tools/lib/catalog-model/model.mjs +282 -0
- package/agency-kit/tools/lib/tot-repo-mappings.mjs +153 -0
- package/apps/storefront/src/config/declaredTenantConfig.ts +9 -3
- package/apps/storefront/src/config/devTenantSeed.ts +7 -7
- package/apps/storefront/src/config/publicationSpaceRegistry.ts +1 -0
- package/apps/storefront/src/config/resolver.ts +19 -1
- package/apps/storefront/src/lib/storyblok/provider.ts +25 -1
- package/apps/storefront/src/lib/tot/ToTClient.ts +63 -18
- package/apps/storefront/src/lib/tot/tenantCatalog.ts +126 -0
- package/apps/storefront/src/middleware/controlPlane.ts +5 -5
- package/apps/storefront/src/middleware/renderChain.ts +24 -15
- package/package.json +1 -1
- package/packages/cli/src/declared-config.mjs +78 -0
- package/packages/public-runtime/package.json +1 -0
- package/packages/public-runtime/src/catalog-files.ts +51 -0
- package/packages/public-runtime/src/csp.ts +2 -2
- package/packages/public-runtime/src/tenant.ts +27 -2
- package/scripts/dev/standalone-graft-plan.mjs +34 -12
- package/scripts/tenant/materialize-tenant-content.mjs +8 -1
- package/scripts/tenant/validate.mjs +72 -31
- package/scripts/tot-dev.mjs +18 -18
package/scripts/tot-dev.mjs
CHANGED
|
@@ -62,7 +62,7 @@ import {
|
|
|
62
62
|
import { dirname, resolve, join } from "node:path";
|
|
63
63
|
import { fileURLToPath } from "node:url";
|
|
64
64
|
import { resolveDevSourceRoot } from "./dev/tenant-source-root.mjs";
|
|
65
|
-
import {
|
|
65
|
+
import { tenantDirSegments } from "./lib/tenant-dirs.mjs";
|
|
66
66
|
import { firstFreePort, isPortFree } from "./dev/port-check.mjs";
|
|
67
67
|
import { busyPortMessage, classifyBusyPort, lockPort, unlockPort } from "./dev/port-lock.mjs";
|
|
68
68
|
import { resync, startWatch } from "./dev/checkout-watch.mjs";
|
|
@@ -276,12 +276,12 @@ if (workspacePath) {
|
|
|
276
276
|
console.log(` checkout: ${wsRoot}`);
|
|
277
277
|
|
|
278
278
|
/**
|
|
279
|
-
* Graft one checkout path (`wsRel`, checkout-relative)
|
|
280
|
-
* `tenants/<tenant>/` layout the app globs, with the same
|
|
281
|
-
* watch-and-resync machinery every mapping gets. Returns
|
|
279
|
+
* Graft one checkout path (`wsRel`, checkout-relative) to `repoRel` in the
|
|
280
|
+
* in-tree `tenants/<tenant>/` layout the app globs, with the same
|
|
281
|
+
* move-aside/restore + watch-and-resync machinery every mapping gets. Returns
|
|
282
|
+
* true if grafted.
|
|
282
283
|
*/
|
|
283
|
-
function graftOne(wsRel, isDir) {
|
|
284
|
-
const repoRel = join(tenantDirRelative(tenant), wsRel);
|
|
284
|
+
function graftOne(wsRel, repoRel, isDir) {
|
|
285
285
|
|
|
286
286
|
const source = resolve(wsRoot, wsRel); // real files in the checkout
|
|
287
287
|
const target = resolve(repoRoot, repoRel); // where the app globs them
|
|
@@ -320,19 +320,19 @@ if (workspacePath) {
|
|
|
320
320
|
return true;
|
|
321
321
|
}
|
|
322
322
|
|
|
323
|
-
//
|
|
324
|
-
//
|
|
325
|
-
//
|
|
326
|
-
//
|
|
327
|
-
//
|
|
328
|
-
//
|
|
329
|
-
// standaloneGraftPlan ALSO appends `.tot/config.json` unconditionally — see its
|
|
330
|
-
// own doc comment. Its success does NOT count toward "did we graft a usable
|
|
331
|
-
// site" below: a checkout with config but no content/public/theme is still
|
|
332
|
-
// nothing to serve.
|
|
323
|
+
// Each mapping's checkout files land where its `repo` says, under THIS tenant's
|
|
324
|
+
// directory (see scripts/dev/standalone-graft-plan.mjs) — resolved exactly as
|
|
325
|
+
// the hosted reconcile resolves them. standaloneGraftPlan ALSO appends
|
|
326
|
+
// `.tot/config.json` unconditionally — see its own doc comment. Its success does
|
|
327
|
+
// NOT count toward "did we graft a usable site" below: a checkout with config but
|
|
328
|
+
// no content/public/theme is still nothing to serve.
|
|
333
329
|
let mappedCount = 0;
|
|
334
|
-
for (const { workspace, isDir } of standaloneGraftPlan(mappings)) {
|
|
335
|
-
|
|
330
|
+
for (const { workspace, target, isDir } of standaloneGraftPlan(tenant, mappings)) {
|
|
331
|
+
if (!target) {
|
|
332
|
+
console.warn(` ⚠ mapping for "${workspace}" has no valid "repo" under tenants/<id>/ — skipping (run tot validate)`);
|
|
333
|
+
continue;
|
|
334
|
+
}
|
|
335
|
+
const grafted = graftOne(workspace, target, isDir);
|
|
336
336
|
if (workspace === ".tot/config.json") {
|
|
337
337
|
if (!grafted) console.warn(` ⚠ checkout has no .tot/config.json — compliance/capabilities/siteType resolve undeclared.`);
|
|
338
338
|
continue;
|