@jbrowse/web-core 2.6.1 → 2.6.2
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/web-core",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.2",
|
|
4
4
|
"description": "JBrowse 2 code shared between web-app type products",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jbrowse",
|
|
@@ -26,13 +26,12 @@
|
|
|
26
26
|
"module": "esm/index.js",
|
|
27
27
|
"files": [
|
|
28
28
|
"dist",
|
|
29
|
-
"esm"
|
|
30
|
-
"src"
|
|
29
|
+
"esm"
|
|
31
30
|
],
|
|
32
31
|
"scripts": {
|
|
33
32
|
"build:esm": "tsc --build tsconfig.build.esm.json",
|
|
34
|
-
"build:
|
|
35
|
-
"build": "npm run build:esm && npm run build:
|
|
33
|
+
"build:commonjs": "tsc --build tsconfig.build.commonjs.json",
|
|
34
|
+
"build": "npm run build:esm && npm run build:commonjs",
|
|
36
35
|
"test": "cd ../..; jest packages/web-core",
|
|
37
36
|
"clean": "rimraf dist esm *.tsbuildinfo",
|
|
38
37
|
"prebuild": "yarn clean",
|
|
@@ -43,8 +42,8 @@
|
|
|
43
42
|
},
|
|
44
43
|
"dependencies": {
|
|
45
44
|
"@babel/runtime": "^7.16.3",
|
|
46
|
-
"@jbrowse/app-core": "^2.6.
|
|
47
|
-
"@jbrowse/product-core": "^2.6.
|
|
45
|
+
"@jbrowse/app-core": "^2.6.2",
|
|
46
|
+
"@jbrowse/product-core": "^2.6.2",
|
|
48
47
|
"@mui/icons-material": "^5.0.0",
|
|
49
48
|
"@mui/material": "^5.10.17",
|
|
50
49
|
"clone": "^2.0.0",
|
|
@@ -64,5 +63,5 @@
|
|
|
64
63
|
"publishConfig": {
|
|
65
64
|
"access": "public"
|
|
66
65
|
},
|
|
67
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "bbea587a402d9974acdd804a33f4b77f31a2fd5f"
|
|
68
67
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { AboutDialog as default } from '@jbrowse/product-core'
|
|
@@ -1,413 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
import { lazy } from 'react'
|
|
3
|
-
import clone from 'clone'
|
|
4
|
-
import { PluginDefinition } from '@jbrowse/core/PluginLoader'
|
|
5
|
-
import {
|
|
6
|
-
getConf,
|
|
7
|
-
AnyConfigurationModel,
|
|
8
|
-
readConfObject,
|
|
9
|
-
AnyConfiguration,
|
|
10
|
-
} from '@jbrowse/core/configuration'
|
|
11
|
-
import { AssemblyManager, JBrowsePlugin } from '@jbrowse/core/util/types'
|
|
12
|
-
import addSnackbarToModel from '@jbrowse/core/ui/SnackbarModel'
|
|
13
|
-
import { localStorageGetItem, localStorageSetItem } from '@jbrowse/core/util'
|
|
14
|
-
import { autorun } from 'mobx'
|
|
15
|
-
import {
|
|
16
|
-
addDisposer,
|
|
17
|
-
cast,
|
|
18
|
-
getParent,
|
|
19
|
-
getSnapshot,
|
|
20
|
-
types,
|
|
21
|
-
SnapshotIn,
|
|
22
|
-
Instance,
|
|
23
|
-
} from 'mobx-state-tree'
|
|
24
|
-
import TextSearchManager from '@jbrowse/core/TextSearch/TextSearchManager'
|
|
25
|
-
import { BaseTrackConfig } from '@jbrowse/core/pluggableElementTypes'
|
|
26
|
-
|
|
27
|
-
// icons
|
|
28
|
-
import SettingsIcon from '@mui/icons-material/Settings'
|
|
29
|
-
import CopyIcon from '@mui/icons-material/FileCopy'
|
|
30
|
-
import DeleteIcon from '@mui/icons-material/Delete'
|
|
31
|
-
import InfoIcon from '@mui/icons-material/Info'
|
|
32
|
-
|
|
33
|
-
// locals
|
|
34
|
-
import PluginManager from '@jbrowse/core/PluginManager'
|
|
35
|
-
import {
|
|
36
|
-
DialogQueueSessionMixin,
|
|
37
|
-
DrawerWidgetSessionMixin,
|
|
38
|
-
MultipleViewsSessionMixin,
|
|
39
|
-
ReferenceManagementSessionMixin,
|
|
40
|
-
SessionTracksManagerSessionMixin,
|
|
41
|
-
ThemeManagerSessionMixin,
|
|
42
|
-
} from '@jbrowse/product-core'
|
|
43
|
-
import {
|
|
44
|
-
SessionAssembliesMixin,
|
|
45
|
-
TemporaryAssembliesMixin,
|
|
46
|
-
} from '@jbrowse/app-core'
|
|
47
|
-
import { BaseAssemblyConfigSchema } from '@jbrowse/core/assemblyManager'
|
|
48
|
-
// locals
|
|
49
|
-
import { WebSessionConnectionsMixin } from '../SessionConnections'
|
|
50
|
-
import { BaseConnectionConfigModel } from '@jbrowse/core/pluggableElementTypes/models/baseConnectionConfig'
|
|
51
|
-
|
|
52
|
-
const AboutDialog = lazy(() => import('./AboutDialog'))
|
|
53
|
-
|
|
54
|
-
export function BaseWebSession({
|
|
55
|
-
pluginManager,
|
|
56
|
-
assemblyConfigSchema,
|
|
57
|
-
}: {
|
|
58
|
-
pluginManager: PluginManager
|
|
59
|
-
assemblyConfigSchema: BaseAssemblyConfigSchema
|
|
60
|
-
}) {
|
|
61
|
-
const sessionModel = types
|
|
62
|
-
.compose(
|
|
63
|
-
'WebCoreSessionModel',
|
|
64
|
-
ReferenceManagementSessionMixin(pluginManager),
|
|
65
|
-
DrawerWidgetSessionMixin(pluginManager),
|
|
66
|
-
DialogQueueSessionMixin(pluginManager),
|
|
67
|
-
ThemeManagerSessionMixin(pluginManager),
|
|
68
|
-
MultipleViewsSessionMixin(pluginManager),
|
|
69
|
-
SessionTracksManagerSessionMixin(pluginManager),
|
|
70
|
-
SessionAssembliesMixin(pluginManager, assemblyConfigSchema),
|
|
71
|
-
TemporaryAssembliesMixin(pluginManager, assemblyConfigSchema),
|
|
72
|
-
WebSessionConnectionsMixin(pluginManager),
|
|
73
|
-
)
|
|
74
|
-
.props({
|
|
75
|
-
/**
|
|
76
|
-
* #property
|
|
77
|
-
*/
|
|
78
|
-
margin: 0,
|
|
79
|
-
/**
|
|
80
|
-
* #property
|
|
81
|
-
*/
|
|
82
|
-
sessionPlugins: types.array(types.frozen()),
|
|
83
|
-
})
|
|
84
|
-
.views(self => ({
|
|
85
|
-
/**
|
|
86
|
-
* #getter
|
|
87
|
-
*/
|
|
88
|
-
get tracks(): AnyConfigurationModel[] {
|
|
89
|
-
return [...self.sessionTracks, ...self.jbrowse.tracks]
|
|
90
|
-
},
|
|
91
|
-
/**
|
|
92
|
-
* #getter
|
|
93
|
-
*/
|
|
94
|
-
get root() {
|
|
95
|
-
return getParent<any>(self)
|
|
96
|
-
},
|
|
97
|
-
/**
|
|
98
|
-
* #getter
|
|
99
|
-
* list of sessionAssemblies and jbrowse config assemblies, does not
|
|
100
|
-
* include temporaryAssemblies. basically the list to be displayed in a
|
|
101
|
-
* AssemblySelector dropdown
|
|
102
|
-
*/
|
|
103
|
-
get assemblies(): Instance<BaseAssemblyConfigSchema[]> {
|
|
104
|
-
return [...self.jbrowse.assemblies, ...self.sessionAssemblies]
|
|
105
|
-
},
|
|
106
|
-
/**
|
|
107
|
-
* #getter
|
|
108
|
-
* list of config connections and session connections
|
|
109
|
-
*/
|
|
110
|
-
get connections(): BaseConnectionConfigModel[] {
|
|
111
|
-
return [...self.jbrowse.connections, ...self.sessionConnections]
|
|
112
|
-
},
|
|
113
|
-
}))
|
|
114
|
-
.actions(self => ({
|
|
115
|
-
/**
|
|
116
|
-
* #action
|
|
117
|
-
*/
|
|
118
|
-
setName(str: string) {
|
|
119
|
-
self.name = str
|
|
120
|
-
},
|
|
121
|
-
}))
|
|
122
|
-
.volatile((/* self */) => ({
|
|
123
|
-
/**
|
|
124
|
-
* #volatile
|
|
125
|
-
*/
|
|
126
|
-
sessionThemeName: localStorageGetItem('themeName') || 'default',
|
|
127
|
-
/**
|
|
128
|
-
* #volatile
|
|
129
|
-
* this is the current "task" that is being performed in the UI.
|
|
130
|
-
* this is usually an object of the form
|
|
131
|
-
* `{ taskName: "configure", target: thing_being_configured }`
|
|
132
|
-
*/
|
|
133
|
-
task: undefined,
|
|
134
|
-
}))
|
|
135
|
-
|
|
136
|
-
.views(self => ({
|
|
137
|
-
/**
|
|
138
|
-
* #getter
|
|
139
|
-
* list of sessionAssemblies and jbrowse config assemblies, does not
|
|
140
|
-
* include temporaryAssemblies. basically the list to be displayed in a
|
|
141
|
-
* AssemblySelector dropdown
|
|
142
|
-
*/
|
|
143
|
-
get assemblyNames() {
|
|
144
|
-
return self.assemblies.map(f => readConfObject(f, 'name') as string)
|
|
145
|
-
},
|
|
146
|
-
/**
|
|
147
|
-
* #getter
|
|
148
|
-
*/
|
|
149
|
-
get version() {
|
|
150
|
-
return self.root.version
|
|
151
|
-
},
|
|
152
|
-
/**
|
|
153
|
-
* #getter
|
|
154
|
-
*/
|
|
155
|
-
get shareURL() {
|
|
156
|
-
return getConf(self.jbrowse, 'shareURL')
|
|
157
|
-
},
|
|
158
|
-
/**
|
|
159
|
-
* #getter
|
|
160
|
-
*/
|
|
161
|
-
get textSearchManager(): TextSearchManager {
|
|
162
|
-
return self.root.textSearchManager
|
|
163
|
-
},
|
|
164
|
-
/**
|
|
165
|
-
* #getter
|
|
166
|
-
*/
|
|
167
|
-
get assemblyManager(): AssemblyManager {
|
|
168
|
-
return self.root.assemblyManager
|
|
169
|
-
},
|
|
170
|
-
/**
|
|
171
|
-
* #getter
|
|
172
|
-
*/
|
|
173
|
-
get savedSessions() {
|
|
174
|
-
return self.root.savedSessions
|
|
175
|
-
},
|
|
176
|
-
/**
|
|
177
|
-
* #getter
|
|
178
|
-
*/
|
|
179
|
-
get previousAutosaveId() {
|
|
180
|
-
return self.root.previousAutosaveId
|
|
181
|
-
},
|
|
182
|
-
/**
|
|
183
|
-
* #getter
|
|
184
|
-
*/
|
|
185
|
-
get savedSessionNames() {
|
|
186
|
-
return self.root.savedSessionNames
|
|
187
|
-
},
|
|
188
|
-
/**
|
|
189
|
-
* #getter
|
|
190
|
-
*/
|
|
191
|
-
get history() {
|
|
192
|
-
return self.root.history
|
|
193
|
-
},
|
|
194
|
-
/**
|
|
195
|
-
* #getter
|
|
196
|
-
*/
|
|
197
|
-
get menus() {
|
|
198
|
-
return self.root.menus
|
|
199
|
-
},
|
|
200
|
-
/**
|
|
201
|
-
* #method
|
|
202
|
-
*/
|
|
203
|
-
renderProps() {
|
|
204
|
-
return {
|
|
205
|
-
theme: self.theme,
|
|
206
|
-
}
|
|
207
|
-
},
|
|
208
|
-
}))
|
|
209
|
-
.actions(self => ({
|
|
210
|
-
/**
|
|
211
|
-
* #action
|
|
212
|
-
*/
|
|
213
|
-
addAssemblyConf(conf: AnyConfiguration) {
|
|
214
|
-
self.jbrowse.addAssemblyConf(conf)
|
|
215
|
-
},
|
|
216
|
-
/**
|
|
217
|
-
* #action
|
|
218
|
-
*/
|
|
219
|
-
addSessionPlugin(plugin: JBrowsePlugin) {
|
|
220
|
-
if (self.sessionPlugins.some(p => p.name === plugin.name)) {
|
|
221
|
-
throw new Error('session plugin cannot be installed twice')
|
|
222
|
-
}
|
|
223
|
-
self.sessionPlugins.push(plugin)
|
|
224
|
-
self.root.setPluginsUpdated(true)
|
|
225
|
-
},
|
|
226
|
-
|
|
227
|
-
/**
|
|
228
|
-
* #action
|
|
229
|
-
*/
|
|
230
|
-
removeSessionPlugin(pluginDefinition: PluginDefinition) {
|
|
231
|
-
self.sessionPlugins = cast(
|
|
232
|
-
self.sessionPlugins.filter(
|
|
233
|
-
plugin =>
|
|
234
|
-
plugin.url !== pluginDefinition.url ||
|
|
235
|
-
plugin.umdUrl !== pluginDefinition.umdUrl ||
|
|
236
|
-
plugin.cjsUrl !== pluginDefinition.cjsUrl ||
|
|
237
|
-
plugin.esmUrl !== pluginDefinition.esmUrl,
|
|
238
|
-
),
|
|
239
|
-
)
|
|
240
|
-
getParent<any>(self).setPluginsUpdated(true)
|
|
241
|
-
},
|
|
242
|
-
|
|
243
|
-
/**
|
|
244
|
-
* #action
|
|
245
|
-
*/
|
|
246
|
-
addSavedSession(sessionSnapshot: SnapshotIn<typeof self>) {
|
|
247
|
-
return self.root.addSavedSession(sessionSnapshot)
|
|
248
|
-
},
|
|
249
|
-
|
|
250
|
-
/**
|
|
251
|
-
* #action
|
|
252
|
-
*/
|
|
253
|
-
removeSavedSession(sessionSnapshot: { name: string }) {
|
|
254
|
-
return self.root.removeSavedSession(sessionSnapshot)
|
|
255
|
-
},
|
|
256
|
-
|
|
257
|
-
/**
|
|
258
|
-
* #action
|
|
259
|
-
*/
|
|
260
|
-
renameCurrentSession(sessionName: string) {
|
|
261
|
-
return self.root.renameCurrentSession(sessionName)
|
|
262
|
-
},
|
|
263
|
-
|
|
264
|
-
/**
|
|
265
|
-
* #action
|
|
266
|
-
*/
|
|
267
|
-
duplicateCurrentSession() {
|
|
268
|
-
return self.root.duplicateCurrentSession()
|
|
269
|
-
},
|
|
270
|
-
/**
|
|
271
|
-
* #action
|
|
272
|
-
*/
|
|
273
|
-
activateSession(sessionName: string) {
|
|
274
|
-
return self.root.activateSession(sessionName)
|
|
275
|
-
},
|
|
276
|
-
|
|
277
|
-
/**
|
|
278
|
-
* #action
|
|
279
|
-
*/
|
|
280
|
-
setDefaultSession() {
|
|
281
|
-
return self.root.setDefaultSession()
|
|
282
|
-
},
|
|
283
|
-
|
|
284
|
-
/**
|
|
285
|
-
* #action
|
|
286
|
-
*/
|
|
287
|
-
saveSessionToLocalStorage() {
|
|
288
|
-
return self.root.saveSessionToLocalStorage()
|
|
289
|
-
},
|
|
290
|
-
|
|
291
|
-
/**
|
|
292
|
-
* #action
|
|
293
|
-
*/
|
|
294
|
-
loadAutosaveSession() {
|
|
295
|
-
return self.root.loadAutosaveSession()
|
|
296
|
-
},
|
|
297
|
-
|
|
298
|
-
/**
|
|
299
|
-
* #action
|
|
300
|
-
*/
|
|
301
|
-
setSession(sessionSnapshot: SnapshotIn<typeof self>) {
|
|
302
|
-
return self.root.setSession(sessionSnapshot)
|
|
303
|
-
},
|
|
304
|
-
}))
|
|
305
|
-
.actions(self => ({
|
|
306
|
-
/**
|
|
307
|
-
* #action
|
|
308
|
-
*/
|
|
309
|
-
editTrackConfiguration(configuration: AnyConfigurationModel) {
|
|
310
|
-
const { adminMode, sessionTracks } = self
|
|
311
|
-
if (!adminMode && !sessionTracks.includes(configuration)) {
|
|
312
|
-
throw new Error("Can't edit the configuration of a non-session track")
|
|
313
|
-
}
|
|
314
|
-
self.editConfiguration(configuration)
|
|
315
|
-
},
|
|
316
|
-
}))
|
|
317
|
-
.views(self => ({
|
|
318
|
-
/**
|
|
319
|
-
* #method
|
|
320
|
-
*/
|
|
321
|
-
getTrackActionMenuItems(config: BaseTrackConfig) {
|
|
322
|
-
const { adminMode, sessionTracks } = self
|
|
323
|
-
const canEdit =
|
|
324
|
-
adminMode || sessionTracks.find(t => t.trackId === config.trackId)
|
|
325
|
-
|
|
326
|
-
// disable if it is a reference sequence track
|
|
327
|
-
const isRefSeq = config.type === 'ReferenceSequenceTrack'
|
|
328
|
-
return [
|
|
329
|
-
{
|
|
330
|
-
label: 'About track',
|
|
331
|
-
onClick: () => {
|
|
332
|
-
self.queueDialog(handleClose => [
|
|
333
|
-
AboutDialog,
|
|
334
|
-
{ config, handleClose },
|
|
335
|
-
])
|
|
336
|
-
},
|
|
337
|
-
icon: InfoIcon,
|
|
338
|
-
},
|
|
339
|
-
{
|
|
340
|
-
label: 'Settings',
|
|
341
|
-
disabled: !canEdit,
|
|
342
|
-
onClick: () => self.editTrackConfiguration(config),
|
|
343
|
-
icon: SettingsIcon,
|
|
344
|
-
},
|
|
345
|
-
{
|
|
346
|
-
label: 'Delete track',
|
|
347
|
-
disabled: !canEdit || isRefSeq,
|
|
348
|
-
onClick: () => self.deleteTrackConf(config),
|
|
349
|
-
icon: DeleteIcon,
|
|
350
|
-
},
|
|
351
|
-
{
|
|
352
|
-
label: 'Copy track',
|
|
353
|
-
disabled: isRefSeq,
|
|
354
|
-
onClick: () => {
|
|
355
|
-
type Display = { displayId: string }
|
|
356
|
-
const snap = clone(getSnapshot(config)) as {
|
|
357
|
-
[key: string]: unknown
|
|
358
|
-
displays: Display[]
|
|
359
|
-
}
|
|
360
|
-
const now = Date.now()
|
|
361
|
-
snap.trackId += `-${now}`
|
|
362
|
-
snap.displays.forEach(display => {
|
|
363
|
-
display.displayId += `-${now}`
|
|
364
|
-
})
|
|
365
|
-
// the -sessionTrack suffix to trackId is used as metadata for
|
|
366
|
-
// the track selector to store the track in a special category,
|
|
367
|
-
// and default category is also cleared
|
|
368
|
-
if (!self.adminMode) {
|
|
369
|
-
snap.trackId += '-sessionTrack'
|
|
370
|
-
snap.category = undefined
|
|
371
|
-
}
|
|
372
|
-
snap.name += ' (copy)'
|
|
373
|
-
self.addTrackConf(snap)
|
|
374
|
-
},
|
|
375
|
-
icon: CopyIcon,
|
|
376
|
-
},
|
|
377
|
-
]
|
|
378
|
-
},
|
|
379
|
-
}))
|
|
380
|
-
.actions(self => ({
|
|
381
|
-
afterAttach() {
|
|
382
|
-
addDisposer(
|
|
383
|
-
self,
|
|
384
|
-
autorun(() => {
|
|
385
|
-
localStorageSetItem('drawerPosition', self.drawerPosition)
|
|
386
|
-
localStorageSetItem('themeName', self.themeName)
|
|
387
|
-
}),
|
|
388
|
-
)
|
|
389
|
-
},
|
|
390
|
-
}))
|
|
391
|
-
|
|
392
|
-
const extendedSessionModel = pluginManager.evaluateExtensionPoint(
|
|
393
|
-
'Core-extendSession',
|
|
394
|
-
sessionModel,
|
|
395
|
-
) as typeof sessionModel
|
|
396
|
-
|
|
397
|
-
return types.snapshotProcessor(addSnackbarToModel(extendedSessionModel), {
|
|
398
|
-
// @ts-expect-error
|
|
399
|
-
preProcessor(snapshot) {
|
|
400
|
-
if (snapshot) {
|
|
401
|
-
// @ts-expect-error
|
|
402
|
-
const { connectionInstances, ...rest } = snapshot || {}
|
|
403
|
-
// connectionInstances schema changed from object to an array, so any
|
|
404
|
-
// old connectionInstances as object is in snapshot, filter it out
|
|
405
|
-
// https://github.com/GMOD/jbrowse-components/issues/1903
|
|
406
|
-
if (!Array.isArray(connectionInstances)) {
|
|
407
|
-
return rest
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
return snapshot
|
|
411
|
-
},
|
|
412
|
-
})
|
|
413
|
-
}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { types } from 'mobx-state-tree'
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
ConnectionManagementSessionMixin,
|
|
5
|
-
SessionWithSessionTracks,
|
|
6
|
-
} from '@jbrowse/product-core'
|
|
7
|
-
import type { BaseSession } from '@jbrowse/product-core'
|
|
8
|
-
|
|
9
|
-
import PluginManager from '@jbrowse/core/PluginManager'
|
|
10
|
-
import { AnyConfigurationModel } from '@jbrowse/core/configuration'
|
|
11
|
-
import { BaseConnectionConfigModel } from '@jbrowse/core/pluggableElementTypes/models/baseConnectionConfig'
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* #stateModel WebSessionConnectionsMixin
|
|
15
|
-
* #category session
|
|
16
|
-
*/
|
|
17
|
-
export function WebSessionConnectionsMixin(pluginManager: PluginManager) {
|
|
18
|
-
return types
|
|
19
|
-
.compose(
|
|
20
|
-
'SessionConnectionsManagement',
|
|
21
|
-
ConnectionManagementSessionMixin(pluginManager),
|
|
22
|
-
types.model({
|
|
23
|
-
/**
|
|
24
|
-
* #property
|
|
25
|
-
*/
|
|
26
|
-
sessionConnections: types.array(
|
|
27
|
-
pluginManager.pluggableConfigSchemaType('connection'),
|
|
28
|
-
),
|
|
29
|
-
}),
|
|
30
|
-
)
|
|
31
|
-
.actions(s => {
|
|
32
|
-
const self = s as typeof s & BaseSession & SessionWithSessionTracks
|
|
33
|
-
const superDeleteConnection = self.deleteConnection
|
|
34
|
-
const superAddConnectionConf = self.addConnectionConf
|
|
35
|
-
return {
|
|
36
|
-
addConnectionConf(connectionConf: BaseConnectionConfigModel) {
|
|
37
|
-
if (self.adminMode) {
|
|
38
|
-
return superAddConnectionConf(connectionConf)
|
|
39
|
-
}
|
|
40
|
-
const { connectionId, type } = connectionConf
|
|
41
|
-
if (!type) {
|
|
42
|
-
throw new Error(`unknown connection type ${type}`)
|
|
43
|
-
}
|
|
44
|
-
const connection = self.sessionTracks.find(
|
|
45
|
-
c => c.connectionId === connectionId,
|
|
46
|
-
)
|
|
47
|
-
if (connection) {
|
|
48
|
-
return connection
|
|
49
|
-
}
|
|
50
|
-
const length = self.sessionConnections.push(connectionConf)
|
|
51
|
-
return self.sessionConnections[length - 1]
|
|
52
|
-
},
|
|
53
|
-
|
|
54
|
-
deleteConnection(configuration: AnyConfigurationModel) {
|
|
55
|
-
let deletedConn
|
|
56
|
-
if (self.adminMode) {
|
|
57
|
-
deletedConn = superDeleteConnection(configuration)
|
|
58
|
-
}
|
|
59
|
-
if (!deletedConn) {
|
|
60
|
-
const { connectionId } = configuration
|
|
61
|
-
const idx = self.sessionConnections.findIndex(
|
|
62
|
-
c => c.connectionId === connectionId,
|
|
63
|
-
)
|
|
64
|
-
if (idx === -1) {
|
|
65
|
-
return undefined
|
|
66
|
-
}
|
|
67
|
-
return self.sessionConnections.splice(idx, 1)
|
|
68
|
-
}
|
|
69
|
-
return deletedConn
|
|
70
|
-
},
|
|
71
|
-
}
|
|
72
|
-
})
|
|
73
|
-
}
|
package/src/index.ts
DELETED