@jbrowse/plugin-legacy-jbrowse 3.6.5 → 4.0.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 (62) hide show
  1. package/esm/JBrowse1Connection/configSchema.d.ts +3 -3
  2. package/esm/JBrowse1Connection/get-value.d.ts +10 -0
  3. package/esm/JBrowse1Connection/get-value.js +84 -0
  4. package/esm/JBrowse1Connection/index.js +2 -2
  5. package/esm/JBrowse1Connection/jb1ConfigLoad.d.ts +1 -1
  6. package/esm/JBrowse1Connection/jb1ConfigLoad.js +2 -2
  7. package/esm/JBrowse1Connection/jb1ConfigParse.d.ts +1 -1
  8. package/esm/JBrowse1Connection/jb1ConfigParse.js +12 -10
  9. package/esm/JBrowse1Connection/jb1ToJb2.d.ts +2 -3
  10. package/esm/JBrowse1Connection/jb1ToJb2.js +43 -45
  11. package/esm/JBrowse1Connection/model.d.ts +16 -24
  12. package/esm/JBrowse1Connection/model.js +8 -14
  13. package/esm/JBrowse1Connection/util.d.ts +1 -1
  14. package/esm/JBrowse1Connection/util.js +13 -3
  15. package/esm/JBrowse1TextSearchAdapter/HttpMap.js +16 -1
  16. package/esm/JBrowse1TextSearchAdapter/JBrowse1TextSearchAdapter.d.ts +1 -1
  17. package/esm/JBrowse1TextSearchAdapter/JBrowse1TextSearchAdapter.js +3 -1
  18. package/esm/JBrowse1TextSearchAdapter/configSchema.d.ts +2 -2
  19. package/esm/JBrowse1TextSearchAdapter/index.js +2 -2
  20. package/esm/NCListAdapter/NCListAdapter.d.ts +1 -1
  21. package/esm/NCListAdapter/NCListAdapter.js +6 -5
  22. package/esm/NCListAdapter/NCListFeature.js +3 -0
  23. package/esm/NCListAdapter/configSchema.d.ts +2 -2
  24. package/esm/NCListAdapter/index.js +2 -2
  25. package/esm/index.js +5 -8
  26. package/package.json +25 -33
  27. package/dist/GuessNCList/index.d.ts +0 -2
  28. package/dist/GuessNCList/index.js +0 -18
  29. package/dist/JBrowse1Connection/configSchema.d.ts +0 -27
  30. package/dist/JBrowse1Connection/configSchema.js +0 -23
  31. package/dist/JBrowse1Connection/index.d.ts +0 -2
  32. package/dist/JBrowse1Connection/index.js +0 -19
  33. package/dist/JBrowse1Connection/jb1ConfigLoad.d.ts +0 -36
  34. package/dist/JBrowse1Connection/jb1ConfigLoad.js +0 -253
  35. package/dist/JBrowse1Connection/jb1ConfigParse.d.ts +0 -4
  36. package/dist/JBrowse1Connection/jb1ConfigParse.js +0 -341
  37. package/dist/JBrowse1Connection/jb1ToJb2.d.ts +0 -49
  38. package/dist/JBrowse1Connection/jb1ToJb2.js +0 -408
  39. package/dist/JBrowse1Connection/model.d.ts +0 -75
  40. package/dist/JBrowse1Connection/model.js +0 -82
  41. package/dist/JBrowse1Connection/types.d.ts +0 -91
  42. package/dist/JBrowse1Connection/types.js +0 -2
  43. package/dist/JBrowse1Connection/util.d.ts +0 -8
  44. package/dist/JBrowse1Connection/util.js +0 -86
  45. package/dist/JBrowse1TextSearchAdapter/HttpMap.d.ts +0 -19
  46. package/dist/JBrowse1TextSearchAdapter/HttpMap.js +0 -65
  47. package/dist/JBrowse1TextSearchAdapter/JBrowse1TextSearchAdapter.d.ts +0 -28
  48. package/dist/JBrowse1TextSearchAdapter/JBrowse1TextSearchAdapter.js +0 -58
  49. package/dist/JBrowse1TextSearchAdapter/configSchema.d.ts +0 -21
  50. package/dist/JBrowse1TextSearchAdapter/configSchema.js +0 -24
  51. package/dist/JBrowse1TextSearchAdapter/index.d.ts +0 -2
  52. package/dist/JBrowse1TextSearchAdapter/index.js +0 -49
  53. package/dist/NCListAdapter/NCListAdapter.d.ts +0 -17
  54. package/dist/NCListAdapter/NCListAdapter.js +0 -48
  55. package/dist/NCListAdapter/NCListFeature.d.ts +0 -16
  56. package/dist/NCListAdapter/NCListFeature.js +0 -58
  57. package/dist/NCListAdapter/configSchema.d.ts +0 -15
  58. package/dist/NCListAdapter/configSchema.js +0 -21
  59. package/dist/NCListAdapter/index.d.ts +0 -2
  60. package/dist/NCListAdapter/index.js +0 -52
  61. package/dist/index.d.ts +0 -6
  62. package/dist/index.js +0 -23
