@jbrowse/core 2.1.5 → 2.1.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 (46) hide show
  1. package/BaseFeatureWidget/BaseFeatureDetail.d.ts +2 -1
  2. package/BaseFeatureWidget/BaseFeatureDetail.js +16 -17
  3. package/BaseFeatureWidget/SequenceBox.d.ts +29 -0
  4. package/BaseFeatureWidget/SequenceBox.js +61 -0
  5. package/BaseFeatureWidget/SequenceFeatureDetails.d.ts +1 -10
  6. package/BaseFeatureWidget/SequenceFeatureDetails.js +100 -152
  7. package/BaseFeatureWidget/SequenceHelpDialog.d.ts +4 -0
  8. package/BaseFeatureWidget/SequenceHelpDialog.js +51 -0
  9. package/BaseFeatureWidget/SequencePanel.d.ts +10 -0
  10. package/BaseFeatureWidget/SequencePanel.js +72 -0
  11. package/BaseFeatureWidget/index.d.ts +7 -0
  12. package/BaseFeatureWidget/index.js +21 -5
  13. package/BaseFeatureWidget/util.d.ts +11 -0
  14. package/BaseFeatureWidget/util.js +13 -1
  15. package/PluginLoader.d.ts +29 -13
  16. package/PluginLoader.js +47 -77
  17. package/PluginManager.d.ts +1 -0
  18. package/PluginManager.js +9 -3
  19. package/assemblyManager/assembly.d.ts +8 -15
  20. package/assemblyManager/assembly.js +14 -17
  21. package/assemblyManager/assemblyManager.d.ts +37 -86
  22. package/configuration/configurationSlot.js +2 -1
  23. package/data_adapters/CytobandAdapter.js +1 -1
  24. package/package.json +3 -3
  25. package/pluggableElementTypes/models/BaseDisplayModel.d.ts +1 -1
  26. package/pluggableElementTypes/models/BaseDisplayModel.js +3 -2
  27. package/pluggableElementTypes/models/BaseTrackModel.d.ts +1 -1
  28. package/pluggableElementTypes/models/BaseTrackModel.js +1 -1
  29. package/pluggableElementTypes/models/baseTrackConfig.js +16 -4
  30. package/rpc/RpcManager.d.ts +1 -1
  31. package/rpc/RpcManager.js +4 -1
  32. package/rpc/WebWorkerRpcDriver.d.ts +2 -0
  33. package/rpc/WebWorkerRpcDriver.js +21 -11
  34. package/rpc/configSchema.js +4 -1
  35. package/tsconfig.build.tsbuildinfo +1 -1
  36. package/ui/AboutDialog.d.ts +6 -0
  37. package/ui/AboutDialog.js +42 -20
  38. package/ui/App.js +2 -2
  39. package/ui/DrawerWidget.js +9 -7
  40. package/ui/FatalErrorDialog.d.ts +6 -22
  41. package/ui/FatalErrorDialog.js +10 -29
  42. package/util/index.d.ts +4 -0
  43. package/util/index.js +5 -1
  44. package/util/stats.js +7 -5
  45. package/util/tracks.d.ts +5 -2
  46. package/util/tracks.js +15 -5
@@ -44,27 +44,20 @@ export default function assemblyManagerFactory(assemblyConfigType: IAnyType, plu
44
44
  }): void;
45
45
  setError(e: Error): void;
46
46
  setRegions(regions: import("../util").Region[]): void;
