@jbrowse/core 2.0.0 → 2.1.2
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.d.ts +9 -3
- package/BaseFeatureWidget/BaseFeatureDetail.js +313 -581
- package/BaseFeatureWidget/SequenceFeatureDetails.js +213 -478
- package/BaseFeatureWidget/index.js +88 -126
- package/BaseFeatureWidget/types.d.ts +1 -0
- package/BaseFeatureWidget/types.js +1 -4
- package/BaseFeatureWidget/util.js +40 -75
- package/CorePlugin.js +55 -94
- package/Plugin.js +9 -34
- package/PluginLoader.js +153 -422
- package/PluginManager.d.ts +28 -33
- package/PluginManager.js +377 -666
- package/ReExports/Attributes.js +3 -10
- package/ReExports/BaseCard.js +3 -10
- package/ReExports/DataGrid.js +5 -12
- package/ReExports/FeatureDetails.js +3 -10
- package/ReExports/index.js +6 -12
- package/ReExports/list.d.ts +5 -0
- package/ReExports/list.js +271 -7
- package/ReExports/material-ui-colors.js +15 -16
- package/ReExports/modules.d.ts +11 -20
- package/ReExports/modules.js +453 -798
- package/TextSearch/BaseResults.js +51 -123
- package/TextSearch/TextSearchManager.js +66 -144
- package/assemblyManager/assembly.js +280 -555
- package/assemblyManager/assemblyConfigSchema.js +47 -64
- package/assemblyManager/assemblyManager.js +126 -272
- package/assemblyManager/index.js +9 -22
- package/configuration/configurationSchema.js +167 -203
- package/configuration/configurationSlot.js +248 -326
- package/configuration/index.js +19 -35
- package/configuration/util.js +131 -173
- package/data_adapters/BaseAdapter.d.ts +2 -2
- package/data_adapters/BaseAdapter.js +132 -521
- package/data_adapters/CytobandAdapter.js +40 -126
- package/data_adapters/dataAdapterCache.js +77 -158
- package/package.json +4 -5
- package/pluggableElementTypes/AdapterType.js +24 -79
- package/pluggableElementTypes/AddTrackWorkflowType.d.ts +17 -0
- package/pluggableElementTypes/AddTrackWorkflowType.js +20 -0
- package/pluggableElementTypes/ConnectionType.js +22 -65
- package/pluggableElementTypes/DisplayType.js +35 -82
- package/pluggableElementTypes/InternetAccountType.js +23 -64
- package/pluggableElementTypes/PluggableElementBase.js +8 -20
- package/pluggableElementTypes/RpcMethodType.js +85 -427
- package/pluggableElementTypes/TextSearchAdapterType.js +16 -55
- package/pluggableElementTypes/TrackType.js +26 -70
- package/pluggableElementTypes/ViewType.js +21 -63
- package/pluggableElementTypes/WidgetType.js +21 -64
- package/pluggableElementTypes/index.d.ts +4 -3
- package/pluggableElementTypes/index.js +42 -125
- package/pluggableElementTypes/models/BaseConnectionModelFactory.js +28 -43
- package/pluggableElementTypes/models/BaseDisplayModel.js +58 -95
- package/pluggableElementTypes/models/BaseTrackModel.js +139 -199
- package/pluggableElementTypes/models/BaseViewModel.js +24 -40
- package/pluggableElementTypes/models/InternetAccountModel.js +116 -263
- package/pluggableElementTypes/models/baseConnectionConfig.js +14 -25
- package/pluggableElementTypes/models/baseInternetAccountConfig.js +29 -38
- package/pluggableElementTypes/models/baseTrackConfig.js +106 -133
- package/pluggableElementTypes/models/index.js +21 -70
- package/pluggableElementTypes/renderers/BoxRendererType.js +132 -291
- package/pluggableElementTypes/renderers/CircularChordRendererType.js +8 -38
- package/pluggableElementTypes/renderers/ComparativeServerSideRendererType.js +60 -192
- package/pluggableElementTypes/renderers/FeatureRendererType.d.ts +0 -2
- package/pluggableElementTypes/renderers/FeatureRendererType.js +89 -255
- package/pluggableElementTypes/renderers/RendererType.js +31 -105
- package/pluggableElementTypes/renderers/ServerSideRenderedContent.js +61 -72
- package/pluggableElementTypes/renderers/ServerSideRendererType.js +112 -265
- package/pluggableElementTypes/renderers/index.js +19 -62
- package/pluggableElementTypes/renderers/util/serializableFilterChain.js +27 -65
- package/rpc/BaseRpcDriver.js +169 -405
- package/rpc/MainThreadRpcDriver.js +27 -150
- package/rpc/RpcManager.js +58 -159
- package/rpc/WebWorkerRpcDriver.js +54 -171
- package/rpc/configSchema.js +25 -49
- package/rpc/coreRpcMethods.d.ts +1 -3
- package/rpc/coreRpcMethods.js +221 -959
- package/rpc/remoteAbortSignals.js +46 -70
- package/tsconfig.build.tsbuildinfo +1 -1
- package/ui/AboutDialog.js +106 -162
- package/ui/App.js +157 -242
- package/ui/AssemblySelector.js +59 -120
- package/ui/CascadingMenu.js +101 -196
- package/ui/ColorPicker.d.ts +16 -0
- package/ui/ColorPicker.js +97 -0
- package/ui/Drawer.js +28 -61
- package/ui/DrawerWidget.js +108 -202
- package/ui/DropDownMenu.js +60 -91
- package/ui/EditableTypography.js +87 -149
- package/ui/ErrorMessage.js +41 -56
- package/ui/FactoryResetDialog.js +24 -57
- package/ui/FatalErrorDialog.js +59 -91
- package/ui/FileSelector/FileSelector.js +123 -189
- package/ui/FileSelector/LocalFileChooser.js +44 -75
- package/ui/FileSelector/UrlChooser.js +17 -38
- package/ui/FileSelector/index.js +6 -12
- package/ui/Icons.js +45 -69
- package/ui/Logo.js +57 -110
- package/ui/Menu.js +232 -354
- package/ui/PrerenderedCanvas.js +63 -87
- package/ui/ResizeHandle.js +87 -116
- package/ui/ReturnToImportFormDialog.js +32 -63
- package/ui/SanitizedHTML.js +64 -47
- package/ui/Snackbar.js +74 -101
- package/ui/SnackbarModel.js +37 -51
- package/ui/Tooltip.js +49 -76
- package/ui/ViewContainer.js +113 -196
- package/ui/colors.d.ts +10 -0
- package/ui/colors.js +78 -0
- package/ui/index.js +51 -181
- package/ui/react-colorful.d.ts +17 -0
- package/ui/react-colorful.js +455 -0
- package/ui/theme.d.ts +23 -1
- package/ui/theme.js +199 -247
- package/util/Base1DUtils.d.ts +32 -0
- package/util/Base1DUtils.js +174 -0
- package/util/Base1DViewModel.d.ts +16 -30
- package/util/Base1DViewModel.js +116 -293
- package/util/QuickLRU.js +84 -332
- package/util/TimeTraveller.d.ts +19 -0
- package/util/TimeTraveller.js +86 -0
- package/util/aborting.js +49 -127
- package/util/analytics.js +91 -154
- package/util/blockTypes.js +106 -240
- package/util/calculateDynamicBlocks.js +98 -128
- package/util/calculateStaticBlocks.js +105 -125
- package/util/color/cssColorsLevel4.js +156 -160
- package/util/color/index.js +33 -55
- package/util/compositeMap.js +49 -333
- package/util/formatFastaStrings.js +9 -14
- package/util/idMaker.js +18 -31
- package/util/index.d.ts +18 -32
- package/util/index.js +747 -1226
- package/util/io/RemoteFileWithRangeCache.js +88 -257
- package/util/io/index.js +95 -169
- package/util/jexl.js +60 -115
- package/util/jexlStrings.js +24 -29
- package/util/layouts/BaseLayout.js +1 -4
- package/util/layouts/GranularRectLayout.js +388 -555
- package/util/layouts/MultiLayout.js +41 -109
- package/util/layouts/PrecomputedLayout.js +56 -112
- package/util/layouts/PrecomputedMultiLayout.js +22 -59
- package/util/layouts/SceneGraph.js +127 -197
- package/util/layouts/index.js +29 -66
- package/util/mst-reflection.js +55 -71
- package/util/offscreenCanvasPonyfill.js +66 -134
- package/util/offscreenCanvasUtils.d.ts +2 -7
- package/util/offscreenCanvasUtils.js +49 -146
- package/util/range.js +29 -40
- package/util/rxjs.js +20 -27
- package/util/simpleFeature.js +88 -152
- package/util/stats.js +91 -151
- package/util/tracks.js +130 -173
- package/util/types/index.js +110 -179
- package/util/types/mst.js +91 -146
- package/util/types/util.js +1 -4
- package/util/when.js +54 -101
- package/BaseFeatureWidget/SequenceFeatureDetails.test.js +0 -122
- package/BaseFeatureWidget/index.test.js +0 -69
- package/TextSearch/BaseResults.test.js +0 -42
- package/configuration/configurationSchema.test.js +0 -266
- package/configuration/configurationSlot.test.js +0 -69
- package/configuration/util.test.js +0 -39
- package/data_adapters/BaseAdapter.test.js +0 -200
- package/declare.d.js +0 -1
- package/pluggableElementTypes/RpcMethodType.test.js +0 -118
- package/pluggableElementTypes/renderers/declare.d.js +0 -1
- package/pluggableElementTypes/renderers/util/serializableFilterChain.test.js +0 -20
- package/rpc/BaseRpcDriver.test.js +0 -540
- package/rpc/declaration.d.js +0 -1
- package/ui/FatalErrorDialog.test.js +0 -82
- package/ui/SanitizedHTML.test.js +0 -36
- package/ui/theme.test.js +0 -92
- package/util/Base1DViewModel.test.js +0 -130
- package/util/calculateDynamicBlocks.test.js +0 -74
- package/util/calculateStaticBlocks.test.js +0 -297
- package/util/declare.d.js +0 -1
- package/util/formatFastaStrings.test.js +0 -40
- package/util/index.test.js +0 -213
- package/util/jexlStrings.test.js +0 -48
- package/util/layouts/GranularRectLayout.test.js +0 -99
- package/util/range.test.js +0 -64
- package/util/simpleFeature.test.js +0 -34
- package/util/stats.test.js +0 -172
|
@@ -1,127 +1,91 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
3
|
exports.InternetAccount = void 0;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
var _io = require("../../util/io");
|
|
21
|
-
|
|
22
|
-
var _mst = require("../../util/types/mst");
|
|
23
|
-
|
|
24
|
-
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; }
|
|
25
|
-
|
|
26
|
-
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; }
|
|
27
|
-
|
|
28
|
-
var inWebWorker = typeof sessionStorage === 'undefined';
|
|
29
|
-
|
|
30
|
-
var InternetAccount = _mobxStateTree.types.model('InternetAccount', {
|
|
31
|
-
id: _mst.ElementId,
|
|
32
|
-
type: _mobxStateTree.types.string
|
|
33
|
-
}).views(function (self) {
|
|
34
|
-
return {
|
|
4
|
+
const mobx_state_tree_1 = require("mobx-state-tree");
|
|
5
|
+
const configuration_1 = require("../../configuration");
|
|
6
|
+
const io_1 = require("../../util/io");
|
|
7
|
+
const mst_1 = require("../../util/types/mst");
|
|
8
|
+
const inWebWorker = typeof sessionStorage === 'undefined';
|
|
9
|
+
exports.InternetAccount = mobx_state_tree_1.types
|
|
10
|
+
.model('InternetAccount', {
|
|
11
|
+
id: mst_1.ElementId,
|
|
12
|
+
type: mobx_state_tree_1.types.string,
|
|
13
|
+
})
|
|
14
|
+
.views(self => ({
|
|
35
15
|
get name() {
|
|
36
|
-
|
|
16
|
+
return (0, configuration_1.getConf)(self, 'name');
|
|
37
17
|
},
|
|
38
|
-
|
|
39
18
|
get description() {
|
|
40
|
-
|
|
19
|
+
return (0, configuration_1.getConf)(self, 'description');
|
|
41
20
|
},
|
|
42
|
-
|
|
43
21
|
get internetAccountId() {
|
|
44
|
-
|
|
22
|
+
return (0, configuration_1.getConf)(self, 'internetAccountId');
|
|
45
23
|
},
|
|
46
|
-
|
|
47
24
|
get authHeader() {
|
|
48
|
-
|
|
25
|
+
return (0, configuration_1.getConf)(self, 'authHeader');
|
|
49
26
|
},
|
|
50
|
-
|
|
51
27
|
get tokenType() {
|
|
52
|
-
|
|
28
|
+
return (0, configuration_1.getConf)(self, 'tokenType');
|
|
53
29
|
},
|
|
54
|
-
|
|
55
30
|
get domains() {
|
|
56
|
-
|
|
31
|
+
return (0, configuration_1.getConf)(self, 'domains');
|
|
57
32
|
},
|
|
58
|
-
|
|
59
33
|
/**
|
|
60
34
|
* Can use this to customize what is displayed in fileSelector's toggle box
|
|
61
35
|
*/
|
|
62
36
|
get toggleContents() {
|
|
63
|
-
|
|
37
|
+
return null;
|
|
64
38
|
},
|
|
65
|
-
|
|
66
39
|
/**
|
|
67
40
|
* Can use this to customize what the fileSelector. It takes a prop called
|
|
68
41
|
* `setLocation` that should be used to set a UriLocation
|
|
69
42
|
*/
|
|
70
43
|
get SelectorComponent() {
|
|
71
|
-
|
|
44
|
+
return undefined;
|
|
72
45
|
},
|
|
73
|
-
|
|
74
46
|
/**
|
|
75
47
|
* Can use this to add a label to the UrlChooser. Has no effect if a custom
|
|
76
48
|
* SelectorComponent is supplied
|
|
77
49
|
*/
|
|
78
50
|
get selectorLabel() {
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}).views(function (self) {
|
|
84
|
-
return {
|
|
51
|
+
return undefined;
|
|
52
|
+
},
|
|
53
|
+
}))
|
|
54
|
+
.views(self => ({
|
|
85
55
|
/**
|
|
86
56
|
* Determine whether this internetAccount provides credentials for a URL
|
|
87
57
|
* @param location - UriLocation of resource
|
|
88
58
|
* @returns true or false
|
|
89
59
|
*/
|
|
90
|
-
handlesLocation
|
|
91
|
-
|
|
92
|
-
return location === null || location === void 0 ? void 0 : location.uri.includes(domain);
|
|
93
|
-
});
|
|
60
|
+
handlesLocation(location) {
|
|
61
|
+
return self.domains.some((domain) => location === null || location === void 0 ? void 0 : location.uri.includes(domain));
|
|
94
62
|
},
|
|
95
|
-
|
|
96
63
|
/**
|
|
97
64
|
* The key used to store this internetAccount's token in sessionStorage
|
|
98
65
|
*/
|
|
99
66
|
get tokenKey() {
|
|
100
|
-
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}).actions(function (self) {
|
|
105
|
-
return {
|
|
67
|
+
return `${self.internetAccountId}-token`;
|
|
68
|
+
},
|
|
69
|
+
}))
|
|
70
|
+
.actions(self => ({
|
|
106
71
|
/**
|
|
107
72
|
* Must be implemented by a model extending or composing this one. Pass the
|
|
108
73
|
* user's token to `resolve`.
|
|
109
74
|
* @param resolve - Pass the token to this function
|
|
110
75
|
* @param reject - If there is an error getting the token, call this function
|
|
111
76
|
*/
|
|
112
|
-
getTokenFromUser
|
|
113
|
-
|
|
77
|
+
getTokenFromUser(resolve, reject) {
|
|
78
|
+
throw new Error('getTokenFromUser must be implemented by extending model');
|
|
114
79
|
},
|
|
115
|
-
storeToken
|
|
116
|
-
|
|
80
|
+
storeToken(token) {
|
|
81
|
+
sessionStorage.setItem(self.tokenKey, token);
|
|
117
82
|
},
|
|
118
|
-
removeToken
|
|
119
|
-
|
|
83
|
+
removeToken() {
|
|
84
|
+
sessionStorage.removeItem(self.tokenKey);
|
|
120
85
|
},
|
|
121
|
-
retrieveToken
|
|
122
|
-
|
|
86
|
+
retrieveToken() {
|
|
87
|
+
return sessionStorage.getItem(self.tokenKey);
|
|
123
88
|
},
|
|
124
|
-
|
|
125
89
|
/**
|
|
126
90
|
* This can be used by an internetAccount to validate a token works before
|
|
127
91
|
* it is used. This is run when preAuthorizationInformation is requested, so
|
|
@@ -134,170 +98,85 @@ var InternetAccount = _mobxStateTree.types.model('InternetAccount', {
|
|
|
134
98
|
* @param location - UriLocation of the resource
|
|
135
99
|
* @returns - Valid auth token
|
|
136
100
|
*/
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
101
|
+
async validateToken(token, location) {
|
|
102
|
+
return token;
|
|
103
|
+
},
|
|
104
|
+
}))
|
|
105
|
+
.actions(self => {
|
|
106
|
+
let tokenPromise = undefined;
|
|
107
|
+
return {
|
|
108
|
+
/**
|
|
109
|
+
* Try to get the token from the location pre-auth, from local storage,
|
|
110
|
+
* or from a previously cached promise. If token is not available, uses
|
|
111
|
+
* `getTokenFromUser`.
|
|
112
|
+
* @param location - UriLocation of the resource
|
|
113
|
+
* @returns A promise for the token
|
|
114
|
+
*/
|
|
115
|
+
async getToken(location) {
|
|
116
|
+
var _a, _b;
|
|
117
|
+
if (tokenPromise) {
|
|
118
|
+
return tokenPromise;
|
|
148
119
|
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
}))();
|
|
152
|
-
}
|
|
153
|
-
};
|
|
154
|
-
}).actions(function (self) {
|
|
155
|
-
var tokenPromise = undefined;
|
|
156
|
-
return {
|
|
157
|
-
/**
|
|
158
|
-
* Try to get the token from the location pre-auth, from local storage,
|
|
159
|
-
* or from a previously cached promise. If token is not available, uses
|
|
160
|
-
* `getTokenFromUser`.
|
|
161
|
-
* @param location - UriLocation of the resource
|
|
162
|
-
* @returns A promise for the token
|
|
163
|
-
*/
|
|
164
|
-
getToken: function getToken(location) {
|
|
165
|
-
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
166
|
-
var _location$internetAcc, _location$internetAcc2;
|
|
167
|
-
|
|
168
|
-
var token;
|
|
169
|
-
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
170
|
-
while (1) {
|
|
171
|
-
switch (_context2.prev = _context2.next) {
|
|
172
|
-
case 0:
|
|
173
|
-
if (!tokenPromise) {
|
|
174
|
-
_context2.next = 2;
|
|
175
|
-
break;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
return _context2.abrupt("return", tokenPromise);
|
|
179
|
-
|
|
180
|
-
case 2:
|
|
181
|
-
token = location === null || location === void 0 ? void 0 : (_location$internetAcc = location.internetAccountPreAuthorization) === null || _location$internetAcc === void 0 ? void 0 : (_location$internetAcc2 = _location$internetAcc.authInfo) === null || _location$internetAcc2 === void 0 ? void 0 : _location$internetAcc2.token;
|
|
182
|
-
|
|
183
|
-
if (!token) {
|
|
184
|
-
_context2.next = 6;
|
|
185
|
-
break;
|
|
186
|
-
}
|
|
187
|
-
|
|
120
|
+
let token = (_b = (_a = location === null || location === void 0 ? void 0 : location.internetAccountPreAuthorization) === null || _a === void 0 ? void 0 : _a.authInfo) === null || _b === void 0 ? void 0 : _b.token;
|
|
121
|
+
if (token) {
|
|
188
122
|
tokenPromise = Promise.resolve(token);
|
|
189
|
-
return
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
if (!inWebWorker) {
|
|
193
|
-
_context2.next = 8;
|
|
194
|
-
break;
|
|
195
|
-
}
|
|
196
|
-
|
|
123
|
+
return tokenPromise;
|
|
124
|
+
}
|
|
125
|
+
if (inWebWorker) {
|
|
197
126
|
throw new Error('Did not get internet account pre-authorization info in worker');
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
if (!token) {
|
|
203
|
-
_context2.next = 12;
|
|
204
|
-
break;
|
|
205
|
-
}
|
|
206
|
-
|
|
127
|
+
}
|
|
128
|
+
token = self.retrieveToken();
|
|
129
|
+
if (token) {
|
|
207
130
|
tokenPromise = Promise.resolve(token);
|
|
208
|
-
return
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
function resolve(token) {
|
|
131
|
+
return tokenPromise;
|
|
132
|
+
}
|
|
133
|
+
tokenPromise = new Promise((r, x) => {
|
|
134
|
+
function resolve(token) {
|
|
213
135
|
self.storeToken(token);
|
|
214
136
|
r(token);
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
function reject(error) {
|
|
137
|
+
}
|
|
138
|
+
function reject(error) {
|
|
218
139
|
self.removeToken();
|
|
219
140
|
x(error);
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
}).actions(function (self) {
|
|
236
|
-
return {
|
|
237
|
-
addAuthHeaderToInit: function addAuthHeaderToInit() {
|
|
238
|
-
var init = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
239
|
-
var token = arguments.length > 1 ? arguments[1] : undefined;
|
|
240
|
-
var tokenInfoString = self.tokenType ? "".concat(self.tokenType, " ").concat(token) : token;
|
|
241
|
-
var newHeaders = new Headers(init.headers || {});
|
|
242
|
-
newHeaders.append(self.authHeader, tokenInfoString);
|
|
243
|
-
return _objectSpread(_objectSpread({}, init), {}, {
|
|
244
|
-
headers: newHeaders
|
|
245
|
-
});
|
|
141
|
+
}
|
|
142
|
+
self.getTokenFromUser(resolve, reject);
|
|
143
|
+
});
|
|
144
|
+
return tokenPromise;
|
|
145
|
+
},
|
|
146
|
+
};
|
|
147
|
+
})
|
|
148
|
+
.actions(self => ({
|
|
149
|
+
addAuthHeaderToInit(init = {}, token) {
|
|
150
|
+
const tokenInfoString = self.tokenType
|
|
151
|
+
? `${self.tokenType} ${token}`
|
|
152
|
+
: token;
|
|
153
|
+
const newHeaders = new Headers(init.headers || {});
|
|
154
|
+
newHeaders.append(self.authHeader, tokenInfoString);
|
|
155
|
+
return { ...init, headers: newHeaders };
|
|
246
156
|
},
|
|
247
|
-
|
|
248
157
|
/**
|
|
249
158
|
* Gets the token and returns it along with the information needed to
|
|
250
159
|
* create a new internetAccount.
|
|
251
160
|
* @param location - UriLocation of the resource
|
|
252
161
|
* @returns
|
|
253
162
|
*/
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
validatedToken = _context3.sent;
|
|
272
|
-
_context3.next = 13;
|
|
273
|
-
break;
|
|
274
|
-
|
|
275
|
-
case 9:
|
|
276
|
-
_context3.prev = 9;
|
|
277
|
-
_context3.t0 = _context3["catch"](3);
|
|
278
|
-
self.removeToken();
|
|
279
|
-
throw _context3.t0;
|
|
280
|
-
|
|
281
|
-
case 13:
|
|
282
|
-
return _context3.abrupt("return", {
|
|
283
|
-
internetAccountType: self.type,
|
|
284
|
-
authInfo: {
|
|
285
|
-
token: validatedToken,
|
|
286
|
-
configuration: (0, _configuration.getConf)(self)
|
|
287
|
-
}
|
|
288
|
-
});
|
|
289
|
-
|
|
290
|
-
case 14:
|
|
291
|
-
case "end":
|
|
292
|
-
return _context3.stop();
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
}, _callee3, null, [[3, 9]]);
|
|
296
|
-
}))();
|
|
297
|
-
}
|
|
298
|
-
};
|
|
299
|
-
}).actions(function (self) {
|
|
300
|
-
return {
|
|
163
|
+
async getPreAuthorizationInformation(location) {
|
|
164
|
+
const authToken = await self.getToken(location);
|
|
165
|
+
let validatedToken;
|
|
166
|
+
try {
|
|
167
|
+
validatedToken = await self.validateToken(authToken, location);
|
|
168
|
+
}
|
|
169
|
+
catch (error) {
|
|
170
|
+
self.removeToken();
|
|
171
|
+
throw error;
|
|
172
|
+
}
|
|
173
|
+
return {
|
|
174
|
+
internetAccountType: self.type,
|
|
175
|
+
authInfo: { token: validatedToken, configuration: (0, configuration_1.getConf)(self) },
|
|
176
|
+
};
|
|
177
|
+
},
|
|
178
|
+
}))
|
|
179
|
+
.actions(self => ({
|
|
301
180
|
/**
|
|
302
181
|
* Get a fetch method that will add any needed authentication headers to
|
|
303
182
|
* the request before sending it. If location is provided, it will be
|
|
@@ -305,49 +184,23 @@ var InternetAccount = _mobxStateTree.types.model('InternetAccount', {
|
|
|
305
184
|
* @param location - UriLocation of the resource
|
|
306
185
|
* @returns A function that can be used to fetch
|
|
307
186
|
*/
|
|
308
|
-
getFetcher
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
while (1) {
|
|
314
|
-
switch (_context4.prev = _context4.next) {
|
|
315
|
-
case 0:
|
|
316
|
-
_context4.next = 2;
|
|
317
|
-
return self.getToken(location);
|
|
318
|
-
|
|
319
|
-
case 2:
|
|
320
|
-
authToken = _context4.sent;
|
|
321
|
-
newInit = self.addAuthHeaderToInit(init, authToken);
|
|
322
|
-
return _context4.abrupt("return", fetch(input, newInit));
|
|
323
|
-
|
|
324
|
-
case 5:
|
|
325
|
-
case "end":
|
|
326
|
-
return _context4.stop();
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
}, _callee4);
|
|
330
|
-
}));
|
|
331
|
-
|
|
332
|
-
return function (_x, _x2) {
|
|
333
|
-
return _ref.apply(this, arguments);
|
|
187
|
+
getFetcher(location) {
|
|
188
|
+
return async (input, init) => {
|
|
189
|
+
const authToken = await self.getToken(location);
|
|
190
|
+
const newInit = self.addAuthHeaderToInit(init, authToken);
|
|
191
|
+
return fetch(input, newInit);
|
|
334
192
|
};
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
}).actions(function (self) {
|
|
339
|
-
return {
|
|
193
|
+
},
|
|
194
|
+
}))
|
|
195
|
+
.actions(self => ({
|
|
340
196
|
/**
|
|
341
197
|
* Gets a filehandle that uses a fetch that adds auth headers
|
|
342
198
|
* @param location - UriLocation of the resource
|
|
343
199
|
* @returns A filehandle
|
|
344
200
|
*/
|
|
345
|
-
openLocation
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
});
|
|
352
|
-
|
|
353
|
-
exports.InternetAccount = InternetAccount;
|
|
201
|
+
openLocation(location) {
|
|
202
|
+
return new io_1.RemoteFileWithRangeCache(location.uri, {
|
|
203
|
+
fetch: self.getFetcher(location),
|
|
204
|
+
});
|
|
205
|
+
},
|
|
206
|
+
}));
|
|
@@ -1,26 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
assemblyNames: {
|
|
17
|
-
type: 'stringArray',
|
|
18
|
-
defaultValue: [],
|
|
19
|
-
description: 'optional list of names of assemblies in this connection'
|
|
20
|
-
}
|
|
21
|
-
}, {
|
|
22
|
-
explicitlyTyped: true,
|
|
23
|
-
explicitIdentifier: 'connectionId'
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
exports.default = _default;
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const configuration_1 = require("../../configuration");
|
|
4
|
+
exports.default = (0, configuration_1.ConfigurationSchema)('BaseConnection', {
|
|
5
|
+
name: {
|
|
6
|
+
type: 'string',
|
|
7
|
+
defaultValue: 'nameOfConnection',
|
|
8
|
+
description: 'a unique name for this connection',
|
|
9
|
+
},
|
|
10
|
+
assemblyNames: {
|
|
11
|
+
type: 'stringArray',
|
|
12
|
+
defaultValue: [],
|
|
13
|
+
description: 'optional list of names of assemblies in this connection',
|
|
14
|
+
},
|
|
15
|
+
}, { explicitlyTyped: true, explicitIdentifier: 'connectionId' });
|
|
@@ -1,40 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.BaseInternetAccountConfig = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
}, {
|
|
37
|
-
explicitIdentifier: 'internetAccountId',
|
|
38
|
-
explicitlyTyped: true
|
|
39
|
-
});
|
|
40
|
-
exports.BaseInternetAccountConfig = BaseInternetAccountConfig;
|
|
4
|
+
const configuration_1 = require("../../configuration");
|
|
5
|
+
exports.BaseInternetAccountConfig = (0, configuration_1.ConfigurationSchema)('InternetAccount', {
|
|
6
|
+
name: {
|
|
7
|
+
description: 'descriptive name of the internet account',
|
|
8
|
+
type: 'string',
|
|
9
|
+
defaultValue: '',
|
|
10
|
+
},
|
|
11
|
+
description: {
|
|
12
|
+
description: 'a description of the internet account',
|
|
13
|
+
type: 'string',
|
|
14
|
+
defaultValue: '',
|
|
15
|
+
},
|
|
16
|
+
authHeader: {
|
|
17
|
+
description: 'request header for credentials',
|
|
18
|
+
type: 'string',
|
|
19
|
+
defaultValue: 'Authorization',
|
|
20
|
+
},
|
|
21
|
+
tokenType: {
|
|
22
|
+
description: 'a custom name for a token to include in the header',
|
|
23
|
+
type: 'string',
|
|
24
|
+
defaultValue: '',
|
|
25
|
+
},
|
|
26
|
+
domains: {
|
|
27
|
+
description: 'array of valid domains the url can contain to use this account',
|
|
28
|
+
type: 'stringArray',
|
|
29
|
+
defaultValue: [],
|
|
30
|
+
},
|
|
31
|
+
}, { explicitIdentifier: 'internetAccountId', explicitlyTyped: true });
|