@jbrowse/core 1.6.5 → 1.6.6
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 +2 -0
- package/ReExports/modules.d.ts +2 -0
- package/TextSearch/TextSearchManager.d.ts +2 -2
- package/assemblyManager/assemblyConfigSchema.d.ts +1 -1
- package/assemblyManager/assemblyManager.d.ts +1 -1
- package/configuration/index.d.ts +1 -1
- package/data_adapters/BaseAdapter.d.ts +2 -1
- package/data_adapters/BaseAdapter.js +20 -2
- 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/rpc/BaseRpcDriver.d.ts +4 -4
- package/rpc/BaseRpcDriver.js +152 -79
- 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/WebWorkerRpcDriver.d.ts +1 -1
- package/rpc/WebWorkerRpcDriver.js +43 -11
- package/rpc/configSchema.d.ts +1 -1
- 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 +2 -0
- package/util/index.js +45 -10
- 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 +3 -0
- package/util/types/index.d.ts +2 -2
- package/util/types/index.js +3 -3
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,9 @@ 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;
|
|
9
12
|
get(name: string): any;
|
|
10
13
|
/**
|
|
11
14
|
* Set an item of data.
|
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) {
|