@jbrowse/plugin-legacy-jbrowse 1.5.0 → 1.5.4

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.
@@ -6,30 +6,74 @@ import { ConfigurationSchema, readConfObject, ConfigurationReference } from '@jb
6
6
  import { BaseAdapter, BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
7
7
  import BaseResult from '@jbrowse/core/TextSearch/BaseResults';
8
8
  import crc32 from 'buffer-crc32';
9
+ import { generateUnsupportedTrackConf, guessAdapter, UNSUPPORTED, UNKNOWN, generateUnknownTrackConf, guessTrackType, getFileName } from '@jbrowse/core/util/tracks';
9
10
  import { objectHash, getSession, checkAbortSignal } from '@jbrowse/core/util';
10
11
  import { baseConnectionConfig, BaseConnectionModelFactory } from '@jbrowse/core/pluggableElementTypes/models';
11
12
  import { types } from 'mobx-state-tree';
12
13
  import { openLocation } from '@jbrowse/core/util/io';
13
14
  import getValue from 'get-value';
14
15
  import setValue from 'set-value';
15
- import { generateUnsupportedTrackConf, guessAdapter, UNSUPPORTED, UNKNOWN, generateUnknownTrackConf, guessTrackType } from '@jbrowse/core/util/tracks';
16
16
  import NCListStore from '@gmod/nclist';
17
17
  import { ObservableCreate } from '@jbrowse/core/util/rxjs';
18
18
  import { RemoteFile } from 'generic-filehandle';
19
19
 
20
+ function _asyncIterator(iterable) {
21
+ var method,
22
+ async,
23
+ sync,
24
+ retry = 2;
25
+
26
+ for ("undefined" != typeof Symbol && (async = Symbol.asyncIterator, sync = Symbol.iterator); retry--;) {
27
+ if (async && null != (method = iterable[async])) return method.call(iterable);
28
+ if (sync && null != (method = iterable[sync])) return new AsyncFromSyncIterator(method.call(iterable));
29
+ async = "@@asyncIterator", sync = "@@iterator";
30
+ }
31
+
32
+ throw new TypeError("Object is not async iterable");
33
+ }
34
+
35
+ function AsyncFromSyncIterator(s) {
36
+ function AsyncFromSyncIteratorContinuation(r) {
37
+ if (Object(r) !== r) return Promise.reject(new TypeError(r + " is not an object."));
38
+ var done = r.done;
39
+ return Promise.resolve(r.value).then(function (value) {
40
+ return {
41
+ value: value,
42
+ done: done
43
+ };
44
+ });
45
+ }
46
+
47
+ return AsyncFromSyncIterator = function (s) {
48
+ this.s = s, this.n = s.next;
49
+ }, AsyncFromSyncIterator.prototype = {
50
+ s: null,
51
+ n: null,
52
+ next: function () {
53
+ return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments));
54
+ },
55
+ return: function (value) {
56
+ var ret = this.s.return;
57
+ return void 0 === ret ? Promise.resolve({
58
+ value: value,
59
+ done: !0
60
+ }) : AsyncFromSyncIteratorContinuation(ret.apply(this.s, arguments));
61
+ },
62
+ throw: function (value) {
63
+ var thr = this.s.return;
64
+ return void 0 === thr ? Promise.reject(value) : AsyncFromSyncIteratorContinuation(thr.apply(this.s, arguments));
65
+ }
66
+ }, new AsyncFromSyncIterator(s);
67
+ }
68
+
20
69
  function ownKeys(object, enumerableOnly) {
21
70
  var keys = Object.keys(object);
22
71
 
23
72
  if (Object.getOwnPropertySymbols) {
24
73
  var symbols = Object.getOwnPropertySymbols(object);
25
-
26
- if (enumerableOnly) {
27
- symbols = symbols.filter(function (sym) {
28
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
29
- });
30
- }
31
-
32
- keys.push.apply(keys, symbols);
74
+ enumerableOnly && (symbols = symbols.filter(function (sym) {
75
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
76
+ })), keys.push.apply(keys, symbols);
33
77
  }
34
78
 
35
79
  return keys;
@@ -37,19 +81,12 @@ function ownKeys(object, enumerableOnly) {
37
81
 
38
82
  function _objectSpread2(target) {
39
83
  for (var i = 1; i < arguments.length; i++) {
40
- var source = arguments[i] != null ? arguments[i] : {};
41
-
42
- if (i % 2) {
43
- ownKeys(Object(source), true).forEach(function (key) {
44
- _defineProperty(target, key, source[key]);
45
- });
46
- } else if (Object.getOwnPropertyDescriptors) {
47
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
48
- } else {
49
- ownKeys(Object(source)).forEach(function (key) {
50
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
51
- });
52
- }
84
+ var source = null != arguments[i] ? arguments[i] : {};
85
+ i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
86
+ _defineProperty(target, key, source[key]);
87
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
88
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
89
+ });
53
90
  }
54
91
 
55
92
  return target;
@@ -58,31 +95,11 @@ function _objectSpread2(target) {
58
95
  function _typeof(obj) {
59
96
  "@babel/helpers - typeof";
60
97
 
61
- if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
62
- _typeof = function (obj) {
63
- return typeof obj;
64
- };
65
- } else {
66
- _typeof = function (obj) {
67
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
68
- };
69
- }
70
-
71
- return _typeof(obj);
72
- }
73
-
74
- function _asyncIterator(iterable) {
75
- var method;
76
-
77
- if (typeof Symbol !== "undefined") {
78
- if (Symbol.asyncIterator) method = iterable[Symbol.asyncIterator];
79
- if (method == null && Symbol.iterator) method = iterable[Symbol.iterator];
80
- }
81
-
82
- if (method == null) method = iterable["@@asyncIterator"];
83
- if (method == null) method = iterable["@@iterator"];
84
- if (method == null) throw new TypeError("Object is not async iterable");
85
- return method.call(iterable);
98
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
99
+ return typeof obj;
100
+ } : function (obj) {
101
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
102
+ }, _typeof(obj);
86
103
  }
