@jbrowse/core 1.6.6 → 1.6.9

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.
@@ -221,7 +221,7 @@ export default class PluginManager {
221
221
  interRegionPaddingWidth: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<number>, [undefined]>;
222
222
  minimumBlockWidth: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<number>, [undefined]>;
223
223
  }, {
224
- features: import("./util/simpleFeature").Feature[] | undefined;
224
+ features: import("./util").Feature[] | undefined;
225
225
  volatileWidth: number;
226
226
  } & {
227
227
  setDisplayedRegions(regions: import("./util").Region[]): void;
@@ -264,7 +264,7 @@ export default class PluginManager {
264
264
  regionNumber?: number | undefined;
265
265
  }): number | undefined;
266
266
  } & {
267
- setFeatures(features: import("./util/simpleFeature").Feature[]): void;
267
+ setFeatures(features: import("./util").Feature[]): void;
268
268
  zoomToDisplayedRegions(leftPx: import("./util/Base1DViewModel").BpOffset | undefined, rightPx: import("./util/Base1DViewModel").BpOffset | undefined): void;
269
269
  showAllRegions(): void;
270
270
  moveTo(start: import("./util/Base1DViewModel").BpOffset, end: import("./util/Base1DViewModel").BpOffset): void;
@@ -149,7 +149,7 @@ declare const libs: {
149
149
  interRegionPaddingWidth: mst.IOptionalIType<mst.ISimpleType<number>, [undefined]>;
150
150
  minimumBlockWidth: mst.IOptionalIType<mst.ISimpleType<number>, [undefined]>;
151
151
  }, {
152
- features: import("../util/simpleFeature").Feature[] | undefined;
152
+ features: coreUtil.Feature[] | undefined;
153
153
  volatileWidth: number;
154
154
  } & {
155
155
  setDisplayedRegions(regions: coreUtil.Region[]): void;
@@ -192,7 +192,7 @@ declare const libs: {
192
192
  regionNumber?: number | undefined;
193
193
  }): number | undefined;
194
194
  } & {
195
- setFeatures(features: import("../util/simpleFeature").Feature[]): void;
195
+ setFeatures(features: coreUtil.Feature[]): void;
196
196
  zoomToDisplayedRegions(leftPx: import("../util/Base1DViewModel").BpOffset | undefined, rightPx: import("../util/Base1DViewModel").BpOffset | undefined): void;
197
197
  showAllRegions(): void;
198
198
  moveTo(start: import("../util/Base1DViewModel").BpOffset, end: import("../util/Base1DViewModel").BpOffset): void;
@@ -9,7 +9,7 @@ export default function assemblyManagerFactory(assemblyConfigType: IAnyType, plu
9
9
  refNameAliases: {
10
10
  [key: string]: string;
11
11
  } | undefined;
12
- cytobands: import("../util/simpleFeature").Feature[] | undefined;
12
+ cytobands: import("../util").Feature[] | undefined;
13
13
  } & {
14
14
  readonly initialized: boolean;
15
15
  readonly name: string;
@@ -31,14 +31,14 @@ export default function assemblyManagerFactory(assemblyConfigType: IAnyType, plu
31
31
  refNameAliases: {
32
32
  [x: string]: string;
33
33
  };
34
- cytobands: import("../util/simpleFeature").Feature[];
34
+ cytobands: import("../util").Feature[];
35
35
  }): void;
36
36
  setError(e: Error): void;
37
37
  setRegions(regions: import("../util").Region[]): void;
38
38
  setRefNameAliases(refNameAliases: {
39
39
  [x: string]: string;
40
40
  }): void;
41
- setCytobands(cytobands: import("../util/simpleFeature").Feature[]): void;
41
+ setCytobands(cytobands: import("../util").Feature[]): void;
42
42
  afterAttach(): void;
43
43
  } & {
44
44
  getAdapterMapEntry(adapterConf: unknown, options: import("./assembly").BaseOptions): Promise<{
@@ -65,7 +65,7 @@ export default function assemblyManagerFactory(assemblyConfigType: IAnyType, plu
65
65
  refNameAliases: {
66
66
  [key: string]: string;
67
67
  } | undefined;
68
- cytobands: import("../util/simpleFeature").Feature[] | undefined;
68
+ cytobands: import("../util").Feature[] | undefined;
69
69
  } & {
70
70
  readonly initialized: boolean;
71
71
  readonly name: string;
@@ -87,14 +87,14 @@ export default function assemblyManagerFactory(assemblyConfigType: IAnyType, plu
87
87
  refNameAliases: {
88
88
  [x: string]: string;
89
89
  };
90
- cytobands: import("../util/simpleFeature").Feature[];
90
+ cytobands: import("../util").Feature[];
91
91
  }): void;
92
92
  setError(e: Error): void;
93
93
  setRegions(regions: import("../util").Region[]): void;
94
94
  setRefNameAliases(refNameAliases: {
95
95
  [x: string]: string;
96
96
  }): void;
97
- setCytobands(cytobands: import("../util/simpleFeature").Feature[]): void;
97
+ setCytobands(cytobands: import("../util").Feature[]): void;
98
98
  afterAttach(): void;
99
99
  } & {
100
100
  getAdapterMapEntry(adapterConf: unknown, options: import("./assembly").BaseOptions): Promise<{
@@ -119,7 +119,7 @@ export default function assemblyManagerFactory(assemblyConfigType: IAnyType, plu
119
119
  refNameAliases: {
120
120
  [key: string]: string;
121
121
  } | undefined;
122
- cytobands: import("../util/simpleFeature").Feature[] | undefined;
122
+ cytobands: import("../util").Feature[] | undefined;
123
123
  } & {
124
124
  readonly initialized: boolean;
125
125
  readonly name: string;
@@ -141,14 +141,14 @@ export default function assemblyManagerFactory(assemblyConfigType: IAnyType, plu
141
141
  refNameAliases: {
142
142
  [x: string]: string;
143
143
  };
144
- cytobands: import("../util/simpleFeature").Feature[];
144
+ cytobands: import("../util").Feature[];
145
145
  }): void;
146
146
  setError(e: Error): void;
147
147
  setRegions(regions: import("../util").Region[]): void;
148
148
  setRefNameAliases(refNameAliases: {
149
149
  [x: string]: string;
150
150
  }): void;
151
- setCytobands(cytobands: import("../util/simpleFeature").Feature[]): void;
151
+ setCytobands(cytobands: import("../util").Feature[]): void;
152
152
  afterAttach(): void;
153
153
  } & {
154
154
  getAdapterMapEntry(adapterConf: unknown, options: import("./assembly").BaseOptions): Promise<{
@@ -184,7 +184,7 @@ export default function assemblyManagerFactory(assemblyConfigType: IAnyType, plu
184
184
  refNameAliases: {
185
185
  [key: string]: string;
186
186
  } | undefined;
187
- cytobands: import("../util/simpleFeature").Feature[] | undefined;
187
+ cytobands: import("../util").Feature[] | undefined;
188
188
  } & {
189
189
  readonly initialized: boolean;
190
190
  readonly name: string;
@@ -206,14 +206,14 @@ export default function assemblyManagerFactory(assemblyConfigType: IAnyType, plu
206
206
  refNameAliases: {
207
207
  [x: string]: string;
208
208
  };
209
- cytobands: import("../util/simpleFeature").Feature[];
209
+ cytobands: import("../util").Feature[];
210
210
  }): void;
211
211
  setError(e: Error): void;
212
212
  setRegions(regions: import("../util").Region[]): void;
213
213
  setRefNameAliases(refNameAliases: {
214
214
  [x: string]: string;
215
215
  }): void;
216
- setCytobands(cytobands: import("../util/simpleFeature").Feature[]): void;
216
+ setCytobands(cytobands: import("../util").Feature[]): void;
217
217
  afterAttach(): void;
218
218
  } & {
219
219
  getAdapterMapEntry(adapterConf: unknown, options: import("./assembly").BaseOptions): Promise<{
@@ -238,7 +238,7 @@ export default function assemblyManagerFactory(assemblyConfigType: IAnyType, plu
238
238
  refNameAliases: {
239
239
  [key: string]: string;
240
240
  } | undefined;
241
- cytobands: import("../util/simpleFeature").Feature[] | undefined;
241
+ cytobands: import("../util").Feature[] | undefined;
242
242
  } & {
243
243
  readonly initialized: boolean;
244
244
  readonly name: string;
@@ -260,14 +260,14 @@ export default function assemblyManagerFactory(assemblyConfigType: IAnyType, plu
260
260
  refNameAliases: {
261
261
  [x: string]: string;
262
262
  };
263
- cytobands: import("../util/simpleFeature").Feature[];
263
+ cytobands: import("../util").Feature[];
264
264
  }): void;
265
265
  setError(e: Error): void;
266
266
  setRegions(regions: import("../util").Region[]): void;
267
267
  setRefNameAliases(refNameAliases: {
268
268
  [x: string]: string;
269
269
  }): void;
270
- setCytobands(cytobands: import("../util/simpleFeature").Feature[]): void;
270
+ setCytobands(cytobands: import("../util").Feature[]): void;
271
271
  afterAttach(): void;
272
272
  } & {
273
273
  getAdapterMapEntry(adapterConf: unknown, options: import("./assembly").BaseOptions): Promise<{
@@ -307,7 +307,7 @@ export default function assemblyManagerFactory(assemblyConfigType: IAnyType, plu
307
307
  refNameAliases: {
308
308
  [key: string]: string;
309
309
  } | undefined;
310
- cytobands: import("../util/simpleFeature").Feature[] | undefined;
310
+ cytobands: import("../util").Feature[] | undefined;
311
311
  } & {
312
312
  readonly initialized: boolean;
313
313
  readonly name: string;
@@ -329,14 +329,14 @@ export default function assemblyManagerFactory(assemblyConfigType: IAnyType, plu
329
329
  refNameAliases: {
330
330
  [x: string]: string;
331
331
  };
332
- cytobands: import("../util/simpleFeature").Feature[];
332
+ cytobands: import("../util").Feature[];
333
333
  }): void;
334
334
  setError(e: Error): void;
335
335
  setRegions(regions: import("../util").Region[]): void;
336
336
  setRefNameAliases(refNameAliases: {
337
337
  [x: string]: string;
338
338
  }): void;
339
- setCytobands(cytobands: import("../util/simpleFeature").Feature[]): void;
339
+ setCytobands(cytobands: import("../util").Feature[]): void;
340
340
  afterAttach(): void;
341
341
  } & {
342
342
  getAdapterMapEntry(adapterConf: unknown, options: import("./assembly").BaseOptions): Promise<{
@@ -361,7 +361,7 @@ export default function assemblyManagerFactory(assemblyConfigType: IAnyType, plu
361
361
  refNameAliases: {
362
362
  [key: string]: string;
363
363
  } | undefined;
364
- cytobands: import("../util/simpleFeature").Feature[] | undefined;
364
+ cytobands: import("../util").Feature[] | undefined;
365
365
  } & {
366
366
  readonly initialized: boolean;
367
367
  readonly name: string;
@@ -383,14 +383,14 @@ export default function assemblyManagerFactory(assemblyConfigType: IAnyType, plu
383
383
  refNameAliases: {
384
384
  [x: string]: string;
385
385
  };
386
- cytobands: import("../util/simpleFeature").Feature[];
386
+ cytobands: import("../util").Feature[];
387
387
  }): void;
388
388
  setError(e: Error): void;
389
389
  setRegions(regions: import("../util").Region[]): void;
390
390
  setRefNameAliases(refNameAliases: {
391
391
  [x: string]: string;
392
392
  }): void;
393
- setCytobands(cytobands: import("../util/simpleFeature").Feature[]): void;
393
+ setCytobands(cytobands: import("../util").Feature[]): void;
394
394
  afterAttach(): void;
395
395
  } & {
396
396
  getAdapterMapEntry(adapterConf: unknown, options: import("./assembly").BaseOptions): Promise<{
@@ -89,11 +89,7 @@ function readConfObject(confObject) {
89
89
  subConf = confObject.get(slotName);
90
90
  }
91
91
 
92
- if (!subConf) {
93
- return undefined;
94
- }
95
-
96
- return readConfObject(subConf, newPath, args);
92
+ return subConf ? readConfObject(subConf, newPath, args) : undefined;
97
93
  }
98
94
 
99
95
  return readConfObject(confObject, slotName, args);
@@ -215,7 +215,7 @@ var BaseFeatureDataAdapter = /*#__PURE__*/function (_BaseAdapter) {
215
215
  if (!hasData) {
216
216
  observer.complete();
217
217
  } else {
218
- _this.getFeatures(region, opts).pipe((0, _operators.takeUntil)((0, _util.observeAbortSignal)(opts.signal))).subscribe(observer);
218
+ _this.getFeatures(region, opts).subscribe(observer);
219
219
  }
220
220
 
221
221
  case 5:
@@ -253,47 +253,9 @@ var BaseFeatureDataAdapter = /*#__PURE__*/function (_BaseAdapter) {
253
253
  var _this2 = this;
254
254
 
255
255
  var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
256
-
257
- var obs = _rxjs.merge.apply(void 0, (0, _toConsumableArray2.default)(regions.map(function (region) {
258
- return (0, _rxjs2.ObservableCreate)( /*#__PURE__*/function () {
259
- var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(observer) {
260
- var hasData;
261
- return _regenerator.default.wrap(function _callee4$(_context4) {
262
- while (1) {
263
- switch (_context4.prev = _context4.next) {
264
- case 0:
265
- _context4.next = 2;
266
- return _this2.hasDataForRefName(region.refName, opts);
267
-
268
- case 2:
269
- hasData = _context4.sent;
270
- (0, _util.checkAbortSignal)(opts.signal);
271
-
272
- if (!hasData) {
273
- observer.complete();
274
- } else {
275
- _this2.getFeatures(region, opts).subscribe(observer);
276
- }
277
-
278
- case 5:
279
- case "end":
280
- return _context4.stop();
281
- }
282
- }
283
- }, _callee4);
284
- }));
285
-
286
- return function (_x4) {
287
- return _ref2.apply(this, arguments);
288
- };
289
- }());
256
+ return _rxjs.merge.apply(void 0, (0, _toConsumableArray2.default)(regions.map(function (region) {
257
+ return _this2.getFeaturesInRegion(region, opts);
290
258
  })));
291
-
292
- if (opts.signal) {
293
- return obs.pipe((0, _operators.takeUntil)((0, _util.observeAbortSignal)(opts.signal)));
294
- }
295
-
296
- return obs;
297
259
  }
298
260
  /**
299
261
  * Check if the store has data for the given reference name.
@@ -304,31 +266,31 @@ var BaseFeatureDataAdapter = /*#__PURE__*/function (_BaseAdapter) {
304
266
  }, {
305
267
  key: "hasDataForRefName",
306
268
  value: function () {
307
- var _hasDataForRefName = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(refName) {
269
+ var _hasDataForRefName = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(refName) {
308
270
  var opts,
309
271
  refNames,
310
- _args5 = arguments;
311
- return _regenerator.default.wrap(function _callee5$(_context5) {
272
+ _args4 = arguments;
273
+ return _regenerator.default.wrap(function _callee4$(_context4) {
312
274
  while (1) {
313
- switch (_context5.prev = _context5.next) {
275
+ switch (_context4.prev = _context4.next) {
314
276
  case 0:
315
- opts = _args5.length > 1 && _args5[1] !== undefined ? _args5[1] : {};
316
- _context5.next = 3;
277
+ opts = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : {};
278
+ _context4.next = 3;
317
279
  return this.getRefNames(opts);
318
280
 
319
281
  case 3:
320
- refNames = _context5.sent;
321
- return _context5.abrupt("return", refNames.includes(refName));
282
+ refNames = _context4.sent;
283
+ return _context4.abrupt("return", refNames.includes(refName));
322
284
 
323
285
  case 5:
324
286
  case "end":
325
- return _context5.stop();
287
+ return _context4.stop();
326
288
  }
327
289
  }
328
- }, _callee5, this);
290
+ }, _callee4, this);
329
291
  }));
330
292
 
331
- function hasDataForRefName(_x5) {
293
+ function hasDataForRefName(_x4) {
332
294
  return _hasDataForRefName.apply(this, arguments);
333
295
  }
334
296
 
@@ -337,24 +299,24 @@ var BaseFeatureDataAdapter = /*#__PURE__*/function (_BaseAdapter) {
337
299
  }, {
338
300
  key: "getRegionStats",
339
301
  value: function () {
340
- var _getRegionStats = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(region, opts) {
302
+ var _getRegionStats = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(region, opts) {
341
303
  var feats;
342
- return _regenerator.default.wrap(function _callee6$(_context6) {
304
+ return _regenerator.default.wrap(function _callee5$(_context5) {
343
305
  while (1) {
344
- switch (_context6.prev = _context6.next) {
306
+ switch (_context5.prev = _context5.next) {
345
307
  case 0:
346
308
  feats = this.getFeatures(region, opts);
347
- return _context6.abrupt("return", (0, _stats.scoresToStats)(region, feats));
309
+ return _context5.abrupt("return", (0, _stats.scoresToStats)(region, feats));
348
310
 
349
311
  case 2:
350
312
  case "end":
351
- return _context6.stop();
313
+ return _context5.stop();
352
314
  }
353
315
  }
354
- }, _callee6, this);
316
+ }, _callee5, this);
355
317
  }));
356
318
 
357
- function getRegionStats(_x6, _x7) {
319
+ function getRegionStats(_x5, _x6) {
358
320
  return _getRegionStats.apply(this, arguments);
359
321
  }
360
322
 
@@ -363,7 +325,7 @@ var BaseFeatureDataAdapter = /*#__PURE__*/function (_BaseAdapter) {
363
325
  }, {
364
326
  key: "getMultiRegionStats",
365
327
  value: function () {
366
- var _getMultiRegionStats = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
328
+ var _getMultiRegionStats = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
367
329
  var _this3 = this;
368
330
 
369
331
  var regions,
@@ -375,29 +337,29 @@ var BaseFeatureDataAdapter = /*#__PURE__*/function (_BaseAdapter) {
375
337
  scoreSumSquares,
376
338
  featureCount,
377
339
  basesCovered,
378
- _args7 = arguments;
379
- return _regenerator.default.wrap(function _callee7$(_context7) {
340
+ _args6 = arguments;
341
+ return _regenerator.default.wrap(function _callee6$(_context6) {
380
342
  while (1) {
381
- switch (_context7.prev = _context7.next) {
343
+ switch (_context6.prev = _context6.next) {
382
344
  case 0:
383
- regions = _args7.length > 0 && _args7[0] !== undefined ? _args7[0] : [];
384
- opts = _args7.length > 1 ? _args7[1] : undefined;
345
+ regions = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : [];
346
+ opts = _args6.length > 1 ? _args6[1] : undefined;
385
347
 
386
348
  if (regions.length) {
387
- _context7.next = 4;
349
+ _context6.next = 4;
388
350
  break;
389
351
  }
390
352
 
391
- return _context7.abrupt("return", (0, _stats.blankStats)());
353
+ return _context6.abrupt("return", (0, _stats.blankStats)());
392
354
 
393
355
  case 4:
394
- _context7.next = 6;
356
+ _context6.next = 6;
395
357
  return Promise.all(regions.map(function (region) {
396
358
  return _this3.getRegionStats(region, opts);
397
359
  }));
398
360
 
399
361
  case 6:
400
- feats = _context7.sent;
362
+ feats = _context6.sent;
401
363
  scoreMax = feats.map(function (a) {
402
364
  return a.scoreMax;
403
365
  }).reduce(function (a, b) {
@@ -420,7 +382,7 @@ var BaseFeatureDataAdapter = /*#__PURE__*/function (_BaseAdapter) {
420
382
  basesCovered = feats.reduce(function (a, b) {
421
383
  return a + b.basesCovered;
422
384
  }, 0);
423
- return _context7.abrupt("return", (0, _stats.rectifyStats)({
385
+ return _context6.abrupt("return", (0, _stats.rectifyStats)({
424
386
  scoreMin: scoreMin,
425
387
  scoreMax: scoreMax,
426
388
  featureCount: featureCount,
@@ -431,10 +393,10 @@ var BaseFeatureDataAdapter = /*#__PURE__*/function (_BaseAdapter) {
431
393
 
432
394
  case 14:
433
395
  case "end":
434
- return _context7.stop();
396
+ return _context6.stop();
435
397
  }
436
398
  }
437
- }, _callee7);
399
+ }, _callee6);
438
400
  }));
439
401
 
440
402
  function getMultiRegionStats() {
@@ -446,16 +408,16 @@ var BaseFeatureDataAdapter = /*#__PURE__*/function (_BaseAdapter) {
446
408
  }, {
447
409
  key: "estimateRegionsStats",
448
410
  value: function () {
449
- var _estimateRegionsStats = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10(regions, opts) {
411
+ var _estimateRegionsStats = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9(regions, opts) {
450
412
  var _this4 = this;
451
413
 
452
414
  var region, lastTime, statsFromInterval, maybeRecordStats;
453
- return _regenerator.default.wrap(function _callee10$(_context10) {
415
+ return _regenerator.default.wrap(function _callee9$(_context9) {
454
416
  while (1) {
455
- switch (_context10.prev = _context10.next) {
417
+ switch (_context9.prev = _context9.next) {
456
418
  case 0:
457
419
  if (regions.length) {
458
- _context10.next = 2;
420
+ _context9.next = 2;
459
421
  break;
460
422
  }
461
423
 
@@ -466,11 +428,11 @@ var BaseFeatureDataAdapter = /*#__PURE__*/function (_BaseAdapter) {
466
428
  lastTime = +Date.now();
467
429
 
468
430
  statsFromInterval = /*#__PURE__*/function () {
469
- var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8(length, expansionTime) {
431
+ var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(length, expansionTime) {
470
432
  var start, end, sampleCenter, query, features;
471
- return _regenerator.default.wrap(function _callee8$(_context8) {
433
+ return _regenerator.default.wrap(function _callee7$(_context7) {
472
434
  while (1) {
473
- switch (_context8.prev = _context8.next) {
435
+ switch (_context7.prev = _context7.next) {
474
436
  case 0:
475
437
  start = region.start, end = region.end;
476
438
  sampleCenter = start * 0.75 + end * 0.25;
@@ -478,85 +440,85 @@ var BaseFeatureDataAdapter = /*#__PURE__*/function (_BaseAdapter) {
478
440
  start: Math.max(0, Math.round(sampleCenter - length / 2)),
479
441
  end: Math.min(Math.round(sampleCenter + length / 2), end)
480
442
  });
481
- _context8.next = 5;
443
+ _context7.next = 5;
482
444
  return _this4.getFeatures(query, opts).pipe((0, _operators.toArray)()).toPromise();
483
445
 
484
446
  case 5:
485
- features = _context8.sent;
486
- return _context8.abrupt("return", maybeRecordStats(length, {
447
+ features = _context7.sent;
448
+ return _context7.abrupt("return", maybeRecordStats(length, {
487
449
  featureDensity: features.length / length
488
450
  }, features.length, expansionTime));
489
451
 
490
452
  case 7:
491
453
  case "end":
492
- return _context8.stop();
454
+ return _context7.stop();
493
455
  }
494
456
  }
495
- }, _callee8);
457
+ }, _callee7);
496
458
  }));
497
459
 
498
- return function statsFromInterval(_x10, _x11) {
499
- return _ref3.apply(this, arguments);
460
+ return function statsFromInterval(_x9, _x10) {
461
+ return _ref2.apply(this, arguments);
500
462
  };
501
463
  }();
502
464
 
503
465
  maybeRecordStats = /*#__PURE__*/function () {
504
- var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9(interval, stats, statsSampleFeatures, expansionTime) {
466
+ var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8(interval, stats, statsSampleFeatures, expansionTime) {
505
467
  var refLen, currTime;
506
- return _regenerator.default.wrap(function _callee9$(_context9) {
468
+ return _regenerator.default.wrap(function _callee8$(_context8) {
507
469
  while (1) {
508
- switch (_context9.prev = _context9.next) {
470
+ switch (_context8.prev = _context8.next) {
509
471
  case 0:
510
472
  refLen = region.end - region.start;
511
473
 
512
474
  if (!(statsSampleFeatures >= 70 || interval * 2 > refLen)) {
513
- _context9.next = 5;
475
+ _context8.next = 5;
514
476
  break;
515
477
  }
516
478
 
517
- return _context9.abrupt("return", stats);
479
+ return _context8.abrupt("return", stats);
518
480
 
519
481
  case 5:
520
482
  if (!(expansionTime <= 5000)) {
521
- _context9.next = 12;
483
+ _context8.next = 12;
522
484
  break;
523
485
  }
524
486
 
525
487
  currTime = +Date.now();
526
488
  expansionTime += currTime - lastTime;
527
489
  lastTime = currTime;
528
- return _context9.abrupt("return", statsFromInterval(interval * 2, expansionTime));
490
+ return _context8.abrupt("return", statsFromInterval(interval * 2, expansionTime));
529
491
 
530
492
  case 12:
531
493
  console.warn("Stats estimation reached timeout, or didn't get enough features");
532
- return _context9.abrupt("return", {
494
+ return _context8.abrupt("return", {
533
495
  featureDensity: Infinity
534
496
  });
535
497
 
536
498
  case 14:
537
499
  case "end":
538
- return _context9.stop();
500
+ return _context8.stop();
539
501
  }
540
502
  }
541
- }, _callee9);
503
+ }, _callee8);
542
504
  }));
543
505
 
544
- return function maybeRecordStats(_x12, _x13, _x14, _x15) {
545
- return _ref4.apply(this, arguments);
506
+ return function maybeRecordStats(_x11, _x12, _x13, _x14) {
507
+ return _ref3.apply(this, arguments);
546
508
  };
547
509
  }();
548
510
 
549
- return _context10.abrupt("return", statsFromInterval(1000, 0));
511
+ return _context9.abrupt("return", statsFromInterval(1000, 0));
550
512
 
551
513
  case 7:
552
514
  case "end":
553
- return _context10.stop();
515
+ return _context9.stop();
554
516
  }
555
517
  }
556
- }, _callee10);
518
+ }, _callee9);
557
519
  }));
558
520
 
559
- function estimateRegionsStats(_x8, _x9) {
521
+ function estimateRegionsStats(_x7, _x8) {
560
522
  return _estimateRegionsStats.apply(this, arguments);
561
523
  }
562
524
 
@@ -581,21 +543,21 @@ var BaseSequenceAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
581
543
  (0, _createClass2.default)(BaseSequenceAdapter, [{
582
544
  key: "estimateRegionsStats",
583
545
  value: function () {
584
- var _estimateRegionsStats2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11() {
585
- return _regenerator.default.wrap(function _callee11$(_context11) {
546
+ var _estimateRegionsStats2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10() {
547
+ return _regenerator.default.wrap(function _callee10$(_context10) {
586
548
  while (1) {
587
- switch (_context11.prev = _context11.next) {
549
+ switch (_context10.prev = _context10.next) {
588
550
  case 0:
589
- return _context11.abrupt("return", {
551
+ return _context10.abrupt("return", {
590
552
  featureDensity: 0
591
553
  });
592
554
 
593
555
  case 1:
594
556
  case "end":
595
- return _context11.stop();
557
+ return _context10.stop();
596
558
  }
597
559
  }
598
- }, _callee11);
560
+ }, _callee10);
599
561
  }));
600
562
 
601
563
  function estimateRegionsStats() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/core",
3
- "version": "1.6.6",
3
+ "version": "1.6.9",
4
4
  "description": "JBrowse 2 core libraries used by plugins",
5
5
  "keywords": [
6
6
  "jbrowse",
@@ -77,5 +77,5 @@
77
77
  "access": "public",
78
78
  "directory": "dist"
79
79
  },
80
- "gitHead": "9fcca7793af0df2d6e527ddaace2b368c8ed2879"
80
+ "gitHead": "f6c3d4edfadc26f7ac635a2fa7259f50f0c7e5e3"
81
81
  }
@@ -114,10 +114,11 @@ var FeatureRendererType = /*#__PURE__*/function (_ServerSideRendererTy) {
114
114
  key: "serializeResultsInWorker",
115
115
  value: function serializeResultsInWorker(result, args) {
116
116
  var serialized = (0, _get2.default)((0, _getPrototypeOf2.default)(FeatureRendererType.prototype), "serializeResultsInWorker", this).call(this, result, args);
117
+ var features = result.features;
117
118
  return _objectSpread(_objectSpread({}, serialized), {}, {
118
- features: (0, _util.iterMap)(result.features.values(), function (f) {
119
+ features: (0, _util.iterMap)(features.values(), function (f) {
119
120
  return f.toJSON();
120
- })
121
+ }, features.size)
121
122
  });
122
123
  }
123
124
  /**
@@ -145,7 +146,7 @@ var FeatureRendererType = /*#__PURE__*/function (_ServerSideRendererTy) {
145
146
  var _getFeatures = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(renderArgs) {
146
147
  var _this = this;
147
148
 
148
- var signal, regions, sessionId, adapterConfig, _yield$getAdapter, dataAdapter, features, requestRegions, region, featureObservable;
149
+ var signal, regions, sessionId, adapterConfig, _yield$getAdapter, dataAdapter, features, requestRegions, region, featureObservable, feats;
149
150
 
150
151
  return _regenerator.default.wrap(function _callee$(_context) {
151
152
  while (1) {
@@ -188,24 +189,18 @@ var FeatureRendererType = /*#__PURE__*/function (_ServerSideRendererTy) {
188
189
  renderArgs) : // @ts-ignore
189
190
  dataAdapter.getFeaturesInMultipleRegions(requestRegions, renderArgs);
190
191
  _context.next = 13;
191
- return featureObservable.pipe((0, _operators.tap)(function () {
192
- return (0, _util.checkAbortSignal)(signal);
193
- }), (0, _operators.filter)(function (feature) {
194
- return _this.featurePassesFilters(renderArgs, feature);
195
- }), (0, _operators.tap)(function (feature) {
196
- var id = feature.id();
197
-
198
- if (!id) {
199
- throw new Error("invalid feature id \"".concat(id, "\""));
200
- }
201
-
202
- features.set(id, feature);
203
- }), (0, _operators.ignoreElements)()).toPromise();
192
+ return featureObservable.pipe((0, _operators.toArray)()).toPromise();
204
193
 
205
194
  case 13:
206
- return _context.abrupt("return", features);
207
-
208
- case 14:
195
+ feats = _context.sent;
196
+ (0, _util.checkAbortSignal)(signal);
197
+ return _context.abrupt("return", new Map(feats.filter(function (feat) {
198
+ return _this.featurePassesFilters(renderArgs, feat);
199
+ }).map(function (feat) {
200
+ return [feat.id(), feat];
201
+ })));
202
+
203
+ case 16:
209
204
  case "end":
210
205
  return _context.stop();
211
206
  }
@@ -1,5 +1,5 @@
1
1
  import PluginManager from '../PluginManager';
2
- import { AnyConfigurationModel } from '../configuration/configurationSchema';
2
+ import { AnyConfigurationModel } from '../configuration';
3
3
  export interface WorkerHandle {
4
4
  status?: string;
5
5
  error?: Error;
@@ -18,26 +18,25 @@ export interface RpcDriverConstructorArgs {
18
18
  export declare function watchWorker(worker: WorkerHandle, pingTime: number, rpcDriverClassName: string): Promise<unknown>;
19
19
  declare class LazyWorker {
20
20
  driver: BaseRpcDriver;
21
- worker?: WorkerHandle;
21
+ workerP?: Promise<WorkerHandle> | undefined;
22
22
  constructor(driver: BaseRpcDriver);
23
- getWorker(pluginManager: PluginManager, rpcDriverClassName: string): Promise<WorkerHandle>;
23
+ getWorker(): Promise<WorkerHandle>;
24
24
  }
25
25
  export default abstract class BaseRpcDriver {
26
26
  abstract name: string;
27
27
  private lastWorkerAssignment;
28
28
  private workerAssignments;
29
- private workerCount;
30
- abstract makeWorker(pluginManager: PluginManager): Promise<WorkerHandle>;
29
+ abstract makeWorker(): Promise<WorkerHandle>;
31
30
  private workerPool?;
32
31
  maxPingTime: number;
33
32
  workerCheckFrequency: number;
34
33
  config: AnyConfigurationModel;
35
34
  constructor(args: RpcDriverConstructorArgs);
36
- filterArgs<THING_TYPE>(thing: THING_TYPE, pluginManager: PluginManager, sessionId: string): THING_TYPE;
37
- remoteAbort(pluginManager: PluginManager, sessionId: string, functionName: string, signalId: number): Promise<void>;
35
+ filterArgs<THING_TYPE>(thing: THING_TYPE, sessionId: string): THING_TYPE;
36
+ remoteAbort(sessionId: string, functionName: string, signalId: number): Promise<void>;
38
37
  createWorkerPool(): LazyWorker[];
39
38
  getWorkerPool(): LazyWorker[];
40
- getWorker(sessionId: string, pluginManager: PluginManager): Promise<WorkerHandle>;
39
+ getWorker(sessionId: string): Promise<WorkerHandle>;
41
40
  call(pluginManager: PluginManager, sessionId: string, functionName: string, args: {
42
41
  statusCallback?: (message: string) => void;
43
42
  }, options?: {}): Promise<unknown>;
@@ -30,6 +30,8 @@ var _util = require("../util");
30
30
 
31
31
  var _remoteAbortSignals = require("./remoteAbortSignals");
32
32
 
33
+ var _configuration = require("../configuration");
34
+
33
35
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
34
36
 
35
37
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
@@ -119,48 +121,38 @@ var LazyWorker = /*#__PURE__*/function () {
119
121
  function LazyWorker(driver) {
120
122
  (0, _classCallCheck2.default)(this, LazyWorker);
121
123
  this.driver = driver;
122
- (0, _defineProperty2.default)(this, "worker", void 0);
124
+ (0, _defineProperty2.default)(this, "workerP", void 0);
123
125
  }
124
126
 
125
127
  (0, _createClass2.default)(LazyWorker, [{
126
128
  key: "getWorker",
127
129
  value: function () {
128
- var _getWorker = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(pluginManager, rpcDriverClassName) {
130
+ var _getWorker = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
129
131
  var _this = this;
130
132
 
131
- var worker;
132
133
  return _regenerator.default.wrap(function _callee$(_context) {
133
134
  while (1) {
134
135
  switch (_context.prev = _context.next) {
135
136
  case 0:
136
- if (this.worker) {
137
- _context.next = 6;
138
- break;
137
+ if (!this.workerP) {
138
+ this.workerP = this.driver.makeWorker().then(function (worker) {
139
+ watchWorker(worker, _this.driver.maxPingTime, _this.driver.name).catch(function (error) {
140
+ if (worker) {
141
+ console.error('worker did not respond, killing and generating new one');
142
+ console.error(error);
143
+ worker.destroy();
144
+ worker.status = 'killed';
145
+ worker.error = error;
146
+ _this.workerP = undefined;
147
+ }
148
+ });
149
+ return worker;
150
+ });
139
151
  }
140
152
 
141
- _context.next = 3;
142
- return this.driver.makeWorker(pluginManager);
153
+ return _context.abrupt("return", this.workerP);
143
154
 
144
- case 3:
145
- worker = _context.sent;
146
- watchWorker(worker, this.driver.maxPingTime, rpcDriverClassName).catch(function (error) {
147
- if (_this.worker) {
148
- console.error('worker did not respond, killing and generating new one');
149
- console.error(error);
150
-
151
- _this.worker.destroy();
152
-
153
- _this.worker.status = 'killed';
154
- _this.worker.error = error;
155
- _this.worker = undefined;
156
- }
157
- });
158
- this.worker = worker;
159
-
160
- case 6:
161
- return _context.abrupt("return", this.worker);
162
-
163
- case 7:
155
+ case 2:
164
156
  case "end":
165
157
  return _context.stop();
166
158
  }
@@ -168,7 +160,7 @@ var LazyWorker = /*#__PURE__*/function () {
168
160
  }, _callee, this);
169
161
  }));
170
162
 
171
- function getWorker(_x4, _x5) {
163
+ function getWorker() {
172
164
  return _getWorker.apply(this, arguments);
173
165
  }
174
166
 
@@ -184,7 +176,6 @@ var BaseRpcDriver = /*#__PURE__*/function () {
184
176
  (0, _defineProperty2.default)(this, "name", void 0);
185
177
  (0, _defineProperty2.default)(this, "lastWorkerAssignment", -1);
186
178
  (0, _defineProperty2.default)(this, "workerAssignments", new Map());
187
- (0, _defineProperty2.default)(this, "workerCount", 0);
188
179
  (0, _defineProperty2.default)(this, "workerPool", void 0);
189
180
  (0, _defineProperty2.default)(this, "maxPingTime", 30000);
190
181
  (0, _defineProperty2.default)(this, "workerCheckFrequency", 5000);
@@ -195,19 +186,19 @@ var BaseRpcDriver = /*#__PURE__*/function () {
195
186
 
196
187
  (0, _createClass2.default)(BaseRpcDriver, [{
197
188
  key: "filterArgs",
198
- value: function filterArgs(thing, pluginManager, sessionId) {
189
+ value: function filterArgs(thing, sessionId) {
199
190
  var _this2 = this;
200
191
 
201
192
  if (Array.isArray(thing)) {
202
193
  return thing.filter(isClonable).map(function (t) {
203
- return _this2.filterArgs(t, pluginManager, sessionId);
194
+ return _this2.filterArgs(t, sessionId);
204
195
  });
205
196
  }
206
197
 
207
198
  if ((0, _typeof2.default)(thing) === 'object' && thing !== null) {
208
199
  // AbortSignals are specially handled
209
200
  if (thing instanceof AbortSignal) {
210
- return (0, _remoteAbortSignals.serializeAbortSignal)(thing, this.remoteAbort.bind(this, pluginManager, sessionId));
201
+ return (0, _remoteAbortSignals.serializeAbortSignal)(thing, this.remoteAbort.bind(this, sessionId));
211
202
  }
212
203
 
213
204
  if ((0, _mobxStateTree.isStateTreeNode)(thing) && !(0, _mobxStateTree.isAlive)(thing)) {
@@ -227,7 +218,7 @@ var BaseRpcDriver = /*#__PURE__*/function () {
227
218
  k = _ref2[0],
228
219
  v = _ref2[1];
229
220
 
230
- return [k, _this2.filterArgs(v, pluginManager, sessionId)];
221
+ return [k, _this2.filterArgs(v, sessionId)];
231
222
  }));
232
223
  }
233
224
 
@@ -236,14 +227,14 @@ var BaseRpcDriver = /*#__PURE__*/function () {
236
227
  }, {
237
228
  key: "remoteAbort",
238
229
  value: function () {
239
- var _remoteAbort = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(pluginManager, sessionId, functionName, signalId) {
230
+ var _remoteAbort = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(sessionId, functionName, signalId) {
240
231
  var worker;
241
232
  return _regenerator.default.wrap(function _callee2$(_context2) {
242
233
  while (1) {
243
234
  switch (_context2.prev = _context2.next) {
244
235
  case 0:
245
236
  _context2.next = 2;
246
- return this.getWorker(sessionId, pluginManager);
237
+ return this.getWorker(sessionId);
247
238
 
248
239
  case 2:
249
240
  worker = _context2.sent;
@@ -262,7 +253,7 @@ var BaseRpcDriver = /*#__PURE__*/function () {
262
253
  }, _callee2, this);
263
254
  }));
264
255
 
265
- function remoteAbort(_x6, _x7, _x8, _x9) {
256
+ function remoteAbort(_x4, _x5, _x6) {
266
257
  return _remoteAbort.apply(this, arguments);
267
258
  }
268
259
 
@@ -274,7 +265,7 @@ var BaseRpcDriver = /*#__PURE__*/function () {
274
265
  var _this3 = this;
275
266
 
276
267
  var hardwareConcurrency = detectHardwareConcurrency();
277
- var workerCount = this.workerCount || Math.max(1, Math.ceil((hardwareConcurrency - 2) / 3));
268
+ var workerCount = (0, _configuration.readConfObject)(this.config, 'workerCount') || (0, _util.clamp)(1, Math.max(1, hardwareConcurrency - 1), 5);
278
269
  return (0, _toConsumableArray2.default)(new Array(workerCount)).map(function () {
279
270
  return new LazyWorker(_this3);
280
271
  });
@@ -293,7 +284,7 @@ var BaseRpcDriver = /*#__PURE__*/function () {
293
284
  }, {
294
285
  key: "getWorker",
295
286
  value: function () {
296
- var _getWorker2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(sessionId, pluginManager) {
287
+ var _getWorker2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(sessionId) {
297
288
  var workers, workerNumber, workerAssignment, worker;
298
289
  return _regenerator.default.wrap(function _callee3$(_context3) {
299
290
  while (1) {
@@ -310,7 +301,7 @@ var BaseRpcDriver = /*#__PURE__*/function () {
310
301
  } // console.log(`${sessionId} -> worker ${workerNumber}`)
311
302
 
312
303
 
313
- worker = workers[workerNumber].getWorker(pluginManager, this.name);
304
+ worker = workers[workerNumber].getWorker();
314
305
 
315
306
  if (worker) {
316
307
  _context3.next = 6;
@@ -330,7 +321,7 @@ var BaseRpcDriver = /*#__PURE__*/function () {
330
321
  }, _callee3, this);
331
322
  }));
332
323
 
333
- function getWorker(_x10, _x11) {
324
+ function getWorker(_x7) {
334
325
  return _getWorker2.apply(this, arguments);
335
326
  }
336
327
 
@@ -369,7 +360,7 @@ var BaseRpcDriver = /*#__PURE__*/function () {
369
360
  case 3:
370
361
  done = false;
371
362
  _context4.next = 6;
372
- return this.getWorker(sessionId, pluginManager);
363
+ return this.getWorker(sessionId);
373
364
 
374
365
  case 6:
375
366
  worker = _context4.sent;
@@ -379,7 +370,7 @@ var BaseRpcDriver = /*#__PURE__*/function () {
379
370
 
380
371
  case 10:
381
372
  serializedArgs = _context4.sent;
382
- filteredAndSerializedArgs = this.filterArgs(serializedArgs, pluginManager, sessionId); // now actually call the worker
373
+ filteredAndSerializedArgs = this.filterArgs(serializedArgs, sessionId); // now actually call the worker
383
374
 
384
375
  callP = worker.call(functionName, filteredAndSerializedArgs, _objectSpread({
385
376
  timeout: 5 * 60 * 1000,
@@ -417,7 +408,7 @@ var BaseRpcDriver = /*#__PURE__*/function () {
417
408
  }, _callee4, this);
418
409
  }));
419
410
 
420
- function call(_x12, _x13, _x14, _x15) {
411
+ function call(_x8, _x9, _x10, _x11) {
421
412
  return _call.apply(this, arguments);
422
413
  }
423
414
 
@@ -334,7 +334,7 @@ var MockRpcDriver = /*#__PURE__*/function (_BaseRpcDriver) {
334
334
  (0, _createClass2.default)(MockRpcDriver, [{
335
335
  key: "makeWorker",
336
336
  value: function () {
337
- var _makeWorker = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(_pluginManager) {
337
+ var _makeWorker = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
338
338
  return _regenerator.default.wrap(function _callee5$(_context5) {
339
339
  while (1) {
340
340
  switch (_context5.prev = _context5.next) {
@@ -349,7 +349,7 @@ var MockRpcDriver = /*#__PURE__*/function (_BaseRpcDriver) {
349
349
  }, _callee5);
350
350
  }));
351
351
 
352
- function makeWorker(_x2) {
352
+ function makeWorker() {
353
353
  return _makeWorker.apply(this, arguments);
354
354
  }
355
355
 
package/rpc/RpcManager.js CHANGED
@@ -25,6 +25,10 @@ var _WebWorkerRpcDriver = _interopRequireDefault(require("./WebWorkerRpcDriver")
25
25
 
26
26
  var _MainThreadRpcDriver = _interopRequireDefault(require("./MainThreadRpcDriver"));
27
27
 
28
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
29
+
30
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
31
+
28
32
  var DriverClasses = {
29
33
  WebWorkerRpcDriver: _WebWorkerRpcDriver.default,
30
34
  MainThreadRpcDriver: _MainThreadRpcDriver.default
@@ -54,21 +58,35 @@ var RpcManager = /*#__PURE__*/function () {
54
58
  return driver;
55
59
  }
56
60
 
57
- var backendConfiguration = this.backendConfigurations[backendName];
58
- var DriverClassImpl = DriverClasses[backendName];
61
+ var newDriver;
62
+ var config = this.mainConfiguration.drivers.get('WebWorkerRpcDriver');
59
63
 
60
- if (!DriverClassImpl) {
61
- throw new Error("requested RPC driver \"".concat(backendName, "\" is not installed"));
62
- }
64
+ if (backendName === 'MainThreadRpcDriver') {
65
+ var backendConfiguration = this.backendConfigurations.MainThreadRpcDriver;
63
66
 
64
- if (!backendConfiguration) {
65
- throw new Error("requested RPC driver \"".concat(backendName, "\" is missing config"));
66
- } // eslint-disable-next-line @typescript-eslint/no-explicit-any
67
+ if (!backendConfiguration) {
68
+ throw new Error("requested RPC driver \"".concat(backendName, "\" is missing config"));
69
+ }
67
70
 
71
+ newDriver = new _MainThreadRpcDriver.default(_objectSpread(_objectSpread({}, backendConfiguration), {}, {
72
+ config: config
73
+ }));
74
+ } else if (backendName === 'WebWorkerRpcDriver') {
75
+ var _backendConfiguration = this.backendConfigurations.WebWorkerRpcDriver;
76
+
77
+ if (!_backendConfiguration) {
78
+ throw new Error("requested RPC driver \"".concat(backendName, "\" is missing config"));
79
+ }
80
+
81
+ newDriver = new _WebWorkerRpcDriver.default(_objectSpread(_objectSpread({}, _backendConfiguration), {}, {
82
+ config: config
83
+ }), {
84
+ plugins: this.pluginManager.runtimePluginDefinitions
85
+ });
86
+ } else {
87
+ throw new Error("requested RPC driver \"".concat(backendName, "\" is not installed"));
88
+ }
68
89
 
69
- var newDriver = new DriverClassImpl(backendConfiguration, {
70
- plugins: this.pluginManager.runtimePluginDefinitions
71
- });
72
90
  this.driverObjects.set(backendName, newDriver);
73
91
  return newDriver;
74
92
  }
@@ -9,14 +9,22 @@ var _mobxStateTree = require("mobx-state-tree");
9
9
 
10
10
  var _configuration = require("../configuration");
11
11
 
12
- var MainThreadRpcDriverConfigSchema = (0, _configuration.ConfigurationSchema)('MainThreadRpcDriver', {}, {
12
+ var BaseRpcDriverConfigSchema = (0, _configuration.ConfigurationSchema)('BaseRpcDriver', {
13
+ workerCount: {
14
+ type: 'number',
15
+ description: 'The number of workers to use. If 0 (the default) JBrowse will decide how many workers to use.',
16
+ defaultValue: 0
17
+ }
18
+ }, {
13
19
  explicitlyTyped: true
14
20
  });
15
- var WebWorkerRpcDriverConfigSchema = (0, _configuration.ConfigurationSchema)('WebWorkerRpcDriver', {}, {
16
- explicitlyTyped: true
21
+ var MainThreadRpcDriverConfigSchema = (0, _configuration.ConfigurationSchema)('MainThreadRpcDriver', {}, {
22
+ explicitlyTyped: true,
23
+ baseConfiguration: BaseRpcDriverConfigSchema
17
24
  });
18
- var ElectronRpcDriverConfigSchema = (0, _configuration.ConfigurationSchema)('ElectronRpcDriver', {}, {
19
- explicitlyTyped: true
25
+ var WebWorkerRpcDriverConfigSchema = (0, _configuration.ConfigurationSchema)('WebWorkerRpcDriver', {}, {
26
+ explicitlyTyped: true,
27
+ baseConfiguration: BaseRpcDriverConfigSchema
20
28
  });
21
29
 
22
30
  var _default = (0, _configuration.ConfigurationSchema)('RpcOptions', {
@@ -25,7 +33,7 @@ var _default = (0, _configuration.ConfigurationSchema)('RpcOptions', {
25
33
  description: 'the RPC driver to use for tracks and tasks that are not configured to use a specific RPC backend',
26
34
  defaultValue: 'MainThreadRpcDriver'
27
35
  },
28
- drivers: _mobxStateTree.types.optional(_mobxStateTree.types.map(_mobxStateTree.types.union(MainThreadRpcDriverConfigSchema, WebWorkerRpcDriverConfigSchema, ElectronRpcDriverConfigSchema)), {
36
+ drivers: _mobxStateTree.types.optional(_mobxStateTree.types.map(_mobxStateTree.types.union(MainThreadRpcDriverConfigSchema, WebWorkerRpcDriverConfigSchema)), {
29
37
  MainThreadRpcDriver: {
30
38
  type: 'MainThreadRpcDriver'
31
39
  }
package/util/index.d.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  import { IAnyStateTreeNode } from 'mobx-state-tree';
2
2
  import { IReactionPublic, IReactionOptions } from 'mobx';
3
3
  import SimpleFeature, { Feature, isFeature } from './simpleFeature';
4
- import { TypeTestedByPredicate, Region, AssemblyManager } from './types';
4
+ import { AssemblyManager, Region, TypeTestedByPredicate } from './types';
5
+ export type { Feature };
5
6
  export * from './types';
6
7
  export * from './aborting';
7
8
  export * from './when';
@@ -121,9 +122,9 @@ export declare function clamp(num: number, min: number, max: number): number;
121
122
  * @param region -
122
123
  * @param bpPerPx -
123
124
  */
124
- export declare function bpToPx(bp: number, region: {
125
- start: number;
126
- end: number;
125
+ export declare function bpToPx(bp: number, { reversed, end, start, }: {
126
+ start?: number;
127
+ end?: number;
127
128
  reversed?: boolean;
128
129
  }, bpPerPx: number): number;
129
130
  export declare function radToDeg(radians: number): number;
package/util/index.js CHANGED
@@ -129,14 +129,14 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
129
129
 
130
130
  var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
131
131
 
132
+ var _react = require("react");
133
+
132
134
  var _mobxStateTree = require("mobx-state-tree");
133
135
 
134
136
  var _mobx = require("mobx");
135
137
 
136
138
  var _object = _interopRequireDefault(require("object.fromentries"));
137
139
 
138
- var _react = require("react");
139
-
140
140
  var _deepmerge = _interopRequireDefault(require("deepmerge"));
141
141
 
142
142
  var _simpleFeature = _interopRequireWildcard(require("./simpleFeature"));
@@ -731,12 +731,13 @@ function roundToNearestPointOne(num) {
731
731
  */
732
732
 
733
733
 
734
- function bpToPx(bp, region, bpPerPx) {
735
- if (region.reversed) {
736
- return roundToNearestPointOne((region.end - bp) / bpPerPx);
737
- }
738
-
739
- return roundToNearestPointOne((bp - region.start) / bpPerPx);
734
+ function bpToPx(bp, _ref, bpPerPx) {
735
+ var reversed = _ref.reversed,
736
+ _ref$end = _ref.end,
737
+ end = _ref$end === void 0 ? 0 : _ref$end,
738
+ _ref$start = _ref.start,
739
+ start = _ref$start === void 0 ? 0 : _ref$start;
740
+ return roundToNearestPointOne((reversed ? end - bp : bp - start) / bpPerPx);
740
741
  }
741
742
 
742
743
  var oneEightyOverPi = 180.0 / Math.PI;
@@ -881,7 +882,7 @@ function makeAbortableReaction(self, dataFunction, asyncReactionFunction, reacti
881
882
  return undefined;
882
883
  }
883
884
  }, /*#__PURE__*/function () {
884
- var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(data, mobxReactionHandle) {
885
+ var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(data, mobxReactionHandle) {
885
886
  var thisInProgress, result;
886
887
  return _regenerator.default.wrap(function _callee$(_context) {
887
888
  while (1) {
@@ -936,7 +937,7 @@ function makeAbortableReaction(self, dataFunction, asyncReactionFunction, reacti
936
937
  }));
937
938
 
938
939
  return function (_x, _x2) {
939
- return _ref.apply(this, arguments);
940
+ return _ref2.apply(this, arguments);
940
941
  };
941
942
  }(), reactionOptions);
942
943
  (0, _mobxStateTree.addDisposer)(self, reactionDisposer);
@@ -1002,7 +1003,7 @@ function _renameRegionsIfNeeded() {
1002
1003
  _context3.t0 = Object;
1003
1004
  _context3.next = 7;
1004
1005
  return Promise.all(assemblyNames.map( /*#__PURE__*/function () {
1005
- var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(assemblyName) {
1006
+ var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(assemblyName) {
1006
1007
  return _regenerator.default.wrap(function _callee2$(_context2) {
1007
1008
  while (1) {
1008
1009
  switch (_context2.prev = _context2.next) {
@@ -1024,7 +1025,7 @@ function _renameRegionsIfNeeded() {
1024
1025
  }));
1025
1026
 
1026
1027
  return function (_x10) {
1027
- return _ref4.apply(this, arguments);
1028
+ return _ref5.apply(this, arguments);
1028
1029
  };
1029
1030
  }()));
1030
1031
 
@@ -1053,10 +1054,10 @@ function minmax(a, b) {
1053
1054
  return [Math.min(a, b), Math.max(a, b)];
1054
1055
  }
1055
1056
 
1056
- function stringify(_ref2) {
1057
- var refName = _ref2.refName,
1058
- coord = _ref2.coord,
1059
- oob = _ref2.oob;
1057
+ function stringify(_ref3) {
1058
+ var refName = _ref3.refName,
1059
+ coord = _ref3.coord,
1060
+ oob = _ref3.oob;
1060
1061
  return "".concat(refName, ":").concat(coord.toLocaleString('en-US')).concat(oob ? ' (out of bounds)' : '');
1061
1062
  } // this is recommended in a later comment in https://github.com/electron/electron/issues/2288
1062
1063
  // for detecting electron in a renderer process, which is the one that has node enabled for us
@@ -1356,11 +1357,11 @@ function _bytesForRegions() {
1356
1357
  return _bytesForRegions.apply(this, arguments);
1357
1358
  }
1358
1359
 
1359
- function viewBpToPx(_ref3) {
1360
- var refName = _ref3.refName,
1361
- coord = _ref3.coord,
1362
- regionNumber = _ref3.regionNumber,
1363
- self = _ref3.self;
1360
+ function viewBpToPx(_ref4) {
1361
+ var refName = _ref4.refName,
1362
+ coord = _ref4.coord,
1363
+ regionNumber = _ref4.regionNumber,
1364
+ self = _ref4.self;
1364
1365
  var offsetBp = 0;
1365
1366
  var interRegionPaddingBp = self.interRegionPaddingWidth * self.bpPerPx;
1366
1367
  var minimumBlockBp = self.minimumBlockWidth * self.bpPerPx;
@@ -1397,15 +1398,15 @@ function viewBpToPx(_ref3) {
1397
1398
  }
1398
1399
 
1399
1400
  function getBpDisplayStr(totalBp) {
1400
- var displayBp;
1401
+ var str;
1401
1402
 
1402
1403
  if (Math.floor(totalBp / 1000000) > 0) {
1403
- displayBp = "".concat(parseFloat((totalBp / 1000000).toPrecision(3)), "Mbp");
1404
+ str = "".concat(parseFloat((totalBp / 1000000).toPrecision(3)), "Mbp");
1404
1405
  } else if (Math.floor(totalBp / 1000) > 0) {
1405
- displayBp = "".concat(parseFloat((totalBp / 1000).toPrecision(3)), "Kbp");
1406
+ str = "".concat(parseFloat((totalBp / 1000).toPrecision(3)), "Kbp");
1406
1407
  } else {
1407
- displayBp = "".concat(Math.floor(totalBp), "bp");
1408
+ str = "".concat(Math.floor(totalBp), "bp");
1408
1409
  }
1409
1410
 
1410
- return displayBp;
1411
+ return str;
1411
1412
  }
@@ -9,6 +9,7 @@ export interface Feature {
9
9
  get(name: 'refName'): string;
10
10
  get(name: 'start'): number;
11
11
  get(name: 'end'): number;
12
+ get(name: 'subfeatures'): Feature[] | undefined;
12
13
  get(name: string): any;
13
14
  /**
14
15
  * Set an item of data.
package/util/tracks.js CHANGED
@@ -162,7 +162,10 @@ function getFileName(track) {
162
162
 
163
163
  function guessAdapter(file, index, adapterHint, model) {
164
164
  if (model) {
165
- var adapterGuesser = (0, _mobxStateTree.getEnv)(model).pluginManager.evaluateExtensionPoint('Core-guessAdapterForLocation', function (_file, _index, _adapterHint) {
165
+ var _getEnv = (0, _mobxStateTree.getEnv)(model),
166
+ pluginManager = _getEnv.pluginManager;
167
+
168
+ var adapterGuesser = pluginManager.evaluateExtensionPoint('Core-guessAdapterForLocation', function (_file, _index, _adapterHint) {
166
169
  return undefined;
167
170
  });
168
171
  var adapter = adapterGuesser(file, index, adapterHint);