@tokenoftrust/storefront-runner 2.0.17 → 2.0.18

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.
Files changed (86) hide show
  1. package/apps/storefront/env.d.ts +18 -0
  2. package/apps/storefront/migrations-apps/0012_test_destinations.sql +29 -0
  3. package/apps/storefront/src/components/blog/ReactionBar.astro +1 -1
  4. package/apps/storefront/src/components/islands/CheckoutComplianceGate.tsx +365 -49
  5. package/apps/storefront/src/components/islands/checkoutVerificationFlow.ts +251 -0
  6. package/apps/storefront/src/config/compliance/rulesets.ts +18 -7
  7. package/apps/storefront/src/config/devTenantSeed.ts +24 -1
  8. package/apps/storefront/src/config/evidenceTenantRoster.ts +25 -0
  9. package/apps/storefront/src/config/publicationSpaceConfig.ts +25 -0
  10. package/apps/storefront/src/config/resolver.ts +5 -0
  11. package/apps/storefront/src/config/tenantAnalyticsFiles.ts +43 -0
  12. package/apps/storefront/src/config/tenants.ts +11 -0
  13. package/apps/storefront/src/layouts/Layout.astro +5 -1
  14. package/apps/storefront/src/lib/activity/killSwitch.ts +1 -1
  15. package/apps/storefront/src/lib/admin/consentSettingsClient.ts +113 -0
  16. package/apps/storefront/src/lib/apps/consentConfigRead.ts +24 -0
  17. package/apps/storefront/src/lib/apps/gtmMigrationDraft.ts +103 -0
  18. package/apps/storefront/src/lib/auth/loginGate.ts +25 -0
  19. package/apps/storefront/src/lib/checkoutCommerce.ts +1 -1
  20. package/apps/storefront/src/lib/compliance/enforcement.ts +25 -3
  21. package/apps/storefront/src/lib/d1/schema-apps.ts +44 -0
  22. package/apps/storefront/src/lib/env.ts +13 -111
  23. package/apps/storefront/src/lib/integration/tenantAnalyticsDeclarations.ts +198 -0
  24. package/apps/storefront/src/lib/monitoring/manifest.ts +1 -1
  25. package/apps/storefront/src/lib/rawMarketingHtml.ts +9 -1
  26. package/apps/storefront/src/lib/runtimeEnv.ts +124 -0
  27. package/apps/storefront/src/lib/verification/totVerificationClient.ts +485 -0
  28. package/apps/storefront/src/middleware/candidatePin.ts +35 -0
  29. package/apps/storefront/src/middleware/controlPlane.ts +270 -0
  30. package/apps/storefront/src/middleware/index.ts +100 -796
  31. package/apps/storefront/src/middleware/publicRender.ts +43 -0
  32. package/apps/storefront/src/middleware/renderChain.ts +685 -0
  33. package/apps/storefront/src/middleware/routeBranch.ts +160 -0
  34. package/apps/storefront/src/middleware/staticBundle.ts +109 -0
  35. package/apps/storefront/src/pages/[...slug].astro +1 -0
  36. package/apps/storefront/src/pages/api/compliance/preflight.ts +179 -2
  37. package/apps/storefront/src/pages/index.astro +1 -0
  38. package/apps/storefront/vitest.config.ts +5 -0
  39. package/package.json +1 -1
  40. package/packages/public-runtime/package.json +1 -0
  41. package/packages/public-runtime/schemas/managed-analytics/v1/deliver-test-event-request.schema.json +122 -0
  42. package/packages/public-runtime/schemas/managed-analytics/v1/get-test-destination-delivery-request.schema.json +79 -0
  43. package/packages/public-runtime/schemas/managed-analytics/v1/register-test-destination-request.schema.json +93 -0
  44. package/packages/public-runtime/schemas/managed-analytics/v1/test-destination-delivery.schema.json +106 -0
  45. package/packages/public-runtime/schemas/managed-analytics/v1/test-destination.schema.json +77 -0
  46. package/packages/public-runtime/schemas/publication-space/v1/manifest.schema.json +195 -0
  47. package/packages/public-runtime/schemas/publication-space/v1/normalized-mount.schema.json +80 -0
  48. package/packages/public-runtime/schemas/publication-space/v1/ref.schema.json +20 -0
  49. package/packages/public-runtime/schemas/publication-version/v1/pointer.schema.json +28 -0
  50. package/packages/public-runtime/schemas/publication-version/v1/transition-request.schema.json +44 -0
  51. package/packages/public-runtime/schemas/publication-version/v1/transition.schema.json +47 -0
  52. package/packages/public-runtime/schemas/publication-version/v1/version.schema.json +58 -0
  53. package/packages/public-runtime/src/activity/catalog.ts +1 -1
  54. package/packages/public-runtime/src/candidate-index.ts +6 -0
  55. package/packages/public-runtime/src/customization-reconcile.ts +8 -0
  56. package/packages/public-runtime/src/html-cache-policy.ts +57 -0
  57. package/packages/public-runtime/src/index.ts +7 -0
  58. package/packages/public-runtime/src/integration/consent-broker.ts +115 -0
  59. package/packages/public-runtime/src/integration/interim-bridge.ts +111 -27
  60. package/packages/public-runtime/src/integration/managed-analytics-api-v1.schemas.ts +65 -0
  61. package/packages/public-runtime/src/integration/managed-analytics-api-v1.ts +81 -0
  62. package/packages/public-runtime/src/integration/render-phases.ts +8 -3
  63. package/packages/public-runtime/src/publication-artifact.ts +203 -0
  64. package/packages/public-runtime/src/publication-space.ts +853 -0
  65. package/packages/public-runtime/src/publication-version.ts +587 -0
  66. package/packages/public-runtime/src/route-tier.ts +257 -0
  67. package/packages/public-runtime/src/static-bundle.ts +18 -5
  68. package/packages/public-runtime/src/tenant-assets.ts +85 -17
  69. package/packages/public-runtime/src/tenant.ts +70 -0
  70. package/packages/public-runtime/tests/fixtures/publication-spaces/internal.json +32 -0
  71. package/packages/public-runtime/tests/fixtures/publication-spaces/mounted-public.json +38 -0
  72. package/packages/public-runtime/tests/fixtures/publication-spaces/normalized-mounts.json +39 -0
  73. package/packages/public-runtime/tests/fixtures/publication-spaces/ref.json +5 -0
  74. package/packages/public-runtime/tests/fixtures/publication-spaces/root-public.json +31 -0
  75. package/packages/public-runtime/tests/fixtures/publication-versions/articles-v1.json +20 -0
  76. package/packages/public-runtime/tests/fixtures/publication-versions/articles-v2.json +20 -0
  77. package/packages/public-runtime/tests/fixtures/publication-versions/internal-v1.json +20 -0
  78. package/packages/public-runtime/tests/fixtures/publication-versions/live-pointer.json +11 -0
  79. package/packages/public-runtime/tests/fixtures/publication-versions/live-transition-request.json +14 -0
  80. package/packages/public-runtime/tests/fixtures/publication-versions/live-transition.json +17 -0
  81. package/packages/public-runtime/tests/fixtures/publication-versions/root-v1.json +20 -0
  82. package/packages/public-runtime/tests/fixtures/publication-versions/root-v2.json +20 -0
  83. package/scripts/dev/ai-edit.mjs +16 -3
  84. package/scripts/dev/port-check.mjs +18 -3
  85. package/scripts/dev/publish.mjs +26 -3
  86. package/scripts/tenant/validate.mjs +14 -1
