@jbrowse/core 1.6.5 → 1.6.8

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.
Files changed (58) hide show
  1. package/BaseFeatureWidget/BaseFeatureDetail.js +1 -3
  2. package/BaseFeatureWidget/index.d.ts +1 -1
  3. package/PluginLoader.d.ts +1 -1
  4. package/PluginManager.d.ts +4 -2
  5. package/ReExports/modules.d.ts +4 -2
  6. package/TextSearch/TextSearchManager.d.ts +2 -2
  7. package/assemblyManager/assemblyConfigSchema.d.ts +1 -1
  8. package/assemblyManager/assemblyManager.d.ts +22 -22
  9. package/configuration/index.d.ts +1 -1
  10. package/configuration/util.js +1 -5
  11. package/data_adapters/BaseAdapter.d.ts +2 -1
  12. package/data_adapters/BaseAdapter.js +90 -110
  13. package/data_adapters/CytobandAdapter.d.ts +1 -1
  14. package/package.json +2 -2
  15. package/pluggableElementTypes/RpcMethodType.js +1 -1
  16. package/pluggableElementTypes/models/InternetAccountModel.d.ts +103 -7
  17. package/pluggableElementTypes/models/InternetAccountModel.js +296 -10
  18. package/pluggableElementTypes/models/baseConnectionConfig.d.ts +1 -1
  19. package/pluggableElementTypes/models/baseInternetAccountConfig.d.ts +1 -1
  20. package/pluggableElementTypes/models/baseInternetAccountConfig.js +16 -1
  21. package/pluggableElementTypes/models/baseTrackConfig.d.ts +1 -1
  22. package/pluggableElementTypes/renderers/ComparativeServerSideRendererType.d.ts +1 -0
  23. package/pluggableElementTypes/renderers/ComparativeServerSideRendererType.js +46 -22
  24. package/pluggableElementTypes/renderers/FeatureRendererType.js +14 -19
  25. package/rpc/BaseRpcDriver.d.ts +7 -8
  26. package/rpc/BaseRpcDriver.js +151 -87
  27. package/rpc/BaseRpcDriver.test.js +55 -36
  28. package/rpc/MainThreadRpcDriver.d.ts +1 -1
  29. package/rpc/MainThreadRpcDriver.js +25 -16
  30. package/rpc/RpcManager.d.ts +1 -1
  31. package/rpc/RpcManager.js +29 -11
  32. package/rpc/WebWorkerRpcDriver.d.ts +1 -1
  33. package/rpc/WebWorkerRpcDriver.js +43 -11
  34. package/rpc/configSchema.d.ts +1 -1
  35. package/rpc/configSchema.js +14 -6
  36. package/ui/ErrorMessage.js +23 -8
  37. package/ui/FileSelector/FileSelector.js +1 -1
  38. package/ui/ReturnToImportFormDialog.d.ts +9 -0
  39. package/ui/ReturnToImportFormDialog.js +63 -0
  40. package/ui/Tooltip.d.ts +1 -1
  41. package/ui/Tooltip.js +2 -2
  42. package/ui/index.d.ts +2 -0
  43. package/ui/index.js +18 -0
  44. package/ui/theme.d.ts +8 -0
  45. package/ui/theme.js +9 -0
  46. package/ui/theme.test.js +2 -2
  47. package/util/Base1DViewModel.d.ts +2 -0
  48. package/util/Base1DViewModel.js +9 -0
  49. package/util/index.d.ts +7 -4
  50. package/util/index.js +67 -31
  51. package/util/index.test.js +35 -14
  52. package/util/io/index.d.ts +2 -1
  53. package/util/io/index.js +97 -86
  54. package/util/offscreenCanvasPonyfill.js +2 -2
  55. package/util/simpleFeature.d.ts +4 -0
  56. package/util/tracks.js +4 -1
  57. package/util/types/index.d.ts +2 -2
  58. package/util/types/index.js +3 -3
@@ -40,7 +40,7 @@ var _rxjs2 = require("../util/rxjs");
40
40
 
