@jbrowse/web-core 2.6.1
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 +201 -0
- package/dist/BaseWebSession/AboutDialog.d.ts +1 -0
- package/dist/BaseWebSession/AboutDialog.js +5 -0
- package/dist/BaseWebSession/index.d.ts +3776 -0
- package/dist/BaseWebSession/index.js +362 -0
- package/dist/SessionConnections.d.ts +176 -0
- package/dist/SessionConnections.js +56 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +18 -0
- package/esm/BaseWebSession/AboutDialog.d.ts +1 -0
- package/esm/BaseWebSession/AboutDialog.js +1 -0
- package/esm/BaseWebSession/index.d.ts +3776 -0
- package/esm/BaseWebSession/index.js +332 -0
- package/esm/SessionConnections.d.ts +176 -0
- package/esm/SessionConnections.js +52 -0
- package/esm/index.d.ts +2 -0
- package/esm/index.js +2 -0
- package/package.json +68 -0
- package/src/BaseWebSession/AboutDialog.tsx +1 -0
- package/src/BaseWebSession/index.ts +413 -0
- package/src/SessionConnections.ts +73 -0
- package/src/index.ts +2 -0
|
@@ -0,0 +1,362 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.BaseWebSession = void 0;
|
|
30
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
31
|
+
const react_1 = require("react");
|
|
32
|
+
const clone_1 = __importDefault(require("clone"));
|
|
33
|
+
const configuration_1 = require("@jbrowse/core/configuration");
|
|
34
|
+
const SnackbarModel_1 = __importDefault(require("@jbrowse/core/ui/SnackbarModel"));
|
|
35
|
+
const util_1 = require("@jbrowse/core/util");
|
|
36
|
+
const mobx_1 = require("mobx");
|
|
37
|
+
const mobx_state_tree_1 = require("mobx-state-tree");
|
|
38
|
+
// icons
|
|
39
|
+
const Settings_1 = __importDefault(require("@mui/icons-material/Settings"));
|
|
40
|
+
const FileCopy_1 = __importDefault(require("@mui/icons-material/FileCopy"));
|
|
41
|
+
const Delete_1 = __importDefault(require("@mui/icons-material/Delete"));
|
|
42
|
+
const Info_1 = __importDefault(require("@mui/icons-material/Info"));
|
|
43
|
+
const product_core_1 = require("@jbrowse/product-core");
|
|
44
|
+
const app_core_1 = require("@jbrowse/app-core");
|
|
45
|
+
// locals
|
|
46
|
+
const SessionConnections_1 = require("../SessionConnections");
|
|
47
|
+
const AboutDialog = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./AboutDialog'))));
|
|
48
|
+
function BaseWebSession({ pluginManager, assemblyConfigSchema, }) {
|
|
49
|
+
const sessionModel = mobx_state_tree_1.types
|
|
50
|
+
.compose('WebCoreSessionModel', (0, product_core_1.ReferenceManagementSessionMixin)(pluginManager), (0, product_core_1.DrawerWidgetSessionMixin)(pluginManager), (0, product_core_1.DialogQueueSessionMixin)(pluginManager), (0, product_core_1.ThemeManagerSessionMixin)(pluginManager), (0, product_core_1.MultipleViewsSessionMixin)(pluginManager), (0, product_core_1.SessionTracksManagerSessionMixin)(pluginManager), (0, app_core_1.SessionAssembliesMixin)(pluginManager, assemblyConfigSchema), (0, app_core_1.TemporaryAssembliesMixin)(pluginManager, assemblyConfigSchema), (0, SessionConnections_1.WebSessionConnectionsMixin)(pluginManager))
|
|
51
|
+
.props({
|
|
52
|
+
/**
|
|
53
|
+
* #property
|
|
54
|
+
*/
|
|
55
|
+
margin: 0,
|
|
56
|
+
/**
|
|
57
|
+
* #property
|
|
58
|
+
*/
|
|
59
|
+
sessionPlugins: mobx_state_tree_1.types.array(mobx_state_tree_1.types.frozen()),
|
|
60
|
+
})
|
|
61
|
+
.views(self => ({
|
|
62
|
+
/**
|
|
63
|
+
* #getter
|
|
64
|
+
*/
|
|
65
|
+
get tracks() {
|
|
66
|
+
return [...self.sessionTracks, ...self.jbrowse.tracks];
|
|
67
|
+
},
|
|
68
|
+
/**
|
|
69
|
+
* #getter
|
|
70
|
+
*/
|
|
71
|
+
get root() {
|
|
72
|
+
return (0, mobx_state_tree_1.getParent)(self);
|
|
73
|
+
},
|
|
74
|
+
/**
|
|
75
|
+
* #getter
|
|
76
|
+
* list of sessionAssemblies and jbrowse config assemblies, does not
|
|
77
|
+
* include temporaryAssemblies. basically the list to be displayed in a
|
|
78
|
+
* AssemblySelector dropdown
|
|
79
|
+
*/
|
|
80
|
+
get assemblies() {
|
|
81
|
+
return [...self.jbrowse.assemblies, ...self.sessionAssemblies];
|
|
82
|
+
},
|
|
83
|
+
/**
|
|
84
|
+
* #getter
|
|
85
|
+
* list of config connections and session connections
|
|
86
|
+
*/
|
|
87
|
+
get connections() {
|
|
88
|
+
return [...self.jbrowse.connections, ...self.sessionConnections];
|
|
89
|
+
},
|
|
90
|
+
}))
|
|
91
|
+
.actions(self => ({
|
|
92
|
+
/**
|
|
93
|
+
* #action
|
|
94
|
+
*/
|
|
95
|
+
setName(str) {
|
|
96
|
+
self.name = str;
|
|
97
|
+
},
|
|
98
|
+
}))
|
|
99
|
+
.volatile(( /* self */) => ({
|
|
100
|
+
/**
|
|
101
|
+
* #volatile
|
|
102
|
+
*/
|
|
103
|
+
sessionThemeName: (0, util_1.localStorageGetItem)('themeName') || 'default',
|
|
104
|
+
/**
|
|
105
|
+
* #volatile
|
|
106
|
+
* this is the current "task" that is being performed in the UI.
|
|
107
|
+
* this is usually an object of the form
|
|
108
|
+
* `{ taskName: "configure", target: thing_being_configured }`
|
|
109
|
+
*/
|
|
110
|
+
task: undefined,
|
|
111
|
+
}))
|
|
112
|
+
.views(self => ({
|
|
113
|
+
/**
|
|
114
|
+
* #getter
|
|
115
|
+
* list of sessionAssemblies and jbrowse config assemblies, does not
|
|
116
|
+
* include temporaryAssemblies. basically the list to be displayed in a
|
|
117
|
+
* AssemblySelector dropdown
|
|
118
|
+
*/
|
|
119
|
+
get assemblyNames() {
|
|
120
|
+
return self.assemblies.map(f => (0, configuration_1.readConfObject)(f, 'name'));
|
|
121
|
+
},
|
|
122
|
+
/**
|
|
123
|
+
* #getter
|
|
124
|
+
*/
|
|
125
|
+
get version() {
|
|
126
|
+
return self.root.version;
|
|
127
|
+
},
|
|
128
|
+
/**
|
|
129
|
+
* #getter
|
|
130
|
+
*/
|
|
131
|
+
get shareURL() {
|
|
132
|
+
return (0, configuration_1.getConf)(self.jbrowse, 'shareURL');
|
|
133
|
+
},
|
|
134
|
+
/**
|
|
135
|
+
* #getter
|
|
136
|
+
*/
|
|
137
|
+
get textSearchManager() {
|
|
138
|
+
return self.root.textSearchManager;
|
|
139
|
+
},
|
|
140
|
+
/**
|
|
141
|
+
* #getter
|
|
142
|
+
*/
|
|
143
|
+
get assemblyManager() {
|
|
144
|
+
return self.root.assemblyManager;
|
|
145
|
+
},
|
|
146
|
+
/**
|
|
147
|
+
* #getter
|
|
148
|
+
*/
|
|
149
|
+
get savedSessions() {
|
|
150
|
+
return self.root.savedSessions;
|
|
151
|
+
},
|
|
152
|
+
/**
|
|
153
|
+
* #getter
|
|
154
|
+
*/
|
|
155
|
+
get previousAutosaveId() {
|
|
156
|
+
return self.root.previousAutosaveId;
|
|
157
|
+
},
|
|
158
|
+
/**
|
|
159
|
+
* #getter
|
|
160
|
+
*/
|
|
161
|
+
get savedSessionNames() {
|
|
162
|
+
return self.root.savedSessionNames;
|
|
163
|
+
},
|
|
164
|
+
/**
|
|
165
|
+
* #getter
|
|
166
|
+
*/
|
|
167
|
+
get history() {
|
|
168
|
+
return self.root.history;
|
|
169
|
+
},
|
|
170
|
+
/**
|
|
171
|
+
* #getter
|
|
172
|
+
*/
|
|
173
|
+
get menus() {
|
|
174
|
+
return self.root.menus;
|
|
175
|
+
},
|
|
176
|
+
/**
|
|
177
|
+
* #method
|
|
178
|
+
*/
|
|
179
|
+
renderProps() {
|
|
180
|
+
return {
|
|
181
|
+
theme: self.theme,
|
|
182
|
+
};
|
|
183
|
+
},
|
|
184
|
+
}))
|
|
185
|
+
.actions(self => ({
|
|
186
|
+
/**
|
|
187
|
+
* #action
|
|
188
|
+
*/
|
|
189
|
+
addAssemblyConf(conf) {
|
|
190
|
+
self.jbrowse.addAssemblyConf(conf);
|
|
191
|
+
},
|
|
192
|
+
/**
|
|
193
|
+
* #action
|
|
194
|
+
*/
|
|
195
|
+
addSessionPlugin(plugin) {
|
|
196
|
+
if (self.sessionPlugins.some(p => p.name === plugin.name)) {
|
|
197
|
+
throw new Error('session plugin cannot be installed twice');
|
|
198
|
+
}
|
|
199
|
+
self.sessionPlugins.push(plugin);
|
|
200
|
+
self.root.setPluginsUpdated(true);
|
|
201
|
+
},
|
|
202
|
+
/**
|
|
203
|
+
* #action
|
|
204
|
+
*/
|
|
205
|
+
removeSessionPlugin(pluginDefinition) {
|
|
206
|
+
self.sessionPlugins = (0, mobx_state_tree_1.cast)(self.sessionPlugins.filter(plugin => plugin.url !== pluginDefinition.url ||
|
|
207
|
+
plugin.umdUrl !== pluginDefinition.umdUrl ||
|
|
208
|
+
plugin.cjsUrl !== pluginDefinition.cjsUrl ||
|
|
209
|
+
plugin.esmUrl !== pluginDefinition.esmUrl));
|
|
210
|
+
(0, mobx_state_tree_1.getParent)(self).setPluginsUpdated(true);
|
|
211
|
+
},
|
|
212
|
+
/**
|
|
213
|
+
* #action
|
|
214
|
+
*/
|
|
215
|
+
addSavedSession(sessionSnapshot) {
|
|
216
|
+
return self.root.addSavedSession(sessionSnapshot);
|
|
217
|
+
},
|
|
218
|
+
/**
|
|
219
|
+
* #action
|
|
220
|
+
*/
|
|
221
|
+
removeSavedSession(sessionSnapshot) {
|
|
222
|
+
return self.root.removeSavedSession(sessionSnapshot);
|
|
223
|
+
},
|
|
224
|
+
/**
|
|
225
|
+
* #action
|
|
226
|
+
*/
|
|
227
|
+
renameCurrentSession(sessionName) {
|
|
228
|
+
return self.root.renameCurrentSession(sessionName);
|
|
229
|
+
},
|
|
230
|
+
/**
|
|
231
|
+
* #action
|
|
232
|
+
*/
|
|
233
|
+
duplicateCurrentSession() {
|
|
234
|
+
return self.root.duplicateCurrentSession();
|
|
235
|
+
},
|
|
236
|
+
/**
|
|
237
|
+
* #action
|
|
238
|
+
*/
|
|
239
|
+
activateSession(sessionName) {
|
|
240
|
+
return self.root.activateSession(sessionName);
|
|
241
|
+
},
|
|
242
|
+
/**
|
|
243
|
+
* #action
|
|
244
|
+
*/
|
|
245
|
+
setDefaultSession() {
|
|
246
|
+
return self.root.setDefaultSession();
|
|
247
|
+
},
|
|
248
|
+
/**
|
|
249
|
+
* #action
|
|
250
|
+
*/
|
|
251
|
+
saveSessionToLocalStorage() {
|
|
252
|
+
return self.root.saveSessionToLocalStorage();
|
|
253
|
+
},
|
|
254
|
+
/**
|
|
255
|
+
* #action
|
|
256
|
+
*/
|
|
257
|
+
loadAutosaveSession() {
|
|
258
|
+
return self.root.loadAutosaveSession();
|
|
259
|
+
},
|
|
260
|
+
/**
|
|
261
|
+
* #action
|
|
262
|
+
*/
|
|
263
|
+
setSession(sessionSnapshot) {
|
|
264
|
+
return self.root.setSession(sessionSnapshot);
|
|
265
|
+
},
|
|
266
|
+
}))
|
|
267
|
+
.actions(self => ({
|
|
268
|
+
/**
|
|
269
|
+
* #action
|
|
270
|
+
*/
|
|
271
|
+
editTrackConfiguration(configuration) {
|
|
272
|
+
const { adminMode, sessionTracks } = self;
|
|
273
|
+
if (!adminMode && !sessionTracks.includes(configuration)) {
|
|
274
|
+
throw new Error("Can't edit the configuration of a non-session track");
|
|
275
|
+
}
|
|
276
|
+
self.editConfiguration(configuration);
|
|
277
|
+
},
|
|
278
|
+
}))
|
|
279
|
+
.views(self => ({
|
|
280
|
+
/**
|
|
281
|
+
* #method
|
|
282
|
+
*/
|
|
283
|
+
getTrackActionMenuItems(config) {
|
|
284
|
+
const { adminMode, sessionTracks } = self;
|
|
285
|
+
const canEdit = adminMode || sessionTracks.find(t => t.trackId === config.trackId);
|
|
286
|
+
// disable if it is a reference sequence track
|
|
287
|
+
const isRefSeq = config.type === 'ReferenceSequenceTrack';
|
|
288
|
+
return [
|
|
289
|
+
{
|
|
290
|
+
label: 'About track',
|
|
291
|
+
onClick: () => {
|
|
292
|
+
self.queueDialog(handleClose => [
|
|
293
|
+
AboutDialog,
|
|
294
|
+
{ config, handleClose },
|
|
295
|
+
]);
|
|
296
|
+
},
|
|
297
|
+
icon: Info_1.default,
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
label: 'Settings',
|
|
301
|
+
disabled: !canEdit,
|
|
302
|
+
onClick: () => self.editTrackConfiguration(config),
|
|
303
|
+
icon: Settings_1.default,
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
label: 'Delete track',
|
|
307
|
+
disabled: !canEdit || isRefSeq,
|
|
308
|
+
onClick: () => self.deleteTrackConf(config),
|
|
309
|
+
icon: Delete_1.default,
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
label: 'Copy track',
|
|
313
|
+
disabled: isRefSeq,
|
|
314
|
+
onClick: () => {
|
|
315
|
+
const snap = (0, clone_1.default)((0, mobx_state_tree_1.getSnapshot)(config));
|
|
316
|
+
const now = Date.now();
|
|
317
|
+
snap.trackId += `-${now}`;
|
|
318
|
+
snap.displays.forEach(display => {
|
|
319
|
+
display.displayId += `-${now}`;
|
|
320
|
+
});
|
|
321
|
+
// the -sessionTrack suffix to trackId is used as metadata for
|
|
322
|
+
// the track selector to store the track in a special category,
|
|
323
|
+
// and default category is also cleared
|
|
324
|
+
if (!self.adminMode) {
|
|
325
|
+
snap.trackId += '-sessionTrack';
|
|
326
|
+
snap.category = undefined;
|
|
327
|
+
}
|
|
328
|
+
snap.name += ' (copy)';
|
|
329
|
+
self.addTrackConf(snap);
|
|
330
|
+
},
|
|
331
|
+
icon: FileCopy_1.default,
|
|
332
|
+
},
|
|
333
|
+
];
|
|
334
|
+
},
|
|
335
|
+
}))
|
|
336
|
+
.actions(self => ({
|
|
337
|
+
afterAttach() {
|
|
338
|
+
(0, mobx_state_tree_1.addDisposer)(self, (0, mobx_1.autorun)(() => {
|
|
339
|
+
(0, util_1.localStorageSetItem)('drawerPosition', self.drawerPosition);
|
|
340
|
+
(0, util_1.localStorageSetItem)('themeName', self.themeName);
|
|
341
|
+
}));
|
|
342
|
+
},
|
|
343
|
+
}));
|
|
344
|
+
const extendedSessionModel = pluginManager.evaluateExtensionPoint('Core-extendSession', sessionModel);
|
|
345
|
+
return mobx_state_tree_1.types.snapshotProcessor((0, SnackbarModel_1.default)(extendedSessionModel), {
|
|
346
|
+
// @ts-expect-error
|
|
347
|
+
preProcessor(snapshot) {
|
|
348
|
+
if (snapshot) {
|
|
349
|
+
// @ts-expect-error
|
|
350
|
+
const { connectionInstances, ...rest } = snapshot || {};
|
|
351
|
+
// connectionInstances schema changed from object to an array, so any
|
|
352
|
+
// old connectionInstances as object is in snapshot, filter it out
|
|
353
|
+
// https://github.com/GMOD/jbrowse-components/issues/1903
|
|
354
|
+
if (!Array.isArray(connectionInstances)) {
|
|
355
|
+
return rest;
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
return snapshot;
|
|
359
|
+
},
|
|
360
|
+
});
|
|
361
|
+
}
|
|
362
|
+
exports.BaseWebSession = BaseWebSession;
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import PluginManager from '@jbrowse/core/PluginManager';
|
|
2
|
+
import { AnyConfigurationModel } from '@jbrowse/core/configuration';
|
|
3
|
+
import { BaseConnectionConfigModel } from '@jbrowse/core/pluggableElementTypes/models/baseConnectionConfig';
|
|
4
|
+
/**
|
|
5
|
+
* #stateModel WebSessionConnectionsMixin
|
|
6
|
+
* #category session
|
|
7
|
+
*/
|
|
8
|
+
export declare function WebSessionConnectionsMixin(pluginManager: PluginManager): import("mobx-state-tree").IModelType<{
|
|
9
|
+
connectionInstances: import("mobx-state-tree").IArrayType<import("mobx-state-tree").IModelType<{
|
|
10
|
+
name: import("mobx-state-tree").ISimpleType<string>;
|
|
11
|
+
tracks: import("mobx-state-tree").IArrayType<import("mobx-state-tree").IAnyModelType>;
|
|
12
|
+
configuration: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
13
|
+
name: {
|
|
14
|
+
type: string;
|
|
15
|
+
defaultValue: string;
|
|
16
|
+
description: string;
|
|
17
|
+
};
|
|
18
|
+
assemblyNames: {
|
|
19
|
+
type: string;
|
|
20
|
+
defaultValue: never[];
|
|
21
|
+
description: string;
|
|
22
|
+
};
|
|
23
|
+
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "connectionId">>;
|
|
24
|
+
}, {
|
|
25
|
+
afterAttach(): void;
|
|
26
|
+
addTrackConf(trackConf: {
|
|
27
|
+
[x: string]: any;
|
|
28
|
+
} & import("mobx-state-tree/dist/internal").NonEmptyObject & {
|
|
29
|
+
setSubschema(slotName: string, data: unknown): any;
|
|
30
|
+
} & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>): any;
|
|
31
|
+
addTrackConfs(trackConfs: ({
|
|
32
|
+
[x: string]: any;
|
|
33
|
+
} & import("mobx-state-tree/dist/internal").NonEmptyObject & {
|
|
34
|
+
setSubschema(slotName: string, data: unknown): any;
|
|
35
|
+
} & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>)[]): any[];
|
|
36
|
+
setTrackConfs(trackConfs: ({
|
|
37
|
+
[x: string]: any;
|
|
38
|
+
} & import("mobx-state-tree/dist/internal").NonEmptyObject & {
|
|
39
|
+
setSubschema(slotName: string, data: unknown): any;
|
|
40
|
+
} & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>)[]): import("mobx-state-tree").IMSTArray<import("mobx-state-tree").IAnyModelType> & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IArrayType<import("mobx-state-tree").IAnyModelType>>;
|
|
41
|
+
clear(): void;
|
|
42
|
+
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
|
|
43
|
+
} & {
|
|
44
|
+
/**
|
|
45
|
+
* #property
|
|
46
|
+
*/
|
|
47
|
+
sessionConnections: import("mobx-state-tree").IArrayType<import("mobx-state-tree").IAnyModelType>;
|
|
48
|
+
}, {
|
|
49
|
+
readonly connections: ({
|
|
50
|
+
[x: string]: any;
|
|
51
|
+
} & import("mobx-state-tree/dist/internal").NonEmptyObject & {
|
|
52
|
+
setSubschema(slotName: string, data: unknown): any;
|
|
53
|
+
} & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
54
|
+
name: {
|
|
55
|
+
type: string;
|
|
56
|
+
defaultValue: string;
|
|
57
|
+
description: string;
|
|
58
|
+
};
|
|
59
|
+
assemblyNames: {
|
|
60
|
+
type: string;
|
|
61
|
+
defaultValue: never[];
|
|
62
|
+
description: string;
|
|
63
|
+
};
|
|
64
|
+
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "connectionId">>>)[];
|
|
65
|
+
} & {
|
|
66
|
+
makeConnection(configuration: {
|
|
67
|
+
[x: string]: any;
|
|
68
|
+
} & import("mobx-state-tree/dist/internal").NonEmptyObject & {
|
|
69
|
+
setSubschema(slotName: string, data: unknown): any;
|
|
70
|
+
} & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>, initialSnapshot?: {}): {
|
|
71
|
+
name: string;
|
|
72
|
+
tracks: import("mobx-state-tree").IMSTArray<import("mobx-state-tree").IAnyModelType> & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IArrayType<import("mobx-state-tree").IAnyModelType>>;
|
|
73
|
+
configuration: {
|
|
74
|
+
[x: string]: any;
|
|
75
|
+
} & import("mobx-state-tree/dist/internal").NonEmptyObject & {
|
|
76
|
+
setSubschema(slotName: string, data: unknown): any;
|
|
77
|
+
} & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
78
|
+
name: {
|
|
79
|
+
type: string;
|
|
80
|
+
defaultValue: string;
|
|
81
|
+
description: string;
|
|
82
|
+
};
|
|
83
|
+
assemblyNames: {
|
|
84
|
+
type: string;
|
|
85
|
+
defaultValue: never[];
|
|
86
|
+
description: string;
|
|
87
|
+
};
|
|
88
|
+
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "connectionId">>>;
|
|
89
|
+
} & import("mobx-state-tree/dist/internal").NonEmptyObject & {
|
|
90
|
+
afterAttach(): void;
|
|
91
|
+
addTrackConf(trackConf: {
|
|
92
|
+
[x: string]: any;
|
|
93
|
+
} & import("mobx-state-tree/dist/internal").NonEmptyObject & {
|
|
94
|
+
setSubschema(slotName: string, data: unknown): any;
|
|
95
|
+
} & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>): any;
|
|
96
|
+
addTrackConfs(trackConfs: ({
|
|
97
|
+
[x: string]: any;
|
|
98
|
+
} & import("mobx-state-tree/dist/internal").NonEmptyObject & {
|
|
99
|
+
setSubschema(slotName: string, data: unknown): any;
|
|
100
|
+
} & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>)[]): any[];
|
|
101
|
+
setTrackConfs(trackConfs: ({
|
|
102
|
+
[x: string]: any;
|
|
103
|
+
} & import("mobx-state-tree/dist/internal").NonEmptyObject & {
|
|
104
|
+
setSubschema(slotName: string, data: unknown): any;
|
|
105
|
+
} & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>)[]): import("mobx-state-tree").IMSTArray<import("mobx-state-tree").IAnyModelType> & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IArrayType<import("mobx-state-tree").IAnyModelType>>;
|
|
106
|
+
clear(): void;
|
|
107
|
+
} & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
|
|
108
|
+
name: import("mobx-state-tree").ISimpleType<string>;
|
|
109
|
+
tracks: import("mobx-state-tree").IArrayType<import("mobx-state-tree").IAnyModelType>;
|
|
110
|
+
configuration: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
111
|
+
name: {
|
|
112
|
+
type: string;
|
|
113
|
+
defaultValue: string;
|
|
114
|
+
description: string;
|
|
115
|
+
};
|
|
116
|
+
assemblyNames: {
|
|
117
|
+
type: string;
|
|
118
|
+
defaultValue: never[];
|
|
119
|
+
description: string;
|
|
120
|
+
};
|
|
121
|
+
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "connectionId">>;
|
|
122
|
+
}, {
|
|
123
|
+
afterAttach(): void;
|
|
124
|
+
addTrackConf(trackConf: {
|
|
125
|
+
[x: string]: any;
|
|
126
|
+
} & import("mobx-state-tree/dist/internal").NonEmptyObject & {
|
|
127
|
+
setSubschema(slotName: string, data: unknown): any;
|
|
128
|
+
} & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>): any;
|
|
129
|
+
addTrackConfs(trackConfs: ({
|
|
130
|
+
[x: string]: any;
|
|
131
|
+
} & import("mobx-state-tree/dist/internal").NonEmptyObject & {
|
|
132
|
+
setSubschema(slotName: string, data: unknown): any;
|
|
133
|
+
} & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>)[]): any[];
|
|
134
|
+
setTrackConfs(trackConfs: ({
|
|
135
|
+
[x: string]: any;
|
|
136
|
+
} & import("mobx-state-tree/dist/internal").NonEmptyObject & {
|
|
137
|
+
setSubschema(slotName: string, data: unknown): any;
|
|
138
|
+
} & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>)[]): import("mobx-state-tree").IMSTArray<import("mobx-state-tree").IAnyModelType> & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IArrayType<import("mobx-state-tree").IAnyModelType>>;
|
|
139
|
+
clear(): void;
|
|
140
|
+
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
|
|
141
|
+
prepareToBreakConnection(configuration: {
|
|
142
|
+
[x: string]: any;
|
|
143
|
+
} & import("mobx-state-tree/dist/internal").NonEmptyObject & {
|
|
144
|
+
setSubschema(slotName: string, data: unknown): any;
|
|
145
|
+
} & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>): (Record<string, number> | (() => void))[] | undefined;
|
|
146
|
+
breakConnection(configuration: {
|
|
147
|
+
[x: string]: any;
|
|
148
|
+
} & import("mobx-state-tree/dist/internal").NonEmptyObject & {
|
|
149
|
+
setSubschema(slotName: string, data: unknown): any;
|
|
150
|
+
} & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>): void;
|
|
151
|
+
deleteConnection(configuration: {
|
|
152
|
+
[x: string]: any;
|
|
153
|
+
} & import("mobx-state-tree/dist/internal").NonEmptyObject & {
|
|
154
|
+
setSubschema(slotName: string, data: unknown): any;
|
|
155
|
+
} & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>): any;
|
|
156
|
+
addConnectionConf(connectionConf: {
|
|
157
|
+
[x: string]: any;
|
|
158
|
+
} & import("mobx-state-tree/dist/internal").NonEmptyObject & {
|
|
159
|
+
setSubschema(slotName: string, data: unknown): any;
|
|
160
|
+
} & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
161
|
+
name: {
|
|
162
|
+
type: string;
|
|
163
|
+
defaultValue: string;
|
|
164
|
+
description: string;
|
|
165
|
+
};
|
|
166
|
+
assemblyNames: {
|
|
167
|
+
type: string;
|
|
168
|
+
defaultValue: never[];
|
|
169
|
+
description: string;
|
|
170
|
+
};
|
|
171
|
+
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "connectionId">>>): any;
|
|
172
|
+
clearConnections(): void;
|
|
173
|
+
} & {
|
|
174
|
+
addConnectionConf(connectionConf: BaseConnectionConfigModel): any;
|
|
175
|
+
deleteConnection(configuration: AnyConfigurationModel): any;
|
|
176
|
+
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WebSessionConnectionsMixin = void 0;
|
|
4
|
+
const mobx_state_tree_1 = require("mobx-state-tree");
|
|
5
|
+
const product_core_1 = require("@jbrowse/product-core");
|
|
6
|
+
/**
|
|
7
|
+
* #stateModel WebSessionConnectionsMixin
|
|
8
|
+
* #category session
|
|
9
|
+
*/
|
|
10
|
+
function WebSessionConnectionsMixin(pluginManager) {
|
|
11
|
+
return mobx_state_tree_1.types
|
|
12
|
+
.compose('SessionConnectionsManagement', (0, product_core_1.ConnectionManagementSessionMixin)(pluginManager), mobx_state_tree_1.types.model({
|
|
13
|
+
/**
|
|
14
|
+
* #property
|
|
15
|
+
*/
|
|
16
|
+
sessionConnections: mobx_state_tree_1.types.array(pluginManager.pluggableConfigSchemaType('connection')),
|
|
17
|
+
}))
|
|
18
|
+
.actions(s => {
|
|
19
|
+
const self = s;
|
|
20
|
+
const superDeleteConnection = self.deleteConnection;
|
|
21
|
+
const superAddConnectionConf = self.addConnectionConf;
|
|
22
|
+
return {
|
|
23
|
+
addConnectionConf(connectionConf) {
|
|
24
|
+
if (self.adminMode) {
|
|
25
|
+
return superAddConnectionConf(connectionConf);
|
|
26
|
+
}
|
|
27
|
+
const { connectionId, type } = connectionConf;
|
|
28
|
+
if (!type) {
|
|
29
|
+
throw new Error(`unknown connection type ${type}`);
|
|
30
|
+
}
|
|
31
|
+
const connection = self.sessionTracks.find(c => c.connectionId === connectionId);
|
|
32
|
+
if (connection) {
|
|
33
|
+
return connection;
|
|
34
|
+
}
|
|
35
|
+
const length = self.sessionConnections.push(connectionConf);
|
|
36
|
+
return self.sessionConnections[length - 1];
|
|
37
|
+
},
|
|
38
|
+
deleteConnection(configuration) {
|
|
39
|
+
let deletedConn;
|
|
40
|
+
if (self.adminMode) {
|
|
41
|
+
deletedConn = superDeleteConnection(configuration);
|
|
42
|
+
}
|
|
43
|
+
if (!deletedConn) {
|
|
44
|
+
const { connectionId } = configuration;
|
|
45
|
+
const idx = self.sessionConnections.findIndex(c => c.connectionId === connectionId);
|
|
46
|
+
if (idx === -1) {
|
|
47
|
+
return undefined;
|
|
48
|
+
}
|
|
49
|
+
return self.sessionConnections.splice(idx, 1);
|
|
50
|
+
}
|
|
51
|
+
return deletedConn;
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
exports.WebSessionConnectionsMixin = WebSessionConnectionsMixin;
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./SessionConnections"), exports);
|
|
18
|
+
__exportStar(require("./BaseWebSession"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { AboutDialog as default } from '@jbrowse/product-core';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { AboutDialog as default } from '@jbrowse/product-core';
|