@jbrowse/core 2.0.0 → 2.1.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/BaseFeatureWidget/BaseFeatureDetail.d.ts +9 -3
- package/BaseFeatureWidget/BaseFeatureDetail.js +313 -581
- package/BaseFeatureWidget/SequenceFeatureDetails.js +213 -478
- package/BaseFeatureWidget/index.js +88 -126
- 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 +28 -33
- package/PluginManager.js +377 -666
- package/ReExports/Attributes.js +3 -10
- package/ReExports/BaseCard.js +3 -10
- package/ReExports/DataGrid.js +5 -12
- package/ReExports/FeatureDetails.js +3 -10
- package/ReExports/index.js +6 -12
- package/ReExports/list.d.ts +5 -0
- package/ReExports/list.js +271 -7
- package/ReExports/material-ui-colors.js +15 -16
- package/ReExports/modules.d.ts +11 -20
- package/ReExports/modules.js +453 -798
- package/TextSearch/BaseResults.js +51 -123
- package/TextSearch/TextSearchManager.js +66 -144
- package/assemblyManager/assembly.js +280 -555
- package/assemblyManager/assemblyConfigSchema.js +47 -64
- package/assemblyManager/assemblyManager.js +126 -272
- 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.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 +4 -5
- 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.js +58 -95
- package/pluggableElementTypes/models/BaseTrackModel.js +139 -199
- 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.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 +106 -162
- package/ui/App.js +157 -242
- package/ui/AssemblySelector.js +59 -120
- package/ui/CascadingMenu.js +101 -196
- package/ui/ColorPicker.d.ts +16 -0
- package/ui/ColorPicker.js +97 -0
- package/ui/Drawer.js +28 -61
- package/ui/DrawerWidget.js +108 -202
- package/ui/DropDownMenu.js +60 -91
- package/ui/EditableTypography.js +87 -149
- package/ui/ErrorMessage.js +41 -56
- 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 -75
- package/ui/FileSelector/UrlChooser.js +17 -38
- package/ui/FileSelector/index.js +6 -12
- package/ui/Icons.js +45 -69
- package/ui/Logo.js +57 -110
- package/ui/Menu.js +232 -354
- package/ui/PrerenderedCanvas.js +63 -87
- package/ui/ResizeHandle.js +87 -116
- package/ui/ReturnToImportFormDialog.js +32 -63
- package/ui/SanitizedHTML.js +64 -47
- package/ui/Snackbar.js +74 -101
- package/ui/SnackbarModel.js +37 -51
- package/ui/Tooltip.js +49 -76
- package/ui/ViewContainer.js +113 -196
- 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 +23 -1
- package/ui/theme.js +199 -247
- package/util/Base1DUtils.d.ts +32 -0
- package/util/Base1DUtils.js +174 -0
- package/util/Base1DViewModel.d.ts +16 -30
- package/util/Base1DViewModel.js +116 -293
- 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 -32
- package/util/index.js +747 -1226
- 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 -555
- package/util/layouts/MultiLayout.js +41 -109
- package/util/layouts/PrecomputedLayout.js +56 -112
- 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 -173
- package/util/types/index.js +110 -179
- package/util/types/mst.js +91 -146
- 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 -69
- 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 -92
- 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/PluginManager.js
CHANGED
|
@@ -1,684 +1,395 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
var _mobxStateTree = require("mobx-state-tree");
|
|
25
|
-
|
|
26
|
-
var _RendererType = _interopRequireDefault(require("./pluggableElementTypes/renderers/RendererType"));
|
|
27
|
-
|
|
28
|
-
var _AdapterType = _interopRequireDefault(require("./pluggableElementTypes/AdapterType"));
|
|
29
|
-
|
|
30
|
-
var _TrackType = _interopRequireDefault(require("./pluggableElementTypes/TrackType"));
|
|
31
|
-
|
|
32
|
-
var _DisplayType = _interopRequireDefault(require("./pluggableElementTypes/DisplayType"));
|
|
33
|
-
|
|
34
|
-
var _ViewType = _interopRequireDefault(require("./pluggableElementTypes/ViewType"));
|
|
35
|
-
|
|
36
|
-
var _WidgetType = _interopRequireDefault(require("./pluggableElementTypes/WidgetType"));
|
|
37
|
-
|
|
38
|
-
var _ConnectionType = _interopRequireDefault(require("./pluggableElementTypes/ConnectionType"));
|
|
39
|
-
|
|
40
|
-
var _RpcMethodType = _interopRequireDefault(require("./pluggableElementTypes/RpcMethodType"));
|
|
41
|
-
|
|
42
|
-
var _InternetAccountType = _interopRequireDefault(require("./pluggableElementTypes/InternetAccountType"));
|
|
43
|
-
|
|
44
|
-
var _TextSearchAdapterType = _interopRequireDefault(require("./pluggableElementTypes/TextSearchAdapterType"));
|
|
45
|
-
|
|
46
|
-
var _configuration = require("./configuration");
|
|
47
|
-
|
|
48
|
-
var _Plugin = _interopRequireDefault(require("./Plugin"));
|
|
49
|
-
|
|
50
|
-
var _ReExports = _interopRequireDefault(require("./ReExports"));
|
|
51
|
-
|
|
52
|
-
var _CorePlugin = _interopRequireDefault(require("./CorePlugin"));
|
|
53
|
-
|
|
54
|
-
var _jexl = _interopRequireDefault(require("./util/jexl"));
|
|
55
|
-
|
|
56
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
57
|
-
|
|
58
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
59
|
-
|
|
60
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
61
|
-
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const mobx_state_tree_1 = require("mobx-state-tree");
|
|
7
|
+
const RendererType_1 = __importDefault(require("./pluggableElementTypes/renderers/RendererType"));
|
|
8
|
+
const AdapterType_1 = __importDefault(require("./pluggableElementTypes/AdapterType"));
|
|
9
|
+
const TrackType_1 = __importDefault(require("./pluggableElementTypes/TrackType"));
|
|
10
|
+
const DisplayType_1 = __importDefault(require("./pluggableElementTypes/DisplayType"));
|
|
11
|
+
const ViewType_1 = __importDefault(require("./pluggableElementTypes/ViewType"));
|
|
12
|
+
const WidgetType_1 = __importDefault(require("./pluggableElementTypes/WidgetType"));
|
|
13
|
+
const ConnectionType_1 = __importDefault(require("./pluggableElementTypes/ConnectionType"));
|
|
14
|
+
const RpcMethodType_1 = __importDefault(require("./pluggableElementTypes/RpcMethodType"));
|
|
15
|
+
const InternetAccountType_1 = __importDefault(require("./pluggableElementTypes/InternetAccountType"));
|
|
16
|
+
const TextSearchAdapterType_1 = __importDefault(require("./pluggableElementTypes/TextSearchAdapterType"));
|
|
17
|
+
const AddTrackWorkflowType_1 = __importDefault(require("./pluggableElementTypes/AddTrackWorkflowType"));
|
|
18
|
+
const configuration_1 = require("./configuration");
|
|
19
|
+
const Plugin_1 = __importDefault(require("./Plugin"));
|
|
20
|
+
const ReExports_1 = __importDefault(require("./ReExports"));
|
|
21
|
+
const CorePlugin_1 = __importDefault(require("./CorePlugin"));
|
|
22
|
+
const jexl_1 = __importDefault(require("./util/jexl"));
|
|
62
23
|
/** little helper class that keeps groups of callbacks that are
|
|
63
24
|
then run in a specified order by group */
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
if (!phaseCallbacks) {
|
|
87
|
-
phaseCallbacks = [];
|
|
88
|
-
this.phaseCallbacks.set(phase, phaseCallbacks);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
phaseCallbacks.push(callback);
|
|
92
|
-
}
|
|
93
|
-
}, {
|
|
94
|
-
key: "run",
|
|
95
|
-
value: function run() {
|
|
96
|
-
var _this = this;
|
|
97
|
-
|
|
98
|
-
this.phaseOrder.forEach(function (phaseName) {
|
|
99
|
-
var _this$phaseCallbacks$;
|
|
100
|
-
|
|
101
|
-
(_this$phaseCallbacks$ = _this.phaseCallbacks.get(phaseName)) === null || _this$phaseCallbacks$ === void 0 ? void 0 : _this$phaseCallbacks$.forEach(function (callback) {
|
|
102
|
-
return callback();
|
|
25
|
+
class PhasedScheduler {
|
|
26
|
+
constructor(...phaseOrder) {
|
|
27
|
+
this.phaseCallbacks = new Map();
|
|
28
|
+
this.phaseOrder = [];
|
|
29
|
+
this.phaseOrder = phaseOrder;
|
|
30
|
+
}
|
|
31
|
+
add(phase, callback) {
|
|
32
|
+
if (!this.phaseOrder.includes(phase)) {
|
|
33
|
+
throw new Error(`unknown phase ${phase}`);
|
|
34
|
+
}
|
|
35
|
+
let phaseCallbacks = this.phaseCallbacks.get(phase);
|
|
36
|
+
if (!phaseCallbacks) {
|
|
37
|
+
phaseCallbacks = [];
|
|
38
|
+
this.phaseCallbacks.set(phase, phaseCallbacks);
|
|
39
|
+
}
|
|
40
|
+
phaseCallbacks.push(callback);
|
|
41
|
+
}
|
|
42
|
+
run() {
|
|
43
|
+
this.phaseOrder.forEach(phaseName => {
|
|
44
|
+
var _a;
|
|
45
|
+
(_a = this.phaseCallbacks.get(phaseName)) === null || _a === void 0 ? void 0 : _a.forEach(callback => callback());
|
|
103
46
|
});
|
|
104
|
-
});
|
|
105
47
|
}
|
|
106
|
-
|
|
107
|
-
return PhasedScheduler;
|
|
108
|
-
}();
|
|
109
|
-
|
|
48
|
+
}
|
|
110
49
|
/** internal class that holds the info for a certain element type */
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
value: function has(name) {
|
|
127
|
-
return name in this.registeredTypes;
|
|
128
|
-
}
|
|
129
|
-
}, {
|
|
130
|
-
key: "get",
|
|
131
|
-
value: function get(name) {
|
|
132
|
-
if (!this.has(name)) {
|
|
133
|
-
throw new Error("".concat(this.typeName, " '").concat(name, "' not found, perhaps its plugin is not loaded or its plugin has not added it."));
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
return this.registeredTypes[name];
|
|
137
|
-
}
|
|
138
|
-
}, {
|
|
139
|
-
key: "all",
|
|
140
|
-
value: function all() {
|
|
141
|
-
return Object.values(this.registeredTypes);
|
|
142
|
-
}
|
|
143
|
-
}]);
|
|
144
|
-
return TypeRecord;
|
|
145
|
-
}(); // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
var PluginManager = /*#__PURE__*/function () {
|
|
149
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
150
|
-
function PluginManager() {
|
|
151
|
-
var _this2 = this;
|
|
152
|
-
|
|
153
|
-
var initialPlugins = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
154
|
-
(0, _classCallCheck2.default)(this, PluginManager);
|
|
155
|
-
(0, _defineProperty2.default)(this, "plugins", []);
|
|
156
|
-
(0, _defineProperty2.default)(this, "jexl", (0, _jexl.default)());
|
|
157
|
-
(0, _defineProperty2.default)(this, "pluginMetadata", {});
|
|
158
|
-
(0, _defineProperty2.default)(this, "runtimePluginDefinitions", []);
|
|
159
|
-
(0, _defineProperty2.default)(this, "elementCreationSchedule", new PhasedScheduler('renderer', 'adapter', 'text search adapter', 'display', 'track', 'connection', 'view', 'widget', 'rpc method', 'internet account'));
|
|
160
|
-
(0, _defineProperty2.default)(this, "rendererTypes", new TypeRecord('RendererType', _RendererType.default));
|
|
161
|
-
(0, _defineProperty2.default)(this, "adapterTypes", new TypeRecord('AdapterType', _AdapterType.default));
|
|
162
|
-
(0, _defineProperty2.default)(this, "textSearchAdapterTypes", new TypeRecord('TextSearchAdapterType', _TextSearchAdapterType.default));
|
|
163
|
-
(0, _defineProperty2.default)(this, "trackTypes", new TypeRecord('TrackType', _TrackType.default));
|
|
164
|
-
(0, _defineProperty2.default)(this, "displayTypes", new TypeRecord('DisplayType', _DisplayType.default));
|
|
165
|
-
(0, _defineProperty2.default)(this, "connectionTypes", new TypeRecord('ConnectionType', _ConnectionType.default));
|
|
166
|
-
(0, _defineProperty2.default)(this, "viewTypes", new TypeRecord('ViewType', _ViewType.default));
|
|
167
|
-
(0, _defineProperty2.default)(this, "widgetTypes", new TypeRecord('WidgetType', _WidgetType.default));
|
|
168
|
-
(0, _defineProperty2.default)(this, "rpcMethods", new TypeRecord('RpcMethodType', _RpcMethodType.default));
|
|
169
|
-
(0, _defineProperty2.default)(this, "internetAccountTypes", new TypeRecord('InternetAccountType', _InternetAccountType.default));
|
|
170
|
-
(0, _defineProperty2.default)(this, "configured", false);
|
|
171
|
-
(0, _defineProperty2.default)(this, "rootModel", void 0);
|
|
172
|
-
(0, _defineProperty2.default)(this, "extensionPoints", new Map());
|
|
173
|
-
(0, _defineProperty2.default)(this, "jbrequireCache", new Map());
|
|
174
|
-
(0, _defineProperty2.default)(this, "lib", _ReExports.default);
|
|
175
|
-
(0, _defineProperty2.default)(this, "load", function (lib) {
|
|
176
|
-
if (!_this2.jbrequireCache.has(lib)) {
|
|
177
|
-
_this2.jbrequireCache.set(lib, lib(_this2));
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
return _this2.jbrequireCache.get(lib);
|
|
181
|
-
});
|
|
182
|
-
(0, _defineProperty2.default)(this, "jbrequire", function (lib // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
183
|
-
) {
|
|
184
|
-
if (typeof lib === 'string') {
|
|
185
|
-
var pack = _this2.lib[lib];
|
|
186
|
-
|
|
187
|
-
if (!pack) {
|
|
188
|
-
throw new TypeError("No jbrequire re-export defined for package '".concat(lib, "'. If this package must be shared between plugins, add it to ReExports.js. If it does not need to be shared, just import it normally."));
|
|
50
|
+
class TypeRecord {
|
|
51
|
+
constructor(typeName, baseClass) {
|
|
52
|
+
this.typeName = typeName;
|
|
53
|
+
this.baseClass = baseClass;
|
|
54
|
+
this.registeredTypes = {};
|
|
55
|
+
}
|
|
56
|
+
add(name, t) {
|
|
57
|
+
this.registeredTypes[name] = t;
|
|
58
|
+
}
|
|
59
|
+
has(name) {
|
|
60
|
+
return name in this.registeredTypes;
|
|
61
|
+
}
|
|
62
|
+
get(name) {
|
|
63
|
+
if (!this.has(name)) {
|
|
64
|
+
throw new Error(`${this.typeName} '${name}' not found, perhaps its plugin is not loaded or its plugin has not added it.`);
|
|
189
65
|
}
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
66
|
+
return this.registeredTypes[name];
|
|
67
|
+
}
|
|
68
|
+
all() {
|
|
69
|
+
return Object.values(this.registeredTypes);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
class PluginManager {
|
|
73
|
+
constructor(initialPlugins = []) {
|
|
74
|
+
this.plugins = [];
|
|
75
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
76
|
+
this.jexl = (0, jexl_1.default)();
|
|
77
|
+
this.pluginMetadata = {};
|
|
78
|
+
this.runtimePluginDefinitions = [];
|
|
79
|
+
this.elementCreationSchedule = new PhasedScheduler('renderer', 'adapter', 'text search adapter', 'display', 'track', 'connection', 'view', 'widget', 'rpc method', 'internet account', 'add track workflow');
|
|
80
|
+
this.rendererTypes = new TypeRecord('RendererType', RendererType_1.default);
|
|
81
|
+
this.adapterTypes = new TypeRecord('AdapterType', AdapterType_1.default);
|
|
82
|
+
this.textSearchAdapterTypes = new TypeRecord('TextSearchAdapterType', TextSearchAdapterType_1.default);
|
|
83
|
+
this.trackTypes = new TypeRecord('TrackType', TrackType_1.default);
|
|
84
|
+
this.displayTypes = new TypeRecord('DisplayType', DisplayType_1.default);
|
|
85
|
+
this.connectionTypes = new TypeRecord('ConnectionType', ConnectionType_1.default);
|
|
86
|
+
this.viewTypes = new TypeRecord('ViewType', ViewType_1.default);
|
|
87
|
+
this.widgetTypes = new TypeRecord('WidgetType', WidgetType_1.default);
|
|
88
|
+
this.rpcMethods = new TypeRecord('RpcMethodType', RpcMethodType_1.default);
|
|
89
|
+
this.addTrackWidgets = new TypeRecord('AddTrackWorkflow', AddTrackWorkflowType_1.default);
|
|
90
|
+
this.internetAccountTypes = new TypeRecord('InternetAccountType', InternetAccountType_1.default);
|
|
91
|
+
this.configured = false;
|
|
92
|
+
this.extensionPoints = new Map();
|
|
93
|
+
this.jbrequireCache = new Map();
|
|
94
|
+
this.lib = ReExports_1.default;
|
|
95
|
+
this.load = (lib) => {
|
|
96
|
+
if (!this.jbrequireCache.has(lib)) {
|
|
97
|
+
this.jbrequireCache.set(lib, lib(this));
|
|
98
|
+
}
|
|
99
|
+
return this.jbrequireCache.get(lib);
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* Get the re-exported version of the given package name.
|
|
103
|
+
* Throws an error if the package is not re-exported by the plugin manager.
|
|
104
|
+
*
|
|
105
|
+
* @returns the library's default export
|
|
106
|
+
*/
|
|
107
|
+
this.jbrequire = (lib) => {
|
|
108
|
+
if (typeof lib === 'string') {
|
|
109
|
+
const pack = this.lib[lib];
|
|
110
|
+
if (!pack) {
|
|
111
|
+
throw new TypeError(`No jbrequire re-export defined for package '${lib}'. If this package must be shared between plugins, add it to ReExports.js. If it does not need to be shared, just import it normally.`);
|
|
112
|
+
}
|
|
113
|
+
return pack;
|
|
114
|
+
}
|
|
115
|
+
if (typeof lib === 'function') {
|
|
116
|
+
return this.load(lib);
|
|
117
|
+
}
|
|
118
|
+
if (lib.default) {
|
|
119
|
+
return this.jbrequire(lib.default);
|
|
120
|
+
}
|
|
121
|
+
throw new TypeError('lib passed to jbrequire must be either a string or a function');
|
|
122
|
+
};
|
|
123
|
+
// add the core plugin
|
|
124
|
+
this.addPlugin({ plugin: new CorePlugin_1.default(), metadata: { isCore: true } });
|
|
125
|
+
// add all the initial plugins
|
|
126
|
+
initialPlugins.forEach(plugin => {
|
|
127
|
+
this.addPlugin(plugin);
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
pluginConfigurationSchemas() {
|
|
131
|
+
const configurationSchemas = {};
|
|
132
|
+
this.plugins.forEach(plugin => {
|
|
133
|
+
if (plugin.configurationSchema) {
|
|
134
|
+
configurationSchemas[plugin.name] = plugin.configurationSchema;
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
return configurationSchemas;
|
|
138
|
+
}
|
|
139
|
+
addPlugin(load) {
|
|
140
|
+
if (this.configured) {
|
|
141
|
+
throw new Error('JBrowse already configured, cannot add plugins');
|
|
224
142
|
}
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
case 'text search adapter':
|
|
308
|
-
return this.textSearchAdapterTypes;
|
|
309
|
-
|
|
310
|
-
case 'connection':
|
|
311
|
-
return this.connectionTypes;
|
|
312
|
-
|
|
313
|
-
case 'widget':
|
|
314
|
-
return this.widgetTypes;
|
|
315
|
-
|
|
316
|
-
case 'renderer':
|
|
317
|
-
return this.rendererTypes;
|
|
318
|
-
|
|
319
|
-
case 'display':
|
|
320
|
-
return this.displayTypes;
|
|
321
|
-
|
|
322
|
-
case 'track':
|
|
323
|
-
return this.trackTypes;
|
|
324
|
-
|
|
325
|
-
case 'view':
|
|
326
|
-
return this.viewTypes;
|
|
327
|
-
|
|
328
|
-
case 'rpc method':
|
|
329
|
-
return this.rpcMethods;
|
|
330
|
-
|
|
331
|
-
case 'internet account':
|
|
332
|
-
return this.internetAccountTypes;
|
|
333
|
-
|
|
334
|
-
default:
|
|
335
|
-
throw new Error("invalid element type '".concat(groupName, "'"));
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
}, {
|
|
339
|
-
key: "addElementType",
|
|
340
|
-
value: function addElementType(groupName, creationCallback) {
|
|
341
|
-
var _this4 = this;
|
|
342
|
-
|
|
343
|
-
if (typeof creationCallback !== 'function') {
|
|
344
|
-
throw new Error('must provide a callback function that returns the new type object');
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
var typeRecord = this.getElementTypeRecord(groupName);
|
|
348
|
-
|
|
349
|
-
if (this.elementCreationSchedule) {
|
|
350
|
-
this.elementCreationSchedule.add(groupName, function () {
|
|
351
|
-
var newElement = creationCallback(_this4);
|
|
352
|
-
|
|
353
|
-
if (!newElement.name) {
|
|
354
|
-
throw new Error("cannot add a ".concat(groupName, " with no name"));
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
if (typeRecord.has(newElement.name)) {
|
|
358
|
-
throw new Error("".concat(groupName, " ").concat(newElement.name, " already registered, cannot register it again"));
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
newElement = _this4.evaluateExtensionPoint('Core-extendPluggableElement', newElement);
|
|
362
|
-
typeRecord.add(newElement.name, newElement);
|
|
143
|
+
const [plugin, metadata = {}] = load instanceof Plugin_1.default ? [load, {}] : [load.plugin, load.metadata];
|
|
144
|
+
if (this.plugins.includes(plugin)) {
|
|
145
|
+
throw new Error('plugin already installed');
|
|
146
|
+
}
|
|
147
|
+
this.pluginMetadata[plugin.name] = metadata;
|
|
148
|
+
if ('definition' in load) {
|
|
149
|
+
this.runtimePluginDefinitions.push(load.definition);
|
|
150
|
+
}
|
|
151
|
+
plugin.install(this);
|
|
152
|
+
this.plugins.push(plugin);
|
|
153
|
+
return this;
|
|
154
|
+
}
|
|
155
|
+
getPlugin(name) {
|
|
156
|
+
return this.plugins.find(p => p.name === name);
|
|
157
|
+
}
|
|
158
|
+
hasPlugin(name) {
|
|
159
|
+
return this.getPlugin(name) !== undefined;
|
|
160
|
+
}
|
|
161
|
+
createPluggableElements() {
|
|
162
|
+
// run the creation callbacks for each element type in order.
|
|
163
|
+
// see elementCreationSchedule above for the creation order
|
|
164
|
+
if (this.elementCreationSchedule) {
|
|
165
|
+
this.elementCreationSchedule.run();
|
|
166
|
+
delete this.elementCreationSchedule;
|
|
167
|
+
}
|
|
168
|
+
return this;
|
|
169
|
+
}
|
|
170
|
+
setRootModel(rootModel) {
|
|
171
|
+
this.rootModel = rootModel;
|
|
172
|
+
}
|
|
173
|
+
configure() {
|
|
174
|
+
if (this.configured) {
|
|
175
|
+
throw new Error('already configured');
|
|
176
|
+
}
|
|
177
|
+
this.plugins.forEach(plugin => plugin.configure(this));
|
|
178
|
+
this.configured = true;
|
|
179
|
+
// console.log(JSON.stringify(getSnapshot(model)))
|
|
180
|
+
return this;
|
|
181
|
+
}
|
|
182
|
+
getElementTypeRecord(groupName) {
|
|
183
|
+
switch (groupName) {
|
|
184
|
+
case 'adapter':
|
|
185
|
+
return this.adapterTypes;
|
|
186
|
+
case 'text search adapter':
|
|
187
|
+
return this.textSearchAdapterTypes;
|
|
188
|
+
case 'connection':
|
|
189
|
+
return this.connectionTypes;
|
|
190
|
+
case 'widget':
|
|
191
|
+
return this.widgetTypes;
|
|
192
|
+
case 'renderer':
|
|
193
|
+
return this.rendererTypes;
|
|
194
|
+
case 'display':
|
|
195
|
+
return this.displayTypes;
|
|
196
|
+
case 'track':
|
|
197
|
+
return this.trackTypes;
|
|
198
|
+
case 'view':
|
|
199
|
+
return this.viewTypes;
|
|
200
|
+
case 'rpc method':
|
|
201
|
+
return this.rpcMethods;
|
|
202
|
+
case 'internet account':
|
|
203
|
+
return this.internetAccountTypes;
|
|
204
|
+
case 'add track workflow':
|
|
205
|
+
return this.addTrackWidgets;
|
|
206
|
+
default:
|
|
207
|
+
throw new Error(`invalid element type '${groupName}'`);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
addElementType(groupName, creationCallback) {
|
|
211
|
+
var _a;
|
|
212
|
+
if (typeof creationCallback !== 'function') {
|
|
213
|
+
throw new Error('must provide a callback function that returns the new type object');
|
|
214
|
+
}
|
|
215
|
+
const typeRecord = this.getElementTypeRecord(groupName);
|
|
216
|
+
(_a = this.elementCreationSchedule) === null || _a === void 0 ? void 0 : _a.add(groupName, () => {
|
|
217
|
+
const newElement = creationCallback(this);
|
|
218
|
+
if (!newElement.name) {
|
|
219
|
+
throw new Error(`cannot add a ${groupName} with no name`);
|
|
220
|
+
}
|
|
221
|
+
if (typeRecord.has(newElement.name)) {
|
|
222
|
+
throw new Error(`${groupName} ${newElement.name} already registered, cannot register it again`);
|
|
223
|
+
}
|
|
224
|
+
typeRecord.add(newElement.name, this.evaluateExtensionPoint('Core-extendPluggableElement', newElement));
|
|
363
225
|
});
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
var typeRecord = this.getElementTypeRecord(groupName);
|
|
372
|
-
return typeRecord.get(typeName);
|
|
373
|
-
}
|
|
374
|
-
}, {
|
|
375
|
-
key: "getElementTypesInGroup",
|
|
376
|
-
value: function getElementTypesInGroup(groupName) {
|
|
377
|
-
var typeRecord = this.getElementTypeRecord(groupName);
|
|
378
|
-
return typeRecord.all();
|
|
226
|
+
return this;
|
|
227
|
+
}
|
|
228
|
+
getElementType(groupName, typeName) {
|
|
229
|
+
return this.getElementTypeRecord(groupName).get(typeName);
|
|
230
|
+
}
|
|
231
|
+
getElementTypesInGroup(groupName) {
|
|
232
|
+
return this.getElementTypeRecord(groupName).all();
|
|
379
233
|
}
|
|
380
234
|
/** get a MST type for the union of all specified pluggable MST types */
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
if (pluggableTypes.length === 0) {
|
|
395
|
-
console.warn("No JBrowse pluggable types found matching ('".concat(typeGroup, "','").concat(fieldName, "')"));
|
|
396
|
-
return fallback;
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
return _mobxStateTree.types.union.apply(_mobxStateTree.types, (0, _toConsumableArray2.default)(pluggableTypes));
|
|
235
|
+
pluggableMstType(groupName, fieldName, fallback = mobx_state_tree_1.types.maybe(mobx_state_tree_1.types.null)) {
|
|
236
|
+
const pluggableTypes = this.getElementTypeRecord(groupName)
|
|
237
|
+
.all()
|
|
238
|
+
// @ts-ignore
|
|
239
|
+
.map(t => t[fieldName])
|
|
240
|
+
.filter(t => (0, mobx_state_tree_1.isType)(t) && (0, mobx_state_tree_1.isModelType)(t));
|
|
241
|
+
// try to smooth over the case when no types are registered, mostly
|
|
242
|
+
// encountered in tests
|
|
243
|
+
if (pluggableTypes.length === 0) {
|
|
244
|
+
console.warn(`No pluggable types found matching ('${groupName}','${fieldName}')`);
|
|
245
|
+
return fallback;
|
|
246
|
+
}
|
|
247
|
+
return mobx_state_tree_1.types.union(...pluggableTypes);
|
|
400
248
|
}
|
|
401
249
|
/** get a MST type for the union of all specified pluggable config schemas */
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
return
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
!newView.displayTypes.includes(display)) {
|
|
528
|
-
newView.addDisplayType(display);
|
|
529
|
-
}
|
|
530
|
-
});
|
|
531
|
-
|
|
532
|
-
return newView;
|
|
533
|
-
};
|
|
534
|
-
|
|
535
|
-
return this.addElementType('view', callback);
|
|
536
|
-
}
|
|
537
|
-
}, {
|
|
538
|
-
key: "addWidgetType",
|
|
539
|
-
value: function addWidgetType(creationCallback) {
|
|
540
|
-
return this.addElementType('widget', creationCallback);
|
|
541
|
-
}
|
|
542
|
-
}, {
|
|
543
|
-
key: "addConnectionType",
|
|
544
|
-
value: function addConnectionType(creationCallback) {
|
|
545
|
-
return this.addElementType('connection', creationCallback);
|
|
546
|
-
}
|
|
547
|
-
}, {
|
|
548
|
-
key: "addRpcMethod",
|
|
549
|
-
value: function addRpcMethod(creationCallback) {
|
|
550
|
-
return this.addElementType('rpc method', creationCallback);
|
|
551
|
-
}
|
|
552
|
-
}, {
|
|
553
|
-
key: "addInternetAccountType",
|
|
554
|
-
value: function addInternetAccountType(creationCallback) {
|
|
555
|
-
return this.addElementType('internet account', creationCallback);
|
|
556
|
-
}
|
|
557
|
-
}, {
|
|
558
|
-
key: "addToExtensionPoint",
|
|
559
|
-
value: function addToExtensionPoint(extensionPointName, callback) {
|
|
560
|
-
var callbacks = this.extensionPoints.get(extensionPointName);
|
|
561
|
-
|
|
562
|
-
if (!callbacks) {
|
|
563
|
-
callbacks = [];
|
|
564
|
-
this.extensionPoints.set(extensionPointName, callbacks);
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
callbacks.push(callback);
|
|
568
|
-
}
|
|
569
|
-
}, {
|
|
570
|
-
key: "evaluateExtensionPoint",
|
|
571
|
-
value: function evaluateExtensionPoint(extensionPointName, extendee) {
|
|
572
|
-
var callbacks = this.extensionPoints.get(extensionPointName);
|
|
573
|
-
var accumulator = extendee;
|
|
574
|
-
|
|
575
|
-
if (callbacks) {
|
|
576
|
-
var _iterator = _createForOfIteratorHelper(callbacks),
|
|
577
|
-
_step;
|
|
578
|
-
|
|
579
|
-
try {
|
|
580
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
581
|
-
var callback = _step.value;
|
|
582
|
-
|
|
583
|
-
try {
|
|
584
|
-
accumulator = callback(accumulator);
|
|
585
|
-
} catch (error) {
|
|
586
|
-
console.error(error);
|
|
250
|
+
pluggableConfigSchemaType(typeGroup, fieldName = 'configSchema') {
|
|
251
|
+
const pluggableTypes = this.getElementTypeRecord(typeGroup)
|
|
252
|
+
.all()
|
|
253
|
+
// @ts-ignore
|
|
254
|
+
.map(t => t[fieldName])
|
|
255
|
+
.filter(t => (0, configuration_1.isBareConfigurationSchemaType)(t));
|
|
256
|
+
if (pluggableTypes.length === 0) {
|
|
257
|
+
pluggableTypes.push((0, configuration_1.ConfigurationSchema)('Null', {}));
|
|
258
|
+
}
|
|
259
|
+
return mobx_state_tree_1.types.union(...pluggableTypes);
|
|
260
|
+
}
|
|
261
|
+
getRendererType(typeName) {
|
|
262
|
+
return this.rendererTypes.get(typeName);
|
|
263
|
+
}
|
|
264
|
+
getRendererTypes() {
|
|
265
|
+
return this.rendererTypes.all();
|
|
266
|
+
}
|
|
267
|
+
getAdapterType(typeName) {
|
|
268
|
+
return this.adapterTypes.get(typeName);
|
|
269
|
+
}
|
|
270
|
+
getTextSearchAdapterType(typeName) {
|
|
271
|
+
return this.textSearchAdapterTypes.get(typeName);
|
|
272
|
+
}
|
|
273
|
+
getTrackType(typeName) {
|
|
274
|
+
return this.trackTypes.get(typeName);
|
|
275
|
+
}
|
|
276
|
+
getDisplayType(typeName) {
|
|
277
|
+
return this.displayTypes.get(typeName);
|
|
278
|
+
}
|
|
279
|
+
getViewType(typeName) {
|
|
280
|
+
return this.viewTypes.get(typeName);
|
|
281
|
+
}
|
|
282
|
+
getAddTrackWorkflow(typeName) {
|
|
283
|
+
return this.addTrackWidgets.get(typeName);
|
|
284
|
+
}
|
|
285
|
+
getWidgetType(typeName) {
|
|
286
|
+
return this.widgetTypes.get(typeName);
|
|
287
|
+
}
|
|
288
|
+
getConnectionType(typeName) {
|
|
289
|
+
return this.connectionTypes.get(typeName);
|
|
290
|
+
}
|
|
291
|
+
getRpcMethodType(methodName) {
|
|
292
|
+
return this.rpcMethods.get(methodName);
|
|
293
|
+
}
|
|
294
|
+
getInternetAccountType(name) {
|
|
295
|
+
return this.internetAccountTypes.get(name);
|
|
296
|
+
}
|
|
297
|
+
addRendererType(cb) {
|
|
298
|
+
return this.addElementType('renderer', cb);
|
|
299
|
+
}
|
|
300
|
+
addAdapterType(cb) {
|
|
301
|
+
return this.addElementType('adapter', cb);
|
|
302
|
+
}
|
|
303
|
+
addTextSearchAdapterType(cb) {
|
|
304
|
+
return this.addElementType('text search adapter', cb);
|
|
305
|
+
}
|
|
306
|
+
addTrackType(cb) {
|
|
307
|
+
// Goes through the already-created displays and registers the ones that
|
|
308
|
+
// specify this track type
|
|
309
|
+
const callback = () => {
|
|
310
|
+
const track = cb(this);
|
|
311
|
+
const displays = this.getElementTypesInGroup('display');
|
|
312
|
+
displays.forEach(display => {
|
|
313
|
+
// track may have already added the displayType in its cb
|
|
314
|
+
if (display.trackType === track.name &&
|
|
315
|
+
!track.displayTypes.includes(display)) {
|
|
316
|
+
track.addDisplayType(display);
|
|
317
|
+
}
|
|
318
|
+
});
|
|
319
|
+
return track;
|
|
320
|
+
};
|
|
321
|
+
return this.addElementType('track', callback);
|
|
322
|
+
}
|
|
323
|
+
addDisplayType(cb) {
|
|
324
|
+
return this.addElementType('display', cb);
|
|
325
|
+
}
|
|
326
|
+
addViewType(cb) {
|
|
327
|
+
const callback = () => {
|
|
328
|
+
const newView = cb(this);
|
|
329
|
+
const displays = this.getElementTypesInGroup('display');
|
|
330
|
+
displays.forEach(display => {
|
|
331
|
+
// view may have already added the displayType in its callback
|
|
332
|
+
if (display.viewType === newView.name &&
|
|
333
|
+
!newView.displayTypes.includes(display)) {
|
|
334
|
+
newView.addDisplayType(display);
|
|
335
|
+
}
|
|
336
|
+
});
|
|
337
|
+
return newView;
|
|
338
|
+
};
|
|
339
|
+
return this.addElementType('view', callback);
|
|
340
|
+
}
|
|
341
|
+
addWidgetType(cb) {
|
|
342
|
+
return this.addElementType('widget', cb);
|
|
343
|
+
}
|
|
344
|
+
addConnectionType(cb) {
|
|
345
|
+
return this.addElementType('connection', cb);
|
|
346
|
+
}
|
|
347
|
+
addRpcMethod(cb) {
|
|
348
|
+
return this.addElementType('rpc method', cb);
|
|
349
|
+
}
|
|
350
|
+
addInternetAccountType(cb) {
|
|
351
|
+
return this.addElementType('internet account', cb);
|
|
352
|
+
}
|
|
353
|
+
addAddTrackWorkflowType(cb) {
|
|
354
|
+
return this.addElementType('add track workflow', cb);
|
|
355
|
+
}
|
|
356
|
+
addToExtensionPoint(extensionPointName, callback) {
|
|
357
|
+
let callbacks = this.extensionPoints.get(extensionPointName);
|
|
358
|
+
if (!callbacks) {
|
|
359
|
+
callbacks = [];
|
|
360
|
+
this.extensionPoints.set(extensionPointName, callbacks);
|
|
361
|
+
}
|
|
362
|
+
callbacks.push(callback);
|
|
363
|
+
}
|
|
364
|
+
evaluateExtensionPoint(extensionPointName, extendee) {
|
|
365
|
+
const callbacks = this.extensionPoints.get(extensionPointName);
|
|
366
|
+
let accumulator = extendee;
|
|
367
|
+
if (callbacks) {
|
|
368
|
+
for (const callback of callbacks) {
|
|
369
|
+
try {
|
|
370
|
+
accumulator = callback(accumulator);
|
|
371
|
+
}
|
|
372
|
+
catch (error) {
|
|
373
|
+
console.error(error);
|
|
374
|
+
}
|
|
587
375
|
}
|
|
588
|
-
}
|
|
589
|
-
} catch (err) {
|
|
590
|
-
_iterator.e(err);
|
|
591
|
-
} finally {
|
|
592
|
-
_iterator.f();
|
|
593
376
|
}
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
return _regenerator.default.wrap(function _callee$(_context) {
|
|
605
|
-
while (1) {
|
|
606
|
-
switch (_context.prev = _context.next) {
|
|
607
|
-
case 0:
|
|
608
|
-
callbacks = this.extensionPoints.get(extensionPointName);
|
|
609
|
-
accumulator = extendee;
|
|
610
|
-
|
|
611
|
-
if (!callbacks) {
|
|
612
|
-
_context.next = 27;
|
|
613
|
-
break;
|
|
377
|
+
return accumulator;
|
|
378
|
+
}
|
|
379
|
+
async evaluateAsyncExtensionPoint(extensionPointName, extendee) {
|
|
380
|
+
const callbacks = this.extensionPoints.get(extensionPointName);
|
|
381
|
+
let accumulator = extendee;
|
|
382
|
+
if (callbacks) {
|
|
383
|
+
for (const callback of callbacks) {
|
|
384
|
+
try {
|
|
385
|
+
accumulator = await callback(accumulator);
|
|
614
386
|
}
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
_context.prev = 4;
|
|
618
|
-
|
|
619
|
-
_iterator2.s();
|
|
620
|
-
|
|
621
|
-
case 6:
|
|
622
|
-
if ((_step2 = _iterator2.n()).done) {
|
|
623
|
-
_context.next = 19;
|
|
624
|
-
break;
|
|
387
|
+
catch (error) {
|
|
388
|
+
console.error(error);
|
|
625
389
|
}
|
|
626
|
-
|
|
627
|
-
callback = _step2.value;
|
|
628
|
-
_context.prev = 8;
|
|
629
|
-
_context.next = 11;
|
|
630
|
-
return callback(accumulator);
|
|
631
|
-
|
|
632
|
-
case 11:
|
|
633
|
-
accumulator = _context.sent;
|
|
634
|
-
_context.next = 17;
|
|
635
|
-
break;
|
|
636
|
-
|
|
637
|
-
case 14:
|
|
638
|
-
_context.prev = 14;
|
|
639
|
-
_context.t0 = _context["catch"](8);
|
|
640
|
-
console.error(_context.t0);
|
|
641
|
-
|
|
642
|
-
case 17:
|
|
643
|
-
_context.next = 6;
|
|
644
|
-
break;
|
|
645
|
-
|
|
646
|
-
case 19:
|
|
647
|
-
_context.next = 24;
|
|
648
|
-
break;
|
|
649
|
-
|
|
650
|
-
case 21:
|
|
651
|
-
_context.prev = 21;
|
|
652
|
-
_context.t1 = _context["catch"](4);
|
|
653
|
-
|
|
654
|
-
_iterator2.e(_context.t1);
|
|
655
|
-
|
|
656
|
-
case 24:
|
|
657
|
-
_context.prev = 24;
|
|
658
|
-
|
|
659
|
-
_iterator2.f();
|
|
660
|
-
|
|
661
|
-
return _context.finish(24);
|
|
662
|
-
|
|
663
|
-
case 27:
|
|
664
|
-
return _context.abrupt("return", accumulator);
|
|
665
|
-
|
|
666
|
-
case 28:
|
|
667
|
-
case "end":
|
|
668
|
-
return _context.stop();
|
|
669
390
|
}
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
return _evaluateAsyncExtensionPoint.apply(this, arguments);
|
|
676
|
-
}
|
|
677
|
-
|
|
678
|
-
return evaluateAsyncExtensionPoint;
|
|
679
|
-
}()
|
|
680
|
-
}]);
|
|
681
|
-
return PluginManager;
|
|
682
|
-
}();
|
|
683
|
-
|
|
684
|
-
exports.default = PluginManager;
|
|
391
|
+
}
|
|
392
|
+
return accumulator;
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
exports.default = PluginManager;
|