47
- setRefNameAliases(refNameAliases: {
47
+ setRefNameAliases(aliases: {
48
48
  [x: string]: string;
49
- }, lowerCaseRefNameAliases: {
49
+ }, lowerCase: {
50
50
  [x: string]: string;
51
51
  }): void;
52
52
  setCytobands(cytobands: import("../util").Feature[]): void;
53
53
  afterAttach(): void;
54
54
  } & {
55
- getAdapterMapEntry(adapterConf: unknown, options: import("./assembly").BaseOptions): Promise<{
56
- forwardMap: {
57
- [key: string]: string;
58
- };
59
- reverseMap: {
60
- [key: string]: string;
61
- };
62
- }>;
55
+ getAdapterMapEntry(adapterConf: unknown, options: import("./assembly").BaseOptions): Promise<import("./assembly").RefNameMap>;
63
56
  getRefNameMapForAdapter(adapterConf: unknown, opts: import("./assembly").BaseOptions): Promise<{
64
- [key: string]: string;
57
+ [x: string]: string;
65
58
  }>;
66
59
  getReverseRefNameMapForAdapter(adapterConf: unknown, opts: import("./assembly").BaseOptions): Promise<{
67
- [key: string]: string;
60
+ [x: string]: string;
68
61
  }>;
69
62
  }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
70
63
  }, {
@@ -111,27 +104,20 @@ export default function assemblyManagerFactory(assemblyConfigType: IAnyType, plu
111
104
  }): void;
112
105
  setError(e: Error): void;
113
106
  setRegions(regions: import("../util").Region[]): void;
114
- setRefNameAliases(refNameAliases: {
107
+ setRefNameAliases(aliases: {
115
108
  [x: string]: string;
116
- }, lowerCaseRefNameAliases: {
109
+ }, lowerCase: {
117
110
  [x: string]: string;
118
111
  }): void;
119
112
  setCytobands(cytobands: import("../util").Feature[]): void;
120
113
  afterAttach(): void;
121
114
  } & {
122
- getAdapterMapEntry(adapterConf: unknown, options: import("./assembly").BaseOptions): Promise<{
123
- forwardMap: {
124
- [key: string]: string;
125
- };
126
- reverseMap: {
127
- [key: string]: string;
128
- };
129
- }>;
115
+ getAdapterMapEntry(adapterConf: unknown, options: import("./assembly").BaseOptions): Promise<import("./assembly").RefNameMap>;
130
116
  getRefNameMapForAdapter(adapterConf: unknown, opts: import("./assembly").BaseOptions): Promise<{
131
- [key: string]: string;
117
+ [x: string]: string;
132
118
  }>;
133
119
  getReverseRefNameMapForAdapter(adapterConf: unknown, opts: import("./assembly").BaseOptions): Promise<{
134
- [key: string]: string;
120
+ [x: string]: string;
135
121
  }>;
136
122
  } & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
137
123
  configuration: import("mobx-state-tree").IMaybe<import("mobx-state-tree").IReferenceType<IAnyType>>;
@@ -176,27 +162,20 @@ export default function assemblyManagerFactory(assemblyConfigType: IAnyType, plu
176
162
  }): void;
177
163
  setError(e: Error): void;
178
164
  setRegions(regions: import("../util").Region[]): void;
179
- setRefNameAliases(refNameAliases: {
165
+ setRefNameAliases(aliases: {
180
166
  [x: string]: string;
181
- }, lowerCaseRefNameAliases: {
167
+ }, lowerCase: {
182
168
  [x: string]: string;
183
169
  }): void;
184
170
  setCytobands(cytobands: import("../util").Feature[]): void;
185
171
  afterAttach(): void;
186
172
  } & {
187
- getAdapterMapEntry(adapterConf: unknown, options: import("./assembly").BaseOptions): Promise<{
188
- forwardMap: {
189
- [key: string]: string;
190
- };
191
- reverseMap: {
192
- [key: string]: string;
193
- };
194
- }>;
173
+ getAdapterMapEntry(adapterConf: unknown, options: import("./assembly").BaseOptions): Promise<import("./assembly").RefNameMap>;
195
174
  getRefNameMapForAdapter(adapterConf: unknown, opts: import("./assembly").BaseOptions): Promise<{
196
- [key: string]: string;
175
+ [x: string]: string;
197
176
  }>;
198
177
  getReverseRefNameMapForAdapter(adapterConf: unknown, opts: import("./assembly").BaseOptions): Promise<{
199
- [key: string]: string;
178
+ [x: string]: string;
200
179
  }>;
201
180
  }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>) | undefined;
202
181
  readonly assemblyNamesList: string[];
@@ -254,27 +233,20 @@ export default function assemblyManagerFactory(assemblyConfigType: IAnyType, plu
254
233
  }): void;
