@jbrowse/plugin-legacy-jbrowse 2.13.0 → 2.14.0

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.
@@ -8,9 +8,11 @@ const io_1 = require("@jbrowse/core/util/io");
8
8
  const jb1ConfigParse_1 = require("./jb1ConfigParse");
9
9
  const util_1 = require("./util");
10
10
  function isUriLocation(location) {
11
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
11
12
  return location.uri !== undefined;
12
13
  }
13
14
  function isLocalPathLocation(location) {
15
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
14
16
  return location.localPath !== undefined;
15
17
  }
16
18
  async function fetchJb1(
@@ -111,7 +113,7 @@ function mergeConfigs(a, b) {
111
113
  const aTracks = a[prop] || [];
112
114
  const bTracks = b[prop] || [];
113
115
  if (Array.isArray(aTracks) && Array.isArray(bTracks)) {
114
- a[prop] = mergeTrackConfigs(aTracks || [], bTracks || []);
116
+ a[prop] = mergeTrackConfigs(aTracks, bTracks);
115
117
  }
116
118
  else {
117
119
  throw new Error(`Track config has not been properly regularized: ${aTracks} ${bTracks}`);
@@ -181,7 +183,7 @@ async function loadIncludes(inputConfig) {
181
183
  throw new Error('Problem merging configs');
182
184
  }
183
185
  const includes = fillTemplates(regularizeIncludes(config.include || []), newUpstreamConf);
184
- delete config.include;
186
+ config.include = undefined;
185
187
  const loads = includes.map(async (include) => {
186
188
  include.cacheBuster = inputConfig.cacheBuster;
187
189
  const includedData = await fetchConfigFile({
@@ -221,7 +223,6 @@ function regularizeIncludes(includes) {
221
223
  return include;
222
224
  });
223
225
  }
224
- // eslint-disable-next-line @typescript-eslint/no-explicit-any,@typescript-eslint/no-unnecessary-type-constraint
225
226
  function fillTemplates(subconfig, config) {
226
227
  if (!subconfig) {
227
228
  return subconfig;
@@ -232,7 +233,6 @@ function fillTemplates(subconfig, config) {
232
233
  }
233
234
  }
234
235
  else if (typeof subconfig === 'object') {
235
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
236
236
  const sub = subconfig;
237
237
  for (const name of Object.keys(sub)) {
238
238
  sub[name] = fillTemplates(sub[name], config);
@@ -52,13 +52,13 @@ function parse(text, url) {
52
52
  let parsedValue;
53
53
  try {
54
54
  // parse json
55
- const match = value.match(/^json:(.+)/i);
55
+ const match = /^json:(.+)/i.exec(value);
56
56
  if (match) {
57
57
  parsedValue = JSON.parse(match[1]);
58
58
  }
59
59
  // parse numbers if it looks numeric
60
60
  else if (/^[+-]?[\d.,]+([eE][-+]?\d+)?$/.test(value)) {
61
- parsedValue = parseFloat(value.replaceAll(',', ''));
61
+ parsedValue = Number.parseFloat(value.replaceAll(',', ''));
62
62
  }
63
63
  else {
64
64
  parsedValue = value;
@@ -98,7 +98,7 @@ function parse(text, url) {
98
98
  const line = textLine.replace(/^\s*#.+/, '');
99
99
  // new section
100
100
  let match;
101
- if ((match = line.match(/^\s*\[([^\]]+)/))) {
101
+ if ((match = /^\s*\[([^\]]+)/.exec(line))) {
102
102
  // new section
103
103
  recordVal();
104
104
  keyPath = undefined;
@@ -120,14 +120,15 @@ function parse(text, url) {
120
120
  }
121
121
  // add to existing array value
122
122
  else if (keyPath !== undefined &&
123
- (match = line.match(/^\s{0,4}\+\s*(.+)/))) {
123
+ (match = /^\s{0,4}\+\s*(.+)/.exec(line))) {
124
124
  recordVal();
125
125
  operation = '+=';
126
126
  value = match[1].trim();
127
127
  }
128
128
  // add to existing value
129
- else if (value !== undefined && (match = line.match(/^\s+(\S.*)/))) {
130
- value += value.length ? ` ${match[1].trim()}` : match[1].trim();
129
+ else if (value !== undefined && (match = /^\s+(\S.*)/.exec(line))) {
130
+ const m = match[1];
131
+ value += value.length ? ` ${m.trim()}` : m.trim();
131
132
  }
132
133
  // done with last value
133
134
  else {
@@ -193,7 +194,7 @@ function regularizeConf(conf, url) {
193
194
  meta.sources = meta.sources.map((sourceDef) => {
194
195
  if (typeof sourceDef === 'string') {
195
196
  const newSourceDef = { url: sourceDef };
196
- const typeMatch = sourceDef.match(/\.(\w+)$/);
197
+ const typeMatch = /\.(\w+)$/.exec(sourceDef);
197
198
  if (typeMatch) {
198
199
  newSourceDef.type = typeMatch[1].toLowerCase();
199
200
  }
@@ -242,7 +243,7 @@ function regularizeConf(conf, url) {
242
243
  // config
243
244
  if (trackConfig.config) {
244
245
  const c = trackConfig.config;
245
- delete trackConfig.config;
246
+ trackConfig.config = undefined;
246
247
  trackConfig = { ...c, ...trackConfig };
247
248
  }
248
249
  // skip if it's a new-style track def
@@ -317,11 +317,9 @@ function convertTrackConfig(jb1TrackConfig, dataRoot, sequenceAdapter) {
317
317
  };
318
318
  }
319
319
  }
320
- // If we don't recognize the store class, make a best effort to guess by file type
320
+ // If we don't recognize the store class, make a best effort to guess by file
321
+ // type
321
322
  jb2TrackConfig.adapter = (0, tracks_1.guessAdapter)({ uri: urlTemplate, locationType: 'UriLocation' }, undefined, urlTemplate);
322
- if (!jb2TrackConfig.adapter) {
323
- throw new Error('Could not determine adapter');
324
- }
325
323
  if (jb2TrackConfig.adapter.type === tracks_1.UNSUPPORTED) {
326
324
  return (0, tracks_1.generateUnsupportedTrackConf)(jb2TrackConfig.name, urlTemplate, jb2TrackConfig.category);
327
325
  }
@@ -363,7 +361,7 @@ async function createRefSeqsAdapter(refSeqs) {
363
361
  }
364
362
  // check refseq urls
365
363
  if (refSeqs.url) {
366
- if (refSeqs.url.match(/.fai$/)) {
364
+ if (/.fai$/.exec(refSeqs.url)) {
367
365
  return {
368
366
  type: 'IndexedFastaAdapter',
369
367
  fastaLocation: {
@@ -376,16 +374,16 @@ async function createRefSeqsAdapter(refSeqs) {
376
374
  },
377
375
  };
378
376
  }
379
- if (refSeqs.url.match(/.2bit$/)) {
377
+ if (/.2bit$/.exec(refSeqs.url)) {
380
378
  return {
381
379
  type: 'TwoBitAdapter',
382
380
  twoBitLocation: { uri: refSeqs.url, locationType: 'UriLocation' },
383
381
  };
384
382
  }
385
- if (refSeqs.url.match(/.fa$/)) {
383
+ if (/.fa$/.exec(refSeqs.url)) {
386
384
  throw new Error('Unindexed FASTA adapter not available');
387
385
  }
388
- if (refSeqs.url.match(/.sizes/)) {
386
+ if (/.sizes/.exec(refSeqs.url)) {
389
387
  throw new Error('chromosome SIZES adapter not available');
390
388
  }
391
389
  const refSeqsJson = await (0, io_1.openLocation)({
@@ -46,9 +46,29 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
46
46
  connect(_arg: import("@jbrowse/core/configuration").AnyConfigurationModel): void;
47
47
  } & {
48
48
  afterAttach(): void;
49
- addTrackConf(trackConf: import("@jbrowse/core/configuration").AnyConfigurationModel): any;
50
- addTrackConfs(trackConfs: import("@jbrowse/core/configuration").AnyConfigurationModel[]): any[];
51
- setTrackConfs(trackConfs: import("@jbrowse/core/configuration").AnyConfigurationModel[]): import("mobx-state-tree").IMSTArray<import("mobx-state-tree").IAnyModelType> & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IArrayType<import("mobx-state-tree").IAnyModelType>>;
49
+ addTrackConf(trackConf: ({
50
+ [x: string]: any;
51
+ } & import("mobx-state-tree/dist/internal").NonEmptyObject & {
52
+ setSubschema(slotName: string, data: Record<string, unknown>): Record<string, unknown> | ({
53
+ [x: string]: any;
54
+ } & import("mobx-state-tree/dist/internal").NonEmptyObject & {
55
+ setSubschema(slotName: string, data: Record<string, unknown>): Record<string, unknown> | ({
56
+ [x: string]: any;
57
+ } & import("mobx-state-tree/dist/internal").NonEmptyObject & any & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>);
58
+ } & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>);
59
+ } & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>) | Record<string, unknown>): any;
60
+ addTrackConfs(trackConfs: (({
61
+ [x: string]: any;
62
+ } & import("mobx-state-tree/dist/internal").NonEmptyObject & {
63
+ setSubschema(slotName: string, data: Record<string, unknown>): Record<string, unknown> | ({
64
+ [x: string]: any;
65
+ } & import("mobx-state-tree/dist/internal").NonEmptyObject & {
66
+ setSubschema(slotName: string, data: Record<string, unknown>): Record<string, unknown> | ({
67
+ [x: string]: any;
68
+ } & import("mobx-state-tree/dist/internal").NonEmptyObject & any & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>);
69
+ } & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>);
70
+ } & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>) | Record<string, unknown>)[]): void;
71
+ setTrackConfs(trackConfs: import("@jbrowse/core/configuration").AnyConfigurationModel[]): void;
52
72
  clear(): void;
53
73
  } & {
54
74
  connect(): Promise<void>;
@@ -9,11 +9,9 @@ exports.deepUpdate = deepUpdate;
9
9
  exports.fillTemplate = fillTemplate;
10
10
  exports.clone = clone;
11
11
  const get_value_1 = __importDefault(require("get-value"));
12
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
13
12
  function isTrack(arg) {
14
13
  return (arg === null || arg === void 0 ? void 0 : arg.label) && typeof arg.label === 'string';
15
14
  }
16
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
17
15
  function isSource(arg) {
18
16
  return (arg === null || arg === void 0 ? void 0 : arg.url) && typeof arg.url === 'string';
19
17
  }
@@ -63,7 +61,6 @@ function fillTemplate(template, fillWith) {
63
61
  * (Lifted from dojo https://github.com/dojo/dojo/blob/master/_base/lang.js)
64
62
  * @param src - The object to clone
65
63
  */
66
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
67
64
  function clone(src) {
68
65
  if (!src ||
69
66
  typeof src !== 'object' ||
@@ -84,12 +81,10 @@ function clone(src) {
84
81
  return new RegExp(src); // RegExp
85
82
  }
86
83
  let r;
87
- let i;
88
- let l;
89
84
  if (Array.isArray(src)) {
90
85
  // array
91
86
  r = [];
92
- for (i = 0, l = src.length; i < l; ++i) {
87
+ for (let i = 0, l = src.length; i < l; ++i) {
93
88
  if (i in src) {
94
89
  r[i] = clone(src[i]);
95
90
  }
@@ -123,15 +118,13 @@ function clone(src) {
123
118
  * @returns dest, as modified
124
119
  */
125
120
  function mixin(dest, source, copyFunc) {
126
- let name;
127
- let s;
128
121
  const empty = {};
129
- for (name in source) {
122
+ for (const name in source) {
130
123
  // the (!(name in empty) || empty[name] !== s) condition avoids copying
131
124
  // properties in "source" inherited from Object.prototype. For example,
132
125
  // if dest has a custom toString() method, don't overwrite it with the
133
126
  // toString() method that source inherited from Object.prototype
134
- s = source[name];
127
+ const s = source[name];
135
128
  if (!(name in dest) ||
136
129
  // @ts-expect-error
137
130
  (dest[name] !== s && (!(name in empty) || empty[name] !== s))) {
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
7
7
  * Helper class allows reading names index generated in JBrowse1
8
8
  * Adapted from https://github.com/GMOD/jbrowse/blob/master/src/JBrowse/Store/Hash.js
9
9
  */
10
- const buffer_crc32_1 = __importDefault(require("buffer-crc32"));
10
+ const crc32_1 = __importDefault(require("crc/crc32"));
11
11
  class HttpMap {
12
12
  constructor(args) {
13
13
  // make sure url has a trailing slash
@@ -85,10 +85,7 @@ class HttpMap {
85
85
  return '';
86
86
  }
87
87
  hash(data) {
88
- return (0, buffer_crc32_1.default)(Buffer.from(data))
89
- .toString('hex')
90
- .toLowerCase()
91
- .replace('-', 'n');
88
+ return (0, crc32_1.default)(Buffer.from(data)).toString(16).toLowerCase().replace('-', 'n');
92
89
  }
93
90
  }
94
91
  exports.default = HttpMap;
@@ -41,7 +41,6 @@ class NCListAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
41
41
  observer.complete();
42
42
  });
43
43
  }
44
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
45
44
  wrapFeature(ncFeature) {
46
45
  return new NCListFeature_1.default(ncFeature, undefined, `${this.id}-${ncFeature.id()}`);
47
46
  }
@@ -6,9 +6,7 @@ const jb1ToJb2 = { seq_id: 'refName' };
6
6
  * wrapper to adapt nclist features to act like jbrowse 2 features
7
7
  */
8
8
  class NCListFeature {
9
- constructor(
10
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
11
- ncFeature, parent, id) {
9
+ constructor(ncFeature, parent, id) {
12
10
  this.ncFeature = ncFeature;
13
11
  this.uniqueId = id || ncFeature.id();
14
12
  this.parentHandle = parent;
@@ -26,11 +24,9 @@ class NCListFeature {
26
24
  // @ts-expect-error
27
25
  return jb1ToJb2[t] || t;
28
26
  }
29
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
30
27
  get(attrName) {
31
28
  const attr = this.ncFeature.get(this.jb2TagToJb1Tag(attrName));
32
29
  if (attr && attrName === 'subfeatures') {
33
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
34
30
  return attr.map((subfeature) => new NCListFeature(subfeature, this));
35
31
  }
36
32
  return attr;
@@ -2,9 +2,11 @@ import { openLocation } from '@jbrowse/core/util/io';
2
2
  import { parseJB1Json, parseJB1Conf, regularizeConf } from './jb1ConfigParse';
3
3
  import { clone, deepUpdate, fillTemplate } from './util';
4
4
  function isUriLocation(location) {
5
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
5
6
  return location.uri !== undefined;
6
7
  }
7
8
  function isLocalPathLocation(location) {
9
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
8
10
  return location.localPath !== undefined;
9
11
  }
10
12
  export async function fetchJb1(
@@ -105,7 +107,7 @@ function mergeConfigs(a, b) {
105
107
  const aTracks = a[prop] || [];
106
108
  const bTracks = b[prop] || [];
107
109
  if (Array.isArray(aTracks) && Array.isArray(bTracks)) {
108
- a[prop] = mergeTrackConfigs(aTracks || [], bTracks || []);
110
+ a[prop] = mergeTrackConfigs(aTracks, bTracks);
109
111
  }
110
112
  else {
111
113
  throw new Error(`Track config has not been properly regularized: ${aTracks} ${bTracks}`);
@@ -175,7 +177,7 @@ async function loadIncludes(inputConfig) {
175
177
  throw new Error('Problem merging configs');
176
178
  }
177
179
  const includes = fillTemplates(regularizeIncludes(config.include || []), newUpstreamConf);
178
- delete config.include;
180
+ config.include = undefined;
179
181
  const loads = includes.map(async (include) => {
180
182
  include.cacheBuster = inputConfig.cacheBuster;
181
183
  const includedData = await fetchConfigFile({
@@ -215,7 +217,6 @@ function regularizeIncludes(includes) {
215
217
  return include;
216
218
  });
217
219
  }
218
- // eslint-disable-next-line @typescript-eslint/no-explicit-any,@typescript-eslint/no-unnecessary-type-constraint
219
220
  function fillTemplates(subconfig, config) {
220
221
  if (!subconfig) {
221
222
  return subconfig;
@@ -226,7 +227,6 @@ function fillTemplates(subconfig, config) {
226
227
  }
227
228
  }
228
229
  else if (typeof subconfig === 'object') {
229
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
230
230
  const sub = subconfig;
231
231
  for (const name of Object.keys(sub)) {
232
232
  sub[name] = fillTemplates(sub[name], config);
@@ -44,13 +44,13 @@ function parse(text, url) {
44
44
  let parsedValue;
45
45
  try {
46
46
  // parse json
47
- const match = value.match(/^json:(.+)/i);
47
+ const match = /^json:(.+)/i.exec(value);
48
48
  if (match) {
49
49
  parsedValue = JSON.parse(match[1]);
50
50
  }
51
51
  // parse numbers if it looks numeric
52
52
  else if (/^[+-]?[\d.,]+([eE][-+]?\d+)?$/.test(value)) {
53
- parsedValue = parseFloat(value.replaceAll(',', ''));
53
+ parsedValue = Number.parseFloat(value.replaceAll(',', ''));
54
54
  }
55
55
  else {
56
56
  parsedValue = value;
@@ -90,7 +90,7 @@ function parse(text, url) {
90
90
  const line = textLine.replace(/^\s*#.+/, '');
91
91
  // new section
92
92
  let match;
93
- if ((match = line.match(/^\s*\[([^\]]+)/))) {
93
+ if ((match = /^\s*\[([^\]]+)/.exec(line))) {
94
94
  // new section
95
95
  recordVal();
96
96
  keyPath = undefined;
@@ -112,14 +112,15 @@ function parse(text, url) {
112
112
  }
113
113
  // add to existing array value
114
114
  else if (keyPath !== undefined &&
115
- (match = line.match(/^\s{0,4}\+\s*(.+)/))) {
115
+ (match = /^\s{0,4}\+\s*(.+)/.exec(line))) {
116
116
  recordVal();
117
117
  operation = '+=';
118
118
  value = match[1].trim();
119
119
  }
120
120
  // add to existing value
121
- else if (value !== undefined && (match = line.match(/^\s+(\S.*)/))) {
122
- value += value.length ? ` ${match[1].trim()}` : match[1].trim();
121
+ else if (value !== undefined && (match = /^\s+(\S.*)/.exec(line))) {
122
+ const m = match[1];
123
+ value += value.length ? ` ${m.trim()}` : m.trim();
123
124
  }
124
125
  // done with last value
125
126
  else {
@@ -185,7 +186,7 @@ export function regularizeConf(conf, url) {
185
186
  meta.sources = meta.sources.map((sourceDef) => {
186
187
  if (typeof sourceDef === 'string') {
187
188
  const newSourceDef = { url: sourceDef };
188
- const typeMatch = sourceDef.match(/\.(\w+)$/);
189
+ const typeMatch = /\.(\w+)$/.exec(sourceDef);
189
190
  if (typeMatch) {
190
191
  newSourceDef.type = typeMatch[1].toLowerCase();
191
192
  }
@@ -234,7 +235,7 @@ export function regularizeConf(conf, url) {
234
235
  // config
235
236
  if (trackConfig.config) {
236
237
  const c = trackConfig.config;
237
- delete trackConfig.config;
238
+ trackConfig.config = undefined;
238
239
  trackConfig = { ...c, ...trackConfig };
239
240
  }
240
241
  // skip if it's a new-style track def
@@ -313,11 +313,9 @@ export function convertTrackConfig(jb1TrackConfig, dataRoot, sequenceAdapter) {
313
313
  };
314
314
  }
315
315
  }
316
- // If we don't recognize the store class, make a best effort to guess by file type
316
+ // If we don't recognize the store class, make a best effort to guess by file
317
+ // type
317
318
  jb2TrackConfig.adapter = guessAdapter({ uri: urlTemplate, locationType: 'UriLocation' }, undefined, urlTemplate);
318
- if (!jb2TrackConfig.adapter) {
319
- throw new Error('Could not determine adapter');
320
- }
321
319
  if (jb2TrackConfig.adapter.type === UNSUPPORTED) {
322
320
  return generateUnsupportedTrackConf(jb2TrackConfig.name, urlTemplate, jb2TrackConfig.category);
323
321
  }
@@ -359,7 +357,7 @@ export async function createRefSeqsAdapter(refSeqs) {
359
357
  }
360
358
  // check refseq urls
361
359
  if (refSeqs.url) {
362
- if (refSeqs.url.match(/.fai$/)) {
360
+ if (/.fai$/.exec(refSeqs.url)) {
363
361
  return {
364
362
  type: 'IndexedFastaAdapter',
365
363
  fastaLocation: {
@@ -372,16 +370,16 @@ export async function createRefSeqsAdapter(refSeqs) {
372
370
  },
373
371
  };
374
372
  }
375
- if (refSeqs.url.match(/.2bit$/)) {
373
+ if (/.2bit$/.exec(refSeqs.url)) {
376
374
  return {
377
375
  type: 'TwoBitAdapter',
378
376
  twoBitLocation: { uri: refSeqs.url, locationType: 'UriLocation' },
379
377
  };
380
378
  }
381
- if (refSeqs.url.match(/.fa$/)) {
379
+ if (/.fa$/.exec(refSeqs.url)) {
382
380
  throw new Error('Unindexed FASTA adapter not available');
383
381
  }
384
- if (refSeqs.url.match(/.sizes/)) {
382
+ if (/.sizes/.exec(refSeqs.url)) {
385
383
  throw new Error('chromosome SIZES adapter not available');
386
384
  }
387
385
  const refSeqsJson = await openLocation({
@@ -46,9 +46,29 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
46
46
  connect(_arg: import("@jbrowse/core/configuration").AnyConfigurationModel): void;
47
47
  } & {
48
48
  afterAttach(): void;
49
- addTrackConf(trackConf: import("@jbrowse/core/configuration").AnyConfigurationModel): any;
50
- addTrackConfs(trackConfs: import("@jbrowse/core/configuration").AnyConfigurationModel[]): any[];
51
- setTrackConfs(trackConfs: import("@jbrowse/core/configuration").AnyConfigurationModel[]): import("mobx-state-tree").IMSTArray<import("mobx-state-tree").IAnyModelType> & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IArrayType<import("mobx-state-tree").IAnyModelType>>;
49
+ addTrackConf(trackConf: ({
50
+ [x: string]: any;
51
+ } & import("mobx-state-tree/dist/internal").NonEmptyObject & {
52
+ setSubschema(slotName: string, data: Record<string, unknown>): Record<string, unknown> | ({
53
+ [x: string]: any;
54
+ } & import("mobx-state-tree/dist/internal").NonEmptyObject & {
55
+ setSubschema(slotName: string, data: Record<string, unknown>): Record<string, unknown> | ({
56
+ [x: string]: any;
57
+ } & import("mobx-state-tree/dist/internal").NonEmptyObject & any & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>);
58
+ } & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>);
59
+ } & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>) | Record<string, unknown>): any;
60
+ addTrackConfs(trackConfs: (({
61
+ [x: string]: any;
62
+ } & import("mobx-state-tree/dist/internal").NonEmptyObject & {
63
+ setSubschema(slotName: string, data: Record<string, unknown>): Record<string, unknown> | ({
64
+ [x: string]: any;
65
+ } & import("mobx-state-tree/dist/internal").NonEmptyObject & {
66
+ setSubschema(slotName: string, data: Record<string, unknown>): Record<string, unknown> | ({
67
+ [x: string]: any;
68
+ } & import("mobx-state-tree/dist/internal").NonEmptyObject & any & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>);
69
+ } & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>);
70
+ } & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>) | Record<string, unknown>)[]): void;
71
+ setTrackConfs(trackConfs: import("@jbrowse/core/configuration").AnyConfigurationModel[]): void;
52
72
  clear(): void;
53
73
  } & {
54
74
  connect(): Promise<void>;
@@ -1,9 +1,7 @@
1
1
  import getValue from 'get-value';
2
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
3
2
  export function isTrack(arg) {
4
3
  return (arg === null || arg === void 0 ? void 0 : arg.label) && typeof arg.label === 'string';
5
4
  }
6
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
7
5
  export function isSource(arg) {
8
6
  return (arg === null || arg === void 0 ? void 0 : arg.url) && typeof arg.url === 'string';
9
7
  }
@@ -53,7 +51,6 @@ export function fillTemplate(template, fillWith) {
53
51
  * (Lifted from dojo https://github.com/dojo/dojo/blob/master/_base/lang.js)
54
52
  * @param src - The object to clone
55
53
  */
56
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
57
54
  export function clone(src) {
58
55
  if (!src ||
59
56
  typeof src !== 'object' ||
@@ -74,12 +71,10 @@ export function clone(src) {
74
71
  return new RegExp(src); // RegExp
75
72
  }
76
73
  let r;
77
- let i;
78
- let l;
79
74
  if (Array.isArray(src)) {
80
75
  // array
81
76
  r = [];
82
- for (i = 0, l = src.length; i < l; ++i) {
77
+ for (let i = 0, l = src.length; i < l; ++i) {
83
78
  if (i in src) {
84
79
  r[i] = clone(src[i]);
85
80
  }
@@ -113,15 +108,13 @@ export function clone(src) {
113
108
  * @returns dest, as modified
114
109
  */
115
110
  function mixin(dest, source, copyFunc) {
116
- let name;
117
- let s;
118
111
  const empty = {};
119
- for (name in source) {
112
+ for (const name in source) {
120
113
  // the (!(name in empty) || empty[name] !== s) condition avoids copying
121
114
  // properties in "source" inherited from Object.prototype. For example,
122
115
  // if dest has a custom toString() method, don't overwrite it with the
123
116
  // toString() method that source inherited from Object.prototype
124
- s = source[name];
117
+ const s = source[name];
125
118
  if (!(name in dest) ||
126
119
  // @ts-expect-error
127
120
  (dest[name] !== s && (!(name in empty) || empty[name] !== s))) {
@@ -2,7 +2,7 @@
2
2
  * Helper class allows reading names index generated in JBrowse1
3
3
  * Adapted from https://github.com/GMOD/jbrowse/blob/master/src/JBrowse/Store/Hash.js
4
4
  */
5
- import crc32 from 'buffer-crc32';
5
+ import crc32 from 'crc/crc32';
6
6
  export default class HttpMap {
7
7
  constructor(args) {
8
8
  // make sure url has a trailing slash
@@ -80,9 +80,6 @@ export default class HttpMap {
80
80
  return '';
81
81
  }
82
82
  hash(data) {
83
- return crc32(Buffer.from(data))
84
- .toString('hex')
85
- .toLowerCase()
86
- .replace('-', 'n');
83
+ return crc32(Buffer.from(data)).toString(16).toLowerCase().replace('-', 'n');
87
84
  }
88
85
  }
@@ -36,7 +36,6 @@ export default class NCListAdapter extends BaseFeatureDataAdapter {
36
36
  observer.complete();
37
37
  });
38
38
  }
39
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
40
39
  wrapFeature(ncFeature) {
41
40
  return new NCListFeature(ncFeature, undefined, `${this.id}-${ncFeature.id()}`);
42
41
  }
@@ -4,9 +4,7 @@ const jb1ToJb2 = { seq_id: 'refName' };
4
4
  * wrapper to adapt nclist features to act like jbrowse 2 features
5
5
  */
6
6
  export default class NCListFeature {
7
- constructor(
8
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
9
- ncFeature, parent, id) {
7
+ constructor(ncFeature, parent, id) {
10
8
  this.ncFeature = ncFeature;
11
9
  this.uniqueId = id || ncFeature.id();
12
10
  this.parentHandle = parent;
@@ -24,11 +22,9 @@ export default class NCListFeature {
24
22
  // @ts-expect-error
25
23
  return jb1ToJb2[t] || t;
26
24
  }
27
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
28
25
  get(attrName) {
29
26
  const attr = this.ncFeature.get(this.jb2TagToJb1Tag(attrName));
30
27
  if (attr && attrName === 'subfeatures') {
31
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
32
28
  return attr.map((subfeature) => new NCListFeature(subfeature, this));
33
29
  }
34
30
  return attr;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/plugin-legacy-jbrowse",
3
- "version": "2.13.0",
3
+ "version": "2.14.0",
4
4
  "description": "JBrowse 2 plugin for connecting to and reading JBrowse 1 data",
5
5
  "keywords": [
6
6
  "jbrowse",
@@ -24,7 +24,7 @@
24
24
  ],
25
25
  "scripts": {
26
26
  "build": "npm-run-all build:*",
27
- "test": "cd ../..; jest plugins/legacy-jbrowse",
27
+ "test": "cd ../..; jest --passWithNoTests plugins/legacy-jbrowse",
28
28
  "prepublishOnly": "yarn test",
29
29
  "prepack": "yarn build && yarn useDist",
30
30
  "postpack": "yarn useSrc",
@@ -37,7 +37,7 @@
37
37
  },
38
38
  "dependencies": {
39
39
  "@gmod/nclist": "^1.0.3",
40
- "buffer-crc32": "^1.0.0",
40
+ "crc": "^4.0.0",
41
41
  "generic-filehandle": "^3.0.0",
42
42
  "get-value": "^3.0.1",
43
43
  "set-value": "^4.0.1"
@@ -55,5 +55,5 @@
55
55
  "distModule": "esm/index.js",
56
56
  "srcModule": "src/index.ts",
57
57
  "module": "esm/index.js",
58
- "gitHead": "efe02fb9616e20e929cceeed46eb96420c1b6923"
58
+ "gitHead": "9fb8231d932db40adf0a283081765431756c66ff"
59
59
  }