@yaks/platform 0.0.0-stage → 0.2.36
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/LICENSE +202 -0
- package/README.md +261 -2
- package/_client-blobs.js +7 -0
- package/_client-error.js +70 -0
- package/_client-modal.js +3 -0
- package/_client-replica.js +5 -0
- package/_client-review.js +1 -0
- package/_client-schema.js +1 -0
- package/_client-vault.js +31 -0
- package/_edit-query.js +1 -0
- package/_uploads.js +4 -0
- package/account-browser.js +67 -0
- package/account-browser.js.map +1 -0
- package/account-browser.ts +87 -0
- package/account-rows.js +130 -0
- package/account-rows.js.map +1 -0
- package/account-rows.ts +237 -0
- package/admin-visits-view.js +65 -0
- package/admin-visits-view.js.map +1 -0
- package/admin-visits-view.ts +120 -0
- package/admin-visits.js +143 -0
- package/admin-visits.js.map +1 -0
- package/admin-visits.ts +211 -0
- package/admit-graph.js +8 -0
- package/admit-graph.js.map +1 -0
- package/admit-graph.ts +10 -0
- package/agent-guide.js +368 -0
- package/agent-guide.js.map +1 -0
- package/agent-guide.ts +450 -0
- package/agents-browser.js +143 -0
- package/agents-browser.js.map +1 -0
- package/agents-browser.ts +141 -0
- package/agents-view.js +129 -0
- package/agents-view.js.map +1 -0
- package/agents-view.ts +236 -0
- package/agents.js +148 -0
- package/agents.js.map +1 -0
- package/agents.ts +150 -0
- package/app-actions.js +56 -0
- package/app-actions.js.map +1 -0
- package/app-actions.ts +61 -0
- package/app-authority.js +280 -0
- package/app-authority.js.map +1 -0
- package/app-authority.ts +356 -0
- package/app-canvas-browser.js +308 -0
- package/app-canvas-browser.js.map +1 -0
- package/app-canvas-browser.ts +377 -0
- package/app-canvas-view.js +244 -0
- package/app-canvas-view.js.map +1 -0
- package/app-canvas-view.ts +399 -0
- package/app-canvas.js +87 -0
- package/app-canvas.js.map +1 -0
- package/app-canvas.ts +170 -0
- package/app-client.js +521 -0
- package/app-client.js.map +1 -0
- package/app-client.ts +562 -0
- package/app-command.js +108 -0
- package/app-command.js.map +1 -0
- package/app-command.ts +155 -0
- package/app-commands.js +334 -0
- package/app-commands.js.map +1 -0
- package/app-commands.ts +379 -0
- package/app-decision.js +69 -0
- package/app-decision.js.map +1 -0
- package/app-decision.ts +61 -0
- package/app-effects.js +43 -0
- package/app-effects.js.map +1 -0
- package/app-effects.ts +53 -0
- package/app-file.js +252 -0
- package/app-file.js.map +1 -0
- package/app-file.ts +362 -0
- package/app-friends.js +60 -0
- package/app-friends.js.map +1 -0
- package/app-friends.ts +81 -0
- package/app-graph.js +9 -0
- package/app-graph.js.map +1 -0
- package/app-graph.ts +9 -0
- package/app-icon.js +59 -0
- package/app-icon.js.map +1 -0
- package/app-icon.ts +121 -0
- package/app-made.js +164 -0
- package/app-made.js.map +1 -0
- package/app-made.ts +306 -0
- package/app-outbound.js +72 -0
- package/app-outbound.js.map +1 -0
- package/app-outbound.ts +109 -0
- package/app-outbox.js +42 -0
- package/app-outbox.js.map +1 -0
- package/app-outbox.ts +46 -0
- package/app-patch.js +75 -0
- package/app-patch.js.map +1 -0
- package/app-patch.ts +106 -0
- package/app-read.js +101 -0
- package/app-read.js.map +1 -0
- package/app-read.ts +126 -0
- package/app-role-tools.js +232 -0
- package/app-role-tools.js.map +1 -0
- package/app-role-tools.ts +258 -0
- package/app-roles.js +91 -0
- package/app-roles.js.map +1 -0
- package/app-roles.ts +76 -0
- package/app-session-access.js +109 -0
- package/app-session-access.js.map +1 -0
- package/app-session-access.ts +145 -0
- package/app-starter.js +109 -0
- package/app-starter.js.map +1 -0
- package/app-starter.ts +123 -0
- package/app-storage.js +38 -0
- package/app-storage.js.map +1 -0
- package/app-storage.ts +54 -0
- package/app-style-guide.js +138 -0
- package/app-style-guide.js.map +1 -0
- package/app-style-guide.ts +195 -0
- package/app-subs.js +89 -0
- package/app-subs.js.map +1 -0
- package/app-subs.ts +110 -0
- package/app-tests.js +54 -0
- package/app-tests.js.map +1 -0
- package/app-tests.ts +56 -0
- package/app-tile.js +209 -0
- package/app-tile.js.map +1 -0
- package/app-tile.ts +227 -0
- package/app-transfer.js +188 -0
- package/app-transfer.js.map +1 -0
- package/app-transfer.ts +281 -0
- package/app-vocab.js +52 -0
- package/app-vocab.js.map +1 -0
- package/app-vocab.ts +43 -0
- package/app-words.js +55 -0
- package/app-words.js.map +1 -0
- package/app-words.ts +73 -0
- package/app-worker.js +28 -0
- package/app-worker.js.map +1 -0
- package/app-worker.ts +38 -0
- package/app-writes.js +132 -0
- package/app-writes.js.map +1 -0
- package/app-writes.ts +128 -0
- package/asset-bytes.js +57 -0
- package/asset-bytes.js.map +1 -0
- package/asset-bytes.ts +90 -0
- package/asset-response.js +28 -0
- package/asset-response.js.map +1 -0
- package/asset-response.ts +46 -0
- package/asset-url.js +556 -0
- package/asset-url.js.map +1 -0
- package/asset-url.ts +774 -0
- package/attribution-vocab.js +14 -0
- package/attribution-vocab.js.map +1 -0
- package/attribution-vocab.ts +11 -0
- package/authorship-graph.js +8 -0
- package/authorship-graph.js.map +1 -0
- package/authorship-graph.ts +10 -0
- package/badge.js +98 -0
- package/blob-images.js +206 -0
- package/blob-images.js.map +1 -0
- package/blob-images.ts +323 -0
- package/blob-posters.js +125 -0
- package/blob-posters.js.map +1 -0
- package/blob-posters.ts +207 -0
- package/blob-routes.js +14 -0
- package/blob-routes.js.map +1 -0
- package/blob-routes.ts +25 -0
- package/bots.js +77 -0
- package/bots.js.map +1 -0
- package/bots.ts +93 -0
- package/browser-mockup.js +81 -0
- package/browser-mockup.js.map +1 -0
- package/browser-mockup.ts +105 -0
- package/browser-record.js +55 -0
- package/browser-record.js.map +1 -0
- package/browser-record.ts +66 -0
- package/browser-scroll.js +90 -0
- package/browser-scroll.js.map +1 -0
- package/browser-scroll.ts +108 -0
- package/browser-stream.js +79 -0
- package/browser-stream.js.map +1 -0
- package/browser-stream.ts +84 -0
- package/browser-trace.js +252 -0
- package/browser-trace.js.map +1 -0
- package/browser-trace.ts +330 -0
- package/browser-viewer.js +236 -0
- package/browser-viewer.js.map +1 -0
- package/browser-viewer.ts +233 -0
- package/browser-visit.js +1522 -0
- package/browser-visit.js.map +1 -0
- package/browser-visit.ts +2179 -0
- package/browser-wire.js +242 -0
- package/browser-wire.js.map +1 -0
- package/browser-wire.ts +262 -0
- package/budget.js +17 -0
- package/budget.js.map +1 -0
- package/budget.ts +42 -0
- package/cli.js +52 -0
- package/cli.js.map +1 -0
- package/cli.ts +55 -0
- package/client-modules.js +24 -0
- package/client-modules.js.map +1 -0
- package/client-modules.ts +24 -0
- package/client-routes.js +83 -0
- package/client-routes.js.map +1 -0
- package/client-routes.ts +104 -0
- package/client-words.js +62 -0
- package/client-words.js.map +1 -0
- package/client-words.ts +77 -0
- package/client.js +709 -0
- package/comp.js +2 -0
- package/comp.js.map +1 -0
- package/comp.ts +15 -0
- package/config.js +497 -0
- package/config.js.map +1 -0
- package/config.ts +287 -0
- package/connect-parts.js +107 -0
- package/connect-parts.js.map +1 -0
- package/connect-parts.ts +165 -0
- package/connected-activity-browser.js +301 -0
- package/connected-activity-browser.js.map +1 -0
- package/connected-activity-browser.ts +341 -0
- package/connected-activity-view.js +55 -0
- package/connected-activity-view.js.map +1 -0
- package/connected-activity-view.ts +81 -0
- package/connected-activity-wire.js +165 -0
- package/connected-activity-wire.js.map +1 -0
- package/connected-activity-wire.ts +171 -0
- package/connected-activity.css +156 -0
- package/connected-activity.js +185 -0
- package/connected-activity.js.map +1 -0
- package/connected-activity.ts +278 -0
- package/connection-icon-browser.js +50 -0
- package/connection-icon-browser.js.map +1 -0
- package/connection-icon-browser.ts +52 -0
- package/connections-browser.js +393 -0
- package/connections-browser.js.map +1 -0
- package/connections-browser.ts +465 -0
- package/connections-page.js +178 -0
- package/connections-page.js.map +1 -0
- package/connections-page.ts +461 -0
- package/connections-view.js +1215 -0
- package/connections-view.js.map +1 -0
- package/connections-view.ts +2239 -0
- package/connector-upload.js +94 -0
- package/connector-upload.js.map +1 -0
- package/connector-upload.ts +146 -0
- package/consent.js +2 -0
- package/consent.js.map +1 -0
- package/consent.ts +3 -0
- package/cookie.js +53 -0
- package/cookie.js.map +1 -0
- package/cookie.ts +75 -0
- package/copy.js +104 -0
- package/corner.js +226 -0
- package/credential-draft-move.js +154 -0
- package/credential-draft-move.js.map +1 -0
- package/credential-draft-move.ts +197 -0
- package/credential-draft-place.js +2 -0
- package/credential-draft-place.js.map +1 -0
- package/credential-draft-place.ts +4 -0
- package/credential-drafts.js +66 -0
- package/credential-drafts.js.map +1 -0
- package/credential-drafts.ts +93 -0
- package/dashboard-browser.js +149 -0
- package/dashboard-browser.js.map +1 -0
- package/dashboard-browser.ts +184 -0
- package/dashboard-view.js +293 -0
- package/dashboard-view.js.map +1 -0
- package/dashboard-view.ts +423 -0
- package/dashboard.js +268 -0
- package/dashboard.js.map +1 -0
- package/dashboard.ts +436 -0
- package/deno.json +1 -0
- package/describe-graph.js +8 -0
- package/describe-graph.js.map +1 -0
- package/describe-graph.ts +7 -0
- package/directory-derived.js +142 -0
- package/directory-derived.js.map +1 -0
- package/directory-derived.ts +198 -0
- package/directory-index-move.js +77 -0
- package/directory-index-move.js.map +1 -0
- package/directory-index-move.ts +59 -0
- package/directory-index.js +382 -0
- package/directory-index.js.map +1 -0
- package/directory-index.ts +550 -0
- package/directory-pages.js +41 -0
- package/directory-pages.js.map +1 -0
- package/directory-pages.ts +71 -0
- package/directory-route.js +129 -0
- package/directory-route.js.map +1 -0
- package/directory-route.ts +189 -0
- package/directory-vocab.js +58 -0
- package/directory-vocab.js.map +1 -0
- package/directory-vocab.ts +46 -0
- package/document-graph.js +86 -0
- package/document-graph.js.map +1 -0
- package/document-graph.ts +93 -0
- package/document-ocr.js +146 -0
- package/document-ocr.js.map +1 -0
- package/document-ocr.ts +204 -0
- package/documents.js +50 -0
- package/documents.js.map +1 -0
- package/documents.ts +64 -0
- package/domain-pages.js +221 -0
- package/domain-pages.js.map +1 -0
- package/domain-pages.ts +586 -0
- package/domain-settings.js +88 -0
- package/domain-settings.js.map +1 -0
- package/domain-settings.ts +132 -0
- package/domain-transfer.js +138 -0
- package/domain-transfer.js.map +1 -0
- package/domain-transfer.ts +190 -0
- package/donation-loans.js +176 -0
- package/donation-loans.js.map +1 -0
- package/donation-loans.ts +271 -0
- package/draft-choice.js +136 -0
- package/draft-choice.js.map +1 -0
- package/draft-choice.ts +310 -0
- package/drawing.js +27 -0
- package/drawing.js.map +1 -0
- package/drawing.ts +40 -0
- package/early-report.js +18 -0
- package/early-report.js.map +1 -0
- package/early-report.ts +31 -0
- package/edit-client-path.js +2 -0
- package/edit-client-path.js.map +1 -0
- package/edit-client-path.ts +1 -0
- package/edit-mode.js +920 -0
- package/edit-mode.js.map +1 -0
- package/edit-mode.ts +1003 -0
- package/edit-sync.js +61 -0
- package/edit-sync.js.map +1 -0
- package/edit-sync.ts +83 -0
- package/edit.js +265 -0
- package/embed-graph.js +11 -0
- package/embed-graph.js.map +1 -0
- package/embed-graph.ts +8 -0
- package/embedded-payment.js +211 -0
- package/embedded-payment.js.map +1 -0
- package/embedded-payment.ts +290 -0
- package/entry-actions-browser.js +43 -0
- package/entry-actions-browser.js.map +1 -0
- package/entry-actions-browser.ts +64 -0
- package/entry-actions.js +56 -0
- package/entry-actions.js.map +1 -0
- package/entry-actions.ts +59 -0
- package/escape.js +14 -0
- package/escape.js.map +1 -0
- package/escape.ts +24 -0
- package/face-input.js +6 -0
- package/face-input.js.map +1 -0
- package/face-input.ts +14 -0
- package/facebook.js +370 -0
- package/facebook.js.map +1 -0
- package/facebook.ts +474 -0
- package/facets.js +142 -0
- package/facets.js.map +1 -0
- package/facets.ts +89 -0
- package/fee.js +45 -0
- package/fee.js.map +1 -0
- package/fee.ts +51 -0
- package/fence.js +164 -0
- package/fence.js.map +1 -0
- package/fence.ts +223 -0
- package/file-metadata.js +135 -0
- package/file-metadata.js.map +1 -0
- package/file-metadata.ts +177 -0
- package/file-operation.js +51 -0
- package/file-operation.js.map +1 -0
- package/file-operation.ts +32 -0
- package/file-redirects.js +72 -0
- package/file-redirects.js.map +1 -0
- package/file-redirects.ts +74 -0
- package/file-root.js +8 -0
- package/file-root.js.map +1 -0
- package/file-root.ts +24 -0
- package/files-routes.js +203 -0
- package/files-routes.js.map +1 -0
- package/files-routes.ts +282 -0
- package/files.js +369 -0
- package/files.js.map +1 -0
- package/files.ts +522 -0
- package/fingerprint.js +217 -0
- package/fingerprint.js.map +1 -0
- package/fingerprint.ts +314 -0
- package/firsts.js +335 -0
- package/firsts.js.map +1 -0
- package/firsts.ts +368 -0
- package/friends-at.js +78 -0
- package/friends-at.js.map +1 -0
- package/friends-at.ts +115 -0
- package/friends-browser.js +66 -0
- package/friends-browser.js.map +1 -0
- package/friends-browser.ts +77 -0
- package/friends-dock-browser.js +375 -0
- package/friends-dock-browser.js.map +1 -0
- package/friends-dock-browser.ts +408 -0
- package/friends-dock-view.js +363 -0
- package/friends-dock-view.js.map +1 -0
- package/friends-dock-view.ts +592 -0
- package/friends-view.js +33 -0
- package/friends-view.js.map +1 -0
- package/friends-view.ts +69 -0
- package/friends.js +153 -0
- package/friends.js.map +1 -0
- package/friends.ts +200 -0
- package/fundraising-orders.js +197 -0
- package/fundraising-orders.js.map +1 -0
- package/fundraising-orders.ts +283 -0
- package/fundraising.js +165 -0
- package/fundraising.js.map +1 -0
- package/fundraising.ts +215 -0
- package/funnel.js +141 -0
- package/funnel.js.map +1 -0
- package/funnel.ts +284 -0
- package/gift-savings.js +19 -0
- package/gift-savings.js.map +1 -0
- package/gift-savings.ts +29 -0
- package/git-history.js +331 -0
- package/git-history.js.map +1 -0
- package/git-history.ts +481 -0
- package/giving-browser.js +35 -0
- package/giving-browser.js.map +1 -0
- package/giving-browser.ts +40 -0
- package/giving-pages.js +284 -0
- package/giving-pages.js.map +1 -0
- package/giving-pages.ts +418 -0
- package/giving-view.js +244 -0
- package/giving-view.js.map +1 -0
- package/giving-view.ts +509 -0
- package/giving.js +198 -0
- package/giving.js.map +1 -0
- package/giving.ts +280 -0
- package/gmail-mailbox.js +52 -0
- package/gmail-mailbox.js.map +1 -0
- package/gmail-mailbox.ts +74 -0
- package/graves.js +136 -0
- package/graves.js.map +1 -0
- package/graves.ts +180 -0
- package/hashed.js +499 -0
- package/hashed.js.map +1 -0
- package/hashed.ts +676 -0
- package/home/assets.js +15 -0
- package/home/assets.js.map +1 -0
- package/home/assets.ts +16 -0
- package/home/brands/stripe.svg +12 -0
- package/home/brands/zoom.svg +34 -0
- package/home/demos.js +413 -0
- package/home/demos.js.map +1 -0
- package/home/demos.ts +431 -0
- package/home/games.js +112 -0
- package/home/games.js.map +1 -0
- package/home/games.ts +137 -0
- package/home/icons.js +41 -0
- package/home/icons.js.map +1 -0
- package/home/icons.ts +42 -0
- package/home/mascot/calculating.webp +0 -0
- package/home/mascot/flag.webp +0 -0
- package/home/mascot/letter.webp +0 -0
- package/home/mascot/plane.webp +0 -0
- package/home/mascot/plug.webp +0 -0
- package/home/mascot/thinking.webp +0 -0
- package/home/mascot/typing.webp +0 -0
- package/home/mascot/wave.webp +0 -0
- package/home/mod.tsx +517 -0
- package/home/parts.js +149 -0
- package/home/parts.js.map +1 -0
- package/home/parts.ts +45 -0
- package/home/phone.tsx +152 -0
- package/home/scenes.tsx +212 -0
- package/home/sky.js +930 -0
- package/home/sky.tsx +479 -0
- package/home/story.js +392 -0
- package/home/style.css +1304 -0
- package/home/words.js +2 -0
- package/home/words.js.map +1 -0
- package/home/words.ts +8 -0
- package/home/yak.js +146 -0
- package/home/yak_test.tsx +111 -0
- package/home-router.js +30 -0
- package/home-router.js.map +1 -0
- package/home-router.ts +41 -0
- package/host.js +58 -0
- package/host.js.map +1 -0
- package/host.ts +97 -0
- package/hosted-page.js +126 -0
- package/hosted-page.js.map +1 -0
- package/hosted-page.ts +295 -0
- package/install-browser.js +89 -0
- package/install-browser.js.map +1 -0
- package/install-browser.ts +99 -0
- package/install-icons.js +271 -0
- package/install-icons.js.map +1 -0
- package/install-icons.ts +366 -0
- package/installs.js +197 -0
- package/installs.js.map +1 -0
- package/installs.ts +270 -0
- package/instrument.js +50 -0
- package/instrument.js.map +1 -0
- package/instrument.ts +55 -0
- package/integration-icons.js +138 -0
- package/integration-icons.js.map +1 -0
- package/integration-icons.ts +198 -0
- package/interaction-browser.js +95 -0
- package/interaction-browser.js.map +1 -0
- package/interaction-browser.ts +107 -0
- package/interaction-report.js +399 -0
- package/interaction-report.js.map +1 -0
- package/interaction-report.ts +450 -0
- package/interaction.js +273 -0
- package/interaction.js.map +1 -0
- package/interaction.ts +290 -0
- package/invite-browser.js +98 -0
- package/invite-browser.js.map +1 -0
- package/invite-browser.ts +123 -0
- package/invite-view.js +100 -0
- package/invite-view.js.map +1 -0
- package/invite-view.ts +137 -0
- package/kept.js +520 -0
- package/kept.js.map +1 -0
- package/kept.ts +821 -0
- package/kills-graph.js +18 -0
- package/kills-graph.js.map +1 -0
- package/kills-graph.ts +16 -0
- package/ladder.js +418 -0
- package/ladder.js.map +1 -0
- package/ladder.ts +510 -0
- package/lenses-graph.js +24 -0
- package/lenses-graph.js.map +1 -0
- package/lenses-graph.ts +27 -0
- package/lenses.js +197 -0
- package/lenses.js.map +1 -0
- package/lenses.ts +204 -0
- package/lent.js +32 -0
- package/lent.js.map +1 -0
- package/lent.ts +95 -0
- package/letters.js +134 -0
- package/letters.js.map +1 -0
- package/letters.ts +251 -0
- package/lexicon-graph.js +11 -0
- package/lexicon-graph.js.map +1 -0
- package/lexicon-graph.ts +7 -0
- package/link-preview.js +111 -0
- package/link-preview.js.map +1 -0
- package/link-preview.ts +136 -0
- package/listing.js +262 -0
- package/listing.js.map +1 -0
- package/listing.ts +330 -0
- package/local-time.js +32 -0
- package/local-time.js.map +1 -0
- package/local-time.ts +41 -0
- package/located.js +380 -0
- package/located.js.map +1 -0
- package/located.ts +471 -0
- package/log-graph.js +7 -0
- package/log-graph.js.map +1 -0
- package/log-graph.ts +9 -0
- package/lower-graph.js +7 -0
- package/lower-graph.js.map +1 -0
- package/lower-graph.ts +9 -0
- package/mail-request.js +32 -0
- package/mail-request.js.map +1 -0
- package/mail-request.ts +29 -0
- package/mail-senders.js +40 -0
- package/mail-senders.js.map +1 -0
- package/mail-senders.ts +47 -0
- package/managed-browser-pilot.js +151 -0
- package/managed-browser-pilot.js.map +1 -0
- package/managed-browser-pilot.ts +230 -0
- package/managed-browser-sites.js +43 -0
- package/managed-browser-sites.js.map +1 -0
- package/managed-browser-sites.ts +41 -0
- package/managed-browser-wire.js +142 -0
- package/managed-browser-wire.js.map +1 -0
- package/managed-browser-wire.ts +140 -0
- package/managed-browser.js +529 -0
- package/managed-browser.js.map +1 -0
- package/managed-browser.ts +740 -0
- package/manifest.js +425 -0
- package/manifest.js.map +1 -0
- package/manifest.ts +468 -0
- package/metadata-effect.js +61 -0
- package/metadata-effect.js.map +1 -0
- package/metadata-effect.ts +59 -0
- package/meter-graph.js +205 -0
- package/meter-graph.js.map +1 -0
- package/meter-graph.ts +238 -0
- package/meter-vocab.js +8 -0
- package/meter-vocab.js.map +1 -0
- package/meter-vocab.ts +4 -0
- package/meter.js +402 -0
- package/meter.js.map +1 -0
- package/meter.ts +697 -0
- package/mod.js +14 -0
- package/mod.js.map +1 -0
- package/mod.ts +16 -0
- package/models-vocab.js +25 -0
- package/models-vocab.js.map +1 -0
- package/models-vocab.ts +15 -0
- package/monogram.js +32 -0
- package/monogram.js.map +1 -0
- package/monogram.ts +46 -0
- package/mover.js +6 -0
- package/mover.js.map +1 -0
- package/mover.ts +45 -0
- package/named.js +136 -0
- package/named.js.map +1 -0
- package/named.ts +169 -0
- package/names.js +196 -0
- package/names.js.map +1 -0
- package/names.ts +252 -0
- package/notices-vocab.js +20 -0
- package/notices-vocab.js.map +1 -0
- package/notices-vocab.ts +28 -0
- package/numbers.js +85 -0
- package/numbers.js.map +1 -0
- package/numbers.ts +97 -0
- package/object-hosts.js +137 -0
- package/object-hosts.js.map +1 -0
- package/object-hosts.ts +153 -0
- package/open-script.js +235 -0
- package/open-script.js.map +1 -0
- package/open-script.ts +253 -0
- package/opening.js +31 -0
- package/opening.js.map +1 -0
- package/opening.ts +28 -0
- package/operator-activity-view.js +82 -0
- package/operator-activity-view.js.map +1 -0
- package/operator-activity-view.ts +85 -0
- package/operator-activity.js +220 -0
- package/operator-activity.js.map +1 -0
- package/operator-activity.ts +293 -0
- package/operator-brief.js +36 -0
- package/operator-brief.js.map +1 -0
- package/operator-brief.ts +76 -0
- package/operator-copy-browser.js +67 -0
- package/operator-copy-browser.js.map +1 -0
- package/operator-copy-browser.ts +71 -0
- package/operator-corner.js +266 -0
- package/operator-corner.js.map +1 -0
- package/operator-corner.ts +300 -0
- package/operator-decisions.js +19 -0
- package/operator-decisions.js.map +1 -0
- package/operator-decisions.ts +18 -0
- package/operator-docs.js +152 -0
- package/operator-docs.js.map +1 -0
- package/operator-docs.ts +196 -0
- package/operator-door.js +10 -0
- package/operator-door.js.map +1 -0
- package/operator-door.ts +14 -0
- package/operator-drafts-browser.js +28 -0
- package/operator-drafts-browser.js.map +1 -0
- package/operator-drafts-browser.ts +32 -0
- package/operator-drafts.js +60 -0
- package/operator-drafts.js.map +1 -0
- package/operator-drafts.ts +80 -0
- package/operator-early-draft.js +110 -0
- package/operator-early-draft.js.map +1 -0
- package/operator-early-draft.ts +125 -0
- package/operator-go-browser.js +130 -0
- package/operator-go-browser.js.map +1 -0
- package/operator-go-browser.ts +182 -0
- package/operator-go-step.js +86 -0
- package/operator-go-step.js.map +1 -0
- package/operator-go-step.ts +92 -0
- package/operator-go-tool.js +49 -0
- package/operator-go-tool.js.map +1 -0
- package/operator-go-tool.ts +31 -0
- package/operator-go.js +68 -0
- package/operator-go.js.map +1 -0
- package/operator-go.ts +100 -0
- package/operator-graph.js +46 -0
- package/operator-graph.js.map +1 -0
- package/operator-graph.ts +60 -0
- package/operator-handoff.js +91 -0
- package/operator-handoff.js.map +1 -0
- package/operator-handoff.ts +104 -0
- package/operator-machine.js +136 -0
- package/operator-machine.js.map +1 -0
- package/operator-machine.ts +168 -0
- package/operator-matches-browser.js +155 -0
- package/operator-matches-browser.js.map +1 -0
- package/operator-matches-browser.ts +178 -0
- package/operator-matches-view.js +147 -0
- package/operator-matches-view.js.map +1 -0
- package/operator-matches-view.ts +224 -0
- package/operator-matches.js +65 -0
- package/operator-matches.js.map +1 -0
- package/operator-matches.ts +120 -0
- package/operator-memory.js +119 -0
- package/operator-memory.js.map +1 -0
- package/operator-memory.ts +122 -0
- package/operator-mic.ts +40 -0
- package/operator-model.js +144 -0
- package/operator-model.js.map +1 -0
- package/operator-model.ts +154 -0
- package/operator-notes.js +32 -0
- package/operator-notes.js.map +1 -0
- package/operator-notes.ts +40 -0
- package/operator-opening-browser.js +184 -0
- package/operator-opening-browser.js.map +1 -0
- package/operator-opening-browser.ts +195 -0
- package/operator-owner.js +391 -0
- package/operator-owner.js.map +1 -0
- package/operator-owner.ts +392 -0
- package/operator-page-context.js +121 -0
- package/operator-page-context.js.map +1 -0
- package/operator-page-context.ts +143 -0
- package/operator-page-image.js +38 -0
- package/operator-page-image.js.map +1 -0
- package/operator-page-image.ts +42 -0
- package/operator-panel-browser.js +601 -0
- package/operator-panel-browser.js.map +1 -0
- package/operator-panel-browser.ts +669 -0
- package/operator-panel-view.js +69 -0
- package/operator-panel-view.js.map +1 -0
- package/operator-panel-view.ts +100 -0
- package/operator-panel.js +131 -0
- package/operator-panel.js.map +1 -0
- package/operator-panel.ts +155 -0
- package/operator-push.tsx +112 -0
- package/operator-record.js +55 -0
- package/operator-record.js.map +1 -0
- package/operator-record.ts +92 -0
- package/operator-replies.js +240 -0
- package/operator-replies.js.map +1 -0
- package/operator-replies.ts +281 -0
- package/operator-reply-view.js +117 -0
- package/operator-reply-view.js.map +1 -0
- package/operator-reply-view.ts +185 -0
- package/operator-safety.js +30 -0
- package/operator-safety.js.map +1 -0
- package/operator-safety.ts +53 -0
- package/operator-settings-browser.js +257 -0
- package/operator-settings-browser.js.map +1 -0
- package/operator-settings-browser.ts +290 -0
- package/operator-settings-view.js +291 -0
- package/operator-settings-view.js.map +1 -0
- package/operator-settings-view.ts +588 -0
- package/operator-settings.js +79 -0
- package/operator-settings.js.map +1 -0
- package/operator-settings.ts +137 -0
- package/operator-source.js +43 -0
- package/operator-source.js.map +1 -0
- package/operator-source.ts +69 -0
- package/operator-talk-browser.js +94 -0
- package/operator-talk-browser.js.map +1 -0
- package/operator-talk-browser.ts +120 -0
- package/operator-talk.js +83 -0
- package/operator-talk.js.map +1 -0
- package/operator-talk.ts +127 -0
- package/operator-task-text.js +45 -0
- package/operator-task-text.js.map +1 -0
- package/operator-task-text.ts +49 -0
- package/operator-timing-browser.js +51 -0
- package/operator-timing-browser.js.map +1 -0
- package/operator-timing-browser.ts +68 -0
- package/operator-timing-view.js +48 -0
- package/operator-timing-view.js.map +1 -0
- package/operator-timing-view.ts +90 -0
- package/operator-timing.js +132 -0
- package/operator-timing.js.map +1 -0
- package/operator-timing.ts +170 -0
- package/operator-vocab.js +8 -0
- package/operator-vocab.js.map +1 -0
- package/operator-vocab.ts +7 -0
- package/operator-voice-audio.ts +84 -0
- package/operator-voice-browser.ts +237 -0
- package/operator-voice-feedback.js +108 -0
- package/operator-voice-feedback.js.map +1 -0
- package/operator-voice-feedback.ts +133 -0
- package/operator-voice-view.js +33 -0
- package/operator-voice-view.js.map +1 -0
- package/operator-voice-view.ts +43 -0
- package/operator-voice.css +38 -0
- package/operator-voice.js +35 -0
- package/operator-voice.js.map +1 -0
- package/operator-voice.ts +33 -0
- package/operator-wait.js +70 -0
- package/operator-wait.js.map +1 -0
- package/operator-wait.ts +79 -0
- package/operator-watches.js +126 -0
- package/operator-watches.js.map +1 -0
- package/operator-watches.ts +141 -0
- package/operator-words.js +94 -0
- package/operator-words.js.map +1 -0
- package/operator-words.ts +114 -0
- package/outreach-trial.js +103 -0
- package/outreach-trial.js.map +1 -0
- package/outreach-trial.ts +122 -0
- package/outreach-vocab.js +10 -0
- package/outreach-vocab.js.map +1 -0
- package/outreach-vocab.ts +7 -0
- package/outreach.js +162 -0
- package/outreach.js.map +1 -0
- package/outreach.ts +239 -0
- package/package.json +1131 -4
- package/packs.js +103 -0
- package/packs.js.map +1 -0
- package/packs.ts +119 -0
- package/page-copy.js +267 -0
- package/page-copy.js.map +1 -0
- package/page-copy.ts +362 -0
- package/page-graph.js +114 -0
- package/page-graph.js.map +1 -0
- package/page-graph.ts +151 -0
- package/page-links.js +78 -0
- package/page-links.js.map +1 -0
- package/page-links.ts +124 -0
- package/page-parts.js +236 -0
- package/page-parts.js.map +1 -0
- package/page-parts.ts +388 -0
- package/page-query.js +95 -0
- package/page-query.js.map +1 -0
- package/page-query.ts +120 -0
- package/page-script.js +183 -0
- package/page-script.js.map +1 -0
- package/page-script.ts +192 -0
- package/page-wire.js +93 -0
- package/page-wire.js.map +1 -0
- package/page-wire.ts +100 -0
- package/pages-vocab.js +9 -0
- package/pages-vocab.js.map +1 -0
- package/pages-vocab.ts +5 -0
- package/partials.js +21 -0
- package/partials.js.map +1 -0
- package/partials.ts +37 -0
- package/payment-browser.js +250 -0
- package/payment-browser.js.map +1 -0
- package/payment-browser.ts +298 -0
- package/payment-rows.js +117 -0
- package/payment-rows.js.map +1 -0
- package/payment-rows.ts +219 -0
- package/payment-view.js +397 -0
- package/payment-view.js.map +1 -0
- package/payment-view.ts +852 -0
- package/people-browser.js +186 -0
- package/people-browser.js.map +1 -0
- package/people-browser.ts +210 -0
- package/people-rows.js +192 -0
- package/people-rows.js.map +1 -0
- package/people-rows.ts +289 -0
- package/people-view.js +463 -0
- package/people-view.js.map +1 -0
- package/people-view.ts +804 -0
- package/person-lines.js +196 -0
- package/person-lines.js.map +1 -0
- package/person-lines.ts +256 -0
- package/place.js +30 -0
- package/place.js.map +1 -0
- package/place.ts +31 -0
- package/plan-details.js +39 -0
- package/plan-details.js.map +1 -0
- package/plan-details.ts +57 -0
- package/plan-trial-graph.js +63 -0
- package/plan-trial-graph.js.map +1 -0
- package/plan-trial-graph.ts +57 -0
- package/plans.js +223 -0
- package/plans.js.map +1 -0
- package/plans.ts +313 -0
- package/platform-credentials.js +136 -0
- package/platform-credentials.js.map +1 -0
- package/platform-credentials.ts +189 -0
- package/poster-backfill.js +72 -0
- package/poster-backfill.js.map +1 -0
- package/poster-backfill.ts +96 -0
- package/presence.js +57 -0
- package/presence.js.map +1 -0
- package/presence.ts +77 -0
- package/preview-audit.js +65 -0
- package/preview-audit.js.map +1 -0
- package/preview-audit.ts +126 -0
- package/preview-fit.js +62 -0
- package/preview-fit.js.map +1 -0
- package/preview-fit.ts +72 -0
- package/preview-html.js +96 -0
- package/preview-html.js.map +1 -0
- package/preview-html.ts +139 -0
- package/preview.js +317 -0
- package/preview.js.map +1 -0
- package/preview.ts +498 -0
- package/price.js +53 -0
- package/price.js.map +1 -0
- package/price.ts +85 -0
- package/profile-browser.js +117 -0
- package/profile-browser.js.map +1 -0
- package/profile-browser.ts +141 -0
- package/profile-view.js +96 -0
- package/profile-view.js.map +1 -0
- package/profile-view.ts +197 -0
- package/provider-credits.js +159 -0
- package/provider-credits.js.map +1 -0
- package/provider-credits.ts +174 -0
- package/public-site-choice.js +18 -0
- package/public-site-choice.js.map +1 -0
- package/public-site-choice.ts +21 -0
- package/public-site.js +151 -0
- package/public-site.js.map +1 -0
- package/public-site.ts +268 -0
- package/publishing-graph.js +136 -0
- package/publishing-graph.js.map +1 -0
- package/publishing-graph.ts +122 -0
- package/qr.js +32 -0
- package/qr.js.map +1 -0
- package/qr.ts +32 -0
- package/query-page.js +159 -0
- package/query-page.js.map +1 -0
- package/query-page.ts +249 -0
- package/query-refusal.js +174 -0
- package/query-refusal.js.map +1 -0
- package/query-refusal.ts +319 -0
- package/refusal-loop.js +71 -0
- package/refusal-loop.js.map +1 -0
- package/refusal-loop.ts +98 -0
- package/refusals-vocab.js +9 -0
- package/refusals-vocab.js.map +1 -0
- package/refusals-vocab.ts +5 -0
- package/refused-writes.js +119 -0
- package/refused-writes.js.map +1 -0
- package/refused-writes.ts +152 -0
- package/refused.js +67 -0
- package/refused.js.map +1 -0
- package/refused.ts +76 -0
- package/regional-route-storage.js +127 -0
- package/regional-route-storage.js.map +1 -0
- package/regional-route-storage.ts +94 -0
- package/regional-route.js +105 -0
- package/regional-route.js.map +1 -0
- package/regional-route.ts +158 -0
- package/regional-serving-copy.js +153 -0
- package/regional-serving-copy.js.map +1 -0
- package/regional-serving-copy.ts +200 -0
- package/release-asset.js +71 -0
- package/release-asset.js.map +1 -0
- package/release-asset.ts +121 -0
- package/release-browser.js +383 -0
- package/release-code.js +5 -0
- package/release-entry.js +3 -0
- package/release-file.js +169 -0
- package/release-file.js.map +1 -0
- package/release-file.ts +241 -0
- package/release-index.js +140 -0
- package/release-index.js.map +1 -0
- package/release-index.ts +161 -0
- package/release-page.js +227 -0
- package/release-reads.js +27 -0
- package/release-reads.js.map +1 -0
- package/release-reads.ts +56 -0
- package/release-sheets.js +76 -0
- package/release-state.js +181 -0
- package/release-update.js +22 -0
- package/release-update.js.map +1 -0
- package/release-update.ts +29 -0
- package/release.js +50 -0
- package/release.js.map +1 -0
- package/release.ts +72 -0
- package/released.js +263 -0
- package/released.js.map +1 -0
- package/released.ts +310 -0
- package/remake-graph.js +17 -0
- package/remake-graph.js.map +1 -0
- package/remake-graph.ts +15 -0
- package/rouse-graph.js +11 -0
- package/rouse-graph.js.map +1 -0
- package/rouse-graph.ts +8 -0
- package/route-memory.js +101 -0
- package/route-memory.js.map +1 -0
- package/route-memory.ts +132 -0
- package/routes.js +1143 -0
- package/routes.js.map +1 -0
- package/routes.ts +1502 -0
- package/sale-recovery.js +175 -0
- package/sale-recovery.js.map +1 -0
- package/sale-recovery.ts +156 -0
- package/sales.js +113 -0
- package/sales.js.map +1 -0
- package/sales.ts +150 -0
- package/schema.js +28 -0
- package/schema.js.map +1 -0
- package/schema.ts +13 -0
- package/serving-copy.js +161 -0
- package/serving-copy.js.map +1 -0
- package/serving-copy.ts +201 -0
- package/settings-drafts-browser.js +81 -0
- package/settings-drafts-browser.js.map +1 -0
- package/settings-drafts-browser.ts +95 -0
- package/settings-drafts.js +119 -0
- package/settings-drafts.js.map +1 -0
- package/settings-drafts.ts +136 -0
- package/shared-browser.js +61 -0
- package/shared-browser.js.map +1 -0
- package/shared-browser.ts +77 -0
- package/shared-view.js +29 -0
- package/shared-view.js.map +1 -0
- package/shared-view.ts +47 -0
- package/side-browser.js +164 -0
- package/side-browser.js.map +1 -0
- package/side-browser.ts +201 -0
- package/side-parts.js +258 -0
- package/side-parts.js.map +1 -0
- package/side-parts.ts +447 -0
- package/side-rows.js +64 -0
- package/side-rows.js.map +1 -0
- package/side-rows.ts +104 -0
- package/signed-in.js +37 -0
- package/signed-in.js.map +1 -0
- package/signed-in.ts +45 -0
- package/site-assets.js +8 -0
- package/site-assets.js.map +1 -0
- package/site-assets.ts +25 -0
- package/site-header.js +65 -0
- package/site-header.js.map +1 -0
- package/site-header.ts +71 -0
- package/site-nav.js +75 -0
- package/site-nav.js.map +1 -0
- package/site-nav.ts +82 -0
- package/site-validation.js +37 -0
- package/site-validation.js.map +1 -0
- package/site-validation.ts +47 -0
- package/space-apps-browser.js +107 -0
- package/space-apps-browser.js.map +1 -0
- package/space-apps-browser.ts +128 -0
- package/space-apps-view.js +222 -0
- package/space-apps-view.js.map +1 -0
- package/space-apps-view.ts +396 -0
- package/space-apps.js +88 -0
- package/space-apps.js.map +1 -0
- package/space-apps.ts +143 -0
- package/space-logo.js +82 -0
- package/space-logo.js.map +1 -0
- package/space-logo.ts +112 -0
- package/space-pages-browser.js +474 -0
- package/space-pages-browser.js.map +1 -0
- package/space-pages-browser.ts +463 -0
- package/space-pages-view.js +212 -0
- package/space-pages-view.js.map +1 -0
- package/space-pages-view.ts +460 -0
- package/space-pages.js +193 -0
- package/space-pages.js.map +1 -0
- package/space-pages.ts +282 -0
- package/space-switch.js +36 -0
- package/space-switch.js.map +1 -0
- package/space-switch.ts +64 -0
- package/splash.js +510 -0
- package/splash.js.map +1 -0
- package/splash.ts +525 -0
- package/standing.js +409 -0
- package/standing.js.map +1 -0
- package/standing.ts +746 -0
- package/still.js +63 -0
- package/still.js.map +1 -0
- package/still.ts +95 -0
- package/store-listing.js +107 -0
- package/store-listing.js.map +1 -0
- package/store-listing.ts +133 -0
- package/store-wake.js +65 -0
- package/store-wake.js.map +1 -0
- package/store-wake.ts +101 -0
- package/stream-posters.js +177 -0
- package/stream-posters.js.map +1 -0
- package/stream-posters.ts +297 -0
- package/support-contract-service.js +219 -0
- package/support-contract-service.js.map +1 -0
- package/support-contract-service.ts +307 -0
- package/support-contract-view.js +155 -0
- package/support-contract-view.js.map +1 -0
- package/support-contract-view.ts +265 -0
- package/support-contract.js +114 -0
- package/support-contract.js.map +1 -0
- package/support-contract.ts +157 -0
- package/sweep-vocab.js +10 -0
- package/sweep-vocab.js.map +1 -0
- package/sweep-vocab.ts +9 -0
- package/talk-views-browser.js +208 -0
- package/talk-views-browser.js.map +1 -0
- package/talk-views-browser.ts +232 -0
- package/talk-views.js +36 -0
- package/talk-views.js.map +1 -0
- package/talk-views.ts +64 -0
- package/task-rows.js +86 -0
- package/task-rows.js.map +1 -0
- package/task-rows.ts +96 -0
- package/tasks-view.js +111 -0
- package/tasks-view.js.map +1 -0
- package/tasks-view.ts +176 -0
- package/toast.ts +17 -0
- package/trash-graph.js +41 -0
- package/trash-graph.js.map +1 -0
- package/trash-graph.ts +27 -0
- package/trash-vocab.js +8 -0
- package/trash-vocab.js.map +1 -0
- package/trash-vocab.ts +4 -0
- package/trial.js +325 -0
- package/trial.js.map +1 -0
- package/trial.ts +451 -0
- package/update-rows.js +77 -0
- package/update-rows.js.map +1 -0
- package/update-rows.ts +171 -0
- package/update-waiting.js +131 -0
- package/update-waiting.js.map +1 -0
- package/update-waiting.ts +133 -0
- package/updates-browser.js +28 -0
- package/updates-browser.js.map +1 -0
- package/updates-browser.ts +33 -0
- package/updates-day-browser.js +77 -0
- package/updates-day-browser.js.map +1 -0
- package/updates-day-browser.ts +84 -0
- package/updates-day.js +60 -0
- package/updates-day.js.map +1 -0
- package/updates-day.ts +94 -0
- package/updates-list-browser.js +175 -0
- package/updates-list-browser.js.map +1 -0
- package/updates-list-browser.ts +198 -0
- package/updates-view.js +546 -0
- package/updates-view.js.map +1 -0
- package/updates-view.ts +814 -0
- package/upload-client-path.js +5 -0
- package/upload-client-path.js.map +1 -0
- package/upload-client-path.ts +4 -0
- package/uploads.js +290 -0
- package/uploads.js.map +1 -0
- package/uploads.ts +334 -0
- package/upstream.js +40 -0
- package/upstream.js.map +1 -0
- package/upstream.ts +57 -0
- package/version-view.js +57 -0
- package/version-view.js.map +1 -0
- package/version-view.ts +99 -0
- package/versions.js +231 -0
- package/versions.js.map +1 -0
- package/versions.ts +367 -0
- package/visit-counts.js +123 -0
- package/visit-counts.js.map +1 -0
- package/visit-counts.ts +162 -0
- package/visitor-location.js +33 -0
- package/visitor-location.js.map +1 -0
- package/visitor-location.ts +38 -0
- package/visitor.js +152 -0
- package/visitor.js.map +1 -0
- package/visitor.ts +228 -0
- package/visits-browser.js +71 -0
- package/visits-browser.js.map +1 -0
- package/visits-browser.ts +87 -0
- package/visits-view.js +88 -0
- package/visits-view.js.map +1 -0
- package/visits-view.ts +184 -0
- package/visits.js +428 -0
- package/visits.js.map +1 -0
- package/visits.ts +561 -0
- package/vocab/account.vocab.json +349 -0
- package/vocab/agents.vocab.json +64 -0
- package/vocab/app-canvas.vocab.json +137 -0
- package/vocab/app-friends.vocab.json +71 -0
- package/vocab/app-permissions.vocab.json +46 -0
- package/vocab/apps.vocab.json +553 -0
- package/vocab/attribution.vocab.json +32 -0
- package/vocab/builder-install.vocab.json +10 -0
- package/vocab/connections.vocab.json +128 -0
- package/vocab/dashboard.vocab.json +148 -0
- package/vocab/directory.vocab.json +2445 -0
- package/vocab/exception.vocab.json +18 -0
- package/vocab/fundraising.vocab.json +284 -0
- package/vocab/gmail-mailbox.vocab.json +73 -0
- package/vocab/kernel.vocab.json +420 -0
- package/vocab/mcp-retirement.vocab.json +66 -0
- package/vocab/meter.vocab.json +230 -0
- package/vocab/models-install.vocab.json +10 -0
- package/vocab/notices.vocab.json +88 -0
- package/vocab/operator-drafts.vocab.json +19 -0
- package/vocab/operator-matches.vocab.json +85 -0
- package/vocab/operator-settings.vocab.json +127 -0
- package/vocab/operator-talk.vocab.json +92 -0
- package/vocab/operator.vocab.json +1314 -0
- package/vocab/outreach.vocab.json +141 -0
- package/vocab/pages.vocab.json +38 -0
- package/vocab/payment.vocab.json +271 -0
- package/vocab/people.vocab.json +337 -0
- package/vocab/presence.vocab.json +19 -0
- package/vocab/preview.vocab.json +66 -0
- package/vocab/referenced.vocab.json +17 -0
- package/vocab/referral.vocab.json +272 -0
- package/vocab/refusals.vocab.json +16 -0
- package/vocab/registration.vocab.json +17 -0
- package/vocab/serving.vocab.json +103 -0
- package/vocab/side.vocab.json +97 -0
- package/vocab/space-apps.vocab.json +137 -0
- package/vocab/space-pages.vocab.json +416 -0
- package/vocab/sweep-install.vocab.json +10 -0
- package/vocab/sweep.vocab.json +125 -0
- package/vocab/trash.vocab.json +19 -0
- package/vocab/update.vocab.json +53 -0
- package/vocab/upload.vocab.json +69 -0
- package/vocab/use.vocab.json +93 -0
- package/vocab/visits.vocab.json +143 -0
- package/vocab/waiting.vocab.json +29 -0
- package/vocab.js +16 -0
- package/vocab.js.map +1 -0
- package/vocab.json +1703 -0
- package/vocab.ts +17 -0
- package/weigh-graph.js +12 -0
- package/weigh-graph.js.map +1 -0
- package/weigh-graph.ts +9 -0
- package/wire-news.js +30 -0
- package/wire-news.js.map +1 -0
- package/wire-news.ts +30 -0
- package/work-standing.js +64 -0
- package/work-standing.js.map +1 -0
- package/work-standing.ts +44 -0
- package/woven.js +435 -0
- package/woven.js.map +1 -0
- package/woven.ts +649 -0
- package/wrap-graph.js +17 -0
- package/wrap-graph.js.map +1 -0
- package/wrap-graph.ts +15 -0
- package/write-owner.js +11 -0
- package/write-owner.js.map +1 -0
- package/write-owner.ts +24 -0
package/routes.js
ADDED
|
@@ -0,0 +1,1143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@yaks/platform/routes` — where a request is going, read from its hostname
|
|
3
|
+
* and path and nothing else (D-32318 §Routing). The apex `yaks.app` is the
|
|
4
|
+
* platform's own face; `<space>.yaks.app/<app>/…` is an app in a space. On
|
|
5
|
+
* loopback, an explicit LOCAL_DEV=1 lets `x-yak-host` stand in for a hostname
|
|
6
|
+
* a local test cannot send (fetch refuses a Host header). Deployed hosts
|
|
7
|
+
* always ignore the header. Pure: only the configured host, no store.
|
|
8
|
+
*
|
|
9
|
+
* ```ts
|
|
10
|
+
* import { route } from '@yaks/platform/routes'
|
|
11
|
+
* import { assertEquals } from '@std/assert'
|
|
12
|
+
* assertEquals(route('ada.yaks.app', '/menu/soup'), {
|
|
13
|
+
* space: 'ada',
|
|
14
|
+
* app: 'menu',
|
|
15
|
+
* path: '/soup',
|
|
16
|
+
* })
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @module
|
|
20
|
+
*/ import { knocks } from "@yaks/git/address";
|
|
21
|
+
import { upgrading } from "./app-outbound.js";
|
|
22
|
+
import { apex, spaceHost, url } from "./host.js";
|
|
23
|
+
import { letter, monogram } from "./monogram.js";
|
|
24
|
+
import { PLATFORM, RESERVED, ROOT, SLUG } from "./names.js";
|
|
25
|
+
import { releaseId } from "./versions.js";
|
|
26
|
+
// A person's spaces and account live at the apex rather than on any space's
|
|
27
|
+
// hostname, so no app sharing a space's origin can reach them (T-39354). A
|
|
28
|
+
// space's own address, `/<space>`, is its Dashboard (T-3702): its apps, what
|
|
29
|
+
// its agents did and its Updates. Its Operator is at `/<space>/operator`
|
|
30
|
+
// (D-473): a new chat, each conversation at `/<space>/operator/<id>`, its
|
|
31
|
+
// Updates at `/<space>/updates` and its Matches at `/<space>/matches`; the
|
|
32
|
+
// person's Updates from every space are `/updates`. Manage is the settings: a space's at `/manage/<space>/<page>`,
|
|
33
|
+
// and the person's own, wherever they are, at `/manage/account/<page>`
|
|
34
|
+
// (T-136122), which no space can be named (./names.ts `RESERVED` holds
|
|
35
|
+
// `account`).
|
|
36
|
+
export let MANAGE = '/manage';
|
|
37
|
+
/** Where a provider-started connection is attached to a space after sign-in. */ export let CONNECTION_INSTALL = '/connections/install';
|
|
38
|
+
/** The person's Updates from every space's Operator. */ export let UPDATES = '/updates';
|
|
39
|
+
/** A texted link's page approving one act the Operator was asked for by a
|
|
40
|
+
* number alone (yaks.app's operator-approvals.ts). */ export let APPROVE = '/approve';
|
|
41
|
+
export let ACCOUNT = 'account';
|
|
42
|
+
let TALK = [
|
|
43
|
+
'updates',
|
|
44
|
+
'matches',
|
|
45
|
+
'dashboard',
|
|
46
|
+
'tasks'
|
|
47
|
+
];
|
|
48
|
+
let talks = (view)=>TALK.includes(view);
|
|
49
|
+
let SPACE_VIEWS = [
|
|
50
|
+
'apps',
|
|
51
|
+
'new',
|
|
52
|
+
'operator',
|
|
53
|
+
'dashboard',
|
|
54
|
+
'updates',
|
|
55
|
+
'tasks',
|
|
56
|
+
'matches',
|
|
57
|
+
'people',
|
|
58
|
+
'connections',
|
|
59
|
+
'visits',
|
|
60
|
+
'selling',
|
|
61
|
+
'billing',
|
|
62
|
+
'domains',
|
|
63
|
+
'settings',
|
|
64
|
+
'trash'
|
|
65
|
+
];
|
|
66
|
+
let ACCOUNT_VIEWS = [
|
|
67
|
+
'profile',
|
|
68
|
+
'friends',
|
|
69
|
+
'invite',
|
|
70
|
+
'agents',
|
|
71
|
+
'shared',
|
|
72
|
+
'space'
|
|
73
|
+
];
|
|
74
|
+
export let accountView = (view)=>ACCOUNT_VIEWS.includes(view);
|
|
75
|
+
// The pages before the space moved into the path, `/manage/<page>` with
|
|
76
|
+
// `?space=` or none for the person's own, and what each is now: letters
|
|
77
|
+
// already sent carry them.
|
|
78
|
+
let LEGACY = {
|
|
79
|
+
...Object.fromEntries(SPACE_VIEWS.map((v)=>[
|
|
80
|
+
v,
|
|
81
|
+
v
|
|
82
|
+
])),
|
|
83
|
+
connect: 'agents'
|
|
84
|
+
};
|
|
85
|
+
/** Whether a space named `slug` stands at the apex's root, `/<slug>`: every
|
|
86
|
+
* space but one holding a name the apex keeps for itself (./names.ts
|
|
87
|
+
* `RESERVED`, `ROOT`), whose Operator stays at `/manage/<slug>`.
|
|
88
|
+
*
|
|
89
|
+
* ```ts
|
|
90
|
+
* import { rooted } from '@yaks/platform/routes'
|
|
91
|
+
* import { assertEquals } from '@std/assert'
|
|
92
|
+
* assertEquals([rooted('ada'), rooted('admin'), rooted('gallery')], [true, false, false])
|
|
93
|
+
* ```
|
|
94
|
+
*/ export let rooted = (slug)=>SLUG.test(slug) && !RESERVED.has(slug) && !ROOT.has(slug);
|
|
95
|
+
// Where a space's pages stand: its own address, else its old one under
|
|
96
|
+
// Manage.
|
|
97
|
+
let home = (space)=>rooted(space) ? `/${space}` : `${MANAGE}/${encodeURIComponent(space)}`;
|
|
98
|
+
/** A space's Dashboard: its own address, else under Manage, where the
|
|
99
|
+
* space's bare address is still its Operator.
|
|
100
|
+
*
|
|
101
|
+
* ```ts
|
|
102
|
+
* import { dashboardPath } from '@yaks/platform/routes'
|
|
103
|
+
* import { assertEquals } from '@std/assert'
|
|
104
|
+
* assertEquals(dashboardPath('ada'), '/ada')
|
|
105
|
+
* assertEquals(dashboardPath('yak'), '/manage/yak/dashboard')
|
|
106
|
+
* ```
|
|
107
|
+
*/ export let dashboardPath = (space)=>rooted(space) ? home(space) : `${home(space)}/dashboard`;
|
|
108
|
+
/** A page of a space's Operator: its Dashboard, Updates or Matches. Without
|
|
109
|
+
* a space, Updates from every space the person talks to.
|
|
110
|
+
*
|
|
111
|
+
* ```ts
|
|
112
|
+
* import { talkPath } from '@yaks/platform/routes'
|
|
113
|
+
* import { assertEquals } from '@std/assert'
|
|
114
|
+
* assertEquals(talkPath('updates', 'ada'), '/ada/updates')
|
|
115
|
+
* assertEquals(talkPath('updates'), '/updates')
|
|
116
|
+
* assertEquals(talkPath('matches', 'yak'), '/manage/yak/matches')
|
|
117
|
+
* assertEquals(talkPath('dashboard', 'ada'), '/ada')
|
|
118
|
+
* ```
|
|
119
|
+
*/ export let talkPath = (view, space)=>!space ? UPDATES : view == 'dashboard' ? dashboardPath(space) : `${home(space)}/${view}`;
|
|
120
|
+
/** The detail page an entity link can open over its current page. */ export let taskEntityPath = (space, eid)=>`${talkPath('tasks', space)}?${new URLSearchParams({
|
|
121
|
+
item: eid
|
|
122
|
+
})}`;
|
|
123
|
+
/** A settings page's path. A space's page without a space names the one the
|
|
124
|
+
* person opens first, whichever that is when they follow it. */ export let managePath = (view, space)=>accountView(view) ? `${MANAGE}/${ACCOUNT}/${view}` : space ? `${MANAGE}/${encodeURIComponent(space)}/${view}` : `${MANAGE}/${view}`;
|
|
125
|
+
/** The fund settings section of a space's Selling page. */ export let donationPath = (space, app)=>managePath('selling', space) + (app ? `?donations=${encodeURIComponent(app)}` : '') + '#donation-funds';
|
|
126
|
+
/** Open a chat account's OAuth confirmation from Profile. */ export let accountLink = (home, integration, space)=>{
|
|
127
|
+
let link = new URL(managePath('profile'), home);
|
|
128
|
+
link.searchParams.set('link', integration);
|
|
129
|
+
if (space) link.searchParams.set('back', space);
|
|
130
|
+
return link;
|
|
131
|
+
};
|
|
132
|
+
/** Where a form lands back: the page under /manage or of a space's Operator
|
|
133
|
+
* it names, at the apex, else `fallback`; a form never sends the person off
|
|
134
|
+
* yaks.app. */ export let backTo = (env, back, fallback)=>{
|
|
135
|
+
let apex = new URL(url(env));
|
|
136
|
+
let to = new URL(back || fallback, apex);
|
|
137
|
+
return to.origin == apex.origin && (to.pathname == MANAGE || to.pathname == CONNECTION_INSTALL || to.pathname.startsWith(`${MANAGE}/`) || !!spaced(to.pathname)) ? to.href : new URL(fallback, apex).href;
|
|
138
|
+
};
|
|
139
|
+
// What a conversation opens by: a task's or a request's eid, or `new`.
|
|
140
|
+
let OPEN = /^(new|[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12})$/;
|
|
141
|
+
/** An Operator conversation's own page, the chat app (operator-page.ts
|
|
142
|
+
* `chatPage`): one opened by its task or request, or a new one, which is the
|
|
143
|
+
* Operator's own address. Its other conversations are under it, so `open`
|
|
144
|
+
* empty is the prefix they share.
|
|
145
|
+
*
|
|
146
|
+
* ```ts
|
|
147
|
+
* import { chatPath } from '@yaks/platform/routes'
|
|
148
|
+
* import { assertEquals } from '@std/assert'
|
|
149
|
+
* let id = '0b5e6a52-3c1d-4f2e-9a8b-7c6d5e4f3a2b'
|
|
150
|
+
* assertEquals(chatPath('ada'), '/ada/operator')
|
|
151
|
+
* assertEquals(chatPath('ada', id), `/ada/operator/${id}`)
|
|
152
|
+
* assertEquals(chatPath('ada', ''), '/ada/operator/')
|
|
153
|
+
* assertEquals(chatPath('yak'), '/manage/yak')
|
|
154
|
+
* assertEquals(chatPath('yak', id), `/manage/yak/operator/${id}`)
|
|
155
|
+
* ```
|
|
156
|
+
*/ export let chatPath = (space, open = 'new')=>rooted(space) ? `/${space}/operator${open == 'new' ? '' : `/${open}`}` : open == 'new' ? home(space) : `${managePath('operator', space)}/${open}`;
|
|
157
|
+
// A version's own page, under its space's: `versions/<app>/<version>`.
|
|
158
|
+
let VERSIONS = 'versions';
|
|
159
|
+
let shipped = (space, [app, n])=>SLUG.test(app) && /^[1-9][0-9]*$/.test(n) ? {
|
|
160
|
+
space,
|
|
161
|
+
view: 'versions',
|
|
162
|
+
version: {
|
|
163
|
+
app,
|
|
164
|
+
version: +n
|
|
165
|
+
}
|
|
166
|
+
} : null;
|
|
167
|
+
/** A version of an app's own page (operator-page.ts `versionPage`): what it
|
|
168
|
+
* changed, as its release says, and the way to it as it shipped.
|
|
169
|
+
*
|
|
170
|
+
* ```ts
|
|
171
|
+
* import { versionPath } from '@yaks/platform/routes'
|
|
172
|
+
* import { assertEquals } from '@std/assert'
|
|
173
|
+
* assertEquals(versionPath('ada', 'roster', 4), '/ada/versions/roster/4')
|
|
174
|
+
* assertEquals(versionPath('yak', 'roster', 4), '/manage/yak/versions/roster/4')
|
|
175
|
+
* ```
|
|
176
|
+
*/ export let versionPath = (space, app, version)=>`${home(space)}/${VERSIONS}/${app}/${version}`;
|
|
177
|
+
/** Where a space's logo is drawn from, or none where it has none: its bytes'
|
|
178
|
+
* own address, so the address changes with the picture and nothing is ever
|
|
179
|
+
* shown stale.
|
|
180
|
+
*
|
|
181
|
+
* ```ts
|
|
182
|
+
* import { logoPath } from '@yaks/platform/routes'
|
|
183
|
+
* import { assertEquals } from '@std/assert'
|
|
184
|
+
* let sha = 'a'.repeat(64)
|
|
185
|
+
* assertEquals(logoPath({ slug: 'ada', logo: { sha } }), `/manage/ada/logo/${sha}?size=avatar`)
|
|
186
|
+
* assertEquals(logoPath({ slug: 'ada', logo: null }), undefined)
|
|
187
|
+
* ```
|
|
188
|
+
*/ export let logoPath = (space, size = 'avatar')=>space.logo ? `${MANAGE}/${encodeURIComponent(space.slug)}/logo/${space.logo.sha}?size=${size}` : undefined;
|
|
189
|
+
/** Where Settings' Logo form sends a picture: Settings with `?logo`, so the
|
|
190
|
+
* page's Save, which also posts a multipart form there, is not read as one.
|
|
191
|
+
*
|
|
192
|
+
* ```ts
|
|
193
|
+
* import { logoUpload } from '@yaks/platform/routes'
|
|
194
|
+
* import { assertEquals } from '@std/assert'
|
|
195
|
+
* assertEquals(logoUpload('ada'), '/manage/ada/settings?logo')
|
|
196
|
+
* ```
|
|
197
|
+
*/ export let logoUpload = (space)=>`${managePath('settings', space)}?logo`;
|
|
198
|
+
/** What draws an app's home-screen icon: its release, the space's logo and
|
|
199
|
+
* the artwork drawn for an app that has no icon of its own.
|
|
200
|
+
*
|
|
201
|
+
* ```ts
|
|
202
|
+
* import { iconVersion } from '@yaks/platform/routes'
|
|
203
|
+
* import { assertEquals } from '@std/assert'
|
|
204
|
+
* let id = '0b6b4f8c-fdcc-4a38-bcbd-15bad97cee69'
|
|
205
|
+
* assertEquals(
|
|
206
|
+
* iconVersion({ source: `ada/.releases/7/${id}` }, { logo: null }),
|
|
207
|
+
* `${id}.`,
|
|
208
|
+
* )
|
|
209
|
+
* ```
|
|
210
|
+
*/ export let iconVersion = (app, space, art)=>`${art ?? releaseId(app.source) ?? app.source ?? ''}.${space.logo?.sha.slice(0, 12) ?? ''}${app.generatedIcon ? `.${app.generatedIcon.slice(0, 12)}` : ''}`;
|
|
211
|
+
/** The platform's empty response that starts an app ahead of navigation. */ export let APP_WARM = '/_web/warm';
|
|
212
|
+
/** The warm door under the app mount `at`. */ export let appWarmAt = (at)=>at.replace(/\/$/, '') + APP_WARM;
|
|
213
|
+
/** An app's icon below its address `at` (ending in a slash), named by what
|
|
214
|
+
* draws it (`iconVersion`), so a browser keeps it until a release or the
|
|
215
|
+
* logo changes it (workers/yak apps.ts `caching`).
|
|
216
|
+
*
|
|
217
|
+
* ```ts
|
|
218
|
+
* import { iconAt } from '@yaks/platform/routes'
|
|
219
|
+
* import { assertEquals } from '@std/assert'
|
|
220
|
+
* assertEquals(
|
|
221
|
+
* iconAt('https://ada.yaks.app/box/', { source: 'abc' }, { logo: null }),
|
|
222
|
+
* 'https://ada.yaks.app/box/icon.png?v=abc.',
|
|
223
|
+
* )
|
|
224
|
+
* ```
|
|
225
|
+
*/ export let iconAt = (at, app, space, art)=>`${at}icon.png?v=${encodeURIComponent(iconVersion(app, space, art))}`;
|
|
226
|
+
/** The release and the platform artwork it can show. */ export let markVersion = ({ eid, slug, title, source, generatedIcon })=>{
|
|
227
|
+
let release = releaseId(source);
|
|
228
|
+
return release || source === null ? `3.${release ?? ''}.${eid}.${generatedIcon ?? letter(title || slug)}` : null;
|
|
229
|
+
};
|
|
230
|
+
/** The icon in an app list. */ export let appMark = (at, app)=>{
|
|
231
|
+
let version = markVersion(app);
|
|
232
|
+
return `${at}/icon.png?display${version ? `&v=${encodeURIComponent(version)}` : ''}`;
|
|
233
|
+
};
|
|
234
|
+
/** An app list's image and the mark it can paint before the image arrives. */ export let appMarkImage = (at, app)=>({
|
|
235
|
+
backdrop: {
|
|
236
|
+
'data-app-mark': '',
|
|
237
|
+
style: {
|
|
238
|
+
'--app-mark': `url("data:image/svg+xml,${encodeURIComponent(monogram(app.title || app.slug, app.eid))}")`
|
|
239
|
+
}
|
|
240
|
+
},
|
|
241
|
+
image: {
|
|
242
|
+
src: appMark(at, app),
|
|
243
|
+
alt: '',
|
|
244
|
+
loading: 'lazy',
|
|
245
|
+
class: 'AppMark_Image',
|
|
246
|
+
'data-app-mark-image': ''
|
|
247
|
+
}
|
|
248
|
+
});
|
|
249
|
+
/** Where the gallery serves pictures whose visibility follows an app. */ export let PICTURES = '/gallery/image/';
|
|
250
|
+
/** Where the connections page serves the logos it does not keep as SVG
|
|
251
|
+
* (workers/yak catalog.ts `logoDoor`), by the integration's name. */ export let LOGOS = '/connections/logo/';
|
|
252
|
+
export let STORED_LOGOS = `${LOGOS}file/`;
|
|
253
|
+
export let ICON_LIMIT = 1024 * 1024;
|
|
254
|
+
/** Where an integration's logo is drawn from, read from its row: its own
|
|
255
|
+
* SVG as a `data:` address, else the logo door for a row that names its
|
|
256
|
+
* logo's address (`image`), made absolute on the apex, or none where it has
|
|
257
|
+
* neither (@yaks/ui `Logo` then draws a neutral mark).
|
|
258
|
+
*
|
|
259
|
+
* ```ts
|
|
260
|
+
* import { integrationLogo } from '@yaks/platform/routes'
|
|
261
|
+
* import { assertEquals } from '@std/assert'
|
|
262
|
+
* let env = { APEX: 'yaks.test' }
|
|
263
|
+
* assertEquals(
|
|
264
|
+
* integrationLogo({ name: 'gmail', image: 'https://x.test/g.svg' }, env),
|
|
265
|
+
* 'https://yaks.test/connections/logo/gmail',
|
|
266
|
+
* )
|
|
267
|
+
* assertEquals(integrationLogo({ name: 'x', logo: '<svg/>' }), 'data:image/svg+xml,%3Csvg%2F%3E')
|
|
268
|
+
* assertEquals(integrationLogo({ name: 'mine' }), undefined)
|
|
269
|
+
* ```
|
|
270
|
+
*/ export let integrationLogo = (i, env = {})=>i.logo ? `data:image/svg+xml,${encodeURIComponent(i.logo)}` : i.image ? url(env, SHA.test(i.image) ? STORED_LOGOS + i.image : `${LOGOS}${encodeURIComponent(i.name)}`) : undefined;
|
|
271
|
+
let SHA = /^[0-9a-f]{64}$/;
|
|
272
|
+
/** The name a web manifest answers at, under an app's mount or a space's
|
|
273
|
+
* Operator. */ export const MANIFEST = 'manifest.webmanifest';
|
|
274
|
+
/** The Operator's public icon. */ export let OPERATOR_ICON = '/connector-512.png';
|
|
275
|
+
/** What a space's Operator page installs from (operator-page.ts
|
|
276
|
+
* `installing`). */ export let manifestPath = (space)=>`${MANAGE}/${encodeURIComponent(space)}/${MANIFEST}`;
|
|
277
|
+
// Where each published app's own page lives (workers/yak app-page.ts): one
|
|
278
|
+
// address per platform-wide name, listed or not.
|
|
279
|
+
export let PAGE = '/apps/';
|
|
280
|
+
/** A published app's own page on the platform. */ /// pageAt('recipes') -> 'https://yaks.app/apps/recipes'
|
|
281
|
+
export let pageAt = (name, env = {})=>url(env, `${PAGE}${encodeURIComponent(name)}`);
|
|
282
|
+
// Where the page of a space that shares anything in public lives
|
|
283
|
+
// (workers/yak publisher-page.ts): one address per space slug.
|
|
284
|
+
export let PUBLISHER = '/spaces/';
|
|
285
|
+
/** The page of a space that shares anything in public. */ /// publisherAt('ada') -> 'https://yaks.app/spaces/ada'
|
|
286
|
+
export let publisherAt = (slug, env = {})=>url(env, `${PUBLISHER}${encodeURIComponent(slug)}`);
|
|
287
|
+
let STORE_DOORS = [
|
|
288
|
+
'apply',
|
|
289
|
+
'query',
|
|
290
|
+
'ws'
|
|
291
|
+
];
|
|
292
|
+
// A page of a space's Operator under Manage, where it was before D-473: sent
|
|
293
|
+
// on to the space's own address, unless the space holds a name the apex keeps
|
|
294
|
+
// (`rooted`), whose Operator is still served there.
|
|
295
|
+
let talked = (space, view, open = 'new')=>!rooted(space) ? {
|
|
296
|
+
space,
|
|
297
|
+
view,
|
|
298
|
+
...view == 'operator' ? {
|
|
299
|
+
open
|
|
300
|
+
} : {}
|
|
301
|
+
} : {
|
|
302
|
+
moved: view == 'operator' ? chatPath(space, open) : talkPath(view, space)
|
|
303
|
+
};
|
|
304
|
+
/** What a path under `/manage` asks for (`Managed`), or null where it is not
|
|
305
|
+
* one. */ export let managed = (path)=>{
|
|
306
|
+
if (!(path == MANAGE || path.startsWith(`${MANAGE}/`))) return null;
|
|
307
|
+
let [one, two, ...rest] = path.slice(MANAGE.length).split('/').filter(Boolean);
|
|
308
|
+
// An Operator conversation, on a page of its own (`chatPath`), or a door
|
|
309
|
+
// of its store.
|
|
310
|
+
if (two == 'operator' && rest.length == 1 && SLUG.test(one)) {
|
|
311
|
+
if (STORE_DOORS.includes(rest[0])) {
|
|
312
|
+
return {
|
|
313
|
+
space: one,
|
|
314
|
+
view: 'operator',
|
|
315
|
+
door: rest[0]
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
return OPEN.test(rest[0]) ? talked(one, 'operator', rest[0]) : null;
|
|
319
|
+
}
|
|
320
|
+
if (two == VERSIONS && rest.length == 2 && SLUG.test(one)) {
|
|
321
|
+
let at = shipped(one, rest);
|
|
322
|
+
return at && rooted(one) ? {
|
|
323
|
+
moved: versionPath(one, at.version.app, at.version.version)
|
|
324
|
+
} : at;
|
|
325
|
+
}
|
|
326
|
+
if (two == MANIFEST && !rest.length && SLUG.test(one)) {
|
|
327
|
+
return {
|
|
328
|
+
space: one,
|
|
329
|
+
view: 'operator',
|
|
330
|
+
manifest: true
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
if (two == 'logo' && rest.length == 1 && SLUG.test(one)) {
|
|
334
|
+
return SHA.test(rest[0]) ? {
|
|
335
|
+
space: one,
|
|
336
|
+
view: 'settings',
|
|
337
|
+
logo: rest[0]
|
|
338
|
+
} : null;
|
|
339
|
+
}
|
|
340
|
+
if (rest.length) return null;
|
|
341
|
+
if (!one) return {
|
|
342
|
+
first: true
|
|
343
|
+
};
|
|
344
|
+
if (one == ACCOUNT) {
|
|
345
|
+
return !two ? {
|
|
346
|
+
account: 'profile'
|
|
347
|
+
} : ACCOUNT_VIEWS.includes(two) ? {
|
|
348
|
+
account: two
|
|
349
|
+
} : null;
|
|
350
|
+
}
|
|
351
|
+
if (one == 'updates' && !two) return {
|
|
352
|
+
moved: UPDATES
|
|
353
|
+
};
|
|
354
|
+
if (!two) {
|
|
355
|
+
return Object.hasOwn(LEGACY, one) ? {
|
|
356
|
+
legacy: LEGACY[one]
|
|
357
|
+
} : SLUG.test(one) ? talked(one, 'operator') : null;
|
|
358
|
+
}
|
|
359
|
+
if (!SLUG.test(one) || !SPACE_VIEWS.includes(two)) return null;
|
|
360
|
+
return talks(two) ? talked(one, two) : {
|
|
361
|
+
space: one,
|
|
362
|
+
view: two
|
|
363
|
+
};
|
|
364
|
+
};
|
|
365
|
+
/** What an address at the apex's root asks for: the person's Updates from
|
|
366
|
+
* every space (`/updates`), or a page of a space at the space's own address
|
|
367
|
+
* (`rooted`): its Dashboard, its Operator's chat or another page of its
|
|
368
|
+
* Operator; or null where it is none. A conversation's address from before
|
|
369
|
+
* the chat moved under `/operator` is sent on to where it is now.
|
|
370
|
+
*
|
|
371
|
+
* ```ts
|
|
372
|
+
* import { spaced } from '@yaks/platform/routes'
|
|
373
|
+
* import { assertEquals } from '@std/assert'
|
|
374
|
+
* let id = '0b5e6a52-3c1d-4f2e-9a8b-7c6d5e4f3a2b'
|
|
375
|
+
* assertEquals(spaced('/ada'), { space: 'ada', view: 'dashboard' })
|
|
376
|
+
* assertEquals(spaced('/ada/operator'), { space: 'ada', view: 'operator', open: 'new' })
|
|
377
|
+
* assertEquals(spaced(`/ada/operator/${id}`), { space: 'ada', view: 'operator', open: id })
|
|
378
|
+
* assertEquals(spaced(`/ada/${id}`), { moved: `/ada/operator/${id}` })
|
|
379
|
+
* assertEquals(spaced('/ada/updates'), { space: 'ada', view: 'updates' })
|
|
380
|
+
* assertEquals(spaced('/ada/versions/roster/4'), {
|
|
381
|
+
* space: 'ada',
|
|
382
|
+
* view: 'versions',
|
|
383
|
+
* version: { app: 'roster', version: 4 },
|
|
384
|
+
* })
|
|
385
|
+
* assertEquals(spaced('/ada/dashboard'), { moved: '/ada' })
|
|
386
|
+
* assertEquals(spaced('/pricing'), null)
|
|
387
|
+
* ```
|
|
388
|
+
*/ export let spaced = (path)=>{
|
|
389
|
+
if (path == UPDATES) return {
|
|
390
|
+
updates: true
|
|
391
|
+
};
|
|
392
|
+
let [, one, two, ...rest] = path.split('/');
|
|
393
|
+
if (!rooted(one)) return null;
|
|
394
|
+
if (two == 'operator' && rest.length < 2) {
|
|
395
|
+
let open = rest[0] ?? 'new';
|
|
396
|
+
return OPEN.test(open) ? {
|
|
397
|
+
space: one,
|
|
398
|
+
view: 'operator',
|
|
399
|
+
open
|
|
400
|
+
} : null;
|
|
401
|
+
}
|
|
402
|
+
if (two == VERSIONS && rest.length == 2) return shipped(one, rest);
|
|
403
|
+
if (rest.length) return null;
|
|
404
|
+
if (two == null) return {
|
|
405
|
+
space: one,
|
|
406
|
+
view: 'dashboard'
|
|
407
|
+
};
|
|
408
|
+
if (two == 'dashboard') return {
|
|
409
|
+
moved: dashboardPath(one)
|
|
410
|
+
};
|
|
411
|
+
if (talks(two)) return {
|
|
412
|
+
space: one,
|
|
413
|
+
view: two
|
|
414
|
+
};
|
|
415
|
+
return OPEN.test(two) ? {
|
|
416
|
+
moved: chatPath(one, two)
|
|
417
|
+
} : null;
|
|
418
|
+
};
|
|
419
|
+
/** Whether `path` is a page a signed-in person opens in the frame: a space's
|
|
420
|
+
* page, every space's Updates, a settings page, or an address moved to one;
|
|
421
|
+
* never a store's door, a logo or a manifest.
|
|
422
|
+
*
|
|
423
|
+
* ```ts
|
|
424
|
+
* import { framed } from '@yaks/platform/routes'
|
|
425
|
+
* import { assertEquals } from '@std/assert'
|
|
426
|
+
* assertEquals(framed('/ada/updates'), true)
|
|
427
|
+
* assertEquals(framed('/manage/account/friends'), true)
|
|
428
|
+
* assertEquals(framed('/manage/ada/logo/' + 'a'.repeat(64)), false)
|
|
429
|
+
* assertEquals(framed('/pricing'), false)
|
|
430
|
+
* ```
|
|
431
|
+
*/ export let framed = (path)=>{
|
|
432
|
+
let at = managed(path) ?? spaced(path);
|
|
433
|
+
return !!at && !('door' in at && at.door || 'logo' in at && at.logo || 'manifest' in at && at.manifest);
|
|
434
|
+
};
|
|
435
|
+
/** Where an address that names no space (`/manage`, or one from before the
|
|
436
|
+
* space was in the path) is now, for `space`: a page names its own, and none
|
|
437
|
+
* is the space's chat. */ export let landing = (at, space)=>'first' in at ? chatPath(space) : talks(at.legacy) ? talkPath(at.legacy, space) : managePath(at.legacy, space);
|
|
438
|
+
/** The path an address from before the dashboard named its space in the path
|
|
439
|
+
* (`/_yaks/<page>`, `/manage/<page>`) stands for in `space`, or null. */ export let movedFor = (path, space)=>{
|
|
440
|
+
let at = managed(path);
|
|
441
|
+
if (at && 'moved' in at && at.moved == UPDATES) {
|
|
442
|
+
return talkPath('updates', space);
|
|
443
|
+
}
|
|
444
|
+
return at && ('first' in at || 'legacy' in at) ? landing(at, space) : null;
|
|
445
|
+
};
|
|
446
|
+
/** The same page of a space's at another name, where a rename moved it. */ export let renamed = (at, slug)=>at.open ? chatPath(slug, at.open) : at.view == 'versions' ? at.version ? versionPath(slug, at.version.app, at.version.version) : dashboardPath(slug) : talks(at.view) ? talkPath(at.view, slug) : managePath(at.view, slug);
|
|
447
|
+
/** One space's settings page, as an address to put in a letter or an
|
|
448
|
+
* answer. */ export let manageAt = (space, view, env = {})=>url(env, managePath(view, space));
|
|
449
|
+
/** A connections page's address, still naming the testing integrations it
|
|
450
|
+
* was opened for (connections.ts `enabled`), so its forms and a sign-in begun
|
|
451
|
+
* there come back to the page as it was. */ export let enabling = (to, enable = [])=>{
|
|
452
|
+
if (!enable.length) return to;
|
|
453
|
+
let [path, hash] = to.split('#');
|
|
454
|
+
return `${path}${path.includes('?') ? '&' : '?'}enable=${enable.map(encodeURIComponent).join(',')}${hash == null ? '' : `#${hash}`}`;
|
|
455
|
+
};
|
|
456
|
+
// The path the platform keeps on every space's hostname, outside the
|
|
457
|
+
// app-slug namespace: a service's webhooks arrive under it (connections.ts
|
|
458
|
+
// `HOOKS`), and the dashboard's addresses from when it lived there move to
|
|
459
|
+
// the apex.
|
|
460
|
+
export let OURS = '/_yaks';
|
|
461
|
+
/** The generated style guide's own sheet and specimens (app-style-guide.ts),
|
|
462
|
+
* the same address on every app origin. No app page is given them. */ export let APP_GUIDE_CSS = '/_app-guide.css';
|
|
463
|
+
export let APP_SPECIMENS_JS = '/_app-specimens.js';
|
|
464
|
+
export let APP_GUIDE_ASSETS = [
|
|
465
|
+
APP_GUIDE_CSS,
|
|
466
|
+
APP_SPECIMENS_JS
|
|
467
|
+
];
|
|
468
|
+
/** A read of a style guide asset at its shared address. */ export let appGuideRead = (method, path)=>(method == 'GET' || method == 'HEAD') && APP_GUIDE_ASSETS.includes(path);
|
|
469
|
+
/** The platform admin's directory, on the platform's own host (admin.ts). */ export let ADMIN = '/admin';
|
|
470
|
+
export let ADMIN_CONNECTIONS = `${ADMIN}/connections`;
|
|
471
|
+
export let adminConnectionsPath = (space, person)=>`${ADMIN_CONNECTIONS}?${new URLSearchParams({
|
|
472
|
+
space,
|
|
473
|
+
person
|
|
474
|
+
})}`;
|
|
475
|
+
export let adminPath = (path)=>path == ADMIN || path.startsWith(ADMIN + '/');
|
|
476
|
+
export let BROWSE = '/api/browse';
|
|
477
|
+
export let ADMIN_BROWSE = `${BROWSE}/admin`;
|
|
478
|
+
export let adminPage = (href, env = {})=>{
|
|
479
|
+
if (typeof href != 'string') return false;
|
|
480
|
+
let url = URL.parse(href);
|
|
481
|
+
return !!url && url.origin == `https://${apex(env)}` && !url.username && !url.password && adminPath(url.pathname);
|
|
482
|
+
};
|
|
483
|
+
/** Where signing out is posted (identity.ts). */ export let LOGOUT = '/logout';
|
|
484
|
+
// What the plans cost, as a page (site/pricing.tsx, D-32751). It lives here
|
|
485
|
+
// — beside the platform's own name, in the module with no dependencies —
|
|
486
|
+
// because both halves of the paid tier need it and they must not import each
|
|
487
|
+
// other: billing.ts writes the plan, usage.ts says where a space stands
|
|
488
|
+
// against its ceilings, and unseen.ts already joins them.
|
|
489
|
+
//
|
|
490
|
+
// It is the one address the agent surface may give (C-33033 on D-32751):
|
|
491
|
+
// OpenAI's app-directory policy forbids a plugin selling a subscription and
|
|
492
|
+
// allows explaining that a feature needs a plan and linking to a page that
|
|
493
|
+
// describes the plans. So a tool answer may name this and never a checkout
|
|
494
|
+
// link — checkout is the signed-in web page's, and email's.
|
|
495
|
+
export let PRICING = url({}, '/pricing');
|
|
496
|
+
/** Signed-in plan settings; login preserves this destination. Never checkout. */ export let planSettings = (slug, env = {})=>manageAt(slug, 'billing', env);
|
|
497
|
+
// One MCP resource, requiring sign-in by default. The explicit required URL
|
|
498
|
+
// remains for existing connectors; mixed auth is opt-in at `?auth=mixed`.
|
|
499
|
+
export let MCP = url({}, '/mcp');
|
|
500
|
+
export let MCP_ASK = `${MCP}?auth=required`;
|
|
501
|
+
// Where signing in happens — one email address and a six-digit code, and the
|
|
502
|
+
// same line for somebody who has never been here (signin.ts). It is here
|
|
503
|
+
// beside the other two for the same reason: everything that says it must say
|
|
504
|
+
// the same string, and the tools that name it in a refusal (tools.ts, anon.ts)
|
|
505
|
+
// cannot import identity.ts, which re-exports it, without dragging the
|
|
506
|
+
// runtime's own modules into a Deno test.
|
|
507
|
+
export let SIGN_IN = url({}, '/login');
|
|
508
|
+
/** Where someone who has not signed in is sent: the login page, already
|
|
509
|
+
* carrying the page to hand them back to (T-32593). Whether that address is
|
|
510
|
+
* one to follow is the login door's to decide. */ export let signInAt = (page, env)=>{
|
|
511
|
+
let to = new URL(`https://${apex(env)}/login`);
|
|
512
|
+
to.searchParams.set('return', page);
|
|
513
|
+
return to.href;
|
|
514
|
+
};
|
|
515
|
+
/** Send a signed-out visitor to sign-in with the requested platform page. */ export let signInReturn = (req, env)=>{
|
|
516
|
+
let { pathname, search } = new URL(req.url);
|
|
517
|
+
return new Response(null, {
|
|
518
|
+
status: 303,
|
|
519
|
+
headers: {
|
|
520
|
+
location: signInAt(url(env, pathname + search), env)
|
|
521
|
+
}
|
|
522
|
+
});
|
|
523
|
+
};
|
|
524
|
+
/** Where a paid plan's Get Started sends a stranger (site/home.tsx,
|
|
525
|
+
* site/pricing.tsx): signing in, then the Billing page of the space they open
|
|
526
|
+
* first, whose plan card is the button that buys the plan. Not the connector
|
|
527
|
+
* page, where the card waits closed below the setup. */ export let GET_PLAN = `/login?return=${encodeURIComponent(managePath('billing'))}`;
|
|
528
|
+
/** The page that installs a published app by its name (install.ts). Here
|
|
529
|
+
* beside the sign-in address, since a visitor's bar (./visits.ts) sends a
|
|
530
|
+
* stranger through the one to the other. */ export let INSTALL = '/install';
|
|
531
|
+
/** The page installing `name`, or, `back`, where it sends a stranger who
|
|
532
|
+
* pressed its button back to once signed in: the same page, marked so the
|
|
533
|
+
* funnel counts one who came back apart (install.ts). */ export let installAt = (name, back = false)=>`${INSTALL}?name=${encodeURIComponent(name)}${back ? '&from=sign-in' : ''}`;
|
|
534
|
+
/** Whether an install page's address is one a stranger came back to from
|
|
535
|
+
* signing in (`installAt`). */ export let isBack = (url)=>url.searchParams.get('from') == 'sign-in';
|
|
536
|
+
export let says = (env = {})=>`sign in at ${url(env, '/login')} to reach your apps from here`;
|
|
537
|
+
// And the sentence every refusal says about it: what a person's agent reads
|
|
538
|
+
// when it asked for something nobody signed in may have. It lives here beside
|
|
539
|
+
// the address rather than at one of the doors, because three of them say it —
|
|
540
|
+
// the 401 and its challenge (identity.ts), and the tools a stranger is shown
|
|
541
|
+
// but may not call (anon.ts `barred`).
|
|
542
|
+
export let SAYS = says();
|
|
543
|
+
// And what an agent's connector form asks for when it will not go and find it
|
|
544
|
+
// (T-34414): the authorization server's own addresses and the one scope.
|
|
545
|
+
// identity.ts configures the provider with these, so they are the same strings
|
|
546
|
+
// the two `/.well-known` documents serve, and the connect page types them out
|
|
547
|
+
// for a person whose form has empty boxes. Paths, not absolute URLs, because
|
|
548
|
+
// the provider matches an endpoint by hostname and path and the probe kernel
|
|
549
|
+
// is not at this hostname; the page absolutes them against PLATFORM.
|
|
550
|
+
export let OAUTH = {
|
|
551
|
+
authorize: '/oauth/authorize',
|
|
552
|
+
token: '/oauth/token',
|
|
553
|
+
register: '/oauth/register',
|
|
554
|
+
scope: 'graph'
|
|
555
|
+
};
|
|
556
|
+
// The Cloudflare for SaaS fallback origin (T-33036): the name a customer's
|
|
557
|
+
// own hostname is CNAME'd to, and the one place that name is written — the
|
|
558
|
+
// attach flow and the guide both read it here.
|
|
559
|
+
//
|
|
560
|
+
// Two labels deep on purpose. `route()` below reads everything before
|
|
561
|
+
// `.yaks.app` as a space slug, and `SLUG` admits no dot, so `x.y.yaks.app` is
|
|
562
|
+
// already outside the space namespace and no person can ever claim the space
|
|
563
|
+
// that would shadow our own origin. A one-label name (`origin.yaks.app`)
|
|
564
|
+
// would have needed a reserved-word list to hold that line, and a list is a
|
|
565
|
+
// thing to forget; the namespace's own shape does not forget.
|
|
566
|
+
//
|
|
567
|
+
// This is also the reason a domain mid-provisioning reaches the Worker at
|
|
568
|
+
// all instead of timing out (T-33036): the CNAME above and the `*/*` route
|
|
569
|
+
// mean traffic for any custom hostname on this zone arrives here, active or
|
|
570
|
+
// not — a visitor of a domain whose DNS, validation or certificate step has
|
|
571
|
+
// not finished yet used to get a raw 522 with nothing between them and it.
|
|
572
|
+
// index.ts `settling` is the branded page that answers there now.
|
|
573
|
+
export let ORIGIN = `origin.saas.${PLATFORM}`;
|
|
574
|
+
// Where the app serving this request is mounted for the browser that asked:
|
|
575
|
+
// the prefix its pages resolve relative URLs against, and the address its own
|
|
576
|
+
// `/<app>/` would forward to. `/<app>/` normally, and `/` when a custom
|
|
577
|
+
// domain carried the request here — there the app is the domain's root
|
|
578
|
+
// (index.ts `aimed`), even though the address the platform routes on names
|
|
579
|
+
// the app's prefix. The router sets this header on a request it rewrote
|
|
580
|
+
// itself and strips it off anything a client sent, so it is never a way to
|
|
581
|
+
// move an app's address from outside.
|
|
582
|
+
export let MOUNT = 'x-yak-mount';
|
|
583
|
+
/** The header an app's own worker carries its sealed visitor in, coming back
|
|
584
|
+
* through its service binding (dispatch.ts). */ export let GRANT = 'x-yak-grant';
|
|
585
|
+
/** Whether a request carries one, valid or not: it is the kernel's to open. */ export let bearing = (req)=>req.headers.has(GRANT);
|
|
586
|
+
// The addresses on a space's hostname its apps never answer: a repository's
|
|
587
|
+
// (@yaks/git/door, mounted by workers/yak git_door.ts) and a service's
|
|
588
|
+
// webhooks (connections.ts). They come before the apps and before the edge's
|
|
589
|
+
// kept pages.
|
|
590
|
+
export let spaceDoor = (path)=>knocks(path) || path.startsWith(`${OURS}/hooks/`);
|
|
591
|
+
/** The browser-facing URL retained when the router aims a custom domain. */ export let ADDRESS = 'x-yak-address';
|
|
592
|
+
/** Where an app's own `api/` is for the browser that asked, where it is not
|
|
593
|
+
* under the app's mount (`MOUNT`): the home app's at the apex (workers/yak
|
|
594
|
+
* site.ts `HOME`), whose pages are mounted at `/`, where `/api/` is the
|
|
595
|
+
* apex's own doors. The pencil reads its doors there (page-script.ts). Set
|
|
596
|
+
* by the router alone, as `MOUNT` is. */ export let API_AT = 'x-yak-api-at';
|
|
597
|
+
// Where a hostname somebody else owns is served from: the address on our own
|
|
598
|
+
// zone that the request is carried to, and the mount the app sits at there
|
|
599
|
+
// (T-34596). The directory says which place the domain names — a space, or one
|
|
600
|
+
// app of it — and this is the whole of what that difference means.
|
|
601
|
+
//
|
|
602
|
+
// A domain on a space is that space's own hostname with the path untouched, so
|
|
603
|
+
// it routes through `route()` and every rung of apps.ts exactly as
|
|
604
|
+
// `<space>.yaks.app` does: the front page at `/`, each app at `/<app>/`, the
|
|
605
|
+
// space's own doors where they always were. There is no second path rule for
|
|
606
|
+
// it, because it is the rule.
|
|
607
|
+
//
|
|
608
|
+
// A domain on an app is that app's prefix under the same hostname, mounted at
|
|
609
|
+
// `/`: `herbusiness.com/menu` is `<space>.yaks.app/<app>/menu`, and the mount
|
|
610
|
+
// says the app's pages resolve from the domain's root rather than from the
|
|
611
|
+
// prefix the platform routed by. Both may point at one space at once — the
|
|
612
|
+
// app's own domain opens it at `/`, the space's opens it at `/<app>/`.
|
|
613
|
+
export let aimedAt = (space, app, pathname, env = {})=>({
|
|
614
|
+
host: spaceHost(env, space),
|
|
615
|
+
pathname: app ? `/${app}${pathname}` : pathname,
|
|
616
|
+
mount: app ? '/' : null
|
|
617
|
+
});
|
|
618
|
+
/** Whether a domain serves its place: provisioned, and shown to be its
|
|
619
|
+
* owner's where Cloudflare asked for that. Anything else is answered the
|
|
620
|
+
* page that says how far it has come (kernel.ts `settling`). */ export let ready = (at)=>at?.host.stage == 'active' && (!!at.host.verified || at.host.verification == null);
|
|
621
|
+
/** A request to a hostname that is a place of ours, a custom domain or the
|
|
622
|
+
* apex's own pages (workers/yak site.ts `HOME`), carried to the address that
|
|
623
|
+
* place already has on our own zone (`aimedAt`), naming the address the
|
|
624
|
+
* browser asked (`ADDRESS`) and, for an app, the mount it answers at
|
|
625
|
+
* (`MOUNT`).
|
|
626
|
+
*
|
|
627
|
+
* ```ts
|
|
628
|
+
* import { ADDRESS, aim, MOUNT } from '@yaks/platform/routes'
|
|
629
|
+
* import { assertEquals } from '@std/assert'
|
|
630
|
+
* let at = { space: { slug: 'ada' }, app: { slug: 'menu' } }
|
|
631
|
+
* let req = aim(new Request('http://her.com/soup?x=1'), 'her.com', at)
|
|
632
|
+
* assertEquals(req.url, 'https://ada.yaks.app/menu/soup?x=1')
|
|
633
|
+
* assertEquals(req.headers.get(ADDRESS), 'https://her.com/soup?x=1')
|
|
634
|
+
* assertEquals(req.headers.get(MOUNT), '/')
|
|
635
|
+
* ```
|
|
636
|
+
*/ export let aim = (req, host, at, env = {})=>{
|
|
637
|
+
let url = new URL(req.url);
|
|
638
|
+
let address = new URL(req.url);
|
|
639
|
+
address.host = host;
|
|
640
|
+
address.port = '';
|
|
641
|
+
address.protocol = 'https:';
|
|
642
|
+
let to = aimedAt(at.space.slug, at.app?.slug ?? null, url.pathname, env);
|
|
643
|
+
url.protocol = 'https:';
|
|
644
|
+
url.host = to.host;
|
|
645
|
+
url.pathname = to.pathname;
|
|
646
|
+
let headers = new Headers(req.headers);
|
|
647
|
+
headers.set(ADDRESS, address.href);
|
|
648
|
+
if (to.mount) headers.set(MOUNT, to.mount);
|
|
649
|
+
return new Request(url, new Request(req, {
|
|
650
|
+
headers
|
|
651
|
+
}));
|
|
652
|
+
};
|
|
653
|
+
// The path a customer's own hostname answers the handoff at (handoff.ts).
|
|
654
|
+
// Namespaced so an app's own routes do not collide with it.
|
|
655
|
+
export let HANDOFF = '/__yak/signin';
|
|
656
|
+
/** Whether this is a custom domain's sign-in handoff, the one identity door
|
|
657
|
+
* a customer's own hostname answers (identity.ts `handoff`). */ export let handedOff = (host, pathname, env = {})=>foreign(host, env) && pathname == HANDOFF;
|
|
658
|
+
/** Whether a hostname is this machine's: a local dev run's, never deployed. */ export let loopback = (host)=>host == 'localhost' || host == '127.0.0.1' || host == '[::1]' || host.endsWith('.localhost');
|
|
659
|
+
export let hostOf = (req, env = {})=>{
|
|
660
|
+
let host = new URL(req.url).hostname.toLowerCase();
|
|
661
|
+
return env.LOCAL_DEV == '1' && loopback(host) ? (req.headers.get('x-yak-host') ?? host).toLowerCase() : host;
|
|
662
|
+
};
|
|
663
|
+
// A hostname that is neither ours nor a dev host — someone else's domain,
|
|
664
|
+
// which the directory may know as a customer's (T-33037). Everything the
|
|
665
|
+
// platform already answers on is not foreign, so every route that exists
|
|
666
|
+
// today is decided before this is ever asked: the apex, a space, a dev host,
|
|
667
|
+
// and `x.y.yaks.app`, which was the apex before custom domains and still is.
|
|
668
|
+
export let foreign = (host, env = {})=>!loopback(host) && host != apex(env) && !host.endsWith(`.${apex(env)}`);
|
|
669
|
+
// An address on the platform's own zone: https, and the apex or a hostname
|
|
670
|
+
// under it. It is what a sign-in may hand someone back to (T-32593) — a
|
|
671
|
+
// stranger's address is nowhere we send anyone, so it answers null and the
|
|
672
|
+
// caller goes home instead. Pure, like the rest of this file.
|
|
673
|
+
//
|
|
674
|
+
// A custom domain is deliberately not on the zone (T-33037). We serve it, but
|
|
675
|
+
// the return address arrives from whoever asked, this check is the only thing
|
|
676
|
+
// between that and an open redirect, and it is pure and synchronous — reading
|
|
677
|
+
// the directory here to see whether a stranger's hostname is a customer's
|
|
678
|
+
// would make the one guard in the path an async lookup that can fail open.
|
|
679
|
+
// Nothing is lost by refusing: the platform session cookie is `yaks.app`'s, so
|
|
680
|
+
// a person handed back to `herbusiness.com` would arrive signed out anyway.
|
|
681
|
+
// index.ts serves a custom domain at its app's own address on this zone, so
|
|
682
|
+
// sign-in hands them back there, signed in. A domain that wants to keep
|
|
683
|
+
// someone on their own hostname needs its own verified return, not a wider
|
|
684
|
+
// `onZone`.
|
|
685
|
+
export let onZone = (href, env = {})=>{
|
|
686
|
+
// A bare path is on the zone by construction, and it is what the platform's
|
|
687
|
+
// own returns are made of (`/login?return=/connect`), so refusing one threw
|
|
688
|
+
// away every address we minted ourselves. `//host` — and `/\host`, which a
|
|
689
|
+
// browser reads the same way — is a stranger's URL wearing a path's
|
|
690
|
+
// clothes, and is refused with the rest.
|
|
691
|
+
if (href.startsWith('/')) return /^\/[/\\]/.test(href) ? null : href;
|
|
692
|
+
let url;
|
|
693
|
+
try {
|
|
694
|
+
url = new URL(href);
|
|
695
|
+
} catch {
|
|
696
|
+
return null;
|
|
697
|
+
}
|
|
698
|
+
let host = url.hostname.toLowerCase();
|
|
699
|
+
return url.protocol == 'https:' && (host == apex(env) || host.endsWith(`.${apex(env)}`)) ? url.href : null;
|
|
700
|
+
};
|
|
701
|
+
export let route = (host, pathname, env = {})=>{
|
|
702
|
+
let space = host.endsWith(`.${apex(env)}`) ? host.slice(0, -apex(env).length - 1) : null;
|
|
703
|
+
if (space == null || !SLUG.test(space)) {
|
|
704
|
+
return {
|
|
705
|
+
space: null,
|
|
706
|
+
app: null,
|
|
707
|
+
path: pathname
|
|
708
|
+
};
|
|
709
|
+
}
|
|
710
|
+
let [, first, ...rest] = pathname.split('/');
|
|
711
|
+
if (!first || !SLUG.test(first)) return {
|
|
712
|
+
space,
|
|
713
|
+
app: null,
|
|
714
|
+
path: pathname
|
|
715
|
+
};
|
|
716
|
+
return {
|
|
717
|
+
space,
|
|
718
|
+
app: first,
|
|
719
|
+
path: pathname.length > first.length + 1 ? `/${rest.join('/')}` : ''
|
|
720
|
+
};
|
|
721
|
+
};
|
|
722
|
+
// What the PLATFORM owns rather than an app, read from the hostname and the
|
|
723
|
+
// path. The whole rule in one idea: `/.well-known/` is where a site grants
|
|
724
|
+
// authority over its own name, and the name under `<space>.yaks.app` is ours
|
|
725
|
+
// — a space rents a label of our hostname, it does not own it.
|
|
726
|
+
//
|
|
727
|
+
// The test is NOT whether a file is host-scoped. `robots.txt` is host-scoped
|
|
728
|
+
// and stays the app's, deliberately: a robots file grants nobody anything,
|
|
729
|
+
// it is a preference about the site, and the site's face is the home app.
|
|
730
|
+
// The test is whether the file hands somebody a capability over a name we
|
|
731
|
+
// own. `assetlinks.json` grants a native Android app the right to intercept
|
|
732
|
+
// URLs for the whole hostname; `apple-app-site-association` does the same on
|
|
733
|
+
// iOS; an HTTP-01 challenge yields a publicly trusted certificate for a
|
|
734
|
+
// hostname on our zone. A space's app must not be able to grant those on our
|
|
735
|
+
// name, and that holds for the HOME app too, which otherwise answers every
|
|
736
|
+
// address no other app claims (T-33040) — which is how all of this landed in
|
|
737
|
+
// an app in the first place, and why top-level routing has to say out loud
|
|
738
|
+
// that it wins.
|
|
739
|
+
//
|
|
740
|
+
// The whole prefix rather than the three files, because a list of names that
|
|
741
|
+
// grant authority is a thing to forget — the next one ships without us —
|
|
742
|
+
// and on our own hostname there is nothing under it we lose by keeping.
|
|
743
|
+
//
|
|
744
|
+
// The same files are the app's on a customer's own domain (`foreign`), by
|
|
745
|
+
// this idea rather than despite it: there the name is theirs, so the
|
|
746
|
+
// authority is theirs to grant. Proving domain control to a third party is
|
|
747
|
+
// exactly what `pki-validation` is for at Sectigo and DigiCert, Stripe asks
|
|
748
|
+
// for `apple-developer-merchantid-domain-association` before Apple Pay
|
|
749
|
+
// works, App Links, Universal Links, `security.txt`, WebFinger, Matrix
|
|
750
|
+
// delegation and fediverse verification all live here, and obtaining a
|
|
751
|
+
// certificate for your own domain is your own business. Nothing is reserved
|
|
752
|
+
// there, and there is no list of exceptions to keep: a path is the
|
|
753
|
+
// platform's when the platform has something to serve at it, and everything
|
|
754
|
+
// else falls through to the app. The apps-directory token is the shape of
|
|
755
|
+
// that — the apex has content at `/.well-known/openai-apps-challenge` and
|
|
756
|
+
// answers it (index.ts), while `/.well-known/anything-else` is nobody's and
|
|
757
|
+
// 404s. When Stripe or Apple Pay needs to answer somewhere, it will answer
|
|
758
|
+
// because it has content, not because a string was added to a table.
|
|
759
|
+
//
|
|
760
|
+
// Our own renewal of a customer's custom-hostname certificate is not at risk
|
|
761
|
+
// from that. This zone has a `*/*` Worker route (wrangler.toml, T-33036), and
|
|
762
|
+
// Cloudflare warns it can intercept a CA's request
|
|
763
|
+
// (developers.cloudflare.com/ssl/edge-certificates/changing-dcv-method/troubleshooting/).
|
|
764
|
+
// Measured 2026-09-03: with that route live and the Worker answering these
|
|
765
|
+
// paths itself, a probe hostname was attached as a custom hostname and
|
|
766
|
+
// ssl.com issued its certificate within a minute, while a request to
|
|
767
|
+
// `/.well-known/acme-challenge/x` on that hostname reached the Worker and got
|
|
768
|
+
// its soft 404. Cloudflare's edge answers the CA before the route ever runs.
|
|
769
|
+
// That measurement is also why the platform can answer its own 404 on our
|
|
770
|
+
// hostnames instead of passing a request through to a fallback origin that is
|
|
771
|
+
// deliberately originless (`AAAA 100::`).
|
|
772
|
+
export let platform = (host, pathname, env = {})=>!foreign(host, env) && pathname.startsWith('/.well-known/');
|
|
773
|
+
// What a page at another address may not ask for here, read from the method
|
|
774
|
+
// and the path (`sameOrigin` below is the check itself).
|
|
775
|
+
//
|
|
776
|
+
// Every write, wherever it is aimed. Sibling spaces are same-site, so any
|
|
777
|
+
// form a page in anybody's space aims at a door that acts on the session
|
|
778
|
+
// cookie arrives with the cookie. A list of the doors that write was the
|
|
779
|
+
// guard once, and every door added after it was open: the OAuth consent, the
|
|
780
|
+
// space delete, the standing link and the address picker were all forged from
|
|
781
|
+
// a free space (T-37874), as the billing webhook had been by being renamed
|
|
782
|
+
// out of the list (T-35357). The method is the one thing a new door cannot
|
|
783
|
+
// forget to say. Guarding costs a server-to-server caller nothing — Stripe
|
|
784
|
+
// posts with no `Origin`, and an absent one is allowed.
|
|
785
|
+
//
|
|
786
|
+
// Except the two doors the OAuth provider answers with CORS on purpose:
|
|
787
|
+
// token and registration read no cookie at all, a code, its PKCE verifier
|
|
788
|
+
// and a client's own metadata being the whole of what they take, and a
|
|
789
|
+
// browser-based client posts to them from its own origin.
|
|
790
|
+
//
|
|
791
|
+
// And the doors the graph answers at, whatever the method: an app's
|
|
792
|
+
// `/<app>/api/…`, a front page's own `/api/…` (apps.ts `fetch` serves the home
|
|
793
|
+
// app everything no other app claims), and the connector at `/mcp`, where a
|
|
794
|
+
// socket or a stream is a read that carries the session's write grant.
|
|
795
|
+
// Pages, files and images are deliberately not here — an app's bytes are the
|
|
796
|
+
// web's, and a cross-origin GET of one carries no `Origin` anyway. The shape
|
|
797
|
+
// over-reaches a little: a static asset at `/x/api/y` on the apex matches too,
|
|
798
|
+
// which costs nothing, since nothing a browser fetches cross-origin without
|
|
799
|
+
// CORS can read the answer either way.
|
|
800
|
+
//
|
|
801
|
+
// And every WebSocket handshake, wherever it is aimed: a handshake is a GET
|
|
802
|
+
// that carries the cookie and is outside the same-origin policy, and the page
|
|
803
|
+
// that opens a socket reads and writes it. The upgrade header, like the
|
|
804
|
+
// method, is one no new socket can forget to send, so no list of socket paths
|
|
805
|
+
// has to keep up.
|
|
806
|
+
export let guarded = (req)=>{
|
|
807
|
+
let { method } = req, path = new URL(req.url).pathname;
|
|
808
|
+
return method != 'GET' && method != 'HEAD' && method != 'OPTIONS' && path != OAUTH.token && path != OAUTH.register || path == '/mcp' || /^(?:\/[^/]+)?\/api\//.test(path) || upgrading(req);
|
|
809
|
+
};
|
|
810
|
+
// The browser's own word for the page that asked, against the hostname it
|
|
811
|
+
// asked at. Every space is a subdomain of one registrable domain, so sibling
|
|
812
|
+
// spaces are same-site: `SameSite=Lax` does not keep the session cookie off a
|
|
813
|
+
// request one space's page aims at another's, and a websocket handshake is
|
|
814
|
+
// outside the same-origin policy altogether. This is the line that separates
|
|
815
|
+
// them, and it is the whole of it everywhere except the one door below, where
|
|
816
|
+
// the answer carries CORS headers precisely because no cookie was read.
|
|
817
|
+
//
|
|
818
|
+
// Absent is allowed on purpose. A browser sends `Origin` on every
|
|
819
|
+
// cross-origin fetch and on every handshake, so refusing only a mismatch
|
|
820
|
+
// closes the browser attack completely; curl, a server-to-server client and
|
|
821
|
+
// the kernel's own internal requests send none and have no page to be tricked
|
|
822
|
+
// through. Requiring the header would break them for no security at all.
|
|
823
|
+
//
|
|
824
|
+
// Hostname only: scheme and port differ between a dev host and the platform,
|
|
825
|
+
// and neither is what a space is isolated by.
|
|
826
|
+
//
|
|
827
|
+
// The apex is no sibling: it is the platform's own pages, with no app's code
|
|
828
|
+
// in them, and the dashboard there aims at a space's doors (pages.ts `desk`:
|
|
829
|
+
// the drop zone). A page that could forge a request
|
|
830
|
+
// from the apex could already consent to an agent or close a space there, so
|
|
831
|
+
// admitting it here gives nothing away.
|
|
832
|
+
//
|
|
833
|
+
// `Origin: null` is a stranger (a sandboxed frame's opaque origin), unless the
|
|
834
|
+
// browser's own `Sec-Fetch-Site`, which no page can set, says the request
|
|
835
|
+
// came from this very origin: a form posted from one of our pages served with
|
|
836
|
+
// `Referrer-Policy: no-referrer` (the approval and sign-in pages) is sent with
|
|
837
|
+
// `Origin: null`. A sandboxed frame's requests are `cross-site` there.
|
|
838
|
+
export let sameOrigin = (host, origin, env = {}, site = null)=>{
|
|
839
|
+
if (!origin) return true;
|
|
840
|
+
if (origin == 'null') return site == 'same-origin';
|
|
841
|
+
try {
|
|
842
|
+
let from = new URL(origin).hostname.toLowerCase();
|
|
843
|
+
return from == host.toLowerCase() || from == apex(env);
|
|
844
|
+
} catch {
|
|
845
|
+
return false;
|
|
846
|
+
}
|
|
847
|
+
};
|
|
848
|
+
// The one door above that a stranger's page may reach anyway (T-33408), and
|
|
849
|
+
// the shape of the whole permission: the app's read door, asked with GET, and
|
|
850
|
+
// answered as nobody — the router drops the request's credentials before it is
|
|
851
|
+
// served and sends `Access-Control-Allow-Origin: *` with no
|
|
852
|
+
// `Access-Control-Allow-Credentials` beside it, which is the browser's own
|
|
853
|
+
// guarantee that no cookie was used and none can be read (`cors`).
|
|
854
|
+
//
|
|
855
|
+
// It is safe because what `sameOrigin` closes is ambient credentials, not
|
|
856
|
+
// secrecy: a public app's rows already answer to anyone with curl, and the
|
|
857
|
+
// attack was the session cookie riding along on a request one space's page
|
|
858
|
+
// aimed at another's. Take the cookie away and the request is curl with a
|
|
859
|
+
// referrer. What the caller may then read is the app's own `access`, unchanged
|
|
860
|
+
// and decided downstream: `public` and `open` answer a stranger, `private`
|
|
861
|
+
// refuses one.
|
|
862
|
+
//
|
|
863
|
+
// Writes are not here and must not be. An `open` app lets a stranger write —
|
|
864
|
+
// with the link, from its own page — and a cross-origin write is the forgery
|
|
865
|
+
// origin_test.ts fires. Nor is `/ws`, which is a read but carries the
|
|
866
|
+
// write grant on the same socket, nor `/graph`, `/who` or `/blob`: this is the
|
|
867
|
+
// door the answer is data at, and nothing else has asked to be shared.
|
|
868
|
+
//
|
|
869
|
+
// No preflight door is needed and none is built: a GET with no author-set
|
|
870
|
+
// headers is a CORS simple request, so the browser sends it and reads the
|
|
871
|
+
// answer with no `OPTIONS` in between. A client that adds a header would need
|
|
872
|
+
// one, and can ask for it when it exists.
|
|
873
|
+
export let shared = (method, pathname)=>(method == 'GET' || method == 'HEAD') && /^(?:\/[^/]+)?\/api\/query$/.test(pathname);
|
|
874
|
+
/** A read the query Worker can take on a space's hostname. The directory
|
|
875
|
+
* still decides which app owns the address and what its caller may read. */ export let queryRequest = (req, env = {})=>{
|
|
876
|
+
if (![
|
|
877
|
+
'GET',
|
|
878
|
+
'HEAD',
|
|
879
|
+
'OPTIONS'
|
|
880
|
+
].includes(req.method)) return false;
|
|
881
|
+
if (req.headers.has('upgrade')) return false;
|
|
882
|
+
let path = collapsedPath(new URL(req.url).pathname);
|
|
883
|
+
let host = hostOf(req, env);
|
|
884
|
+
let at = route(host, path, env);
|
|
885
|
+
if (!at.space || platform(host, path, env) || previews(path) || spaceDoor(path)) return false;
|
|
886
|
+
return queryPath(path) || queryPath(at.path);
|
|
887
|
+
};
|
|
888
|
+
/** A store query at the app-relative address, with or without a page token. */ export let queryPath = (path)=>/^(?:\/~[^/]+)?\/api\/query$/.test(path);
|
|
889
|
+
/** A private binding response asking the front to send the original request
|
|
890
|
+
* to the kernel, where the address belongs to a different door. */ export let QUERY_PASS = 'x-yak-query-pass';
|
|
891
|
+
// The pages of ours at other addresses that ask the sign-in door for a code
|
|
892
|
+
// (D-138669): yak.sh's "Get set up on yaks.app" section posts the address
|
|
893
|
+
// typed there, and gets the letter any sign-in gets (signin.ts `codeLetter`).
|
|
894
|
+
export let ASKERS = [
|
|
895
|
+
'yak.sh'
|
|
896
|
+
];
|
|
897
|
+
// Whether a request's `Origin` is one of {@link ASKERS}.
|
|
898
|
+
let asker = (origin)=>{
|
|
899
|
+
try {
|
|
900
|
+
return ASKERS.includes(new URL(origin ?? '').hostname.toLowerCase());
|
|
901
|
+
} catch {
|
|
902
|
+
return false;
|
|
903
|
+
}
|
|
904
|
+
};
|
|
905
|
+
// The second door a page elsewhere may reach, opened the way the first is,
|
|
906
|
+
// with the credentials taken off (`admitted`): asking for a
|
|
907
|
+
// code reads no cookie, and answers a page exactly what it answers curl. Only
|
|
908
|
+
// for {@link ASKERS}, so no other page can spread its asks over its visitors'
|
|
909
|
+
// addresses.
|
|
910
|
+
export let askable = (method, pathname, origin)=>method == 'POST' && pathname == '/login' && asker(origin);
|
|
911
|
+
// A sandboxed app's page asking its own doors (./installs.ts, D-37901): the
|
|
912
|
+
// path carries its page token as `/<app>/~<token>/…`, or `/~<token>/…` for a
|
|
913
|
+
// front page or an app on its own domain. Such a page has an opaque origin,
|
|
914
|
+
// so it sends `Origin: null`, which `sameOrigin` refuses — and it should,
|
|
915
|
+
// everywhere a cookie could ride along. Here none may: the router takes the
|
|
916
|
+
// cookie off before the request is served and marks the answer readable by
|
|
917
|
+
// any origin (`admitted`), because the credential is the token in the URL,
|
|
918
|
+
// which no browser attaches on its own. What the token opens is the one app
|
|
919
|
+
// it was sealed for; every other request on such a path is anonymous. A
|
|
920
|
+
// draft's preview link is read the same way: its ticket is its path's
|
|
921
|
+
// (`previews`).
|
|
922
|
+
export let paged = (pathname)=>/^(?:\/[^/]+)?\/~[^/]+(?:\/|$)/.test(pathname) || previews(pathname);
|
|
923
|
+
/** The segment under an app its drafts' preview links are mounted at
|
|
924
|
+
* (@yaks/platform/preview `mountOf`). */ export let PREVIEW = '_preview';
|
|
925
|
+
let PREVIEWS = new RegExp(`^/[^/]+/(?:${PREVIEW}|~[a-z0-9]{12})(?:/|$)`);
|
|
926
|
+
/** Whether `pathname` is under an app's preview links, which the platform
|
|
927
|
+
* answers and no app routes: a sealed ticket's under {@link PREVIEW}, or a
|
|
928
|
+
* stored link's `/<app>/~<code>/`, twelve letters and digits
|
|
929
|
+
* (@yaks/platform/preview `CODE`), which a page token, sealed `<body>.<mac>`,
|
|
930
|
+
* never is. */ /// previews('/cookbook/_preview/t/about') -> true
|
|
931
|
+
/// previews('/cookbook/_preview') -> true
|
|
932
|
+
/// previews('/cookbook/~k3f9x2ab7q1z/about') -> true
|
|
933
|
+
/// previews('/cookbook/~k3f9x2ab7q1z') -> true
|
|
934
|
+
/// previews('/cookbook/~abc.def/') -> false
|
|
935
|
+
/// previews('/cookbook/_previews/') -> false
|
|
936
|
+
/// previews('/_preview/t/') -> false
|
|
937
|
+
export let previews = (pathname)=>PREVIEWS.test(pathname);
|
|
938
|
+
/** The preview page and its assets have their own response deadline. */ export let previewRead = (req)=>{
|
|
939
|
+
if (![
|
|
940
|
+
'GET',
|
|
941
|
+
'HEAD'
|
|
942
|
+
].includes(req.method) || req.headers.has('upgrade')) {
|
|
943
|
+
return false;
|
|
944
|
+
}
|
|
945
|
+
let path = new URL(req.url).pathname;
|
|
946
|
+
let [, , marker, first, afterTicket] = path.split('/', 5);
|
|
947
|
+
return previews(path) && (marker == PREVIEW ? afterTicket : first) != 'api';
|
|
948
|
+
};
|
|
949
|
+
export let previewWait = {
|
|
950
|
+
kernel: 10_000,
|
|
951
|
+
front: 12_000
|
|
952
|
+
};
|
|
953
|
+
let RETRY = 2;
|
|
954
|
+
/** A request a browser shows as a page, in a tab or a frame. */ let shown = (req)=>{
|
|
955
|
+
let dest = req.headers.get('sec-fetch-dest');
|
|
956
|
+
return dest ? dest == 'document' || dest == 'iframe' : !!req.headers.get('accept')?.includes('text/html');
|
|
957
|
+
};
|
|
958
|
+
/** A preview that cannot answer yet says so and when to ask again. A page
|
|
959
|
+
* asks again on its own, so a person who opened the link while it was being
|
|
960
|
+
* built, or while a store restarted, sees it arrive without reloading. */ export let previewWaiting = (req, preparing = false)=>{
|
|
961
|
+
let said = preparing ? 'This preview is still preparing.' : 'This preview is temporarily unavailable.';
|
|
962
|
+
let page = shown(req);
|
|
963
|
+
let body = page ? `<!doctype html><meta charset="utf-8"><meta http-equiv="refresh" content="${RETRY}"><title>Preview</title><p>${said} This page tries again in a moment.</p>` : `${said} Try again shortly.`;
|
|
964
|
+
return new Response(req.method == 'HEAD' ? null : body, {
|
|
965
|
+
status: preparing ? 202 : 503,
|
|
966
|
+
headers: {
|
|
967
|
+
'cache-control': 'private, no-store',
|
|
968
|
+
'content-type': page ? 'text/html; charset=utf-8' : 'text/plain; charset=utf-8',
|
|
969
|
+
'referrer-policy': 'no-referrer',
|
|
970
|
+
'retry-after': String(RETRY)
|
|
971
|
+
}
|
|
972
|
+
});
|
|
973
|
+
};
|
|
974
|
+
/** The connector and app or platform API doors answer failures as JSON. */ export let jsonDoor = (path)=>path == '/mcp' || /^(?:\/[^/]+)?\/api\//.test(path);
|
|
975
|
+
/** A request waiting for a response reached its deadline. */ export let timedOut = (req)=>{
|
|
976
|
+
let message = 'This request took too long. Try again shortly.';
|
|
977
|
+
let init = {
|
|
978
|
+
status: 504,
|
|
979
|
+
headers: {
|
|
980
|
+
'cache-control': 'no-store'
|
|
981
|
+
}
|
|
982
|
+
};
|
|
983
|
+
return jsonDoor(new URL(req.url).pathname) ? Response.json({
|
|
984
|
+
error: {
|
|
985
|
+
code: 'timeout',
|
|
986
|
+
message
|
|
987
|
+
}
|
|
988
|
+
}, init) : new Response(message, init);
|
|
989
|
+
};
|
|
990
|
+
// One page, one address: a doubled slash (`/printbound//refund`, from a typed
|
|
991
|
+
// link or a crawler's join) names the page its single slash names. Collapsed
|
|
992
|
+
// before anything routes on it, no part below and no app's code ever reads a
|
|
993
|
+
// path that starts `//`, which `new URL` takes for a host and throws on
|
|
994
|
+
// (T-153266, T-153429).
|
|
995
|
+
let collapsedPath = (path)=>path.replace(/\/{2,}/g, '/');
|
|
996
|
+
export let collapsed = (req)=>{
|
|
997
|
+
let url = new URL(req.url);
|
|
998
|
+
let path = collapsedPath(url.pathname);
|
|
999
|
+
if (path == url.pathname) return req;
|
|
1000
|
+
url.pathname = path;
|
|
1001
|
+
return new Request(url, req);
|
|
1002
|
+
};
|
|
1003
|
+
// Headers taken off a request before it is served.
|
|
1004
|
+
let without = (req, names)=>{
|
|
1005
|
+
if (!names.some((n)=>req.headers.has(n))) return req;
|
|
1006
|
+
let headers = new Headers(req.headers);
|
|
1007
|
+
for (let n of names)headers.delete(n);
|
|
1008
|
+
return new Request(req, {
|
|
1009
|
+
headers
|
|
1010
|
+
});
|
|
1011
|
+
};
|
|
1012
|
+
/** A request with the headers only the router writes ({@link MOUNT},
|
|
1013
|
+
* {@link ADDRESS}, {@link API_AT}) taken off: whatever a client sent under
|
|
1014
|
+
* those names is gone before anything reads it. */ export let unmounted = (req)=>without(req, [
|
|
1015
|
+
MOUNT,
|
|
1016
|
+
ADDRESS,
|
|
1017
|
+
API_AT
|
|
1018
|
+
]);
|
|
1019
|
+
// A page on somebody else's address, writing or at one of our graph doors
|
|
1020
|
+
// (`sameOrigin`, `guarded`). It is refused in the shape every other api
|
|
1021
|
+
// refusal has — a code the page's code reads, a sentence its person reads —
|
|
1022
|
+
// and it is a deliberate no, so nothing is filed about it.
|
|
1023
|
+
let stranger = ()=>Response.json({
|
|
1024
|
+
error: {
|
|
1025
|
+
code: 'foreign_origin',
|
|
1026
|
+
message: 'that page is at another address and cannot use this door'
|
|
1027
|
+
}
|
|
1028
|
+
}, {
|
|
1029
|
+
status: 403
|
|
1030
|
+
});
|
|
1031
|
+
// The question a browser asks before a sandboxed page's JSON write or its
|
|
1032
|
+
// upload: yes, from anywhere, with the headers it named. No credentials are
|
|
1033
|
+
// allowed and none are read, so there is nothing an origin could add.
|
|
1034
|
+
let preflight = (req)=>new Response(null, {
|
|
1035
|
+
status: 204,
|
|
1036
|
+
headers: {
|
|
1037
|
+
'access-control-allow-origin': '*',
|
|
1038
|
+
'access-control-allow-methods': 'GET, HEAD, POST, PUT, DELETE',
|
|
1039
|
+
'access-control-allow-headers': req.headers.get('access-control-request-headers') ?? '',
|
|
1040
|
+
'access-control-max-age': '86400'
|
|
1041
|
+
}
|
|
1042
|
+
});
|
|
1043
|
+
/**
|
|
1044
|
+
* Space isolation, and the one place it holds (`sameOrigin`). It is asked
|
|
1045
|
+
* before a custom domain's request is carried to its place on our zone
|
|
1046
|
+
* (`aim`), because what must match is what the browser addressed: a page at
|
|
1047
|
+
* `herbusiness.com` asking its own `/api/…` is same-origin even though the
|
|
1048
|
+
* router is about to carry the request to `<space>.yaks.app/<app>/api/…`.
|
|
1049
|
+
*
|
|
1050
|
+
* One door is open to every page anyway: the app's read door, asked with
|
|
1051
|
+
* GET, served with the credentials stripped off and marked readable by any
|
|
1052
|
+
* origin (`shared`). So is asking for a sign-in code, to the pages of ours
|
|
1053
|
+
* that ask for one (`askable`). And a sandboxed app's page, on the path that
|
|
1054
|
+
* carries its token: its origin is opaque, so it is a stranger to every
|
|
1055
|
+
* page, and its request is served with no cookie at all (`paged`).
|
|
1056
|
+
*
|
|
1057
|
+
* The credentials go together because neither half is safe alone: an answer
|
|
1058
|
+
* marked readable by any origin must be an answer no session was used to
|
|
1059
|
+
* compute. The cookie is the whole of the ambient credential an app's door
|
|
1060
|
+
* reads, and `authorization` goes with it, so that the day a door reads one
|
|
1061
|
+
* it cannot arrive through here.
|
|
1062
|
+
*
|
|
1063
|
+
* ```ts
|
|
1064
|
+
* import { admitted } from '@yaks/platform/routes'
|
|
1065
|
+
* import { assertEquals } from '@std/assert'
|
|
1066
|
+
* let post = new Request('https://ada.yaks.app/menu/api/apply', {
|
|
1067
|
+
* method: 'POST',
|
|
1068
|
+
* headers: { origin: 'https://bob.yaks.app' },
|
|
1069
|
+
* })
|
|
1070
|
+
* let got = admitted(post, 'ada.yaks.app')
|
|
1071
|
+
* assertEquals('answer' in got && got.answer.status, 403)
|
|
1072
|
+
* ```
|
|
1073
|
+
*/ export let admitted = (req, host, env = {})=>{
|
|
1074
|
+
let asked = new URL(req.url).pathname;
|
|
1075
|
+
let origin = req.headers.get('origin');
|
|
1076
|
+
if (paged(asked)) {
|
|
1077
|
+
return req.method == 'OPTIONS' ? {
|
|
1078
|
+
answer: preflight(req)
|
|
1079
|
+
} : {
|
|
1080
|
+
req: without(req, [
|
|
1081
|
+
'cookie'
|
|
1082
|
+
]),
|
|
1083
|
+
anyone: true
|
|
1084
|
+
};
|
|
1085
|
+
}
|
|
1086
|
+
if (!guarded(req) || sameOrigin(host, origin, env, req.headers.get('sec-fetch-site'))) {
|
|
1087
|
+
return {
|
|
1088
|
+
req,
|
|
1089
|
+
anyone: false
|
|
1090
|
+
};
|
|
1091
|
+
}
|
|
1092
|
+
if (!shared(req.method, asked) && !askable(req.method, asked, origin)) {
|
|
1093
|
+
return {
|
|
1094
|
+
answer: stranger()
|
|
1095
|
+
};
|
|
1096
|
+
}
|
|
1097
|
+
return {
|
|
1098
|
+
req: without(req, [
|
|
1099
|
+
'cookie',
|
|
1100
|
+
'authorization'
|
|
1101
|
+
]),
|
|
1102
|
+
anyone: true
|
|
1103
|
+
};
|
|
1104
|
+
};
|
|
1105
|
+
/**
|
|
1106
|
+
* The mark on an answer {@link admitted} served to any page. The wildcard,
|
|
1107
|
+
* never the asking origin, and no `Access-Control-Allow-Credentials`: a
|
|
1108
|
+
* browser refuses to send a credentialed request to `*`, so the pair is a
|
|
1109
|
+
* promise the browser itself enforces, and echoing the origin back would let
|
|
1110
|
+
* a future mistake add credentials to it.
|
|
1111
|
+
*
|
|
1112
|
+
* `Vary: Origin` because the same URL answers differently to the page that
|
|
1113
|
+
* owns it. No shared cache may sit in front of such an answer: a Workers
|
|
1114
|
+
* cache key holds the path and not the hostname, so
|
|
1115
|
+
* `alice.yaks.app/recipes/api/query?x` and bob's would be one entry.
|
|
1116
|
+
*/ export let cors = (res)=>{
|
|
1117
|
+
if (res.status == 101) return res;
|
|
1118
|
+
let headers = new Headers(res.headers);
|
|
1119
|
+
headers.set('access-control-allow-origin', '*');
|
|
1120
|
+
headers.append('vary', 'origin');
|
|
1121
|
+
return new Response(res.body, {
|
|
1122
|
+
status: res.status,
|
|
1123
|
+
statusText: res.statusText,
|
|
1124
|
+
headers
|
|
1125
|
+
});
|
|
1126
|
+
};
|
|
1127
|
+
/// firstOf({first: '["/recipes/*"]'}) -> ['/recipes/*']
|
|
1128
|
+
/// firstOf(undefined) -> []
|
|
1129
|
+
/// firstOf({first: 'not json'}) -> []
|
|
1130
|
+
/**
|
|
1131
|
+
* The property as the App row reads it (directory.ts `appOf`): the JSON array
|
|
1132
|
+
* in `home.first`, or nothing at all. Lenient where the Worker's `globs` is strict — a
|
|
1133
|
+
* read must answer whatever the row holds, since the graph tier writes this
|
|
1134
|
+
* property too, and a listing must not fall over on one somebody typed by hand.
|
|
1135
|
+
*/ export let firstOf = (home)=>{
|
|
1136
|
+
try {
|
|
1137
|
+
let held = JSON.parse(home?.first || '[]');
|
|
1138
|
+
return Array.isArray(held) ? held.filter((g)=>typeof g == 'string') : [];
|
|
1139
|
+
} catch {
|
|
1140
|
+
return [];
|
|
1141
|
+
}
|
|
1142
|
+
};
|
|
1143
|
+
//# sourceMappingURL=routes.js.map
|