41
41
  var _util = require("../util");
42
42
 
43
- var _configurationSchema = require("../configuration/configurationSchema");
43
+ var _configuration = require("../configuration");
44
44
 
45
45
  var _stats = require("../util/stats");
46
46
 
@@ -55,7 +55,7 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
55
55
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
56
56
 
57
57
  var BaseAdapter = /*#__PURE__*/(0, _createClass2.default)(function BaseAdapter() {
58
- var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : (0, _configurationSchema.ConfigurationSchema)('empty', {}).create();
58
+ var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : (0, _configuration.ConfigurationSchema)('empty', {}).create();
59
59
  var getSubAdapter = arguments.length > 1 ? arguments[1] : undefined;
60
60
  var pluginManager = arguments.length > 2 ? arguments[2] : undefined;
61
61
  (0, _classCallCheck2.default)(this, BaseAdapter);
@@ -97,6 +97,24 @@ var BaseFeatureDataAdapter = /*#__PURE__*/function (_BaseAdapter) {
97
97
  }
98
98
 
99
99
  (0, _createClass2.default)(BaseFeatureDataAdapter, [{
100
+ key: "getConf",
101
+ value: // public abstract async getRefNames(opts?: BaseOptions): Promise<string[]>
102
+ // await this.setup()
103
+ // const { refNames } = this.metadata
104
+ // return refNames
105
+ // }
106
+ //
107
+ function getConf(arg) {
108
+ return (0, _configuration.readConfObject)(this.config, arg);
109
+ }
110
+ /**
111
+ * Get features from the data source that overlap a region
112
+ * @param region - Region
113
+ * @param options - Feature adapter options
114
+ * @returns Observable of Feature objects in the region
115
+ */
116
+
117
+ }, {
100
118
  key: "getHeader",
101
119
  value: // public abstract getFeatures(
102
120
  // region: Region,
@@ -197,7 +215,7 @@ var BaseFeatureDataAdapter = /*#__PURE__*/function (_BaseAdapter) {
197
215
  if (!hasData) {
198
216
  observer.complete();
199
217
  } else {
200
- _this.getFeatures(region, opts).pipe((0, _operators.takeUntil)((0, _util.observeAbortSignal)(opts.signal))).subscribe(observer);
218
+ _this.getFeatures(region, opts).subscribe(observer);
201
219
  }
202
220
 
203
221
  case 5:
@@ -235,47 +253,9 @@ var BaseFeatureDataAdapter = /*#__PURE__*/function (_BaseAdapter) {
235
253
  var _this2 = this;
236
254
 
237
255
  var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
238
-
239
- var obs = _rxjs.merge.apply(void 0, (0, _toConsumableArray2.default)(regions.map(function (region) {
240
- return (0, _rxjs2.ObservableCreate)( /*#__PURE__*/function () {
241
- var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(observer) {
242
- var hasData;
243
- return _regenerator.default.wrap(function _callee4$(_context4) {
244
- while (1) {
245
- switch (_context4.prev = _context4.next) {
246
- case 0:
247
- _context4.next = 2;
248
- return _this2.hasDataForRefName(region.refName, opts);
249
-
250
- case 2:
251
- hasData = _context4.sent;
252
- (0, _util.checkAbortSignal)(opts.signal);
253
-
254
- if (!hasData) {
255
- observer.complete();
256
- } else {
257
- _this2.getFeatures(region, opts).subscribe(observer);
258
- }
259
-
260
- case 5:
261
- case "end":
262
- return _context4.stop();
263
- }
264
- }
265
- }, _callee4);
266
- }));
267
-
268
- return function (_x4) {
269
- return _ref2.apply(this, arguments);
270
- };
271
- }());
256
+ return _rxjs.merge.apply(void 0, (0, _toConsumableArray2.default)(regions.map(function (region) {
257
+ return _this2.getFeaturesInRegion(region, opts);
272
258
  })));
273
-
274
- if (opts.signal) {
275
- return obs.pipe((0, _operators.takeUntil)((0, _util.observeAbortSignal)(opts.signal)));
276
- }
277
-
278
- return obs;
279
259
  }
280
260
  /**
281
261
  * Check if the store has data for the given reference name.
@@ -286,31 +266,31 @@ var BaseFeatureDataAdapter = /*#__PURE__*/function (_BaseAdapter) {
286
266
  }, {
287
267
  key: "hasDataForRefName",
288
268
  value: function () {
289
- 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) {
290
270
  var opts,
291
271
  refNames,
292
- _args5 = arguments;
293
- return _regenerator.default.wrap(function _callee5$(_context5) {
272
+ _args4 = arguments;
273
+ return _regenerator.default.wrap(function _callee4$(_context4) {
294
274
  while (1) {
295
- switch (_context5.prev = _context5.next) {
275
+ switch (_context4.prev = _context4.next) {
296
276
  case 0:
297
- opts = _args5.length > 1 && _args5[1] !== undefined ? _args5[1] : {};
298
- _context5.next = 3;
277
+ opts = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : {};
278
+ _context4.next = 3;
299
279
  return this.getRefNames(opts);
300
280
 
301
281
  case 3:
302
- refNames = _context5.sent;
303
- return _context5.abrupt("return", refNames.includes(refName));
282
+ refNames = _context4.sent;
283
+ return _context4.abrupt("return", refNames.includes(refName));
304
284
 
305
285
  case 5:
306
286
  case "end":
307
- return _context5.stop();
287
+ return _context4.stop();
308
288
  }
309
289
  }
310
- }, _callee5, this);
290
+ }, _callee4, this);
311
291
  }));
312
292
 
313
- function hasDataForRefName(_x5) {
293
+ function hasDataForRefName(_x4) {
314
294
  return _hasDataForRefName.apply(this, arguments);
315
295
  }
316
296
 
@@ -319,24 +299,24 @@ var BaseFeatureDataAdapter = /*#__PURE__*/function (_BaseAdapter) {
319
299
  }, {
320
300
  key: "getRegionStats",
321
301
  value: function () {
322
- 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) {
323
303
  var feats;
324
- return _regenerator.default.wrap(function _callee6$(_context6) {
304
+ return _regenerator.default.wrap(function _callee5$(_context5) {
325
305
  while (1) {
326
- switch (_context6.prev = _context6.next) {
306
+ switch (_context5.prev = _context5.next) {
327
307
  case 0:
328
308
  feats = this.getFeatures(region, opts);
329
- return _context6.abrupt("return", (0, _stats.scoresToStats)(region, feats));
309
+ return _context5.abrupt("return", (0, _stats.scoresToStats)(region, feats));
330
310
 
331
311
  case 2:
332
312
  case "end":
333
- return _context6.stop();
313
+ return _context5.stop();
334
314
  }
335
315
  }
336
- }, _callee6, this);
316
+ }, _callee5, this);
337
317
  }));
338
318
 
339
- function getRegionStats(_x6, _x7) {
319
+ function getRegionStats(_x5, _x6) {
340
320
  return _getRegionStats.apply(this, arguments);
341
321
  }
342
322
 
@@ -345,7 +325,7 @@ var BaseFeatureDataAdapter = /*#__PURE__*/function (_BaseAdapter) {
345
325
  }, {
346
326
  key: "getMultiRegionStats",
347
327
  value: function () {
348
- var _getMultiRegionStats = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
328
+ var _getMultiRegionStats = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
349
329
  var _this3 = this;
350
330
 
351
331
  var regions,
@@ -357,29 +337,29 @@ var BaseFeatureDataAdapter = /*#__PURE__*/function (_BaseAdapter) {
357
337
  scoreSumSquares,
358
338
  featureCount,
359
339
  basesCovered,
360
- _args7 = arguments;
361
- return _regenerator.default.wrap(function _callee7$(_context7) {
340
+ _args6 = arguments;
341
+ return _regenerator.default.wrap(function _callee6$(_context6) {
362
342
  while (1) {
363
- switch (_context7.prev = _context7.next) {
343
+ switch (_context6.prev = _context6.next) {
364
344
  case 0:
365
- regions = _args7.length > 0 && _args7[0] !== undefined ? _args7[0] : [];
366
- 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;
367
347
 
368
348
  if (regions.length) {
369
- _context7.next = 4;
349
+ _context6.next = 4;
370
350
  break;
371
351
  }
372
352
 
373
- return _context7.abrupt("return", (0, _stats.blankStats)());
353
+ return _context6.abrupt("return", (0, _stats.blankStats)());
374
354
 
375
355
  case 4:
376
- _context7.next = 6;
356
+ _context6.next = 6;
377
357
  return Promise.all(regions.map(function (region) {
378
358
  return _this3.getRegionStats(region, opts);
379
359
  }));
380
360
 
381
361
  case 6:
382
- feats = _context7.sent;
362
+ feats = _context6.sent;
383
363
  scoreMax = feats.map(function (a) {
384
364
  return a.scoreMax;
385
365
  }).reduce(function (a, b) {
@@ -402,7 +382,7 @@ var BaseFeatureDataAdapter = /*#__PURE__*/function (_BaseAdapter) {
402
382
  basesCovered = feats.reduce(function (a, b) {
403
383
  return a + b.basesCovered;
404
384
  }, 0);
405
- return _context7.abrupt("return", (0, _stats.rectifyStats)({
385
+ return _context6.abrupt("return", (0, _stats.rectifyStats)({
406
386
  scoreMin: scoreMin,
407
387
  scoreMax: scoreMax,
408
388
  featureCount: featureCount,
@@ -413,10 +393,10 @@ var BaseFeatureDataAdapter = /*#__PURE__*/function (_BaseAdapter) {
413
393
 
414
394
  case 14:
415
395
  case "end":
416
- return _context7.stop();
396
+ return _context6.stop();
417
397
  }
418
398
  }
419
- }, _callee7);
399
+ }, _callee6);
420
400
  }));
421
401
 
422
402
  function getMultiRegionStats() {
@@ -428,16 +408,16 @@ var BaseFeatureDataAdapter = /*#__PURE__*/function (_BaseAdapter) {
428
408
  }, {
429
409
  key: "estimateRegionsStats",
430
410
  value: function () {
431
- 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) {
432
412
  var _this4 = this;
433
413
 
434
414
  var region, lastTime, statsFromInterval, maybeRecordStats;
435
- return _regenerator.default.wrap(function _callee10$(_context10) {
415
+ return _regenerator.default.wrap(function _callee9$(_context9) {
436
416
  while (1) {
437
- switch (_context10.prev = _context10.next) {
417
+ switch (_context9.prev = _context9.next) {
438
418
  case 0:
439
419
  if (regions.length) {
440
- _context10.next = 2;
420
+ _context9.next = 2;
441
421
  break;
442
422
  }
443
423
 
@@ -448,11 +428,11 @@ var BaseFeatureDataAdapter = /*#__PURE__*/function (_BaseAdapter) {
448
428
  lastTime = +Date.now();
449
429
 
450
430
  statsFromInterval = /*#__PURE__*/function () {
451
- 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) {
452
432
  var start, end, sampleCenter, query, features;
453
- return _regenerator.default.wrap(function _callee8$(_context8) {
433
+ return _regenerator.default.wrap(function _callee7$(_context7) {
454
434
  while (1) {
455
- switch (_context8.prev = _context8.next) {
435
+ switch (_context7.prev = _context7.next) {
456
436
  case 0:
457
437
  start = region.start, end = region.end;
458
438
  sampleCenter = start * 0.75 + end * 0.25;
@@ -460,85 +440,85 @@ var BaseFeatureDataAdapter = /*#__PURE__*/function (_BaseAdapter) {
460
440
  start: Math.max(0, Math.round(sampleCenter - length / 2)),
461
441
  end: Math.min(Math.round(sampleCenter + length / 2), end)
462
442
  });
463
- _context8.next = 5;
443
+ _context7.next = 5;
464
444
  return _this4.getFeatures(query, opts).pipe((0, _operators.toArray)()).toPromise();
465
445
 
466
446
  case 5:
467
- features = _context8.sent;
468
- return _context8.abrupt("return", maybeRecordStats(length, {
447
+ features = _context7.sent;
448
+ return _context7.abrupt("return", maybeRecordStats(length, {
469
449
  featureDensity: features.length / length
470
450
  }, features.length, expansionTime));
471
451
 
472
452
  case 7:
473
453
  case "end":
474
- return _context8.stop();
454
+ return _context7.stop();
475
455
  }
476
456
  }
477
- }, _callee8);
457
+ }, _callee7);
478
458
  }));
479
459
 
480
- return function statsFromInterval(_x10, _x11) {
481
- return _ref3.apply(this, arguments);
460
+ return function statsFromInterval(_x9, _x10) {
461
+ return _ref2.apply(this, arguments);
482
462
  };
483
463
  }();
484
464
 
485
465
  maybeRecordStats = /*#__PURE__*/function () {
486
- 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) {
487
467
  var refLen, currTime;
488
- return _regenerator.default.wrap(function _callee9$(_context9) {
468
+ return _regenerator.default.wrap(function _callee8$(_context8) {
489
469
  while (1) {
490
- switch (_context9.prev = _context9.next) {
470
+ switch (_context8.prev = _context8.next) {
491
471
  case 0:
492
472
  refLen = region.end - region.start;
493
473
 
494
474
  if (!(statsSampleFeatures >= 70 || interval * 2 > refLen)) {
495
- _context9.next = 5;
475
+ _context8.next = 5;
496
476
  break;
497
477
  }
498
478
 
499
- return _context9.abrupt("return", stats);
479
+ return _context8.abrupt("return", stats);
500
480
 
501
481
  case 5:
502
482
  if (!(expansionTime <= 5000)) {
503
- _context9.next = 12;
483
+ _context8.next = 12;
504
484
  break;
505
485
  }
506
486
 
507
487
  currTime = +Date.now();
508
488
  expansionTime += currTime - lastTime;
509
489
  lastTime = currTime;
510
- return _context9.abrupt("return", statsFromInterval(interval * 2, expansionTime));
490
+ return _context8.abrupt("return", statsFromInterval(interval * 2, expansionTime));
511
491
 
512
492
  case 12:
513
493
  console.warn("Stats estimation reached timeout, or didn't get enough features");
514
- return _context9.abrupt("return", {
494
+ return _context8.abrupt("return", {
515
495
  featureDensity: Infinity
516
496
  });
517
497
 
518
498
  case 14:
519
499
  case "end":
520
- return _context9.stop();
500
+ return _context8.stop();
521
501
  }
522
502
  }
523
- }, _callee9);
503
+ }, _callee8);
524
504
  }));
525
505
 
526
- return function maybeRecordStats(_x12, _x13, _x14, _x15) {
527
- return _ref4.apply(this, arguments);
506
+ return function maybeRecordStats(_x11, _x12, _x13, _x14) {
507
+ return _ref3.apply(this, arguments);
528
508
  };
529
509
  }();
530
510
 
531
- return _context10.abrupt("return", statsFromInterval(1000, 0));
511
+ return _context9.abrupt("return", statsFromInterval(1000, 0));
532
512
 
533
513
  case 7:
534
514
  case "end":
535
- return _context10.stop();
515
+ return _context9.stop();
536
516
  }
537
517
  }
538
- }, _callee10);
518
+ }, _callee9);
539
519
  }));
540
520
 
541
- function estimateRegionsStats(_x8, _x9) {
521
+ function estimateRegionsStats(_x7, _x8) {
542
522
  return _estimateRegionsStats.apply(this, arguments);
543
523
  }
544
524
 
@@ -563,21 +543,21 @@ var BaseSequenceAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
563
543
  (0, _createClass2.default)(BaseSequenceAdapter, [{
564
544
  key: "estimateRegionsStats",
565
545
  value: function () {
566
- var _estimateRegionsStats2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11() {
567
- 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) {
568
548
  while (1) {
569
- switch (_context11.prev = _context11.next) {
549
+ switch (_context10.prev = _context10.next) {
570
550
  case 0:
571
- return _context11.abrupt("return", {
551
+ return _context10.abrupt("return", {
572
552
  featureDensity: 0
573
553
  });
574
554
 
575
555
  case 1:
576
556
  case "end":
577
- return _context11.stop();
557
+ return _context10.stop();
578
558
  }
579
559
  }
580
- }, _callee11);
560
+ }, _callee10);
581
561
  }));
582
562
 
583
563
  function estimateRegionsStats() {
@@ -1,6 +1,6 @@
1
1
  import SimpleFeature from '../util/simpleFeature';
2
2
  import { BaseAdapter } from './BaseAdapter';
3
- declare const configSchema: import("../configuration/configurationSchema").AnyConfigurationSchemaType;
3
+ declare const configSchema: import("../configuration").AnyConfigurationSchemaType;
4
4
  declare class CytobandAdapter extends BaseAdapter {
5
5
  getData(): Promise<SimpleFeature[]>;
6
6
  freeResources(): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/core",
3
- "version": "1.6.5",
3
+ "version": "1.6.8",
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": "ab41f017840ffef09f5d60b008281cedaa5abe26"
80
+ "gitHead": "585e522096651ef4afb188366bb46d723439dc1b"
81
81
  }
@@ -245,7 +245,7 @@ var RpcMethodType = /*#__PURE__*/function (_PluggableElementBase) {
245
245
  }
246
246
 
247
247
  // @ts-ignore
248
- retryAccount = rootModel === null || rootModel === void 0 ? void 0 : rootModel.createEphemeralInternetAccount("HTTPBasicInternetAccount-".concat(new URL(_context5.t0.location.uri).origin), {}, _context5.t0.location);
248
+ retryAccount = rootModel === null || rootModel === void 0 ? void 0 : rootModel.createEphemeralInternetAccount("HTTPBasicInternetAccount-".concat(new URL(_context5.t0.url).origin), {}, _context5.t0.url);
249
249
  throw new _types.RetryError('Retrying with created internet account', retryAccount.internetAccountId);
250
250
 
251
251
  case 12:
@@ -1,24 +1,120 @@
1
1
  import React from 'react';
2
2
  import { Instance } from 'mobx-state-tree';
3
3
  import { RemoteFileWithRangeCache } from '../../util/io';
4
- import { FileLocation, UriLocation, AnyReactComponentType } from '../../util/types';
4
+ import { UriLocation, AnyReactComponentType } from '../../util/types';
5
5
  export declare const InternetAccount: import("mobx-state-tree").IModelType<{
6
6
  id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
7
7
  type: import("mobx-state-tree").ISimpleType<string>;
8
8
  }, {
9
- readonly name: any;
10
- readonly internetAccountId: any;
11
- readonly tokenType: any;
12
- readonly accountConfig: any;
9
+ readonly name: string;
10
+ readonly description: string;
11
+ readonly internetAccountId: string;
12
+ readonly authHeader: string;
13
+ readonly tokenType: string;
14
+ readonly domains: string[];
15
+ /**
16
+ * Can use this to customize what is displayed in fileSelector's toggle box
17
+ */
13
18
  readonly toggleContents: React.ReactNode;
19
+ /**
20
+ * Can use this to customize what the fileSelector. It takes a prop called
21
+ * `setLocation` that should be used to set a UriLocation
22
+ */
14
23
  readonly SelectorComponent: AnyReactComponentType | undefined;
24
+ /**
25
+ * Can use this to add a label to the UrlChooser. Has no effect if a custom
26
+ * SelectorComponent is supplied
27
+ */
15
28
  readonly selectorLabel: string | undefined;
16
- handlesLocation(location: FileLocation): boolean;
17
29
  } & {
18
- openLocation(location: UriLocation): RemoteFileWithRangeCache;
30
+ /**
31
+ * Determine whether this internetAccount provides credentials for a URL
32
+ * @param location - UriLocation of resource
33
+ * @returns true or false
34
+ */
35
+ handlesLocation(location: UriLocation): boolean;
36
+ /**
37
+ * The key used to store this internetAccount's token in sessionStorage
38
+ */
39
+ readonly tokenKey: string;
40
+ } & {
41
+ /**
42
+ * Must be implemented by a model extending or composing this one. Pass the
43
+ * user's token to `resolve`.
44
+ * @param resolve - Pass the token to this function
45
+ * @param reject - If there is an error getting the token, call this function
46
+ */
47
+ getTokenFromUser(resolve: (token: string) => void, reject: (error: Error) => void): void;
48
+ storeToken(token: string): void;
49
+ removeToken(): void;
50
+ retrieveToken(): string | null;
51
+ /**
52
+ * This can be used by an internetAccount to validate a token works before
53
+ * it is used. This is run when preAuthorizationInformation is requested, so
54
+ * it can be used to check that a token is valid before sending it to a
55
+ * worker thread. It expects the token to be returned so that this action
56
+ * can also be used to generate a new token (e.g. by using a refresh token)
57
+ * if the original one was invalid. Should throw an error if a token is
58
+ * invalid.
59
+ * @param token - Auth token
60
+ * @param location - UriLocation of the resource
61
+ * @returns - Valid auth token
62
+ */
63
+ validateToken(token: string, location: UriLocation): Promise<string>;
64
+ } & {
65
+ /**
66
+ * Try to get the token from the location pre-auth, from local storage,
67
+ * or from a previously cached promise. If token is not available, uses
68
+ * `getTokenFromUser`.
69
+ * @param location - UriLocation of the resource
70
+ * @returns A promise for the token
71
+ */
72
+ getToken(location?: UriLocation | undefined): Promise<string>;
73
+ } & {
74
+ addAuthHeaderToInit(init: RequestInit | undefined, token: string): {
75
+ headers: Headers;
76
+ body?: BodyInit | null | undefined;
77
+ cache?: RequestCache | undefined;
78
+ credentials?: RequestCredentials | undefined;
79
+ integrity?: string | undefined;
80
+ keepalive?: boolean | undefined;
81
+ method?: string | undefined;
82
+ mode?: RequestMode | undefined;
83
+ redirect?: RequestRedirect | undefined;
84
+ referrer?: string | undefined;
85
+ referrerPolicy?: ReferrerPolicy | undefined;
86
+ signal?: AbortSignal | null | undefined;
87
+ window?: null | undefined;
88
+ };
89
+ /**
90
+ * Gets the token and returns it along with the information needed to
91
+ * create a new internetAccount.
92
+ * @param location - UriLocation of the resource
93
+ * @returns
94
+ */
19
95
  getPreAuthorizationInformation(location: UriLocation): Promise<{
20
96
  internetAccountType: string;
97
+ authInfo: {
98
+ token: string;
99
+ configuration: any;
100
+ };
21
101
  }>;
102
+ } & {
103
+ /**
104
+ * Get a fetch method that will add any needed authentication headers to
105
+ * the request before sending it. If location is provided, it will be
106
+ * checked to see if it includes a token in it pre-auth information.
107
+ * @param location - UriLocation of the resource
108
+ * @returns A function that can be used to fetch
109
+ */
110
+ getFetcher(location?: UriLocation | undefined): (input: RequestInfo, init?: RequestInit | undefined) => Promise<Response>;
111
+ } & {
112
+ /**
113
+ * Gets a filehandle that uses a fetch that adds auth headers
114
+ * @param location - UriLocation of the resource
115
+ * @returns A filehandle
116
+ */
117
+ openLocation(location: UriLocation): RemoteFileWithRangeCache;
22
118
  }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
23
119
  export declare type BaseInternetAccountStateModel = typeof InternetAccount;
24
120
  export declare type BaseInternetAccountModel = Instance<BaseInternetAccountStateModel>;