@tokenoftrust/storefront-runner 2.4.88 → 2.4.90
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 +2 -2
- package/apps/storefront/drizzle.config.apps.ts +1 -1
- package/apps/storefront/env.d.ts +1 -1
- package/apps/storefront/migrations/README.md +5 -5
- package/apps/storefront/perf/README.md +6 -6
- package/apps/storefront/perf/assert-budgets.ts +2 -2
- package/apps/storefront/src/components/catalog/storefront/CollectionCard.astro +1 -1
- package/apps/storefront/src/components/catalog/storefront/ProductCard.astro +1 -1
- package/apps/storefront/src/components/catalog/storefront/commerce/BrandGrid.astro +1 -1
- package/apps/storefront/src/components/catalog/storefront/commerce/TagFilterCloud.astro +1 -1
- package/apps/storefront/src/components/catalog/storefront/islands/QuickView.tsx +1 -1
- package/apps/storefront/src/components/catalog/storefront/islands/RecentlyViewed.tsx +1 -1
- package/apps/storefront/src/components/catalog/storefront/islands/SearchTypeahead.tsx +1 -1
- package/apps/storefront/src/components/catalog/storefront/plp/ActiveFilters.astro +2 -2
- package/apps/storefront/src/components/catalog/storefront/plp/FacetSidebar.astro +2 -2
- package/apps/storefront/src/components/catalog/storefront/plp/Pagination.astro +1 -1
- package/apps/storefront/src/components/content/storefront/Breadcrumbs.astro +1 -1
- package/apps/storefront/src/components/content/storefront/EmptyState.astro +1 -1
- package/apps/storefront/src/components/content/storefront/blog/BlogPaywall.astro +1 -1
- package/apps/storefront/src/components/content/storefront/blog/ReactionBar.astro +2 -2
- package/apps/storefront/src/components/content/storefront/chrome/NavDropdown.astro +1 -1
- package/apps/storefront/src/components/content/storefront/chrome/SiteFooter.astro +1 -1
- package/apps/storefront/src/components/content/storefront/chrome/SiteHeader.astro +1 -1
- package/apps/storefront/src/components/content/storefront/chrome/UtilityNav.astro +1 -1
- package/apps/storefront/src/components/content/storefront/commerce/ArticleCard.astro +1 -1
- package/apps/storefront/src/components/content/storefront/home/Hero.astro +1 -1
- package/apps/storefront/src/components/content/storefront/marketing/CardGrid.astro +1 -1
- package/apps/storefront/src/components/content/storefront/marketing/Integrations.astro +1 -1
- package/apps/storefront/src/components/content/storefront/marketing/MarketingCtas.astro +1 -1
- package/apps/storefront/src/components/customers/storefront/islands/SavedList.tsx +1 -1
- package/apps/storefront/src/config/adminTargetTenant.ts +1 -1
- package/apps/storefront/src/config/devTenants.ts +1 -1
- package/apps/storefront/src/config/resolver.ts +2 -2
- package/apps/storefront/src/layouts/Layout.astro +5 -5
- package/apps/storefront/src/lib/{admin → access/admin}/README.md +3 -3
- package/apps/storefront/src/lib/{admin → access/admin}/adminShell.ts +1 -1
- package/apps/storefront/src/lib/{admin → access/admin}/envelope.ts +2 -2
- package/apps/storefront/src/lib/{admin → access/admin}/viewmodels/settings.ts +2 -2
- package/apps/storefront/src/lib/{auth → access/auth}/adminApiGuard.ts +2 -2
- package/apps/storefront/src/lib/{auth → access/auth}/adminEntry.ts +3 -3
- package/apps/storefront/src/lib/{auth → access/auth}/adminLanding.ts +1 -1
- package/apps/storefront/src/lib/{auth → access/auth}/brokerAssertion.ts +1 -1
- package/apps/storefront/src/lib/{auth → access/auth}/devAuth.ts +1 -1
- package/apps/storefront/src/lib/{auth → access/auth}/identityToken.ts +2 -2
- package/apps/storefront/src/lib/{auth → access/auth}/loginGate.ts +2 -2
- package/apps/storefront/src/lib/{auth → access/auth}/mcpClientAssertion.ts +1 -1
- package/apps/storefront/src/lib/{auth → access/auth}/route.ts +1 -1
- package/apps/storefront/src/lib/{auth → access/auth}/totAccessClient.ts +5 -5
- package/apps/storefront/src/lib/{dashboard → access/dashboard}/delegateGate.ts +3 -3
- package/apps/storefront/src/lib/{dashboard → access/dashboard}/staffAdmission.ts +1 -1
- package/apps/storefront/src/lib/{dashboard → access/dashboard}/staffVendorAccess.ts +1 -1
- package/apps/storefront/src/lib/{dashboard → access/dashboard}/tenantSelection.ts +1 -1
- package/apps/storefront/src/lib/{admin/services/mock → access/fixtures}/settings.ts +4 -4
- package/apps/storefront/src/lib/{shared → access/shared}/accessExplain.ts +1 -1
- package/apps/storefront/src/lib/{adminTenantEnvelope.ts → access/shared/adminTenantEnvelope.ts} +3 -3
- package/apps/storefront/src/lib/{shared → access/shared}/developerInvites.ts +5 -5
- package/apps/storefront/src/lib/{shared → access/shared}/invitePreflight.ts +1 -1
- package/apps/storefront/src/lib/{shared → access/shared}/principalGrants.ts +3 -3
- package/apps/storefront/src/lib/{tenantRouting.ts → access/shared/tenantRouting.ts} +1 -1
- package/apps/storefront/src/lib/{shared → access/shared}/viewerGrant.ts +1 -1
- package/apps/storefront/src/lib/activity/fixtures/evidence.ts +2 -2
- package/apps/storefront/src/lib/activity/killSwitch.ts +1 -1
- package/apps/storefront/src/lib/activity/uiActor.ts +5 -5
- package/apps/storefront/src/lib/activity/workerCommit.ts +1 -1
- package/apps/storefront/src/lib/admin/services/mock/index.ts +4 -4
- package/apps/storefront/src/lib/assets/durableR2Bindings.ts +1 -1
- package/apps/storefront/src/lib/{admin → automation/admin}/viewmodels/aiWorkflows.ts +3 -3
- package/apps/storefront/src/lib/{admin → automation}/ai/askEnvelope.ts +1 -1
- package/apps/storefront/src/lib/{admin → automation}/ai/operationalRuns.ts +4 -4
- package/apps/storefront/src/lib/{admin/services/mock → automation/fixtures}/aiWorkflows.ts +4 -4
- package/apps/storefront/src/lib/catalog/fixtures/products.ts +4 -4
- package/apps/storefront/src/lib/checkout/admin/checkoutStyleTarget.ts +2 -2
- package/apps/storefront/src/lib/checkout/commerce/checkoutHandoffCorrelation.ts +1 -1
- package/apps/storefront/src/lib/checkout/fixtures/checkoutSettings.ts +1 -1
- package/apps/storefront/src/lib/checkout/shared/checkoutCommerce.ts +1 -1
- package/apps/storefront/src/lib/compliance/browser/checkoutVerificationFlow.ts +1 -1
- package/apps/storefront/src/lib/compliance/enforcement.ts +1 -1
- package/apps/storefront/src/lib/compliance/tamper-sentinel-boot.ts +1 -1
- package/apps/storefront/src/lib/compliance/verification/totVerificationClient.ts +2 -2
- package/apps/storefront/src/lib/content/blog/access.ts +1 -1
- package/apps/storefront/src/lib/content/blog/collection.ts +1 -1
- package/apps/storefront/src/lib/content/blog/postView.ts +2 -2
- package/apps/storefront/src/lib/content/blog/provider.ts +1 -1
- package/apps/storefront/src/lib/content/shared/heroSlideshow.ts +1 -1
- package/apps/storefront/src/lib/content/shared/homeVisualParity.ts +1 -1
- package/apps/storefront/src/lib/content/shared/rawMarketingHtml.ts +1 -1
- package/apps/storefront/src/lib/content/storyblok/provider.ts +1 -1
- package/apps/storefront/src/lib/customers/fixtures/customers.ts +3 -3
- package/apps/storefront/src/lib/{admin → developer-experience/admin}/memoizeByEnvelope.ts +1 -1
- package/apps/storefront/src/lib/{dev → developer-experience/dev}/activityIngestToken.ts +2 -2
- package/apps/storefront/src/lib/{dev → developer-experience/dev}/cliSignInCode.ts +4 -4
- package/apps/storefront/src/lib/{dev → developer-experience/dev}/livePreview.ts +1 -1
- package/apps/storefront/src/lib/{dev → developer-experience/dev}/previewStatus.ts +2 -2
- package/apps/storefront/src/lib/{dev → developer-experience/dev}/rendezvousBroker.ts +3 -3
- package/apps/storefront/src/lib/{dev → developer-experience/dev}/subjectReissue.ts +2 -2
- package/apps/storefront/src/lib/{http → developer-experience/http}/mcpServiceCall.ts +1 -1
- package/apps/storefront/src/lib/{cloudflare-workers.d.ts → developer-experience/types/cloudflare-workers.d.ts} +1 -1
- package/apps/storefront/src/lib/engagement/messaging/messagesClient.ts +2 -2
- package/apps/storefront/src/lib/engagement/newsletter/resendClient.ts +1 -1
- package/apps/storefront/src/lib/engagement/social/tokenStore.ts +1 -1
- package/apps/storefront/src/lib/fulfillment/fulfillmentService.ts +4 -4
- package/apps/storefront/src/lib/integrations/apps/gatewayKeys.ts +1 -1
- package/apps/storefront/src/lib/integrations/apps/registryAccess.ts +1 -1
- package/apps/storefront/src/lib/integrations/integration/browserEnvironment.ts +1 -1
- package/apps/storefront/src/lib/integrations/webhooks/emit.ts +1 -1
- package/apps/storefront/src/lib/integrations/webhooks/getDispatcher.ts +1 -1
- package/apps/storefront/src/lib/measurement/attribution/orderConversionD1.ts +1 -1
- package/apps/storefront/src/lib/measurement/tracking/d1Control.ts +1 -1
- package/apps/storefront/src/lib/measurement/tracking/interactionCollector.ts +1 -1
- package/apps/storefront/src/lib/measurement/tracking/tenantD1Registry.ts +1 -1
- package/apps/storefront/src/lib/{monitoring → observability/monitoring}/manifest.ts +2 -2
- package/apps/storefront/src/lib/{analytics → observability/performance}/budgets.json +1 -1
- package/apps/storefront/src/lib/{analytics → observability/performance}/webVitals.ts +1 -1
- package/apps/storefront/src/lib/orders/fixtures/orders.ts +4 -4
- package/apps/storefront/src/lib/orders/providers/foxyOrderClient.ts +1 -1
- package/apps/storefront/src/lib/{basePath.ts → publication/shared/basePath.ts} +1 -1
- package/apps/storefront/src/lib/{env.ts → publication/shared/env.ts} +1 -1
- package/apps/storefront/src/lib/{previewReload.ts → publication/shared/previewReload.ts} +1 -1
- package/apps/storefront/src/lib/{runtimeEnv.ts → publication/shared/runtimeEnv.ts} +1 -1
- package/apps/storefront/src/lib/{url.ts → publication/shared/url.ts} +1 -1
- package/apps/storefront/src/lib/reporting/fixtures/reporting.ts +3 -3
- package/apps/storefront/src/lib/subscriptions/fixtures/subscriptions.ts +3 -3
- package/apps/storefront/src/middleware/candidatePin.ts +1 -1
- package/apps/storefront/src/middleware/controlPlane.ts +8 -8
- package/apps/storefront/src/middleware/index.ts +13 -13
- package/apps/storefront/src/middleware/publicRender.ts +2 -2
- package/apps/storefront/src/middleware/renderChain.ts +9 -9
- package/apps/storefront/src/middleware/staticBundle.ts +2 -2
- package/apps/storefront/src/pages/404.astro +1 -1
- package/apps/storefront/src/pages/api/activity.ts +1 -1
- package/apps/storefront/src/pages/api/admin/activity-alerts.ts +2 -2
- package/apps/storefront/src/pages/api/admin/commerce-readiness.ts +1 -1
- package/apps/storefront/src/pages/api/admin/fulfillment/batches.ts +1 -1
- package/apps/storefront/src/pages/api/admin/fulfillment/orders/[id]/address.ts +1 -1
- package/apps/storefront/src/pages/api/admin/fulfillment/orders/[id].ts +1 -1
- package/apps/storefront/src/pages/api/admin/interaction-insights.ts +2 -2
- package/apps/storefront/src/pages/api/admin/orders/[id].ts +2 -2
- package/apps/storefront/src/pages/api/admin/orders.ts +2 -2
- package/apps/storefront/src/pages/api/auth/logout.ts +2 -2
- package/apps/storefront/src/pages/api/auth/magic-exchange.ts +6 -6
- package/apps/storefront/src/pages/api/auth/send.ts +3 -3
- package/apps/storefront/src/pages/api/auth/step-up-send.ts +1 -1
- package/apps/storefront/src/pages/api/auth/step-up-verify.ts +3 -3
- package/apps/storefront/src/pages/api/auth/verify.ts +5 -5
- package/apps/storefront/src/pages/api/blog/[collection]/[slug]/react.ts +2 -2
- package/apps/storefront/src/pages/api/checkout-style.css.ts +1 -1
- package/apps/storefront/src/pages/api/cli/policy.ts +1 -1
- package/apps/storefront/src/pages/api/commerce/final-cart-authorization.ts +1 -1
- package/apps/storefront/src/pages/api/newsletter/[collection]/subscribe.ts +2 -2
- package/apps/storefront/src/pages/api/newsletter/confirm.ts +1 -1
- package/apps/storefront/src/pages/api/newsletter/unsubscribe.ts +2 -2
- package/apps/storefront/src/pages/api/newsletter.ts +2 -2
- package/apps/storefront/src/pages/api/request-access.ts +1 -1
- package/apps/storefront/src/pages/api/rum/vitals.ts +2 -2
- package/apps/storefront/src/pages/api/tracking/interaction.ts +1 -1
- package/apps/storefront/src/pages/auth/login.astro +3 -3
- package/apps/storefront/src/pages/auth/magic.astro +1 -1
- package/apps/storefront/src/pages/capabilities.astro +1 -1
- package/apps/storefront/src/pages/collections/[handle].astro +2 -2
- package/apps/storefront/src/pages/feed.json.ts +1 -1
- package/apps/storefront/src/pages/index.astro +1 -1
- package/apps/storefront/src/pages/llms.txt.ts +1 -1
- package/apps/storefront/src/pages/products/[handle].astro +1 -1
- package/apps/storefront/src/pages/search-index.json.ts +1 -1
- package/apps/storefront/src/pages/search.astro +1 -1
- package/apps/storefront/src/pages/sitemap.xml.ts +1 -1
- package/apps/storefront/src/pages/tenants/[id]/[...path].ts +1 -1
- package/apps/storefront/test/pipeline/fake-preview-services.ts +2 -2
- package/apps/storefront/test/pipeline/harness.ts +1 -1
- package/apps/storefront/test/pipeline/matrix-faults.ts +4 -4
- package/apps/storefront/test/pipeline/pipeline-host.ts +9 -9
- package/apps/storefront/test/pipeline/publish-kinds.ts +4 -4
- package/apps/storefront/test/pipeline/synthetic-job.ts +3 -3
- package/apps/storefront/test/pipeline-faults/matrix-lib.ts +2 -2
- package/package.json +1 -1
- package/packages/public-runtime/src/hosted-image-media-types.ts +1 -1
- package/packages/public-runtime/src/retention-holds.ts +1 -1
- package/scripts/dev/locate.mjs +1 -1
- package/apps/storefront/src/lib/admin/ai/index.ts +0 -6
- /package/apps/storefront/src/components/{auth → access/storefront/auth}/AuthBadge.astro +0 -0
- /package/apps/storefront/src/lib/{auth → access/auth}/gatePage.ts +0 -0
- /package/apps/storefront/src/lib/{auth → access/auth}/internalContentAuthority.ts +0 -0
- /package/apps/storefront/src/lib/{auth → access/auth}/operatorSession.ts +0 -0
- /package/apps/storefront/src/lib/{auth → access/auth}/session.ts +0 -0
- /package/apps/storefront/src/lib/{auth → access/auth}/stepUpChallenge.ts +0 -0
- /package/apps/storefront/src/lib/{dashboard → access/dashboard}/vendorQuery.ts +0 -0
- /package/apps/storefront/src/lib/{admin/services/mock → access/fixtures}/tenants.ts +0 -0
- /package/apps/storefront/src/lib/{email → access/notifications}/magicLinkInviteEmail.ts +0 -0
- /package/apps/storefront/src/lib/{privacy → access/privacy}/emailHint.ts +0 -0
- /package/apps/storefront/src/lib/{rate → access/rate}/kvWindow.ts +0 -0
- /package/apps/storefront/src/lib/{shared → access/shared}/capability.ts +0 -0
- /package/apps/storefront/src/lib/{cspStaticHashes.ts → access/shared/cspStaticHashes.ts} +0 -0
- /package/apps/storefront/src/lib/{demoGate.ts → access/shared/demoGate.ts} +0 -0
- /package/apps/storefront/src/lib/{maintenance.ts → access/shared/maintenance.ts} +0 -0
- /package/apps/storefront/src/lib/{securityHeaders.ts → access/shared/securityHeaders.ts} +0 -0
- /package/apps/storefront/src/lib/{tenantOrigins.ts → access/shared/tenantOrigins.ts} +0 -0
- /package/apps/storefront/src/lib/{admin → automation}/ai/approvalMode.ts +0 -0
- /package/apps/storefront/src/lib/{admin → automation}/ai/audit.ts +0 -0
- /package/apps/storefront/src/lib/{admin → automation}/ai/recommendation.ts +0 -0
- /package/apps/storefront/src/lib/{admin → developer-experience/admin}/seed.ts +0 -0
- /package/apps/storefront/src/lib/{dev → developer-experience/dev}/activityStore.ts +0 -0
- /package/apps/storefront/src/lib/{dev → developer-experience/dev}/ai-widget-client.js +0 -0
- /package/apps/storefront/src/lib/{dev → developer-experience/dev}/apiBase.ts +0 -0
- /package/apps/storefront/src/lib/{dev → developer-experience/dev}/cockpit/ask.ts +0 -0
- /package/apps/storefront/src/lib/{dev → developer-experience/dev}/cockpit/clickToSource.ts +0 -0
- /package/apps/storefront/src/lib/{dev → developer-experience/dev}/cockpit/copyCommand.ts +0 -0
- /package/apps/storefront/src/lib/{dev → developer-experience/dev}/cockpit/files.ts +0 -0
- /package/apps/storefront/src/lib/{dev → developer-experience/dev}/cockpit/hostedActivity.ts +0 -0
- /package/apps/storefront/src/lib/{dev → developer-experience/dev}/cockpit/infoPopover.ts +0 -0
- /package/apps/storefront/src/lib/{dev → developer-experience/dev}/cockpit/mcpCopy.ts +0 -0
- /package/apps/storefront/src/lib/{dev → developer-experience/dev}/cockpit/monitor.ts +0 -0
- /package/apps/storefront/src/lib/{dev → developer-experience/dev}/cockpit/stepper.ts +0 -0
- /package/apps/storefront/src/lib/{dev → developer-experience/dev}/cockpit/themeToggle.ts +0 -0
- /package/apps/storefront/src/lib/{dev → developer-experience/dev}/devDraft.ts +0 -0
- /package/apps/storefront/src/lib/{dev → developer-experience/dev}/obstacleStore.ts +0 -0
- /package/apps/storefront/src/lib/{dev → developer-experience/dev}/runtimeStore.ts +0 -0
- /package/apps/storefront/src/lib/{dev → developer-experience/dev}/storeStatus.ts +0 -0
- /package/apps/storefront/src/lib/{fixtures → developer-experience/fixtures}/regulated-commerce-truth/index.ts +0 -0
- /package/apps/storefront/src/lib/{fixtures → developer-experience/fixtures}/ws3-readonly-clone-preflight/index.ts +0 -0
- /package/apps/storefront/src/lib/{http → developer-experience/http}/fetchTransport.ts +0 -0
- /package/apps/storefront/src/lib/{memoryKv.ts → developer-experience/shared/memoryKv.ts} +0 -0
- /package/apps/storefront/src/lib/{diag → observability/diag}/capture.ts +0 -0
- /package/apps/storefront/src/lib/{diag → observability/diag}/consoleLine.ts +0 -0
- /package/apps/storefront/src/lib/{diag → observability/diag}/debugConsole.ts +0 -0
- /package/apps/storefront/src/lib/{diag → observability/diag}/debugMode.ts +0 -0
- /package/apps/storefront/src/lib/{diag → observability/diag}/debugWindow.ts +0 -0
- /package/apps/storefront/src/lib/{diag → observability/diag}/redact.ts +0 -0
- /package/apps/storefront/src/lib/{diag → observability/diag}/reference.ts +0 -0
- /package/apps/storefront/src/lib/{diag → observability/diag}/referenceStore.ts +0 -0
- /package/apps/storefront/src/lib/{diag → observability/diag}/report.ts +0 -0
- /package/apps/storefront/src/lib/{diag → observability/diag}/session.ts +0 -0
- /package/apps/storefront/src/lib/{analytics → observability/performance}/lighthouseReport.ts +0 -0
- /package/apps/storefront/src/lib/{analytics → observability/performance}/perfBudgets.ts +0 -0
- /package/apps/storefront/src/lib/{analytics → observability/performance}/rumAlert.ts +0 -0
- /package/apps/storefront/src/lib/{health.ts → observability/shared/health.ts} +0 -0
- /package/apps/storefront/src/lib/{d1 → publication/d1}/schema-apps.ts +0 -0
- /package/apps/storefront/src/lib/{email → publication/notifications}/candidateConflictEmail.ts +0 -0
- /package/apps/storefront/src/lib/{cdnForward.ts → publication/shared/cdnForward.ts} +0 -0
- /package/apps/storefront/src/lib/{edgeCache.ts → publication/shared/edgeCache.ts} +0 -0
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* shape + the request host + a config flag, never a secret.
|
|
6
6
|
*
|
|
7
7
|
* WHY AN IFRAME WORKS (no screenshots, no new infra): tenant routing is host-first with a
|
|
8
|
-
* `/<appDomain>/…` path-prefix fallback on the same worker (src/lib/tenantRouting.ts), so
|
|
8
|
+
* `/<appDomain>/…` path-prefix fallback on the same worker (src/lib/access/shared/tenantRouting.ts), so
|
|
9
9
|
* the tenant's real site is reachable at a RELATIVE path from /dev. CSP already permits
|
|
10
10
|
* same-origin framing both directions (`frame-ancestors 'self'` + `frame-src 'self'`,
|
|
11
11
|
* packages/public-runtime/src/csp.ts) alongside `X-Frame-Options: SAMEORIGIN` — no header
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
* transport / parse fault → { configured:true, ok:false } so a caller can distinguish
|
|
21
21
|
* "definitely not provisioned" (ok + provisioned:false) from "couldn't tell". Never throws.
|
|
22
22
|
*/
|
|
23
|
-
import { callMcpService } from "@/lib/http/mcpServiceCall";
|
|
24
|
-
import { FetchHttpTransport, type HttpGetTransport } from "@/lib/http/fetchTransport";
|
|
23
|
+
import { callMcpService } from "@/lib/developer-experience/http/mcpServiceCall";
|
|
24
|
+
import { FetchHttpTransport, type HttpGetTransport } from "@/lib/developer-experience/http/fetchTransport";
|
|
25
25
|
|
|
26
26
|
export type { HttpGetTransport };
|
|
27
27
|
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
* (the MCP derives the expected audience from that fixed path, not the sub-path), so
|
|
20
20
|
* one minted assertion shape covers every call. SERVER-SIDE ONLY.
|
|
21
21
|
*/
|
|
22
|
-
import { readEnv } from "@/lib/env";
|
|
23
|
-
import { mintMcpClientAssertion, McpClientAssertionError } from "@/lib/auth/mcpClientAssertion";
|
|
24
|
-
import { FetchHttpTransport, type HttpTransport } from "@/lib/http/fetchTransport";
|
|
22
|
+
import { readEnv } from "@/lib/publication/shared/env";
|
|
23
|
+
import { mintMcpClientAssertion, McpClientAssertionError } from "@/lib/access/auth/mcpClientAssertion";
|
|
24
|
+
import { FetchHttpTransport, type HttpTransport } from "@/lib/developer-experience/http/fetchTransport";
|
|
25
25
|
|
|
26
26
|
export type { HttpTransport };
|
|
27
27
|
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
* MCP client_id, exactly what the MCP binds the subject_token audience to. This is the
|
|
21
21
|
* same non-gated mint the MCP itself uses to power rendezvous creation.
|
|
22
22
|
*/
|
|
23
|
-
import { getAccessClient } from "@/lib/auth/route";
|
|
24
|
-
import type { TotAccessClient } from "@/lib/auth/totAccessClient";
|
|
23
|
+
import { getAccessClient } from "@/lib/access/auth/route";
|
|
24
|
+
import type { TotAccessClient } from "@/lib/access/auth/totAccessClient";
|
|
25
25
|
|
|
26
26
|
/** Short — the proof is minted and used immediately at approve time. */
|
|
27
27
|
const SUBJECT_TOKEN_TTL_SECONDS = 120;
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* (a non-skipped failure), while each caller keeps its own fail-open / fail-closed mapping
|
|
11
11
|
* for the outcome.
|
|
12
12
|
*/
|
|
13
|
-
import { readEnv } from "@/lib/env";
|
|
13
|
+
import { readEnv } from "@/lib/publication/shared/env";
|
|
14
14
|
|
|
15
15
|
export interface McpServiceResponse {
|
|
16
16
|
status: number;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* The storefront does not depend on @cloudflare/workers-types (its globals collide with the DOM
|
|
5
5
|
* lib Astro compiles against), so the Durable Object surface the pipeline needs is declared here.
|
|
6
6
|
* The module only resolves inside workerd; under Node it is imported lazily and guarded
|
|
7
|
-
* (`lib/runtimeEnv.ts`).
|
|
7
|
+
* (`lib/publication/shared/runtimeEnv.ts`).
|
|
8
8
|
*/
|
|
9
9
|
declare module "cloudflare:workers" {
|
|
10
10
|
export type SqlStorageValue = ArrayBuffer | string | number | null;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* The storefront RENDERS its own branded email HTML and hands it to tot20 to TRANSMIT, so we
|
|
5
5
|
* reuse tot20's Mandrill SPF/DKIM deliverability (the whole point) while owning the body/brand.
|
|
6
|
-
* Used for the magic-link invite email (see lib/grants/magicLinkInvite.ts).
|
|
6
|
+
* Used for the magic-link invite email (see lib/access/grants/magicLinkInvite.ts).
|
|
7
7
|
*
|
|
8
8
|
* POST <core>/api/messages
|
|
9
9
|
* { channel:"email", to, subject, html, totApiKey, totSecretKey } → 200 { sent:true, id? }
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*
|
|
16
16
|
* Built like `@/lib/grants/developerInvites` (interface + Http impl + Mock + env factory).
|
|
17
17
|
*/
|
|
18
|
-
import { readEnv } from "@/lib/env";
|
|
18
|
+
import { readEnv } from "@/lib/publication/shared/env";
|
|
19
19
|
|
|
20
20
|
export interface InlineEmail {
|
|
21
21
|
/** Recipient address. */
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* (`POST /emails/batch`, up to 100 messages/call); audience/consent/unsubscribe
|
|
6
6
|
* state stays first-party in our D1, never in a vendor list.
|
|
7
7
|
*/
|
|
8
|
-
import { readEnv } from "../../env.js";
|
|
8
|
+
import { readEnv } from "../../publication/shared/env.js";
|
|
9
9
|
|
|
10
10
|
/** Resend's batch limit: at most 100 messages per `/emails/batch` call. */
|
|
11
11
|
export const RESEND_BATCH_LIMIT = 100;
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* `null` when either binding is absent so callers degrade rather than throw.
|
|
20
20
|
*/
|
|
21
21
|
import type { Queryable } from "../../catalog/d1/catalog.js";
|
|
22
|
-
import { readD1, readEnv } from "../../env.js";
|
|
22
|
+
import { readD1, readEnv } from "../../publication/shared/env.js";
|
|
23
23
|
|
|
24
24
|
/** The decrypted token material we persist as one JSON blob under AES-GCM. */
|
|
25
25
|
export interface SocialTokenPayload {
|
|
@@ -30,10 +30,10 @@ import {
|
|
|
30
30
|
type ProviderOutcome,
|
|
31
31
|
type StockState,
|
|
32
32
|
} from "@tot/public-runtime";
|
|
33
|
-
import { readD1 } from "@/lib/env";
|
|
34
|
-
import { decideAdminApiAccess } from "@/lib/auth/adminApiGuard";
|
|
35
|
-
import { readViewerSession } from "@/lib/auth/route";
|
|
36
|
-
import type { SessionRecord } from "@/lib/auth/session";
|
|
33
|
+
import { readD1 } from "@/lib/publication/shared/env";
|
|
34
|
+
import { decideAdminApiAccess } from "@/lib/access/auth/adminApiGuard";
|
|
35
|
+
import { readViewerSession } from "@/lib/access/auth/route";
|
|
36
|
+
import type { SessionRecord } from "@/lib/access/auth/session";
|
|
37
37
|
import {
|
|
38
38
|
canRelease,
|
|
39
39
|
carrierPolicyForTenant,
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* shape change.
|
|
20
20
|
*/
|
|
21
21
|
import { importPKCS8, exportJWK, type CryptoKey, type JWK, type JSONWebKeySet } from "jose";
|
|
22
|
-
import { readEnv } from "@/lib/env";
|
|
22
|
+
import { readEnv } from "@/lib/publication/shared/env";
|
|
23
23
|
|
|
24
24
|
/** The only algorithm the gateway signs with (verifiers reject anything else). */
|
|
25
25
|
export const APP_GATEWAY_ALG = "RS256";
|
|
@@ -17,7 +17,7 @@ import { AppRegistryService } from "./registryService.js";
|
|
|
17
17
|
import { D1CredentialStore } from "./credentials.js";
|
|
18
18
|
import { DEFAULT_APP_GATEWAY_KID, APP_GATEWAY_KID_ENV } from "./gatewayKeys.js";
|
|
19
19
|
import { fromD1 } from "../../catalog/d1/catalog.js";
|
|
20
|
-
import { readD1, readEnv } from "../../env.js";
|
|
20
|
+
import { readD1, readEnv } from "../../publication/shared/env.js";
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* No-store JSON response — install/rotate bodies carry a one-time client
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
type IntegrationSiteSurface,
|
|
20
20
|
type ObligationTenant,
|
|
21
21
|
} from "@tot/public-runtime";
|
|
22
|
-
import { isAdminPath } from "@/lib/auth/loginGate";
|
|
22
|
+
import { isAdminPath } from "@/lib/access/auth/loginGate";
|
|
23
23
|
import {
|
|
24
24
|
resolveIntegrationRenderState,
|
|
25
25
|
type IntegrationRenderState,
|
|
@@ -51,7 +51,7 @@ import { getDispatcher } from "./getDispatcher.js";
|
|
|
51
51
|
import { getRegistryService } from "../apps/registryAccess.js";
|
|
52
52
|
import type { AppInstall } from "../apps/registryService.js";
|
|
53
53
|
import { fromD1 } from "../../catalog/d1/catalog.js";
|
|
54
|
-
import { readD1 } from "../../env.js";
|
|
54
|
+
import { readD1 } from "../../publication/shared/env.js";
|
|
55
55
|
|
|
56
56
|
/** Contract-scoped payload schema version — `asyncapi.yaml`'s `dataschemaversion` is `const: "1"` for V1. */
|
|
57
57
|
const DATASCHEMA_VERSION = "1";
|
|
@@ -23,7 +23,7 @@ import { D1CredentialStore } from "../apps/credentials.js";
|
|
|
23
23
|
import { DEFAULT_APP_GATEWAY_KID, APP_GATEWAY_KID_ENV } from "../apps/gatewayKeys.js";
|
|
24
24
|
import { json } from "../apps/registryAccess.js";
|
|
25
25
|
import { fromD1, type Queryable } from "../../catalog/d1/catalog.js";
|
|
26
|
-
import { readD1, readEnv, readQueue } from "../../env.js";
|
|
26
|
+
import { readD1, readEnv, readQueue } from "../../publication/shared/env.js";
|
|
27
27
|
import { COMMERCE_SCHEDULER } from "@tot/public-runtime";
|
|
28
28
|
|
|
29
29
|
/** Binding name `getDispatcher()` checks to pick the Cloudflare Queues adapter. Not yet declared in `wrangler.toml`. */
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* in-memory `node:sqlite` in tests unchanged.
|
|
17
17
|
*/
|
|
18
18
|
import type { Queryable } from "../../catalog/d1/catalog.js";
|
|
19
|
-
import { readEnv } from "@/lib/env";
|
|
19
|
+
import { readEnv } from "@/lib/publication/shared/env";
|
|
20
20
|
import {
|
|
21
21
|
computeOrderConversion,
|
|
22
22
|
resolveConversionEnvironment,
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* stores use (`d1/catalog.ts`), so the insert code in `interactionStore.ts` is
|
|
22
22
|
* transport-agnostic and unit-testable against an in-memory sqlite.
|
|
23
23
|
*/
|
|
24
|
-
import { readEnv } from "../../env.js";
|
|
24
|
+
import { readEnv } from "../../publication/shared/env.js";
|
|
25
25
|
import type { Queryable, QueryStatement } from "../../catalog/d1/catalog.js";
|
|
26
26
|
|
|
27
27
|
const CF_API_BASE = "https://api.cloudflare.com/client/v4";
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
* violate either.
|
|
27
27
|
*/
|
|
28
28
|
import type { TotInteraction } from "@tot/public-runtime";
|
|
29
|
-
import { withClientApiBase } from "@/lib/basePath";
|
|
29
|
+
import { withClientApiBase } from "@/lib/publication/shared/basePath";
|
|
30
30
|
|
|
31
31
|
/** Where the browser beacon POSTs interaction batches. */
|
|
32
32
|
export const INTERACTION_BEACON_PATH = "/api/tracking/interaction";
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
* never fail because storage is unconfigured.
|
|
32
32
|
*/
|
|
33
33
|
import { sha256Hex } from "@tot/public-runtime";
|
|
34
|
-
import { readEnv } from "../../env.js";
|
|
34
|
+
import { readEnv } from "../../publication/shared/env.js";
|
|
35
35
|
import type { Queryable } from "../../catalog/d1/catalog.js";
|
|
36
36
|
import {
|
|
37
37
|
ensureDatabase,
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* `needs-external` / `needs-secret`.
|
|
11
11
|
*
|
|
12
12
|
* Signal sources are named against real code where it exists in this repo
|
|
13
|
-
* (`/health` → lib/health.ts, CSP → pages/api/csp-report.ts + CSP_REPORT_PATH,
|
|
13
|
+
* (`/health` → lib/observability/shared/health.ts, CSP → pages/api/csp-report.ts + CSP_REPORT_PATH,
|
|
14
14
|
* commerce events → lib/analytics). Signals owned by sibling units are referenced
|
|
15
15
|
* by CONTRACT NAME, not imported — Core Web Vitals come from the RUM beacon,
|
|
16
16
|
* and age-verification / restricted-state denials come from the compliance
|
|
@@ -99,7 +99,7 @@ export const MONITORS: readonly Monitor[] = [
|
|
|
99
99
|
title: "Storefront uptime / liveness",
|
|
100
100
|
category: "availability",
|
|
101
101
|
signal: {
|
|
102
|
-
source: "GET /health (lib/health.ts — answered before tenant/gate/cache)",
|
|
102
|
+
source: "GET /health (lib/observability/shared/health.ts — answered before tenant/gate/cache)",
|
|
103
103
|
observe: "external synthetic probe hits /health across regions; expects 200 {status:'ok'}",
|
|
104
104
|
},
|
|
105
105
|
threshold: "2 consecutive probe failures (or >1% of probes failing over 5m)",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$comment": "F14 performance budgets manifest — the checked-in, tool-neutral source of truth for the storefront go-live framework's perf gate. Consumed by (1) the lab budget-assertion harness (perf/assert-budgets.ts), (2) the Lighthouse budgets exporter (toLighthouseBudgets), and (3) the field RUM regression-alert contract (rumAlert.ts). Edit HERE — everything else derives from it. Shape + validation: src/lib/
|
|
2
|
+
"$comment": "F14 performance budgets manifest — the checked-in, tool-neutral source of truth for the storefront go-live framework's perf gate. Consumed by (1) the lab budget-assertion harness (perf/assert-budgets.ts), (2) the Lighthouse budgets exporter (toLighthouseBudgets), and (3) the field RUM regression-alert contract (rumAlert.ts). Edit HERE — everything else derives from it. Shape + validation: src/lib/observability/performance/perfBudgets.ts (parsePerfBudgets).",
|
|
3
3
|
"version": 1,
|
|
4
4
|
"webVitals": {
|
|
5
5
|
"$comment": "Core Web Vitals thresholds, evaluated at the 75th percentile (p75) of the field distribution — the same percentile Google's CrUX / the RUM alert contract use.",
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
isPurposeEligible,
|
|
35
35
|
parseConsentSnapshot,
|
|
36
36
|
} from "@tot/public-runtime";
|
|
37
|
-
import { withClientApiBase } from "@/lib/basePath";
|
|
37
|
+
import { withClientApiBase } from "@/lib/publication/shared/basePath";
|
|
38
38
|
|
|
39
39
|
/** The three field metrics we collect. INP is field-only (no lab equivalent). */
|
|
40
40
|
export type WebVitalName = "lcp" | "inp" | "cls";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { AdminTenantEnvelope } from "../../admin/envelope";
|
|
2
|
-
import { MOCK_ANCHOR_ISO, offsetIso, pick, randomBool, randomInt, seededRandom } from "../../admin/seed";
|
|
1
|
+
import type { AdminTenantEnvelope } from "../../access/admin/envelope";
|
|
2
|
+
import { MOCK_ANCHOR_ISO, offsetIso, pick, randomBool, randomInt, seededRandom } from "../../developer-experience/admin/seed";
|
|
3
3
|
import type {
|
|
4
4
|
OrderDetail,
|
|
5
5
|
OrderEvidenceEvent,
|
|
@@ -8,8 +8,8 @@ import type {
|
|
|
8
8
|
OrderRow,
|
|
9
9
|
OrdersViewModel,
|
|
10
10
|
} from "../admin/viewmodels/orders";
|
|
11
|
-
import { tenantProfile } from "../../
|
|
12
|
-
import { memoizeByEnvelope } from "../../admin/memoizeByEnvelope";
|
|
11
|
+
import { tenantProfile } from "../../access/fixtures/tenants";
|
|
12
|
+
import { memoizeByEnvelope } from "../../developer-experience/admin/memoizeByEnvelope";
|
|
13
13
|
|
|
14
14
|
// Must stay index-aligned with customers.ts's NAMES: an order's customerId is
|
|
15
15
|
// derived from the picked name's position here, and customers.ts assigns each
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
* `messagesClient.ts`, is a shared singleton that multiple callers (read
|
|
24
24
|
* routes, event receiver) each independently resolve.
|
|
25
25
|
*/
|
|
26
|
-
import { readEnv } from "@/lib/env";
|
|
26
|
+
import { readEnv } from "@/lib/publication/shared/env";
|
|
27
27
|
|
|
28
28
|
/** One order line item, as tot-foxycart's `buildOrderPayload()` returns it. */
|
|
29
29
|
export interface FoxyOrderLineItem {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Tenant base-path helpers.
|
|
3
3
|
*
|
|
4
4
|
* When a request selects its tenant via a `/<domain>/` path prefix (see
|
|
5
|
-
* lib/tenantRouting.ts), every same-origin link must carry that prefix or the
|
|
5
|
+
* lib/access/shared/tenantRouting.ts), every same-origin link must carry that prefix or the
|
|
6
6
|
* visitor falls out of the tenant. Host-routed requests have an empty base path
|
|
7
7
|
* and links are returned unchanged.
|
|
8
8
|
*
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* A tiny live-reload client is injected (by src/middleware) into `test`-env HTML
|
|
7
7
|
* pages ONLY — never `live`. It polls `GET /api/preview/version?tenant=<id>` (the
|
|
8
8
|
* per-tenant edge cache-version integer, which bumps on every reconcile/publish;
|
|
9
|
-
* see lib/edgeCache.ts + api/preview/reconcile.ts) and reloads the page when the
|
|
9
|
+
* see lib/publication/shared/edgeCache.ts + api/preview/reconcile.ts) and reloads the page when the
|
|
10
10
|
* version changes. Poll-based v1; an SSE / Durable-Object PUSH is the later
|
|
11
11
|
* upgrade (TODO below) that removes the ~1s poll latency.
|
|
12
12
|
*
|
|
@@ -22,7 +22,7 @@ let workerEnv: Record<string, unknown> | null | undefined;
|
|
|
22
22
|
export async function getWorkerEnv(): Promise<Record<string, unknown> | null> {
|
|
23
23
|
if (workerEnv !== undefined) return workerEnv;
|
|
24
24
|
try {
|
|
25
|
-
// Only resolvable in the Workers runtime; types in lib/cloudflare-workers.d.ts.
|
|
25
|
+
// Only resolvable in the Workers runtime; types in lib/developer-experience/types/cloudflare-workers.d.ts.
|
|
26
26
|
const mod = await import("cloudflare:workers");
|
|
27
27
|
workerEnv = (mod.env ?? null) as Record<string, unknown> | null;
|
|
28
28
|
} catch {
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* &opt.Size=M&tag=sale&priceMin=50&priceMax=200&q=wool
|
|
9
9
|
*/
|
|
10
10
|
import type { ListProductsQuery } from "@tot/public-runtime";
|
|
11
|
-
import type { PriceBucket } from "
|
|
11
|
+
import type { PriceBucket } from "../../catalog/shared/priceBuckets.js";
|
|
12
12
|
|
|
13
13
|
export function parseQuery(url: URL): ListProductsQuery {
|
|
14
14
|
const sp = url.searchParams;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { AdminTenantEnvelope } from "../../admin/envelope";
|
|
2
|
-
import { memoizeByEnvelope } from "../../admin/memoizeByEnvelope";
|
|
3
|
-
import { pick, randomInt, seededRandom } from "../../admin/seed";
|
|
1
|
+
import type { AdminTenantEnvelope } from "../../access/admin/envelope";
|
|
2
|
+
import { memoizeByEnvelope } from "../../developer-experience/admin/memoizeByEnvelope";
|
|
3
|
+
import { pick, randomInt, seededRandom } from "../../developer-experience/admin/seed";
|
|
4
4
|
import type { AnalysisBriefItem, ReportingCategory, ReportingSummary, ReportingViewModel } from "../admin/viewmodels/reporting";
|
|
5
5
|
|
|
6
6
|
const CATEGORY_DEFS: { category: ReportingCategory; label: string; drilldownHref: string }[] = [
|
|
@@ -7,14 +7,14 @@ import {
|
|
|
7
7
|
isSubscriptionFrequency,
|
|
8
8
|
purchaseOptionPrice,
|
|
9
9
|
} from "@tot/public-runtime";
|
|
10
|
-
import type { AdminTenantEnvelope } from "../../admin/envelope";
|
|
11
|
-
import { memoizeByEnvelope } from "../../admin/memoizeByEnvelope";
|
|
10
|
+
import type { AdminTenantEnvelope } from "../../access/admin/envelope";
|
|
11
|
+
import { memoizeByEnvelope } from "../../developer-experience/admin/memoizeByEnvelope";
|
|
12
12
|
import {
|
|
13
13
|
MOCK_ANCHOR_ISO,
|
|
14
14
|
offsetIso,
|
|
15
15
|
randomInt,
|
|
16
16
|
seededRandom,
|
|
17
|
-
} from "../../admin/seed";
|
|
17
|
+
} from "../../developer-experience/admin/seed";
|
|
18
18
|
import type { CustomerRow } from "../../customers/admin/viewmodels/customers";
|
|
19
19
|
import type { ProductDetail, ProductRow } from "../../catalog/admin/viewmodels/products";
|
|
20
20
|
import type {
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* `hasCandidatePin` means the same thing at both: a pin this tenant actually
|
|
9
9
|
* verified, never the mere presence of a query param a client can type.
|
|
10
10
|
*/
|
|
11
|
-
import { readEnv } from "@/lib/runtimeEnv";
|
|
11
|
+
import { readEnv } from "@/lib/publication/shared/runtimeEnv";
|
|
12
12
|
import { CANDIDATE_CONTENT_PIN_PARAM, verifyContentPinToken } from "@tot/public-runtime";
|
|
13
13
|
|
|
14
14
|
export interface CandidateContentPin {
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* then delegates to the shared render chain with those values supplied.
|
|
8
8
|
*/
|
|
9
9
|
import type { APIContext, MiddlewareNext } from "astro";
|
|
10
|
-
import { readEnv, readD1, readKv } from "@/lib/env";
|
|
10
|
+
import { readEnv, readD1, readKv } from "@/lib/publication/shared/env";
|
|
11
11
|
import { fromD1, type D1Like } from "@/lib/catalog/d1/catalog";
|
|
12
12
|
import { readCurrentTenantConsentConfig } from "@/lib/measurement/consent/consentConfigRead";
|
|
13
13
|
import { loadActiveManagedInstallDeclarations } from "@/lib/integrations/integration/managedInstallDeclarations";
|
|
@@ -30,14 +30,14 @@ import {
|
|
|
30
30
|
sessionAdmitsHost,
|
|
31
31
|
sessionHostCapability,
|
|
32
32
|
type GateMode,
|
|
33
|
-
} from "@/lib/auth/loginGate";
|
|
34
|
-
import { resolveAdminLanding, isAdminSelectPath } from "@/lib/auth/adminLanding";
|
|
35
|
-
import { resolveAdminTenantMode } from "@/lib/adminTenantEnvelope";
|
|
36
|
-
import { gatedApiResponse, gatedHoldingResponse } from "@/lib/auth/gatePage";
|
|
37
|
-
import { readSession, KvSessionStore, SESSION_COOKIE } from "@/lib/auth/session";
|
|
33
|
+
} from "@/lib/access/auth/loginGate";
|
|
34
|
+
import { resolveAdminLanding, isAdminSelectPath } from "@/lib/access/auth/adminLanding";
|
|
35
|
+
import { resolveAdminTenantMode } from "@/lib/access/shared/adminTenantEnvelope";
|
|
36
|
+
import { gatedApiResponse, gatedHoldingResponse } from "@/lib/access/auth/gatePage";
|
|
37
|
+
import { readSession, KvSessionStore, SESSION_COOKIE } from "@/lib/access/auth/session";
|
|
38
38
|
import { runRenderChain } from "./renderChain.js";
|
|
39
39
|
import { resolveCandidateContentPin } from "./candidatePin.js";
|
|
40
|
-
import type { InternalContentGrant } from "@/lib/auth/internalContentAuthority";
|
|
40
|
+
import type { InternalContentGrant } from "@/lib/access/auth/internalContentAuthority";
|
|
41
41
|
|
|
42
42
|
export interface ControlPlaneInput {
|
|
43
43
|
context: APIContext;
|
|
@@ -209,7 +209,7 @@ export async function serveControlPlane(input: ControlPlaneInput): Promise<Respo
|
|
|
209
209
|
// with no standing here (staff browsing without a selection) carries none —
|
|
210
210
|
// the session's standing on any other store never appears on this host.
|
|
211
211
|
// Authorization never reads this chrome: admission resolves standing from the
|
|
212
|
-
// session record for the routed tenant (lib/pipeline/admission-request).
|
|
212
|
+
// session record for the routed tenant (lib/publication/pipeline/admission-request).
|
|
213
213
|
//
|
|
214
214
|
// On an admin path, "the host" a staff viewer is really acting on is the
|
|
215
215
|
// ?asTenant= impersonation target (mirrors admin.astro/AdminPublishTab.astro's
|
|
@@ -22,20 +22,20 @@
|
|
|
22
22
|
import { defineMiddleware } from "astro:middleware";
|
|
23
23
|
import type { APIContext, MiddlewareNext } from "astro";
|
|
24
24
|
import { getTenantResolver } from "@/config/resolver";
|
|
25
|
-
import { readEnv, readKv, readR2 } from "@/lib/runtimeEnv";
|
|
26
|
-
import { resolveCdnForwardRouting, resolveTenantRouting } from "@/lib/tenantRouting";
|
|
27
|
-
import { crossSiteFormRefusal, verifyCdnForward } from "@/lib/cdnForward";
|
|
25
|
+
import { readEnv, readKv, readR2 } from "@/lib/publication/shared/runtimeEnv";
|
|
26
|
+
import { resolveCdnForwardRouting, resolveTenantRouting } from "@/lib/access/shared/tenantRouting";
|
|
27
|
+
import { crossSiteFormRefusal, verifyCdnForward } from "@/lib/publication/shared/cdnForward";
|
|
28
28
|
import { compileRouteTierIndexV1, resolvePublicationRoutePlanV1, type RouteTierIndexV1 , storefrontModeRequiresSignIn } from "@tot/public-runtime";
|
|
29
29
|
import type { PublicationArtifactBucketV1, TenantConfig } from "@tot/public-runtime";
|
|
30
|
-
import { DEV_DRAFT_COOKIE } from "@/lib/dev/devDraft";
|
|
31
|
-
import { applySecurityHeaders } from "@/lib/securityHeaders";
|
|
30
|
+
import { DEV_DRAFT_COOKIE } from "@/lib/developer-experience/dev/devDraft";
|
|
31
|
+
import { applySecurityHeaders } from "@/lib/access/shared/securityHeaders";
|
|
32
32
|
import { visitorRegionFor, withVisitorRegionCookie } from "@/lib/compliance/shared/visitorRegionCookie";
|
|
33
33
|
import { tryServeStaticBundle } from "./staticBundle.js";
|
|
34
34
|
import { resolveCandidateContentPin } from "./candidatePin.js";
|
|
35
|
-
import { parseGateMode } from "@/lib/auth/loginGate";
|
|
36
|
-
import { evaluateDemoGate, hostInGateList } from "@/lib/demoGate";
|
|
37
|
-
import { isMaintenanceOn, maintenanceResponse } from "@/lib/maintenance";
|
|
38
|
-
import { HEALTH_PATH, healthResponse } from "@/lib/health";
|
|
35
|
+
import { parseGateMode } from "@/lib/access/auth/loginGate";
|
|
36
|
+
import { evaluateDemoGate, hostInGateList } from "@/lib/access/shared/demoGate";
|
|
37
|
+
import { isMaintenanceOn, maintenanceResponse } from "@/lib/access/shared/maintenance";
|
|
38
|
+
import { HEALTH_PATH, healthResponse } from "@/lib/observability/shared/health";
|
|
39
39
|
import { observeDeployVersion } from "@/lib/activity/deployVersion";
|
|
40
40
|
import { primeActivityKillSwitch } from "@/lib/activity/killSwitch";
|
|
41
41
|
import {
|
|
@@ -46,13 +46,13 @@ import {
|
|
|
46
46
|
} from "./routeBranch.js";
|
|
47
47
|
import { servePublicRender } from "./publicRender.js";
|
|
48
48
|
import { serveControlPlane } from "./controlPlane.js";
|
|
49
|
-
import { KvSessionStore, SESSION_COOKIE } from "@/lib/auth/session";
|
|
50
|
-
import { mintOpaqueBrokerAssertion } from "@/lib/auth/brokerAssertion";
|
|
49
|
+
import { KvSessionStore, SESSION_COOKIE } from "@/lib/access/auth/session";
|
|
50
|
+
import { mintOpaqueBrokerAssertion } from "@/lib/access/auth/brokerAssertion";
|
|
51
51
|
import {
|
|
52
52
|
applyInternalContentResponsePolicy,
|
|
53
53
|
authorizeInternalContentRequest,
|
|
54
54
|
type InternalContentGrant,
|
|
55
|
-
} from "@/lib/auth/internalContentAuthority";
|
|
55
|
+
} from "@/lib/access/auth/internalContentAuthority";
|
|
56
56
|
|
|
57
57
|
/**
|
|
58
58
|
* Compiled once per tenant-config object, as the resolver's contract asks —
|
|
@@ -109,7 +109,7 @@ async function serveRequest(
|
|
|
109
109
|
// ---- /health — liveness + deploy-identity probe ---------------------------
|
|
110
110
|
// Answered FIRST: before tenant resolution, the access gate, the maintenance
|
|
111
111
|
// kill-switch, and the edge cache — so it reports the running build's commit SHA
|
|
112
|
-
// regardless of Host, an unresolved tenant, or a closed site. See lib/health.
|
|
112
|
+
// regardless of Host, an unresolved tenant, or a closed site. See lib/observability/shared/health.
|
|
113
113
|
if (url.pathname === HEALTH_PATH) {
|
|
114
114
|
return healthResponse();
|
|
115
115
|
}
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
* accident. That absence is the contract, and it is held structurally rather
|
|
8
8
|
* than by review: `public-render-no-request-time-d1` (.dependency-cruiser.cjs)
|
|
9
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
|
|
10
|
+
* `lib/publication/shared/env.ts`, the sole accessor for a live D1 handle. The public path reaches
|
|
11
|
+
* `lib/publication/shared/runtimeEnv.ts` instead — readEnv/readKv/readR2, the substrate that serves
|
|
12
12
|
* published bytes.
|
|
13
13
|
*
|
|
14
14
|
* Two companions cover what a forward graph walk from this module cannot see:
|
|
@@ -12,24 +12,24 @@ import type { APIContext, MiddlewareNext } from "astro";
|
|
|
12
12
|
import { referenceTheme } from "@/themes/reference";
|
|
13
13
|
import { mergeTheme, themeToCssVars } from "@/themes/schema";
|
|
14
14
|
import { createToTClient } from "@/lib/catalog/tot/ToTClient";
|
|
15
|
-
import { readEnv, readR2 } from "@/lib/runtimeEnv";
|
|
15
|
+
import { readEnv, readR2 } from "@/lib/publication/shared/runtimeEnv";
|
|
16
16
|
import { tryServeStaticBundle } from "./staticBundle.js";
|
|
17
17
|
import { isPlatformPublicDiscoveryPath } from "./routeBranch.js";
|
|
18
18
|
import { resolveCandidateContentPin, type CandidateContentPin } from "./candidatePin.js";
|
|
19
19
|
import { createContentProvider, DevDraftContentProvider } from "@/lib/content/storyblok/provider";
|
|
20
20
|
import { bindPublicationSpaceContentProviderV1 } from "@/lib/publication/contentProvider.js";
|
|
21
21
|
import { resolvePublicationRuntimeSourceV1 } from "@/lib/publication/runtimeSource.js";
|
|
22
|
-
import { DEV_DRAFT_COOKIE, devDraftKey, verifyDevDraftToken } from "@/lib/dev/devDraft";
|
|
22
|
+
import { DEV_DRAFT_COOKIE, devDraftKey, verifyDevDraftToken } from "@/lib/developer-experience/dev/devDraft";
|
|
23
23
|
import {
|
|
24
24
|
isCacheablePath,
|
|
25
25
|
pageCacheKey,
|
|
26
26
|
readCacheVersion,
|
|
27
27
|
getCachedPage,
|
|
28
28
|
putCachedPage,
|
|
29
|
-
} from "@/lib/edgeCache";
|
|
30
|
-
import { STATIC_SCRIPT_HASHES, STATIC_STYLE_HASHES } from "@/lib/cspStaticHashes";
|
|
31
|
-
import { applySecurityHeaders } from "@/lib/securityHeaders";
|
|
32
|
-
import { maybeInjectPreviewReload } from "@/lib/previewReload";
|
|
29
|
+
} from "@/lib/publication/shared/edgeCache";
|
|
30
|
+
import { STATIC_SCRIPT_HASHES, STATIC_STYLE_HASHES } from "@/lib/access/shared/cspStaticHashes";
|
|
31
|
+
import { applySecurityHeaders } from "@/lib/access/shared/securityHeaders";
|
|
32
|
+
import { maybeInjectPreviewReload } from "@/lib/publication/shared/previewReload";
|
|
33
33
|
import {
|
|
34
34
|
resolveCustomizationEnv,
|
|
35
35
|
buildCsp,
|
|
@@ -104,13 +104,13 @@ import {
|
|
|
104
104
|
} from "@/lib/integrations/integration/renderIntegrationState";
|
|
105
105
|
import { recordActivity } from "@/lib/activity/recordActivity";
|
|
106
106
|
import { middlewareRewriteTargetV1 } from "./routeBranch.js";
|
|
107
|
-
import { declaredTenantOrigins } from "@/lib/tenantOrigins";
|
|
107
|
+
import { declaredTenantOrigins } from "@/lib/access/shared/tenantOrigins";
|
|
108
108
|
import { withDeclaredTenantConfig } from "@/config/declaredTenantConfig";
|
|
109
109
|
import {
|
|
110
110
|
applyInternalContentResponsePolicy,
|
|
111
111
|
internalContentGrantMatchesPlan,
|
|
112
112
|
type InternalContentGrant,
|
|
113
|
-
} from "@/lib/auth/internalContentAuthority";
|
|
113
|
+
} from "@/lib/access/auth/internalContentAuthority";
|
|
114
114
|
|
|
115
115
|
export interface RenderChainInput {
|
|
116
116
|
context: APIContext;
|
|
@@ -178,7 +178,7 @@ export async function runRenderChain(input: RenderChainInput): Promise<Response>
|
|
|
178
178
|
|
|
179
179
|
// Candidate-render CONTENT PIN (`__tot_candidate_pin`): a signed, tenant- and
|
|
180
180
|
// expiry-bound token minted ONLY by the control-plane candidate/revision
|
|
181
|
-
// renderers (`src/lib/preview/pinnedRouteRender.ts`, never client-forgeable)
|
|
181
|
+
// renderers (`src/lib/publication/preview/pinnedRouteRender.ts`, never client-forgeable)
|
|
182
182
|
// that pins THIS one render's content resolution to an exact immutable
|
|
183
183
|
// `versionId`, bypassing the shared `{live,test}` channel entirely. It rides
|
|
184
184
|
// an in-process `context.rewrite()` from those renderers so a real Astro
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
* hashed names exist only inside a tenant's bundle, never in the Worker's own
|
|
8
8
|
* build output). It reads R2 and KV and never D1.
|
|
9
9
|
*/
|
|
10
|
-
import { readR2 } from "@/lib/runtimeEnv";
|
|
11
|
-
import { getCachedPage, putCachedPage, staticBundleCacheKey } from "@/lib/edgeCache";
|
|
10
|
+
import { readR2 } from "@/lib/publication/shared/runtimeEnv";
|
|
11
|
+
import { getCachedPage, putCachedPage, staticBundleCacheKey } from "@/lib/publication/shared/edgeCache";
|
|
12
12
|
import {
|
|
13
13
|
resolveChannelDigest,
|
|
14
14
|
serveStaticBundle,
|
|
@@ -13,7 +13,7 @@ export const prerender = false;
|
|
|
13
13
|
|
|
14
14
|
import Layout from "@/layouts/Layout.astro";
|
|
15
15
|
import CollectionCard from "@/components/catalog/storefront/CollectionCard.astro";
|
|
16
|
-
import { withBase } from "@/lib/basePath";
|
|
16
|
+
import { withBase } from "@/lib/publication/shared/basePath";
|
|
17
17
|
|
|
18
18
|
const { tenant, tot, basePath, features } = Astro.locals;
|
|
19
19
|
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
* origin check, so the server-to-server callers work.
|
|
29
29
|
*/
|
|
30
30
|
import type { APIContext } from "astro";
|
|
31
|
-
import { readD1, readEnv, readAnalytics, runAfterResponse, type CfExecutionContextLike } from "@/lib/env";
|
|
31
|
+
import { readD1, readEnv, readAnalytics, runAfterResponse, type CfExecutionContextLike } from "@/lib/publication/shared/env";
|
|
32
32
|
import { fromD1 } from "@/lib/catalog/d1/catalog";
|
|
33
33
|
import { verifyIngestAuth } from "@/lib/activity/ingestAuth";
|
|
34
34
|
import { ingestEvents, type IngestRejection } from "@/lib/activity/ingest";
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
* ops-timeline; never a URL/query value.
|
|
26
26
|
*/
|
|
27
27
|
import type { APIContext } from "astro";
|
|
28
|
-
import { requireAdminApiEntry } from "@/lib/auth/adminApiGuard";
|
|
29
|
-
import { readD1 } from "@/lib/env";
|
|
28
|
+
import { requireAdminApiEntry } from "@/lib/access/auth/adminApiGuard";
|
|
29
|
+
import { readD1 } from "@/lib/publication/shared/env";
|
|
30
30
|
import { fromD1 } from "@/lib/catalog/d1/catalog";
|
|
31
31
|
import { checkActivityAlerts } from "@/lib/activity/alerts";
|
|
32
32
|
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* surface has no ledger, so configured, absent, and unreadable stay unhealthy.
|
|
10
10
|
*/
|
|
11
11
|
import type { APIContext } from "astro";
|
|
12
|
-
import { requireAdminApiEntry } from "@/lib/auth/adminApiGuard";
|
|
12
|
+
import { requireAdminApiEntry } from "@/lib/access/auth/adminApiGuard";
|
|
13
13
|
import { workerCommit } from "@/lib/activity/workerCommit";
|
|
14
14
|
import {
|
|
15
15
|
COMMERCE_SCHEDULER,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Authenticated owner API for whole-order batch claim and batch read.
|
|
3
3
|
*/
|
|
4
4
|
import type { APIContext } from "astro";
|
|
5
|
-
import { requireAdminApiEntry } from "@/lib/auth/adminApiGuard";
|
|
5
|
+
import { requireAdminApiEntry } from "@/lib/access/auth/adminApiGuard";
|
|
6
6
|
import {
|
|
7
7
|
fulfillmentResultResponse,
|
|
8
8
|
isOpaqueId,
|