@jbrowse/core 3.1.0 → 3.2.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/CorePlugin.js +2 -2
- package/PluginLoader.js +3 -3
- package/PluginManager.js +15 -14
- package/configuration/configurationSchema.js +2 -2
- package/configuration/util.js +2 -2
- package/data_adapters/BaseAdapter/BaseFeatureDataAdapter.js +9 -2
- package/data_adapters/BaseAdapter/BaseOptions.d.ts +0 -1
- package/data_adapters/BaseAdapter/types.d.ts +1 -1
- package/data_adapters/CytobandAdapter/configSchema.js +17 -2
- package/data_adapters/dataAdapterCache.js +4 -4
- package/package.json +2 -2
- package/pluggableElementTypes/RpcMethodTypeWithFiltersAndRenameRegions.d.ts +3 -1
- package/pluggableElementTypes/models/BaseTrackModel.js +3 -1
- package/pluggableElementTypes/models/baseTrackConfig.js +2 -2
- package/pluggableElementTypes/renderers/FeatureRendererType.js +1 -0
- package/rpc/methods/CoreFreeResources.js +2 -2
- package/tsconfig.build.tsbuildinfo +1 -1
- package/util/Base1DUtils.js +1 -1
- package/util/analytics.js +2 -2
- package/util/idMaker.d.ts +1 -1
- package/util/idMaker.js +1 -1
- package/util/index.d.ts +3 -1
- package/util/index.js +36 -10
- package/util/layouts/PrecomputedMultiLayout.js +2 -2
- package/util/map-obj.js +2 -2
- package/util/rxjs.d.ts +1 -1
- package/util/rxjs.js +3 -1
- package/util/stopToken.d.ts +1 -1
package/CorePlugin.js
CHANGED
|
@@ -48,9 +48,9 @@ class CorePlugin extends Plugin_1.default {
|
|
|
48
48
|
this.name = 'CorePlugin';
|
|
49
49
|
}
|
|
50
50
|
install(pluginManager) {
|
|
51
|
-
Object.values(coreRpcMethods)
|
|
51
|
+
for (const RpcMethod of Object.values(coreRpcMethods)) {
|
|
52
52
|
pluginManager.addRpcMethod(() => new RpcMethod(pluginManager));
|
|
53
|
-
}
|
|
53
|
+
}
|
|
54
54
|
(0, CytobandAdapter_1.default)(pluginManager);
|
|
55
55
|
pluginManager.addWidgetType(() => {
|
|
56
56
|
return new WidgetType_1.default({
|
package/PluginLoader.js
CHANGED
|
@@ -63,12 +63,12 @@ function pluginDescriptionString(d) {
|
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
function pluginUrl(d) {
|
|
66
|
-
var _a, _b, _c;
|
|
66
|
+
var _a, _b, _c, _d, _e, _f;
|
|
67
67
|
if (isUMDPluginDefinition(d)) {
|
|
68
|
-
return (
|
|
68
|
+
return (_c = (_a = d.url) !== null && _a !== void 0 ? _a : (_b = d.umdLoc) === null || _b === void 0 ? void 0 : _b.uri) !== null && _c !== void 0 ? _c : d.umdUrl;
|
|
69
69
|
}
|
|
70
70
|
else if (isESMPluginDefinition(d)) {
|
|
71
|
-
return (
|
|
71
|
+
return (_e = (_d = d.esmUrl) !== null && _d !== void 0 ? _d : d.esmUri) !== null && _e !== void 0 ? _e : (_f = d.esmLoc) === null || _f === void 0 ? void 0 : _f.uri;
|
|
72
72
|
}
|
|
73
73
|
else if (isCJSPluginDefinition(d)) {
|
|
74
74
|
return d.cjsUrl || d.cjsLoc.uri;
|
package/PluginManager.js
CHANGED
|
@@ -37,10 +37,11 @@ class PhasedScheduler {
|
|
|
37
37
|
phaseCallbacks.push(callback);
|
|
38
38
|
}
|
|
39
39
|
run() {
|
|
40
|
-
this.phaseOrder
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
for (const phaseName of this.phaseOrder) {
|
|
41
|
+
for (const callback of this.phaseCallbacks.get(phaseName) || []) {
|
|
42
|
+
callback();
|
|
43
|
+
}
|
|
44
|
+
}
|
|
44
45
|
}
|
|
45
46
|
}
|
|
46
47
|
class TypeRecord {
|
|
@@ -115,17 +116,17 @@ class PluginManager {
|
|
|
115
116
|
isCore: true,
|
|
116
117
|
},
|
|
117
118
|
});
|
|
118
|
-
|
|
119
|
+
for (const plugin of initialPlugins) {
|
|
119
120
|
this.addPlugin(plugin);
|
|
120
|
-
}
|
|
121
|
+
}
|
|
121
122
|
}
|
|
122
123
|
pluginConfigurationSchemas() {
|
|
123
124
|
const configurationSchemas = {};
|
|
124
|
-
this.plugins
|
|
125
|
+
for (const plugin of this.plugins) {
|
|
125
126
|
if (plugin.configurationSchema) {
|
|
126
127
|
configurationSchemas[plugin.name] = plugin.configurationSchema;
|
|
127
128
|
}
|
|
128
|
-
}
|
|
129
|
+
}
|
|
129
130
|
return configurationSchemas;
|
|
130
131
|
}
|
|
131
132
|
addPlugin(load) {
|
|
@@ -167,9 +168,9 @@ class PluginManager {
|
|
|
167
168
|
if (this.configured) {
|
|
168
169
|
throw new Error('already configured');
|
|
169
170
|
}
|
|
170
|
-
this.plugins
|
|
171
|
+
for (const plugin of this.plugins) {
|
|
171
172
|
plugin.configure(this);
|
|
172
|
-
}
|
|
173
|
+
}
|
|
173
174
|
this.configured = true;
|
|
174
175
|
return this;
|
|
175
176
|
}
|
|
@@ -318,12 +319,12 @@ class PluginManager {
|
|
|
318
319
|
const callback = () => {
|
|
319
320
|
const track = cb(this);
|
|
320
321
|
const displays = this.getElementTypesInGroup('display');
|
|
321
|
-
|
|
322
|
+
for (const display of displays) {
|
|
322
323
|
if (display.trackType === track.name &&
|
|
323
324
|
!track.displayTypes.includes(display)) {
|
|
324
325
|
track.addDisplayType(display);
|
|
325
326
|
}
|
|
326
|
-
}
|
|
327
|
+
}
|
|
327
328
|
return track;
|
|
328
329
|
};
|
|
329
330
|
return this.addElementType('track', callback);
|
|
@@ -335,13 +336,13 @@ class PluginManager {
|
|
|
335
336
|
const callback = () => {
|
|
336
337
|
const newView = cb(this);
|
|
337
338
|
const displays = this.getElementTypesInGroup('display');
|
|
338
|
-
|
|
339
|
+
for (const display of displays) {
|
|
339
340
|
if ((display.viewType === newView.name ||
|
|
340
341
|
display.viewType === newView.extendedName) &&
|
|
341
342
|
!newView.displayTypes.includes(display)) {
|
|
342
343
|
newView.addDisplayType(display);
|
|
343
344
|
}
|
|
344
|
-
}
|
|
345
|
+
}
|
|
345
346
|
return newView;
|
|
346
347
|
};
|
|
347
348
|
return this.addElementType('view', callback);
|
|
@@ -75,7 +75,7 @@ function makeConfigurationSchemaModel(modelName, schemaDefinition, options) {
|
|
|
75
75
|
options,
|
|
76
76
|
},
|
|
77
77
|
};
|
|
78
|
-
|
|
78
|
+
for (const [slotName, slotDefinition] of Object.entries(schemaDefinition)) {
|
|
79
79
|
if (((0, mobx_state_tree_1.isType)(slotDefinition) && (0, mobx_state_tree_1.isLateType)(slotDefinition)) ||
|
|
80
80
|
(0, util_1.isConfigurationSchemaType)(slotDefinition)) {
|
|
81
81
|
modelDefinition[slotName] = slotDefinition;
|
|
@@ -98,7 +98,7 @@ function makeConfigurationSchemaModel(modelName, schemaDefinition, options) {
|
|
|
98
98
|
else {
|
|
99
99
|
throw new Error(`invalid configuration schema definition, "${slotName}" must be either a valid configuration slot definition, a constant, or a nested configuration schema`);
|
|
100
100
|
}
|
|
101
|
-
}
|
|
101
|
+
}
|
|
102
102
|
let completeModel = mobx_state_tree_1.types
|
|
103
103
|
.model(`${modelName}ConfigurationSchema`, modelDefinition)
|
|
104
104
|
.actions(self => ({
|
package/configuration/util.js
CHANGED
|
@@ -58,7 +58,7 @@ function getTypeNamesFromExplicitlyTypedUnion(maybeUnionType) {
|
|
|
58
58
|
maybeUnionType = (0, mst_reflection_1.resolveLateType)(maybeUnionType);
|
|
59
59
|
if ((0, mobx_state_tree_1.isUnionType)(maybeUnionType)) {
|
|
60
60
|
const typeNames = [];
|
|
61
|
-
(0, mst_reflection_1.getUnionSubTypes)(maybeUnionType)
|
|
61
|
+
for (let type of (0, mst_reflection_1.getUnionSubTypes)(maybeUnionType)) {
|
|
62
62
|
type = (0, mst_reflection_1.resolveLateType)(type);
|
|
63
63
|
let typeName = getTypeNamesFromExplicitlyTypedUnion(type);
|
|
64
64
|
if (!typeName.length) {
|
|
@@ -69,7 +69,7 @@ function getTypeNamesFromExplicitlyTypedUnion(maybeUnionType) {
|
|
|
69
69
|
throw new Error(`invalid config schema type ${type}`);
|
|
70
70
|
}
|
|
71
71
|
typeNames.push(...typeName);
|
|
72
|
-
}
|
|
72
|
+
}
|
|
73
73
|
return typeNames;
|
|
74
74
|
}
|
|
75
75
|
}
|
|
@@ -68,9 +68,16 @@ class BaseFeatureDataAdapter extends BaseAdapter_1.BaseAdapter {
|
|
|
68
68
|
start: Math.max(0, Math.round(sampleCenter - length / 2)),
|
|
69
69
|
end: Math.min(Math.round(sampleCenter + length / 2), end),
|
|
70
70
|
}, opts).pipe((0, operators_1.toArray)()));
|
|
71
|
-
return maybeRecordStats(
|
|
71
|
+
return maybeRecordStats({
|
|
72
|
+
interval: length,
|
|
73
|
+
statsSampleFeatures: features.length,
|
|
74
|
+
expansionTime,
|
|
75
|
+
stats: {
|
|
76
|
+
featureDensity: features.length / length,
|
|
77
|
+
},
|
|
78
|
+
});
|
|
72
79
|
};
|
|
73
|
-
const maybeRecordStats = async (interval, stats, statsSampleFeatures, expansionTime) => {
|
|
80
|
+
const maybeRecordStats = async ({ interval, stats, statsSampleFeatures, expansionTime, }) => {
|
|
74
81
|
const refLen = region.end - region.start;
|
|
75
82
|
if (statsSampleFeatures >= 70 || interval * 2 > refLen) {
|
|
76
83
|
return stats;
|
|
@@ -2,9 +2,9 @@ export interface BaseOptions {
|
|
|
2
2
|
stopToken?: string;
|
|
3
3
|
bpPerPx?: number;
|
|
4
4
|
sessionId?: string;
|
|
5
|
+
signal?: AbortSignal;
|
|
5
6
|
statusCallback?: (message: string) => void;
|
|
6
7
|
headers?: Record<string, string>;
|
|
7
|
-
[key: string]: unknown;
|
|
8
8
|
}
|
|
9
9
|
export type SearchType = 'full' | 'prefix' | 'exact';
|
|
10
10
|
export interface BaseTextSearchArgs {
|
|
@@ -5,7 +5,22 @@ function x() { }
|
|
|
5
5
|
const configSchema = (0, configuration_1.ConfigurationSchema)('CytobandAdapter', {
|
|
6
6
|
cytobandLocation: {
|
|
7
7
|
type: 'fileLocation',
|
|
8
|
-
defaultValue: {
|
|
8
|
+
defaultValue: {
|
|
9
|
+
uri: '/path/to/cytoband.txt.gz',
|
|
10
|
+
},
|
|
9
11
|
},
|
|
10
|
-
}, {
|
|
12
|
+
}, {
|
|
13
|
+
explicitlyTyped: true,
|
|
14
|
+
preProcessSnapshot: snap => {
|
|
15
|
+
return snap.uri
|
|
16
|
+
? {
|
|
17
|
+
...snap,
|
|
18
|
+
cytobandLocation: {
|
|
19
|
+
uri: snap.uri,
|
|
20
|
+
baseUri: snap.baseUri,
|
|
21
|
+
},
|
|
22
|
+
}
|
|
23
|
+
: snap;
|
|
24
|
+
},
|
|
25
|
+
});
|
|
11
26
|
exports.default = configSchema;
|
|
@@ -33,22 +33,22 @@ function freeAdapterResources(args) {
|
|
|
33
33
|
const specKeys = Object.keys(args);
|
|
34
34
|
if (specKeys.length === 1 && specKeys[0] === 'sessionId') {
|
|
35
35
|
const { sessionId } = args;
|
|
36
|
-
|
|
36
|
+
for (const [cacheKey, cacheEntry] of Object.entries(adapterCache)) {
|
|
37
37
|
cacheEntry.sessionIds.delete(sessionId);
|
|
38
38
|
if (cacheEntry.sessionIds.size === 0) {
|
|
39
39
|
delete adapterCache[cacheKey];
|
|
40
40
|
}
|
|
41
|
-
}
|
|
41
|
+
}
|
|
42
42
|
}
|
|
43
43
|
else {
|
|
44
|
-
Object.values(adapterCache)
|
|
44
|
+
for (const cacheEntry of Object.values(adapterCache)) {
|
|
45
45
|
const regions = args.regions || (args.region ? [args.region] : []);
|
|
46
46
|
for (const region of regions) {
|
|
47
47
|
if (region.refName !== undefined) {
|
|
48
48
|
cacheEntry.dataAdapter.freeResources(region);
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
}
|
|
51
|
+
}
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
function clearAdapterCache() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/core",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"description": "JBrowse 2 core libraries used by plugins",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jbrowse",
|
|
@@ -69,5 +69,5 @@
|
|
|
69
69
|
"access": "public",
|
|
70
70
|
"directory": "dist"
|
|
71
71
|
},
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "c750e3f56706a490c19ba75abd807fec5e38aebf"
|
|
73
73
|
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import RpcMethodType from './RpcMethodType';
|
|
2
2
|
import type { RenderArgs } from '@jbrowse/core/rpc/coreRpcMethods';
|
|
3
3
|
export default abstract class RpcMethodTypeWithFiltersAndRenameRegions extends RpcMethodType {
|
|
4
|
-
deserializeArguments(args:
|
|
4
|
+
deserializeArguments<T>(args: T & {
|
|
5
|
+
filters?: any;
|
|
6
|
+
}, rpcDriverClassName: string): Promise<T>;
|
|
5
7
|
serializeArguments(args: RenderArgs & {
|
|
6
8
|
stopToken?: string;
|
|
7
9
|
statusCallback?: (arg: string) => void;
|
|
@@ -91,7 +91,9 @@ function createBaseTrackModel(pm, trackType, baseTrackConfig) {
|
|
|
91
91
|
const conf = (0, mobx_state_tree_1.resolveIdentifier)(schema, (0, mobx_state_tree_1.getRoot)(self), displayId);
|
|
92
92
|
const t = self.displays.filter(d => d.configuration === conf);
|
|
93
93
|
(0, mobx_1.transaction)(() => {
|
|
94
|
-
|
|
94
|
+
for (const d of t) {
|
|
95
|
+
self.displays.remove(d);
|
|
96
|
+
}
|
|
95
97
|
});
|
|
96
98
|
return t.length;
|
|
97
99
|
},
|
|
@@ -87,14 +87,14 @@ function createBaseTrackConfig(pluginManager) {
|
|
|
87
87
|
const { displays = [] } = snap;
|
|
88
88
|
if (snap.trackId !== 'placeholderId') {
|
|
89
89
|
const configDisplayTypes = new Set(displays.map(d => d.type));
|
|
90
|
-
pluginManager.getTrackType(snap.type).displayTypes
|
|
90
|
+
for (const d of pluginManager.getTrackType(snap.type).displayTypes) {
|
|
91
91
|
if (!configDisplayTypes.has(d.name)) {
|
|
92
92
|
displays.push({
|
|
93
93
|
displayId: `${snap.trackId}-${d.name}`,
|
|
94
94
|
type: d.name,
|
|
95
95
|
});
|
|
96
96
|
}
|
|
97
|
-
}
|
|
97
|
+
}
|
|
98
98
|
}
|
|
99
99
|
return { ...snap, displays };
|
|
100
100
|
},
|
|
@@ -49,6 +49,7 @@ class FeatureRendererType extends ServerSideRendererType_1.default {
|
|
|
49
49
|
if (!(0, BaseAdapter_1.isFeatureAdapter)(dataAdapter)) {
|
|
50
50
|
throw new Error('Adapter does not support retrieving features');
|
|
51
51
|
}
|
|
52
|
+
(0, stopToken_1.checkStopToken)(stopToken);
|
|
52
53
|
const requestRegions = regions.map(r => ({
|
|
53
54
|
...r,
|
|
54
55
|
start: Math.floor(r.start),
|
|
@@ -12,9 +12,9 @@ class CoreFreeResources extends RpcMethodType_1.default {
|
|
|
12
12
|
}
|
|
13
13
|
async execute(args) {
|
|
14
14
|
(0, dataAdapterCache_1.freeAdapterResources)(args);
|
|
15
|
-
this.pluginManager.getRendererTypes()
|
|
15
|
+
for (const renderer of this.pluginManager.getRendererTypes()) {
|
|
16
16
|
renderer.freeResources(args);
|
|
17
|
-
}
|
|
17
|
+
}
|
|
18
18
|
}
|
|
19
19
|
async serializeArguments(args, _rpcDriver) {
|
|
20
20
|
return args;
|