@jbrowse/core 1.7.11 → 2.1.0
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/BaseFeatureWidget/BaseFeatureDetail.d.ts +20 -4
- package/BaseFeatureWidget/BaseFeatureDetail.js +313 -558
- package/BaseFeatureWidget/SequenceFeatureDetails.js +213 -473
- package/BaseFeatureWidget/index.d.ts +2 -2
- package/BaseFeatureWidget/index.js +88 -124
- package/BaseFeatureWidget/types.d.ts +1 -0
- package/BaseFeatureWidget/types.js +1 -4
- package/BaseFeatureWidget/util.js +40 -75
- package/CorePlugin.js +55 -94
- package/Plugin.js +9 -34
- package/PluginLoader.js +153 -422
- package/PluginManager.d.ts +84 -117
- package/PluginManager.js +377 -666
- package/ReExports/Attributes.d.ts +2 -0
- package/ReExports/Attributes.js +5 -0
- package/ReExports/BaseCard.d.ts +2 -0
- package/ReExports/BaseCard.js +5 -0
- package/ReExports/DataGrid.d.ts +2 -0
- package/ReExports/DataGrid.js +6 -0
- package/ReExports/FeatureDetails.d.ts +2 -0
- package/ReExports/FeatureDetails.js +5 -0
- package/ReExports/index.js +6 -12
- package/ReExports/list.d.ts +5 -0
- package/ReExports/list.js +271 -7
- package/ReExports/material-ui-colors.d.ts +1 -19
- package/ReExports/material-ui-colors.js +16 -158
- package/ReExports/modules.d.ts +68 -109
- package/ReExports/modules.js +455 -244
- package/TextSearch/BaseResults.js +51 -123
- package/TextSearch/TextSearchManager.d.ts +3 -1
- package/TextSearch/TextSearchManager.js +66 -144
- package/assemblyManager/assembly.js +280 -554
- package/assemblyManager/assemblyConfigSchema.js +47 -64
- package/assemblyManager/assemblyManager.d.ts +12 -10
- package/assemblyManager/assemblyManager.js +126 -270
- package/assemblyManager/index.js +9 -22
- package/configuration/configurationSchema.js +167 -203
- package/configuration/configurationSlot.js +248 -326
- package/configuration/index.js +19 -35
- package/configuration/util.d.ts +1 -1
- package/configuration/util.js +131 -173
- package/data_adapters/BaseAdapter.d.ts +2 -2
- package/data_adapters/BaseAdapter.js +132 -521
- package/data_adapters/CytobandAdapter.js +40 -126
- package/data_adapters/dataAdapterCache.js +77 -158
- package/package.json +16 -18
- package/pluggableElementTypes/AdapterType.js +24 -79
- package/pluggableElementTypes/AddTrackWorkflowType.d.ts +17 -0
- package/pluggableElementTypes/AddTrackWorkflowType.js +20 -0
- package/pluggableElementTypes/ConnectionType.js +22 -65
- package/pluggableElementTypes/DisplayType.js +35 -82
- package/pluggableElementTypes/InternetAccountType.js +23 -64
- package/pluggableElementTypes/PluggableElementBase.js +8 -20
- package/pluggableElementTypes/RpcMethodType.js +85 -427
- package/pluggableElementTypes/TextSearchAdapterType.js +16 -55
- package/pluggableElementTypes/TrackType.js +26 -70
- package/pluggableElementTypes/ViewType.js +21 -63
- package/pluggableElementTypes/WidgetType.js +21 -64
- package/pluggableElementTypes/index.d.ts +4 -3
- package/pluggableElementTypes/index.js +42 -125
- package/pluggableElementTypes/models/BaseConnectionModelFactory.js +28 -43
- package/pluggableElementTypes/models/BaseDisplayModel.d.ts +10 -10
- package/pluggableElementTypes/models/BaseDisplayModel.js +58 -95
- package/pluggableElementTypes/models/BaseTrackModel.d.ts +1 -1
- package/pluggableElementTypes/models/BaseTrackModel.js +139 -200
- package/pluggableElementTypes/models/BaseViewModel.js +24 -40
- package/pluggableElementTypes/models/InternetAccountModel.js +116 -263
- package/pluggableElementTypes/models/baseConnectionConfig.js +14 -25
- package/pluggableElementTypes/models/baseInternetAccountConfig.js +29 -38
- package/pluggableElementTypes/models/baseTrackConfig.js +106 -133
- package/pluggableElementTypes/models/index.js +21 -70
- package/pluggableElementTypes/renderers/BoxRendererType.js +132 -291
- package/pluggableElementTypes/renderers/CircularChordRendererType.js +8 -38
- package/pluggableElementTypes/renderers/ComparativeServerSideRendererType.js +60 -192
- package/pluggableElementTypes/renderers/FeatureRendererType.d.ts +0 -2
- package/pluggableElementTypes/renderers/FeatureRendererType.js +89 -255
- package/pluggableElementTypes/renderers/RendererType.js +31 -105
- package/pluggableElementTypes/renderers/ServerSideRenderedContent.js +61 -72
- package/pluggableElementTypes/renderers/ServerSideRendererType.d.ts +2 -2
- package/pluggableElementTypes/renderers/ServerSideRendererType.js +112 -265
- package/pluggableElementTypes/renderers/index.js +19 -62
- package/pluggableElementTypes/renderers/util/serializableFilterChain.js +27 -65
- package/rpc/BaseRpcDriver.js +169 -405
- package/rpc/MainThreadRpcDriver.js +27 -150
- package/rpc/RpcManager.js +58 -159
- package/rpc/WebWorkerRpcDriver.js +54 -171
- package/rpc/configSchema.js +25 -49
- package/rpc/coreRpcMethods.d.ts +1 -3
- package/rpc/coreRpcMethods.js +221 -959
- package/rpc/remoteAbortSignals.js +46 -70
- package/tsconfig.build.tsbuildinfo +1 -1
- package/ui/AboutDialog.js +107 -158
- package/ui/App.js +157 -261
- package/ui/AssemblySelector.d.ts +1 -1
- package/ui/AssemblySelector.js +59 -115
- package/ui/CascadingMenu.js +100 -199
- package/ui/ColorPicker.d.ts +16 -0
- package/ui/ColorPicker.js +97 -0
- package/ui/Drawer.js +28 -58
- package/ui/DrawerWidget.js +109 -209
- package/ui/DropDownMenu.d.ts +0 -8
- package/ui/DropDownMenu.js +60 -97
- package/ui/EditableTypography.d.ts +1 -1
- package/ui/EditableTypography.js +87 -155
- package/ui/ErrorMessage.js +41 -66
- package/ui/FactoryResetDialog.js +24 -57
- package/ui/FatalErrorDialog.js +59 -91
- package/ui/FileSelector/FileSelector.js +123 -189
- package/ui/FileSelector/LocalFileChooser.js +44 -71
- package/ui/FileSelector/UrlChooser.js +17 -38
- package/ui/FileSelector/index.js +6 -12
- package/ui/Icons.d.ts +1 -1
- package/ui/Icons.js +45 -69
- package/ui/Logo.js +57 -110
- package/ui/Menu.d.ts +1 -1
- package/ui/Menu.js +232 -355
- package/ui/PrerenderedCanvas.js +63 -78
- package/ui/ResizeHandle.js +87 -114
- package/ui/ReturnToImportFormDialog.js +32 -59
- package/ui/SanitizedHTML.js +63 -52
- package/ui/Snackbar.js +74 -99
- package/ui/SnackbarModel.js +37 -51
- package/ui/Tooltip.d.ts +3 -1
- package/ui/Tooltip.js +49 -74
- package/ui/ViewContainer.js +113 -183
- package/ui/colors.d.ts +10 -0
- package/ui/colors.js +78 -0
- package/ui/index.js +51 -181
- package/ui/react-colorful.d.ts +17 -0
- package/ui/react-colorful.js +455 -0
- package/ui/theme.d.ts +279 -131
- package/ui/theme.js +197 -225
- package/util/Base1DUtils.d.ts +32 -0
- package/util/Base1DUtils.js +174 -0
- package/util/Base1DViewModel.d.ts +16 -37
- package/util/Base1DViewModel.js +116 -295
- package/util/QuickLRU.js +84 -332
- package/util/TimeTraveller.d.ts +19 -0
- package/util/TimeTraveller.js +86 -0
- package/util/aborting.js +49 -127
- package/util/analytics.js +91 -154
- package/util/blockTypes.js +106 -240
- package/util/calculateDynamicBlocks.js +98 -128
- package/util/calculateStaticBlocks.js +105 -125
- package/util/color/cssColorsLevel4.js +156 -160
- package/util/color/index.js +33 -55
- package/util/compositeMap.js +49 -333
- package/util/formatFastaStrings.js +9 -14
- package/util/idMaker.js +18 -31
- package/util/index.d.ts +18 -39
- package/util/index.js +743 -1236
- package/util/io/RemoteFileWithRangeCache.js +88 -257
- package/util/io/index.js +95 -169
- package/util/jexl.js +60 -115
- package/util/jexlStrings.js +24 -29
- package/util/layouts/BaseLayout.js +1 -4
- package/util/layouts/GranularRectLayout.js +388 -557
- package/util/layouts/MultiLayout.js +41 -109
- package/util/layouts/PrecomputedLayout.js +56 -114
- package/util/layouts/PrecomputedMultiLayout.js +22 -59
- package/util/layouts/SceneGraph.js +127 -197
- package/util/layouts/index.js +29 -66
- package/util/mst-reflection.js +55 -71
- package/util/offscreenCanvasPonyfill.js +66 -134
- package/util/offscreenCanvasUtils.d.ts +2 -7
- package/util/offscreenCanvasUtils.js +49 -146
- package/util/range.js +29 -40
- package/util/rxjs.js +20 -27
- package/util/simpleFeature.js +88 -152
- package/util/stats.js +91 -151
- package/util/tracks.js +130 -171
- package/util/types/index.d.ts +3 -3
- package/util/types/index.js +110 -179
- package/util/types/mst.d.ts +3 -3
- package/util/types/mst.js +91 -142
- package/util/types/util.js +1 -4
- package/util/when.js +54 -101
- package/BaseFeatureWidget/SequenceFeatureDetails.test.js +0 -122
- package/BaseFeatureWidget/index.test.js +0 -51
- package/TextSearch/BaseResults.test.js +0 -42
- package/configuration/configurationSchema.test.js +0 -266
- package/configuration/configurationSlot.test.js +0 -69
- package/configuration/util.test.js +0 -39
- package/data_adapters/BaseAdapter.test.js +0 -200
- package/declare.d.js +0 -1
- package/pluggableElementTypes/RpcMethodType.test.js +0 -118
- package/pluggableElementTypes/renderers/declare.d.js +0 -1
- package/pluggableElementTypes/renderers/util/serializableFilterChain.test.js +0 -20
- package/rpc/BaseRpcDriver.test.js +0 -540
- package/rpc/declaration.d.js +0 -1
- package/ui/FatalErrorDialog.test.js +0 -82
- package/ui/SanitizedHTML.test.js +0 -36
- package/ui/theme.test.js +0 -111
- package/util/Base1DViewModel.test.js +0 -130
- package/util/calculateDynamicBlocks.test.js +0 -74
- package/util/calculateStaticBlocks.test.js +0 -297
- package/util/declare.d.js +0 -1
- package/util/formatFastaStrings.test.js +0 -40
- package/util/index.test.js +0 -213
- package/util/jexlStrings.test.js +0 -48
- package/util/layouts/GranularRectLayout.test.js +0 -99
- package/util/range.test.js +0 -64
- package/util/simpleFeature.test.js +0 -34
- package/util/stats.test.js +0 -172
package/util/tracks.js
CHANGED
|
@@ -1,145 +1,108 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
exports.generateUnknownTrackConf = generateUnknownTrackConf;
|
|
8
|
-
exports.generateUnsupportedTrackConf = generateUnsupportedTrackConf;
|
|
9
|
-
exports.getBlob = getBlob;
|
|
10
|
-
exports.getBlobMap = getBlobMap;
|
|
11
|
-
exports.getFileName = getFileName;
|
|
12
|
-
exports.getParentRenderProps = getParentRenderProps;
|
|
13
|
-
exports.getRpcSessionId = getRpcSessionId;
|
|
14
|
-
exports.getTrackAssemblyNames = getTrackAssemblyNames;
|
|
15
|
-
exports.guessAdapter = guessAdapter;
|
|
16
|
-
exports.guessTrackType = guessTrackType;
|
|
17
|
-
exports.makeIndex = makeIndex;
|
|
18
|
-
exports.makeIndexType = makeIndexType;
|
|
19
|
-
exports.setBlobMap = setBlobMap;
|
|
20
|
-
exports.storeBlobLocation = storeBlobLocation;
|
|
21
|
-
|
|
22
|
-
var _mobxStateTree = require("mobx-state-tree");
|
|
23
|
-
|
|
24
|
-
var _index2 = require("./index");
|
|
25
|
-
|
|
26
|
-
var _configuration = require("../configuration");
|
|
27
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateUnknownTrackConf = exports.generateUnsupportedTrackConf = exports.guessTrackType = exports.guessAdapter = exports.getFileName = exports.makeIndexType = exports.makeIndex = exports.storeBlobLocation = exports.setBlobMap = exports.getBlobMap = exports.getBlob = exports.UNSUPPORTED = exports.UNKNOWN = exports.getParentRenderProps = exports.getRpcSessionId = exports.getTrackAssemblyNames = void 0;
|
|
4
|
+
const mobx_state_tree_1 = require("mobx-state-tree");
|
|
5
|
+
const index_1 = require("./index");
|
|
6
|
+
const configuration_1 = require("../configuration");
|
|
28
7
|
/* utility functions for use by track models and so forth */
|
|
29
8
|
function getTrackAssemblyNames(track) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
return [(0, _configuration.readConfObject)(parent, 'name')];
|
|
9
|
+
const trackConf = track.configuration;
|
|
10
|
+
const trackAssemblyNames = (0, configuration_1.readConfObject)(trackConf, 'assemblyNames');
|
|
11
|
+
if (!trackAssemblyNames) {
|
|
12
|
+
// Check if it's an assembly sequence track
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14
|
+
const parent = (0, mobx_state_tree_1.getParent)(track.configuration);
|
|
15
|
+
if ('sequence' in parent) {
|
|
16
|
+
return [(0, configuration_1.readConfObject)(parent, 'name')];
|
|
17
|
+
}
|
|
40
18
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
return trackAssemblyNames;
|
|
19
|
+
return trackAssemblyNames;
|
|
44
20
|
}
|
|
21
|
+
exports.getTrackAssemblyNames = getTrackAssemblyNames;
|
|
45
22
|
/** return the rpcSessionId of the highest parent node in the tree that has an rpcSessionId */
|
|
46
|
-
|
|
47
|
-
|
|
48
23
|
function getRpcSessionId(thisNode) {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
24
|
+
let highestRpcSessionId;
|
|
25
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
26
|
+
for (let node = thisNode; !(0, mobx_state_tree_1.isRoot)(node); node = (0, mobx_state_tree_1.getParent)(node)) {
|
|
27
|
+
if ('rpcSessionId' in node) {
|
|
28
|
+
highestRpcSessionId = node.rpcSessionId;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
if (!highestRpcSessionId) {
|
|
32
|
+
throw new Error('getRpcSessionId failed, no parent node in the state tree has an `rpcSessionId` attribute');
|
|
54
33
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
if (!highestRpcSessionId) {
|
|
58
|
-
throw new Error('getRpcSessionId failed, no parent node in the state tree has an `rpcSessionId` attribute');
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
return highestRpcSessionId;
|
|
34
|
+
return highestRpcSessionId;
|
|
62
35
|
}
|
|
36
|
+
exports.getRpcSessionId = getRpcSessionId;
|
|
63
37
|
/**
|
|
64
38
|
* given an MST node, get the renderprops of the first parent container that has
|
|
65
39
|
* renderProps
|
|
66
40
|
* @param node -
|
|
67
41
|
* @returns renderprops, or empty object if none found
|
|
68
42
|
*/
|
|
69
|
-
|
|
70
|
-
|
|
71
43
|
function getParentRenderProps(node) {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
44
|
+
for (
|
|
45
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
46
|
+
let currentNode = (0, mobx_state_tree_1.getParent)(node); !(0, mobx_state_tree_1.isRoot)(currentNode);
|
|
47
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
48
|
+
currentNode = (0, mobx_state_tree_1.getParent)(currentNode)) {
|
|
49
|
+
if ('renderProps' in currentNode) {
|
|
50
|
+
return currentNode.renderProps();
|
|
51
|
+
}
|
|
75
52
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
return {};
|
|
53
|
+
return {};
|
|
79
54
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
exports.
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
var blobMap = {}; // get a specific blob
|
|
86
|
-
|
|
55
|
+
exports.getParentRenderProps = getParentRenderProps;
|
|
56
|
+
exports.UNKNOWN = 'UNKNOWN';
|
|
57
|
+
exports.UNSUPPORTED = 'UNSUPPORTED';
|
|
58
|
+
let blobMap = {};
|
|
59
|
+
// get a specific blob
|
|
87
60
|
function getBlob(id) {
|
|
88
|
-
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
|
|
61
|
+
return blobMap[id];
|
|
62
|
+
}
|
|
63
|
+
exports.getBlob = getBlob;
|
|
64
|
+
// used to export entire context to webworker
|
|
92
65
|
function getBlobMap() {
|
|
93
|
-
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
|
|
66
|
+
return blobMap;
|
|
67
|
+
}
|
|
68
|
+
exports.getBlobMap = getBlobMap;
|
|
69
|
+
// used in new contexts like webworkers
|
|
97
70
|
function setBlobMap(map) {
|
|
98
|
-
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
|
|
71
|
+
blobMap = map;
|
|
72
|
+
}
|
|
73
|
+
exports.setBlobMap = setBlobMap;
|
|
74
|
+
let counter = 0;
|
|
75
|
+
// blob files are stored in a global map. the blobId is based on a combination
|
|
76
|
+
// of timestamp plus counter to be unique across sessions and fast repeated
|
|
77
|
+
// calls
|
|
102
78
|
function storeBlobLocation(location) {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
return {
|
|
110
|
-
name: location === null || location === void 0 ? void 0 : location.blob.name,
|
|
111
|
-
blobId: blobId,
|
|
112
|
-
locationType: 'BlobLocation'
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
return location;
|
|
79
|
+
if (location && 'blob' in location) {
|
|
80
|
+
const blobId = `b${+Date.now()}-${counter++}`;
|
|
81
|
+
blobMap[blobId] = location.blob;
|
|
82
|
+
return { name: location === null || location === void 0 ? void 0 : location.blob.name, blobId, locationType: 'BlobLocation' };
|
|
83
|
+
}
|
|
84
|
+
return location;
|
|
117
85
|
}
|
|
86
|
+
exports.storeBlobLocation = storeBlobLocation;
|
|
118
87
|
/**
|
|
119
88
|
* creates a new location from the provided location including the appropriate suffix and location type
|
|
120
89
|
* @param location - the FileLocation
|
|
121
90
|
* @param suffix - the file suffix (e.g. .bam)
|
|
122
91
|
* @returns the constructed location object from the provided prameters
|
|
123
92
|
*/
|
|
124
|
-
|
|
125
|
-
|
|
126
93
|
function makeIndex(location, suffix) {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
locationType: 'LocalPathLocation'
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
return location;
|
|
94
|
+
if ('uri' in location) {
|
|
95
|
+
return { uri: location.uri + suffix, locationType: 'UriLocation' };
|
|
96
|
+
}
|
|
97
|
+
if ('localPath' in location) {
|
|
98
|
+
return {
|
|
99
|
+
localPath: location.localPath + suffix,
|
|
100
|
+
locationType: 'LocalPathLocation',
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
return location;
|
|
142
104
|
}
|
|
105
|
+
exports.makeIndex = makeIndex;
|
|
143
106
|
/**
|
|
144
107
|
* constructs a potential index file (with suffix) from the provided file name
|
|
145
108
|
* @param name - the name of the index file
|
|
@@ -147,76 +110,72 @@ function makeIndex(location, suffix) {
|
|
|
147
110
|
* @param typeB - the second option of a potential two file suffix (e.g. CSI, BAI)
|
|
148
111
|
* @returns a likely name of the index file for a given filename
|
|
149
112
|
*/
|
|
150
|
-
|
|
151
|
-
|
|
152
113
|
function makeIndexType(name, typeA, typeB) {
|
|
153
|
-
|
|
114
|
+
return (name === null || name === void 0 ? void 0 : name.toUpperCase().endsWith(typeA)) ? typeA : typeB;
|
|
154
115
|
}
|
|
155
|
-
|
|
116
|
+
exports.makeIndexType = makeIndexType;
|
|
156
117
|
function getFileName(track) {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
118
|
+
const uri = 'uri' in track ? track.uri : undefined;
|
|
119
|
+
const localPath = 'localPath' in track ? track.localPath : undefined;
|
|
120
|
+
const blob = 'blobId' in track ? track : undefined;
|
|
121
|
+
return ((blob === null || blob === void 0 ? void 0 : blob.name) ||
|
|
122
|
+
(uri === null || uri === void 0 ? void 0 : uri.slice(uri.lastIndexOf('/') + 1)) ||
|
|
123
|
+
(localPath === null || localPath === void 0 ? void 0 : localPath.slice(localPath.lastIndexOf('/') + 1)) ||
|
|
124
|
+
'');
|
|
161
125
|
}
|
|
162
|
-
|
|
126
|
+
exports.getFileName = getFileName;
|
|
163
127
|
function guessAdapter(file, index, adapterHint, model) {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
if (adapter) {
|
|
174
|
-
return adapter;
|
|
128
|
+
if (model) {
|
|
129
|
+
const { pluginManager } = (0, mobx_state_tree_1.getEnv)(model);
|
|
130
|
+
const adapterGuesser = pluginManager.evaluateExtensionPoint('Core-guessAdapterForLocation', (_file, _index, _adapterHint) => {
|
|
131
|
+
return undefined;
|
|
132
|
+
});
|
|
133
|
+
const adapter = adapterGuesser(file, index, adapterHint);
|
|
134
|
+
if (adapter) {
|
|
135
|
+
return adapter;
|
|
136
|
+
}
|
|
175
137
|
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
type: UNKNOWN
|
|
180
|
-
};
|
|
138
|
+
return {
|
|
139
|
+
type: exports.UNKNOWN,
|
|
140
|
+
};
|
|
181
141
|
}
|
|
182
|
-
|
|
142
|
+
exports.guessAdapter = guessAdapter;
|
|
183
143
|
function guessTrackType(adapterType, model) {
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
144
|
+
if (model) {
|
|
145
|
+
// @ts-ignore
|
|
146
|
+
const session = (0, index_1.getSession)(model);
|
|
147
|
+
const trackTypeGuesser = (0, mobx_state_tree_1.getEnv)(session).pluginManager.evaluateExtensionPoint('Core-guessTrackTypeForLocation', (_adapterName) => {
|
|
148
|
+
return undefined;
|
|
149
|
+
});
|
|
150
|
+
const trackType = trackTypeGuesser(adapterType);
|
|
151
|
+
if (trackType) {
|
|
152
|
+
return trackType;
|
|
153
|
+
}
|
|
194
154
|
}
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
return 'FeatureTrack';
|
|
155
|
+
return 'FeatureTrack';
|
|
198
156
|
}
|
|
199
|
-
|
|
157
|
+
exports.guessTrackType = guessTrackType;
|
|
200
158
|
function generateUnsupportedTrackConf(trackName, trackUrl, categories) {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
159
|
+
const conf = {
|
|
160
|
+
type: 'FeatureTrack',
|
|
161
|
+
name: `${trackName} (Unsupported)`,
|
|
162
|
+
description: `Support not yet implemented for "${trackUrl}"`,
|
|
163
|
+
category: categories,
|
|
164
|
+
trackId: '',
|
|
165
|
+
};
|
|
166
|
+
conf.trackId = (0, index_1.objectHash)(conf);
|
|
167
|
+
return conf;
|
|
210
168
|
}
|
|
211
|
-
|
|
169
|
+
exports.generateUnsupportedTrackConf = generateUnsupportedTrackConf;
|
|
212
170
|
function generateUnknownTrackConf(trackName, trackUrl, categories) {
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
}
|
|
171
|
+
const conf = {
|
|
172
|
+
type: 'FeatureTrack',
|
|
173
|
+
name: `${trackName} (Unknown)`,
|
|
174
|
+
description: `Could not determine track type for "${trackUrl}"`,
|
|
175
|
+
category: categories,
|
|
176
|
+
trackId: '',
|
|
177
|
+
};
|
|
178
|
+
conf.trackId = (0, index_1.objectHash)(conf);
|
|
179
|
+
return conf;
|
|
180
|
+
}
|
|
181
|
+
exports.generateUnknownTrackConf = generateUnknownTrackConf;
|
package/util/types/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Instance, SnapshotIn, IAnyStateTreeNode } from 'mobx-state-tree';
|
|
2
|
+
import { Instance, SnapshotIn, IAnyStateTreeNode, IStateTreeNode, IType } from 'mobx-state-tree';
|
|
3
3
|
import { AnyConfigurationModel } from '../../configuration/configurationSchema';
|
|
4
4
|
import assemblyManager from '../../assemblyManager';
|
|
5
5
|
import TextSearchManager from '../../TextSearch/TextSearchManager';
|
|
@@ -10,10 +10,10 @@ import { Feature } from '../simpleFeature';
|
|
|
10
10
|
import { BaseInternetAccountModel } from '../../pluggableElementTypes/models';
|
|
11
11
|
export * from './util';
|
|
12
12
|
/** abstract type for a model that contains multiple views */
|
|
13
|
-
export interface AbstractViewContainer extends
|
|
13
|
+
export interface AbstractViewContainer extends IStateTreeNode<IType<any, unknown, any>> {
|
|
14
14
|
views: AbstractViewModel[];
|
|
15
15
|
removeView(view: AbstractViewModel): void;
|
|
16
|
-
addView(typeName: string, initialState?: Record<string, unknown>):
|
|
16
|
+
addView(typeName: string, initialState?: Record<string, unknown>): AbstractViewModel;
|
|
17
17
|
}
|
|
18
18
|
export declare function isViewContainer(thing: unknown): thing is AbstractViewContainer;
|
|
19
19
|
export declare type NotificationLevel = 'error' | 'info' | 'warning' | 'success';
|