@jbrowse/core 1.6.3 → 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.
Files changed (56) 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 +2 -0
  5. package/ReExports/modules.d.ts +2 -0
  6. package/TextSearch/TextSearchManager.d.ts +2 -2
  7. package/assemblyManager/assemblyConfigSchema.d.ts +1 -1
  8. package/assemblyManager/assemblyManager.d.ts +1 -1
  9. package/configuration/index.d.ts +1 -1
  10. package/data_adapters/BaseAdapter.d.ts +2 -1
  11. package/data_adapters/BaseAdapter.js +29 -3
  12. package/data_adapters/CytobandAdapter.d.ts +1 -1
  13. package/package.json +4 -4
  14. package/pluggableElementTypes/RpcMethodType.js +1 -1
  15. package/pluggableElementTypes/models/InternetAccountModel.d.ts +103 -7
  16. package/pluggableElementTypes/models/InternetAccountModel.js +296 -10
  17. package/pluggableElementTypes/models/baseConnectionConfig.d.ts +1 -1
  18. package/pluggableElementTypes/models/baseInternetAccountConfig.d.ts +1 -1
  19. package/pluggableElementTypes/models/baseInternetAccountConfig.js +16 -1
  20. package/pluggableElementTypes/models/baseTrackConfig.d.ts +1 -1
  21. package/pluggableElementTypes/renderers/ComparativeServerSideRendererType.d.ts +1 -0
  22. package/pluggableElementTypes/renderers/ComparativeServerSideRendererType.js +46 -22
  23. package/rpc/BaseRpcDriver.d.ts +4 -4
  24. package/rpc/BaseRpcDriver.js +152 -79
  25. package/rpc/BaseRpcDriver.test.js +64 -43
  26. package/rpc/MainThreadRpcDriver.d.ts +1 -1
  27. package/rpc/MainThreadRpcDriver.js +25 -16
  28. package/rpc/RpcManager.d.ts +1 -1
  29. package/rpc/WebWorkerRpcDriver.d.ts +1 -1
  30. package/rpc/WebWorkerRpcDriver.js +43 -11
  31. package/rpc/configSchema.d.ts +1 -1
  32. package/ui/ErrorMessage.js +23 -8
  33. package/ui/FileSelector/FileSelector.js +1 -1
  34. package/ui/ReturnToImportFormDialog.d.ts +9 -0
  35. package/ui/ReturnToImportFormDialog.js +63 -0
  36. package/ui/Tooltip.d.ts +1 -1
  37. package/ui/Tooltip.js +2 -2
  38. package/ui/index.d.ts +2 -0
  39. package/ui/index.js +18 -0
  40. package/ui/theme.d.ts +8 -0
  41. package/ui/theme.js +9 -0
  42. package/ui/theme.test.js +2 -2
  43. package/util/Base1DViewModel.d.ts +2 -0
  44. package/util/Base1DViewModel.js +9 -0
  45. package/util/index.d.ts +12 -1
  46. package/util/index.js +52 -17
  47. package/util/index.test.js +35 -14
  48. package/util/io/index.d.ts +2 -1
  49. package/util/io/index.js +95 -96
  50. package/util/offscreenCanvasPonyfill.d.ts +1 -0
  51. package/util/offscreenCanvasPonyfill.js +70 -58
  52. package/util/simpleFeature.d.ts +3 -0
  53. package/util/types/index.d.ts +2 -2
  54. package/util/types/index.js +3 -3
  55. package/babel.config.d.ts +0 -15
  56. package/babel.config.js +0 -19
@@ -29,8 +29,6 @@ var _core = require("@material-ui/core");
29
29
 
30
30
  var _ExpandMore = _interopRequireDefault(require("@material-ui/icons/ExpandMore"));
31
31
 
32
- var _styles = require("@material-ui/core/styles");
33
-
34
32
  var _xDataGrid = require("@mui/x-data-grid");
35
33
 
36
34
  var _mobxReact = require("mobx-react");
@@ -64,7 +62,7 @@ var MAX_FIELD_NAME_WIDTH = 170; // these are always omitted as too detailed
64
62
  var globalOmit = ['length', 'position', 'subfeatures', 'uniqueId', 'exonFrames', 'parentId', 'thickStart', 'thickEnd']; // coreDetails are omitted in some circumstances
65
63
 
66
64
  var coreDetails = ['name', 'start', 'end', 'strand', 'refName', 'description', 'type'];
