Skip to content

A spy satellite simulator in your browser, except the data is real. Live open source spatial intelligence on a photorealistic 3D globe.

feat(share): export the share-view codec and link-path helpers (#1419)

Sameh Khamis3d9f153bc055
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/<code>` 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/<code>` link, for example to describe it in link previews.
+ `share/link-path` reads and builds the `/share/<code>` 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** — `<app>/share/<code>`, where `<app>` is wherever the app is
served (an origin's root, or a base path) and `<code>` 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": [