@jbrowse/plugin-legacy-jbrowse 2.16.1 → 2.18.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.
Files changed (65) hide show
  1. package/dist/GuessNCList/index.d.ts +1 -1
  2. package/dist/JBrowse1Connection/configSchema.d.ts +0 -6
  3. package/dist/JBrowse1Connection/configSchema.js +2 -14
  4. package/dist/JBrowse1Connection/index.d.ts +1 -1
  5. package/dist/JBrowse1Connection/index.js +1 -2
  6. package/dist/JBrowse1Connection/jb1ConfigLoad.d.ts +1 -1
  7. package/dist/JBrowse1Connection/jb1ConfigLoad.js +5 -44
  8. package/dist/JBrowse1Connection/jb1ConfigParse.d.ts +1 -8
  9. package/dist/JBrowse1Connection/jb1ConfigParse.js +1 -41
  10. package/dist/JBrowse1Connection/jb1ToJb2.d.ts +1 -1
  11. package/dist/JBrowse1Connection/jb1ToJb2.js +1 -5
  12. package/dist/JBrowse1Connection/model.d.ts +5 -5
  13. package/dist/JBrowse1Connection/model.js +1 -3
  14. package/dist/JBrowse1Connection/util.d.ts +2 -21
  15. package/dist/JBrowse1Connection/util.js +9 -58
  16. package/dist/JBrowse1TextSearchAdapter/HttpMap.d.ts +0 -20
  17. package/dist/JBrowse1TextSearchAdapter/HttpMap.js +1 -27
  18. package/dist/JBrowse1TextSearchAdapter/JBrowse1TextSearchAdapter.d.ts +5 -9
  19. package/dist/JBrowse1TextSearchAdapter/JBrowse1TextSearchAdapter.js +1 -7
  20. package/dist/JBrowse1TextSearchAdapter/configSchema.d.ts +0 -9
  21. package/dist/JBrowse1TextSearchAdapter/configSchema.js +1 -17
  22. package/dist/JBrowse1TextSearchAdapter/index.d.ts +1 -1
  23. package/dist/JBrowse1TextSearchAdapter/index.js +0 -1
  24. package/dist/NCListAdapter/NCListAdapter.d.ts +7 -22
  25. package/dist/NCListAdapter/NCListAdapter.js +3 -19
  26. package/dist/NCListAdapter/NCListFeature.d.ts +1 -16
  27. package/dist/NCListAdapter/NCListFeature.js +0 -19
  28. package/dist/NCListAdapter/configSchema.d.ts +0 -6
  29. package/dist/NCListAdapter/configSchema.js +1 -10
  30. package/dist/NCListAdapter/index.d.ts +1 -1
  31. package/dist/index.d.ts +1 -1
  32. package/dist/index.js +3 -3
  33. package/esm/GuessNCList/index.d.ts +1 -1
  34. package/esm/JBrowse1Connection/configSchema.d.ts +0 -6
  35. package/esm/JBrowse1Connection/configSchema.js +2 -14
  36. package/esm/JBrowse1Connection/index.d.ts +1 -1
  37. package/esm/JBrowse1Connection/index.js +1 -2
  38. package/esm/JBrowse1Connection/jb1ConfigLoad.d.ts +1 -1
  39. package/esm/JBrowse1Connection/jb1ConfigLoad.js +7 -46
  40. package/esm/JBrowse1Connection/jb1ConfigParse.d.ts +1 -8
  41. package/esm/JBrowse1Connection/jb1ConfigParse.js +1 -41
  42. package/esm/JBrowse1Connection/jb1ToJb2.d.ts +1 -1
  43. package/esm/JBrowse1Connection/jb1ToJb2.js +2 -6
  44. package/esm/JBrowse1Connection/model.d.ts +5 -5
  45. package/esm/JBrowse1Connection/model.js +1 -3
  46. package/esm/JBrowse1Connection/util.d.ts +2 -21
  47. package/esm/JBrowse1Connection/util.js +8 -57
  48. package/esm/JBrowse1TextSearchAdapter/HttpMap.d.ts +0 -20
  49. package/esm/JBrowse1TextSearchAdapter/HttpMap.js +1 -27
  50. package/esm/JBrowse1TextSearchAdapter/JBrowse1TextSearchAdapter.d.ts +5 -9
  51. package/esm/JBrowse1TextSearchAdapter/JBrowse1TextSearchAdapter.js +2 -8
  52. package/esm/JBrowse1TextSearchAdapter/configSchema.d.ts +0 -9
  53. package/esm/JBrowse1TextSearchAdapter/configSchema.js +1 -17
  54. package/esm/JBrowse1TextSearchAdapter/index.d.ts +1 -1
  55. package/esm/JBrowse1TextSearchAdapter/index.js +0 -1
  56. package/esm/NCListAdapter/NCListAdapter.d.ts +7 -22
  57. package/esm/NCListAdapter/NCListAdapter.js +4 -20
  58. package/esm/NCListAdapter/NCListFeature.d.ts +1 -16
  59. package/esm/NCListAdapter/NCListFeature.js +0 -19
  60. package/esm/NCListAdapter/configSchema.d.ts +0 -6
  61. package/esm/NCListAdapter/configSchema.js +1 -10
  62. package/esm/NCListAdapter/index.d.ts +1 -1
  63. package/esm/index.d.ts +1 -1
  64. package/esm/index.js +3 -3
  65. package/package.json +2 -2