@@ -0,0 +1,43 @@
1
+ /**
2
+ * The public-render branch: anonymous tenant output, served with NO request-time
3
+ * D1 read.
4
+ *
5
+ * This module's whole job is to hand the shared chain the empty forms of every
6
+ * D1-derived input, so a control-plane read cannot reach the public path by
7
+ * accident. That absence is the contract, and it is held structurally rather
8
+ * than by review: `public-render-no-request-time-d1` (.dependency-cruiser.cjs)
9
+ * fails `pnpm run check` if ANY module reachable from this one reaches
10
+ * `lib/env.ts`, the sole accessor for a live D1 handle. The public path reaches
11
+ * `lib/runtimeEnv.ts` instead — readEnv/readKv/readR2, the substrate that serves
12
+ * published bytes.
13
+ *
14
+ * Two companions cover what a forward graph walk from this module cannot see:
15
+ * `middleware-front-door-no-d1-handle` (same config) fences `index.ts` and
16
+ * `routeBranch.ts`, which call INTO this branch and so run before it on every
17
+ * request; `scripts/playbooks/check-public-render-d1.sh` fences the `.astro` pages
18
+ * and components the chain reaches through Astro's `next()` dispatch rather than
19
+ * an import.
20
+ *
21
+ * What the empty forms mean, per ADR 0013:
22
+ * - managed installs — admin-installed state, baked at publish, never read per
23
+ * request on a public page.
24
+ * - consent — the fail-closed essential-only default here; the tenant's real
25
+ * snapshot reaches a public page baked into the static bundle (the signed
26
+ * materialize-mode header the shared chain still honors).
27
+ * - catalog — the bundled JSON snapshot, never the D1 edge replica.
28
+ */
29
+ import { runRenderChain, type RenderChainInput } from "./renderChain.js";
30
+
31
+ export type PublicRenderInput = Omit<
32
+ RenderChainInput,
33
+ "managedIntegrationDeclarations" | "readTenantConsentSnapshot" | "readCatalogD1"
34
+ >;
35
+
36
+ export function servePublicRender(input: PublicRenderInput): Promise<Response> {
37
+ return runRenderChain({
38
+ ...input,
39
+ managedIntegrationDeclarations: [],
40
+ readTenantConsentSnapshot: null,
41
+ readCatalogD1: null,
42
+ });
43
+ }