@jbrowse/add-track-core 5.0.0-beta.10 → 5.0.0-beta.11
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.
- package/esm/formats.d.ts +6 -0
- package/esm/formats.js +8 -0
- package/esm/index.d.ts +2 -1
- package/esm/index.js +2 -1
- package/esm/looseTrackConfig.d.ts +13 -0
- package/esm/looseTrackConfig.js +11 -0
- package/package.json +1 -1
package/esm/formats.d.ts
CHANGED
|
@@ -60,6 +60,12 @@ export interface FormatEntry {
|
|
|
60
60
|
* precede their plain counterparts.
|
|
61
61
|
*/
|
|
62
62
|
export declare const formats: FormatEntry[];
|
|
63
|
+
/**
|
|
64
|
+
* The bare filename the format table matches against — the same thing
|
|
65
|
+
* `@jbrowse/core`'s `getFileName` hands the guesser chain, so a path and a URL
|
|
66
|
+
* with a presigned query string both reduce to what the regexes expect.
|
|
67
|
+
*/
|
|
68
|
+
export declare function fileNameOf(location: string): string;
|
|
63
69
|
/**
|
|
64
70
|
* The format `fileName` is, or — when `adapterHint` names an adapter type — that
|
|
65
71
|
* adapter's format whatever the filename says. A hint always wins, which is what
|
package/esm/formats.js
CHANGED
|
@@ -386,6 +386,14 @@ export const formats = [
|
|
|
386
386
|
},
|
|
387
387
|
},
|
|
388
388
|
];
|
|
389
|
+
/**
|
|
390
|
+
* The bare filename the format table matches against — the same thing
|
|
391
|
+
* `@jbrowse/core`'s `getFileName` hands the guesser chain, so a path and a URL
|
|
392
|
+
* with a presigned query string both reduce to what the regexes expect.
|
|
393
|
+
*/
|
|
394
|
+
export function fileNameOf(location) {
|
|
395
|
+
return (location.replaceAll('\\', '/').split('/').at(-1)?.split(/[?#]/)[0] ?? '');
|
|
396
|
+
}
|
|
389
397
|
function matchesRegex(fileName, regex) {
|
|
390
398
|
return Array.isArray(regex)
|
|
391
399
|
? regex.every(r => r.test(fileName))
|
package/esm/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export { type AdapterSpec, type FormatEntry, type Sidecar, formats, matchFormat, trackTypeForAdapter, } from './formats.ts';
|
|
1
|
+
export { type AdapterSpec, type FormatEntry, type Sidecar, fileNameOf, formats, matchFormat, trackTypeForAdapter, } from './formats.ts';
|
|
2
2
|
export { indexCandidateNames, indexSpellings, resolveIndexType, sidecarCandidateNames, } from './indexCandidates.ts';
|
|
3
|
+
export { type LooseTrackInput, isLooseTrackConfig } from './looseTrackConfig.ts';
|
|
3
4
|
export { adapterTypesToTrackTypeMap } from './trackTypes.generated.ts';
|
package/esm/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export { formats, matchFormat, trackTypeForAdapter, } from './formats.js';
|
|
1
|
+
export { fileNameOf, formats, matchFormat, trackTypeForAdapter, } from './formats.js';
|
|
2
2
|
export { indexCandidateNames, indexSpellings, resolveIndexType, sidecarCandidateNames, } from './indexCandidates.js';
|
|
3
|
+
export { isLooseTrackConfig } from './looseTrackConfig.js';
|
|
3
4
|
export { adapterTypesToTrackTypeMap } from './trackTypes.generated.js';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface LooseTrackInput {
|
|
2
|
+
uri: string;
|
|
3
|
+
index?: string;
|
|
4
|
+
baseUri?: string;
|
|
5
|
+
[key: string]: unknown;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* A track written as a data file with no `adapter`, the form
|
|
9
|
+
* `expandLooseTrackConfig` expands.
|
|
10
|
+
*/
|
|
11
|
+
export declare function isLooseTrackConfig(snap: unknown): snap is LooseTrackInput & {
|
|
12
|
+
trackId?: string;
|
|
13
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A track written as a data file with no `adapter`, the form
|
|
3
|
+
* `expandLooseTrackConfig` expands.
|
|
4
|
+
*/
|
|
5
|
+
export function isLooseTrackConfig(snap) {
|
|
6
|
+
return (typeof snap === 'object' &&
|
|
7
|
+
snap !== null &&
|
|
8
|
+
!Array.isArray(snap) &&
|
|
9
|
+
typeof snap.uri === 'string' &&
|
|
10
|
+
!('adapter' in snap));
|
|
11
|
+
}
|
package/package.json
CHANGED