@@ -1,4 +1,4 @@
1
- declare const JBrowse1Connection: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
1
+ declare const JBrowse1Connection: import("node_modules/@jbrowse/core/src/configuration/configurationSchema").ConfigurationSchemaType<{
2
2
  dataDirLocation: {
3
3
  type: string;
4
4
  defaultValue: {
@@ -12,7 +12,7 @@ declare const JBrowse1Connection: import("@jbrowse/core/configuration/configurat
12
12
  type: string;
13
13
  defaultValue: never[];
14
14
  };
15
- }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
15
+ }, import("node_modules/@jbrowse/core/src/configuration/configurationSchema").ConfigurationSchemaOptions<import("node_modules/@jbrowse/core/src/configuration/configurationSchema").ConfigurationSchemaType<{
16
16
  name: {
17
17
  type: string;
18
18
  defaultValue: string;
@@ -23,5 +23,5 @@ declare const JBrowse1Connection: import("@jbrowse/core/configuration/configurat
23
23
  defaultValue: never[];
24
24
  description: string;
25
25
  };
26
- }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "connectionId">>, undefined>>;
26
+ }, import("node_modules/@jbrowse/core/src/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "connectionId">>, undefined>>;
27
27
  export default JBrowse1Connection;
@@ -0,0 +1,10 @@
1
+ export interface Options {
2
+ default?: unknown;
3
+ separator?: string;
4
+ joinChar?: string;
5
+ join?: (segs: string[]) => string;
6
+ split?: (path: string) => string[];
7
+ isValid?: (key: string, target: {}) => boolean;
8
+ }
9
+ declare const getValue: (target: unknown, path: string | number | string[], options?: Options) => unknown;
10
+ export default getValue;
@@ -0,0 +1,84 @@
1
+ const isObject = v => v !== null && typeof v === 'object';
2
+ const join = (segs, joinChar, options) => {
3
+ if (typeof options.join === 'function') {
4
+ return options.join(segs);
5
+ }
6
+ return segs[0] + joinChar + segs[1];
7
+ };
8
+ const split = (path, splitChar, options) => {
9
+ if (typeof options.split === 'function') {
10
+ return options.split(path);
11
+ }
12
+ return path.split(splitChar);
13
+ };
14
+ const isValid = (key, target = {}, options) => {
15
+ if (typeof options?.isValid === 'function') {
16
+ return options.isValid(key, target);
17
+ }
18
+ return true;
19
+ };
20
+ const isValidObject = (v) => {
21
+ return isObject(v) || typeof v === 'function';
22
+ };
23
+ const getValue = (target, path, options = {}) => {
24
+ if (!isObject(options)) {
25
+ options = { default: options };
26
+ }
27
+ if (!isValidObject(target)) {
28
+ return options.default !== undefined ? options.default : target;
29
+ }
30
+ if (typeof path === 'number') {
31
+ path = String(path);
32
+ }
33
+ const pathIsArray = Array.isArray(path);
34
+ const pathIsString = typeof path === 'string';
35
+ const splitChar = options.separator || '.';
36
+ const joinChar = options.joinChar || (typeof splitChar === 'string' ? splitChar : '.');
37
+ if (!pathIsString && !pathIsArray) {
38
+ return target;
39
+ }
40
+ if (target[path] !== undefined) {
41
+ return isValid(path, target, options) ? target[path] : options.default;
42
+ }
43
+ const segs = pathIsArray ? path : split(path, splitChar, options);
44
+ const len = segs.length;
45
+ let idx = 0;
46
+ do {
47
+ let prop = segs[idx];
48
+ if (typeof prop !== 'string') {
49
+ prop = String(prop);
50
+ }
51
+ while (prop.endsWith('\\')) {
52
+ prop = join([prop.slice(0, -1), segs[++idx] || ''], joinChar, options);
53
+ }
54
+ if (target[prop] !== undefined) {
55
+ if (!isValid(prop, target, options)) {
56
+ return options.default;
57
+ }
58
+ target = target[prop];
59
+ }
60
+ else {
61
+ let hasProp = false;
62
+ let n = idx + 1;
63
+ while (n < len) {
64
+ prop = join([prop, segs[n++]], joinChar, options);
65
+ if ((hasProp = target[prop] !== undefined)) {
66
+ if (!isValid(prop, target, options)) {
67
+ return options.default;
68
+ }
69
+ target = target[prop];
70
+ idx = n - 1;
71
+ break;
72
+ }
73
+ }
74
+ if (!hasProp) {
75
+ return options.default;
76
+ }
77
+ }
78
+ } while (++idx < len && isValidObject(target));
79
+ if (idx === len) {
80
+ return target;
81
+ }
82
+ return options.default;
83
+ };
84
+ export default getValue;
@@ -1,6 +1,6 @@
1
1
  import ConnectionType from '@jbrowse/core/pluggableElementTypes/ConnectionType';
2
- import configSchema from './configSchema';
3
- import modelFactory from './model';
2
+ import configSchema from "./configSchema.js";
3
+ import modelFactory from "./model.js";
4
4
  export default function JBrowse1ConnectionF(pluginManager) {
5
5
  pluginManager.addConnectionType(() => new ConnectionType({
6
6
  name: 'JBrowse1Connection',
@@ -1,4 +1,4 @@
1
- import type { Config, JBLocation } from './types';
1
+ import type { Config, JBLocation } from './types.ts';
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,6 +1,6 @@
1
1
  import { openLocation } from '@jbrowse/core/util/io';
2
- import { parseJB1Conf, parseJB1Json, regularizeConf } from './jb1ConfigParse';
3
- import { deepUpdate, fillTemplate } from './util';
2
+ import { parseJB1Conf, parseJB1Json, regularizeConf } from "./jb1ConfigParse.js";
3
+ import { deepUpdate, fillTemplate } from "./util.js";
4
4
  function isUriLocation(location) {
5
5
  return location.uri !== undefined;
6
6
  }
@@ -1,4 +1,4 @@
1
- import type { Config } from './types';
1
+ import type { Config } from './types.ts';
2
2
  export declare function parseJB1Json(config: Config | string, url: string): Config;
3
3
  export declare function parseJB1Conf(config: string, url: string): Config;
4
4
  export declare function regularizeConf(conf: Config, url: string): Config;
@@ -1,7 +1,7 @@
1
1
  import { objectHash } from '@jbrowse/core/util';
2
- import getValue from 'get-value';
3
2
  import setValue from 'set-value';
4
- import { isSource, isTrack } from './util';
3
+ import getValue from "./get-value.js";
4
+ import { isSource, isTrack } from "./util.js";
5
5
  export function parseJB1Json(config, url) {
6
6
  if (typeof config === 'string') {
7
7
  let parsedConf;
@@ -143,7 +143,7 @@ export function regularizeConf(conf, url) {
143
143
  }
144
144
  }
145
145
  const meta = conf.trackMetadata;
146
- if (meta === null || meta === void 0 ? void 0 : meta.sources) {
146
+ if (meta?.sources) {
147
147
  if (typeof meta.sources === 'string') {
148
148
  meta.sources = [meta.sources];
149
149
  }
@@ -184,10 +184,14 @@ export function regularizeConf(conf, url) {
184
184
  if (conf.sourceUrl) {
185
185
  const addBase = [];
186
186
  if (conf.tracks) {
187
- addBase.push(...conf.tracks);
187
+ for (const track of conf.tracks) {
188
+ addBase.push(track);
189
+ }
188
190
  }
189
191
  if (conf.stores) {
190
- addBase.push(...Object.values(conf.stores));
192
+ for (const store of Object.values(conf.stores)) {
193
+ addBase.push(store);
194
+ }
191
195
  }
192
196
  if (conf.names) {
193
197
  addBase.push(conf.names);
@@ -252,11 +256,10 @@ function regularizeClass(root, className) {
252
256
  return className;
253
257
  }
254
258
  function guessStoreClass(trackConfig, urlTemplate) {
255
- var _a, _b;
256
259
  if (!trackConfig) {
257
260
  return '';
258
261
  }
259
- if ((_a = trackConfig.type) === null || _a === void 0 ? void 0 : _a.includes('/FixedImage')) {
262
+ if (trackConfig.type?.includes('/FixedImage')) {
260
263
  return `JBrowse/Store/TiledImage/Fixed${trackConfig.backendVersion === 0 ? '_v0' : ''}`;
261
264
  }
262
265
  if (/\.jsonz?$/i.test(urlTemplate)) {
@@ -298,13 +301,12 @@ function guessStoreClass(trackConfig, urlTemplate) {
298
301
  if (/\.2bit$/i.test(urlTemplate)) {
299
302
  return 'JBrowse/Store/SeqFeature/TwoBit';
300
303
  }
301
- if ((_b = trackConfig.type) === null || _b === void 0 ? void 0 : _b.endsWith('/Sequence')) {
304
+ if (trackConfig.type?.endsWith('/Sequence')) {
302
305
  return 'JBrowse/Store/Sequence/StaticChunked';
303
306
  }
304
307
  return '';
305
308
  }
306
309
  function synthesizeTrackStoreConfig(mainConf, trackConfig) {
307
- var _a;
308
310
  const { urlTemplate = '' } = trackConfig;
309
311
  const storeClass = trackConfig.storeClass
310
312
  ? regularizeClass('JBrowse/Store', trackConfig.storeClass)
@@ -322,7 +324,7 @@ function synthesizeTrackStoreConfig(mainConf, trackConfig) {
322
324
  storeClass === 'JBrowse/Store/SeqFeature/TwoBit' ||
323
325
  storeClass === 'JBrowse/Store/Sequence/TwoBit' ||
324
326
  trackConfig.useAsRefSeqStore) &&
325
- !((_a = mainConf.stores) === null || _a === void 0 ? void 0 : _a.refseqs)
327
+ !mainConf.stores?.refseqs
326
328
  ? 'refseqs'
327
329
  : `store${objectHash(storeConf)}`;
328
330
  if (!mainConf.stores) {
@@ -1,4 +1,4 @@
1
- import type { RefSeqs, Track } from './types';
1
+ import type { RefSeqs, Track } from './types.ts';
2
2
  interface Jb2Track {
3
3
  trackId: string;
4
4
  name: string;
@@ -30,7 +30,6 @@ interface Jb2Adapter {
30
30
  indexType?: string;
31
31
  };
32
32
  rootUrlTemplate?: Jb2Location;
33
- sequenceAdapter?: Jb2Adapter;
34
33
  }
35
34
  interface Jb2Feature {
36
35
  refName: string;
@@ -44,6 +43,6 @@ interface Jb2Location {
44
43
  blobId?: string;
45
44
  locationType?: string;
46
45
  }
47
- export declare function convertTrackConfig(jb1TrackConfig: Track, dataRoot: string, sequenceAdapter: Jb2Adapter): Jb2Track;
46
+ export declare function convertTrackConfig(jb1TrackConfig: Track, dataRoot: string): Jb2Track;
48
47
  export declare function createRefSeqsAdapter(refSeqs: string | RefSeqs): Promise<Jb2Adapter>;
49
48
  export {};
@@ -1,8 +1,7 @@
1
1
  import { objectHash } from '@jbrowse/core/util';
2
2
  import { openLocation } from '@jbrowse/core/util/io';
3
3
  import { UNKNOWN, UNSUPPORTED, generateUnknownTrackConf, generateUnsupportedTrackConf, guessAdapter, guessTrackType, } from '@jbrowse/core/util/tracks';
4
- export function convertTrackConfig(jb1TrackConfig, dataRoot, sequenceAdapter) {
5
- var _a, _b, _c, _d, _e;
4
+ export function convertTrackConfig(jb1TrackConfig, dataRoot) {
6
5
  const jb2TrackConfig = {
7
6
  trackId: objectHash(jb1TrackConfig),
8
7
  name: jb1TrackConfig.key || jb1TrackConfig.label,
@@ -12,11 +11,11 @@ export function convertTrackConfig(jb1TrackConfig, dataRoot, sequenceAdapter) {
12
11
  if (description) {
13
12
  jb2TrackConfig.description = description;
14
13
  }
15
- const category = jb1TrackConfig.category || ((_a = jb1TrackConfig.metadata) === null || _a === void 0 ? void 0 : _a.category);
14
+ const category = jb1TrackConfig.category || jb1TrackConfig.metadata?.category;
16
15
  jb2TrackConfig.category = category ? category.split(/\s*\/\s*/) : [];
17
16
  const { storeClass } = jb1TrackConfig;
18
17
  if (!jb1TrackConfig.urlTemplate) {
19
- if (!(storeClass === null || storeClass === void 0 ? void 0 : storeClass.endsWith('FromConfig'))) {
18
+ if (!storeClass?.endsWith('FromConfig')) {
20
19
  const trackIdentifier = jb1TrackConfig.key || jb1TrackConfig.label;
21
20
  console.warn(`Could not import JBrowse1 track "${trackIdentifier}" because it does not have a "urlTemplate" or is not a "FromConfig" track`);
22
21
  return generateUnsupportedTrackConf(jb2TrackConfig.name, trackIdentifier, jb2TrackConfig.category);
@@ -67,17 +66,16 @@ export function convertTrackConfig(jb1TrackConfig, dataRoot, sequenceAdapter) {
67
66
  const adapter = {
68
67
  type: 'CramAdapter',
69
68
  cramLocation: { uri: urlTemplate, locationType: 'UriLocation' },
70
- sequenceAdapter,
69
+ craiLocation: jb1TrackConfig.craiUrlTemplate
70
+ ? {
71
+ uri: resolveUrlTemplate(jb1TrackConfig.craiUrlTemplate),
72
+ locationType: 'UriLocation',
73
+ }
74
+ : {
75
+ uri: `${urlTemplate}.crai`,
76
+ locationType: 'UriLocation',
77
+ },
71
78
  };
72
- adapter.craiLocation = jb1TrackConfig.craiUrlTemplate
73
- ? {
74
- uri: resolveUrlTemplate(jb1TrackConfig.craiUrlTemplate),
75
- locationType: 'UriLocation',
76
- }
77
- : {
78
- uri: `${urlTemplate}.crai`,
79
- locationType: 'UriLocation',
80
- };
81
79
  return {
82
80
  ...jb2TrackConfig,
83
81
  type: 'AlignmentsTrack',
@@ -96,10 +94,10 @@ export function convertTrackConfig(jb1TrackConfig, dataRoot, sequenceAdapter) {
96
94
  }
97
95
  if (storeClass === 'JBrowse/Store/SeqFeature/BigWig' ||
98
96
  storeClass === 'JBrowse/Store/BigWig') {
99
- if ((_b = jb1TrackConfig.type) === null || _b === void 0 ? void 0 : _b.endsWith('XYPlot')) {
97
+ if (jb1TrackConfig.type?.endsWith('XYPlot')) {
100
98
  jb2TrackConfig.defaultRendering = 'xyplot';
101
99
  }
102
- else if ((_c = jb1TrackConfig.type) === null || _c === void 0 ? void 0 : _c.endsWith('Density')) {
100
+ else if (jb1TrackConfig.type?.endsWith('Density')) {
103
101
  jb2TrackConfig.defaultRendering = 'density';
104
102
  }
105
103
  return {
@@ -257,16 +255,16 @@ export function convertTrackConfig(jb1TrackConfig, dataRoot, sequenceAdapter) {
257
255
  const adapter = {
258
256
  type: 'IndexedFastaAdapter',
259
257
  fastaLocation: { uri: urlTemplate, locationType: 'UriLocation' },
258
+ faiLocation: jb1TrackConfig.faiUrlTemplate
259
+ ? {
260
+ uri: resolveUrlTemplate(jb1TrackConfig.faiUrlTemplate),
261
+ locationType: 'UriLocation',
262
+ }
263
+ : {
264
+ uri: `${urlTemplate}.fai`,
265
+ locationType: 'UriLocation',
266
+ },
260
267
  };
261
- adapter.faiLocation = jb1TrackConfig.faiUrlTemplate
262
- ? {
263
- uri: resolveUrlTemplate(jb1TrackConfig.faiUrlTemplate),
264
- locationType: 'UriLocation',
265
- }
266
- : {
267
- uri: `${urlTemplate}.fai`,
268
- locationType: 'UriLocation',
269
- };
270
268
  return {
271
269
  ...jb2TrackConfig,
272
270
  type: 'SequenceTrack',
@@ -277,25 +275,25 @@ export function convertTrackConfig(jb1TrackConfig, dataRoot, sequenceAdapter) {
277
275
  const adapter = {
278
276
  type: 'BgzipFastaAdapter',
279
277
  fastaLocation: { uri: urlTemplate, locationType: 'UriLocation' },
278
+ faiLocation: jb1TrackConfig.faiUrlTemplate
279
+ ? {
280
+ uri: resolveUrlTemplate(jb1TrackConfig.faiUrlTemplate),
281
+ locationType: 'UriLocation',
282
+ }
283
+ : {
284
+ uri: `${urlTemplate}.fai`,
285
+ locationType: 'UriLocation',
286
+ },
287
+ gziLocation: jb1TrackConfig.gziUrlTemplate
288
+ ? {
289
+ uri: resolveUrlTemplate(jb1TrackConfig.gziUrlTemplate),
290
+ locationType: 'UriLocation',
291
+ }
292
+ : {
293
+ uri: `${urlTemplate}.gzi`,
294
+ locationType: 'UriLocation',
295
+ },
280
296
  };
281
- adapter.faiLocation = jb1TrackConfig.faiUrlTemplate
282
- ? {
283
- uri: resolveUrlTemplate(jb1TrackConfig.faiUrlTemplate),
284
- locationType: 'UriLocation',
285
- }
286
- : {
287
- uri: `${urlTemplate}.fai`,
288
- locationType: 'UriLocation',
289
- };
290
- adapter.gziLocation = jb1TrackConfig.gziUrlTemplate
291
- ? {
292
- uri: resolveUrlTemplate(jb1TrackConfig.gziUrlTemplate),
293
- locationType: 'UriLocation',
294
- }
295
- : {
296
- uri: `${urlTemplate}.gzi`,
297
- locationType: 'UriLocation',
298
- };
299
297
  return {
300
298
  ...jb2TrackConfig,
301
299
  type: 'ReferenceSequenceTrack',
@@ -322,10 +320,10 @@ export function convertTrackConfig(jb1TrackConfig, dataRoot, sequenceAdapter) {
322
320
  }
323
321
  jb2TrackConfig.type = guessTrackType(jb2TrackConfig.adapter.type);
324
322
  if (jb2TrackConfig.type === 'QuantitativeTrack') {
325
- if ((_d = jb1TrackConfig.type) === null || _d === void 0 ? void 0 : _d.endsWith('XYPlot')) {
323
+ if (jb1TrackConfig.type?.endsWith('XYPlot')) {
326
324
  jb2TrackConfig.defaultRendering = 'xyplot';
327
325
  }
328
- else if ((_e = jb1TrackConfig.type) === null || _e === void 0 ? void 0 : _e.endsWith('Density')) {
326
+ else if (jb1TrackConfig.type?.endsWith('Density')) {
329
327
  jb2TrackConfig.defaultRendering = 'density';
330
328
  }
331
329
  }
@@ -1,8 +1,8 @@
1
1
  import type PluginManager from '@jbrowse/core/PluginManager';
2
- export default function stateModelFactory(pluginManager: PluginManager): import("mobx-state-tree").IModelType<{
3
- name: import("mobx-state-tree").ISimpleType<string>;
4
- tracks: import("mobx-state-tree").IArrayType<import("mobx-state-tree").IAnyModelType>;
5
- configuration: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
2
+ export default function stateModelFactory(pluginManager: PluginManager): import("@jbrowse/mobx-state-tree").IModelType<{
3
+ name: import("@jbrowse/mobx-state-tree").ISimpleType<string>;
4
+ tracks: import("@jbrowse/mobx-state-tree").IArrayType<import("@jbrowse/mobx-state-tree").IAnyModelType>;
5
+ configuration: import("node_modules/@jbrowse/core/src/configuration/configurationSchema.ts").ConfigurationSchemaType<{
6
6
  name: {
7
7
  type: string;
8
8
  defaultValue: string;
@@ -13,9 +13,9 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
13
13
  defaultValue: never[];
14
14
  description: string;
15
15
  };
16
- }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "connectionId">>;
16
+ }, import("node_modules/@jbrowse/core/src/configuration/configurationSchema.ts").ConfigurationSchemaOptions<undefined, "connectionId">>;
17
17
  } & {
18
- configuration: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
18
+ configuration: import("node_modules/@jbrowse/core/src/configuration/configurationSchema.ts").ConfigurationSchemaType<{
19
19
  dataDirLocation: {
20
20
  type: string;
21
21
  defaultValue: {
@@ -29,7 +29,7 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
29
29
  type: string;
30
30
  defaultValue: never[];
31
31
  };
32
- }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
32
+ }, import("node_modules/@jbrowse/core/src/configuration/configurationSchema.ts").ConfigurationSchemaOptions<import("node_modules/@jbrowse/core/src/configuration/configurationSchema.ts").ConfigurationSchemaType<{
33
33
  name: {
34
34
  type: string;
35
35
  defaultValue: string;
@@ -40,36 +40,28 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
40
40
  defaultValue: never[];
41
41
  description: string;
42
42
  };
43
- }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "connectionId">>, undefined>>;
44
- type: import("mobx-state-tree").ISimpleType<"JBrowse1Connection">;
43
+ }, import("node_modules/@jbrowse/core/src/configuration/configurationSchema.ts").ConfigurationSchemaOptions<undefined, "connectionId">>, undefined>>;
44
+ type: import("@jbrowse/mobx-state-tree").ISimpleType<"JBrowse1Connection">;
45
45
  }, {
46
46
  connect(_arg: import("@jbrowse/core/configuration").AnyConfigurationModel): void;
47
47
  } & {
48
48
  afterAttach(): void;
49
49
  addTrackConf(trackConf: Record<string, unknown> | ({
50
50
  [x: string]: any;
51
- } & import("mobx-state-tree/dist/internal").NonEmptyObject & {
51
+ } & import("@jbrowse/mobx-state-tree/dist/internal").NonEmptyObject & {
52
52
  setSubschema(slotName: string, data: Record<string, unknown>): Record<string, unknown> | ({
53
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>)): any;
54
+ } & import("@jbrowse/mobx-state-tree/dist/internal").NonEmptyObject & any & import("@jbrowse/mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>);
55
+ } & import("@jbrowse/mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>)): any;
60
56
  addTrackConfs(trackConfs: (Record<string, unknown> | ({
61
57
  [x: string]: any;
62
- } & import("mobx-state-tree/dist/internal").NonEmptyObject & {
58
+ } & import("@jbrowse/mobx-state-tree/dist/internal").NonEmptyObject & {
63
59
  setSubschema(slotName: string, data: Record<string, unknown>): Record<string, unknown> | ({
64
60
  [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>))[]): void;
61
+ } & import("@jbrowse/mobx-state-tree/dist/internal").NonEmptyObject & any & import("@jbrowse/mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>);
62
+ } & import("@jbrowse/mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>))[]): void;
71
63
  setTrackConfs(trackConfs: import("@jbrowse/core/configuration").AnyConfigurationModel[]): void;
72
64
  clear(): void;
73
65
  } & {
74
66
  connect(): Promise<void>;
75
- }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
67
+ }, import("@jbrowse/mobx-state-tree")._NotCustomized, import("@jbrowse/mobx-state-tree")._NotCustomized>;
@@ -1,8 +1,8 @@
1
- import { ConfigurationReference, getConf, readConfObject, } from '@jbrowse/core/configuration';
1
+ import { ConfigurationReference, getConf } from '@jbrowse/core/configuration';
2
2
  import { BaseConnectionModelFactory } from '@jbrowse/core/pluggableElementTypes/models';
3
3
  import { getSession } from '@jbrowse/core/util';
4
- import { types } from 'mobx-state-tree';
5
- import configSchema from './configSchema';
4
+ import { types } from '@jbrowse/mobx-state-tree';
5
+ import configSchema from "./configSchema.js";
6
6
  export default function stateModelFactory(pluginManager) {
7
7
  return types
8
8
  .compose('JBrowse1Connection', BaseConnectionModelFactory(pluginManager), types.model({
@@ -11,24 +11,18 @@ export default function stateModelFactory(pluginManager) {
11
11
  }))
12
12
  .actions(self => ({
13
13
  async connect() {
14
- var _a, _b;
15
14
  const session = getSession(self);
16
15
  try {
17
16
  const dataDirLocation = getConf(self, 'dataDirLocation');
18
- const { fetchJb1 } = await import('./jb1ConfigLoad');
19
- const { convertTrackConfig } = await import('./jb1ToJb2');
17
+ const { fetchJb1 } = await import("./jb1ConfigLoad.js");
18
+ const { convertTrackConfig } = await import("./jb1ToJb2.js");
20
19
  const config = await fetchJb1(dataDirLocation);
21
20
  const assemblyName = getConf(self, 'assemblyNames')[0];
22
21
  if (!assemblyName) {
23
22
  throw new Error('assembly name required for JBrowse 1 connection');
24
23
  }
25
- const conf = session.assemblies.find(a => readConfObject(a, 'name') === assemblyName);
26
- if (!conf) {
27
- throw new Error(`Assembly "${assemblyName}" not found`);
28
- }
29
- const sequenceAdapter = readConfObject(conf, ['sequence', 'adapter']);
30
- const jb2Tracks = (_a = config.tracks) === null || _a === void 0 ? void 0 : _a.map(jb1Track => ({
31
- ...convertTrackConfig(jb1Track, config.dataRoot || '', sequenceAdapter),
24
+ const jb2Tracks = config.tracks?.map(jb1Track => ({
25
+ ...convertTrackConfig(jb1Track, config.dataRoot || ''),
32
26
  assemblyNames: [assemblyName],
33
27
  }));
34
28
  self.setTrackConfs(jb2Tracks);
@@ -36,7 +30,7 @@ export default function stateModelFactory(pluginManager) {
36
30
  catch (error) {
37
31
  console.error(error);
38
32
  session.notifyError(`There was a problem connecting to the JBrowse 1 data directory "${self.name}". Please make sure you have entered a valid location. The error that was thrown is: "${error}"`, error);
39
- (_b = session.breakConnection) === null || _b === void 0 ? void 0 : _b.call(session, self.configuration);
33
+ session.breakConnection?.(self.configuration);
40
34
  }
41
35
  },
42
36
  }));
@@ -1,4 +1,4 @@
1
- import type { Source, Track } from './types';
1
+ import type { Source, Track } from './types.ts';
2
2
  export declare function isTrack(arg: any): arg is Track;
3
3
  export declare function isSource(arg: any): arg is Source;
4
4
  type Obj = Record<string, any>;
@@ -1,12 +1,17 @@
1
- import getValue from 'get-value';
1
+ import getValue from "./get-value.js";
2
2
  export function isTrack(arg) {
3
- return (arg === null || arg === void 0 ? void 0 : arg.label) && typeof arg.label === 'string';
3
+ return arg?.label && typeof arg.label === 'string';
4
4
  }
5
5
  export function isSource(arg) {
6
- return (arg === null || arg === void 0 ? void 0 : arg.url) && typeof arg.url === 'string';
6
+ return arg?.url && typeof arg.url === 'string';
7
7
  }
8
8
  export function deepUpdate(a, b) {
9
9
  for (const prop of Object.keys(b)) {
10
+ if (prop === '__proto__' ||
11
+ prop === 'constructor' ||
12
+ prop === 'prototype') {
13
+ continue;
14
+ }
10
15
  if (prop in a &&
11
16
  typeof b[prop] === 'object' &&
12
17
  typeof a[prop] === 'object') {
@@ -66,6 +71,11 @@ export function structuredClone(src) {
66
71
  function mixin(dest, source, copyFunc) {
67
72
  const empty = {};
68
73
  for (const name in source) {
74
+ if (name === '__proto__' ||
75
+ name === 'constructor' ||
76
+ name === 'prototype') {
77
+ continue;
78
+ }
69
79
  const s = source[name];
70
80
  if (!(name in dest) ||
71
81
  (dest[name] !== s && (!(name in empty) || empty[name] !== s))) {
@@ -1,5 +1,20 @@
1
- import crc32 from 'crc/crc32';
1
+ const crcTable = new Uint32Array(256);
2
+ for (let i = 0; i < 256; i++) {
3
+ let c = i;
4
+ for (let j = 0; j < 8; j++) {
5
+ c = c & 1 ? 0xedb88320 ^ (c >>> 1) : c >>> 1;
6
+ }
7
+ crcTable[i] = c;
8
+ }
9
+ function crc32(str) {
10
+ let crc = 0xffffffff;
11
+ for (let i = 0; i < str.length; i++) {
12
+ crc = crcTable[(crc ^ str.charCodeAt(i)) & 0xff] ^ (crc >>> 8);
13
+ }
14
+ return (crc ^ 0xffffffff) >>> 0;
15
+ }
2
16
  export default class HttpMap {
17
+ url;
3
18
  constructor(args) {
4
19
  this.url = args.url.endsWith('/') ? args.url : `${args.url}/`;
5
20
  }
@@ -1,6 +1,6 @@
1
1
  import BaseResult from '@jbrowse/core/TextSearch/BaseResults';
2
2
  import { BaseAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
3
- import HttpMap from './HttpMap';
3
+ import HttpMap from './HttpMap.ts';
4
4
  import type PluginManager from '@jbrowse/core/PluginManager';
5
5
  import type { AnyConfigurationModel } from '@jbrowse/core/configuration';
6
6
  import type { BaseTextSearchAdapter, BaseTextSearchArgs } from '@jbrowse/core/data_adapters/BaseAdapter';
@@ -1,8 +1,10 @@
1
1
  import BaseResult from '@jbrowse/core/TextSearch/BaseResults';
2
2
  import { readConfObject } from '@jbrowse/core/configuration';
3
3
  import { BaseAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
4
- import HttpMap from './HttpMap';
4
+ import HttpMap from "./HttpMap.js";
5
5
  export default class JBrowse1TextSearchAdapter extends BaseAdapter {
6
+ httpMap;
7
+ tracksNames;
6
8
  constructor(config, getSubAdapter, pluginManager) {
7
9
  super(config, getSubAdapter, pluginManager);
8
10
  const namesIndex = readConfObject(config, 'namesIndexLocation');
@@ -1,4 +1,4 @@
1
- declare const _default: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
1
+ declare const _default: import("node_modules/@jbrowse/core/src/configuration/configurationSchema").ConfigurationSchemaType<{
2
2
  namesIndexLocation: {
3
3
  type: string;
4
4
  defaultValue: {
@@ -17,5 +17,5 @@ declare const _default: import("@jbrowse/core/configuration/configurationSchema"
17
17
  defaultValue: never[];
18
18
  description: string;
19
19
  };
20
- }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "textSearchAdapterId">>;
20
+ }, import("node_modules/@jbrowse/core/src/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "textSearchAdapterId">>;
21
21
  export default _default;
@@ -1,10 +1,10 @@
1
1
  import TextSearchAdapterType from '@jbrowse/core/pluggableElementTypes/TextSearchAdapterType';
2
- import configSchema from './configSchema';
2
+ import configSchema from "./configSchema.js";
3
3
  export default function JBrowse1TextSearchAdapterF(pluginManager) {
4
4
  pluginManager.addTextSearchAdapterType(() => new TextSearchAdapterType({
5
5
  name: 'JBrowse1TextSearchAdapter',
6
6
  configSchema,
7
7
  description: 'A JBrowse 1 text search adapter',
8
- getAdapterClass: () => import('./JBrowse1TextSearchAdapter').then(t => t.default),
8
+ getAdapterClass: () => import("./JBrowse1TextSearchAdapter.js").then(t => t.default),
9
9
  }));
10
10
  }
@@ -1,5 +1,5 @@
1
1
  import { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
2
- import NCListFeature from './NCListFeature';
2
+ import NCListFeature from './NCListFeature.ts';
3
3
  import type PluginManager from '@jbrowse/core/PluginManager';
4
4
  import type { AnyConfigurationModel } from '@jbrowse/core/configuration';
5
5
  import type { BaseOptions } from '@jbrowse/core/data_adapters/BaseAdapter';