@mountaya/studio 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +69 -0
- package/LICENCE.fr.txt +280 -0
- package/LICENSE.txt +262 -0
- package/README.md +917 -2
- package/dist/agent/index.cjs +2600 -0
- package/dist/agent/index.cjs.map +1 -0
- package/dist/agent/index.d.cts +1237 -0
- package/dist/agent/index.d.ts +1237 -0
- package/dist/agent/index.js +2581 -0
- package/dist/agent/index.js.map +1 -0
- package/dist/chunk-3Oi_Zrtm.js +9 -0
- package/dist/chunk-3Oi_Zrtm.js.map +1 -0
- package/dist/chunk-B18OPIu_.js +6 -0
- package/dist/chunk-B18OPIu_.js.map +1 -0
- package/dist/chunk-B5Uz3Qct.cjs +15 -0
- package/dist/chunk-B5Uz3Qct.cjs.map +1 -0
- package/dist/chunk-BBEJwkd3.d.cts +839 -0
- package/dist/chunk-BIEc_SkR.cjs +29 -0
- package/dist/chunk-BIEc_SkR.cjs.map +1 -0
- package/dist/chunk-BKMFOe-N.js +171 -0
- package/dist/chunk-BKMFOe-N.js.map +1 -0
- package/dist/chunk-BP4uy7E1.d.ts +11583 -0
- package/dist/chunk-BSHTsFiB.js +1403 -0
- package/dist/chunk-BSHTsFiB.js.map +1 -0
- package/dist/chunk-BTUUABGI.js +17 -0
- package/dist/chunk-BTUUABGI.js.map +1 -0
- package/dist/chunk-BaPiaz5X.cjs +115 -0
- package/dist/chunk-BaPiaz5X.cjs.map +1 -0
- package/dist/chunk-BeCVpkYr.cjs +542 -0
- package/dist/chunk-BeCVpkYr.cjs.map +1 -0
- package/dist/chunk-BgngsvK8.cjs +6202 -0
- package/dist/chunk-BgngsvK8.cjs.map +1 -0
- package/dist/chunk-BhInd7CJ.d.cts +253 -0
- package/dist/chunk-Bn6ZbxkS.cjs +27 -0
- package/dist/chunk-By9ZnkVI.js +60 -0
- package/dist/chunk-By9ZnkVI.js.map +1 -0
- package/dist/chunk-BzqPhxsz.cjs +367 -0
- package/dist/chunk-BzqPhxsz.cjs.map +1 -0
- package/dist/chunk-C2mMX81q.d.ts +443 -0
- package/dist/chunk-C2rr9Q0V.cjs +1402 -0
- package/dist/chunk-C2rr9Q0V.cjs.map +1 -0
- package/dist/chunk-CDJCbwIQ.d.cts +78 -0
- package/dist/chunk-CLGvBOVH.d.cts +1654 -0
- package/dist/chunk-COdw1dc6.d.ts +525 -0
- package/dist/chunk-CQCJnT2i.d.ts +511 -0
- package/dist/chunk-CSyHY67q.cjs +353 -0
- package/dist/chunk-CSyHY67q.cjs.map +1 -0
- package/dist/chunk-CiK1Iqrv.js +950 -0
- package/dist/chunk-CiK1Iqrv.js.map +1 -0
- package/dist/chunk-CmJBgSwZ.cjs +24 -0
- package/dist/chunk-CmJBgSwZ.cjs.map +1 -0
- package/dist/chunk-CnrsRK2u.cjs +83 -0
- package/dist/chunk-CnrsRK2u.cjs.map +1 -0
- package/dist/chunk-Co782_9r.js +326 -0
- package/dist/chunk-Co782_9r.js.map +1 -0
- package/dist/chunk-Csr3KDpZ.cjs +32 -0
- package/dist/chunk-Csr3KDpZ.cjs.map +1 -0
- package/dist/chunk-CwkmccXv.js +89 -0
- package/dist/chunk-CwkmccXv.js.map +1 -0
- package/dist/chunk-D0Q4iL9B.cjs +255 -0
- package/dist/chunk-D0Q4iL9B.cjs.map +1 -0
- package/dist/chunk-DFwiSzUS.cjs +72 -0
- package/dist/chunk-DFwiSzUS.cjs.map +1 -0
- package/dist/chunk-DIFayl2P.d.cts +443 -0
- package/dist/chunk-DIGF58ux.d.cts +525 -0
- package/dist/chunk-DKuuuld5.js +101 -0
- package/dist/chunk-DKuuuld5.js.map +1 -0
- package/dist/chunk-DMePkFEo.js +5054 -0
- package/dist/chunk-DMePkFEo.js.map +1 -0
- package/dist/chunk-DO5SIBgu.js +305 -0
- package/dist/chunk-DO5SIBgu.js.map +1 -0
- package/dist/chunk-DOQ_7eE5.d.ts +6662 -0
- package/dist/chunk-DThaaNeb.d.cts +15 -0
- package/dist/chunk-DThaaNeb.d.ts +15 -0
- package/dist/chunk-DUQzjUJy.d.ts +78 -0
- package/dist/chunk-DX37IPhV.cjs +1903 -0
- package/dist/chunk-DX37IPhV.cjs.map +1 -0
- package/dist/chunk-Damps5Tk.cjs +155 -0
- package/dist/chunk-Damps5Tk.cjs.map +1 -0
- package/dist/chunk-DbK5PhpJ.d.ts +1654 -0
- package/dist/chunk-De0vAASv.d.ts +253 -0
- package/dist/chunk-DhSZ7YZt.d.cts +6662 -0
- package/dist/chunk-DjEvqvPA.cjs +43 -0
- package/dist/chunk-DjEvqvPA.cjs.map +1 -0
- package/dist/chunk-DkwDzwvu.d.cts +121 -0
- package/dist/chunk-DkwDzwvu.d.ts +121 -0
- package/dist/chunk-Dmszv9If.js +71 -0
- package/dist/chunk-Dmszv9If.js.map +1 -0
- package/dist/chunk-Dp_ftNWY.d.cts +511 -0
- package/dist/chunk-DsHQySz0.js +31 -0
- package/dist/chunk-DsHQySz0.js.map +1 -0
- package/dist/chunk-DwoUyHHh.js +281 -0
- package/dist/chunk-DwoUyHHh.js.map +1 -0
- package/dist/chunk-IaIDQflj.d.cts +2315 -0
- package/dist/chunk-IaIDQflj.d.ts +2315 -0
- package/dist/chunk-cVXLsZfL.d.ts +839 -0
- package/dist/chunk-mIaCX9EJ.d.cts +11583 -0
- package/dist/chunk-nJQxbOwQ.cjs +8962 -0
- package/dist/chunk-nJQxbOwQ.cjs.map +1 -0
- package/dist/chunk-o9jaxhCO.js +8852 -0
- package/dist/chunk-o9jaxhCO.js.map +1 -0
- package/dist/chunk-p-Tt_Lwz.js +14 -0
- package/dist/chunk-p-Tt_Lwz.js.map +1 -0
- package/dist/engines/index.cjs +2091 -0
- package/dist/engines/index.cjs.map +1 -0
- package/dist/engines/index.d.cts +2176 -0
- package/dist/engines/index.d.ts +2176 -0
- package/dist/engines/index.js +2075 -0
- package/dist/engines/index.js.map +1 -0
- package/dist/handlers/index.cjs +53 -0
- package/dist/handlers/index.cjs.map +1 -0
- package/dist/handlers/index.d.cts +403 -0
- package/dist/handlers/index.d.ts +403 -0
- package/dist/handlers/index.js +33 -0
- package/dist/handlers/index.js.map +1 -0
- package/dist/index.cjs +3511 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +8 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +3033 -0
- package/dist/index.js.map +1 -0
- package/dist/plugins/index.cjs +510 -0
- package/dist/plugins/index.cjs.map +1 -0
- package/dist/plugins/index.d.cts +296 -0
- package/dist/plugins/index.d.ts +296 -0
- package/dist/plugins/index.js +489 -0
- package/dist/plugins/index.js.map +1 -0
- package/dist/seams/index.cjs +89 -0
- package/dist/seams/index.cjs.map +1 -0
- package/dist/seams/index.d.cts +452 -0
- package/dist/seams/index.d.ts +452 -0
- package/dist/seams/index.js +49 -0
- package/dist/seams/index.js.map +1 -0
- package/dist/strings/fr/index.cjs +2135 -0
- package/dist/strings/fr/index.cjs.map +1 -0
- package/dist/strings/fr/index.d.cts +17 -0
- package/dist/strings/fr/index.d.ts +17 -0
- package/dist/strings/fr/index.js +2130 -0
- package/dist/strings/fr/index.js.map +1 -0
- package/dist/strings/index.cjs +2384 -0
- package/dist/strings/index.cjs.map +1 -0
- package/dist/strings/index.d.cts +3 -0
- package/dist/strings/index.d.ts +3 -0
- package/dist/strings/index.js +2353 -0
- package/dist/strings/index.js.map +1 -0
- package/dist/testing/index.cjs +230 -0
- package/dist/testing/index.cjs.map +1 -0
- package/dist/testing/index.d.cts +246 -0
- package/dist/testing/index.d.ts +246 -0
- package/dist/testing/index.js +219 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/time/index.cjs +28 -0
- package/dist/time/index.cjs.map +1 -0
- package/dist/time/index.d.cts +41 -0
- package/dist/time/index.d.ts +41 -0
- package/dist/time/index.js +23 -0
- package/dist/time/index.js.map +1 -0
- package/package.json +224 -4
- package/src/agent/engines/agentThreads.ts +1601 -0
- package/src/agent/engines/directorChat.ts +500 -0
- package/src/agent/index.ts +67 -0
- package/src/agent/rules/agentEditLock.ts +115 -0
- package/src/agent/rules/agentErrorCopy.ts +44 -0
- package/src/agent/rules/copilotOrganization.ts +36 -0
- package/src/agent/rules/playbook.gen.ts +444 -0
- package/src/agent/rules/router.ts +518 -0
- package/src/agent/rules/stateDelta.ts +29 -0
- package/src/agent/rules/studioRouter.ts +123 -0
- package/src/agent/rules/surfaces.gen.ts +633 -0
- package/src/agent/rules/threadsUrl.ts +48 -0
- package/src/agent/rules/transcriptObserver.ts +90 -0
- package/src/agent/stores/agentThreads.ts +451 -0
- package/src/bus/contracts/noData.ts +18 -0
- package/src/bus/contracts/shared.ts +172 -0
- package/src/bus/contracts/studioTools.ts +224 -0
- package/src/bus/rules/bus.ts +857 -0
- package/src/bus/rules/confirmation.ts +22 -0
- package/src/bus/rules/defineRegistry.ts +24 -0
- package/src/bus/rules/errors.ts +401 -0
- package/src/bus/rules/handlerErrors.ts +103 -0
- package/src/bus/rules/handlerRegistry.ts +627 -0
- package/src/bus/rules/inputSchema.ts +232 -0
- package/src/bus/rules/invalidInput.ts +441 -0
- package/src/bus/rules/lateBoundTools.ts +100 -0
- package/src/bus/rules/studioRegistry.ts +324 -0
- package/src/bus/rules/studioToolBus.ts +73 -0
- package/src/bus/rules/types.ts +804 -0
- package/src/chrome/contracts/alert.ts +42 -0
- package/src/chrome/contracts/itinerary.ts +26 -0
- package/src/chrome/contracts/map.ts +23 -0
- package/src/chrome/contracts/overlay.ts +46 -0
- package/src/chrome/contracts/panel.ts +29 -0
- package/src/chrome/contracts/question.ts +52 -0
- package/src/chrome/contracts/selection.ts +26 -0
- package/src/chrome/contracts/sidenav.ts +23 -0
- package/src/chrome/contracts/snapshot.ts +319 -0
- package/src/chrome/contracts/state.ts +22 -0
- package/src/chrome/contracts/tabs.ts +56 -0
- package/src/chrome/handlers/alert.ts +91 -0
- package/src/chrome/handlers/introspection.ts +180 -0
- package/src/chrome/handlers/panels.ts +42 -0
- package/src/chrome/handlers/question.ts +24 -0
- package/src/chrome/handlers/sidenav.ts +116 -0
- package/src/chrome/handlers/snapshot.ts +451 -0
- package/src/chrome/handlers/stateDelta.ts +125 -0
- package/src/chrome/handlers/tabs.ts +143 -0
- package/src/chrome/handlers/timestamp.ts +19 -0
- package/src/chrome/rules/agentSelectors.ts +210 -0
- package/src/chrome/rules/mapAlert.ts +13 -0
- package/src/chrome/rules/question.ts +25 -0
- package/src/chrome/rules/tabs.ts +13 -0
- package/src/chrome/stores/activeDraftSession.ts +134 -0
- package/src/chrome/stores/chrome.ts +527 -0
- package/src/chrome/stores/uiStore.ts +575 -0
- package/src/collab/contracts/collab.ts +261 -0
- package/src/collab/handlers/collab.ts +468 -0
- package/src/collab/rules/toolNames.ts +33 -0
- package/src/collab/stores/collab.ts +899 -0
- package/src/collections/contracts/collection.ts +182 -0
- package/src/collections/handlers/collectionAttach.ts +141 -0
- package/src/collections/handlers/collections.ts +499 -0
- package/src/collections/handlers/heldCollection.ts +42 -0
- package/src/collections/handlers/restCollections.ts +386 -0
- package/src/collections/rules/collections.ts +138 -0
- package/src/collections/rules/entityCollections.ts +53 -0
- package/src/collections/stores/collections.ts +133 -0
- package/src/data/contracts/data.ts +233 -0
- package/src/data/contracts/itinerary.ts +71 -0
- package/src/data/handlers/activityResolve.ts +76 -0
- package/src/data/handlers/data.ts +200 -0
- package/src/data/handlers/graphql.ts +26 -0
- package/src/data/handlers/mutationSink.ts +1577 -0
- package/src/data/handlers/profile.ts +83 -0
- package/src/data/handlers/writeThrough.ts +417 -0
- package/src/data/rules/cache.ts +181 -0
- package/src/data/rules/dataTypes.ts +40 -0
- package/src/data/rules/keys.ts +106 -0
- package/src/data/rules/persistence.ts +1058 -0
- package/src/data/rules/requestBody.ts +43 -0
- package/src/data/rules/restErrors.ts +354 -0
- package/src/data/rules/sessionSurface.ts +156 -0
- package/src/data/rules/toolResultData.ts +73 -0
- package/src/data/rules/uuid.ts +24 -0
- package/src/edit/contracts/edit.ts +37 -0
- package/src/edit/contracts/itinerary.ts +57 -0
- package/src/edit/handlers/draftCommit.ts +257 -0
- package/src/edit/handlers/editDiscard.ts +34 -0
- package/src/edit/handlers/editLock.ts +949 -0
- package/src/edit/handlers/editor.ts +203 -0
- package/src/edit/handlers/formUnsaved.ts +24 -0
- package/src/edit/rules/draftMetadata.ts +117 -0
- package/src/edit/rules/editKeyboard.ts +222 -0
- package/src/edit/rules/editShortcuts.ts +102 -0
- package/src/edit/rules/editTooltip.ts +174 -0
- package/src/edit/rules/editorTaken.ts +49 -0
- package/src/edit/rules/history.ts +26 -0
- package/src/edit/rules/unsavedWork.ts +60 -0
- package/src/edit/stores/editorReservation.ts +70 -0
- package/src/edit/stores/formsUnsaved.ts +54 -0
- package/src/embed/contracts/embed.ts +48 -0
- package/src/embed/engines/embedFraming.ts +1329 -0
- package/src/embed/engines/embedReady.ts +353 -0
- package/src/embed/engines/framingPageSession.ts +169 -0
- package/src/embed/handlers/embed.ts +130 -0
- package/src/embed/rules/allowedDomains.ts +71 -0
- package/src/embed/rules/bridgeMessages.ts +224 -0
- package/src/embed/rules/defaults.ts +173 -0
- package/src/embed/rules/displaySeed.ts +115 -0
- package/src/embed/rules/embedAllowlist.ts +146 -0
- package/src/embed/rules/embedConstraints.ts +215 -0
- package/src/embed/rules/embedElements.ts +277 -0
- package/src/embed/rules/embedSectionFields.ts +126 -0
- package/src/embed/rules/embedSecurity.ts +116 -0
- package/src/embed/rules/fieldDependencies.ts +89 -0
- package/src/embed/rules/fieldOptions.ts +138 -0
- package/src/embed/rules/layerOptions.ts +161 -0
- package/src/embed/rules/readyProtocol.ts +66 -0
- package/src/embed/rules/safetyRules.ts +215 -0
- package/src/embed/rules/snippet.ts +531 -0
- package/src/embed/rules/tableCode.ts +270 -0
- package/src/embed/stores/embed.ts +60 -0
- package/src/embed/stores/embedContent.ts +77 -0
- package/src/engines/index.ts +81 -0
- package/src/handlers/index.ts +66 -0
- package/src/index.ts +1065 -0
- package/src/itinerary/contracts/itinerary.ts +705 -0
- package/src/itinerary/engines/itineraryPace.ts +612 -0
- package/src/itinerary/engines/profileMarker.ts +238 -0
- package/src/itinerary/handlers/importStaging.ts +352 -0
- package/src/itinerary/handlers/itinerary.ts +572 -0
- package/src/itinerary/handlers/itineraryDuplicate.ts +177 -0
- package/src/itinerary/handlers/itineraryExport.ts +117 -0
- package/src/itinerary/handlers/itineraryImport.ts +783 -0
- package/src/itinerary/handlers/itineraryPublish.ts +118 -0
- package/src/itinerary/handlers/itinerarySelection.ts +354 -0
- package/src/itinerary/handlers/itinerarySuggest.ts +1186 -0
- package/src/itinerary/handlers/itineraryUnpublish.ts +101 -0
- package/src/itinerary/handlers/publicationScope.ts +118 -0
- package/src/itinerary/handlers/restItineraries.ts +752 -0
- package/src/itinerary/handlers/restItineraryExport.ts +70 -0
- package/src/itinerary/handlers/restItineraryImport.ts +311 -0
- package/src/itinerary/handlers/restItineraryPace.ts +87 -0
- package/src/itinerary/handlers/restItineraryRecord.ts +36 -0
- package/src/itinerary/handlers/suggestParams.ts +379 -0
- package/src/itinerary/handlers/suggestStaging.ts +363 -0
- package/src/itinerary/handlers/surfaceOpen.ts +389 -0
- package/src/itinerary/rules/activity.ts +139 -0
- package/src/itinerary/rules/analysis.ts +42 -0
- package/src/itinerary/rules/ceiling.ts +49 -0
- package/src/itinerary/rules/createFlow.ts +107 -0
- package/src/itinerary/rules/densify.ts +440 -0
- package/src/itinerary/rules/draftSurface.ts +219 -0
- package/src/itinerary/rules/editorView.ts +83 -0
- package/src/itinerary/rules/export.ts +159 -0
- package/src/itinerary/rules/friendlyName.ts +77 -0
- package/src/itinerary/rules/import.ts +1050 -0
- package/src/itinerary/rules/importFiles.ts +140 -0
- package/src/itinerary/rules/importTotals.ts +77 -0
- package/src/itinerary/rules/liveSegment.ts +712 -0
- package/src/itinerary/rules/lngLat.ts +17 -0
- package/src/itinerary/rules/mapSync.ts +100 -0
- package/src/itinerary/rules/previewRender.ts +416 -0
- package/src/itinerary/rules/profileReadout.ts +216 -0
- package/src/itinerary/rules/routing.ts +707 -0
- package/src/itinerary/rules/suggest.ts +522 -0
- package/src/itinerary/rules/suggestionPreview.ts +119 -0
- package/src/itinerary/rules/view.ts +61 -0
- package/src/itinerary/stores/importSession.ts +319 -0
- package/src/itinerary/stores/itinerary.ts +331 -0
- package/src/itinerary/stores/itineraryDuplicate.ts +76 -0
- package/src/itinerary/stores/sessionIdentity.ts +43 -0
- package/src/itinerary/stores/suggestSession.ts +418 -0
- package/src/layers/contracts/itinerary.ts +46 -0
- package/src/layers/contracts/overlay.ts +132 -0
- package/src/layers/handlers/enrichment.ts +36 -0
- package/src/layers/handlers/overlay.ts +406 -0
- package/src/layers/handlers/restLayers.ts +94 -0
- package/src/layers/handlers/tiles.ts +25 -0
- package/src/layers/rules/layers.ts +212 -0
- package/src/layers/rules/overlayInstant.ts +12 -0
- package/src/layers/rules/reachabilityIcon.ts +18 -0
- package/src/layers/rules/readout.ts +102 -0
- package/src/layers/stores/layers.ts +262 -0
- package/src/map/contracts/contextmenu.ts +33 -0
- package/src/map/contracts/geolocate.ts +37 -0
- package/src/map/contracts/map.ts +146 -0
- package/src/map/contracts/streetview.ts +53 -0
- package/src/map/contracts/terrain.ts +152 -0
- package/src/map/handlers/contextMenu.ts +135 -0
- package/src/map/handlers/geolocate.ts +52 -0
- package/src/map/handlers/map.ts +391 -0
- package/src/map/handlers/streetview.ts +94 -0
- package/src/map/handlers/terrain.ts +663 -0
- package/src/map/rules/baseTerrain.ts +75 -0
- package/src/map/rules/clickTargets.ts +464 -0
- package/src/map/rules/constraints.ts +32 -0
- package/src/map/rules/contextMenuReadout.ts +67 -0
- package/src/map/rules/coordinates.ts +71 -0
- package/src/map/rules/itineraryFit.ts +8 -0
- package/src/map/rules/mapEvents.ts +64 -0
- package/src/map/rules/mapProjection.ts +476 -0
- package/src/map/rules/terrainReading.ts +62 -0
- package/src/plugins/contracts/ids.ts +66 -0
- package/src/plugins/contracts/plugin.ts +202 -0
- package/src/plugins/contracts/slots.ts +137 -0
- package/src/plugins/engines/studioPlugin.ts +1365 -0
- package/src/plugins/index.ts +111 -0
- package/src/plugins/rules/contributions.ts +152 -0
- package/src/plugins/rules/errors.ts +60 -0
- package/src/plugins/rules/ids.ts +42 -0
- package/src/plugins/rules/validation.ts +249 -0
- package/src/rules/listeners.ts +57 -0
- package/src/rules/origin.ts +13 -0
- package/src/rules/storeWrite.ts +37 -0
- package/src/rules/types.ts +136 -0
- package/src/seams/index.ts +79 -0
- package/src/seams/rules/clock.ts +28 -0
- package/src/seams/rules/formatters.ts +211 -0
- package/src/seams/rules/ids.ts +102 -0
- package/src/seams/rules/links.ts +66 -0
- package/src/seams/rules/navigation.ts +222 -0
- package/src/seams/rules/notify.ts +49 -0
- package/src/seams/rules/persistenceDrawer.ts +220 -0
- package/src/seams/rules/saveFile.ts +101 -0
- package/src/seams/rules/seams.ts +156 -0
- package/src/seams/rules/storage.ts +116 -0
- package/src/search/contracts/overlay.ts +74 -0
- package/src/search/contracts/search.ts +197 -0
- package/src/search/handlers/pois.ts +57 -0
- package/src/search/handlers/search.ts +280 -0
- package/src/search/rules/params.ts +925 -0
- package/src/search/rules/poiGroups.ts +138 -0
- package/src/search/rules/searchFetch.ts +139 -0
- package/src/search/rules/timeWindow.ts +30 -0
- package/src/search/stores/search.ts +51 -0
- package/src/segments/contracts/itinerary.ts +433 -0
- package/src/segments/contracts/segment.ts +35 -0
- package/src/segments/engines/segmentDraft.ts +926 -0
- package/src/segments/handlers/chainGuards.ts +67 -0
- package/src/segments/handlers/directions.ts +44 -0
- package/src/segments/handlers/itineraryEcho.ts +45 -0
- package/src/segments/handlers/roadAccessDialog.ts +34 -0
- package/src/segments/handlers/segment.ts +111 -0
- package/src/segments/handlers/segmentEdit.ts +1341 -0
- package/src/segments/handlers/segmentGroups.ts +347 -0
- package/src/segments/handlers/segmentStructure.ts +1144 -0
- package/src/segments/rules/chain.ts +196 -0
- package/src/segments/rules/chainModel.ts +217 -0
- package/src/segments/rules/colors.ts +11 -0
- package/src/segments/rules/commit.ts +76 -0
- package/src/segments/rules/draft.ts +90 -0
- package/src/segments/rules/draftDisposition.ts +43 -0
- package/src/segments/rules/draftSegmentEdit.ts +129 -0
- package/src/segments/rules/engine.ts +222 -0
- package/src/segments/rules/groupSave.ts +234 -0
- package/src/segments/rules/hazardPrompt.ts +60 -0
- package/src/segments/rules/itineraryEcho.ts +40 -0
- package/src/segments/rules/liveSegmentProjection.ts +55 -0
- package/src/segments/rules/merge.ts +51 -0
- package/src/segments/rules/metrics.ts +456 -0
- package/src/segments/rules/naming.ts +168 -0
- package/src/segments/rules/segmentArming.ts +144 -0
- package/src/segments/rules/splitPick.ts +84 -0
- package/src/segments/rules/viaSimplify.ts +230 -0
- package/src/segments/stores/directions.ts +77 -0
- package/src/segments/stores/roadAccessDialog.ts +58 -0
- package/src/segments/stores/segmentEdit.ts +922 -0
- package/src/segments/stores/segmentGroupEdit.ts +84 -0
- package/src/segments/stores/segmentSplit.ts +77 -0
- package/src/share/contracts/share.ts +39 -0
- package/src/share/contracts/shareLink.ts +63 -0
- package/src/share/engines/shareLink.ts +1053 -0
- package/src/share/handlers/share.ts +47 -0
- package/src/share/handlers/shareLink.ts +231 -0
- package/src/share/handlers/shareScope.ts +54 -0
- package/src/share/rules/link.ts +89 -0
- package/src/share/rules/shareLink.ts +218 -0
- package/src/share/rules/targets.ts +92 -0
- package/src/share/rules/viewConfig.ts +95 -0
- package/src/share/stores/share.ts +58 -0
- package/src/strings/fr/index.ts +18 -0
- package/src/strings/fr/rules/fr.ts +2368 -0
- package/src/strings/index.ts +98 -0
- package/src/strings/rules/confirmCopy.ts +156 -0
- package/src/strings/rules/draftToolNames.ts +94 -0
- package/src/strings/rules/en.ts +2519 -0
- package/src/strings/rules/failureAlert.ts +115 -0
- package/src/strings/rules/formError.ts +400 -0
- package/src/strings/rules/maneuvers.ts +107 -0
- package/src/strings/rules/outputOptions.ts +126 -0
- package/src/strings/rules/publicationState.ts +100 -0
- package/src/strings/rules/routeHazardCopy.ts +62 -0
- package/src/strings/rules/searchLabels.ts +50 -0
- package/src/strings/rules/segmentChainVerbs.ts +62 -0
- package/src/strings/rules/studioCopy.ts +130 -0
- package/src/strings/rules/unitOptions.ts +119 -0
- package/src/testing/checkedBus.ts +226 -0
- package/src/testing/index.ts +30 -0
- package/src/testing/plugins.ts +106 -0
- package/src/testing/studio.ts +267 -0
- package/src/testing/urlSeam.ts +153 -0
- package/src/time/index.ts +12 -0
- package/src/time/rules/sun.ts +78 -0
- package/src/video/contracts/cameraSchemas.ts +266 -0
- package/src/video/contracts/profileSchemas.ts +37 -0
- package/src/video/contracts/video.ts +601 -0
- package/src/video/handlers/video.ts +1638 -0
- package/src/video/handlers/videoDirector.ts +114 -0
- package/src/video/rules/previewRefresh.ts +76 -0
- package/src/video/rules/profileSource.ts +51 -0
- package/src/video/rules/routeSpans.ts +79 -0
- package/src/video/rules/shotDefaults.ts +28 -0
- package/src/video/rules/stepOrder.ts +17 -0
- package/src/video/rules/videoSnapshot.ts +136 -0
- package/src/video/stores/directorThreads.ts +167 -0
- package/src/video/stores/videoExport.ts +290 -0
- package/src/viewer/contracts/preferences.ts +40 -0
- package/src/viewer/handlers/preferences.ts +91 -0
- package/src/viewer/rules/capabilities.ts +42 -0
- package/src/viewer/rules/config.ts +266 -0
- package/src/viewer/rules/context.ts +375 -0
- package/src/viewer/rules/ownership.ts +134 -0
- package/src/viewer/rules/platformViewer.ts +199 -0
- package/src/viewer/rules/scope.ts +197 -0
- package/src/viewer/rules/url.ts +145 -0
- package/src/viewer/rules/viewer.ts +307 -0
- package/src/viewer/rules/viewerSeam.ts +49 -0
- package/src/viewer/rules/viewerUnits.ts +34 -0
- package/src/waypoints/contracts/itinerary.ts +417 -0
- package/src/waypoints/handlers/poiWaypointStyle.ts +32 -0
- package/src/waypoints/handlers/waypointDetailsDialog.ts +38 -0
- package/src/waypoints/handlers/waypointEdit.ts +1073 -0
- package/src/waypoints/rules/amenities.ts +30 -0
- package/src/waypoints/rules/defaults.ts +31 -0
- package/src/waypoints/rules/details.ts +213 -0
- package/src/waypoints/rules/detailsDraft.ts +312 -0
- package/src/waypoints/rules/detailsPreview.ts +76 -0
- package/src/waypoints/rules/detailsSave.ts +356 -0
- package/src/waypoints/rules/draftDirty.ts +45 -0
- package/src/waypoints/rules/icons.ts +32 -0
- package/src/waypoints/rules/liveWaypoint.ts +63 -0
- package/src/waypoints/rules/naming.ts +185 -0
- package/src/waypoints/rules/sections.ts +77 -0
- package/src/waypoints/rules/waypointDraft.ts +62 -0
- package/src/waypoints/stores/waypointDetails.ts +62 -0
- package/src/waypoints/stores/waypointEdit.ts +566 -0
- package/src/zones/contracts/collection.ts +37 -0
- package/src/zones/contracts/zone.ts +528 -0
- package/src/zones/engines/zoneForm.ts +1773 -0
- package/src/zones/handlers/restZones.ts +287 -0
- package/src/zones/handlers/zonePublish.ts +206 -0
- package/src/zones/handlers/zoneUnpublish.ts +56 -0
- package/src/zones/handlers/zones.ts +2254 -0
- package/src/zones/rules/geometry.ts +946 -0
- package/src/zones/rules/zoneDefaults.ts +34 -0
- package/src/zones/rules/zoneDraft.ts +54 -0
- package/src/zones/rules/zoneForm.ts +563 -0
- package/src/zones/rules/zoneMetadata.ts +29 -0
- package/src/zones/rules/zoneSource.ts +87 -0
- package/src/zones/rules/zoneSourceRefusal.ts +104 -0
- package/src/zones/stores/zoneEdit.ts +998 -0
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import type { ToolFailure } from "../../bus/rules/types.js";
|
|
2
|
+
import type { StudioToolContext } from "./context.js";
|
|
3
|
+
import type { StudioScopeSeam } from "./scope.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* canEditOwnedResource reports whether a viewer may edit a resource owned the way a zone or an
|
|
7
|
+
* itinerary is: by the organization it belongs to, or, for a personal resource, by the user who
|
|
8
|
+
* created it.
|
|
9
|
+
*
|
|
10
|
+
* It mirrors the platform's write grant, which has one arm per kind of owner. An organization's
|
|
11
|
+
* resource is edited by a write role in that organization, whoever created it:
|
|
12
|
+
* `writableOrganizationIds` is the set of organizations in which the viewer holds one. Its
|
|
13
|
+
* creator holds nothing more than any other member, so a creator who left the organization, or
|
|
14
|
+
* whose role there reads only, may not edit it. A personal resource belongs to no organization
|
|
15
|
+
* (`organizationId` null), and only its creator may edit it, whatever roles the viewer holds
|
|
16
|
+
* elsewhere.
|
|
17
|
+
*
|
|
18
|
+
* Authorship needs a creator to compare against. A personal resource whose `createdById` is null
|
|
19
|
+
* or undefined was created by nobody the studio can name, so nobody may edit it, a signed-out
|
|
20
|
+
* viewer (an absent `userId`) included: two absent ids are not the same user.
|
|
21
|
+
*
|
|
22
|
+
* A proactive gate, like every read of the viewer on this side of the wire: it decides whether a
|
|
23
|
+
* surface offers the edit, and the platform refuses a write its grant does not cover either way.
|
|
24
|
+
*
|
|
25
|
+
* @param resource - The resource's creator and owning organization, as its record states them.
|
|
26
|
+
* @param userId - The viewer's id, absent for a signed-out viewer.
|
|
27
|
+
* @param writableOrganizationIds - The organizations in which the viewer holds a write role.
|
|
28
|
+
*/
|
|
29
|
+
export const canEditOwnedResource = (
|
|
30
|
+
resource: {
|
|
31
|
+
readonly createdById: string | null | undefined;
|
|
32
|
+
readonly organizationId: string | null | undefined;
|
|
33
|
+
},
|
|
34
|
+
userId: string | null | undefined,
|
|
35
|
+
writableOrganizationIds: ReadonlySet<string>,
|
|
36
|
+
): boolean =>
|
|
37
|
+
resource.organizationId == null
|
|
38
|
+
? resource.createdById != null && resource.createdById === userId
|
|
39
|
+
: writableOrganizationIds.has(resource.organizationId);
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* canEditItinerary reports whether a viewer may edit an itinerary: change its name, its
|
|
43
|
+
* segments, its waypoints, its groups or its publication.
|
|
44
|
+
*
|
|
45
|
+
* Two facts, and both have to hold, as the platform asks both of every such write. The viewer
|
|
46
|
+
* holds the write grant {@link canEditOwnedResource} answers: a write role (an owner, an admin or
|
|
47
|
+
* a contributor) in the organization that owns the itinerary, or, for a personal itinerary, its
|
|
48
|
+
* authorship. And the itinerary's scope takes an itinerary write, as `writeRefusal` answers it:
|
|
49
|
+
* an organization whose agreement does not include Map Studio keeps its itineraries readable,
|
|
50
|
+
* and the editor opens on them read-only. The personal space keeps itineraries, so its author
|
|
51
|
+
* edits one there.
|
|
52
|
+
*
|
|
53
|
+
* Deleting an itinerary and withdrawing its publication ask the grant alone, which is why an
|
|
54
|
+
* organization whose agreement lapsed still takes them: a surface offering those asks
|
|
55
|
+
* {@link canEditOwnedResource} instead.
|
|
56
|
+
*
|
|
57
|
+
* A proactive gate: it decides whether a surface offers the edit, and the platform refuses a
|
|
58
|
+
* write its grant does not cover either way.
|
|
59
|
+
*
|
|
60
|
+
* @param itinerary - The itinerary's creator and owning organization, as its record states them
|
|
61
|
+
* (`created_by.id` and `organization_id`).
|
|
62
|
+
* @param userId - The viewer's id, absent for a signed-out viewer.
|
|
63
|
+
* @param writableOrganizationIds - The organizations in which the viewer holds a write role.
|
|
64
|
+
* @param writeRefusal - Why a scope refuses a write, as the host's scope seam answers it. Left
|
|
65
|
+
* out, every scope takes the write and the grant alone answers.
|
|
66
|
+
* @example
|
|
67
|
+
* ```ts
|
|
68
|
+
* declare const itinerary: Itinerary;
|
|
69
|
+
* declare const userId: string;
|
|
70
|
+
* declare const writableOrgIds: ReadonlySet<string>;
|
|
71
|
+
*
|
|
72
|
+
* const editable = canEditItinerary(
|
|
73
|
+
* { createdById: itinerary.created_by.id, organizationId: itinerary.organization_id },
|
|
74
|
+
* userId,
|
|
75
|
+
* writableOrgIds,
|
|
76
|
+
* );
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
export const canEditItinerary = (
|
|
80
|
+
itinerary: {
|
|
81
|
+
readonly createdById: string | null | undefined;
|
|
82
|
+
readonly organizationId: string | null | undefined;
|
|
83
|
+
},
|
|
84
|
+
userId: string | null | undefined,
|
|
85
|
+
writableOrganizationIds: ReadonlySet<string>,
|
|
86
|
+
writeRefusal?: StudioScopeSeam["writeRefusal"],
|
|
87
|
+
): boolean =>
|
|
88
|
+
canEditOwnedResource(itinerary, userId, writableOrganizationIds) &&
|
|
89
|
+
(writeRefusal?.("itinerary", itinerary.organizationId) ?? null) === null;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* refuseUngrantedItinerary refuses a write on the open itinerary from a reader who holds no
|
|
93
|
+
* write grant on it ({@link canEditOwnedResource}), returning the refusal to return or null to
|
|
94
|
+
* continue. It answers `forbidden`, the code the API's `403` reads as, before anything is sent.
|
|
95
|
+
*
|
|
96
|
+
* It judges only what it can see: the itinerary the store holds open, and a reader whose write
|
|
97
|
+
* roles the context's scope states (`StudioScopeSeam.writable`). A write on another itinerary,
|
|
98
|
+
* and one in a context whose scope states no roles, is refused nothing here: the API decides it.
|
|
99
|
+
*
|
|
100
|
+
* Like every gate of this kind it is a UX and agent-containment gate and NOT the security
|
|
101
|
+
* boundary: the API refuses the same write on the same fact.
|
|
102
|
+
*
|
|
103
|
+
* @param ctx - The context of the verb that writes.
|
|
104
|
+
* @param itineraryId - The itinerary the verb writes.
|
|
105
|
+
*/
|
|
106
|
+
export const refuseUngrantedItinerary = (
|
|
107
|
+
ctx: Pick<StudioToolContext, "scope" | "ui" | "viewer">,
|
|
108
|
+
itineraryId: string,
|
|
109
|
+
): ToolFailure | null => {
|
|
110
|
+
const scope = ctx.scope;
|
|
111
|
+
const writable = scope?.writable;
|
|
112
|
+
const open = ctx.ui.getState().activeItinerary;
|
|
113
|
+
if (scope === undefined || writable === undefined || open === null || open.id !== itineraryId) {
|
|
114
|
+
return null;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// A personal itinerary is one whatever id the host spells the personal space with.
|
|
118
|
+
const owner = {
|
|
119
|
+
createdById: open.created_by.id,
|
|
120
|
+
organizationId: scope.isPersonalScope(open.organization_id) ? null : open.organization_id,
|
|
121
|
+
};
|
|
122
|
+
if (canEditOwnedResource(owner, ctx.viewer.getUserId(), writable.writableOrgIds)) {
|
|
123
|
+
return null;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
return {
|
|
127
|
+
code: "forbidden",
|
|
128
|
+
error:
|
|
129
|
+
owner.organizationId == null
|
|
130
|
+
? `itinerary ${itineraryId} is a personal itinerary, which its author alone edits: it opens read-only for anyone else`
|
|
131
|
+
: `the reader holds no write role in organization ${owner.organizationId}, which owns itinerary ${itineraryId}: an owner, an admin or a contributor of that organization edits it, and it opens read-only for anyone else`,
|
|
132
|
+
ok: false,
|
|
133
|
+
};
|
|
134
|
+
};
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The viewer a host builds from what Mountaya answers: what a person may use of the studio, and
|
|
3
|
+
* how many itineraries they may keep, in each scope.
|
|
4
|
+
*
|
|
5
|
+
* The answer is the platform's and this module adds nothing to it. Mountaya resolves it from the
|
|
6
|
+
* organization's agreement and the person's role, and a rule written here would be that paywall
|
|
7
|
+
* shipped inside every host's product, drifting from the server that enforces it. So a feature
|
|
8
|
+
* is held exactly when the answer for the scope in view lists it, and a ceiling is exactly the
|
|
9
|
+
* number the answer states.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
// oxlint-disable-next-line no-unused-vars -- named by a {@link} below, which an editor follows.
|
|
13
|
+
import { defaultStudioScope, type StudioScopeSeam } from "./scope.js";
|
|
14
|
+
import type { StudioEntitlement, StudioViewer } from "./viewer.js";
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* PlatformScopeAnswer is what Mountaya answers a person may use of the studio in one scope.
|
|
18
|
+
*
|
|
19
|
+
* Each membership `getMyOrganizations` of `@mountaya/client` returns carries one
|
|
20
|
+
* (`Membership`), for the organization it is in. The reader's own space has an answer of the
|
|
21
|
+
* same shape, which no operation of the public contract returns: a host that holds one hands it
|
|
22
|
+
* to {@link createPlatformViewer} as `personalSpace`.
|
|
23
|
+
*/
|
|
24
|
+
export interface PlatformScopeAnswer {
|
|
25
|
+
/**
|
|
26
|
+
* How many itineraries the person may keep in the scope, or null where no ceiling applies.
|
|
27
|
+
* Left out, the answer states no ceiling, as a membership never does: the platform's own
|
|
28
|
+
* `limit-reached` refusal is how an organization's ceiling is met.
|
|
29
|
+
*/
|
|
30
|
+
readonly itinerary_limit?: number | null | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* The features the person may use in the scope.
|
|
33
|
+
*/
|
|
34
|
+
readonly studio_entitlements: readonly StudioEntitlement[];
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* PlatformMembership is one membership as `getMyOrganizations` answers it, read for what a
|
|
39
|
+
* viewer needs: the organization it is in, and the answer for that scope. A `Membership` of
|
|
40
|
+
* `@mountaya/client` is one as it is received.
|
|
41
|
+
*/
|
|
42
|
+
export interface PlatformMembership extends PlatformScopeAnswer {
|
|
43
|
+
/** The organization the membership is in. */
|
|
44
|
+
readonly organization_id: string;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* PlatformAnswerReader reads one answer a host holds: a function that reads it as it stands, and
|
|
49
|
+
* a function that subscribes to its changes and returns the release.
|
|
50
|
+
*
|
|
51
|
+
* Read late, at every question, rather than captured: a membership read lands after the studio
|
|
52
|
+
* mounts, and the scope in view moves while the session stays.
|
|
53
|
+
*/
|
|
54
|
+
export interface PlatformAnswerReader<T> {
|
|
55
|
+
/** Reads the answer as it stands now. */
|
|
56
|
+
readonly read: () => T;
|
|
57
|
+
/**
|
|
58
|
+
* Registers a listener told after the answer changes, and returns the function that removes
|
|
59
|
+
* it. A reader whose answer never changes returns a release that does nothing.
|
|
60
|
+
*/
|
|
61
|
+
readonly subscribe: (onChange: () => void) => () => void;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** PlatformViewerOptions is what {@link createPlatformViewer} reads. */
|
|
65
|
+
export interface PlatformViewerOptions {
|
|
66
|
+
/**
|
|
67
|
+
* Whether an id names the reader's own space rather than an organization: the host's
|
|
68
|
+
* {@link StudioScopeSeam.isPersonalScope}, for a host that spells its personal space with an
|
|
69
|
+
* organization id. An absent id (`null` or `undefined`) and the empty string name it whatever
|
|
70
|
+
* this answers.
|
|
71
|
+
*
|
|
72
|
+
* Asked at every question and subscribed to by nothing, so its answer for an id is fixed for
|
|
73
|
+
* the life of the viewer, or moves only with something a reader here already tells of (the
|
|
74
|
+
* memberships, the personal space, the scope in view or the host's viewer). A predicate that
|
|
75
|
+
* comes to answer otherwise on its own, as one over an id a later read resolves would, changes
|
|
76
|
+
* what the viewer answers with no listener told: build a new viewer when it does.
|
|
77
|
+
*
|
|
78
|
+
* @default Only an absent id, as {@link defaultStudioScope} reads one.
|
|
79
|
+
*/
|
|
80
|
+
readonly isPersonalScope?: ((organizationId: string | null | undefined) => boolean) | undefined;
|
|
81
|
+
/**
|
|
82
|
+
* The person's memberships as `getMyOrganizations` answers them, or `undefined` while the
|
|
83
|
+
* read has not landed. Every membership answers for its own organization; an invitation not
|
|
84
|
+
* accepted yet is no membership, and holds nothing.
|
|
85
|
+
*/
|
|
86
|
+
readonly memberships: PlatformAnswerReader<readonly PlatformMembership[] | undefined>;
|
|
87
|
+
/**
|
|
88
|
+
* The answer for the reader's own space, or `undefined` while it has not landed. Left out, the
|
|
89
|
+
* personal space holds no feature and states no ceiling, which is the reading for a host whose
|
|
90
|
+
* credential never reaches it, as a publishable key never does.
|
|
91
|
+
*/
|
|
92
|
+
readonly personalSpace?: PlatformAnswerReader<PlatformScopeAnswer | undefined> | undefined;
|
|
93
|
+
/**
|
|
94
|
+
* The scope in view: the organization the studio is showing, or the reader's own space in any
|
|
95
|
+
* spelling {@link isPersonalScope} reads, `null` and `undefined` among them. A studio's own
|
|
96
|
+
* reading of it is the URL's `organization_id` (`activeStudioScope`).
|
|
97
|
+
*/
|
|
98
|
+
readonly scope: PlatformAnswerReader<string | null | undefined>;
|
|
99
|
+
/**
|
|
100
|
+
* The rest of the viewer, which the host answers itself: who the person is, the units they
|
|
101
|
+
* read in, where a preference is kept, and the subscription that tells their changes. Any
|
|
102
|
+
* viewer is one, `createMemoryViewer` among them.
|
|
103
|
+
*/
|
|
104
|
+
readonly viewer: Pick<
|
|
105
|
+
StudioViewer,
|
|
106
|
+
"getPreferences" | "getUserId" | "setPreferences" | "subscribe"
|
|
107
|
+
>;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* createPlatformViewer builds the viewer of a person from what Mountaya answers for each of
|
|
112
|
+
* their scopes, and decides none of it.
|
|
113
|
+
*
|
|
114
|
+
* - `hasEntitlement` is true exactly when the answer for the scope in view lists the
|
|
115
|
+
* entitlement. A scope with no answer holds nothing: memberships not landed yet, an
|
|
116
|
+
* organization the person is no member of, and the personal space a host states no answer
|
|
117
|
+
* for. Refusing what cannot yet be shown to be held is the safe direction to be wrong in.
|
|
118
|
+
* - `getItineraryLimit` is the `itinerary_limit` of the scope it names, and null wherever that
|
|
119
|
+
* scope has no answer or its answer states none, so a ceiling not known yet holds nothing back.
|
|
120
|
+
* - `getUserId`, `getPreferences` and `setPreferences` are the host's `viewer`.
|
|
121
|
+
* - `subscribe` tells a listener when any of them may have changed: the host's viewer, the
|
|
122
|
+
* memberships, the personal space, and the scope in view when it names another scope. A scope
|
|
123
|
+
* reader that fires without the scope moving, as a URL does at every camera move, tells
|
|
124
|
+
* nobody.
|
|
125
|
+
*
|
|
126
|
+
* The answer shows or withholds what the studio offers and authorizes nothing: every request is
|
|
127
|
+
* still refused by its own rule, so an answer read before a change of agreement only offers or
|
|
128
|
+
* withholds a feature until the next read.
|
|
129
|
+
*
|
|
130
|
+
* @param options - Where each answer is read.
|
|
131
|
+
* @returns The viewer to hand the studio's context, read late at every question.
|
|
132
|
+
* @example
|
|
133
|
+
* ```ts
|
|
134
|
+
* declare const session: {
|
|
135
|
+
* readonly memberships: () => readonly Membership[] | undefined;
|
|
136
|
+
* readonly organizationInView: () => string | null;
|
|
137
|
+
* readonly subscribe: (onChange: () => void) => () => void;
|
|
138
|
+
* };
|
|
139
|
+
*
|
|
140
|
+
* const viewer = createPlatformViewer({
|
|
141
|
+
* memberships: { read: session.memberships, subscribe: session.subscribe },
|
|
142
|
+
* scope: { read: session.organizationInView, subscribe: session.subscribe },
|
|
143
|
+
* viewer: createMemoryViewer({}, { getUserId: () => "user_…" }),
|
|
144
|
+
* });
|
|
145
|
+
* ```
|
|
146
|
+
*/
|
|
147
|
+
export const createPlatformViewer = ({
|
|
148
|
+
isPersonalScope = defaultStudioScope.isPersonalScope,
|
|
149
|
+
memberships,
|
|
150
|
+
personalSpace,
|
|
151
|
+
scope,
|
|
152
|
+
viewer,
|
|
153
|
+
}: PlatformViewerOptions): StudioViewer => {
|
|
154
|
+
// One spelling of a scope: null for the reader's own space, the organization's id otherwise.
|
|
155
|
+
// The empty string is a record whose owner is still in flight, read as the personal space as
|
|
156
|
+
// `activeStudioScope` reads it.
|
|
157
|
+
const scopeOf = (organizationId: string | null | undefined): string | null =>
|
|
158
|
+
organizationId === undefined || organizationId === "" || isPersonalScope(organizationId)
|
|
159
|
+
? null
|
|
160
|
+
: organizationId;
|
|
161
|
+
|
|
162
|
+
const answerFor = (organizationId: string | null): PlatformScopeAnswer | undefined =>
|
|
163
|
+
organizationId === null
|
|
164
|
+
? personalSpace?.read()
|
|
165
|
+
: memberships.read()?.find((membership) => membership.organization_id === organizationId);
|
|
166
|
+
|
|
167
|
+
return {
|
|
168
|
+
getItineraryLimit: (organizationId) =>
|
|
169
|
+
answerFor(scopeOf(organizationId))?.itinerary_limit ?? null,
|
|
170
|
+
getPreferences: () => viewer.getPreferences(),
|
|
171
|
+
getUserId: () => viewer.getUserId(),
|
|
172
|
+
hasEntitlement: (entitlement) =>
|
|
173
|
+
answerFor(scopeOf(scope.read()))?.studio_entitlements.includes(entitlement) ?? false,
|
|
174
|
+
setPreferences: (partial) => viewer.setPreferences(partial),
|
|
175
|
+
subscribe: (onChange) => {
|
|
176
|
+
// Each subscription holds the scope it last told about, so a scope reader that fires for
|
|
177
|
+
// a change of something else (a URL's camera, its open itinerary) is no change here.
|
|
178
|
+
let inView = scopeOf(scope.read());
|
|
179
|
+
const releases = [
|
|
180
|
+
viewer.subscribe(onChange),
|
|
181
|
+
memberships.subscribe(onChange),
|
|
182
|
+
personalSpace?.subscribe(onChange),
|
|
183
|
+
scope.subscribe(() => {
|
|
184
|
+
const next = scopeOf(scope.read());
|
|
185
|
+
if (next !== inView) {
|
|
186
|
+
inView = next;
|
|
187
|
+
onChange();
|
|
188
|
+
}
|
|
189
|
+
}),
|
|
190
|
+
];
|
|
191
|
+
|
|
192
|
+
return () => {
|
|
193
|
+
for (const release of releases) {
|
|
194
|
+
release?.();
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
},
|
|
198
|
+
};
|
|
199
|
+
};
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import type { ToolFailure } from "../../bus/rules/types.js";
|
|
2
|
+
import type { StudioToolContext } from "./context.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* StudioWriteResource names a resource a studio creates or reshapes in a scope: a collection,
|
|
6
|
+
* an itinerary or a zone. It is what {@link StudioScopeSeam.writeRefusal} is asked about.
|
|
7
|
+
*/
|
|
8
|
+
export type StudioWriteResource = "collection" | "itinerary" | "zone";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* StudioWriteRefusal is why a scope refuses a write, as {@link StudioScopeSeam.writeRefusal}
|
|
12
|
+
* answers it:
|
|
13
|
+
*
|
|
14
|
+
* - `personal`: the reader's own space holds no such resource, as it holds no zone.
|
|
15
|
+
* - `agreement`: the organization's agreement does not include what the write needs, such as
|
|
16
|
+
* Map Studio.
|
|
17
|
+
*/
|
|
18
|
+
export type StudioWriteRefusal = "agreement" | "personal";
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* StudioScopeSeam answers whether an organization id means "the reader's own" rather than a
|
|
22
|
+
* real organization, whether a scope takes a write, and where the reader holds a write role.
|
|
23
|
+
*
|
|
24
|
+
* A tool that must refuse a PERSONAL resource needs to know what personal means, and nothing
|
|
25
|
+
* else on {@link StudioToolContext} says it: this package cannot see a host's root-organization
|
|
26
|
+
* id, which is why `collections/handlers/collections.ts` evicts both listings rather than
|
|
27
|
+
* choosing one.
|
|
28
|
+
*
|
|
29
|
+
* A PREDICATE rather than the id, for the same reason the React roster publishes one: personal
|
|
30
|
+
* scope has more than one spelling. The API says `null`, since a personal resource belongs to no
|
|
31
|
+
* organization; a form that has not picked one yet holds `undefined`, and a host whose own data
|
|
32
|
+
* names a shared root organization spells it with that UUID. All three compile wherever one is
|
|
33
|
+
* expected, and picking the wrong one produces a gate that never fires. One predicate collapses
|
|
34
|
+
* them, and the host that knows which spellings it uses is the one answering.
|
|
35
|
+
*
|
|
36
|
+
* Its members are deliberately the SAME ones `StudioOrganizations` already declares in
|
|
37
|
+
* `@mountaya/studio-react`, so that roster satisfies this seam structurally and a host wires
|
|
38
|
+
* nothing new.
|
|
39
|
+
*/
|
|
40
|
+
export interface StudioScopeSeam {
|
|
41
|
+
isPersonalScope(organizationId: string | null | undefined): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* writable names the organizations in which the reader holds a write role (an owner, an admin
|
|
44
|
+
* or a contributor), as `writableOrgIds`.
|
|
45
|
+
*
|
|
46
|
+
* The verbs that change the open itinerary refuse a reader who holds no write role in the
|
|
47
|
+
* organization that owns it with `forbidden`, before anything is sent, and a personal
|
|
48
|
+
* itinerary to anyone but its author, as `canEditOwnedResource` answers both. A host
|
|
49
|
+
* answers it from the reader's memberships, each of which `getMyOrganizations` answers with the
|
|
50
|
+
* reader's role.
|
|
51
|
+
*
|
|
52
|
+
* Left out, no role is asked and the API decides, which is the reading for a consumer whose
|
|
53
|
+
* every reader may write.
|
|
54
|
+
*/
|
|
55
|
+
writable?:
|
|
56
|
+
| {
|
|
57
|
+
/** Every organization id the reader holds a write role in. */
|
|
58
|
+
readonly writableOrgIds: ReadonlySet<string>;
|
|
59
|
+
}
|
|
60
|
+
| undefined;
|
|
61
|
+
/**
|
|
62
|
+
* writeRefusal answers why the scope `organizationId` names refuses a write of `resource`,
|
|
63
|
+
* or null where it takes it.
|
|
64
|
+
*
|
|
65
|
+
* The handlers that create or reshape a resource ask it before they write anything, and the
|
|
66
|
+
* pickers that offer a scope ask it before they offer one, so the reader never fills a form
|
|
67
|
+
* for a write the API refuses. A host answers it from the products each organization holds,
|
|
68
|
+
* which every membership `getMyOrganizations` answers carries as `organization_capabilities`.
|
|
69
|
+
* An organization the host does not know answers null: the API decides it.
|
|
70
|
+
*
|
|
71
|
+
* Left out, every scope takes every write, which is the reading for a consumer whose every
|
|
72
|
+
* scope may write.
|
|
73
|
+
*
|
|
74
|
+
* @param resource - The resource the write creates or reshapes.
|
|
75
|
+
* @param organizationId - The scope it is written in, in any spelling
|
|
76
|
+
* {@link isPersonalScope} reads.
|
|
77
|
+
*/
|
|
78
|
+
writeRefusal?:
|
|
79
|
+
| ((
|
|
80
|
+
resource: StudioWriteResource,
|
|
81
|
+
organizationId: string | null | undefined,
|
|
82
|
+
) => StudioWriteRefusal | null)
|
|
83
|
+
| undefined;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* The scope a studio mounted without a host binding reads.
|
|
88
|
+
*
|
|
89
|
+
* Only an ABSENT id is personal, which is the correct defined absence: a consumer whose product
|
|
90
|
+
* has no shared root organization has nothing to compare against, and every real id they hold
|
|
91
|
+
* is a real organization. A default that treated an unknown id as personal would refuse the
|
|
92
|
+
* publishing verbs for every consumer who never wired this seam. It refuses no write either.
|
|
93
|
+
*/
|
|
94
|
+
export const defaultStudioScope: StudioScopeSeam = {
|
|
95
|
+
isPersonalScope: (organizationId) => organizationId === null || organizationId === undefined,
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
/** What a write of each resource is called in a refusal. */
|
|
99
|
+
const writeResourceNames: Readonly<Record<StudioWriteResource, string>> = {
|
|
100
|
+
collection: "a collection",
|
|
101
|
+
itinerary: "an itinerary",
|
|
102
|
+
zone: "a zone",
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* requireWritableScope refuses a write of `resource` into the scope `organizationId` names,
|
|
107
|
+
* returning the refusal to return or `null` to continue: the host's
|
|
108
|
+
* {@link StudioScopeSeam.writeRefusal} answers, through the context's `scope`.
|
|
109
|
+
*
|
|
110
|
+
* - `personal` answers `forbidden`: the reader's own space holds no such resource, and nothing
|
|
111
|
+
* is missing from an agreement, only an organization to write it in.
|
|
112
|
+
* - `agreement` answers `upgrade-required`: the organization's agreement does not include what
|
|
113
|
+
* the write needs.
|
|
114
|
+
*
|
|
115
|
+
* A context whose scope states no `writeRefusal`, or none at all, refuses nothing. Like every
|
|
116
|
+
* gate of this kind it is a UX and agent-containment gate and NOT the security boundary: the API
|
|
117
|
+
* refuses the same write on the same fact.
|
|
118
|
+
*
|
|
119
|
+
* @param ctx - The context of the verb that writes.
|
|
120
|
+
* @param resource - The resource the verb creates or reshapes.
|
|
121
|
+
* @param organizationId - The scope it writes in: an organization, or the reader's own space in
|
|
122
|
+
* any spelling the host's predicate reads.
|
|
123
|
+
*/
|
|
124
|
+
export const requireWritableScope = (
|
|
125
|
+
ctx: Pick<StudioToolContext, "scope">,
|
|
126
|
+
resource: StudioWriteResource,
|
|
127
|
+
organizationId: string | null | undefined,
|
|
128
|
+
): ToolFailure | null => {
|
|
129
|
+
const refusal = ctx.scope?.writeRefusal?.(resource, organizationId) ?? null;
|
|
130
|
+
const name = writeResourceNames[resource];
|
|
131
|
+
|
|
132
|
+
switch (refusal) {
|
|
133
|
+
case "personal":
|
|
134
|
+
return {
|
|
135
|
+
code: "forbidden",
|
|
136
|
+
error: `the personal space holds no ${resource}: write ${name} in an organization whose agreement includes Map Studio`,
|
|
137
|
+
ok: false,
|
|
138
|
+
};
|
|
139
|
+
case "agreement":
|
|
140
|
+
return {
|
|
141
|
+
code: "upgrade-required",
|
|
142
|
+
error: `not part of the organization's agreement: writing ${name} needs an organization whose agreement includes Map Studio`,
|
|
143
|
+
ok: false,
|
|
144
|
+
};
|
|
145
|
+
default:
|
|
146
|
+
return null;
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* activeStudioScope answers the organization whose scope the studio is in, as its URL names it
|
|
152
|
+
* (`organization_id`), or null for the reader's own space.
|
|
153
|
+
*
|
|
154
|
+
* The scope the sidenav lists, the overlays the map draws and the manifest a handler reads all
|
|
155
|
+
* follow it. The reader's own space has one spelling here, null, whatever the URL holds for it:
|
|
156
|
+
* an id the host's predicate reads as personal folds down, as an absent one does. A context with
|
|
157
|
+
* no URL seam is in the reader's own space.
|
|
158
|
+
*/
|
|
159
|
+
export const activeStudioScope = (ctx: Pick<StudioToolContext, "scope" | "url">): string | null => {
|
|
160
|
+
const named = ctx.url?.read().organization_id;
|
|
161
|
+
const { isPersonalScope } = ctx.scope ?? defaultStudioScope;
|
|
162
|
+
|
|
163
|
+
return named === undefined || named === "" || isPersonalScope(named) ? null : named;
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* isPublishableScope answers whether a resource's owning organization can produce PUBLISHED
|
|
168
|
+
* OUTPUT: a publication, and everything that hangs off one (the embed, the video export, the
|
|
169
|
+
* share link and the file download).
|
|
170
|
+
*
|
|
171
|
+
* One rule, not one per verb and not one per resource. A personal resource belongs to no
|
|
172
|
+
* organization, and an organization is what a published itinerary belongs to under its
|
|
173
|
+
* agreement, so a personal resource produces none of those things. The API refuses each of them
|
|
174
|
+
* on that same fact; this rule is how a surface avoids offering what the API refuses.
|
|
175
|
+
*
|
|
176
|
+
* `isPersonalScope` is the host's predicate, {@link StudioScopeSeam.isPersonalScope}, rather than
|
|
177
|
+
* the root organization's id, for the reason that seam gives: personal scope has more than one
|
|
178
|
+
* spelling, and the host that knows its spellings is the one that answers.
|
|
179
|
+
*
|
|
180
|
+
* Two absences answer `false`, and both are deliberate:
|
|
181
|
+
*
|
|
182
|
+
* - `undefined`, an owner the caller cannot name yet. This rule decides what a surface OFFERS,
|
|
183
|
+
* and a surface whose record is still loading offers nothing it might have to withdraw. The
|
|
184
|
+
* tool handlers behind the publishing verbs read the same `undefined` the other way: they
|
|
185
|
+
* refuse only a resource KNOWN to be personal, because refusing on a cache the session never
|
|
186
|
+
* warmed would break a legitimate publish, and the API stays the answer that is total.
|
|
187
|
+
* - The empty string. A predicate comparing against `null`, `undefined` and a root id matches
|
|
188
|
+
* none of them for `""`, so the predicate alone would read `""` as a real organization, and
|
|
189
|
+
* `""` is what a surface holds while the record carrying `organization_id` is in flight.
|
|
190
|
+
*
|
|
191
|
+
* @param organizationId - The resource's owning organization, as its record or surface holds it.
|
|
192
|
+
* @param isPersonalScope - The host's predicate for the reader's own scope.
|
|
193
|
+
*/
|
|
194
|
+
export const isPublishableScope = (
|
|
195
|
+
organizationId: string | null | undefined,
|
|
196
|
+
isPersonalScope: (organizationId: string | null | undefined) => boolean,
|
|
197
|
+
): boolean => Boolean(organizationId) && !isPersonalScope(organizationId);
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The studio's slice of the URL, and the seam a host answers it with.
|
|
3
|
+
*
|
|
4
|
+
* A studio reflects part of its state into the address bar so a reload reopens what was open
|
|
5
|
+
* and a link carries what the sender was looking at. That is ONE concern with two directions,
|
|
6
|
+
* and it is not the same concern as moving somewhere: nothing here changes the page, every
|
|
7
|
+
* write is a patch of the same query string the surface is already on.
|
|
8
|
+
*
|
|
9
|
+
* That distinction is why this is separate from `NavigationSeam` in
|
|
10
|
+
* `@mountaya/studio-react/headless`, which takes a PATH and moves. A single seam carrying
|
|
11
|
+
* both would hand a host one object with two unrelated jobs, and would freeze the studio's own
|
|
12
|
+
* route into the contract: every write here targets the page the studio is mounted on, so
|
|
13
|
+
* naming it would be a constant nobody can change.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* MirroredSearch is the slice of a URL the studio owns.
|
|
18
|
+
*
|
|
19
|
+
* Four map facets, the open itinerary, the organization whose collections are in view, and the
|
|
20
|
+
* one transient flag a create flow raises. Every field is optional because a URL carries none
|
|
21
|
+
* of them until something is chosen, and `undefined` in a PATCH means "remove this key" rather
|
|
22
|
+
* than "leave it alone", which is how a verb that closes a detail clears it.
|
|
23
|
+
*/
|
|
24
|
+
export interface MirroredSearch {
|
|
25
|
+
/** Raised while a create flow is open, so a reload lands back on the form. */
|
|
26
|
+
creating?: boolean | undefined;
|
|
27
|
+
/** The enrichment overlays shown over the base map, by slug. */
|
|
28
|
+
enrichments?: string[] | undefined;
|
|
29
|
+
/** The itinerary the editor holds, so a reload reopens it. */
|
|
30
|
+
itinerary_id?: string | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* The organization whose collections are being browsed, ABSENT for the personal scope.
|
|
33
|
+
*
|
|
34
|
+
* Absence is the spelling rather than a sentinel, because that is how the listing endpoints
|
|
35
|
+
* spell it, and it is in the URL rather than in component state so a reload lands on the
|
|
36
|
+
* same folders and a link carries them. A host with no organizations never sets it.
|
|
37
|
+
*/
|
|
38
|
+
organization_id?: string | undefined;
|
|
39
|
+
/** The map overlay shown, by slug. */
|
|
40
|
+
overlay?: string | undefined;
|
|
41
|
+
/** The base terrain, by slug. */
|
|
42
|
+
terrain?: string | undefined;
|
|
43
|
+
/** How far from now the time-aware overlays read, in minutes. */
|
|
44
|
+
time_offset?: number | undefined;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* StudioUrlSeam is how a host lets the studio read and write its own slice of the URL.
|
|
49
|
+
*
|
|
50
|
+
* Without it, the surfaces that mirror state would be the one place that knew a router by
|
|
51
|
+
* name, reaching for a route tree, a path and a search schema at once. None of those are their
|
|
52
|
+
* business: they mirror the values of {@link MirroredSearch} into whatever URL they are given.
|
|
53
|
+
*
|
|
54
|
+
* Four members, and the shape of each is a decision rather than a convenience:
|
|
55
|
+
*
|
|
56
|
+
* - `readOnce` is the init source, read at mount and not subscribed. A surface dispatches one
|
|
57
|
+
* tool per present param exactly once, so a subscribing read here would re-fire them.
|
|
58
|
+
* - `read` and `subscribe` are the live slice, as a function that reads and a function that
|
|
59
|
+
* subscribes and returns its release. No member is a hook: this package names no framework,
|
|
60
|
+
* so a host with no React answers the seam with a variable and a set of listeners, and a
|
|
61
|
+
* port answers it at all. A React binding joins the two through `useSyncExternalStore`. They
|
|
62
|
+
* name the mirrored slice and take no selector, because a selector has to survive a router's
|
|
63
|
+
* own generics on the way through and there is only ever one slice to read.
|
|
64
|
+
* - `write` takes a PATCH, never a whole-search reducer. A reducer would have to return the
|
|
65
|
+
* host's complete search type, which routers commonly split in two (TanStack validates
|
|
66
|
+
* `zoom` from `string | number` down to `number`), so a function written against either shape
|
|
67
|
+
* fails against the other. A patch of keys the studio owns has no such split, and the host
|
|
68
|
+
* merges it into whatever it holds.
|
|
69
|
+
*
|
|
70
|
+
* It may answer a PROMISE, and a caller may await it. Most writes do not care (a handler
|
|
71
|
+
* patches the URL on its way out and has nothing to sequence against it), but a surface that
|
|
72
|
+
* must not act until the navigation has LANDED does: arming an edit engine before a
|
|
73
|
+
* create→editor transition trips the unsaved-edits guard on the transition it just caused.
|
|
74
|
+
* Returning void is the ordinary case and stays valid; a host whose router navigates
|
|
75
|
+
* asynchronously says so by handing the promise back.
|
|
76
|
+
*
|
|
77
|
+
* `hash` rides the write because MapLibre owns the `#view` camera through `history.replaceState`,
|
|
78
|
+
* which a router does not observe: a search write that did not re-assert it would drop the
|
|
79
|
+
* camera from the URL.
|
|
80
|
+
*
|
|
81
|
+
* The whole seam is OPTIONAL on the tool context, and its absence is defined: a host without a
|
|
82
|
+
* router (an embed, a render-free test) mutates its state and mirrors nothing.
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* ```ts
|
|
86
|
+
* declare const router: {
|
|
87
|
+
* navigate: (search: MirroredSearch, hash: string | undefined) => void;
|
|
88
|
+
* onSearchChange: (listener: () => void) => () => void;
|
|
89
|
+
* search: () => MirroredSearch;
|
|
90
|
+
* };
|
|
91
|
+
*
|
|
92
|
+
* const url: StudioUrlSeam = {
|
|
93
|
+
* read: () => router.search(),
|
|
94
|
+
* readOnce: () => router.search(),
|
|
95
|
+
* subscribe: (listener) => router.onSearchChange(listener),
|
|
96
|
+
* write: (patch, options) => router.navigate({ ...router.search(), ...patch }, options?.hash),
|
|
97
|
+
* };
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
100
|
+
export interface StudioUrlSeam {
|
|
101
|
+
/**
|
|
102
|
+
* read answers the mirrored slice as the URL holds it now, by reference: the same object on
|
|
103
|
+
* every call until one of its values changes. A subscriber reads it once it is told, and a
|
|
104
|
+
* binding compares two reads by identity, so a read that built a new object per call would
|
|
105
|
+
* read as a change every time.
|
|
106
|
+
*/
|
|
107
|
+
read: () => MirroredSearch;
|
|
108
|
+
/** readOnce answers the slice as the URL holds it at mount. Read once, and never subscribed. */
|
|
109
|
+
readOnce: () => MirroredSearch;
|
|
110
|
+
/**
|
|
111
|
+
* subscribe registers a listener the host tells after each change of the mirrored slice, and
|
|
112
|
+
* returns its release, which is idempotent. A change to another part of the URL tells nobody.
|
|
113
|
+
*/
|
|
114
|
+
subscribe: (listener: () => void) => () => void;
|
|
115
|
+
/**
|
|
116
|
+
* write merges a patch of the keys the studio owns into the URL. A key stated as `undefined`
|
|
117
|
+
* is removed. It may answer a promise that settles once the navigation has landed.
|
|
118
|
+
*/
|
|
119
|
+
write: (patch: MirroredSearch, options?: { hash?: string | undefined }) => void | Promise<void>;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/** The empty slice, hoisted so the inert seam answers ONE object across every read. */
|
|
123
|
+
const nothingMirrored: MirroredSearch = {};
|
|
124
|
+
|
|
125
|
+
/** The inert seam's release: nothing was registered, so there is nothing to let go of. */
|
|
126
|
+
const releaseNothing = (): void => {};
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* inertStudioUrlSeam is the seam a host with no address bar to lend gets.
|
|
130
|
+
*
|
|
131
|
+
* It reads empty, tells no subscriber and drops every write, which is the absence the interface
|
|
132
|
+
* above already describes: the studio mutates its state and mirrors nothing, so a reload opens
|
|
133
|
+
* an empty studio and a copied link carries the page and not the view.
|
|
134
|
+
*
|
|
135
|
+
* A constant rather than a factory, and `read` answering one hoisted object rather than a fresh
|
|
136
|
+
* literal, because a binding reads it on every render of the surface that mirrors: a new object
|
|
137
|
+
* per call is a new dependency per render, and the write it triggers would re-enter the seam
|
|
138
|
+
* that produced it.
|
|
139
|
+
*/
|
|
140
|
+
export const inertStudioUrlSeam: StudioUrlSeam = {
|
|
141
|
+
read: () => nothingMirrored,
|
|
142
|
+
readOnce: () => nothingMirrored,
|
|
143
|
+
subscribe: () => releaseNothing,
|
|
144
|
+
write: () => {},
|
|
145
|
+
};
|