@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.
- package/BaseFeatureWidget/BaseFeatureDetail.js +1 -3
- package/BaseFeatureWidget/index.d.ts +1 -1
- package/PluginLoader.d.ts +1 -1
- package/PluginManager.d.ts +4 -2
- package/ReExports/modules.d.ts +4 -2
- package/TextSearch/TextSearchManager.d.ts +2 -2
- package/assemblyManager/assemblyConfigSchema.d.ts +1 -1
- package/assemblyManager/assemblyManager.d.ts +22 -22
- package/configuration/index.d.ts +1 -1
- package/configuration/util.js +1 -5
- package/data_adapters/BaseAdapter.d.ts +2 -1
- package/data_adapters/BaseAdapter.js +90 -110
- package/data_adapters/CytobandAdapter.d.ts +1 -1
- package/package.json +2 -2
- package/pluggableElementTypes/RpcMethodType.js +1 -1
- package/pluggableElementTypes/models/InternetAccountModel.d.ts +103 -7
- package/pluggableElementTypes/models/InternetAccountModel.js +296 -10
- package/pluggableElementTypes/models/baseConnectionConfig.d.ts +1 -1
- package/pluggableElementTypes/models/baseInternetAccountConfig.d.ts +1 -1
- package/pluggableElementTypes/models/baseInternetAccountConfig.js +16 -1
- package/pluggableElementTypes/models/baseTrackConfig.d.ts +1 -1
- package/pluggableElementTypes/renderers/ComparativeServerSideRendererType.d.ts +1 -0
- package/pluggableElementTypes/renderers/ComparativeServerSideRendererType.js +46 -22
- package/pluggableElementTypes/renderers/FeatureRendererType.js +14 -19
- package/rpc/BaseRpcDriver.d.ts +7 -8
- package/rpc/BaseRpcDriver.js +151 -87
- package/rpc/BaseRpcDriver.test.js +55 -36
- package/rpc/MainThreadRpcDriver.d.ts +1 -1
- package/rpc/MainThreadRpcDriver.js +25 -16
- package/rpc/RpcManager.d.ts +1 -1
- package/rpc/RpcManager.js +29 -11
- package/rpc/WebWorkerRpcDriver.d.ts +1 -1
- package/rpc/WebWorkerRpcDriver.js +43 -11
- package/rpc/configSchema.d.ts +1 -1
- package/rpc/configSchema.js +14 -6
- package/ui/ErrorMessage.js +23 -8
- package/ui/FileSelector/FileSelector.js +1 -1
- package/ui/ReturnToImportFormDialog.d.ts +9 -0
- package/ui/ReturnToImportFormDialog.js +63 -0
- package/ui/Tooltip.d.ts +1 -1
- package/ui/Tooltip.js +2 -2
- package/ui/index.d.ts +2 -0
- package/ui/index.js +18 -0
- package/ui/theme.d.ts +8 -0
- package/ui/theme.js +9 -0
- package/ui/theme.test.js +2 -2
- package/util/Base1DViewModel.d.ts +2 -0
- package/util/Base1DViewModel.js +9 -0
- package/util/index.d.ts +7 -4
- package/util/index.js +67 -31
- package/util/index.test.js +35 -14
- package/util/io/index.d.ts +2 -1
- package/util/io/index.js +97 -86
- package/util/offscreenCanvasPonyfill.js +2 -2
- package/util/simpleFeature.d.ts +4 -0
- package/util/tracks.js +4 -1
- package/util/types/index.d.ts +2 -2
- package/util/types/index.js +3 -3
package/util/index.js
CHANGED
|
@@ -56,6 +56,7 @@ var _exportNames = {
|
|
|
56
56
|
objectHash: true,
|
|
57
57
|
bytesForRegions: true,
|
|
58
58
|
viewBpToPx: true,
|
|
59
|
+
getBpDisplayStr: true,
|
|
59
60
|
SimpleFeature: true,
|
|
60
61
|
isFeature: true
|
|
61
62
|
};
|
|
@@ -81,6 +82,7 @@ exports.findLastIndex = findLastIndex;
|
|
|
81
82
|
exports.findParentThat = findParentThat;
|
|
82
83
|
exports.findParentThatIs = findParentThatIs;
|
|
83
84
|
exports.generateCodonTable = generateCodonTable;
|
|
85
|
+
exports.getBpDisplayStr = getBpDisplayStr;
|
|
84
86
|
exports.getContainingDisplay = getContainingDisplay;
|
|
85
87
|
exports.getContainingTrack = getContainingTrack;
|
|
86
88
|
exports.getContainingView = getContainingView;
|
|
@@ -127,14 +129,14 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
127
129
|
|
|
128
130
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
129
131
|
|
|
132
|
+
var _react = require("react");
|
|
133
|
+
|
|
130
134
|
var _mobxStateTree = require("mobx-state-tree");
|
|
131
135
|
|
|
132
136
|
var _mobx = require("mobx");
|
|
133
137
|
|
|
134
138
|
var _object = _interopRequireDefault(require("object.fromentries"));
|
|
135
139
|
|
|
136
|
-
var _react = require("react");
|
|
137
|
-
|
|
138
140
|
var _deepmerge = _interopRequireDefault(require("deepmerge"));
|
|
139
141
|
|
|
140
142
|
var _simpleFeature = _interopRequireWildcard(require("./simpleFeature"));
|
|
@@ -469,7 +471,8 @@ function assembleLocString(region) {
|
|
|
469
471
|
var assemblyName = region.assemblyName,
|
|
470
472
|
refName = region.refName,
|
|
471
473
|
start = region.start,
|
|
472
|
-
end = region.end
|
|
474
|
+
end = region.end,
|
|
475
|
+
reversed = region.reversed;
|
|
473
476
|
var assemblyNameString = assemblyName ? "{".concat(assemblyName, "}") : '';
|
|
474
477
|
var startString;
|
|
475
478
|
|
|
@@ -489,17 +492,29 @@ function assembleLocString(region) {
|
|
|
489
492
|
endString = start !== undefined ? '..' : '';
|
|
490
493
|
}
|
|
491
494
|
|
|
492
|
-
|
|
495
|
+
var rev = '';
|
|
496
|
+
|
|
497
|
+
if (reversed) {
|
|
498
|
+
rev = '[rev]';
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
return "".concat(assemblyNameString).concat(refName).concat(startString).concat(endString).concat(rev);
|
|
493
502
|
}
|
|
494
503
|
|
|
495
504
|
function parseLocStringOneBased(locString, isValidRefName) {
|
|
496
505
|
if (!locString) {
|
|
497
506
|
throw new Error('no location string provided, could not parse');
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
var reversed = false;
|
|
510
|
+
|
|
511
|
+
if (locString.endsWith('[rev]')) {
|
|
512
|
+
reversed = true;
|
|
513
|
+
locString = locString.replace(/\[rev\]$/, '');
|
|
498
514
|
} // remove any whitespace
|
|
499
515
|
|
|
500
516
|
|
|
501
|
-
locString = locString.replace(/\s/, ''); // refNames can have colons
|
|
502
|
-
// https://samtools.github.io/hts-specs/SAMv1.pdf Appendix A
|
|
517
|
+
locString = locString.replace(/\s/, ''); // refNames can have colons, ref https://samtools.github.io/hts-specs/SAMv1.pdf Appendix A
|
|
503
518
|
|
|
504
519
|
var assemblyMatch = locString.match(/(\{(.+)\})?(.+)/);
|
|
505
520
|
|
|
@@ -521,7 +536,8 @@ function parseLocStringOneBased(locString, isValidRefName) {
|
|
|
521
536
|
if (isValidRefName(location, assemblyName)) {
|
|
522
537
|
return {
|
|
523
538
|
assemblyName: assemblyName,
|
|
524
|
-
refName: location
|
|
539
|
+
refName: location,
|
|
540
|
+
reversed: reversed
|
|
525
541
|
};
|
|
526
542
|
}
|
|
527
543
|
|
|
@@ -550,7 +566,8 @@ function parseLocStringOneBased(locString, isValidRefName) {
|
|
|
550
566
|
assemblyName: assemblyName,
|
|
551
567
|
refName: prefix,
|
|
552
568
|
start: +_start.replace(/,/g, ''),
|
|
553
|
-
end: +_end.replace(/,/g, '')
|
|
569
|
+
end: +_end.replace(/,/g, ''),
|
|
570
|
+
reversed: reversed
|
|
554
571
|
};
|
|
555
572
|
}
|
|
556
573
|
} else if (singleMatch) {
|
|
@@ -564,7 +581,8 @@ function parseLocStringOneBased(locString, isValidRefName) {
|
|
|
564
581
|
return {
|
|
565
582
|
assemblyName: assemblyName,
|
|
566
583
|
refName: prefix,
|
|
567
|
-
start: +_start2.replace(/,/g, '')
|
|
584
|
+
start: +_start2.replace(/,/g, ''),
|
|
585
|
+
reversed: reversed
|
|
568
586
|
};
|
|
569
587
|
}
|
|
570
588
|
|
|
@@ -572,7 +590,8 @@ function parseLocStringOneBased(locString, isValidRefName) {
|
|
|
572
590
|
assemblyName: assemblyName,
|
|
573
591
|
refName: prefix,
|
|
574
592
|
start: +_start2.replace(/,/g, ''),
|
|
575
|
-
end: +_start2.replace(/,/g, '')
|
|
593
|
+
end: +_start2.replace(/,/g, ''),
|
|
594
|
+
reversed: reversed
|
|
576
595
|
};
|
|
577
596
|
}
|
|
578
597
|
} else {
|
|
@@ -581,13 +600,15 @@ function parseLocStringOneBased(locString, isValidRefName) {
|
|
|
581
600
|
} else {
|
|
582
601
|
return {
|
|
583
602
|
assemblyName: assemblyName,
|
|
584
|
-
refName: prefix
|
|
603
|
+
refName: prefix,
|
|
604
|
+
reversed: reversed
|
|
585
605
|
};
|
|
586
606
|
}
|
|
587
607
|
} else if (isValidRefName(location, assemblyName)) {
|
|
588
608
|
return {
|
|
589
609
|
assemblyName: assemblyName,
|
|
590
|
-
refName: location
|
|
610
|
+
refName: location,
|
|
611
|
+
reversed: reversed
|
|
591
612
|
};
|
|
592
613
|
}
|
|
593
614
|
|
|
@@ -710,12 +731,13 @@ function roundToNearestPointOne(num) {
|
|
|
710
731
|
*/
|
|
711
732
|
|
|
712
733
|
|
|
713
|
-
function bpToPx(bp,
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
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);
|
|
719
741
|
}
|
|
720
742
|
|
|
721
743
|
var oneEightyOverPi = 180.0 / Math.PI;
|
|
@@ -860,7 +882,7 @@ function makeAbortableReaction(self, dataFunction, asyncReactionFunction, reacti
|
|
|
860
882
|
return undefined;
|
|
861
883
|
}
|
|
862
884
|
}, /*#__PURE__*/function () {
|
|
863
|
-
var
|
|
885
|
+
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(data, mobxReactionHandle) {
|
|
864
886
|
var thisInProgress, result;
|
|
865
887
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
866
888
|
while (1) {
|
|
@@ -915,7 +937,7 @@ function makeAbortableReaction(self, dataFunction, asyncReactionFunction, reacti
|
|
|
915
937
|
}));
|
|
916
938
|
|
|
917
939
|
return function (_x, _x2) {
|
|
918
|
-
return
|
|
940
|
+
return _ref2.apply(this, arguments);
|
|
919
941
|
};
|
|
920
942
|
}(), reactionOptions);
|
|
921
943
|
(0, _mobxStateTree.addDisposer)(self, reactionDisposer);
|
|
@@ -981,7 +1003,7 @@ function _renameRegionsIfNeeded() {
|
|
|
981
1003
|
_context3.t0 = Object;
|
|
982
1004
|
_context3.next = 7;
|
|
983
1005
|
return Promise.all(assemblyNames.map( /*#__PURE__*/function () {
|
|
984
|
-
var
|
|
1006
|
+
var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(assemblyName) {
|
|
985
1007
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
986
1008
|
while (1) {
|
|
987
1009
|
switch (_context2.prev = _context2.next) {
|
|
@@ -1003,7 +1025,7 @@ function _renameRegionsIfNeeded() {
|
|
|
1003
1025
|
}));
|
|
1004
1026
|
|
|
1005
1027
|
return function (_x10) {
|
|
1006
|
-
return
|
|
1028
|
+
return _ref5.apply(this, arguments);
|
|
1007
1029
|
};
|
|
1008
1030
|
}()));
|
|
1009
1031
|
|
|
@@ -1032,10 +1054,10 @@ function minmax(a, b) {
|
|
|
1032
1054
|
return [Math.min(a, b), Math.max(a, b)];
|
|
1033
1055
|
}
|
|
1034
1056
|
|
|
1035
|
-
function stringify(
|
|
1036
|
-
var refName =
|
|
1037
|
-
coord =
|
|
1038
|
-
oob =
|
|
1057
|
+
function stringify(_ref3) {
|
|
1058
|
+
var refName = _ref3.refName,
|
|
1059
|
+
coord = _ref3.coord,
|
|
1060
|
+
oob = _ref3.oob;
|
|
1039
1061
|
return "".concat(refName, ":").concat(coord.toLocaleString('en-US')).concat(oob ? ' (out of bounds)' : '');
|
|
1040
1062
|
} // this is recommended in a later comment in https://github.com/electron/electron/issues/2288
|
|
1041
1063
|
// for detecting electron in a renderer process, which is the one that has node enabled for us
|
|
@@ -1335,11 +1357,11 @@ function _bytesForRegions() {
|
|
|
1335
1357
|
return _bytesForRegions.apply(this, arguments);
|
|
1336
1358
|
}
|
|
1337
1359
|
|
|
1338
|
-
function viewBpToPx(
|
|
1339
|
-
var refName =
|
|
1340
|
-
coord =
|
|
1341
|
-
regionNumber =
|
|
1342
|
-
self =
|
|
1360
|
+
function viewBpToPx(_ref4) {
|
|
1361
|
+
var refName = _ref4.refName,
|
|
1362
|
+
coord = _ref4.coord,
|
|
1363
|
+
regionNumber = _ref4.regionNumber,
|
|
1364
|
+
self = _ref4.self;
|
|
1343
1365
|
var offsetBp = 0;
|
|
1344
1366
|
var interRegionPaddingBp = self.interRegionPaddingWidth * self.bpPerPx;
|
|
1345
1367
|
var minimumBlockBp = self.minimumBlockWidth * self.bpPerPx;
|
|
@@ -1373,4 +1395,18 @@ function viewBpToPx(_ref3) {
|
|
|
1373
1395
|
}
|
|
1374
1396
|
|
|
1375
1397
|
return undefined;
|
|
1398
|
+
}
|
|
1399
|
+
|
|
1400
|
+
function getBpDisplayStr(totalBp) {
|
|
1401
|
+
var displayBp;
|
|
1402
|
+
|
|
1403
|
+
if (Math.floor(totalBp / 1000000) > 0) {
|
|
1404
|
+
displayBp = "".concat(parseFloat((totalBp / 1000000).toPrecision(3)), "Mbp");
|
|
1405
|
+
} else if (Math.floor(totalBp / 1000) > 0) {
|
|
1406
|
+
displayBp = "".concat(parseFloat((totalBp / 1000).toPrecision(3)), "Kbp");
|
|
1407
|
+
} else {
|
|
1408
|
+
displayBp = "".concat(Math.floor(totalBp), "bp");
|
|
1409
|
+
}
|
|
1410
|
+
|
|
1411
|
+
return displayBp;
|
|
1376
1412
|
}
|
package/util/index.test.js
CHANGED
|
@@ -68,7 +68,8 @@ describe('parseLocString', function () {
|
|
|
68
68
|
}], ['{hg19}chr1', {
|
|
69
69
|
assemblyName: 'hg19',
|
|
70
70
|
refName: 'chr1'
|
|
71
|
-
}]];
|
|
71
|
+
}]]; // test unreversed
|
|
72
|
+
|
|
72
73
|
cases.forEach(function (_ref) {
|
|
73
74
|
var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
|
|
74
75
|
input = _ref2[0],
|
|
@@ -76,8 +77,24 @@ describe('parseLocString', function () {
|
|
|
76
77
|
|
|
77
78
|
test("".concat(input), function () {
|
|
78
79
|
expect((0, _index.parseLocString)(input, function (refName) {
|
|
79
|
-
return
|
|
80
|
-
})).toEqual(output)
|
|
80
|
+
return ['chr1', 'chr2'].includes(refName);
|
|
81
|
+
})).toEqual(_objectSpread(_objectSpread({}, output), {}, {
|
|
82
|
+
reversed: false
|
|
83
|
+
}));
|
|
84
|
+
});
|
|
85
|
+
}); // test reversed
|
|
86
|
+
|
|
87
|
+
cases.forEach(function (_ref3) {
|
|
88
|
+
var _ref4 = (0, _slicedToArray2.default)(_ref3, 2),
|
|
89
|
+
input = _ref4[0],
|
|
90
|
+
output = _ref4[1];
|
|
91
|
+
|
|
92
|
+
test("".concat(input), function () {
|
|
93
|
+
expect((0, _index.parseLocString)(input + '[rev]', function (refName) {
|
|
94
|
+
return ['chr1', 'chr2'].includes(refName);
|
|
95
|
+
})).toEqual(_objectSpread(_objectSpread({}, output), {}, {
|
|
96
|
+
reversed: true
|
|
97
|
+
}));
|
|
81
98
|
});
|
|
82
99
|
});
|
|
83
100
|
});
|
|
@@ -117,10 +134,10 @@ describe('assembleLocString', function () {
|
|
|
117
134
|
end: -1,
|
|
118
135
|
refName: 'chr1'
|
|
119
136
|
}, 'chr1:-99..-1']];
|
|
120
|
-
cases.forEach(function (
|
|
121
|
-
var
|
|
122
|
-
input =
|
|
123
|
-
output =
|
|
137
|
+
cases.forEach(function (_ref5) {
|
|
138
|
+
var _ref6 = (0, _slicedToArray2.default)(_ref5, 2),
|
|
139
|
+
input = _ref6[0],
|
|
140
|
+
output = _ref6[1];
|
|
124
141
|
|
|
125
142
|
test("assemble ".concat(output), function () {
|
|
126
143
|
expect((0, _index.assembleLocString)(input)).toEqual(output);
|
|
@@ -128,7 +145,9 @@ describe('assembleLocString', function () {
|
|
|
128
145
|
test("assemble and parse ".concat(output), function () {
|
|
129
146
|
expect((0, _index.parseLocString)((0, _index.assembleLocString)(input), function (refName) {
|
|
130
147
|
return refName === 'chr1' || refName === 'chr2';
|
|
131
|
-
})).toEqual(input)
|
|
148
|
+
})).toEqual(_objectSpread(_objectSpread({}, input), {}, {
|
|
149
|
+
reversed: false
|
|
150
|
+
}));
|
|
132
151
|
});
|
|
133
152
|
}); // Special case since undefined `start` will result in `start` being assumed
|
|
134
153
|
// to be `0`
|
|
@@ -152,17 +171,19 @@ describe('assembleLocString', function () {
|
|
|
152
171
|
expect((0, _index.parseLocString)((0, _index.assembleLocString)(location), function (refName) {
|
|
153
172
|
return refName === 'chr1' || refName === 'chr2';
|
|
154
173
|
})).toEqual(_objectSpread(_objectSpread({}, location), {}, {
|
|
155
|
-
start: 0
|
|
174
|
+
start: 0,
|
|
175
|
+
reversed: false,
|
|
176
|
+
assemblyName: undefined
|
|
156
177
|
}));
|
|
157
178
|
});
|
|
158
179
|
});
|
|
159
180
|
describe('compareLocStrings', function () {
|
|
160
181
|
var cases = [['chr1:1..200', 'chr1:1-200', 0], ['chr1:1-200', '{hg19}chr1:1-200', -1], ['{hg19}chr1:1-200', 'chr1:1-200', 1], ['{hg19}chr1:1-200', '{hg19}chr1:2-200', -1]];
|
|
161
|
-
cases.forEach(function (
|
|
162
|
-
var
|
|
163
|
-
input1 =
|
|
164
|
-
input2 =
|
|
165
|
-
output =
|
|
182
|
+
cases.forEach(function (_ref7) {
|
|
183
|
+
var _ref8 = (0, _slicedToArray2.default)(_ref7, 3),
|
|
184
|
+
input1 = _ref8[0],
|
|
185
|
+
input2 = _ref8[1],
|
|
186
|
+
output = _ref8[2];
|
|
166
187
|
|
|
167
188
|
test("".concat(input1, " ").concat(input2, " = ").concat(output), function () {
|
|
168
189
|
expect((0, _index.compareLocStrings)(input1, input2, function (refName) {
|
package/util/io/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { GenericFilehandle } from 'generic-filehandle';
|
|
1
|
+
import { GenericFilehandle, Fetcher } from 'generic-filehandle';
|
|
2
2
|
import { RemoteFileWithRangeCache } from './RemoteFileWithRangeCache';
|
|
3
3
|
import { FileLocation } from '../types';
|
|
4
4
|
import PluginManager from '../../PluginManager';
|
|
5
5
|
export { RemoteFileWithRangeCache };
|
|
6
6
|
export declare function openLocation(location: FileLocation, pluginManager?: PluginManager): GenericFilehandle;
|
|
7
|
+
export declare function getFetcher(location: FileLocation, pluginManager: PluginManager): Fetcher;
|
package/util/io/index.js
CHANGED
|
@@ -11,12 +11,15 @@ Object.defineProperty(exports, "RemoteFileWithRangeCache", {
|
|
|
11
11
|
return _RemoteFileWithRangeCache.RemoteFileWithRangeCache;
|
|
12
12
|
}
|
|
13
13
|
});
|
|
14
|
+
exports.getFetcher = getFetcher;
|
|
14
15
|
exports.openLocation = openLocation;
|
|
15
16
|
|
|
16
17
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
17
18
|
|
|
18
19
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
19
20
|
|
|
21
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
22
|
+
|
|
20
23
|
var _genericFilehandle = require("generic-filehandle");
|
|
21
24
|
|
|
22
25
|
var _RemoteFileWithRangeCache = require("./RemoteFileWithRangeCache");
|
|
@@ -27,6 +30,10 @@ var _tracks = require("../tracks");
|
|
|
27
30
|
|
|
28
31
|
var _detectNode = _interopRequireDefault(require("detect-node"));
|
|
29
32
|
|
|
33
|
+
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
|
+
|
|
35
|
+
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; }
|
|
36
|
+
|
|
30
37
|
function isLocalPathLocation(location) {
|
|
31
38
|
return 'localPath' in location;
|
|
32
39
|
}
|
|
@@ -36,50 +43,6 @@ function isBlobLocation(location) {
|
|
|
36
43
|
}
|
|
37
44
|
|
|
38
45
|
function openLocation(location, pluginManager) {
|
|
39
|
-
function checkAuthNeededFetch(_x, _x2) {
|
|
40
|
-
return _checkAuthNeededFetch.apply(this, arguments);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function _checkAuthNeededFetch() {
|
|
44
|
-
_checkAuthNeededFetch = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(url, opts) {
|
|
45
|
-
var response, authHeaders;
|
|
46
|
-
return _regenerator.default.wrap(function _callee$(_context) {
|
|
47
|
-
while (1) {
|
|
48
|
-
switch (_context.prev = _context.next) {
|
|
49
|
-
case 0:
|
|
50
|
-
_context.next = 2;
|
|
51
|
-
return fetch(url, opts);
|
|
52
|
-
|
|
53
|
-
case 2:
|
|
54
|
-
response = _context.sent;
|
|
55
|
-
|
|
56
|
-
if (!(response.status === 401)) {
|
|
57
|
-
_context.next = 7;
|
|
58
|
-
break;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
authHeaders = response.headers.get('WWW-Authenticate');
|
|
62
|
-
|
|
63
|
-
if (!((0, _types.isUriLocation)(location) && authHeaders && authHeaders.includes('Basic'))) {
|
|
64
|
-
_context.next = 7;
|
|
65
|
-
break;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
throw new _types.AuthNeededError('Accessing HTTPBasic resource without authentication', location);
|
|
69
|
-
|
|
70
|
-
case 7:
|
|
71
|
-
return _context.abrupt("return", response);
|
|
72
|
-
|
|
73
|
-
case 8:
|
|
74
|
-
case "end":
|
|
75
|
-
return _context.stop();
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}, _callee);
|
|
79
|
-
}));
|
|
80
|
-
return _checkAuthNeededFetch.apply(this, arguments);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
46
|
if (!location) {
|
|
84
47
|
throw new Error('must provide a location to openLocation');
|
|
85
48
|
}
|
|
@@ -108,66 +71,114 @@ function openLocation(location, pluginManager) {
|
|
|
108
71
|
}
|
|
109
72
|
|
|
110
73
|
if ((0, _types.isUriLocation)(location)) {
|
|
74
|
+
// Check for empty string
|
|
111
75
|
if (!location.uri) {
|
|
112
76
|
throw new Error('No URI provided');
|
|
113
|
-
}
|
|
77
|
+
} // Resolve any relative URLs to absolute URLs
|
|
114
78
|
|
|
115
|
-
if (location.internetAccountPreAuthorization) {
|
|
116
|
-
if (!pluginManager) {
|
|
117
|
-
throw new Error('need plugin manager to open locations with an internet account');
|
|
118
|
-
}
|
|
119
79
|
|
|
120
|
-
|
|
80
|
+
var absoluteLocation = location.baseUri ? _objectSpread(_objectSpread({}, location), {}, {
|
|
81
|
+
uri: new URL(location.uri, location.baseUri).href
|
|
82
|
+
}) : location; // If there is a plugin manager, we can try internet accounts
|
|
83
|
+
|
|
84
|
+
if (pluginManager) {
|
|
85
|
+
var internetAccount = getInternetAccount(location, pluginManager); // If an internetAccount was found, use it to open the location
|
|
121
86
|
|
|
122
|
-
if (
|
|
123
|
-
|
|
87
|
+
if (internetAccount) {
|
|
88
|
+
return internetAccount.openLocation(absoluteLocation);
|
|
124
89
|
}
|
|
90
|
+
} // Otherwise fall back on usual open
|
|
125
91
|
|
|
126
|
-
var internetAccount;
|
|
127
92
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
internetAccount = internetAccountType.stateModel.create({
|
|
133
|
-
type: location.internetAccountPreAuthorization.internetAccountType,
|
|
134
|
-
configuration: location.internetAccountPreAuthorization.authInfo.configuration
|
|
135
|
-
});
|
|
93
|
+
return new _RemoteFileWithRangeCache.RemoteFileWithRangeCache(absoluteLocation.uri, {
|
|
94
|
+
fetch: checkAuthNeededFetch
|
|
95
|
+
});
|
|
96
|
+
}
|
|
136
97
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
}
|
|
140
|
-
}
|
|
98
|
+
throw new Error('invalid fileLocation');
|
|
99
|
+
}
|
|
141
100
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
101
|
+
function getFetcher(location, pluginManager) {
|
|
102
|
+
if (!(0, _types.isUriLocation)(location)) {
|
|
103
|
+
throw new Error("Not a valid UriLocation: ".concat(JSON.stringify(location)));
|
|
104
|
+
}
|
|
145
105
|
|
|
146
|
-
|
|
147
|
-
} else if (pluginManager) {
|
|
148
|
-
var _rootModel = pluginManager.rootModel;
|
|
106
|
+
var internetAccount = getInternetAccount(location, pluginManager);
|
|
149
107
|
|
|
150
|
-
|
|
151
|
-
|
|
108
|
+
if (internetAccount) {
|
|
109
|
+
return internetAccount.getFetcher(location);
|
|
110
|
+
}
|
|
152
111
|
|
|
153
|
-
|
|
112
|
+
return checkAuthNeededFetch;
|
|
113
|
+
}
|
|
154
114
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
function (preAuthInfo) {
|
|
158
|
-
return modifiedLocation.internetAccountPreAuthorization = preAuthInfo;
|
|
159
|
-
});
|
|
115
|
+
function getInternetAccount(location, pluginManager) {
|
|
116
|
+
var rootModel = pluginManager.rootModel; // If there is an appRootModel, use it to find the internetAccount
|
|
160
117
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
118
|
+
if (rootModel && (0, _types.isAppRootModel)(rootModel)) {
|
|
119
|
+
return rootModel.findAppropriateInternetAccount(location);
|
|
120
|
+
} // If there is no appRootModel, but there is pre-auth, create a temporary
|
|
121
|
+
// internetAccount. This is typical in a worker.
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
if (location.internetAccountPreAuthorization) {
|
|
125
|
+
if (!location.internetAccountPreAuthorization.authInfo.token) {
|
|
126
|
+
throw new Error('Failed to obtain token from internet account. Try reloading the page');
|
|
164
127
|
}
|
|
165
128
|
|
|
166
|
-
var
|
|
167
|
-
return
|
|
168
|
-
|
|
129
|
+
var internetAccountType = pluginManager.getInternetAccountType(location.internetAccountPreAuthorization.internetAccountType);
|
|
130
|
+
return internetAccountType.stateModel.create({
|
|
131
|
+
type: location.internetAccountPreAuthorization.internetAccountType,
|
|
132
|
+
configuration: location.internetAccountPreAuthorization.authInfo.configuration
|
|
169
133
|
});
|
|
170
134
|
}
|
|
171
135
|
|
|
172
|
-
|
|
136
|
+
return;
|
|
137
|
+
} // This fetch throws a special error if the response is "401" and includes a
|
|
138
|
+
// "WWW-Authenticate: Basic" header. This is so downstream code can retry if
|
|
139
|
+
// needed with HTTP Basic authentication included
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
function checkAuthNeededFetch(_x, _x2) {
|
|
143
|
+
return _checkAuthNeededFetch.apply(this, arguments);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function _checkAuthNeededFetch() {
|
|
147
|
+
_checkAuthNeededFetch = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(url, opts) {
|
|
148
|
+
var response, authHeaders;
|
|
149
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
150
|
+
while (1) {
|
|
151
|
+
switch (_context.prev = _context.next) {
|
|
152
|
+
case 0:
|
|
153
|
+
_context.next = 2;
|
|
154
|
+
return fetch(url, opts);
|
|
155
|
+
|
|
156
|
+
case 2:
|
|
157
|
+
response = _context.sent;
|
|
158
|
+
|
|
159
|
+
if (!(response.status === 401)) {
|
|
160
|
+
_context.next = 7;
|
|
161
|
+
break;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
authHeaders = response.headers.get('WWW-Authenticate');
|
|
165
|
+
|
|
166
|
+
if (!(authHeaders && authHeaders.includes('Basic'))) {
|
|
167
|
+
_context.next = 7;
|
|
168
|
+
break;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
throw new _types.AuthNeededError('Accessing HTTPBasic resource without authentication', url.toString());
|
|
172
|
+
|
|
173
|
+
case 7:
|
|
174
|
+
return _context.abrupt("return", response);
|
|
175
|
+
|
|
176
|
+
case 8:
|
|
177
|
+
case "end":
|
|
178
|
+
return _context.stop();
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}, _callee);
|
|
182
|
+
}));
|
|
183
|
+
return _checkAuthNeededFetch.apply(this, arguments);
|
|
173
184
|
}
|
|
@@ -264,14 +264,14 @@ var PonyfillOffscreenContext = /*#__PURE__*/function () {
|
|
|
264
264
|
var x = args[0],
|
|
265
265
|
y = args[1],
|
|
266
266
|
w = args[2],
|
|
267
|
-
h = args[3];
|
|
267
|
+
h = args[3]; // avoid rendering offscreen contents
|
|
268
268
|
|
|
269
269
|
if (x > this.width || x + w < 0) {
|
|
270
270
|
return;
|
|
271
271
|
}
|
|
272
272
|
|
|
273
273
|
var nx = Math.max(x, 0);
|
|
274
|
-
var nw =
|
|
274
|
+
var nw = w - (nx - x);
|
|
275
275
|
this.commands.push({
|
|
276
276
|
type: 'fillRect',
|
|
277
277
|
args: [nx, y, nw, h]
|
package/util/simpleFeature.d.ts
CHANGED
|
@@ -6,6 +6,10 @@ export interface Feature {
|
|
|
6
6
|
* Get a piece of data about the feature. All features must have
|
|
7
7
|
* 'start' and 'end', but everything else is optional.
|
|
8
8
|
*/
|
|
9
|
+
get(name: 'refName'): string;
|
|
10
|
+
get(name: 'start'): number;
|
|
11
|
+
get(name: 'end'): number;
|
|
12
|
+
get(name: 'subfeatures'): Feature[] | undefined;
|
|
9
13
|
get(name: string): any;
|
|
10
14
|
/**
|
|
11
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
|
|
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);
|
package/util/types/index.d.ts
CHANGED
|
@@ -186,8 +186,8 @@ export interface UriLocation extends SnapshotIn<typeof MUUriLocation> {
|
|
|
186
186
|
export declare function isUriLocation(location: unknown): location is UriLocation;
|
|
187
187
|
export declare class AuthNeededError extends Error {
|
|
188
188
|
message: string;
|
|
189
|
-
|
|
190
|
-
constructor(message: string,
|
|
189
|
+
url: string;
|
|
190
|
+
constructor(message: string, url: string);
|
|
191
191
|
}
|
|
192
192
|
export declare class RetryError extends Error {
|
|
193
193
|
message: string;
|
package/util/types/index.js
CHANGED
|
@@ -158,13 +158,13 @@ var AuthNeededError = /*#__PURE__*/function (_Error) {
|
|
|
158
158
|
|
|
159
159
|
var _super = _createSuper(AuthNeededError);
|
|
160
160
|
|
|
161
|
-
function AuthNeededError(message,
|
|
161
|
+
function AuthNeededError(message, url) {
|
|
162
162
|
var _this;
|
|
163
163
|
|
|
164
164
|
(0, _classCallCheck2.default)(this, AuthNeededError);
|
|
165
165
|
_this = _super.call(this, message);
|
|
166
166
|
_this.message = message;
|
|
167
|
-
_this.
|
|
167
|
+
_this.url = url;
|
|
168
168
|
_this.name = 'AuthNeededError';
|
|
169
169
|
Object.setPrototypeOf((0, _assertThisInitialized2.default)(_this), AuthNeededError.prototype);
|
|
170
170
|
return _this;
|
|
@@ -198,7 +198,7 @@ exports.RetryError = RetryError;
|
|
|
198
198
|
|
|
199
199
|
function isAuthNeededException(exception) {
|
|
200
200
|
return exception instanceof Error && ( // DOMException
|
|
201
|
-
exception.name === 'AuthNeededError' || exception.
|
|
201
|
+
exception.name === 'AuthNeededError' || exception.url !== undefined);
|
|
202
202
|
}
|
|
203
203
|
|
|
204
204
|
function isRetryException(exception) {
|