255
234
  setError(e: Error): void;
256
235
  setRegions(regions: import("../util").Region[]): void;
257
- setRefNameAliases(refNameAliases: {
236
+ setRefNameAliases(aliases: {
258
237
  [x: string]: string;
259
- }, lowerCaseRefNameAliases: {
238
+ }, lowerCase: {
260
239
  [x: string]: string;
261
240
  }): void;
262
241
  setCytobands(cytobands: import("../util").Feature[]): void;
263
242
  afterAttach(): void;
264
243
  } & {
265
- getAdapterMapEntry(adapterConf: unknown, options: import("./assembly").BaseOptions): Promise<{
266
- forwardMap: {
267
- [key: string]: string;
268
- };
269
- reverseMap: {
270
- [key: string]: string;
271
- };
272
- }>;
244
+ getAdapterMapEntry(adapterConf: unknown, options: import("./assembly").BaseOptions): Promise<import("./assembly").RefNameMap>;
273
245
  getRefNameMapForAdapter(adapterConf: unknown, opts: import("./assembly").BaseOptions): Promise<{
274
- [key: string]: string;
246
+ [x: string]: string;
275
247
  }>;
276
248
  getReverseRefNameMapForAdapter(adapterConf: unknown, opts: import("./assembly").BaseOptions): Promise<{
277
- [key: string]: string;
249
+ [x: string]: string;
278
250
  }>;
279
251
  } & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
280
252
  configuration: import("mobx-state-tree").IMaybe<import("mobx-state-tree").IReferenceType<IAnyType>>;
@@ -319,40 +291,33 @@ export default function assemblyManagerFactory(assemblyConfigType: IAnyType, plu
319
291
  }): void;
320
292
  setError(e: Error): void;
321
293
  setRegions(regions: import("../util").Region[]): void;
322
- setRefNameAliases(refNameAliases: {
294
+ setRefNameAliases(aliases: {
323
295
  [x: string]: string;
324
- }, lowerCaseRefNameAliases: {
296
+ }, lowerCase: {
325
297
  [x: string]: string;
326
298
  }): void;
327
299
  setCytobands(cytobands: import("../util").Feature[]): void;
328
300
  afterAttach(): void;
329
301
  } & {
330
- getAdapterMapEntry(adapterConf: unknown, options: import("./assembly").BaseOptions): Promise<{
331
- forwardMap: {
332
- [key: string]: string;
333
- };
334
- reverseMap: {
335
- [key: string]: string;
336
- };
337
- }>;
302
+ getAdapterMapEntry(adapterConf: unknown, options: import("./assembly").BaseOptions): Promise<import("./assembly").RefNameMap>;
338
303
  getRefNameMapForAdapter(adapterConf: unknown, opts: import("./assembly").BaseOptions): Promise<{
339
- [key: string]: string;
304
+ [x: string]: string;
340
305
  }>;
341
306
  getReverseRefNameMapForAdapter(adapterConf: unknown, opts: import("./assembly").BaseOptions): Promise<{
342
- [key: string]: string;
307
+ [x: string]: string;
343
308
  }>;
344
309
  }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>) | undefined>;
345
310
  getRefNameMapForAdapter(adapterConf: unknown, assemblyName: string | undefined, opts: {
346
311
  signal?: AbortSignal;
347
312
  sessionId: string;
348
313
  }): Promise<{
349
- [key: string]: string;
314
+ [x: string]: string;
350
315
  } | undefined>;
351
316
  getReverseRefNameMapForAdapter(adapterConf: unknown, assemblyName: string | undefined, opts: {
352
317
  signal?: AbortSignal;
353
318
  sessionId: string;
354
319
  }): Promise<{
355
- [key: string]: string;
320
+ [x: string]: string;
356
321
  } | undefined>;
357
322
  isValidRefName(refName: string, assemblyName?: string): boolean;
358
323
  } & {
@@ -399,27 +364,20 @@ export default function assemblyManagerFactory(assemblyConfigType: IAnyType, plu
399
364
  }): void;
400
365
  setError(e: Error): void;
401
366
  setRegions(regions: import("../util").Region[]): void;
