@jbrowse/product-core 4.3.0 → 5.0.0-beta.10
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/esm/RootModel/BaseRootModel.d.ts +514 -323
- package/esm/RootModel/BaseRootModel.js +141 -14
- package/esm/RootModel/HierarchicalConfig.d.ts +30 -20
- package/esm/RootModel/HierarchicalConfig.js +36 -0
- package/esm/RootModel/InternetAccounts.d.ts +18 -1
- package/esm/RootModel/InternetAccounts.js +120 -22
- package/esm/RootModel/PreferencesConfig.d.ts +37 -0
- package/esm/RootModel/PreferencesConfig.js +75 -0
- package/esm/RootModel/createConfigModel.d.ts +257 -0
- package/esm/RootModel/createConfigModel.js +77 -0
- package/esm/RootModel/index.d.ts +10 -5
- package/esm/RootModel/index.js +10 -5
- package/esm/RootModel/menuItems.d.ts +24 -0
- package/esm/RootModel/menuItems.js +141 -0
- package/esm/Session/BaseSession.d.ts +285 -11
- package/esm/Session/BaseSession.js +383 -15
- package/esm/Session/Connections.d.ts +115 -8
- package/esm/Session/Connections.js +196 -74
- package/esm/Session/DrawerWidgets.d.ts +145 -13
- package/esm/Session/DrawerWidgets.js +219 -49
- package/esm/Session/MultipleViews.d.ts +1067 -1177
- package/esm/Session/MultipleViews.js +395 -64
- package/esm/Session/Preferences.d.ts +1389 -0
- package/esm/Session/Preferences.js +58 -0
- package/esm/Session/ReferenceManagement.d.ts +28 -3
- package/esm/Session/ReferenceManagement.js +56 -41
- package/esm/Session/SessionTracks.d.ts +1101 -1180
- package/esm/Session/SessionTracks.js +584 -34
- package/esm/Session/Themes.d.ts +136 -2
- package/esm/Session/Themes.js +267 -21
- package/esm/Session/TrackMenu.d.ts +88 -0
- package/esm/Session/TrackMenu.js +175 -0
- package/esm/Session/TrackMenuSessionMixin.d.ts +27 -0
- package/esm/Session/TrackMenuSessionMixin.js +42 -0
- package/esm/Session/Tracks.d.ts +945 -1159
- package/esm/Session/Tracks.js +229 -30
- package/esm/Session/assertSessionModel.d.ts +21 -0
- package/esm/Session/assertSessionModel.js +1 -0
- package/esm/Session/copyTrackSnapshot.d.ts +21 -0
- package/esm/Session/copyTrackSnapshot.js +20 -0
- package/esm/Session/developerMode.d.ts +7 -0
- package/esm/Session/developerMode.js +43 -0
- package/esm/Session/finalizeSession.d.ts +15 -0
- package/esm/Session/finalizeSession.js +28 -0
- package/esm/Session/hydratedForms.d.ts +16 -0
- package/esm/Session/hydratedForms.js +13 -0
- package/esm/Session/index.d.ts +27 -10
- package/esm/Session/index.js +16 -10
- package/esm/Session/pluginExtraTrackItems.d.ts +11 -0
- package/esm/Session/pluginExtraTrackItems.js +13 -0
- package/esm/Session/readdedTrackConf.d.ts +8 -0
- package/esm/Session/readdedTrackConf.js +24 -0
- package/esm/Session/shareableSnapshot.d.ts +23 -0
- package/esm/Session/shareableSnapshot.js +66 -0
- package/esm/Session/temporaryAssemblyTracks.d.ts +24 -0
- package/esm/Session/temporaryAssemblyTracks.js +37 -0
- package/esm/assertExtends.d.ts +55 -0
- package/esm/assertExtends.js +1 -0
- package/esm/controllerTracks.d.ts +76 -0
- package/esm/controllerTracks.js +125 -0
- package/esm/destroyViewState.d.ts +21 -0
- package/esm/destroyViewState.js +29 -0
- package/esm/embeddedController.d.ts +57 -0
- package/esm/embeddedController.js +100 -0
- package/esm/index.d.ts +32 -4
- package/esm/index.js +31 -4
- package/esm/loadPlugins.d.ts +38 -0
- package/esm/loadPlugins.js +45 -0
- package/esm/localFiles.d.ts +74 -0
- package/esm/localFiles.js +156 -0
- package/esm/observeSession.d.ts +55 -0
- package/esm/observeSession.js +90 -0
- package/esm/parallelChunkLoading.d.ts +30 -0
- package/esm/parallelChunkLoading.js +71 -0
- package/esm/pluginInput.d.ts +32 -0
- package/esm/pluginInput.js +19 -0
- package/esm/pruneUnbuildableNodes.d.ts +109 -0
- package/esm/pruneUnbuildableNodes.js +562 -0
- package/esm/resolveAssemblies.d.ts +68 -0
- package/esm/resolveAssemblies.js +77 -0
- package/esm/rpcWorker.d.ts +36 -4
- package/esm/rpcWorker.js +126 -20
- package/esm/sessionMigrations/index.d.ts +15 -0
- package/esm/sessionMigrations/index.js +178 -0
- package/esm/sessionUrl.d.ts +40 -0
- package/esm/sessionUrl.js +66 -0
- package/esm/sessionUtils.d.ts +74 -0
- package/esm/sessionUtils.js +599 -0
- package/esm/siblingCast.d.ts +14 -0
- package/esm/siblingCast.js +16 -0
- package/esm/snapshotUtils.d.ts +8 -0
- package/esm/snapshotUtils.js +12 -0
- package/esm/ui/AboutDialog.d.ts +8 -3
- package/esm/ui/AboutDialog.js +14 -5
- package/esm/ui/AboutDialogContents.d.ts +2 -6
- package/esm/ui/AboutDialogContents.js +13 -17
- package/esm/ui/AssemblyInfoPanel.d.ts +5 -0
- package/esm/ui/AssemblyInfoPanel.js +63 -0
- package/esm/ui/DescriptionPanel.d.ts +3 -0
- package/esm/ui/DescriptionPanel.js +25 -0
- package/esm/ui/Drawer.d.ts +21 -0
- package/esm/ui/Drawer.js +60 -0
- package/esm/ui/DrawerControls.d.ts +5 -0
- package/esm/ui/DrawerControls.js +28 -0
- package/esm/ui/DrawerHeader.d.ts +6 -0
- package/esm/ui/DrawerHeader.js +36 -0
- package/esm/ui/DrawerWidget.d.ts +5 -0
- package/esm/ui/DrawerWidget.js +12 -0
- package/esm/ui/DrawerWidgetSelector.d.ts +5 -0
- package/esm/ui/DrawerWidgetSelector.js +40 -0
- package/esm/ui/FileInfoPanel.d.ts +3 -6
- package/esm/ui/FileInfoPanel.js +36 -26
- package/esm/ui/GeneralPreferencesTab.d.ts +17 -0
- package/esm/ui/GeneralPreferencesTab.js +34 -0
- package/esm/ui/HeaderButtons.d.ts +2 -1
- package/esm/ui/HeaderButtons.js +15 -17
- package/esm/ui/ModalWidget.d.ts +13 -0
- package/esm/ui/ModalWidget.js +48 -0
- package/esm/ui/ModalWidgetAppBar.d.ts +8 -0
- package/esm/ui/ModalWidgetAppBar.js +9 -0
- package/esm/ui/PreferenceCheckbox.d.ts +6 -0
- package/esm/ui/PreferenceCheckbox.js +16 -0
- package/esm/ui/PreferencesDialog.d.ts +34 -0
- package/esm/ui/PreferencesDialog.js +55 -0
- package/esm/ui/PreferencesResetDialog.d.ts +8 -0
- package/esm/ui/PreferencesResetDialog.js +19 -0
- package/esm/ui/RefNameAliasesDialog.d.ts +9 -0
- package/esm/ui/RefNameAliasesDialog.js +65 -0
- package/esm/ui/RefNameInfoDialog.d.ts +3 -6
- package/esm/ui/RefNameInfoDialog.js +45 -63
- package/esm/ui/ViewPreferencesTab.d.ts +12 -0
- package/esm/ui/ViewPreferencesTab.js +15 -0
- package/esm/ui/WidgetBody.d.ts +18 -0
- package/esm/ui/WidgetBody.js +22 -0
- package/esm/ui/WidgetHeading.d.ts +7 -0
- package/esm/ui/WidgetHeading.js +7 -0
- package/esm/ui/aboutTestUtils.d.ts +140 -0
- package/esm/ui/aboutTestUtils.js +25 -0
- package/esm/ui/descriptionHtml.d.ts +25 -0
- package/esm/ui/descriptionHtml.js +64 -0
- package/esm/ui/drawerLayout.d.ts +18 -0
- package/esm/ui/drawerLayout.js +22 -0
- package/esm/ui/index.d.ts +15 -1
- package/esm/ui/index.js +13 -1
- package/esm/ui/preferencesReset.d.ts +18 -0
- package/esm/ui/preferencesReset.js +69 -0
- package/esm/ui/util.d.ts +22 -7
- package/esm/ui/util.js +19 -41
- package/esm/useEngineLifecycle.d.ts +19 -0
- package/esm/useEngineLifecycle.js +44 -0
- package/package.json +15 -18
- package/esm/RootModel/FormatAbout.d.ts +0 -12
- package/esm/RootModel/FormatAbout.js +0 -15
- package/esm/RootModel/FormatDetails.d.ts +0 -24
- package/esm/RootModel/FormatDetails.js +0 -27
- package/esm/Session/DialogQueue.d.ts +0 -17
- package/esm/Session/DialogQueue.js +0 -31
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { ENCODED_PREFIX, JSON_PREFIX, fromUrlSafeB64, toUrlSafeB64, } from '@jbrowse/core/util';
|
|
2
|
+
import { getShareableSessionSnapshot } from './Session/shareableSnapshot.js';
|
|
3
|
+
/**
|
|
4
|
+
* Serialize a live session into a compact, URL-safe string for a query param or
|
|
5
|
+
* hash fragment. Deflated then base64url-encoded, so it survives a URL intact
|
|
6
|
+
* and stays far smaller than raw JSON.
|
|
7
|
+
*
|
|
8
|
+
* Not a plain `getSnapshot`: a workspace arrangement turned on by the sender's
|
|
9
|
+
* preference is not in the snapshot, so a raw one renders as a classic stack
|
|
10
|
+
* for whoever opens the link. `getShareableSessionSnapshot` stamps it first.
|
|
11
|
+
*
|
|
12
|
+
* The session travels but the config does not — the receiving app supplies its
|
|
13
|
+
* own assembly/tracks. Put the result somewhere the server never sees (the hash
|
|
14
|
+
* fragment) if it may be long: a query string can exceed the request-line limit
|
|
15
|
+
* and get a 414, which is why jbrowse-web moved its own there.
|
|
16
|
+
*
|
|
17
|
+
* Carries `ENCODED_PREFIX`, the same `?session=encoded-…` value jbrowse-web's
|
|
18
|
+
* SessionLoader decodes, so a link built by an embedded product opens in
|
|
19
|
+
* jbrowse.org/jb2 and vice versa. The format is `encodeSessionParam`'s `long`
|
|
20
|
+
* mode; sessionUrl.test.ts asserts the two stay byte-identical.
|
|
21
|
+
*/
|
|
22
|
+
export async function encodeSessionToUrl(session) {
|
|
23
|
+
const snap = getShareableSessionSnapshot(session);
|
|
24
|
+
return `${ENCODED_PREFIX}${await toUrlSafeB64(JSON.stringify(snap))}`;
|
|
25
|
+
}
|
|
26
|
+
function isSessionSnapshot(value) {
|
|
27
|
+
return (typeof value === 'object' &&
|
|
28
|
+
value !== null &&
|
|
29
|
+
!Array.isArray(value) &&
|
|
30
|
+
'name' in value &&
|
|
31
|
+
typeof value.name === 'string');
|
|
32
|
+
}
|
|
33
|
+
// A clipped `json-` link still parses up to the cut, so without this the
|
|
34
|
+
// recipient reads JSON.parse's "Unterminated string in JSON at position 813"
|
|
35
|
+
function parseJsonParam(json) {
|
|
36
|
+
try {
|
|
37
|
+
return JSON.parse(json)?.session;
|
|
38
|
+
}
|
|
39
|
+
catch (e) {
|
|
40
|
+
throw new Error("This link's session JSON is incomplete, which is how a link cut short in transit arrives. A short link survives being sent where a long one may not.", { cause: e });
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
async function parseEncodedParam(value) {
|
|
44
|
+
return JSON.parse(await fromUrlSafeB64(value.startsWith(ENCODED_PREFIX)
|
|
45
|
+
? value.slice(ENCODED_PREFIX.length)
|
|
46
|
+
: value));
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Inverse of {@link encodeSessionToUrl}, and of the `json-` form jbrowse-web's
|
|
50
|
+
* share dialog writes. Accepts an `encoded-` value with or without its prefix,
|
|
51
|
+
* so a raw `?session=` value from either app passes straight through.
|
|
52
|
+
*
|
|
53
|
+
* Throws on anything that isn't a decodable session — a truncated link, or a
|
|
54
|
+
* `share-`/`spec-` param an embedded product doesn't handle — so a host can
|
|
55
|
+
* fall back to its own declarative launch state instead of opening a
|
|
56
|
+
* half-built session.
|
|
57
|
+
*/
|
|
58
|
+
export async function decodeSessionFromUrl(value) {
|
|
59
|
+
const parsed = value.startsWith(JSON_PREFIX)
|
|
60
|
+
? parseJsonParam(value.slice(JSON_PREFIX.length))
|
|
61
|
+
: await parseEncodedParam(value);
|
|
62
|
+
if (!isSessionSnapshot(parsed)) {
|
|
63
|
+
throw new Error('not a session snapshot: no "name"');
|
|
64
|
+
}
|
|
65
|
+
return parsed;
|
|
66
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { HydratedForms } from './Session/hydratedForms.ts';
|
|
2
|
+
import type { PluginDefinition } from '@jbrowse/core/pluginDefinitions';
|
|
3
|
+
import type { IAnyStateTreeNode, IAnyType } from '@jbrowse/mobx-state-tree';
|
|
4
|
+
export interface DroppedSessionNode {
|
|
5
|
+
type?: string;
|
|
6
|
+
configuration?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function filterSessionInPlace(node: IAnyStateTreeNode, type: IAnyType, dropped?: DroppedSessionNode[]): DroppedSessionNode[];
|
|
9
|
+
export interface NonPortableLocation {
|
|
10
|
+
locationType: string;
|
|
11
|
+
name: string;
|
|
12
|
+
trackId?: string;
|
|
13
|
+
trackName?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface WebPortabilityReport {
|
|
16
|
+
nonPortable: NonPortableLocation[];
|
|
17
|
+
portable: boolean;
|
|
18
|
+
}
|
|
19
|
+
export declare function analyzeWebPortability(snapshot: unknown): WebPortabilityReport;
|
|
20
|
+
export interface TrackSnapshot {
|
|
21
|
+
trackId: string;
|
|
22
|
+
[key: string]: unknown;
|
|
23
|
+
}
|
|
24
|
+
export interface WebExportInput {
|
|
25
|
+
assemblies?: AssemblySnapshot[];
|
|
26
|
+
tracks?: TrackSnapshot[];
|
|
27
|
+
plugins?: PluginDefinition[];
|
|
28
|
+
connections?: unknown[];
|
|
29
|
+
configuration?: {
|
|
30
|
+
sourceConfigUrl?: string;
|
|
31
|
+
webExportUrl?: string;
|
|
32
|
+
};
|
|
33
|
+
defaultSession?: Record<string, unknown>;
|
|
34
|
+
}
|
|
35
|
+
export interface AssemblySnapshot {
|
|
36
|
+
name: string;
|
|
37
|
+
[key: string]: unknown;
|
|
38
|
+
}
|
|
39
|
+
export interface HostedBaseConfig {
|
|
40
|
+
assemblies?: AssemblySnapshot[];
|
|
41
|
+
tracks?: TrackSnapshot[];
|
|
42
|
+
internetAccounts?: {
|
|
43
|
+
internetAccountId?: string;
|
|
44
|
+
}[];
|
|
45
|
+
plugins?: PluginDefinition[];
|
|
46
|
+
connections?: unknown[];
|
|
47
|
+
configuration?: {
|
|
48
|
+
shareURL?: string;
|
|
49
|
+
};
|
|
50
|
+
[key: string]: unknown;
|
|
51
|
+
}
|
|
52
|
+
export interface HostedBase {
|
|
53
|
+
config: HostedBaseConfig;
|
|
54
|
+
forms: HydratedForms;
|
|
55
|
+
}
|
|
56
|
+
export interface WebExportPlan {
|
|
57
|
+
strategy: 'hostedConfigBase' | 'selfContained';
|
|
58
|
+
configUrl?: string;
|
|
59
|
+
webBaseUrl: string;
|
|
60
|
+
session: Record<string, unknown>;
|
|
61
|
+
droppedTracks: string[];
|
|
62
|
+
blockingFiles: string[];
|
|
63
|
+
selfContainedReason?: SelfContainedReason;
|
|
64
|
+
droppedTextIndexes: string[];
|
|
65
|
+
revertedAssemblies: string[];
|
|
66
|
+
unavailableAccounts: string[];
|
|
67
|
+
}
|
|
68
|
+
export type SelfContainedReason = 'noSourceConfig' | 'baseUnreachable' | 'assembliesNotInBase';
|
|
69
|
+
export declare function planWebExport(snapshot: WebExportInput, base?: HostedBase): WebExportPlan;
|
|
70
|
+
export declare const DEFAULT_WEB_BASE_URL = "https://jbrowse.org/code/jb2/latest/";
|
|
71
|
+
export declare function buildWebExportUrl(plan: Pick<WebExportPlan, 'webBaseUrl' | 'configUrl'>, sessionParam: string, options?: {
|
|
72
|
+
password?: string;
|
|
73
|
+
exportedFrom?: string;
|
|
74
|
+
}): string;
|