@tokenoftrust/storefront-runner 1.4.1 → 2.0.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.
- package/apps/storefront/astro.config.mjs +17 -1
- package/apps/storefront/env.d.ts +54 -5
- package/apps/storefront/integrations/materialize-guard.mjs +54 -0
- package/apps/storefront/migrations-apps/0002_good_switch.sql +26 -0
- package/apps/storefront/migrations-apps/0003_mute_marauders.sql +12 -0
- package/apps/storefront/migrations-apps/0004_deep_morph.sql +36 -0
- package/apps/storefront/migrations-apps/0005_common_mystique.sql +23 -0
- package/apps/storefront/migrations-apps/0006_broad_microchip.sql +16 -0
- package/apps/storefront/migrations-apps/0007_brave_outlaw_kid.sql +15 -0
- package/apps/storefront/migrations-apps/0008_blue_dazzler.sql +11 -0
- package/apps/storefront/migrations-apps/0009_bored_shinobi_shaw.sql +15 -0
- package/apps/storefront/migrations-apps/0010_ws4_verified_provider_measurement.sql +35 -0
- package/apps/storefront/migrations-apps/meta/0002_snapshot.json +1160 -0
- package/apps/storefront/migrations-apps/meta/0003_snapshot.json +1235 -0
- package/apps/storefront/migrations-apps/meta/0004_snapshot.json +1474 -0
- package/apps/storefront/migrations-apps/meta/0005_snapshot.json +1617 -0
- package/apps/storefront/migrations-apps/meta/0006_snapshot.json +1716 -0
- package/apps/storefront/migrations-apps/meta/0007_snapshot.json +1812 -0
- package/apps/storefront/migrations-apps/meta/0008_snapshot.json +1881 -0
- package/apps/storefront/migrations-apps/meta/0009_snapshot.json +1979 -0
- package/apps/storefront/migrations-apps/meta/_journal.json +56 -0
- package/apps/storefront/public/apps/tot.demo.analytics/0.1.0/entry.js +42 -0
- package/apps/storefront/public/js/dashboard-team.js +38 -2
- package/apps/storefront/public/platform/amplitude-http/v1/entry.mjs +19 -0
- package/apps/storefront/public/platform/google-measurement/v1/entry.mjs +19 -0
- package/apps/storefront/public/shared/commerce-chrome.css +20 -2
- package/apps/storefront/scripts/build-v84-clean-clone-standalone.mjs +68 -0
- package/apps/storefront/scripts/deny-v84-clean-clone-standalone-capabilities.mjs +111 -0
- package/apps/storefront/scripts/deny-v84-dogfood-capabilities.mjs +2 -0
- package/apps/storefront/scripts/deny-v84-lifecycle-capabilities.mjs +247 -0
- package/apps/storefront/scripts/dogfood-v84-nonportable-routes.ts +73 -0
- package/apps/storefront/scripts/fixed-v84-native-install-producer.ts +79 -0
- package/apps/storefront/scripts/generated/v84-clean-clone-replay.bundle.mjs +10982 -0
- package/apps/storefront/scripts/import-v84-through-ws2.ts +38 -0
- package/apps/storefront/scripts/initialize-v84-lifecycle-tooling-dependency.ts +2 -0
- package/apps/storefront/scripts/initialize-v84-lifecycle-tooling.ts +4 -0
- package/apps/storefront/scripts/install-v84-native-through-ws1.ts +185 -0
- package/apps/storefront/scripts/prove-clone-isolation.ts +506 -0
- package/apps/storefront/scripts/replay-v84-clean-clone-pass.ts +148 -0
- package/apps/storefront/scripts/replay-v84-clean-clone-standalone.ts +35 -0
- package/apps/storefront/scripts/replay-v84-clean-clone.ts +214 -0
- package/apps/storefront/scripts/run-fixed-v84-native-install-producer.mjs +18 -0
- package/apps/storefront/scripts/run-v84-clone-isolation-proof.mjs +18 -0
- package/apps/storefront/scripts/run-v84-clone-lifecycle-proof.mjs +18 -0
- package/apps/storefront/scripts/run-v84-import-through-ws2-proof.mjs +17 -0
- package/apps/storefront/scripts/run-v84-nonportable-route-dogfood.mjs +15 -0
- package/apps/storefront/scripts/sanitize-v84-proof-environment.mjs +21 -0
- package/apps/storefront/scripts/v84CleanCloneGraphPin.ts +42 -0
- package/apps/storefront/scripts/v84CleanCloneSourceGraph.ts +145 -0
- package/apps/storefront/scripts/validate-v84-clone-lifecycle.ts +18 -0
- package/apps/storefront/src/components/Img.astro +1 -1
- package/apps/storefront/src/components/Seo.astro +65 -1
- package/apps/storefront/src/components/admin/AdminBlogDetailRail.astro +878 -0
- package/apps/storefront/src/components/admin/AdminBlogTab.astro +1435 -0
- package/apps/storefront/src/components/admin/AdminCustomersTab.astro +3 -7
- package/apps/storefront/src/components/admin/AdminIntegrationsTab.astro +105 -0
- package/apps/storefront/src/components/admin/AdminPublishTab.astro +1980 -2564
- package/apps/storefront/src/components/admin/AdminSettingsTab.astro +2 -2
- package/apps/storefront/src/components/admin/AdminSubscriptionsTab.astro +1 -3
- package/apps/storefront/src/components/admin/orders/OrdersWorkspace.astro +5 -5
- package/apps/storefront/src/components/blog/BlogPaywall.astro +87 -0
- package/apps/storefront/src/components/blog/PostAccessBadge.astro +43 -0
- package/apps/storefront/src/components/blog/PostGrid.astro +57 -0
- package/apps/storefront/src/components/blog/ReactionBar.astro +214 -0
- package/apps/storefront/src/components/chrome/NavDropdown.astro +12 -0
- package/apps/storefront/src/components/chrome/SiteFooter.astro +7 -2
- package/apps/storefront/src/components/chrome/SiteHeader.astro +46 -10
- package/apps/storefront/src/components/compliance/AdultSignatureNotice.astro +1 -1
- package/apps/storefront/src/components/compliance/ComplianceNotice.astro +1 -2
- package/apps/storefront/src/components/compliance/ExciseTaxNotice.astro +1 -2
- package/apps/storefront/src/components/compliance/PactActNotice.astro +1 -1
- package/apps/storefront/src/components/compliance/Prop65Warning.astro +1 -2
- package/apps/storefront/src/components/compliance/PurchaseLimitNotice.astro +2 -3
- package/apps/storefront/src/components/compliance/ShippingRestrictionNotice.astro +2 -2
- package/apps/storefront/src/components/compliance/StateEligibilityNotice.astro +2 -3
- package/apps/storefront/src/components/content/TrustStrip.astro +4 -4
- package/apps/storefront/src/components/islands/MobileNav.tsx +26 -1
- package/apps/storefront/src/components/islands/VariantSelector.tsx +27 -2
- package/apps/storefront/src/components/islands/useCheckoutHandoffCorrelation.ts +75 -0
- package/apps/storefront/src/components/membership/IllustrativeLabel.astro +1 -2
- package/apps/storefront/src/components/membership/TierCards.astro +2 -2
- package/apps/storefront/src/components/membership/TierComparisonTable.astro +2 -2
- package/apps/storefront/src/components/subscription/SavingsExplainer.astro +2 -2
- package/apps/storefront/src/config/adminTenantLookup.ts +35 -0
- package/apps/storefront/src/config/devTenantSeed.ts +9 -9
- package/apps/storefront/src/config/resolver.ts +4 -4
- package/apps/storefront/src/layouts/Layout.astro +146 -21
- package/apps/storefront/src/lib/activity/alerts.ts +17 -19
- package/apps/storefront/src/lib/activity/candidateSubmitLease.ts +87 -0
- package/apps/storefront/src/lib/activity/changeActorAttribution.ts +89 -9
- package/apps/storefront/src/lib/activity/deployVersion.ts +20 -27
- package/apps/storefront/src/lib/activity/ingest.ts +8 -8
- package/apps/storefront/src/lib/activity/ingestAuth.ts +1 -1
- package/apps/storefront/src/lib/activity/killSwitch.ts +6 -6
- package/apps/storefront/src/lib/activity/query.ts +9 -9
- package/apps/storefront/src/lib/activity/recordActivity.ts +11 -15
- package/apps/storefront/src/lib/activity/store.ts +4 -6
- package/apps/storefront/src/lib/activity/uiActor.ts +12 -12
- package/apps/storefront/src/lib/activity/workerCommit.ts +6 -6
- package/apps/storefront/src/lib/admin/adminShell.ts +292 -0
- package/apps/storefront/src/lib/admin/ai/approvalMode.ts +2 -3
- package/apps/storefront/src/lib/admin/ai/audit.ts +3 -5
- package/apps/storefront/src/lib/admin/checkoutStyleInput.ts +7 -7
- package/apps/storefront/src/lib/admin/checkoutStyleTarget.ts +3 -3
- package/apps/storefront/src/lib/admin/envelope.ts +1 -2
- package/apps/storefront/src/lib/admin/orderClient.ts +3 -5
- package/apps/storefront/src/lib/admin/services/orders.ts +17 -19
- package/apps/storefront/src/lib/admin/viewmodels/aiWorkflows.ts +4 -6
- package/apps/storefront/src/lib/admin/viewmodels/settings.ts +1 -1
- package/apps/storefront/src/lib/apps/adminService.ts +14 -4
- package/apps/storefront/src/lib/apps/adminSession.ts +54 -45
- package/apps/storefront/src/lib/apps/apiAuth.ts +2 -2
- package/apps/storefront/src/lib/apps/apiRoute.ts +2 -2
- package/apps/storefront/src/lib/apps/appVersionStore.ts +281 -0
- package/apps/storefront/src/lib/apps/catalogMapper.ts +1 -1
- package/apps/storefront/src/lib/apps/consentConfigStore.ts +228 -0
- package/apps/storefront/src/lib/apps/credentials.ts +2 -2
- package/apps/storefront/src/lib/apps/gatewayKeys.ts +4 -4
- package/apps/storefront/src/lib/apps/gtmMigrationInstall.ts +447 -0
- package/apps/storefront/src/lib/apps/gtmMigrationReport.ts +367 -0
- package/apps/storefront/src/lib/apps/gtmMigrationTab.ts +315 -0
- package/apps/storefront/src/lib/apps/healthAggregate.ts +5 -5
- package/apps/storefront/src/lib/apps/integrationLifecycle.ts +614 -0
- package/apps/storefront/src/lib/apps/integrationLifecycleController.ts +125 -0
- package/apps/storefront/src/lib/apps/integrationReadModel.ts +563 -0
- package/apps/storefront/src/lib/apps/integrationsTab.ts +547 -0
- package/apps/storefront/src/lib/apps/integrationsView.ts +106 -0
- package/apps/storefront/src/lib/apps/managedAnalyticsService.ts +599 -0
- package/apps/storefront/src/lib/apps/orders/attributionService.ts +2 -2
- package/apps/storefront/src/lib/apps/orders/customerHash.ts +1 -1
- package/apps/storefront/src/lib/apps/orders/foxyOrderClient.ts +12 -12
- package/apps/storefront/src/lib/apps/orders/idempotency.ts +7 -7
- package/apps/storefront/src/lib/apps/orders/orderConversionD1.ts +150 -0
- package/apps/storefront/src/lib/apps/orders/orderForwardReceiver.ts +9 -1
- package/apps/storefront/src/lib/apps/orders/orderMapper.ts +2 -2
- package/apps/storefront/src/lib/apps/orders/ordersStore.ts +7 -7
- package/apps/storefront/src/lib/apps/orders/verifiedProviderMeasurement.ts +117 -0
- package/apps/storefront/src/lib/apps/registryService.ts +270 -16
- package/apps/storefront/src/lib/apps/scopes.ts +2 -2
- package/apps/storefront/src/lib/apps/tenantIntegrationMaterialization.ts +170 -0
- package/apps/storefront/src/lib/apps/tokenIssuer.ts +4 -4
- package/apps/storefront/src/lib/apps/tokenVerifier.ts +6 -6
- package/apps/storefront/src/lib/apps/v84CleanCloneReplayContext.ts +16 -0
- package/apps/storefront/src/lib/apps/v84CloneLifecycleCacheEvidence.ts +105 -0
- package/apps/storefront/src/lib/apps/v84CloneLifecycleEvidence.ts +177 -0
- package/apps/storefront/src/lib/apps/v84CloneLifecycleMaterialization.ts +251 -0
- package/apps/storefront/src/lib/apps/v84CloneLifecycleSemantics.ts +241 -0
- package/apps/storefront/src/lib/apps/v84CloneMigrationEvidence.ts +211 -0
- package/apps/storefront/src/lib/apps/v84CloneNativeInstallEvidence.ts +409 -0
- package/apps/storefront/src/lib/apps/v84NonportableCodeCoaching.ts +368 -0
- package/apps/storefront/src/lib/apps/v84NonportableRouteContract.ts +188 -0
- package/apps/storefront/src/lib/apps/v84NonportableRouteDogfood.ts +291 -0
- package/apps/storefront/src/lib/apps/widgets/eligibility.ts +2 -2
- package/apps/storefront/src/lib/apps/widgets/frameProps.ts +3 -3
- package/apps/storefront/src/lib/apps/widgets/launchToken.ts +4 -4
- package/apps/storefront/src/lib/apps/widgets/placements.ts +2 -2
- package/apps/storefront/src/lib/apps/widgets/renderSlot.ts +1 -1
- package/apps/storefront/src/lib/apps/ws1ManagedAnalyticsClient.ts +95 -0
- package/apps/storefront/src/lib/auth/adminApiGuard.ts +66 -0
- package/apps/storefront/src/lib/auth/adminEntry.ts +11 -11
- package/apps/storefront/src/lib/auth/adminLanding.ts +88 -0
- package/apps/storefront/src/lib/auth/identityToken.ts +6 -14
- package/apps/storefront/src/lib/auth/loginGate.ts +75 -13
- package/apps/storefront/src/lib/auth/mcpClientAssertion.ts +2 -4
- package/apps/storefront/src/lib/auth/operatorSession.ts +113 -0
- package/apps/storefront/src/lib/auth/session.ts +7 -8
- package/apps/storefront/src/lib/auth/totAccessClient.ts +8 -18
- package/apps/storefront/src/lib/basePath.ts +9 -2
- package/apps/storefront/src/lib/blog/access.ts +29 -0
- package/apps/storefront/src/lib/blog/collection.ts +400 -0
- package/apps/storefront/src/lib/blog/markdown.ts +174 -0
- package/apps/storefront/src/lib/blog/provider.ts +62 -3
- package/apps/storefront/src/lib/blog/reactions.ts +87 -0
- package/apps/storefront/src/lib/blog/rss.ts +92 -0
- package/apps/storefront/src/lib/blog/teaser.ts +83 -0
- package/apps/storefront/src/lib/blog/types.ts +34 -0
- package/apps/storefront/src/lib/blog/viewCounts.ts +243 -0
- package/apps/storefront/src/lib/chrome/examples/tokenoftrust.chrome-assignments.example.json +6 -0
- package/apps/storefront/src/lib/chrome/examples/tokenoftrust.chrome.example.json +79 -0
- package/apps/storefront/src/lib/chrome/model.ts +48 -253
- package/apps/storefront/src/lib/chrome/navCurrent.ts +29 -0
- package/apps/storefront/src/lib/chrome/parseConfig.ts +18 -32
- package/apps/storefront/src/lib/chrome/variant.ts +39 -0
- package/apps/storefront/src/lib/commerce/checkoutHandoffCorrelation.ts +105 -0
- package/apps/storefront/src/lib/compliance/tamper-sentinel-boot.ts +152 -0
- package/apps/storefront/src/lib/compliance/tamper-sentinel.ts +327 -0
- package/apps/storefront/src/lib/content/index.ts +5 -5
- package/apps/storefront/src/lib/content-edit/applyDiff.ts +1 -1
- package/apps/storefront/src/lib/content-edit/route.ts +1 -1
- package/apps/storefront/src/lib/d1/catalog.ts +14 -2
- package/apps/storefront/src/lib/d1/schema-apps.ts +372 -17
- package/apps/storefront/src/lib/dev/activityIngestToken.ts +2 -4
- package/apps/storefront/src/lib/dev/activityStore.ts +3 -5
- package/apps/storefront/src/lib/dev/apiBase.ts +1 -4
- package/apps/storefront/src/lib/dev/cockpit/ask.ts +49 -0
- package/apps/storefront/src/lib/dev/cockpit/clickToSource.ts +71 -0
- package/apps/storefront/src/lib/dev/cockpit/copyCommand.ts +227 -0
- package/apps/storefront/src/lib/dev/cockpit/files.ts +249 -0
- package/apps/storefront/src/lib/dev/cockpit/hostedActivity.ts +500 -0
- package/apps/storefront/src/lib/dev/cockpit/infoPopover.ts +12 -0
- package/apps/storefront/src/lib/dev/cockpit/mcpCopy.ts +34 -0
- package/apps/storefront/src/lib/dev/cockpit/monitor.ts +107 -0
- package/apps/storefront/src/lib/dev/cockpit/stepper.ts +116 -0
- package/apps/storefront/src/lib/dev/cockpit/themeToggle.ts +23 -0
- package/apps/storefront/src/lib/dev/cockpitStore.ts +1 -9
- package/apps/storefront/src/lib/dev/devDraft.ts +1 -1
- package/apps/storefront/src/lib/dev/previewStatus.ts +9 -21
- package/apps/storefront/src/lib/dev/rendezvousBroker.ts +9 -24
- package/apps/storefront/src/lib/dev/runtimeStore.ts +1 -1
- package/apps/storefront/src/lib/edgeCache.ts +34 -5
- package/apps/storefront/src/lib/email/candidateConflictEmail.ts +80 -0
- package/apps/storefront/src/lib/http/fetchTransport.ts +63 -0
- package/apps/storefront/src/lib/i18n.ts +25 -0
- package/apps/storefront/src/lib/integration/browserEnvironment.ts +137 -0
- package/apps/storefront/src/lib/integration/managedInstallDeclarations.ts +72 -0
- package/apps/storefront/src/lib/integration/nonceStamp.ts +49 -0
- package/apps/storefront/src/lib/integration/tenantDeclarations.ts +116 -0
- package/apps/storefront/src/lib/jsonld.ts +118 -0
- package/apps/storefront/src/lib/membership/eligibility.ts +1 -1
- package/apps/storefront/src/lib/membership/model.ts +1 -2
- package/apps/storefront/src/lib/monitoring/manifest.ts +11 -11
- package/apps/storefront/src/lib/newsletter/confirmationEmail.ts +30 -0
- package/apps/storefront/src/lib/newsletter/consent.ts +23 -0
- package/apps/storefront/src/lib/newsletter/digest.ts +117 -0
- package/apps/storefront/src/lib/newsletter/resendClient.ts +79 -0
- package/apps/storefront/src/lib/newsletter/send.ts +265 -0
- package/apps/storefront/src/lib/newsletter/subscribers.ts +156 -0
- package/apps/storefront/src/lib/previewReload.ts +57 -1
- package/apps/storefront/src/lib/publish/adminPublishTab.ts +4625 -0
- package/apps/storefront/src/lib/publish/apex-readiness.ts +41 -18
- package/apps/storefront/src/lib/publish/buildStream.ts +269 -0
- package/apps/storefront/src/lib/publish/collapsePersistence.ts +72 -0
- package/apps/storefront/src/lib/publish/dispatchHealth.ts +5 -7
- package/apps/storefront/src/lib/publish/domainState.ts +22 -13
- package/apps/storefront/src/lib/publish/lifecycleState.ts +369 -0
- package/apps/storefront/src/lib/publish/liveReleaseSummary.ts +29 -0
- package/apps/storefront/src/lib/publish/mergeDoctorOnFailure.ts +78 -0
- package/apps/storefront/src/lib/publish/mergeHealthBanner.ts +62 -0
- package/apps/storefront/src/lib/publish/mergeRowFindings.ts +124 -0
- package/apps/storefront/src/lib/publish/mergeSupportEscalation.ts +75 -0
- package/apps/storefront/src/lib/publish/panelPolling.ts +78 -0
- package/apps/storefront/src/lib/publish/publish-guard.ts +88 -0
- package/apps/storefront/src/lib/publish/publishFormat.ts +165 -0
- package/apps/storefront/src/lib/publish/publishHero.ts +177 -0
- package/apps/storefront/src/lib/publish/reviewRelease/changeState.ts +66 -0
- package/apps/storefront/src/lib/publish/reviewRelease/copy.ts +141 -0
- package/apps/storefront/src/lib/publish/reviewRelease/index.ts +41 -0
- package/apps/storefront/src/lib/publish/reviewRelease/permissions.ts +47 -0
- package/apps/storefront/src/lib/publish/reviewRelease/releaseState.ts +42 -0
- package/apps/storefront/src/lib/publish/reviewRelease/types.ts +59 -0
- package/apps/storefront/src/lib/publish/reviewRelease/viewModel.ts +440 -0
- package/apps/storefront/src/lib/publish/reviewReleaseWorkspace/actions.ts +161 -0
- package/apps/storefront/src/lib/publish/reviewReleaseWorkspace/controller.ts +325 -0
- package/apps/storefront/src/lib/publish/reviewReleaseWorkspace/render.ts +241 -0
- package/apps/storefront/src/lib/publish/shipWorkspace.ts +121 -51
- package/apps/storefront/src/lib/publish/sseRoute.ts +119 -0
- package/apps/storefront/src/lib/publish/stageBundleUpload.ts +215 -0
- package/apps/storefront/src/lib/publish/streamLogConsole.ts +142 -0
- package/apps/storefront/src/lib/publish/versionNumber.ts +52 -0
- package/apps/storefront/src/lib/rate/kvWindow.ts +53 -0
- package/apps/storefront/src/lib/rawChrome.ts +125 -47
- package/apps/storefront/src/lib/rawMarketingHtml.ts +74 -3
- package/apps/storefront/src/lib/search/index.ts +2 -2
- package/apps/storefront/src/lib/seo/alternates.ts +42 -0
- package/apps/storefront/src/lib/seo/meta.ts +65 -0
- package/apps/storefront/src/lib/social/golive.ts +212 -0
- package/apps/storefront/src/lib/social/notify.ts +32 -0
- package/apps/storefront/src/lib/social/tokenStore.ts +171 -0
- package/apps/storefront/src/lib/storyblok/content-model.ts +7 -33
- package/apps/storefront/src/lib/storyblok/provider.ts +168 -60
- package/apps/storefront/src/lib/subscription/model.ts +4 -4
- package/apps/storefront/src/lib/the-build/provider.ts +32 -0
- package/apps/storefront/src/lib/the-build/readingTime.ts +35 -0
- package/apps/storefront/src/lib/the-build/toc.ts +95 -0
- package/apps/storefront/src/lib/tot/ToTClient.ts +1 -1
- package/apps/storefront/src/lib/tot/d1Client.ts +2 -2
- package/apps/storefront/src/lib/tot/totClientInterface.ts +3 -4
- package/apps/storefront/src/lib/webhooks/deliveryStore.ts +16 -17
- package/apps/storefront/src/middleware/index.ts +385 -52
- package/apps/storefront/src/pages/[...slug].astro +9 -4
- package/apps/storefront/src/pages/admin/review-release.astro +265 -0
- package/apps/storefront/src/pages/admin/select.astro +96 -0
- package/apps/storefront/src/pages/admin.astro +25 -1313
- package/apps/storefront/src/pages/api/activity.ts +8 -8
- package/apps/storefront/src/pages/api/admin/activity-alerts.ts +5 -20
- package/apps/storefront/src/pages/api/admin/orders/[id].ts +7 -2
- package/apps/storefront/src/pages/api/admin/orders.ts +8 -2
- package/apps/storefront/src/pages/api/apps/admin/gtm-migration-install.ts +174 -0
- package/apps/storefront/src/pages/api/apps/admin/gtm-migration.ts +96 -0
- package/apps/storefront/src/pages/api/apps/admin/integration-lifecycle.ts +118 -0
- package/apps/storefront/src/pages/api/apps/admin/integrations.ts +89 -0
- package/apps/storefront/src/pages/api/apps/admin/platform-adapters.ts +85 -0
- package/apps/storefront/src/pages/api/apps/internal/order-forward.ts +74 -2
- package/apps/storefront/src/pages/api/blog/[collection]/[slug]/react.ts +104 -0
- package/apps/storefront/src/pages/api/commerce/checkout-handoff.ts +77 -0
- package/apps/storefront/src/pages/api/compliance/tamper.ts +88 -0
- package/apps/storefront/src/pages/api/integrations/v1/[operation].ts +108 -0
- package/apps/storefront/src/pages/api/newsletter/[collection]/subscribe.ts +146 -0
- package/apps/storefront/src/pages/api/newsletter/confirm.ts +75 -0
- package/apps/storefront/src/pages/api/newsletter/unsubscribe.ts +90 -0
- package/apps/storefront/src/pages/api/publish/stage-bundle.ts +70 -0
- package/apps/storefront/src/pages/api/rum/vitals.ts +20 -2
- package/apps/storefront/src/pages/blog/[slug].astro +99 -19
- package/apps/storefront/src/pages/blog/author/[author].astro +140 -0
- package/apps/storefront/src/pages/blog/category/[category].astro +67 -0
- package/apps/storefront/src/pages/blog/index.astro +4 -2
- package/apps/storefront/src/pages/blog/tag/[tag].astro +65 -0
- package/apps/storefront/src/pages/cockpit.astro +77 -1353
- package/apps/storefront/src/pages/dashboard/[appDomain]/team.astro +15 -11
- package/apps/storefront/src/pages/index.astro +10 -5
- package/apps/storefront/src/pages/llms.txt.ts +1 -1
- package/apps/storefront/src/pages/products/[handle].astro +7 -6
- package/apps/storefront/src/pages/search.astro +1 -1
- package/apps/storefront/src/pages/sitemap.xml.ts +21 -1
- package/apps/storefront/src/pages/style-guide/[tenant]/[theme].astro +31 -27
- package/apps/storefront/src/pages/style-guide/[tenant]/chrome/[theme].astro +1 -1
- package/apps/storefront/src/pages/tenants/[id]/[...path].ts +38 -2
- package/apps/storefront/src/pages/the-build/[slug].astro +129 -0
- package/apps/storefront/src/pages/the-build/index.astro +146 -0
- package/apps/storefront/src/pages/the-build/rss.xml.ts +33 -0
- package/apps/storefront/src/styles/admin.css +1106 -0
- package/apps/storefront/tsconfig.json +6 -1
- package/package.json +1 -1
- package/packages/public-runtime/package.json +3 -1
- package/packages/public-runtime/schemas/managed-analytics/v1/adapter-definition.schema.json +427 -0
- package/packages/public-runtime/schemas/managed-analytics/v1/create-integration-install-request.schema.json +161 -0
- package/packages/public-runtime/schemas/managed-analytics/v1/create-migration-draft-request.schema.json +157 -0
- package/packages/public-runtime/schemas/managed-analytics/v1/delete-integration-install-request.schema.json +84 -0
- package/packages/public-runtime/schemas/managed-analytics/v1/delete-migration-draft-request.schema.json +84 -0
- package/packages/public-runtime/schemas/managed-analytics/v1/error-envelope.schema.json +180 -0
- package/packages/public-runtime/schemas/managed-analytics/v1/get-adapter-definition-request.schema.json +52 -0
- package/packages/public-runtime/schemas/managed-analytics/v1/get-integration-install-request.schema.json +52 -0
- package/packages/public-runtime/schemas/managed-analytics/v1/get-integration-revision-request.schema.json +79 -0
- package/packages/public-runtime/schemas/managed-analytics/v1/get-migration-draft-request.schema.json +52 -0
- package/packages/public-runtime/schemas/managed-analytics/v1/integration-install.schema.json +167 -0
- package/packages/public-runtime/schemas/managed-analytics/v1/integration-revision.schema.json +208 -0
- package/packages/public-runtime/schemas/managed-analytics/v1/list-adapter-definitions-request.schema.json +53 -0
- package/packages/public-runtime/schemas/managed-analytics/v1/list-integration-installs-request.schema.json +53 -0
- package/packages/public-runtime/schemas/managed-analytics/v1/list-integration-revisions-request.schema.json +82 -0
- package/packages/public-runtime/schemas/managed-analytics/v1/migration-draft.schema.json +218 -0
- package/packages/public-runtime/schemas/managed-analytics/v1/mutation-request.schema.json +52 -0
- package/packages/public-runtime/schemas/managed-analytics/v1/mutation-success-envelope.schema.json +49 -0
- package/packages/public-runtime/schemas/managed-analytics/v1/read-request.schema.json +20 -0
- package/packages/public-runtime/schemas/managed-analytics/v1/read-success-envelope.schema.json +45 -0
- package/packages/public-runtime/schemas/managed-analytics/v1/revise-integration-install-request.schema.json +156 -0
- package/packages/public-runtime/schemas/managed-analytics/v1/set-integration-install-status-request.schema.json +92 -0
- package/packages/public-runtime/schemas/managed-analytics/v1/update-migration-draft-request.schema.json +184 -0
- package/packages/public-runtime/scripts/generate-managed-analytics-api-v1-schemas.mjs +13 -0
- package/packages/public-runtime/src/activity/catalog.ts +89 -33
- package/packages/public-runtime/src/activity/event.ts +6 -6
- package/packages/public-runtime/src/activity/index.ts +2 -2
- package/packages/public-runtime/src/activity/redaction.ts +4 -4
- package/packages/public-runtime/src/candidate-index.ts +42 -8
- package/packages/public-runtime/src/catalog-d1.ts +1 -1
- package/packages/public-runtime/src/checkout-orders.ts +2 -2
- package/packages/public-runtime/src/checkout-style-publish.ts +2 -2
- package/packages/public-runtime/src/checkout-style.ts +7 -7
- package/packages/public-runtime/src/checkout.ts +3 -3
- package/packages/public-runtime/src/chrome.ts +777 -0
- package/packages/public-runtime/src/compliance-obligations.ts +310 -0
- package/packages/public-runtime/src/csp.ts +99 -0
- package/packages/public-runtime/src/customization-preview.ts +25 -2
- package/packages/public-runtime/src/customization-runtime.ts +156 -3
- package/packages/public-runtime/src/customization-versioning.ts +10 -0
- package/packages/public-runtime/src/destination-webhook/contract.ts +353 -0
- package/packages/public-runtime/src/embed-catalog.d.mts +9 -0
- package/packages/public-runtime/src/embed-catalog.mjs +40 -0
- package/packages/public-runtime/src/evidence.ts +288 -0
- package/packages/public-runtime/src/gtm-migration/bounds.ts +138 -0
- package/packages/public-runtime/src/gtm-migration/disposition-rules.ts +361 -0
- package/packages/public-runtime/src/gtm-migration/dispositions.ts +181 -0
- package/packages/public-runtime/src/gtm-migration/draft-generator.ts +400 -0
- package/packages/public-runtime/src/gtm-migration/graph.ts +468 -0
- package/packages/public-runtime/src/gtm-migration/index.ts +95 -0
- package/packages/public-runtime/src/gtm-migration/parse.ts +410 -0
- package/packages/public-runtime/src/gtm-migration/references.ts +266 -0
- package/packages/public-runtime/src/gtm-migration/types.ts +86 -0
- package/packages/public-runtime/src/index.ts +17 -1
- package/packages/public-runtime/src/integration/assurance-decision.ts +259 -0
- package/packages/public-runtime/src/integration/assurance.ts +228 -0
- package/packages/public-runtime/src/integration/candidate-evidence.ts +377 -0
- package/packages/public-runtime/src/integration/commerce-broker.ts +497 -0
- package/packages/public-runtime/src/integration/consent-broker.ts +337 -0
- package/packages/public-runtime/src/integration/consent-cmp-demand.ts +115 -0
- package/packages/public-runtime/src/integration/consent-config.ts +260 -0
- package/packages/public-runtime/src/integration/consent-preview.ts +125 -0
- package/packages/public-runtime/src/integration/correlation-token.ts +444 -0
- package/packages/public-runtime/src/integration/csp-compiler.ts +267 -0
- package/packages/public-runtime/src/integration/csp.ts +105 -0
- package/packages/public-runtime/src/integration/digest.ts +43 -0
- package/packages/public-runtime/src/integration/environment.ts +228 -0
- package/packages/public-runtime/src/integration/events-catalog.ts +186 -0
- package/packages/public-runtime/src/integration/events.ts +701 -0
- package/packages/public-runtime/src/integration/g2-action-boundary.ts +106 -0
- package/packages/public-runtime/src/integration/index.ts +90 -0
- package/packages/public-runtime/src/integration/interim-bridge.ts +138 -0
- package/packages/public-runtime/src/integration/lifecycle-boot.ts +317 -0
- package/packages/public-runtime/src/integration/lifecycle-runtime.ts +393 -0
- package/packages/public-runtime/src/integration/lifecycle.ts +94 -0
- package/packages/public-runtime/src/integration/managed-analytics-api-v1-safety.d.mts +2 -0
- package/packages/public-runtime/src/integration/managed-analytics-api-v1-safety.mjs +10 -0
- package/packages/public-runtime/src/integration/managed-analytics-api-v1.schemas.ts +382 -0
- package/packages/public-runtime/src/integration/managed-analytics-api-v1.ts +684 -0
- package/packages/public-runtime/src/integration/managed-analytics-bridge.ts +383 -0
- package/packages/public-runtime/src/integration/managed-analytics-value-safety.ts +14 -0
- package/packages/public-runtime/src/integration/managed-analytics.ts +277 -0
- package/packages/public-runtime/src/integration/manifest.ts +470 -0
- package/packages/public-runtime/src/integration/native-amplitude.ts +362 -0
- package/packages/public-runtime/src/integration/native-ga4.ts +352 -0
- package/packages/public-runtime/src/integration/observability.ts +451 -0
- package/packages/public-runtime/src/integration/order-conversion.ts +0 -0
- package/packages/public-runtime/src/integration/phases.ts +182 -0
- package/packages/public-runtime/src/integration/plan.ts +112 -0
- package/packages/public-runtime/src/integration/platform-adapter-runtime.ts +146 -0
- package/packages/public-runtime/src/integration/platform-adapters.ts +671 -0
- package/packages/public-runtime/src/integration/promotion-gate.ts +451 -0
- package/packages/public-runtime/src/integration/provider-checkout-extension.ts +425 -0
- package/packages/public-runtime/src/integration/receipt-measurement.ts +370 -0
- package/packages/public-runtime/src/integration/regulated-parent-cert.ts +311 -0
- package/packages/public-runtime/src/integration/render-phases.ts +267 -0
- package/packages/public-runtime/src/integration/resolve.ts +465 -0
- package/packages/public-runtime/src/integration/result.ts +239 -0
- package/packages/public-runtime/src/integration/secrets.ts +92 -0
- package/packages/public-runtime/src/integration/tamper-evidence.ts +205 -0
- package/packages/public-runtime/src/integration/tamper-recovery.ts +127 -0
- package/packages/public-runtime/src/integration/version.ts +92 -0
- package/packages/public-runtime/src/integration-capabilities.ts +520 -0
- package/packages/public-runtime/src/membership.ts +2 -2
- package/packages/public-runtime/src/raw-html-policy.ts +2 -4
- package/packages/public-runtime/src/regulated-commerce/broker/consent-dedupe.ts +144 -0
- package/packages/public-runtime/src/regulated-commerce/correlation/contract.ts +177 -0
- package/packages/public-runtime/src/regulated-commerce/diagnostics/local-dispatch.ts +24 -0
- package/packages/public-runtime/src/regulated-commerce/diagnostics/read-model.ts +69 -0
- package/packages/public-runtime/src/regulated-commerce/dispatch/core.ts +134 -0
- package/packages/public-runtime/src/regulated-commerce/events/contract.ts +113 -0
- package/packages/public-runtime/src/regulated-commerce/ledger/core.ts +81 -0
- package/packages/public-runtime/src/regulated-commerce/mappings/ga4-ads.ts +87 -0
- package/packages/public-runtime/src/regulated-commerce/provider-order/bridge.ts +52 -0
- package/packages/public-runtime/src/regulated-commerce/purchase-truth/contract.ts +252 -0
- package/packages/public-runtime/src/regulated-commerce/sources/accepted-browser-operation.ts +67 -0
- package/packages/public-runtime/src/regulated-commerce/testing/fake-destination.ts +93 -0
- package/packages/public-runtime/src/static-bundle.ts +357 -0
- package/packages/public-runtime/src/tenant-assets.ts +143 -4
- package/packages/public-runtime/src/tenant.ts +81 -17
- package/packages/public-runtime/tests/fixtures/integration/browser-environment.example.json +8 -0
- package/packages/public-runtime/tests/fixtures/integration/commerce-event.example.json +44 -0
- package/packages/public-runtime/tests/fixtures/integration/commerce-order-event.example.json +44 -0
- package/packages/public-runtime/tests/fixtures/integration/compliance-assurance-record.example.json +50 -0
- package/packages/public-runtime/tests/fixtures/integration/integration-manifest-v2.example.json +120 -0
- package/packages/public-runtime/tests/fixtures/integration/managed-analytics-v1/fake-adapter-catalog.json +35 -0
- package/packages/public-runtime/tests/fixtures/integration/tenant-action-registry.example.json +11 -0
- package/packages/public-runtime/tests/fixtures/integration/tenant-local-example/README.md +22 -0
- package/packages/public-runtime/tests/fixtures/integration/tenant-local-example/entry.js +30 -0
- package/packages/public-runtime/tests/fixtures/integration/tenant-local-example/manifest.json +75 -0
- package/packages/public-runtime/tests/fixtures/integration/tenant-local-example/public-config.json +3 -0
- package/packages/public-runtime/tests/fixtures/regulated-commerce/fake-destinations.ts +38 -0
- package/packages/public-runtime/tests/gtm-migration/fixtures/gtm-sample-container-v84.provenance.json +29 -0
- package/packages/public-runtime/tests/gtm-migration/fixtures/gtm-sample-container-v84.redacted.json +3397 -0
- package/scripts/build/copy-tenant-assets.mjs +14 -4
- package/scripts/dev/ai-edit.mjs +1 -1
- package/scripts/dev/checkout-watch.mjs +2 -2
- package/scripts/dev/file-browser.mjs +4 -6
- package/scripts/dev/file-writer.mjs +3 -3
- package/scripts/dev/git-status.mjs +2 -2
- package/scripts/dev/integration-guardrails.mjs +498 -0
- package/scripts/dev/locate-handler.mjs +3 -3
- package/scripts/dev/port-check.mjs +3 -3
- package/scripts/dev/publish.mjs +5 -9
- package/scripts/dev/safe-path.mjs +2 -2
- package/scripts/dev/shot.mjs +1 -1
- package/scripts/dev/tenant-source-root.mjs +1 -1
- package/scripts/dev/unified-diff.mjs +8 -3
- package/scripts/tot-dev.mjs +8 -11
- package/apps/storefront/src/lib/dev/vcBinding.ts +0 -80
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** Shared fake/local state contract for one composed v84 clean-clone pass. */
|
|
2
|
+
export const V84_REPLAY_SESSION_ID = "offline-v84-shared-clone-session" as const;
|
|
3
|
+
export const V84_REPLAY_CLONE_TENANT = "tokenoftrust.com~clone~gtm-migration-v84" as const;
|
|
4
|
+
|
|
5
|
+
export interface V84CleanCloneReplayContext {
|
|
6
|
+
readonly sessionId: typeof V84_REPLAY_SESSION_ID;
|
|
7
|
+
readonly cloneTenant: typeof V84_REPLAY_CLONE_TENANT;
|
|
8
|
+
read<T>(key: string): T | undefined;
|
|
9
|
+
write(key: string, value: unknown): void;
|
|
10
|
+
delete(key: string): void;
|
|
11
|
+
keys(prefix?: string): readonly string[];
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function sameV84ReplayValue(left: unknown, right: unknown): boolean {
|
|
15
|
+
return JSON.stringify(left) === JSON.stringify(right);
|
|
16
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/** Clone-only cold/warm cache evidence over local managed-install state. */
|
|
2
|
+
import { getCachedPage, pageCacheKey, putCachedPage } from "../edgeCache.js";
|
|
3
|
+
import type { V84DisabledInstallMaterializationResult } from "./v84CloneLifecycleMaterialization.js";
|
|
4
|
+
import {
|
|
5
|
+
V84_NATIVE_CLONE_TENANT,
|
|
6
|
+
V84_NATIVE_SOURCE_TENANT,
|
|
7
|
+
} from "./v84CloneNativeInstallEvidence.js";
|
|
8
|
+
import type { V84CleanCloneReplayContext } from "./v84CleanCloneReplayContext.js";
|
|
9
|
+
|
|
10
|
+
const CACHE_BODY = "<!-- offline v84 lifecycle cache artifact; no integration markup -->";
|
|
11
|
+
const INTEGRATION_MARKUP = /<script|dataLayer|googletagmanager|GTM-|\beval\s*\(/i;
|
|
12
|
+
|
|
13
|
+
function fakeCache(replayContext?: V84CleanCloneReplayContext) {
|
|
14
|
+
const store = new Map<string, Response>();
|
|
15
|
+
const reads: string[] = [];
|
|
16
|
+
const writes: string[] = [];
|
|
17
|
+
const cache = {
|
|
18
|
+
async match(request: Request) {
|
|
19
|
+
reads.push(request.url);
|
|
20
|
+
if (replayContext) {
|
|
21
|
+
const found = replayContext.read<{
|
|
22
|
+
body: string;
|
|
23
|
+
headers: Record<string, string>;
|
|
24
|
+
status: number;
|
|
25
|
+
}>(`stage/lifecycle/cache/${encodeURIComponent(request.url)}`);
|
|
26
|
+
return found ? new Response(found.body, { headers: found.headers, status: found.status }) : undefined;
|
|
27
|
+
}
|
|
28
|
+
return store.get(request.url)?.clone();
|
|
29
|
+
},
|
|
30
|
+
async put(request: Request, response: Response) {
|
|
31
|
+
writes.push(request.url);
|
|
32
|
+
if (replayContext) {
|
|
33
|
+
replayContext.write(`stage/lifecycle/cache/${encodeURIComponent(request.url)}`, {
|
|
34
|
+
body: await response.clone().text(),
|
|
35
|
+
headers: Object.fromEntries(response.headers.entries()),
|
|
36
|
+
status: response.status,
|
|
37
|
+
});
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
store.set(request.url, response.clone());
|
|
41
|
+
},
|
|
42
|
+
} as unknown as Cache;
|
|
43
|
+
return { cache, reads, writes };
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** Exercise a true cold miss and warm clone-only hit without touching source keys. */
|
|
47
|
+
export async function buildV84CloneCacheEvidence(
|
|
48
|
+
materialization: V84DisabledInstallMaterializationResult,
|
|
49
|
+
replayContext?: V84CleanCloneReplayContext,
|
|
50
|
+
) {
|
|
51
|
+
const memory = fakeCache(replayContext);
|
|
52
|
+
const disabledCacheKeyBefore = pageCacheKey(
|
|
53
|
+
V84_NATIVE_CLONE_TENANT,
|
|
54
|
+
"/v84-lifecycle",
|
|
55
|
+
"",
|
|
56
|
+
1,
|
|
57
|
+
materialization.candidatePlanBefore.planRevision,
|
|
58
|
+
);
|
|
59
|
+
const cloneCacheKey = pageCacheKey(
|
|
60
|
+
V84_NATIVE_CLONE_TENANT,
|
|
61
|
+
"/v84-lifecycle",
|
|
62
|
+
"",
|
|
63
|
+
1,
|
|
64
|
+
materialization.candidatePlanAfter.planRevision,
|
|
65
|
+
);
|
|
66
|
+
const sourceCacheKey = pageCacheKey(V84_NATIVE_SOURCE_TENANT, "/v84-lifecycle", "", 1);
|
|
67
|
+
const cold = await getCachedPage(memory.cache, cloneCacheKey);
|
|
68
|
+
await putCachedPage(memory.cache, cloneCacheKey, new Response(CACHE_BODY, {
|
|
69
|
+
status: 200,
|
|
70
|
+
headers: { "content-type": "text/html; charset=utf-8" },
|
|
71
|
+
}));
|
|
72
|
+
const warm = await getCachedPage(memory.cache, cloneCacheKey);
|
|
73
|
+
const warmBody = warm ? await warm.text() : "";
|
|
74
|
+
if (
|
|
75
|
+
cold !== null ||
|
|
76
|
+
!warm ||
|
|
77
|
+
warmBody !== CACHE_BODY ||
|
|
78
|
+
warm.headers.get("x-tot-cache") !== "hit" ||
|
|
79
|
+
disabledCacheKeyBefore.url !== cloneCacheKey.url ||
|
|
80
|
+
INTEGRATION_MARKUP.test(warmBody)
|
|
81
|
+
) {
|
|
82
|
+
throw new Error("The clone-local warm-cache proof failed.");
|
|
83
|
+
}
|
|
84
|
+
if (memory.reads.includes(sourceCacheKey.url) || memory.writes.includes(sourceCacheKey.url)) {
|
|
85
|
+
throw new Error("The warm-cache proof touched the source namespace.");
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return {
|
|
89
|
+
warmCache: {
|
|
90
|
+
tenant: V84_NATIVE_CLONE_TENANT,
|
|
91
|
+
coldMiss: true,
|
|
92
|
+
warmHit: true,
|
|
93
|
+
cloneWriteCount: memory.writes.length,
|
|
94
|
+
sourceReadCount: memory.reads.filter((url) => url === sourceCacheKey.url).length,
|
|
95
|
+
sourceWriteCount: memory.writes.filter((url) => url === sourceCacheKey.url).length,
|
|
96
|
+
managedInstallStateChanged: materialization.managedInstallStateChanged,
|
|
97
|
+
effectivePlanChanged:
|
|
98
|
+
materialization.candidatePlanBefore.planRevision !== materialization.candidatePlanAfter.planRevision,
|
|
99
|
+
disabledDraftsChangedCacheKey: disabledCacheKeyBefore.url !== cloneCacheKey.url,
|
|
100
|
+
artifactContainsIntegrationMarkup: INTEGRATION_MARKUP.test(warmBody),
|
|
101
|
+
},
|
|
102
|
+
cloneCacheReads: memory.reads.length,
|
|
103
|
+
cloneCacheWrites: memory.writes.length,
|
|
104
|
+
};
|
|
105
|
+
}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Exact-clone, offline lifecycle validation composed from public product seams.
|
|
3
|
+
*
|
|
4
|
+
* It consumes the already-reviewed native-install evidence, then exercises only
|
|
5
|
+
* public-value environment, consent, semantic-event, lifecycle-bridge, and cache
|
|
6
|
+
* contracts. It has no renderer, integration loader, destination runtime, network,
|
|
7
|
+
* persistence, GTM, eval, or publish authority.
|
|
8
|
+
*/
|
|
9
|
+
import {
|
|
10
|
+
APPROVED_MARKETING_ACTION_NAMES,
|
|
11
|
+
planCacheIdentity,
|
|
12
|
+
sha256Hex,
|
|
13
|
+
snapshotManagedAnalyticsDeclarativeInput,
|
|
14
|
+
stableIntegrationStringify,
|
|
15
|
+
} from "@tot/public-runtime";
|
|
16
|
+
import { buildV84CloneCacheEvidence } from "./v84CloneLifecycleCacheEvidence.js";
|
|
17
|
+
import {
|
|
18
|
+
validateV84DisabledInstallMaterialization,
|
|
19
|
+
type V84LifecycleMaterializationDependencies,
|
|
20
|
+
} from "./v84CloneLifecycleMaterialization.js";
|
|
21
|
+
import { buildV84CloneLifecycleSemantics } from "./v84CloneLifecycleSemantics.js";
|
|
22
|
+
import {
|
|
23
|
+
V84_NATIVE_CLONE_TENANT,
|
|
24
|
+
V84_NATIVE_SOURCE_TENANT,
|
|
25
|
+
V84_WS1_API_CONTRACT,
|
|
26
|
+
V84_WS1_FINAL,
|
|
27
|
+
V84_WS2_EVIDENCE_SHA256,
|
|
28
|
+
V84_WS2_FINAL,
|
|
29
|
+
type V84NativeInstallEvidence,
|
|
30
|
+
} from "./v84CloneNativeInstallEvidence.js";
|
|
31
|
+
import {
|
|
32
|
+
sameV84ReplayValue,
|
|
33
|
+
type V84CleanCloneReplayContext,
|
|
34
|
+
} from "./v84CleanCloneReplayContext.js";
|
|
35
|
+
|
|
36
|
+
/** SHA-256 of the full canonical native-install evidence accepted by this unit. */
|
|
37
|
+
export const V84_NATIVE_INSTALL_EVIDENCE_SHA256 = "d479a8b07cdde0808c75abea7410c7f1c685ed8d79f5e62f21a6261d1087eda8" as const;
|
|
38
|
+
|
|
39
|
+
function assertNativeEvidence(evidence: V84NativeInstallEvidence): void {
|
|
40
|
+
if (
|
|
41
|
+
evidence.scope.sourceTenant !== V84_NATIVE_SOURCE_TENANT ||
|
|
42
|
+
evidence.scope.sourceMode !== "read-only" ||
|
|
43
|
+
evidence.scope.cloneTenant !== V84_NATIVE_CLONE_TENANT ||
|
|
44
|
+
evidence.scope.destinationMode !== "offline-in-memory-fake-only" ||
|
|
45
|
+
evidence.contractPins.ws1Final !== V84_WS1_FINAL ||
|
|
46
|
+
evidence.contractPins.ws1ApiContract !== V84_WS1_API_CONTRACT ||
|
|
47
|
+
evidence.contractPins.ws2Final !== V84_WS2_FINAL ||
|
|
48
|
+
evidence.contractPins.ws2EvidenceSha256 !== V84_WS2_EVIDENCE_SHA256 ||
|
|
49
|
+
evidence.installations.length !== 2 ||
|
|
50
|
+
evidence.installations.some((item) =>
|
|
51
|
+
item.desired.installStatus !== "disabled" ||
|
|
52
|
+
item.desired.revisionStatus !== "draft" ||
|
|
53
|
+
item.effective.activeRevisionId !== null ||
|
|
54
|
+
item.effective.materialized !== false
|
|
55
|
+
) ||
|
|
56
|
+
stableIntegrationStringify(evidence.semanticActions) !==
|
|
57
|
+
stableIntegrationStringify(APPROVED_MARKETING_ACTION_NAMES) ||
|
|
58
|
+
evidence.operationCounts.reviseIntegrationInstall !== 0 ||
|
|
59
|
+
evidence.operationCounts.setIntegrationInstallStatus !== 0 ||
|
|
60
|
+
evidence.operationCounts.publish !== 0 ||
|
|
61
|
+
evidence.safety.sourceMutationCount !== 0 ||
|
|
62
|
+
evidence.safety.liveDestinationCount !== 0 ||
|
|
63
|
+
evidence.safety.externalNetworkRequestCount !== 0 ||
|
|
64
|
+
evidence.safety.importedCodeExecuted ||
|
|
65
|
+
evidence.safety.runtimeLoaded ||
|
|
66
|
+
evidence.safety.lifecycle !== "reviewed-disabled-draft-only"
|
|
67
|
+
) {
|
|
68
|
+
throw new Error("The supplied native-install evidence is outside the exact disabled v84 proof.");
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** Build deterministic, sanitized evidence. Every delivery remains an in-memory callback. */
|
|
73
|
+
export async function buildV84CloneLifecycleEvidence(
|
|
74
|
+
unsafeNativeEvidence: unknown,
|
|
75
|
+
materializationDependencies?: V84LifecycleMaterializationDependencies,
|
|
76
|
+
replayContext?: V84CleanCloneReplayContext,
|
|
77
|
+
) {
|
|
78
|
+
const snapshot = snapshotManagedAnalyticsDeclarativeInput<V84NativeInstallEvidence>(unsafeNativeEvidence);
|
|
79
|
+
if (!snapshot.ok) throw new Error("The native-install evidence could not be snapshotted safely.");
|
|
80
|
+
const nativeEvidence = snapshot.value;
|
|
81
|
+
assertNativeEvidence(nativeEvidence);
|
|
82
|
+
if (replayContext && !sameV84ReplayValue(
|
|
83
|
+
replayContext.read<V84NativeInstallEvidence>("stage/native/handoff"),
|
|
84
|
+
nativeEvidence,
|
|
85
|
+
)) {
|
|
86
|
+
throw new Error("The lifecycle proof did not receive the shared native handoff.");
|
|
87
|
+
}
|
|
88
|
+
const nativeEvidenceSha256 = await sha256Hex(stableIntegrationStringify(nativeEvidence));
|
|
89
|
+
if (nativeEvidenceSha256 !== V84_NATIVE_INSTALL_EVIDENCE_SHA256) {
|
|
90
|
+
throw new Error("The supplied native-install evidence does not match the pinned exact proof.");
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const semantics = buildV84CloneLifecycleSemantics();
|
|
94
|
+
const materialization = await validateV84DisabledInstallMaterialization(
|
|
95
|
+
nativeEvidence.installations,
|
|
96
|
+
semantics.candidateEnvironment,
|
|
97
|
+
semantics.stagedEnvironment,
|
|
98
|
+
materializationDependencies,
|
|
99
|
+
replayContext,
|
|
100
|
+
);
|
|
101
|
+
const candidatePlan = materialization.candidatePlanAfter;
|
|
102
|
+
const stagedPlan = materialization.stagedPlanAfter;
|
|
103
|
+
const cache = await buildV84CloneCacheEvidence(materialization, replayContext);
|
|
104
|
+
|
|
105
|
+
const evidence = {
|
|
106
|
+
schemaVersion: 1 as const,
|
|
107
|
+
scope: {
|
|
108
|
+
sourceTenant: V84_NATIVE_SOURCE_TENANT,
|
|
109
|
+
sourceMode: "read-only" as const,
|
|
110
|
+
cloneTenant: V84_NATIVE_CLONE_TENANT,
|
|
111
|
+
destinationMode: "offline-in-memory-callback-only" as const,
|
|
112
|
+
environments: ["candidate", "staged"] as const,
|
|
113
|
+
},
|
|
114
|
+
contractPins: {
|
|
115
|
+
ws1Final: V84_WS1_FINAL,
|
|
116
|
+
ws1ApiContract: V84_WS1_API_CONTRACT,
|
|
117
|
+
ws2Final: V84_WS2_FINAL,
|
|
118
|
+
ws2EvidenceSha256: V84_WS2_EVIDENCE_SHA256,
|
|
119
|
+
nativeInstallEvidenceSha256: nativeEvidenceSha256,
|
|
120
|
+
},
|
|
121
|
+
disabledDrafts: {
|
|
122
|
+
count: nativeEvidence.installations.length,
|
|
123
|
+
statuses: nativeEvidence.installations.map(({ desired }) => ({
|
|
124
|
+
install: desired.installStatus,
|
|
125
|
+
revision: desired.revisionStatus,
|
|
126
|
+
})),
|
|
127
|
+
activeRevisionCount: nativeEvidence.installations.filter(({ effective }) => effective.activeRevisionId !== null).length,
|
|
128
|
+
materializedCount: candidatePlan.integrations.length + stagedPlan.integrations.length,
|
|
129
|
+
materializedDeclarationCount: materialization.materializedDeclarationCount,
|
|
130
|
+
materializedAssetCount: materialization.materializedAssetCount,
|
|
131
|
+
readModelUnmaterializedCount: materialization.readModelUnmaterializedCount,
|
|
132
|
+
lifecycleRefusalCount: materialization.lifecycleRefusalCount,
|
|
133
|
+
lifecycleMutationCount: materialization.lifecycleMutationCount,
|
|
134
|
+
},
|
|
135
|
+
environment: {
|
|
136
|
+
candidate: semantics.candidateEnvironment,
|
|
137
|
+
staged: semantics.stagedEnvironment,
|
|
138
|
+
candidatePlanIdentity: planCacheIdentity(candidatePlan),
|
|
139
|
+
stagedPlanIdentity: planCacheIdentity(stagedPlan),
|
|
140
|
+
distinctPlanIdentities: planCacheIdentity(candidatePlan) !== planCacheIdentity(stagedPlan),
|
|
141
|
+
liveEnvironmentCount: 0,
|
|
142
|
+
},
|
|
143
|
+
consent: semantics.consent,
|
|
144
|
+
lifecycle: semantics.lifecycle,
|
|
145
|
+
routes: semantics.routes,
|
|
146
|
+
actions: semantics.actions,
|
|
147
|
+
warmCache: cache.warmCache,
|
|
148
|
+
operationCounts: {
|
|
149
|
+
sourceReads: 0,
|
|
150
|
+
sourceWrites: 0,
|
|
151
|
+
managedMaterializationReads: materialization.materializationReadCount,
|
|
152
|
+
managedReadModelAssemblies: materialization.readModelAssemblyCount,
|
|
153
|
+
managedLifecycleLoads: materialization.lifecycleLoadCount,
|
|
154
|
+
cloneCacheReads: cache.cloneCacheReads,
|
|
155
|
+
cloneCacheWrites: cache.cloneCacheWrites,
|
|
156
|
+
inMemoryEventDeliveries: semantics.inMemoryEventDeliveries,
|
|
157
|
+
externalNetworkRequests: 0,
|
|
158
|
+
lifecycleMutations: 0,
|
|
159
|
+
publishes: 0,
|
|
160
|
+
},
|
|
161
|
+
safety: {
|
|
162
|
+
importedCodeExecuted: false,
|
|
163
|
+
rendererCalled: false,
|
|
164
|
+
integrationLifecycleRuntimeInitialized: false,
|
|
165
|
+
nativeDestinationRuntimeInvoked: false,
|
|
166
|
+
gtmLoaded: false,
|
|
167
|
+
markupEvaluated: false,
|
|
168
|
+
externalNetworkUsed: false,
|
|
169
|
+
liveSecretUsed: false,
|
|
170
|
+
productionUsed: false,
|
|
171
|
+
sourceMutated: false,
|
|
172
|
+
diagnosticsCarryDestinationValues: false,
|
|
173
|
+
},
|
|
174
|
+
};
|
|
175
|
+
replayContext?.write("stage/lifecycle/handoff", evidence);
|
|
176
|
+
return evidence;
|
|
177
|
+
}
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fake/local adapter that proves disabled managed-install rows remain absent from
|
|
3
|
+
* the real declaration, admin read-model, and lifecycle seams.
|
|
4
|
+
*/
|
|
5
|
+
import {
|
|
6
|
+
resolveEffectivePlan,
|
|
7
|
+
stableIntegrationStringify,
|
|
8
|
+
type BrowserEnvironment,
|
|
9
|
+
type EffectivePlan,
|
|
10
|
+
type IntegrationDeclarationInput,
|
|
11
|
+
} from "@tot/public-runtime";
|
|
12
|
+
import type { Queryable } from "../d1/catalog.js";
|
|
13
|
+
import { loadActiveManagedInstallDeclarations } from "../integration/managedInstallDeclarations.js";
|
|
14
|
+
import { assembleIntegrationReadModel } from "./integrationReadModel.js";
|
|
15
|
+
import { handleLifecycleRequest } from "./integrationLifecycleController.js";
|
|
16
|
+
import {
|
|
17
|
+
V84_NATIVE_CLONE_TENANT,
|
|
18
|
+
type V84NativeInstallEvidence,
|
|
19
|
+
} from "./v84CloneNativeInstallEvidence.js";
|
|
20
|
+
import type { V84CleanCloneReplayContext } from "./v84CleanCloneReplayContext.js";
|
|
21
|
+
|
|
22
|
+
type NativeInstall = V84NativeInstallEvidence["installations"][number];
|
|
23
|
+
|
|
24
|
+
interface LocalManagedRow {
|
|
25
|
+
readonly install_id: string;
|
|
26
|
+
readonly tenant_id: string;
|
|
27
|
+
readonly managed_kind: "managed-analytics-v1";
|
|
28
|
+
readonly status: "suspended";
|
|
29
|
+
readonly app_id: string;
|
|
30
|
+
readonly app_version: string;
|
|
31
|
+
readonly manifest: "{}";
|
|
32
|
+
readonly revision_status: "draft";
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface V84LifecycleMaterializationDependencies {
|
|
36
|
+
readonly loadDeclarations: typeof loadActiveManagedInstallDeclarations;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const dependencies: V84LifecycleMaterializationDependencies = {
|
|
40
|
+
loadDeclarations: loadActiveManagedInstallDeclarations,
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
function resolvePlan(
|
|
44
|
+
environment: BrowserEnvironment,
|
|
45
|
+
declarations: readonly IntegrationDeclarationInput[],
|
|
46
|
+
): EffectivePlan {
|
|
47
|
+
const result = resolveEffectivePlan({
|
|
48
|
+
tenantPublicId: V84_NATIVE_CLONE_TENANT,
|
|
49
|
+
environment,
|
|
50
|
+
declarations,
|
|
51
|
+
});
|
|
52
|
+
if (!result.ok) throw new Error("The local managed-install plan failed safely.");
|
|
53
|
+
return result.value;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function localRows(installations: readonly NativeInstall[]): LocalManagedRow[] {
|
|
57
|
+
return installations.map((install, index) => ({
|
|
58
|
+
install_id: `v84-local-managed-${index + 1}`,
|
|
59
|
+
tenant_id: V84_NATIVE_CLONE_TENANT,
|
|
60
|
+
managed_kind: "managed-analytics-v1",
|
|
61
|
+
status: "suspended",
|
|
62
|
+
app_id: install.adapterId,
|
|
63
|
+
app_version: install.adapterVersion,
|
|
64
|
+
manifest: "{}",
|
|
65
|
+
revision_status: install.desired.revisionStatus,
|
|
66
|
+
}));
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** Minimal local Queryable that executes the materializer's active-row predicate. */
|
|
70
|
+
function localManagedInstallDb(rows: readonly LocalManagedRow[]): Queryable {
|
|
71
|
+
const unexpected = async (): Promise<never> => {
|
|
72
|
+
throw new Error("The disabled managed-install proof reached an unexpected persistence operation.");
|
|
73
|
+
};
|
|
74
|
+
return {
|
|
75
|
+
all: async <T>(sql: string, ...params: unknown[]) => {
|
|
76
|
+
const normalized = sql.replace(/\s+/g, " ").trim();
|
|
77
|
+
if (
|
|
78
|
+
!normalized.includes("FROM app_installs") ||
|
|
79
|
+
!normalized.includes("tenant_id = ?") ||
|
|
80
|
+
!normalized.includes("managed_kind = ?") ||
|
|
81
|
+
!normalized.includes("status = 'active'") ||
|
|
82
|
+
params.length !== 2
|
|
83
|
+
) {
|
|
84
|
+
throw new Error("The managed-install materializer widened its active-row boundary.");
|
|
85
|
+
}
|
|
86
|
+
const [tenantId, managedKind] = params;
|
|
87
|
+
return rows
|
|
88
|
+
.filter((row) =>
|
|
89
|
+
row.tenant_id === tenantId &&
|
|
90
|
+
row.managed_kind === managedKind &&
|
|
91
|
+
row.status === ("active" as string)
|
|
92
|
+
)
|
|
93
|
+
.map(({ install_id, app_id, app_version, manifest }) => ({
|
|
94
|
+
install_id,
|
|
95
|
+
app_id,
|
|
96
|
+
app_version,
|
|
97
|
+
manifest,
|
|
98
|
+
})) as T[];
|
|
99
|
+
},
|
|
100
|
+
first: unexpected,
|
|
101
|
+
run: unexpected,
|
|
102
|
+
exec: unexpected,
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export interface V84DisabledInstallMaterializationResult {
|
|
107
|
+
readonly candidatePlanBefore: EffectivePlan;
|
|
108
|
+
readonly candidatePlanAfter: EffectivePlan;
|
|
109
|
+
readonly stagedPlanAfter: EffectivePlan;
|
|
110
|
+
readonly managedInstallStateChanged: true;
|
|
111
|
+
readonly readModelUnmaterializedCount: 2;
|
|
112
|
+
readonly lifecycleRefusalCount: 2;
|
|
113
|
+
readonly materializedDeclarationCount: 0;
|
|
114
|
+
readonly materializedAssetCount: 0;
|
|
115
|
+
readonly materializationReadCount: 2;
|
|
116
|
+
readonly readModelAssemblyCount: 1;
|
|
117
|
+
readonly lifecycleLoadCount: 2;
|
|
118
|
+
readonly lifecycleMutationCount: 0;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Exercise the actual managed-install declaration loader, admin read model, and
|
|
123
|
+
* lifecycle controller over local rows derived from the canonical install output.
|
|
124
|
+
*/
|
|
125
|
+
export async function validateV84DisabledInstallMaterialization(
|
|
126
|
+
installations: readonly NativeInstall[],
|
|
127
|
+
candidateEnvironment: BrowserEnvironment,
|
|
128
|
+
stagedEnvironment: BrowserEnvironment,
|
|
129
|
+
deps: V84LifecycleMaterializationDependencies = dependencies,
|
|
130
|
+
replayContext?: V84CleanCloneReplayContext,
|
|
131
|
+
): Promise<V84DisabledInstallMaterializationResult> {
|
|
132
|
+
const localBeforeRows: readonly LocalManagedRow[] = [];
|
|
133
|
+
const localAfterRows = localRows(installations);
|
|
134
|
+
if (replayContext) {
|
|
135
|
+
replayContext.write("stage/lifecycle/materialization/before", localBeforeRows);
|
|
136
|
+
replayContext.write("stage/lifecycle/materialization/after", localAfterRows);
|
|
137
|
+
}
|
|
138
|
+
const beforeRows = replayContext
|
|
139
|
+
? replayContext.read<readonly LocalManagedRow[]>("stage/lifecycle/materialization/before") ?? []
|
|
140
|
+
: localBeforeRows;
|
|
141
|
+
const afterRows = replayContext
|
|
142
|
+
? replayContext.read<readonly LocalManagedRow[]>("stage/lifecycle/materialization/after") ?? []
|
|
143
|
+
: localAfterRows;
|
|
144
|
+
if (
|
|
145
|
+
afterRows.length !== 2 ||
|
|
146
|
+
afterRows.some((row) => row.status !== "suspended" || row.revision_status !== "draft") ||
|
|
147
|
+
stableIntegrationStringify(beforeRows) === stableIntegrationStringify(afterRows)
|
|
148
|
+
) {
|
|
149
|
+
throw new Error("The local disabled managed-install state was not exact.");
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
let materializationReadCount = 0;
|
|
153
|
+
const loadDeclarations = async (db: Queryable) => {
|
|
154
|
+
materializationReadCount += 1;
|
|
155
|
+
return deps.loadDeclarations(db, V84_NATIVE_CLONE_TENANT);
|
|
156
|
+
};
|
|
157
|
+
const beforeDeclarations = await loadDeclarations(
|
|
158
|
+
localManagedInstallDb(beforeRows),
|
|
159
|
+
);
|
|
160
|
+
const afterDeclarations = await loadDeclarations(
|
|
161
|
+
localManagedInstallDb(afterRows),
|
|
162
|
+
);
|
|
163
|
+
if (beforeDeclarations.length !== 0 || afterDeclarations.length !== 0) {
|
|
164
|
+
throw new Error("A disabled draft was treated as a materializable managed install.");
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
const candidatePlanBefore = resolvePlan(candidateEnvironment, beforeDeclarations);
|
|
168
|
+
const candidatePlanAfter = resolvePlan(candidateEnvironment, afterDeclarations);
|
|
169
|
+
const stagedPlanAfter = resolvePlan(stagedEnvironment, afterDeclarations);
|
|
170
|
+
let readModelAssemblyCount = 0;
|
|
171
|
+
readModelAssemblyCount += 1;
|
|
172
|
+
const readModel = assembleIntegrationReadModel({
|
|
173
|
+
tenantPublicId: V84_NATIVE_CLONE_TENANT,
|
|
174
|
+
stage: "candidate",
|
|
175
|
+
items: afterRows.map((row) => ({
|
|
176
|
+
install: {
|
|
177
|
+
installId: row.install_id,
|
|
178
|
+
appId: row.app_id,
|
|
179
|
+
appVersion: row.app_version,
|
|
180
|
+
tenantId: row.tenant_id,
|
|
181
|
+
status: row.status,
|
|
182
|
+
},
|
|
183
|
+
purpose: "Reviewed managed analytics destination.",
|
|
184
|
+
desiredConfig: { destinationConfigured: true },
|
|
185
|
+
declaredTier: "platform-adapter",
|
|
186
|
+
effectivePlan: null,
|
|
187
|
+
effectiveCsp: null,
|
|
188
|
+
consentSnapshot: null,
|
|
189
|
+
candidate: null,
|
|
190
|
+
knownGood: null,
|
|
191
|
+
})),
|
|
192
|
+
});
|
|
193
|
+
if (
|
|
194
|
+
!readModel.ok ||
|
|
195
|
+
readModel.value.items.length !== 2 ||
|
|
196
|
+
readModel.value.items.some((item) => item.effective !== null || !item.drift.unmaterialized)
|
|
197
|
+
) {
|
|
198
|
+
throw new Error("The disabled managed-install read model materialized an effective state.");
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
let lifecycleMutationCount = 0;
|
|
202
|
+
let lifecycleRefusalCount = 0;
|
|
203
|
+
let lifecycleLoadCount = 0;
|
|
204
|
+
for (const row of afterRows) {
|
|
205
|
+
const response = await handleLifecycleRequest({
|
|
206
|
+
load: async () => { lifecycleLoadCount += 1; return null; },
|
|
207
|
+
save: async () => { lifecycleMutationCount += 1; },
|
|
208
|
+
resolveCandidateEvidence: async () => {
|
|
209
|
+
throw new Error("An unmaterialized disabled install must not resolve candidate evidence.");
|
|
210
|
+
},
|
|
211
|
+
resolveGate: async () => {
|
|
212
|
+
throw new Error("An unmaterialized disabled install must not resolve a publish gate.");
|
|
213
|
+
},
|
|
214
|
+
}, {
|
|
215
|
+
action: "preview",
|
|
216
|
+
installId: row.install_id,
|
|
217
|
+
actor: "v84-local-reviewer",
|
|
218
|
+
});
|
|
219
|
+
if (response.status !== 409 || JSON.stringify(response.body) !== JSON.stringify({
|
|
220
|
+
error: "integration is not materialized",
|
|
221
|
+
code: "not_materialized",
|
|
222
|
+
})) {
|
|
223
|
+
throw new Error("The disabled managed-install lifecycle did not fail closed.");
|
|
224
|
+
}
|
|
225
|
+
lifecycleRefusalCount += 1;
|
|
226
|
+
}
|
|
227
|
+
if (
|
|
228
|
+
materializationReadCount !== 2 ||
|
|
229
|
+
readModelAssemblyCount !== 1 ||
|
|
230
|
+
lifecycleLoadCount !== 2 ||
|
|
231
|
+
lifecycleMutationCount !== 0 ||
|
|
232
|
+
lifecycleRefusalCount !== 2
|
|
233
|
+
) {
|
|
234
|
+
throw new Error("The disabled managed-install lifecycle changed local state.");
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
return {
|
|
238
|
+
candidatePlanBefore,
|
|
239
|
+
candidatePlanAfter,
|
|
240
|
+
stagedPlanAfter,
|
|
241
|
+
managedInstallStateChanged: true,
|
|
242
|
+
readModelUnmaterializedCount: 2,
|
|
243
|
+
lifecycleRefusalCount: 2,
|
|
244
|
+
materializedDeclarationCount: afterDeclarations.length as 0,
|
|
245
|
+
materializedAssetCount: afterDeclarations.flatMap((item) => item.materializedAssets).length as 0,
|
|
246
|
+
materializationReadCount: materializationReadCount as 2,
|
|
247
|
+
readModelAssemblyCount: readModelAssemblyCount as 1,
|
|
248
|
+
lifecycleLoadCount: lifecycleLoadCount as 2,
|
|
249
|
+
lifecycleMutationCount,
|
|
250
|
+
};
|
|
251
|
+
}
|