402
- setRefNameAliases(refNameAliases: {
367
+ setRefNameAliases(aliases: {
403
368
  [x: string]: string;
404
- }, lowerCaseRefNameAliases: {
369
+ }, lowerCase: {
405
370
  [x: string]: string;
406
371
  }): void;
407
372
  setCytobands(cytobands: import("../util").Feature[]): void;
408
373
  afterAttach(): void;
409
374
  } & {
410
- getAdapterMapEntry(adapterConf: unknown, options: import("./assembly").BaseOptions): Promise<{
411
- forwardMap: {
412
- [key: string]: string;
413
- };
414
- reverseMap: {
415
- [key: string]: string;
416
- };
417
- }>;
375
+ getAdapterMapEntry(adapterConf: unknown, options: import("./assembly").BaseOptions): Promise<import("./assembly").RefNameMap>;
418
376
  getRefNameMapForAdapter(adapterConf: unknown, opts: import("./assembly").BaseOptions): Promise<{
419
- [key: string]: string;
377
+ [x: string]: string;
420
378
  }>;
421
379
  getReverseRefNameMapForAdapter(adapterConf: unknown, opts: import("./assembly").BaseOptions): Promise<{
422
- [key: string]: string;
380
+ [x: string]: string;
423
381
  }>;
424
382
  } & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
425
383
  configuration: import("mobx-state-tree").IMaybe<import("mobx-state-tree").IReferenceType<IAnyType>>;
@@ -464,27 +422,20 @@ export default function assemblyManagerFactory(assemblyConfigType: IAnyType, plu
464
422
  }): void;
465
423
  setError(e: Error): void;
466
424
  setRegions(regions: import("../util").Region[]): void;
467
- setRefNameAliases(refNameAliases: {
425
+ setRefNameAliases(aliases: {
468
426
  [x: string]: string;
469
- }, lowerCaseRefNameAliases: {
427
+ }, lowerCase: {
470
428
  [x: string]: string;
471
429
  }): void;
472
430
  setCytobands(cytobands: import("../util").Feature[]): void;
473
431
  afterAttach(): void;
474
432
  } & {
475
- getAdapterMapEntry(adapterConf: unknown, options: import("./assembly").BaseOptions): Promise<{
476
- forwardMap: {
477
- [key: string]: string;
478
- };
479
- reverseMap: {
480
- [key: string]: string;
481
- };
482
- }>;
433
+ getAdapterMapEntry(adapterConf: unknown, options: import("./assembly").BaseOptions): Promise<import("./assembly").RefNameMap>;
483
434
  getRefNameMapForAdapter(adapterConf: unknown, opts: import("./assembly").BaseOptions): Promise<{
484
- [key: string]: string;
435
+ [x: string]: string;
485
436
  }>;
486
437
  getReverseRefNameMapForAdapter(adapterConf: unknown, opts: import("./assembly").BaseOptions): Promise<{
487
- [key: string]: string;
438
+ [x: string]: string;
488
439
  }>;
489
440
  }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>): void;
490
441
  afterAttach(): void;
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
4
4
  const mobx_state_tree_1 = require("mobx-state-tree");
5
5
  const jexlStrings_1 = require("../util/jexlStrings");
6
6
  const mst_1 = require("../util/types/mst");