67
- var useStyles = (0, _styles.makeStyles)(function (theme) {
65
+ var useStyles = (0, _core.makeStyles)(function (theme) {
68
66
  return {
69
67
  expansionPanelDetails: {
70
68
  display: 'block',
@@ -1,5 +1,5 @@
1
1
  import PluginManager from '../PluginManager';
2
- declare const configSchema: import("../configuration/configurationSchema").AnyConfigurationSchemaType;
2
+ declare const configSchema: import("../configuration").AnyConfigurationSchemaType;
3
3
  export default function stateModelFactory(pluginManager: PluginManager): import("mobx-state-tree").IModelType<{
4
4
  id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
5
5
  type: import("mobx-state-tree").ISimpleType<"BaseFeatureWidget">;
package/PluginLoader.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { PluginConstructor } from './Plugin';
2
- export declare const PluginSourceConfigurationSchema: import("./configuration/configurationSchema").AnyConfigurationSchemaType;
2
+ export declare const PluginSourceConfigurationSchema: import("./configuration").AnyConfigurationSchemaType;
3
3
  export interface UMDPluginDefinition {
4
4
  umdUrl: string;
5
5
  name: string;
@@ -205,6 +205,7 @@ export default class PluginManager {
205
205
  '@jbrowse/core/util/layouts': typeof import("./util/layouts");
206
206
  '@jbrowse/core/util/tracks': typeof import("./util/tracks");
207
207
  '@jbrowse/core/util/Base1DViewModel': import("mobx-state-tree").IModelType<{
208
+ id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
208
209
  displayedRegions: import("mobx-state-tree").IArrayType<import("mobx-state-tree").IModelType<{
209
210
  refName: import("mobx-state-tree").ISimpleType<string>;
210
211
  start: import("mobx-state-tree").ISimpleType<number>;
@@ -228,6 +229,7 @@ export default class PluginManager {
228
229
  setVolatileWidth(width: number): void;
229
230
  } & {
230
231
  readonly width: number;
232
+ readonly assemblyNames: string[];
231
233
  readonly displayedRegionsTotalPx: number;
232
234
  readonly maxOffset: number;
233
235
  readonly minOffset: number;
@@ -133,6 +133,7 @@ declare const libs: {
133
133
  '@jbrowse/core/util/layouts': typeof coreLayouts;
134
134
  '@jbrowse/core/util/tracks': typeof trackUtils;
135
135
  '@jbrowse/core/util/Base1DViewModel': mst.IModelType<{
136
+ id: mst.IOptionalIType<mst.ISimpleType<string>, [undefined]>;
136
137
  displayedRegions: mst.IArrayType<mst.IModelType<{
137
138
  refName: mst.ISimpleType<string>;
138
139
  start: mst.ISimpleType<number>;
@@ -156,6 +157,7 @@ declare const libs: {
156
157
  setVolatileWidth(width: number): void;
157
158
  } & {
158
159
  readonly width: number;
160
+ readonly assemblyNames: string[];
159
161
  readonly displayedRegionsTotalPx: number;
160
162
  readonly maxOffset: number;
161
163
  readonly minOffset: number;
@@ -29,10 +29,10 @@ export default class TextSearchManager {
29
29
  */
30
30
  relevantAdapters(searchScope: SearchScope): (import("mobx-state-tree").ModelInstanceTypeProps<Record<string, any>> & {
31
31
  setSubschema(slotName: string, data: unknown): any;
32
- } & import("mobx-state-tree").IStateTreeNode<import("../configuration/configurationSchema").AnyConfigurationSchemaType>)[];
32
+ } & import("mobx-state-tree").IStateTreeNode<import("../configuration").AnyConfigurationSchemaType>)[];
33
33
  getAdaptersWithAssembly(asmName: string, adapterConfs: AnyConfigurationModel[]): (import("mobx-state-tree").ModelInstanceTypeProps<Record<string, any>> & {
34
34
  setSubschema(slotName: string, data: unknown): any;
35
- } & import("mobx-state-tree").IStateTreeNode<import("../configuration/configurationSchema").AnyConfigurationSchemaType>)[];
35
+ } & import("mobx-state-tree").IStateTreeNode<import("../configuration").AnyConfigurationSchemaType>)[];
36
36
  /**
37
37
  * Returns list of relevant results given a search query and options
38
38
  * @param args - search options/arguments include: search query
@@ -1,3 +1,3 @@
1
1
  import PluginManager from '../PluginManager';
2
- declare const _default: (pluginManager: PluginManager) => import("../configuration/configurationSchema").AnyConfigurationSchemaType;
2
+ declare const _default: (pluginManager: PluginManager) => import("../configuration").AnyConfigurationSchemaType;
3
3
  export default _default;
@@ -169,7 +169,7 @@ export default function assemblyManagerFactory(assemblyConfigType: IAnyType, plu
169
169
  readonly assemblyNamesList: string[];
170
170
  readonly assemblyList: (import("mobx-state-tree").ModelInstanceTypeProps<Record<string, any>> & {
171
171
  setSubschema(slotName: string, data: unknown): any;
172
- } & import("mobx-state-tree").IStateTreeNode<import("../configuration/configurationSchema").AnyConfigurationSchemaType> & {
172
+ } & import("mobx-state-tree").IStateTreeNode<import("../configuration").AnyConfigurationSchemaType> & {
173
173
  name: string;
174
174
  })[];
175
175
  readonly rpcManager: any;
@@ -1,3 +1,3 @@
1
1
  export { ConfigurationSchema, ConfigurationReference, } from './configurationSchema';
2
- export type { AnyConfigurationModel } from './configurationSchema';
2
+ export type { AnyConfigurationModel, AnyConfigurationSchemaType, } from './configurationSchema';
3
3
  export * from './util';
@@ -1,6 +1,6 @@
1
1
  import { Observable } from 'rxjs';
2
2
  import { Feature } from '../util/simpleFeature';
3
- import { AnyConfigurationModel } from '../configuration/configurationSchema';
3
+ import { AnyConfigurationModel } from '../configuration';
4
4
  import { getSubAdapterType } from './dataAdapterCache';
5
5
  import { AugmentedRegion as Region, NoAssemblyRegion } from '../util/types';
6
6
  import BaseResult from '../TextSearch/BaseResults';
@@ -59,6 +59,7 @@ export declare abstract class BaseFeatureDataAdapter extends BaseAdapter {
59
59
  * @param opts - Feature adapter options
60
60
  */
61
61
  abstract getRefNames(opts?: BaseOptions): Promise<string[]>;
62
+ getConf(arg: string | string[]): any;
62
63
  /**
63
64
  * Get features from the data source that overlap a region
64
65
  * @param region - Region
@@ -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,
@@ -436,6 +454,14 @@ var BaseFeatureDataAdapter = /*#__PURE__*/function (_BaseAdapter) {
436
454
  while (1) {
437
455
  switch (_context10.prev = _context10.next) {
438
456
  case 0:
457
+ if (regions.length) {
458
+ _context10.next = 2;
459
+ break;
460
+ }
461
+
462
+ throw new Error('No regions to estimate stats for');
463
+
464
+ case 2:
439
465
  region = regions[0];
440
466
  lastTime = +Date.now();
441
467
 
@@ -522,7 +548,7 @@ var BaseFeatureDataAdapter = /*#__PURE__*/function (_BaseAdapter) {
522
548
 
523
549
  return _context10.abrupt("return", statsFromInterval(1000, 0));
524
550
 
525
- case 5:
551
+ case 7:
526
552
  case "end":
527
553
  return _context10.stop();
528
554
  }
@@ -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.3",
3
+ "version": "1.6.6",
4
4
  "description": "JBrowse 2 core libraries used by plugins",
5
5
  "keywords": [
6
6
  "jbrowse",
@@ -26,12 +26,12 @@
26
26
  "clean": "rimraf dist",
27
27
  "prebuild": "yarn clean",
28
28
  "prepack": "yarn build",
29
- "build": "NODE_ENV=production babel . --root-mode upward --out-dir dist --extensions '.ts,.js,.tsx,.jsx' && cp package.json README.md ../../LICENSE dist/ && tsc"
29
+ "build": "babel . --root-mode upward --out-dir dist --extensions '.ts,.js,.tsx,.jsx' && cp package.json README.md ../../LICENSE dist/ && tsc"
30
30
  },
31
31
  "dependencies": {
32
32
  "@babel/runtime": "^7.16.3",
33
33
  "@material-ui/icons": "^4.0.1",
34
- "abortable-promise-cache": "^1.1.3",
34
+ "abortable-promise-cache": "^1.5.0",
35
35
  "base64-js": "^1.3.0",
36
36
  "canvas": "^2.8.0",
37
37
  "clsx": "^1.0.4",
@@ -77,5 +77,5 @@
77
77
  "access": "public",
78
78
  "directory": "dist"
79
79
  },
80
- "gitHead": "c6d6783d3dc82ea96390ab177ceb8ed38b439333"
80
+ "gitHead": "9fcca7793af0df2d6e527ddaace2b368c8ed2879"
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>;