@@ -1,13 +1,7 @@
1
- import { baseConnectionConfig } from '@jbrowse/core/pluggableElementTypes/models';
2
1
  import { ConfigurationSchema } from '@jbrowse/core/configuration';
3
- /**
4
- * #config JBrowse1Connection
5
- */
6
- function x() { } // eslint-disable-line @typescript-eslint/no-unused-vars
2
+ import { baseConnectionConfig } from '@jbrowse/core/pluggableElementTypes/models';
3
+ function x() { }
7
4
  const JBrowse1Connection = ConfigurationSchema('JBrowse1Connection', {
8
- /**
9
- * #slot
10
- */
11
5
  dataDirLocation: {
12
6
  type: 'fileLocation',
13
7
  defaultValue: {
@@ -16,18 +10,12 @@ const JBrowse1Connection = ConfigurationSchema('JBrowse1Connection', {
16
10
  },
17
11
  description: 'the location of the JBrowse 1 data directory, often something like http://mysite.com/jbrowse/data/',
18
12
  },
19
- /**
20
- * #slot
21
- */
22
13
  assemblyNames: {
23
14
  description: 'name of the assembly the connection belongs to, should be a single entry',
24
15
  type: 'stringArray',
25
16
  defaultValue: [],
26
17
  },
27
18
  }, {
28
- /**
29
- * #baseConfiguration
30
- */
31
19
  baseConfiguration: baseConnectionConfig,
32
20
  });
33
21
  export default JBrowse1Connection;
@@ -1,2 +1,2 @@
1
- import PluginManager from '@jbrowse/core/PluginManager';
1
+ import type PluginManager from '@jbrowse/core/PluginManager';
2
2
  export default function JBrowse1ConnectionF(pluginManager: PluginManager): void;
@@ -1,7 +1,6 @@
1
1
  import ConnectionType from '@jbrowse/core/pluggableElementTypes/ConnectionType';
2
- // locals
3
- import modelFactory from './model';
4
2
  import configSchema from './configSchema';
3
+ import modelFactory from './model';
5
4
  export default function JBrowse1ConnectionF(pluginManager) {
6
5
  pluginManager.addConnectionType(() => new ConnectionType({
7
6
  name: 'JBrowse1Connection',
@@ -1,4 +1,4 @@
1
- import { JBLocation, Config } from './types';
1
+ import type { Config, JBLocation } from './types';
2
2
  export declare function fetchJb1(dataRoot?: JBLocation, baseConfig?: Config, baseConfigRoot?: JBLocation): Promise<Config>;
3
3
  export declare function createFinalConfig(baseConfig: Config, defaults?: {
4
4
  tracks: never[];
@@ -1,23 +1,15 @@
1
1
  import { openLocation } from '@jbrowse/core/util/io';
2
- import { parseJB1Json, parseJB1Conf, regularizeConf } from './jb1ConfigParse';
3
- import { clone, deepUpdate, fillTemplate } from './util';
2
+ import { parseJB1Conf, parseJB1Json, regularizeConf } from './jb1ConfigParse';
3
+ import { deepUpdate, fillTemplate } from './util';
4
4
  function isUriLocation(location) {
5
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
6
5
  return location.uri !== undefined;
7
6
  }
8
7
  function isLocalPathLocation(location) {
9
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
10
8
  return location.localPath !== undefined;
11
9
  }
12
- export async function fetchJb1(
13
- // eslint-disable-next-line unicorn/no-object-as-default-parameter
14
- dataRoot = { uri: '', locationType: 'UriLocation' },
15
- // eslint-disable-next-line unicorn/no-object-as-default-parameter
16
- baseConfig = {
10
+ export async function fetchJb1(dataRoot = { uri: '', locationType: 'UriLocation' }, baseConfig = {
17
11
  include: ['{dataRoot}/trackList.json', '{dataRoot}/tracks.conf'],
18
- },
19
- // eslint-disable-next-line unicorn/no-object-as-default-parameter
20
- baseConfigRoot = { uri: '', locationType: 'UriLocation' }) {
12
+ }, baseConfigRoot = { uri: '', locationType: 'UriLocation' }) {
21
13
  const protocol = 'uri' in dataRoot ? 'uri' : 'localPath';
22
14
  const dataRootReg = JSON.parse(JSON.stringify(dataRoot));
23
15
  let dataRootLocation = '';
@@ -47,7 +39,6 @@ baseConfigRoot = { uri: '', locationType: 'UriLocation' }) {
47
39
  for (const conf of ['jbrowse.conf', 'jbrowse_conf.json']) {
48
40
  let fetchedConfig = null;
49
41
  try {
50
- // @ts-expect-error
51
42
  fetchedConfig = await fetchConfigFile({
52
43
  [baseProtocol]: `${baseConfigLocation}/${conf}`,
53
44
  });
@@ -69,7 +60,7 @@ baseConfigRoot = { uri: '', locationType: 'UriLocation' }) {
69
60
  return createFinalConfig(newConfig);
70
61
  }
71
62
  export async function createFinalConfig(baseConfig, defaults = configDefaults) {
72
- const configWithDefaults = deepUpdate(clone(defaults), baseConfig);
63
+ const configWithDefaults = deepUpdate(structuredClone(defaults), baseConfig);
73
64
  let finalConfig = await loadIncludes(configWithDefaults);
74
65
  finalConfig = mergeConfigs(finalConfig, baseConfig) || finalConfig;
75
66
  fillTemplates(finalConfig, finalConfig);
@@ -92,9 +83,6 @@ export function parseJb1(config, url = '') {
92
83
  }
93
84
  return parseJB1Conf(config, url);
94
85
  }
95
- /**
96
- * Merges config object b into a. Properties in b override those in a.
97
- */
98
86
  function mergeConfigs(a, b) {
99
87
  if (b === null) {
100
88
  return null;
@@ -115,11 +103,8 @@ function mergeConfigs(a, b) {
115
103
  }
116
104
  else if (!noRecursiveMerge(prop) &&
117
105
  prop in a &&
118
- // @ts-expect-error
119
106
  typeof b[prop] === 'object' &&
120
- // @ts-expect-error
121
107
  typeof a[prop] === 'object') {
122
- // @ts-expect-error
123
108
  a[prop] = deepUpdate(a[prop], b[prop]);
124
109
  }
125
110
  else if (prop === 'dataRoot') {
@@ -127,23 +112,17 @@ function mergeConfigs(a, b) {
127
112
  (a[prop] === 'data' && b[prop] !== undefined)) {
128
113
  a[prop] = b[prop];
129
114
  }
130
- // @ts-expect-error
131
115
  }
132
116
  else if (a[prop] === undefined || b[prop] !== undefined) {
133
- // @ts-expect-error
134
117
  a[prop] = b[prop];
135
118
  }
136
119
  }
137
120
  return a;
138
121
  }
139
- /**
140
- * Special-case merging of two `tracks` configuration arrays.
141
- */
142
122
  function mergeTrackConfigs(a, b) {
143
123
  if (!b.length) {
144
124
  return a;
145
125
  }
146
- // index the tracks in `a` by track label
147
126
  const aTracks = {};
148
127
  a.forEach((t, i) => {
149
128
  t.index = i;
@@ -160,19 +139,14 @@ function mergeTrackConfigs(a, b) {
160
139
  });
161
140
  return a;
162
141
  }
163
- /**
164
- * Recursively fetch, parse, and merge all the includes in the given config
165
- * object. Calls the callback with the resulting configuration when finished.
166
- * @param inputConfig - Config to load includes into
167
- */
168
142
  async function loadIncludes(inputConfig) {
169
- inputConfig = clone(inputConfig);
143
+ inputConfig = structuredClone(inputConfig);
170
144
  async function loadRecur(config, upstreamConf) {
171
145
  const sourceUrl = config.sourceUrl || config.baseUrl;
172
146
  if (!sourceUrl) {
173
147
  throw new Error(`Could not determine source URL: ${JSON.stringify(config)}`);
174
148
  }
175
- const newUpstreamConf = mergeConfigs(clone(upstreamConf), config);
149
+ const newUpstreamConf = mergeConfigs(structuredClone(upstreamConf), config);
176
150
  if (!newUpstreamConf) {
177
151
  throw new Error('Problem merging configs');
178
152
  }
@@ -198,16 +172,13 @@ function regularizeIncludes(includes) {
198
172
  if (!includes) {
199
173
  return [];
200
174
  }
201
- // coerce include to an array
202
175
  if (!Array.isArray(includes)) {
203
176
  includes = [includes];
204
177
  }
205
178
  return includes.map((include) => {
206
- // coerce bare strings in the includes to URLs
207
179
  if (typeof include === 'string') {
208
180
  include = { url: include };
209
181
  }
210
- // set defaults for format and version
211
182
  if (!('format' in include)) {
212
183
  include.format = include.url.endsWith('.conf') ? 'conf' : 'JB_json';
213
184
  }
@@ -233,15 +204,10 @@ function fillTemplates(subconfig, config) {
233
204
  }
234
205
  }
235
206
  else if (typeof subconfig === 'string') {
236
- // @ts-expect-error
237
207
  return fillTemplate(subconfig, config);
238
208
  }
239
209
  return subconfig;
240
210
  }
241
- /**
242
- * list of config properties that should not be recursively merged
243
- * @param propName - name of config property
244
- */
245
211
  function noRecursiveMerge(propName) {
246
212
  return propName === 'datasets';
247
213
  }
@@ -271,11 +237,6 @@ const configDefaults = {
271
237
  highlightSearchedRegions: false,
272
238
  highResolutionMode: 'auto',
273
239
  };
274
- /**
275
- * Examine the loaded and merged configuration for errors. Throws
276
- * exceptions if it finds anything amiss.
277
- * @returns nothing meaningful
278
- */
279
240
  function validateConfig(config) {
280
241
  if (!config.tracks) {
281
242
  config.tracks = [];
@@ -1,11 +1,4 @@
1
- import { Config } from './types';
1
+ import type { Config } from './types';
2
2
  export declare function parseJB1Json(config: Config | string, url: string): Config;
3
3
  export declare function parseJB1Conf(config: string, url: string): Config;
4
- /**
5
- * Applies defaults and any other necessary tweaks to the loaded configuration.
6
- * @param conf - the object containing the configuration, which it modifies
7
- * in-place
8
- * @param url - URL of the config file
9
- * @returns the same object it was passed
10
- */
11
4
  export declare function regularizeConf(conf: Config, url: string): Config;
@@ -1,7 +1,6 @@
1
- /* eslint no-cond-assign: ["error", "except-parens"] */
1
+ import { objectHash } from '@jbrowse/core/util';
2
2
  import getValue from 'get-value';
3
3
  import setValue from 'set-value';
4
- import { objectHash } from '@jbrowse/core/util';
5
4
  import { isSource, isTrack } from './util';
6
5
  export function parseJB1Json(config, url) {
7
6
  if (typeof config === 'string') {
@@ -43,12 +42,10 @@ function parse(text, url) {
43
42
  if (value !== undefined) {
44
43
  let parsedValue;
45
44
  try {
46
- // parse json
47
45
  const match = /^json:(.+)/i.exec(value);
48
46
  if (match) {
49
47
  parsedValue = JSON.parse(match[1]);
50
48
  }
51
- // parse numbers if it looks numeric
52
49
  else if (/^[+-]?[\d.,]+([eE][-+]?\d+)?$/.test(value)) {
53
50
  parsedValue = Number.parseFloat(value.replaceAll(',', ''));
54
51
  }
@@ -88,10 +85,8 @@ function parse(text, url) {
88
85
  text.split(/\n|\r\n|\r/).forEach((textLine, i) => {
89
86
  lineNumber = i + 1;
90
87
  const line = textLine.replace(/^\s*#.+/, '');
91
- // new section
92
88
  let match;
93
89
  if ((match = /^\s*\[([^\]]+)/.exec(line))) {
94
- // new section
95
90
  recordVal();
96
91
  keyPath = undefined;
97
92
  value = undefined;
@@ -100,7 +95,6 @@ function parse(text, url) {
100
95
  section = [];
101
96
  }
102
97
  }
103
- // new value
104
98
  else if ((match = line.match(value === undefined ? /^([^+=]+)(\+?=)(.*)/ : /^(\S[^+=]+)(\+?=)(.*)/))) {
105
99
  recordVal();
106
100
  keyPath = match[1].trim().split(/\s*\.\s*/);
@@ -110,19 +104,16 @@ function parse(text, url) {
110
104
  }
111
105
  value = match[3].trim();
112
106
  }
113
- // add to existing array value
114
107
  else if (keyPath !== undefined &&
115
108
  (match = /^\s{0,4}\+\s*(.+)/.exec(line))) {
116
109
  recordVal();
117
110
  operation = '+=';
118
111
  value = match[1].trim();
119
112
  }
120
- // add to existing value
121
113
  else if (value !== undefined && (match = /^\s+(\S.*)/.exec(line))) {
122
114
  const m = match[1];
123
115
  value += value.length ? ` ${m.trim()}` : m.trim();
124
116
  }
125
- // done with last value
126
117
  else {
127
118
  recordVal();
128
119
  keyPath = undefined;
@@ -132,21 +123,11 @@ function parse(text, url) {
132
123
  recordVal();
133
124
  return data;
134
125
  }
135
- /**
136
- * Applies defaults and any other necessary tweaks to the loaded configuration.
137
- * @param conf - the object containing the configuration, which it modifies
138
- * in-place
139
- * @param url - URL of the config file
140
- * @returns the same object it was passed
141
- */
142
126
  export function regularizeConf(conf, url) {
143
- // if tracks is not an array, convert it to one
144
127
  if (conf.tracks && !Array.isArray(conf.tracks)) {
145
- // if it's a single track config, wrap it in an arrayref
146
128
  if (isTrack(conf.tracks)) {
147
129
  conf.tracks = [conf.tracks];
148
130
  }
149
- // otherwise, coerce it to an array
150
131
  else {
151
132
  const tracks = [];
152
133
  for (const label of Object.keys(conf.tracks)) {
@@ -161,10 +142,8 @@ export function regularizeConf(conf, url) {
161
142
  conf.tracks = tracks;
162
143
  }
163
144
  }
164
- // regularize trackMetadata.sources
165
145
  const meta = conf.trackMetadata;
166
146
  if (meta === null || meta === void 0 ? void 0 : meta.sources) {
167
- // if it's a single source config, wrap it in an arrayref
168
147
  if (typeof meta.sources === 'string') {
169
148
  meta.sources = [meta.sources];
170
149
  }
@@ -182,7 +161,6 @@ export function regularizeConf(conf, url) {
182
161
  }
183
162
  meta.sources = sources;
184
163
  }
185
- // coerce any string source defs to be URLs, and try to detect their types
186
164
  meta.sources = meta.sources.map((sourceDef) => {
187
165
  if (typeof sourceDef === 'string') {
188
166
  const newSourceDef = { url: sourceDef };
@@ -204,8 +182,6 @@ export function regularizeConf(conf, url) {
204
182
  conf.baseUrl += '/';
205
183
  }
206
184
  if (conf.sourceUrl) {
207
- // set a default baseUrl in each of the track and store confs, and the names
208
- // conf, if needed
209
185
  const addBase = [];
210
186
  if (conf.tracks) {
211
187
  addBase.push(...conf.tracks);
@@ -221,7 +197,6 @@ export function regularizeConf(conf, url) {
221
197
  t.baseUrl = conf.baseUrl || '/';
222
198
  }
223
199
  });
224
- // resolve the refSeqs and nameUrl if present
225
200
  if (conf.refSeqs && typeof conf.refSeqs === 'string') {
226
201
  conf.refSeqs = new URL(conf.refSeqs, conf.sourceUrl).href;
227
202
  }
@@ -231,14 +206,11 @@ export function regularizeConf(conf, url) {
231
206
  }
232
207
  conf.stores = conf.stores || {};
233
208
  (conf.tracks || []).forEach((trackConfig) => {
234
- // if there is a `config` subpart, just copy its keys in to the top-level
235
- // config
236
209
  if (trackConfig.config) {
237
210
  const c = trackConfig.config;
238
211
  trackConfig.config = undefined;
239
212
  trackConfig = { ...c, ...trackConfig };
240
213
  }
241
- // skip if it's a new-style track def
242
214
  if (trackConfig.store) {
243
215
  return;
244
216
  }
@@ -269,11 +241,6 @@ export function regularizeConf(conf, url) {
269
241
  });
270
242
  return conf;
271
243
  }
272
- /**
273
- * prefix class name with `root` if it contains no slashes
274
- * @param root - Prefix root
275
- * @param className - class name
276
- */
277
244
  function regularizeClass(root, className) {
278
245
  if (!className) {
279
246
  return '';
@@ -338,8 +305,6 @@ function guessStoreClass(trackConfig, urlTemplate) {
338
305
  }
339
306
  function synthesizeTrackStoreConfig(mainConf, trackConfig) {
340
307
  var _a;
341
- // figure out what data store class to use with the track, applying some
342
- // defaults if it is not explicit in the configuration
343
308
  const { urlTemplate = '' } = trackConfig;
344
309
  const storeClass = trackConfig.storeClass
345
310
  ? regularizeClass('JBrowse/Store', trackConfig.storeClass)
@@ -348,10 +313,7 @@ function synthesizeTrackStoreConfig(mainConf, trackConfig) {
348
313
  console.warn(`Unable to determine an appropriate data store to use with track '${trackConfig.label}', please explicitly specify a storeClass in the configuration.`);
349
314
  return;
350
315
  }
351
- // synthesize a separate store conf
352
316
  const storeConf = { ...trackConfig, type: storeClass };
353
- // if this is the first sequence store we see, and we have no refseqs store
354
- // defined explicitly, make this the refseqs store.
355
317
  storeConf.name =
356
318
  (storeClass === 'JBrowse/Store/Sequence/StaticChunked' ||
357
319
  storeClass === 'JBrowse/Store/Sequence/IndexedFasta' ||
@@ -363,11 +325,9 @@ function synthesizeTrackStoreConfig(mainConf, trackConfig) {
363
325
  !((_a = mainConf.stores) === null || _a === void 0 ? void 0 : _a.refseqs)
364
326
  ? 'refseqs'
365
327
  : `store${objectHash(storeConf)}`;
366
- // record it
367
328
  if (!mainConf.stores) {
368
329
  mainConf.stores = {};
369
330
  }
370
331
  mainConf.stores[storeConf.name] = storeConf;
371
- // connect it to the track conf
372
332
  trackConfig.store = storeConf.name;
373
333
  }
@@ -1,4 +1,4 @@
1
- import { Track, RefSeqs } from './types';
1
+ import type { RefSeqs, Track } from './types';
2
2
  interface Jb2Track {
3
3
  trackId: string;
4
4
  name: string;
@@ -1,6 +1,6 @@
1
- import { openLocation } from '@jbrowse/core/util/io';
2
1
  import { objectHash } from '@jbrowse/core/util';
3
- import { generateUnknownTrackConf, generateUnsupportedTrackConf, guessAdapter, guessTrackType, UNKNOWN, UNSUPPORTED, } from '@jbrowse/core/util/tracks';
2
+ import { openLocation } from '@jbrowse/core/util/io';
3
+ import { UNKNOWN, UNSUPPORTED, generateUnknownTrackConf, generateUnsupportedTrackConf, guessAdapter, guessTrackType, } from '@jbrowse/core/util/tracks';
4
4
  export function convertTrackConfig(jb1TrackConfig, dataRoot, sequenceAdapter) {
5
5
  var _a, _b, _c, _d, _e;
6
6
  const jb2TrackConfig = {
@@ -313,8 +313,6 @@ 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
317
- // type
318
316
  jb2TrackConfig.adapter = guessAdapter({ uri: urlTemplate, locationType: 'UriLocation' }, undefined, urlTemplate);
319
317
  if (jb2TrackConfig.adapter.type === UNSUPPORTED) {
320
318
  return generateUnsupportedTrackConf(jb2TrackConfig.name, urlTemplate, jb2TrackConfig.category);
@@ -350,12 +348,10 @@ function generateFromConfigTrackConfig(jb1TrackConfig, jb2TrackConfig) {
350
348
  }
351
349
  export async function createRefSeqsAdapter(refSeqs) {
352
350
  if (typeof refSeqs === 'string') {
353
- // assume refSeqs is a url if it is string
354
351
  refSeqs = {
355
352
  url: refSeqs,
356
353
  };
357
354
  }
358
- // check refseq urls
359
355
  if (refSeqs.url) {
360
356
  if (/.fai$/.exec(refSeqs.url)) {
361
357
  return {
@@ -1,4 +1,4 @@
1
- import PluginManager from '@jbrowse/core/PluginManager';
1
+ import type PluginManager from '@jbrowse/core/PluginManager';
2
2
  export default function stateModelFactory(pluginManager: PluginManager): import("mobx-state-tree").IModelType<{
3
3
  name: import("mobx-state-tree").ISimpleType<string>;
4
4
  tracks: import("mobx-state-tree").IArrayType<import("mobx-state-tree").IAnyModelType>;
@@ -46,7 +46,7 @@ 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: ({
49
+ addTrackConf(trackConf: Record<string, unknown> | ({
50
50
  [x: string]: any;
51
51
  } & import("mobx-state-tree/dist/internal").NonEmptyObject & {
52
52
  setSubschema(slotName: string, data: Record<string, unknown>): Record<string, unknown> | ({
@@ -56,8 +56,8 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
56
56
  [x: string]: any;
57
57
  } & import("mobx-state-tree/dist/internal").NonEmptyObject & any & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>);
58
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: (({
59
+ } & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>)): any;
60
+ addTrackConfs(trackConfs: (Record<string, unknown> | ({
61
61
  [x: string]: any;
62
62
  } & import("mobx-state-tree/dist/internal").NonEmptyObject & {
63
63
  setSubschema(slotName: string, data: Record<string, unknown>): Record<string, unknown> | ({
@@ -67,7 +67,7 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
67
67
  [x: string]: any;
68
68
  } & import("mobx-state-tree/dist/internal").NonEmptyObject & any & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>);
69
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;
70
+ } & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>))[]): void;
71
71
  setTrackConfs(trackConfs: import("@jbrowse/core/configuration").AnyConfigurationModel[]): void;
72
72
  clear(): void;
73
73
  } & {
@@ -1,8 +1,7 @@
1
1
  import { ConfigurationReference, getConf, readConfObject, } from '@jbrowse/core/configuration';
2
- import { getSession } from '@jbrowse/core/util';
3
2
  import { BaseConnectionModelFactory } from '@jbrowse/core/pluggableElementTypes/models';
3
+ import { getSession } from '@jbrowse/core/util';
4
4
  import { types } from 'mobx-state-tree';
5
- // locals
6
5
  import configSchema from './configSchema';
7
6
  export default function stateModelFactory(pluginManager) {
8
7
  return types
@@ -28,7 +27,6 @@ export default function stateModelFactory(pluginManager) {
28
27
  throw new Error(`Assembly "${assemblyName}" not found`);
29
28
  }
30
29
  const sequenceAdapter = readConfObject(conf, ['sequence', 'adapter']);
31
- // @ts-expect-error
32
30
  const jb2Tracks = (_a = config.tracks) === null || _a === void 0 ? void 0 : _a.map(jb1Track => ({
33
31
  ...convertTrackConfig(jb1Track, config.dataRoot || '', sequenceAdapter),
34
32
  assemblyNames: [assemblyName],
@@ -1,27 +1,8 @@
1
- import { Track, Source } from './types';
1
+ import type { Source, Track } from './types';
2
2
  export declare function isTrack(arg: any): arg is Track;
3
3
  export declare function isSource(arg: any): arg is Source;
4
- /**
5
- * updates a with values from b, recursively
6
- */
7
4
  type Obj = Record<string, any>;
8
5
  export declare function deepUpdate(a: Obj, b: Obj): Obj;
9
- /**
10
- * replace variables in a template string with values
11
- *
12
- * @param template - String with variable names in curly brackets
13
- * e.g., `http://foo/{bar}?arg={baz.foo}`
14
- * @param fillWith - object with attribute-value mappings
15
- * e.g., `{ 'bar': 'someurl', 'baz': { 'foo': 42 } }`
16
- * @returns the template string with variables in fillWith replaced
17
- * e.g., 'htp://foo/someurl?arg=valueforbaz'
18
- */
19
6
  export declare function fillTemplate(template: string, fillWith: Obj): string;
20
- /**
21
- * Clones objects (including DOM nodes) and all children.
22
- * Warning: do not clone cyclic structures
23
- * (Lifted from dojo https://github.com/dojo/dojo/blob/master/_base/lang.js)
24
- * @param src - The object to clone
25
- */
26
- export declare function clone(src: any): any;
7
+ export declare function structuredClone(src: any): any;
27
8
  export {};
@@ -18,16 +18,6 @@ export function deepUpdate(a, b) {
18
18
  }
19
19
  return a;
20
20
  }
21
- /**
22
- * replace variables in a template string with values
23
- *
24
- * @param template - String with variable names in curly brackets
25
- * e.g., `http://foo/{bar}?arg={baz.foo}`
26
- * @param fillWith - object with attribute-value mappings
27
- * e.g., `{ 'bar': 'someurl', 'baz': { 'foo': 42 } }`
28
- * @returns the template string with variables in fillWith replaced
29
- * e.g., 'htp://foo/someurl?arg=valueforbaz'
30
- */
31
21
  export function fillTemplate(template, fillWith) {
32
22
  return template.replaceAll(/{([\s\w.]+)}/g, (match, varName) => {
33
23
  varName = varName.replaceAll(/\s+/g, '');
@@ -36,7 +26,6 @@ export function fillTemplate(template, fillWith) {
36
26
  return typeof fill === 'function' ? fill(varName) : fill;
37
27
  }
38
28
  if (fillWith.callback) {
39
- // @ts-expect-error
40
29
  const v = fillWith.callback.call(this, varName);
41
30
  if (v !== undefined) {
42
31
  return v;
@@ -45,81 +34,43 @@ export function fillTemplate(template, fillWith) {
45
34
  return match;
46
35
  });
47
36
  }
48
- /**
49
- * Clones objects (including DOM nodes) and all children.
50
- * Warning: do not clone cyclic structures
51
- * (Lifted from dojo https://github.com/dojo/dojo/blob/master/_base/lang.js)
52
- * @param src - The object to clone
53
- */
54
- export function clone(src) {
37
+ export function structuredClone(src) {
55
38
  if (!src ||
56
39
  typeof src !== 'object' ||
57
40
  Object.prototype.toString.call(src) === '[object Function]') {
58
- // null, undefined, any non-object, or function
59
- return src; // anything
41
+ return src;
60
42
  }
61
43
  if (src.nodeType && 'cloneNode' in src) {
62
- // DOM Node
63
- return src.cloneNode(true); // Node
44
+ return src.cloneNode(true);
64
45
  }
65
46
  if (src instanceof Date) {
66
- // Date
67
- return new Date(src.getTime()); // Date
47
+ return new Date(src.getTime());
68
48
  }
69
49
  if (src instanceof RegExp) {
70
- // RegExp
71
- return new RegExp(src); // RegExp
50
+ return new RegExp(src);
72
51
  }
73
52
  let r;
74
53
  if (Array.isArray(src)) {
75
- // array
76
54
  r = [];
77
55
  for (let i = 0, l = src.length; i < l; ++i) {
78
56
  if (i in src) {
79
- r[i] = clone(src[i]);
57
+ r[i] = structuredClone(src[i]);
80
58
  }
81
59
  }
82
- // we don't clone functions for performance reasons
83
- // }else if(d.isFunction(src)){
84
- // // function
85
- // r = function(){ return src.apply(this, arguments); };
86
60
  }
87
61
  else {
88
- // generic objects
89
62
  r = src.constructor ? new src.constructor() : {};
90
63
  }
91
- return mixin(r, src, clone);
64
+ return mixin(r, src, a => structuredClone(a));
92
65
  }
93
- /**
94
- * Copies/adds all properties of source to dest; returns dest.
95
- * (Lifted from dojo https://github.com/dojo/dojo/blob/master/_base/lang.js)
96
- *
97
- * All properties, including functions (sometimes termed "methods"), excluding
98
- * any non-standard extensions found in Object.prototype, are copied/added to
99
- * dest. Copying/adding each particular property is delegated to copyFunc
100
- * (if any); copyFunc defaults to the Javascript assignment operator if not
101
- * provided. Notice that by default, mixin executes a so-called "shallow copy"
102
- * and aggregate types are copied/added by reference.
103
- * @param dest - The object to which to copy/add all properties contained in
104
- * source.
105
- * @param source - The object from which to draw all properties to copy into dest.
106
- * @param copyFunc - The process used to copy/add a property in source; defaults
107
- * to the Javascript assignment operator.
108
- * @returns dest, as modified
109
- */
110
66
  function mixin(dest, source, copyFunc) {
111
67
  const empty = {};
112
68
  for (const name in source) {
113
- // the (!(name in empty) || empty[name] !== s) condition avoids copying
114
- // properties in "source" inherited from Object.prototype. For example,
115
- // if dest has a custom toString() method, don't overwrite it with the
116
- // toString() method that source inherited from Object.prototype
117
69
  const s = source[name];
118
70
  if (!(name in dest) ||
119
- // @ts-expect-error
120
71
  (dest[name] !== s && (!(name in empty) || empty[name] !== s))) {
121
72
  dest[name] = copyFunc ? copyFunc(s) : s;
122
73
  }
123
74
  }
124
- return dest; // Object
75
+ return dest;
125
76
  }