87
104
 
88
105
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
@@ -140,6 +157,9 @@ function _defineProperties(target, props) {
140
157
  function _createClass(Constructor, protoProps, staticProps) {
141
158
  if (protoProps) _defineProperties(Constructor.prototype, protoProps);
142
159
  if (staticProps) _defineProperties(Constructor, staticProps);
160
+ Object.defineProperty(Constructor, "prototype", {
161
+ writable: false
162
+ });
143
163
  return Constructor;
144
164
  }
145
165
 
@@ -163,12 +183,15 @@ function _inherits(subClass, superClass) {
163
183
  throw new TypeError("Super expression must either be null or a function");
164
184
  }
165
185
 
166
- subClass.prototype = Object.create(superClass && superClass.prototype, {
167
- constructor: {
168
- value: subClass,
169
- writable: true,
170
- configurable: true
171
- }
186
+ Object.defineProperty(subClass, "prototype", {
187
+ value: Object.create(superClass && superClass.prototype, {
188
+ constructor: {
189
+ value: subClass,
190
+ writable: true,
191
+ configurable: true
192
+ }
193
+ }),
194
+ writable: false
172
195
  });
173
196
  if (superClass) _setPrototypeOf(subClass, superClass);
174
197
  }
@@ -1716,7 +1739,8 @@ function mixin(dest, source, copyFunc) {
1716
1739
  // toString() method that source inherited from Object.prototype
1717
1740
  s = source[name];
1718
1741
 
1719
- if (!(name in dest) || dest[name] !== s && (!(name in empty) || empty[name] !== s)) {
1742
+ if (!(name in dest) || // @ts-ignore
1743
+ dest[name] !== s && (!(name in empty) || empty[name] !== s)) {
1720
1744
  dest[name] = copyFunc ? copyFunc(s) : s;
1721
1745
  }
1722
1746
  }
@@ -2363,33 +2387,25 @@ function _fetchConfigFile() {
2363
2387
  case 2:
2364
2388
  result = _context3.sent;
2365
2389
 
2366
- if (!(typeof result !== 'string')) {
2367
- _context3.next = 5;
2368
- break;
2369
- }
2370
-
2371
- throw new Error("Error opening location: ".concat(location));
2372
-
2373
- case 5:
2374
2390
  if (!isUriLocation(location)) {
2375
- _context3.next = 7;
2391
+ _context3.next = 5;
2376
2392
  break;
2377
2393
  }
2378
2394
 
2379
2395
  return _context3.abrupt("return", parseJb1(result, location.uri));
2380
2396
 
2381
- case 7:
2397
+ case 5:
2382
2398
  if (!isLocalPathLocation(location)) {
2383
- _context3.next = 9;
2399
+ _context3.next = 7;
2384
2400
  break;
2385
2401
  }
2386
2402
 
2387
2403
  return _context3.abrupt("return", parseJb1(result, location.localPath));
2388
2404
 
2389
- case 9:
2405
+ case 7:
2390
2406
  return _context3.abrupt("return", parseJb1(result));
2391
2407
 
2392
- case 10:
2408
+ case 8:
2393
2409
  case "end":
2394
2410
  return _context3.stop();
2395
2411
  }
@@ -3076,9 +3092,7 @@ function convertTrackConfig(jb1TrackConfig, dataRoot, sequenceAdapter) {
3076
3092
  jb2TrackConfig.adapter = guessAdapter({
3077
3093
  uri: urlTemplate,
3078
3094
  locationType: 'UriLocation'
3079
- }, undefined, function () {
3080
- return urlTemplate;
3081
- });
3095
+ }, undefined, urlTemplate);
3082
3096
 
3083
3097
  if (!jb2TrackConfig.adapter) {
3084
3098
  throw new Error('Could not determine adapter');
@@ -3186,6 +3200,22 @@ var LegacyJBrowsePlugin = /*#__PURE__*/function (_Plugin) {
3186
3200
  }
3187
3201
  });
3188
3202
  });
3203
+ pluginManager.addToExtensionPoint('Core-guessAdapterForLocation', function (adapterGuesser) {
3204
+ return function (file, index, adapterHint) {
3205
+ var regexGuess = /trackData.jsonz?$/i;
3206
+ var adapterName = 'NCListAdapter';
3207
+ var fileName = getFileName(file);
3208
+
3209
+ if (regexGuess.test(fileName) || adapterHint === adapterName) {
3210
+ return {
3211
+ type: adapterName,
3212
+ rootUrlTemplate: file
3213
+ };
3214
+ }
3215
+
3216
+ return adapterGuesser(file, index, adapterHint);
3217
+ };
3218
+ });
3189
3219
  pluginManager.addTextSearchAdapterType(function () {
3190
3220
  return new TextSearchAdapterType({
3191
3221
  name: 'JBrowse1TextSearchAdapter',