From 3d9f153bc055acc58d18c6a4b329f044816409a7 Mon Sep 17 00:00:00 2001 From: Sameh Khamis Date: Mon, 26 Oct 2026 16:20:23 -0700 Subject: [PATCH] feat(share): export the share-view codec and link-path helpers (#1419) * feat(share): export the share-view codec for host servers Add `@gods-eye-view/core/share/view-codec` (src/share/viewCodec.js) as a package export with its own boundary group. The codec is pure (no DOM, no Cesium, no external dependencies), so a host's server can decode a /share/ link, for example to describe the view in link previews. * feat(share): export the share-link address helpers Add `@gods-eye-view/core/share/link-path` (src/share/shareLinkPath.js), so a host's server reads /share/ addresses the way the app does. --- changelog.d/1419-share-view-codec-export.md | 4 +++ docs/CODE-BOUNDARIES.md | 4 +++ docs/SHARE-LINK-FORMAT.md | 3 +- package.json | 2 ++ scripts/package-boundaries.json | 33 +++++++++++++++++++++ 5 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 changelog.d/1419-share-view-codec-export.md diff --git a/changelog.d/1419-share-view-codec-export.md b/changelog.d/1419-share-view-codec-export.md new file mode 100644 index 000000000..e3ce1b105 --- /dev/null +++ b/changelog.d/1419-share-view-codec-export.md @@ -0,0 +1,4 @@ +- Hosts can read share links on their server: the share-link codec and the + `/share/` address helpers are now package exports, + `@gods-eye-view/core/share/view-codec` and `@gods-eye-view/core/share/link-path` + (samehkhamis, #1419). diff --git a/docs/CODE-BOUNDARIES.md b/docs/CODE-BOUNDARIES.md index 9f8e0f629..efc7b86bc 100644 --- a/docs/CODE-BOUNDARIES.md +++ b/docs/CODE-BOUNDARIES.md @@ -598,6 +598,10 @@ state subscriptions retain their existing event contract. tracking handoff. It reads Cockpit admission and uses supplied tracking operations. - `ui/share-restoration` owns the initial restore transaction, layer coordinator, status notices and gesture/timer cleanup. +- `share/view-codec` is the share-link codec (`decodeShareView`, + `encodeShareView`). It is pure (no DOM, no Cesium), so a host's server can + read a `/share/` link, for example to describe it in link previews. + `share/link-path` reads and builds the `/share/` address itself. - `ui/visual-settings` owns style preferences, detection overrides, display inputs and IR cleanup. Its engine services and panel operations are explicit. - `ui/panel-chrome` owns disclosure, docking, collapse preferences and temporary diff --git a/docs/SHARE-LINK-FORMAT.md b/docs/SHARE-LINK-FORMAT.md index f590e02bc..cfb6d50fb 100644 --- a/docs/SHARE-LINK-FORMAT.md +++ b/docs/SHARE-LINK-FORMAT.md @@ -9,7 +9,8 @@ style, data layers and panel layout. There are two forms. - **Short form** — `/share/`, where `` is wherever the app is served (an origin's root, or a base path) and `` is encoded and decoded by `src/share/viewCodec.js`, which is pure (no DOM, no Cesium) and - needs no server. The share button makes this form. The same code opens on + needs no server. Hosts import it as `@gods-eye-view/core/share/view-codec` + (a server can read a code to describe the view in a link preview). The share button makes this form. The same code opens on any copy of the app. `src/share/shareLinkPath.js` reads and builds the address, and `src/share/legacyShareState.js` converts between the long form's parsed state and the code's state. diff --git a/package.json b/package.json index cb06324ee..75a1f994c 100644 --- a/package.json +++ b/package.json @@ -223,6 +223,8 @@ "./data/lifecycle": "./src/data/lifecycle.js", "./ui/navigation": "./src/ui/navigationController.js", "./ui/share-restoration": "./src/ui/shareRestoration.js", + "./share/view-codec": "./src/share/viewCodec.js", + "./share/link-path": "./src/share/shareLinkPath.js", "./ui/visual-settings": "./src/ui/visualSettings.js", "./ui/panel-chrome": "./src/ui/panelChrome.js", "./layers/flights/records": "./src/layers/flights/records.js", diff --git a/scripts/package-boundaries.json b/scripts/package-boundaries.json index dedf4c272..d32997d5c 100644 --- a/scripts/package-boundaries.json +++ b/scripts/package-boundaries.json @@ -3887,6 +3887,39 @@ ], "external": [] }, + "share-view-codec": { + "exports": ["./share/view-codec"], + "modules": [ + "src/share/viewCodec.js", + "src/share/follow.js", + "src/share/wire.js", + "src/ui/visualPresets.js", + "src/bloom.js", + "src/styles/anime.js", + "src/styles/noir.js", + "src/styles/retro.js", + "src/styles/snow.js", + "src/styles/surveillance.js", + "src/styles/thermal.js", + "src/view/index.js", + "src/data/layerState.js", + "src/data/layerStateTokenReservations.json", + "src/data/idSwitches.js", + "src/data/detectionPolicy.js", + "src/scopeMaskPolicy.js", + "src/i18n/index.js", + "src/i18n/locale.js", + "src/i18n/locales/es.json", + "src/i18n/locales/ru.json", + "src/i18n/locales/zh-CN.json" + ], + "external": [] + }, + "share-link-path": { + "exports": ["./share/link-path"], + "modules": ["src/share/shareLinkPath.js"], + "external": [] + }, "ghostmaps": { "exports": ["./layers/ghostmaps"], "modules": [