7
+ const util_1 = require("../util");
7
8
  function isValidColorString( /* str */) {
8
9
  // TODO: check all the crazy cases for whether it's a valid HTML/CSS color string
9
10
  return true;
@@ -176,7 +177,7 @@ function ConfigSlot(slotName, { description = '', model, type, defaultValue, con
176
177
  get expr() {
177
178
  if (self.isCallback) {
178
179
  // compile as jexl function
179
- const { pluginManager } = (0, mobx_state_tree_1.getEnv)(self);
180
+ const { pluginManager } = (0, util_1.getEnv)(self);
180
181
  if (!pluginManager && typeof jest === 'undefined') {
181
182
  console.warn('no pluginManager detected on config env (if you dynamically instantiate a config, for example in renderProps for your display model, check that you add the env argument)');
182
183
  }
@@ -23,7 +23,7 @@ class CytobandAdapter extends BaseAdapter_1.BaseAdapter {
23
23
  }
24
24
  const data = await (0, io_1.openLocation)(loc).readFile('utf8');
25
25
  return data
26
- .split('\n')
26
+ .split(/\n|\r\n|\r/)
27
27
  .filter(f => !!f.trim())
28
28
  .map(line => {
29
29
  const [refName, start, end, name, type] = line.split('\t');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/core",
3
- "version": "2.1.5",
3
+ "version": "2.1.6",
4
4
  "description": "JBrowse 2 core libraries used by plugins",
5
5
  "keywords": [
6
6
  "jbrowse",
@@ -52,8 +52,8 @@
52
52
  "material-ui-popup-state": "^3.0.0",
53
53
  "rbush": "^3.0.1",
54
54
  "react-error-boundary": "^3.0.0",
55
- "react-intersection-observer": "^9.3.0",
56
55
  "react-use-measure": "^2.1.1",
56
+ "serialize-error": "^8.0.0",
57
57
  "shortid": "^2.2.13",
58
58
  "svg-path-generator": "^1.1.0"
59
59
  },
@@ -73,5 +73,5 @@
73
73
  "access": "public",
74
74
  "directory": "dist"
75
75
  },
76
- "gitHead": "bc5253ecdddeceeb999fffebf6dc6cf5f444e1c9"
76
+ "gitHead": "df810d2a4f057adcd8f5345d54972508fba007a7"
77
77
  }
@@ -56,7 +56,7 @@ export declare const BaseDisplay: import("mobx-state-tree").IModelType<{
56
56
  * the pluggable element type object for this display's
57
57
  * renderer
58
58
  */
59
- readonly rendererType: any;
59
+ readonly rendererType: import("..").RendererType;
60
60
  /**
61
61
  * if a display-level message should be displayed instead,
62
62
  * make this return a react component
@@ -5,6 +5,7 @@ exports.BaseDisplay = void 0;
5
5
  const mobx_state_tree_1 = require("mobx-state-tree");
6
6
  const configuration_1 = require("../../configuration");
7
7
  const tracks_1 = require("../../util/tracks");
8
+ const util_1 = require("../../util");
8
9
  const mst_1 = require("../../util/types/mst");
9
10
  exports.BaseDisplay = mobx_state_tree_1.types
10
11
  .model('BaseDisplay', {
@@ -18,7 +19,7 @@ exports.BaseDisplay = mobx_state_tree_1.types
18
19
  }))
19
20
  .views(self => ({
20
21
  get RenderingComponent() {
21
- const { pluginManager } = (0, mobx_state_tree_1.getEnv)(self);
22
+ const { pluginManager } = (0, util_1.getEnv)(self);
22
23
  const displayType = pluginManager.getDisplayType(self.type);
23
24
  return displayType.ReactComponent;
24
25
  },
@@ -54,7 +55,7 @@ exports.BaseDisplay = mobx_state_tree_1.types
54
55
  * renderer
55
56
  */
56
57
  get rendererType() {
57
- const { pluginManager } = (0, mobx_state_tree_1.getEnv)(self);
58
+ const { pluginManager } = (0, util_1.getEnv)(self);
58
59
  const RendererType = pluginManager.getRendererType(self.rendererTypeName);
59
60
  if (!RendererType) {
60
61
  throw new Error(`renderer "${self.rendererTypeName}" not found`);
@@ -14,7 +14,7 @@ export declare function createBaseTrackModel(pluginManager: PluginManager, track
14
14
  /**
15
15
  * the PluggableElementType for the currently defined adapter
16
16
  */
17
- readonly adapterType: any;
17
+ readonly adapterType: import("..").AdapterType;
18
18
  readonly viewMenuActions: MenuItem[];
19
19
  readonly canConfigure: any;
20
20
  } & {
@@ -35,7 +35,7 @@ function createBaseTrackModel(pluginManager, trackType, baseTrackConfig) {
35
35
  */
36
36
  get adapterType() {
37
37
  const adapterConfig = (0, configuration_1.getConf)(self, 'adapter');
38
- const { pluginManager: pm } = (0, mobx_state_tree_1.getEnv)(self);
38
+ const { pluginManager: pm } = (0, util_1.getEnv)(self);
39
39
  if (!adapterConfig) {
40
40
  throw new Error(`no adapter configuration provided for ${self.type}`);
41
41
  }
@@ -65,6 +65,18 @@ function createBaseTrackConfig(pluginManager) {
65
65
  description: 'depth to iterate on subfeatures',
66
66
  },
67
67
  }),
68
+ formatAbout: (0, configuration_1.ConfigurationSchema)('FormatAbout', {
69
+ config: {
70
+ type: 'frozen',
71
+ description: 'formats configuration object in about dialog',
72
+ defaultValue: {},
73
+ contextVariable: ['config'],
74
+ },
75
+ hideUris: {
76
+ type: 'boolean',
77
+ defaultValue: false,
78
+ },
79
+ }),
68
80
  }, {
69
81
  preProcessSnapshot: s => {
70
82
  const snap = JSON.parse(JSON.stringify(s));
@@ -90,16 +102,16 @@ function createBaseTrackConfig(pluginManager) {
90
102
  explicitIdentifier: 'trackId',
91
103
  explicitlyTyped: true,
92
104
  actions: (self) => ({
93
- addDisplayConf(displayConf) {
94
- const { type } = displayConf;
105
+ addDisplayConf(conf) {
106
+ const { type } = conf;
95
107
  if (!type) {
96
108
  throw new Error(`unknown display type ${type}`);
97
109
  }
98
- const display = self.displays.find((d) => d && d.displayId === displayConf.displayId);
110
+ const display = self.displays.find((d) => d && d.displayId === conf.displayId);
99
111
  if (display) {
100
112
  return display;
101
113
  }
102
- const length = self.displays.push(displayConf);
114
+ const length = self.displays.push(conf);
103
115
  return self.displays[length - 1];
104
116
  },
105
117
  }),
@@ -1,7 +1,7 @@
1
1
  import PluginManager from '../PluginManager';
2
+ import { AnyConfigurationModel } from '../configuration';
2
3
  import WebWorkerRpcDriver from './WebWorkerRpcDriver';
3
4
  import MainThreadRpcDriver from './MainThreadRpcDriver';
4
- import { AnyConfigurationModel } from '../configuration/configurationSchema';
5
5
  declare type DriverClass = WebWorkerRpcDriver | MainThreadRpcDriver;
6
6
  declare type BackendConfigurations = {
7
7
  WebWorkerRpcDriver?: Omit<ConstructorParameters<typeof WebWorkerRpcDriver>[0], 'config'>;
package/rpc/RpcManager.js CHANGED
@@ -40,7 +40,10 @@ class RpcManager {
40
40
  if (!backendConfiguration) {
41
41
  throw new Error(`requested RPC driver "${backendName}" is missing config`);
42
42
  }
43
- newDriver = new WebWorkerRpcDriver_1.default({ ...backendConfiguration, config }, { plugins: this.pluginManager.runtimePluginDefinitions });
43
+ newDriver = new WebWorkerRpcDriver_1.default({ ...backendConfiguration, config }, {
44
+ plugins: this.pluginManager.runtimePluginDefinitions,
45
+ windowHref: window.location.href,
46
+ });
44
47
  }
45
48
  else {
46
49
  throw new Error(`requested RPC driver "${backendName}" is not installed`);
@@ -14,11 +14,13 @@ declare class WebWorkerHandle extends Rpc.Client {
14
14
  export default class WebWorkerRpcDriver extends BaseRpcDriver {
15
15
  workerBootConfiguration: {
16
16
  plugins: PluginDefinition[];
17
+ windowHref: string;
17
18
  };
18
19
  name: string;
19
20
  makeWorkerInstance: () => Worker;
20
21
  constructor(args: WebWorkerRpcDriverConstructorArgs, workerBootConfiguration: {
21
22
  plugins: PluginDefinition[];
23
+ windowHref: string;
22
24
  });
23
25
  makeWorker(): Promise<WebWorkerHandle>;
24
26
  }
@@ -5,6 +5,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const librpc_web_mod_1 = __importDefault(require("librpc-web-mod"));
7
7
  const shortid_1 = __importDefault(require("shortid"));
8
+ const serialize_error_1 = require("serialize-error");
9
+ // locals
8
10
  const BaseRpcDriver_1 = __importDefault(require("./BaseRpcDriver"));
9
11
  class WebWorkerHandle extends librpc_web_mod_1.default.Client {
10
12
  destroy() {
@@ -14,9 +16,7 @@ class WebWorkerHandle extends librpc_web_mod_1.default.Client {
14
16
  const { statusCallback, rpcDriverClassName } = opts;
15
17
  const channel = `message-${shortid_1.default.generate()}`;
16
18
  const listener = (message) => {
17
- if (statusCallback) {
18
- statusCallback(message);
19
- }
19
+ statusCallback === null || statusCallback === void 0 ? void 0 : statusCallback(message);
20
20
  };
21
21
  this.on(channel, listener);
22
22
  const result = await super.call(functionName, { ...args, channel, rpcDriverClassName }, opts);
@@ -37,21 +37,31 @@ class WebWorkerRpcDriver extends BaseRpcDriver_1.default {
37
37
  // load balancing rather than using librpc's builtin round-robin
38
38
  const instance = this.makeWorkerInstance();
39
39
  const worker = new WebWorkerHandle({ workers: [instance] });
40
+ const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
41
+ if (isSafari) {
42
+ // xref https://github.com/GMOD/jbrowse-components/issues/3245
43
+ // eslint-disable-next-line no-console
44
+ console.log('console logging the webworker handle avoids the track going into an infinite loading state, this is a hacky workaround for safari', instance);
45
+ }
40
46
  // send the worker its boot configuration using info from the pluginManager
41
- const p = new Promise((resolve, reject) => {
42
- worker.workers[0].onmessage = e => {
43
- if (e.data === 'ready') {
47
+ return new Promise((resolve, reject) => {
48
+ const listener = (e) => {
49
+ if (e.data.message === 'ready') {
44
50
  resolve(worker);
51
+ worker.workers[0].removeEventListener('message', listener);
45
52
  }
46
- else if (e.data === 'readyForConfig') {
47
- worker.workers[0].postMessage(this.workerBootConfiguration);
53
+ else if (e.data.message === 'readyForConfig') {
54
+ worker.workers[0].postMessage({
55
+ message: 'config',
56
+ config: this.workerBootConfiguration,
57
+ });
48
58
  }
49
- else {
50
- reject();
59
+ else if (e.data.message === 'error') {
60
+ reject((0, serialize_error_1.deserializeError)(e.data.error));
51
61
  }
52
62
  };
63
+ worker.workers[0].addEventListener('message', listener);
53
64
  });
54
- return p;
55
65
  }
56
66
  }
57
67
  exports.default = WebWorkerRpcDriver;
@@ -17,7 +17,10 @@ exports.default = (0, configuration_1.ConfigurationSchema)('RpcOptions', {
17
17
  description: 'the RPC driver to use for tracks and tasks that are not configured to use a specific RPC backend',
18
18
  defaultValue: 'MainThreadRpcDriver',
19
19
  },
20
- drivers: mobx_state_tree_1.types.optional(mobx_state_tree_1.types.map(mobx_state_tree_1.types.union(MainThreadRpcDriverConfigSchema, WebWorkerRpcDriverConfigSchema)), { MainThreadRpcDriver: { type: 'MainThreadRpcDriver' } }),
20
+ drivers: mobx_state_tree_1.types.optional(mobx_state_tree_1.types.map(mobx_state_tree_1.types.union(MainThreadRpcDriverConfigSchema, WebWorkerRpcDriverConfigSchema)), {
21
+ MainThreadRpcDriver: { type: 'MainThreadRpcDriver' },
22
+ WebWorkerRpcDriver: { type: 'WebWorkerRpcDriver' },
23
+ }),
21
24
  }, {
22
25
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
23
26
  actions: (self) => ({