@genome-spy/core 0.77.0 → 0.79.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.
- package/dist/bundle/{browser-KWU9rWZT.js → browser-CETrb2cm.js} +53 -33
- package/dist/bundle/esm-BdLYkz-m.js +248 -0
- package/dist/bundle/esm-BwiDsqSb.js +1367 -0
- package/dist/bundle/esm-CDFd1cjk.js +441 -0
- package/dist/bundle/{esm-CRMf_I9V.js → esm-CTUHLDbv.js} +30 -30
- package/dist/bundle/esm-Cx-EbkOj.js +1221 -0
- package/dist/bundle/esm-DlYGqi79.js +128 -0
- package/dist/bundle/{esm-BygJiwh0.js → esm-k9p3oHkt.js} +133 -158
- package/dist/bundle/{esm-CT3ygiMq.js → esm-zAZJQO6D.js} +226 -212
- package/dist/bundle/index.es.js +14102 -10810
- package/dist/bundle/index.js +109 -95
- package/dist/bundle/{parquetRead-DG_-F5j5.js → parquetRead-Cad1SOVV.js} +473 -399
- package/dist/schema.json +23788 -11049
- package/dist/src/config/axisConfig.d.ts +2 -2
- package/dist/src/config/axisConfig.d.ts.map +1 -1
- package/dist/src/config/axisConfig.js +28 -44
- package/dist/src/config/configLayers.d.ts +45 -0
- package/dist/src/config/configLayers.d.ts.map +1 -0
- package/dist/src/config/configLayers.js +110 -0
- package/dist/src/config/defaultConfig.d.ts.map +1 -1
- package/dist/src/config/defaultConfig.js +8 -1
- package/dist/src/config/defaults/legendDefaults.d.ts +14 -0
- package/dist/src/config/defaults/legendDefaults.d.ts.map +1 -0
- package/dist/src/config/defaults/legendDefaults.js +46 -0
- package/dist/src/config/defaults/titleDefaults.d.ts.map +1 -1
- package/dist/src/config/defaults/titleDefaults.js +26 -18
- package/dist/src/config/legendConfig.d.ts +11 -0
- package/dist/src/config/legendConfig.d.ts.map +1 -0
- package/dist/src/config/legendConfig.js +63 -0
- package/dist/src/config/styleUtils.d.ts +8 -2
- package/dist/src/config/styleUtils.d.ts.map +1 -1
- package/dist/src/config/styleUtils.js +25 -1
- package/dist/src/config/themes.d.ts.map +1 -1
- package/dist/src/config/themes.js +21 -2
- package/dist/src/config/titleConfig.d.ts.map +1 -1
- package/dist/src/config/titleConfig.js +2 -18
- package/dist/src/data/collector.d.ts.map +1 -1
- package/dist/src/data/collector.js +40 -18
- package/dist/src/data/flowInit.d.ts +6 -0
- package/dist/src/data/flowInit.d.ts.map +1 -1
- package/dist/src/data/flowInit.js +1 -1
- package/dist/src/data/flowNode.d.ts +32 -0
- package/dist/src/data/flowNode.d.ts.map +1 -1
- package/dist/src/data/flowNode.js +59 -0
- package/dist/src/data/sources/lazy/bamSource.d.ts +0 -1
- package/dist/src/data/sources/lazy/bamSource.d.ts.map +1 -1
- package/dist/src/data/sources/lazy/bamSource.js +39 -30
- package/dist/src/data/sources/lazy/bigBedSource.d.ts +0 -10
- package/dist/src/data/sources/lazy/bigBedSource.d.ts.map +1 -1
- package/dist/src/data/sources/lazy/bigBedSource.js +127 -62
- package/dist/src/data/sources/lazy/bigWigSource.d.ts +2 -2
- package/dist/src/data/sources/lazy/bigWigSource.d.ts.map +1 -1
- package/dist/src/data/sources/lazy/bigWigSource.js +234 -81
- package/dist/src/data/sources/lazy/gff3Source.d.ts +7 -3
- package/dist/src/data/sources/lazy/gff3Source.d.ts.map +1 -1
- package/dist/src/data/sources/lazy/gff3Source.js +7 -8
- package/dist/src/data/sources/lazy/indexedFastaSource.d.ts +1 -1
- package/dist/src/data/sources/lazy/indexedFastaSource.d.ts.map +1 -1
- package/dist/src/data/sources/lazy/indexedFastaSource.js +28 -19
- package/dist/src/data/sources/lazy/legendEntriesSource.d.ts +24 -0
- package/dist/src/data/sources/lazy/legendEntriesSource.d.ts.map +1 -0
- package/dist/src/data/sources/lazy/legendEntriesSource.js +217 -0
- package/dist/src/data/sources/lazy/legendGradientSource.d.ts +30 -0
- package/dist/src/data/sources/lazy/legendGradientSource.d.ts.map +1 -0
- package/dist/src/data/sources/lazy/legendGradientSource.js +388 -0
- package/dist/src/data/sources/lazy/mockLazySource.d.ts +4 -1
- package/dist/src/data/sources/lazy/mockLazySource.d.ts.map +1 -1
- package/dist/src/data/sources/lazy/mockLazySource.js +49 -4
- package/dist/src/data/sources/lazy/registerCoreLazySources.js +2 -0
- package/dist/src/data/sources/lazy/singleAxisWindowedSource.d.ts.map +1 -1
- package/dist/src/data/sources/lazy/singleAxisWindowedSource.js +3 -4
- package/dist/src/data/sources/lazy/tabixSource.d.ts +9 -4
- package/dist/src/data/sources/lazy/tabixSource.d.ts.map +1 -1
- package/dist/src/data/sources/lazy/tabixSource.js +201 -70
- package/dist/src/data/sources/lazy/tabixTsvSource.d.ts +2 -3
- package/dist/src/data/sources/lazy/tabixTsvSource.d.ts.map +1 -1
- package/dist/src/data/sources/lazy/tabixTsvSource.js +14 -12
- package/dist/src/data/sources/lazy/vcfSource.d.ts +7 -3
- package/dist/src/data/sources/lazy/vcfSource.d.ts.map +1 -1
- package/dist/src/data/sources/lazy/vcfSource.js +7 -8
- package/dist/src/data/sources/urlDescriptor.d.ts +165 -0
- package/dist/src/data/sources/urlDescriptor.d.ts.map +1 -0
- package/dist/src/data/sources/urlDescriptor.js +473 -0
- package/dist/src/data/sources/urlDescriptorController.d.ts +25 -0
- package/dist/src/data/sources/urlDescriptorController.d.ts.map +1 -0
- package/dist/src/data/sources/urlDescriptorController.js +72 -0
- package/dist/src/data/sources/urlDescriptorState.d.ts +47 -0
- package/dist/src/data/sources/urlDescriptorState.d.ts.map +1 -0
- package/dist/src/data/sources/urlDescriptorState.js +129 -0
- package/dist/src/data/sources/urlSource.d.ts.map +1 -1
- package/dist/src/data/sources/urlSource.js +101 -61
- package/dist/src/data/transforms/packLegendLabels.d.ts +21 -0
- package/dist/src/data/transforms/packLegendLabels.d.ts.map +1 -0
- package/dist/src/data/transforms/packLegendLabels.js +189 -0
- package/dist/src/data/transforms/transformFactory.d.ts.map +1 -1
- package/dist/src/data/transforms/transformFactory.js +4 -0
- package/dist/src/data/transforms/truncateText.d.ts +27 -0
- package/dist/src/data/transforms/truncateText.d.ts.map +1 -0
- package/dist/src/data/transforms/truncateText.js +94 -0
- package/dist/src/debug/dataflowDebugSnapshot.d.ts +58 -0
- package/dist/src/debug/dataflowDebugSnapshot.d.ts.map +1 -0
- package/dist/src/debug/dataflowDebugSnapshot.js +159 -0
- package/dist/src/debug/markDebugSnapshot.d.ts +54 -0
- package/dist/src/debug/markDebugSnapshot.d.ts.map +1 -0
- package/dist/src/debug/markDebugSnapshot.js +100 -0
- package/dist/src/debug/paramDebugSnapshot.d.ts +53 -0
- package/dist/src/debug/paramDebugSnapshot.d.ts.map +1 -0
- package/dist/src/debug/paramDebugSnapshot.js +86 -0
- package/dist/src/debug/resolutionDebugSnapshot.d.ts +155 -0
- package/dist/src/debug/resolutionDebugSnapshot.d.ts.map +1 -0
- package/dist/src/debug/resolutionDebugSnapshot.js +291 -0
- package/dist/src/debug/valuePreview.d.ts +9 -0
- package/dist/src/debug/valuePreview.d.ts.map +1 -0
- package/dist/src/debug/valuePreview.js +57 -0
- package/dist/src/debug/viewDebugSnapshot.d.ts +131 -0
- package/dist/src/debug/viewDebugSnapshot.d.ts.map +1 -0
- package/dist/src/debug/viewDebugSnapshot.js +390 -0
- package/dist/src/embedFactory.d.ts.map +1 -1
- package/dist/src/embedFactory.js +6 -1
- package/dist/src/encoder/encoder.d.ts +2 -2
- package/dist/src/encoder/encoder.d.ts.map +1 -1
- package/dist/src/encoder/encoder.js +5 -4
- package/dist/src/fonts/bmFontManager.d.ts +1 -1
- package/dist/src/fonts/bmFontManager.d.ts.map +1 -1
- package/dist/src/fonts/bmFontManager.js +45 -10
- package/dist/src/fonts/textMetrics.d.ts +69 -0
- package/dist/src/fonts/textMetrics.d.ts.map +1 -0
- package/dist/src/fonts/textMetrics.js +73 -0
- package/dist/src/genomeSpy/headlessBootstrap.d.ts.map +1 -1
- package/dist/src/genomeSpy/headlessBootstrap.js +8 -0
- package/dist/src/genomeSpy/interactionController.d.ts +4 -1
- package/dist/src/genomeSpy/interactionController.d.ts.map +1 -1
- package/dist/src/genomeSpy/interactionController.js +57 -13
- package/dist/src/genomeSpy/renderCoordinator.d.ts.map +1 -1
- package/dist/src/genomeSpy/renderCoordinator.js +25 -3
- package/dist/src/genomeSpy/viewDataInit.d.ts +14 -0
- package/dist/src/genomeSpy/viewDataInit.d.ts.map +1 -1
- package/dist/src/genomeSpy/viewDataInit.js +45 -8
- package/dist/src/genomeSpyBase.d.ts +6 -0
- package/dist/src/genomeSpyBase.d.ts.map +1 -1
- package/dist/src/genomeSpyBase.js +25 -4
- package/dist/src/gl/glslScaleGenerator.d.ts +17 -0
- package/dist/src/gl/glslScaleGenerator.d.ts.map +1 -1
- package/dist/src/gl/glslScaleGenerator.js +39 -2
- package/dist/src/gl/includes/common.glsl.js +1 -1
- package/dist/src/gl/vertexRangeIndex.d.ts.map +1 -1
- package/dist/src/gl/vertexRangeIndex.js +4 -2
- package/dist/src/gl/webGLHelper.d.ts +1 -1
- package/dist/src/gl/webGLHelper.d.ts.map +1 -1
- package/dist/src/gl/webGLHelper.js +13 -8
- package/dist/src/marks/__snapshots__/shaderSnapshot.test.js.snap +140 -3
- package/dist/src/marks/mark.d.ts +47 -4
- package/dist/src/marks/mark.d.ts.map +1 -1
- package/dist/src/marks/mark.js +158 -54
- package/dist/src/marks/point.d.ts.map +1 -1
- package/dist/src/marks/point.js +4 -0
- package/dist/src/marks/point.vertex.glsl.js +1 -1
- package/dist/src/marks/text.d.ts +1 -1
- package/dist/src/marks/text.d.ts.map +1 -1
- package/dist/src/marks/text.js +2 -7
- package/dist/src/marks/text.vertex.glsl.js +1 -1
- package/dist/src/paramRuntime/paramUtils.d.ts +43 -9
- package/dist/src/paramRuntime/paramUtils.d.ts.map +1 -1
- package/dist/src/paramRuntime/paramUtils.js +61 -1
- package/dist/src/paramRuntime/viewParamRuntime.d.ts +32 -0
- package/dist/src/paramRuntime/viewParamRuntime.d.ts.map +1 -1
- package/dist/src/paramRuntime/viewParamRuntime.js +63 -0
- package/dist/src/scales/axisResolution.d.ts +35 -0
- package/dist/src/scales/axisResolution.d.ts.map +1 -1
- package/dist/src/scales/axisResolution.js +115 -7
- package/dist/src/scales/domainExpressions.d.ts +21 -0
- package/dist/src/scales/domainExpressions.d.ts.map +1 -0
- package/dist/src/scales/domainExpressions.js +43 -0
- package/dist/src/scales/domainPlanner.d.ts +12 -1
- package/dist/src/scales/domainPlanner.d.ts.map +1 -1
- package/dist/src/scales/domainPlanner.js +55 -36
- package/dist/src/scales/legendResolution.d.ts +83 -0
- package/dist/src/scales/legendResolution.d.ts.map +1 -0
- package/dist/src/scales/legendResolution.js +461 -0
- package/dist/src/scales/scaleInstanceManager.d.ts +1 -0
- package/dist/src/scales/scaleInstanceManager.d.ts.map +1 -1
- package/dist/src/scales/scaleInstanceManager.js +5 -0
- package/dist/src/scales/scalePropsResolver.d.ts +6 -1
- package/dist/src/scales/scalePropsResolver.d.ts.map +1 -1
- package/dist/src/scales/scalePropsResolver.js +35 -10
- package/dist/src/scales/scaleResolution.d.ts +52 -0
- package/dist/src/scales/scaleResolution.d.ts.map +1 -1
- package/dist/src/scales/scaleResolution.js +195 -16
- package/dist/src/scales/scaleRules.d.ts +10 -0
- package/dist/src/scales/scaleRules.d.ts.map +1 -1
- package/dist/src/scales/scaleRules.js +38 -1
- package/dist/src/scales/viewLevelGuideConfig.d.ts +53 -0
- package/dist/src/scales/viewLevelGuideConfig.d.ts.map +1 -0
- package/dist/src/scales/viewLevelGuideConfig.js +224 -0
- package/dist/src/scales/viewLevelScaleConfig.d.ts +45 -0
- package/dist/src/scales/viewLevelScaleConfig.d.ts.map +1 -0
- package/dist/src/scales/viewLevelScaleConfig.js +149 -0
- package/dist/src/spec/axis.d.ts +109 -3
- package/dist/src/spec/channel.d.ts +23 -4
- package/dist/src/spec/config.d.ts +59 -4
- package/dist/src/spec/data.d.ts +177 -17
- package/dist/src/spec/legend.d.ts +246 -0
- package/dist/src/spec/mark.d.ts +16 -4
- package/dist/src/spec/scale.d.ts +19 -6
- package/dist/src/spec/title.d.ts +58 -1
- package/dist/src/spec/transform.d.ts +149 -0
- package/dist/src/spec/view.d.ts +50 -6
- package/dist/src/styles/genome-spy.css +4 -1
- package/dist/src/styles/genome-spy.css.d.ts +1 -1
- package/dist/src/styles/genome-spy.css.d.ts.map +1 -1
- package/dist/src/styles/genome-spy.css.js +4 -1
- package/dist/src/types/embedApi.d.ts +262 -6
- package/dist/src/types/rendering.d.ts +19 -3
- package/dist/src/types/viewContext.d.ts +18 -2
- package/dist/src/utils/arrayUtils.d.ts +11 -0
- package/dist/src/utils/arrayUtils.d.ts.map +1 -1
- package/dist/src/utils/arrayUtils.js +23 -0
- package/dist/src/utils/suspension.d.ts +17 -0
- package/dist/src/utils/suspension.d.ts.map +1 -0
- package/dist/src/utils/suspension.js +41 -0
- package/dist/src/utils/ui/tooltip.d.ts +4 -0
- package/dist/src/utils/ui/tooltip.d.ts.map +1 -1
- package/dist/src/utils/ui/tooltip.js +35 -10
- package/dist/src/view/axisGridView.d.ts.map +1 -1
- package/dist/src/view/axisGridView.js +1 -4
- package/dist/src/view/axisView.d.ts +18 -2
- package/dist/src/view/axisView.d.ts.map +1 -1
- package/dist/src/view/axisView.js +180 -75
- package/dist/src/view/concatView.d.ts +10 -2
- package/dist/src/view/concatView.d.ts.map +1 -1
- package/dist/src/view/concatView.js +46 -9
- package/dist/src/view/containerMutationHelper.d.ts +20 -1
- package/dist/src/view/containerMutationHelper.d.ts.map +1 -1
- package/dist/src/view/containerMutationHelper.js +203 -32
- package/dist/src/view/facetView.d.ts +1 -1
- package/dist/src/view/gridView/gridChild.d.ts +54 -4
- package/dist/src/view/gridView/gridChild.d.ts.map +1 -1
- package/dist/src/view/gridView/gridChild.js +301 -120
- package/dist/src/view/gridView/gridChildLegends.d.ts +57 -0
- package/dist/src/view/gridView/gridChildLegends.d.ts.map +1 -0
- package/dist/src/view/gridView/gridChildLegends.js +503 -0
- package/dist/src/view/gridView/gridView.d.ts +25 -0
- package/dist/src/view/gridView/gridView.d.ts.map +1 -1
- package/dist/src/view/gridView/gridView.js +454 -78
- package/dist/src/view/gridView/legendLayout.d.ts +26 -0
- package/dist/src/view/gridView/legendLayout.d.ts.map +1 -0
- package/dist/src/view/gridView/legendLayout.js +111 -0
- package/dist/src/view/gridView/scrollbar.d.ts.map +1 -1
- package/dist/src/view/gridView/scrollbar.js +1 -4
- package/dist/src/view/gridView/selectionRect.d.ts.map +1 -1
- package/dist/src/view/gridView/selectionRect.js +1 -4
- package/dist/src/view/gridView/separatorView.d.ts.map +1 -1
- package/dist/src/view/gridView/separatorView.js +1 -4
- package/dist/src/view/layerView.d.ts +9 -2
- package/dist/src/view/layerView.d.ts.map +1 -1
- package/dist/src/view/layerView.js +18 -1
- package/dist/src/view/layout/flexLayout.d.ts +20 -4
- package/dist/src/view/layout/flexLayout.d.ts.map +1 -1
- package/dist/src/view/layout/flexLayout.js +331 -31
- package/dist/src/view/layout/rectangle.d.ts +14 -0
- package/dist/src/view/layout/rectangle.d.ts.map +1 -1
- package/dist/src/view/layout/rectangle.js +40 -0
- package/dist/src/view/legend/legendEntries.d.ts +20 -0
- package/dist/src/view/legend/legendEntries.d.ts.map +1 -0
- package/dist/src/view/legend/legendEntries.js +21 -0
- package/dist/src/view/legendView.d.ts +134 -0
- package/dist/src/view/legendView.d.ts.map +1 -0
- package/dist/src/view/legendView.js +1611 -0
- package/dist/src/view/renderingContext/bufferedViewRenderingContext.d.ts.map +1 -1
- package/dist/src/view/renderingContext/bufferedViewRenderingContext.js +26 -4
- package/dist/src/view/renderingContext/clipOptions.d.ts +44 -0
- package/dist/src/view/renderingContext/clipOptions.d.ts.map +1 -0
- package/dist/src/view/renderingContext/clipOptions.js +140 -0
- package/dist/src/view/renderingContext/simpleViewRenderingContext.d.ts.map +1 -1
- package/dist/src/view/renderingContext/simpleViewRenderingContext.js +12 -1
- package/dist/src/view/resolutionPlanner.d.ts +2 -1
- package/dist/src/view/resolutionPlanner.d.ts.map +1 -1
- package/dist/src/view/resolutionPlanner.js +89 -25
- package/dist/src/view/testUtils.d.ts +4 -2
- package/dist/src/view/testUtils.d.ts.map +1 -1
- package/dist/src/view/testUtils.js +29 -7
- package/dist/src/view/titleView.d.ts +37 -0
- package/dist/src/view/titleView.d.ts.map +1 -0
- package/dist/src/view/titleView.js +584 -0
- package/dist/src/view/unitView.d.ts +3 -3
- package/dist/src/view/unitView.d.ts.map +1 -1
- package/dist/src/view/unitView.js +3 -2
- package/dist/src/view/view.d.ts +25 -24
- package/dist/src/view/view.d.ts.map +1 -1
- package/dist/src/view/view.js +121 -16
- package/dist/src/view/viewFactory.d.ts +2 -5
- package/dist/src/view/viewFactory.d.ts.map +1 -1
- package/dist/src/view/viewFactory.js +1 -2
- package/dist/src/view/viewIdentityRegistry.d.ts +37 -0
- package/dist/src/view/viewIdentityRegistry.d.ts.map +1 -0
- package/dist/src/view/viewIdentityRegistry.js +71 -0
- package/dist/src/view/viewMutationAcidTestUtils.d.ts +112 -0
- package/dist/src/view/viewMutationAcidTestUtils.d.ts.map +1 -0
- package/dist/src/view/viewMutationAcidTestUtils.js +234 -0
- package/dist/src/view/viewMutationApi.d.ts +42 -0
- package/dist/src/view/viewMutationApi.d.ts.map +1 -0
- package/dist/src/view/viewMutationApi.js +811 -0
- package/dist/src/view/viewSelectors.d.ts +10 -0
- package/dist/src/view/viewSelectors.d.ts.map +1 -1
- package/dist/src/view/viewSelectors.js +23 -1
- package/package.json +4 -4
- package/dist/bundle/esm-0dYHNV_D.js +0 -121
- package/dist/bundle/esm-C49STiCR.js +0 -1248
- package/dist/bundle/esm-CscjKVDc.js +0 -1426
- package/dist/bundle/esm-CuMSzCHy.js +0 -298
- package/dist/bundle/esm-DMXpJXM4.js +0 -369
- package/dist/src/view/title.d.ts +0 -13
- package/dist/src/view/title.d.ts.map +0 -1
- package/dist/src/view/title.js +0 -154
- /package/dist/bundle/{AbortablePromiseCache-3gHJdF3E.js → AbortablePromiseCache-BTmAcN-t.js} +0 -0
- /package/dist/bundle/{esm-CuVa5T98.js → esm-VvpZ9hsq.js} +0 -0
- /package/dist/bundle/{chunk-DmhlhrBa.js → rolldown-runtime-Dy4uBu1J.js} +0 -0
|
@@ -3,16 +3,32 @@ import {
|
|
|
3
3
|
activateExprRefProps,
|
|
4
4
|
withoutExprRef,
|
|
5
5
|
} from "../../../paramRuntime/paramUtils.js";
|
|
6
|
-
import
|
|
6
|
+
import { attachDescriptorFieldsToData } from "../urlDescriptor.js";
|
|
7
|
+
import UrlDescriptorController from "../urlDescriptorController.js";
|
|
8
|
+
import UrlDescriptorState, {
|
|
9
|
+
updateUrlDescriptorState,
|
|
10
|
+
} from "../urlDescriptorState.js";
|
|
7
11
|
import SingleAxisWindowedSource from "./singleAxisWindowedSource.js";
|
|
8
12
|
|
|
9
13
|
/**
|
|
10
14
|
* @template T
|
|
15
|
+
* @template P
|
|
11
16
|
* @abstract
|
|
12
17
|
*/
|
|
13
18
|
export default class TabixSource extends SingleAxisWindowedSource {
|
|
14
|
-
/**
|
|
15
|
-
|
|
19
|
+
/**
|
|
20
|
+
* @typedef {object} TabixHandle
|
|
21
|
+
* @prop {import("@gmod/tabix").TabixIndexedFile} tbiIndex
|
|
22
|
+
* @prop {Record<string, import("../../../spec/channel.js").Scalar>} [fields]
|
|
23
|
+
* @prop {P} parserContext
|
|
24
|
+
* @prop {string} url
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
/** @type {UrlDescriptorState<TabixHandle>} */
|
|
28
|
+
#descriptorState = new UrlDescriptorState();
|
|
29
|
+
|
|
30
|
+
/** @type {UrlDescriptorController} */
|
|
31
|
+
#urlDescriptors;
|
|
16
32
|
|
|
17
33
|
/**
|
|
18
34
|
* @param {import("../../../spec/data.js").TabixData} params
|
|
@@ -41,7 +57,7 @@ export default class TabixSource extends SingleAxisWindowedSource {
|
|
|
41
57
|
props.has("indexUrl") ||
|
|
42
58
|
props.has("addChrPrefix")
|
|
43
59
|
) {
|
|
44
|
-
this.#
|
|
60
|
+
this.#reloadIfCurrentDomainNeedsData();
|
|
45
61
|
} else if (props.has("windowSize")) {
|
|
46
62
|
this.reloadLastDomain();
|
|
47
63
|
}
|
|
@@ -50,6 +66,12 @@ export default class TabixSource extends SingleAxisWindowedSource {
|
|
|
50
66
|
{ batchMode: "whenPropagated" }
|
|
51
67
|
);
|
|
52
68
|
|
|
69
|
+
this.#urlDescriptors = new UrlDescriptorController(this, {
|
|
70
|
+
getUrl: () => this.params.url,
|
|
71
|
+
getIndexUrl: () => this.params.indexUrl,
|
|
72
|
+
onChange: () => this.#reloadIfCurrentDomainNeedsData(),
|
|
73
|
+
});
|
|
74
|
+
|
|
53
75
|
if (!withoutExprRef(this.params.url)) {
|
|
54
76
|
throw new Error("No URL provided for TabixSource");
|
|
55
77
|
}
|
|
@@ -60,48 +82,93 @@ export default class TabixSource extends SingleAxisWindowedSource {
|
|
|
60
82
|
}
|
|
61
83
|
|
|
62
84
|
#initialize() {
|
|
63
|
-
this.initializedPromise =
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
85
|
+
this.initializedPromise = this.#doInitialize();
|
|
86
|
+
return this.initializedPromise;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Refreshes active descriptors and reloads the current domain only if the
|
|
91
|
+
* current loaded data does not cover the new active descriptor set.
|
|
92
|
+
*/
|
|
93
|
+
async #reloadIfCurrentDomainNeedsData() {
|
|
94
|
+
try {
|
|
95
|
+
await this.#initialize();
|
|
96
|
+
|
|
97
|
+
if (
|
|
98
|
+
!this.isDataReadyForDomain({
|
|
99
|
+
[this.channel]: this.scaleResolution.getDomain(),
|
|
100
|
+
})
|
|
101
|
+
) {
|
|
102
|
+
this.reloadLastDomain();
|
|
103
|
+
}
|
|
104
|
+
} catch {
|
|
105
|
+
// Initialization has already updated the loading status.
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
async #doInitialize() {
|
|
110
|
+
await updateUrlDescriptorState({
|
|
111
|
+
controller: this.#urlDescriptors,
|
|
112
|
+
state: this.#descriptorState,
|
|
113
|
+
clearData: () => this.load(),
|
|
114
|
+
setLoadingStatus: (status, detail) =>
|
|
115
|
+
this.setLoadingStatus(status, detail),
|
|
116
|
+
loadModules: async () => {
|
|
117
|
+
const { TabixIndexedFile, RemoteFile } =
|
|
118
|
+
await loadTabixModules();
|
|
74
119
|
const addChrPrefix = withoutExprRef(this.params.addChrPrefix);
|
|
75
120
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
"error",
|
|
97
|
-
`${withoutExprRef(this.params.url)}: ${e.message}`
|
|
98
|
-
);
|
|
99
|
-
reject(e);
|
|
100
|
-
}
|
|
101
|
-
});
|
|
121
|
+
const renameRefSeqs =
|
|
122
|
+
addChrPrefix === true
|
|
123
|
+
? (/** @type {string} */ refSeq) => "chr" + refSeq
|
|
124
|
+
: addChrPrefix
|
|
125
|
+
? (/** @type {string} */ refSeq) =>
|
|
126
|
+
addChrPrefix + refSeq
|
|
127
|
+
: undefined;
|
|
128
|
+
|
|
129
|
+
return { TabixIndexedFile, RemoteFile, renameRefSeqs };
|
|
130
|
+
},
|
|
131
|
+
createHandle: (
|
|
132
|
+
descriptor,
|
|
133
|
+
{ TabixIndexedFile, RemoteFile, renameRefSeqs }
|
|
134
|
+
) =>
|
|
135
|
+
this.#createHandle(
|
|
136
|
+
descriptor,
|
|
137
|
+
TabixIndexedFile,
|
|
138
|
+
RemoteFile,
|
|
139
|
+
renameRefSeqs
|
|
140
|
+
),
|
|
102
141
|
});
|
|
142
|
+
}
|
|
103
143
|
|
|
104
|
-
|
|
144
|
+
/**
|
|
145
|
+
* @param {import("../urlDescriptor.js").UrlDescriptor} descriptor
|
|
146
|
+
* @param {typeof import("@gmod/tabix").TabixIndexedFile} TabixIndexedFile
|
|
147
|
+
* @param {typeof import("generic-filehandle2").RemoteFile} RemoteFile
|
|
148
|
+
* @param {((refSeq: string) => string) | undefined} renameRefSeqs
|
|
149
|
+
* @returns {Promise<TabixHandle>}
|
|
150
|
+
*/
|
|
151
|
+
async #createHandle(
|
|
152
|
+
descriptor,
|
|
153
|
+
TabixIndexedFile,
|
|
154
|
+
RemoteFile,
|
|
155
|
+
renameRefSeqs
|
|
156
|
+
) {
|
|
157
|
+
const tbiIndex = new TabixIndexedFile({
|
|
158
|
+
filehandle: new RemoteFile(descriptor.url),
|
|
159
|
+
tbiFilehandle: new RemoteFile(
|
|
160
|
+
descriptor.indexUrl ?? descriptor.url + ".tbi"
|
|
161
|
+
),
|
|
162
|
+
renameRefSeqs,
|
|
163
|
+
});
|
|
164
|
+
const header = await tbiIndex.getHeader();
|
|
165
|
+
|
|
166
|
+
return {
|
|
167
|
+
tbiIndex,
|
|
168
|
+
fields: descriptor.fields,
|
|
169
|
+
parserContext: await this._createParser(header, tbiIndex),
|
|
170
|
+
url: descriptor.url,
|
|
171
|
+
};
|
|
105
172
|
}
|
|
106
173
|
|
|
107
174
|
/**
|
|
@@ -111,51 +178,67 @@ export default class TabixSource extends SingleAxisWindowedSource {
|
|
|
111
178
|
*/
|
|
112
179
|
async loadInterval(interval) {
|
|
113
180
|
await this.initializedPromise;
|
|
114
|
-
const
|
|
181
|
+
const handles = this.#descriptorState.handles;
|
|
182
|
+
const featureChunksByHandle = await this.discretizeAndLoad(
|
|
115
183
|
interval,
|
|
116
|
-
async (discreteInterval, signal) =>
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
184
|
+
async (discreteInterval, signal) =>
|
|
185
|
+
await Promise.all(
|
|
186
|
+
handles.map(async (handle) => {
|
|
187
|
+
/** @type {string[]} */
|
|
188
|
+
const lines = [];
|
|
189
|
+
|
|
190
|
+
await handle.tbiIndex.getLines(
|
|
191
|
+
discreteInterval.chrom,
|
|
192
|
+
discreteInterval.startPos,
|
|
193
|
+
discreteInterval.endPos,
|
|
194
|
+
{
|
|
195
|
+
lineCallback: (line) => {
|
|
196
|
+
lines.push(line);
|
|
197
|
+
},
|
|
198
|
+
signal,
|
|
199
|
+
}
|
|
200
|
+
);
|
|
201
|
+
|
|
202
|
+
return /** @type {[TabixHandle, T[]]} */ ([
|
|
203
|
+
handle,
|
|
204
|
+
attachDescriptorFieldsToData(
|
|
205
|
+
this._parseFeatures(
|
|
206
|
+
lines,
|
|
207
|
+
handle.parserContext
|
|
208
|
+
),
|
|
209
|
+
handle.fields
|
|
210
|
+
),
|
|
211
|
+
]);
|
|
212
|
+
})
|
|
213
|
+
)
|
|
134
214
|
);
|
|
135
215
|
|
|
136
|
-
if (
|
|
137
|
-
this
|
|
216
|
+
if (featureChunksByHandle) {
|
|
217
|
+
this.#publishHandleData(handles, featureChunksByHandle);
|
|
138
218
|
}
|
|
139
219
|
}
|
|
140
220
|
|
|
141
221
|
/**
|
|
142
222
|
* @param {string} header
|
|
223
|
+
* @param {import("@gmod/tabix").TabixIndexedFile} tbiIndex
|
|
143
224
|
* @protected
|
|
225
|
+
* @returns {Promise<P>}
|
|
144
226
|
*/
|
|
145
|
-
async
|
|
146
|
-
|
|
227
|
+
async _createParser(header, tbiIndex) {
|
|
228
|
+
return /** @type {P} */ (undefined);
|
|
147
229
|
}
|
|
148
230
|
|
|
149
231
|
/**
|
|
150
232
|
* Read a prefix of the Tabix file and decode it as text.
|
|
151
233
|
*
|
|
234
|
+
* @param {import("@gmod/tabix").TabixIndexedFile} tbiIndex
|
|
152
235
|
* @returns {Promise<string>}
|
|
153
236
|
* @protected
|
|
154
237
|
*/
|
|
155
|
-
async _readFilePrefix() {
|
|
156
|
-
const { maxBlockSize } = await
|
|
157
|
-
const
|
|
158
|
-
const compressedPrefix = await
|
|
238
|
+
async _readFilePrefix(tbiIndex) {
|
|
239
|
+
const { maxBlockSize } = await tbiIndex.getMetadata();
|
|
240
|
+
const tabixIndex = /** @type {any} */ (tbiIndex);
|
|
241
|
+
const compressedPrefix = await tabixIndex.filehandle.read(
|
|
159
242
|
maxBlockSize,
|
|
160
243
|
0
|
|
161
244
|
);
|
|
@@ -167,10 +250,58 @@ export default class TabixSource extends SingleAxisWindowedSource {
|
|
|
167
250
|
* @abstract
|
|
168
251
|
* @protected
|
|
169
252
|
* @param {string[]} lines
|
|
253
|
+
* @param {P} parserContext
|
|
170
254
|
* @returns {T[]}
|
|
171
255
|
*/
|
|
172
|
-
_parseFeatures(lines) {
|
|
256
|
+
_parseFeatures(lines, parserContext) {
|
|
173
257
|
// Override me
|
|
174
258
|
return [];
|
|
175
259
|
}
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* @param {TabixHandle[]} handles
|
|
263
|
+
* @param {[TabixHandle, T[]][][]} featureChunksByHandle
|
|
264
|
+
*/
|
|
265
|
+
#publishHandleData(handles, featureChunksByHandle) {
|
|
266
|
+
this.reset();
|
|
267
|
+
|
|
268
|
+
for (const [handleIndex, handle] of handles.entries()) {
|
|
269
|
+
// Preserve physical file boundaries so downstream transforms can
|
|
270
|
+
// reset schema-dependent state for each partition.
|
|
271
|
+
this.beginBatch({ type: "file", url: handle.url });
|
|
272
|
+
|
|
273
|
+
for (const featureChunks of featureChunksByHandle) {
|
|
274
|
+
const [chunkHandle, data] = featureChunks[handleIndex];
|
|
275
|
+
if (chunkHandle !== handle) {
|
|
276
|
+
throw new Error("Tabix feature chunks are out of order.");
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
for (const datum of data) {
|
|
280
|
+
this._propagate(datum);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
this.complete();
|
|
286
|
+
this.#descriptorState.markLoaded();
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* @param {import("./singleAxisLazySource.js").DataReadinessRequest} request
|
|
291
|
+
* @returns {boolean}
|
|
292
|
+
*/
|
|
293
|
+
isDataReadyForDomain(request) {
|
|
294
|
+
return (
|
|
295
|
+
this.#descriptorState.activeSetLoaded &&
|
|
296
|
+
super.isDataReadyForDomain(request)
|
|
297
|
+
);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
async function loadTabixModules() {
|
|
302
|
+
const [{ TabixIndexedFile }, { RemoteFile }] = await Promise.all([
|
|
303
|
+
import("@gmod/tabix"),
|
|
304
|
+
import("generic-filehandle2"),
|
|
305
|
+
]);
|
|
306
|
+
return { TabixIndexedFile, RemoteFile };
|
|
176
307
|
}
|
|
@@ -27,11 +27,10 @@ export function extractTabixTsvColumnsFromFirstLine(text: string): string[] | un
|
|
|
27
27
|
*/
|
|
28
28
|
export function parseTabixTsvLines(lines: string[], columns: string[], parse?: import("../../../spec/data.js").Parse | null | undefined): Record<string, any>[];
|
|
29
29
|
/**
|
|
30
|
-
* @extends {TabixSource<Record<string, any
|
|
30
|
+
* @extends {TabixSource<Record<string, any>, string[]>}
|
|
31
31
|
*/
|
|
32
|
-
export default class TabixTsvSource extends TabixSource<Record<string, any
|
|
32
|
+
export default class TabixTsvSource extends TabixSource<Record<string, any>, string[]> {
|
|
33
33
|
constructor(params: import("../../../spec/data.js").TabixData, view: import("../../../view/view.js").default);
|
|
34
|
-
#private;
|
|
35
34
|
}
|
|
36
35
|
import TabixSource from "./tabixSource.js";
|
|
37
36
|
//# sourceMappingURL=tabixTsvSource.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabixTsvSource.d.ts","sourceRoot":"","sources":["../../../../../src/data/sources/lazy/tabixTsvSource.js"],"names":[],"mappings":"AAMA;;;;;;;;GAQG;AACH,+CAHW,MAAM,GACJ,MAAM,EAAE,GAAG,SAAS,CAsBhC;AAED;;;;;;;;GAQG;AACH,0DAHW,MAAM,GACJ,MAAM,EAAE,GAAG,SAAS,CAkBhC;AAED;;;;;;GAMG;AACH,0CAJW,MAAM,EAAE,WACR,MAAM,EAAE,UACR,OAAO,uBAAuB,EAAE,KAAK,GAAG,IAAI,GAAG,SAAS,yBAgClE;AAED;;GAEG;AACH
|
|
1
|
+
{"version":3,"file":"tabixTsvSource.d.ts","sourceRoot":"","sources":["../../../../../src/data/sources/lazy/tabixTsvSource.js"],"names":[],"mappings":"AAMA;;;;;;;;GAQG;AACH,+CAHW,MAAM,GACJ,MAAM,EAAE,GAAG,SAAS,CAsBhC;AAED;;;;;;;;GAQG;AACH,0DAHW,MAAM,GACJ,MAAM,EAAE,GAAG,SAAS,CAkBhC;AAED;;;;;;GAMG;AACH,0CAJW,MAAM,EAAE,WACR,MAAM,EAAE,UACR,OAAO,uBAAuB,EAAE,KAAK,GAAG,IAAI,GAAG,SAAS,yBAgClE;AAED;;GAEG;AACH;;CAgDC;wBAtJuB,kBAAkB"}
|
|
@@ -102,51 +102,53 @@ export function parseTabixTsvLines(lines, columns, parse) {
|
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
/**
|
|
105
|
-
* @extends {TabixSource<Record<string, any
|
|
105
|
+
* @extends {TabixSource<Record<string, any>, string[]>}
|
|
106
106
|
*/
|
|
107
107
|
export default class TabixTsvSource extends TabixSource {
|
|
108
|
-
/** @type {string[] | undefined} */
|
|
109
|
-
#columns;
|
|
110
|
-
|
|
111
108
|
get label() {
|
|
112
109
|
return "tabixSource";
|
|
113
110
|
}
|
|
114
111
|
|
|
115
112
|
/**
|
|
116
113
|
* @param {string} header
|
|
114
|
+
* @param {import("@gmod/tabix").TabixIndexedFile} tbiIndex
|
|
115
|
+
* @returns {Promise<string[]>}
|
|
117
116
|
*/
|
|
118
|
-
async
|
|
117
|
+
async _createParser(header, tbiIndex) {
|
|
119
118
|
const params =
|
|
120
119
|
/** @type {import("../../../spec/data.js").TabixTsvData} */ (
|
|
121
120
|
this.params
|
|
122
121
|
);
|
|
123
122
|
const columns = withoutExprRef(params.columns);
|
|
124
|
-
|
|
123
|
+
let fileColumns = columns ?? extractTabixTsvColumns(header);
|
|
125
124
|
|
|
126
|
-
if (!
|
|
127
|
-
|
|
128
|
-
await this._readFilePrefix()
|
|
125
|
+
if (!fileColumns?.length) {
|
|
126
|
+
fileColumns = extractTabixTsvColumnsFromFirstLine(
|
|
127
|
+
await this._readFilePrefix(tbiIndex)
|
|
129
128
|
);
|
|
130
129
|
}
|
|
131
130
|
|
|
132
|
-
if (!
|
|
131
|
+
if (!fileColumns?.length) {
|
|
133
132
|
throw new Error(
|
|
134
133
|
"No columns available for Tabix TSV source. Provide data.lazy.columns or a tabix header line such as #chrom\\tstart\\tend, or a plain first row such as chrom\\tstart\\tend."
|
|
135
134
|
);
|
|
136
135
|
}
|
|
136
|
+
|
|
137
|
+
return fileColumns;
|
|
137
138
|
}
|
|
138
139
|
|
|
139
140
|
/**
|
|
140
141
|
* @param {string[]} lines
|
|
142
|
+
* @param {string[] | undefined} columns
|
|
141
143
|
*/
|
|
142
|
-
_parseFeatures(lines) {
|
|
144
|
+
_parseFeatures(lines, columns) {
|
|
143
145
|
const params =
|
|
144
146
|
/** @type {import("../../../spec/data.js").TabixTsvData} */ (
|
|
145
147
|
this.params
|
|
146
148
|
);
|
|
147
149
|
return parseTabixTsvLines(
|
|
148
150
|
lines,
|
|
149
|
-
|
|
151
|
+
columns ?? [],
|
|
150
152
|
withoutExprRef(params.parse)
|
|
151
153
|
);
|
|
152
154
|
}
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @extends {TabixSource<import("./vcfTypes.js").ParsedVariant>}
|
|
2
|
+
* @extends {TabixSource<import("./vcfTypes.js").ParsedVariant, import("@gmod/vcf").default>}
|
|
3
3
|
*/
|
|
4
|
-
export default class VcfSource extends TabixSource<import("./vcfTypes.js").ParsedVariant> {
|
|
4
|
+
export default class VcfSource extends TabixSource<import("./vcfTypes.js").ParsedVariant, import("@gmod/vcf").default> {
|
|
5
5
|
constructor(params: import("../../../spec/data.js").TabixData, view: import("../../../view/view.js").default);
|
|
6
|
-
|
|
6
|
+
/**
|
|
7
|
+
* @param {string} header
|
|
8
|
+
* @returns {Promise<import("@gmod/vcf").default>}
|
|
9
|
+
*/
|
|
10
|
+
_createParser(header: string): Promise<import("@gmod/vcf").default>;
|
|
7
11
|
}
|
|
8
12
|
import TabixSource from "./tabixSource.js";
|
|
9
13
|
//# sourceMappingURL=vcfSource.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vcfSource.d.ts","sourceRoot":"","sources":["../../../../../src/data/sources/lazy/vcfSource.js"],"names":[],"mappings":"AAGA;;GAEG;AACH;;;
|
|
1
|
+
{"version":3,"file":"vcfSource.d.ts","sourceRoot":"","sources":["../../../../../src/data/sources/lazy/vcfSource.js"],"names":[],"mappings":"AAGA;;GAEG;AACH;;IAKI;;;OAGG;IACH,sBAHW,MAAM,GACJ,OAAO,CAAC,OAAO,WAAW,EAAE,OAAO,CAAC,CAMhD;CAkBJ;wBArCuB,kBAAkB"}
|
|
@@ -2,31 +2,30 @@ import TabixSource from "./tabixSource.js";
|
|
|
2
2
|
import { registerBuiltInLazyDataSource } from "./lazyDataSourceRegistry.js";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* @extends {TabixSource<import("./vcfTypes.js").ParsedVariant>}
|
|
5
|
+
* @extends {TabixSource<import("./vcfTypes.js").ParsedVariant, import("@gmod/vcf").default>}
|
|
6
6
|
*/
|
|
7
7
|
export default class VcfSource extends TabixSource {
|
|
8
|
-
/** @type {import("@gmod/vcf").default} */
|
|
9
|
-
#tbiVCFParser;
|
|
10
|
-
|
|
11
8
|
get label() {
|
|
12
9
|
return "vcfSource";
|
|
13
10
|
}
|
|
14
11
|
|
|
15
12
|
/**
|
|
16
13
|
* @param {string} header
|
|
14
|
+
* @returns {Promise<import("@gmod/vcf").default>}
|
|
17
15
|
*/
|
|
18
|
-
async
|
|
16
|
+
async _createParser(header) {
|
|
19
17
|
const VCFParser = (await import("@gmod/vcf")).default;
|
|
20
18
|
// @ts-ignore - There's something wrong with the type definition
|
|
21
|
-
|
|
19
|
+
return new VCFParser({ header });
|
|
22
20
|
}
|
|
23
21
|
|
|
24
22
|
/**
|
|
25
23
|
* @param {string[]} lines
|
|
24
|
+
* @param {import("@gmod/vcf").default} parser
|
|
26
25
|
*/
|
|
27
|
-
_parseFeatures(lines) {
|
|
26
|
+
_parseFeatures(lines, parser) {
|
|
28
27
|
return lines.map((line) => {
|
|
29
|
-
const parsed =
|
|
28
|
+
const parsed = parser.parseLine(line);
|
|
30
29
|
delete parsed.GENOTYPES;
|
|
31
30
|
// @ts-ignore
|
|
32
31
|
parsed.SAMPLES = parsed.SAMPLES();
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Expands a URL spec into concrete descriptors, resolves relative URLs against
|
|
3
|
+
* the view base URL, deduplicates the result, and enforces `maxValues`.
|
|
4
|
+
*
|
|
5
|
+
* @param {UrlDescriptorOptions} options
|
|
6
|
+
* @returns {Promise<UrlDescriptor[]>}
|
|
7
|
+
*/
|
|
8
|
+
export function normalizeUrlDescriptors(options: UrlDescriptorOptions): Promise<UrlDescriptor[]>;
|
|
9
|
+
/**
|
|
10
|
+
* Expands a URL spec that is expected to resolve to exactly one descriptor.
|
|
11
|
+
* Sources that still support only one remote file use this to fail before
|
|
12
|
+
* constructing file handles.
|
|
13
|
+
*
|
|
14
|
+
* @param {UrlDescriptorOptions} options
|
|
15
|
+
* @param {string} sourceName
|
|
16
|
+
* @returns {Promise<UrlDescriptor>}
|
|
17
|
+
*/
|
|
18
|
+
export function normalizeSingleUrlDescriptor(options: UrlDescriptorOptions, sourceName: string): Promise<UrlDescriptor>;
|
|
19
|
+
/**
|
|
20
|
+
* Subscribes to expressions that affect URL expansion. Sources call this in
|
|
21
|
+
* addition to `activateExprRefProps` because template values are nested under
|
|
22
|
+
* `url.values` and therefore are not top-level data source properties.
|
|
23
|
+
*
|
|
24
|
+
* @param {{
|
|
25
|
+
* url: UrlSourceRef | SingleUrlSourceRef | MultiUrlSourceRef | unknown,
|
|
26
|
+
* indexUrl?: IndexUrlSourceRef | unknown,
|
|
27
|
+
* paramRuntime: UrlExpressionRuntime,
|
|
28
|
+
* listener: () => void,
|
|
29
|
+
* registerDisposer?: (disposer: () => void) => void,
|
|
30
|
+
* }} options
|
|
31
|
+
*/
|
|
32
|
+
export function watchUrlDescriptorExpressions(options: {
|
|
33
|
+
url: UrlSourceRef | SingleUrlSourceRef | MultiUrlSourceRef | unknown;
|
|
34
|
+
indexUrl?: IndexUrlSourceRef | unknown;
|
|
35
|
+
paramRuntime: UrlExpressionRuntime;
|
|
36
|
+
listener: () => void;
|
|
37
|
+
registerDisposer?: (disposer: () => void) => void;
|
|
38
|
+
}): void;
|
|
39
|
+
/**
|
|
40
|
+
* Creates a mutating attacher for descriptor fields. Descriptor fields are
|
|
41
|
+
* source context from URL expansion, such as `{ sample: "S1" }`. Source-loaded
|
|
42
|
+
* datums are fresh objects, so mutating them avoids per-row cloning while still
|
|
43
|
+
* detecting ambiguous source metadata.
|
|
44
|
+
*
|
|
45
|
+
* @param {Record<string, Scalar>} [fields]
|
|
46
|
+
* @returns {(datum: Record<string, any>) => Record<string, any>}
|
|
47
|
+
*/
|
|
48
|
+
export function createDescriptorFieldAttacher(fields?: Record<string, Scalar>): (datum: Record<string, any>) => Record<string, any>;
|
|
49
|
+
/**
|
|
50
|
+
* Attaches descriptor fields to a loaded datum.
|
|
51
|
+
*
|
|
52
|
+
* @template {Record<string, any>} T
|
|
53
|
+
* @param {T} datum
|
|
54
|
+
* @param {Record<string, Scalar>} [fields]
|
|
55
|
+
* @returns {T}
|
|
56
|
+
*/
|
|
57
|
+
export function attachDescriptorFields<T extends Record<string, any>>(datum: T, fields?: Record<string, Scalar>): T;
|
|
58
|
+
/**
|
|
59
|
+
* @template {Record<string, any>} T
|
|
60
|
+
* @param {T[]} data
|
|
61
|
+
* @param {Record<string, Scalar>} [fields]
|
|
62
|
+
* @returns {T[]}
|
|
63
|
+
*/
|
|
64
|
+
export function attachDescriptorFieldsToData<T extends Record<string, any>>(data: T[], fields?: Record<string, Scalar>): T[];
|
|
65
|
+
/**
|
|
66
|
+
* Runs a per-descriptor load operation and converts configured failures into
|
|
67
|
+
* skipped results.
|
|
68
|
+
*
|
|
69
|
+
* @template T
|
|
70
|
+
* @param {UrlDescriptor} descriptor
|
|
71
|
+
* @param {() => Promise<T>} load
|
|
72
|
+
* @returns {Promise<T | undefined>}
|
|
73
|
+
*/
|
|
74
|
+
export function loadUrlDescriptorOrSkip<T>(descriptor: UrlDescriptor, load: () => Promise<T>): Promise<T | undefined>;
|
|
75
|
+
/**
|
|
76
|
+
* Returns a stable key for comparing URL descriptors independently of their
|
|
77
|
+
* position in a descriptor array.
|
|
78
|
+
*
|
|
79
|
+
* @param {UrlDescriptor} descriptor
|
|
80
|
+
*/
|
|
81
|
+
export function urlDescriptorKey(descriptor: UrlDescriptor): string;
|
|
82
|
+
/**
|
|
83
|
+
* @typedef {import("../../spec/channel.js").Scalar} Scalar
|
|
84
|
+
* @typedef {import("../../spec/data.js").UrlSourceRef} UrlSourceRef
|
|
85
|
+
* @typedef {import("../../spec/data.js").SingleUrlSourceRef} SingleUrlSourceRef
|
|
86
|
+
* @typedef {import("../../spec/data.js").MultiUrlSourceRef} MultiUrlSourceRef
|
|
87
|
+
* @typedef {import("../../spec/data.js").IndexUrlSourceRef} IndexUrlSourceRef
|
|
88
|
+
* @typedef {import("../../spec/data.js").UrlTemplate} UrlTemplate
|
|
89
|
+
* @typedef {import("../../spec/data.js").IndexUrlTemplate} IndexUrlTemplate
|
|
90
|
+
* @typedef {import("../../spec/parameter.js").ExprRef} ExprRef
|
|
91
|
+
* @typedef {() => unknown} ExpressionFunction
|
|
92
|
+
* @typedef {ExpressionFunction & { subscribe?: (listener: () => void) => () => void }} SubscribableExpressionFunction
|
|
93
|
+
* @typedef {{
|
|
94
|
+
* createExpression: (expr: string) => SubscribableExpressionFunction,
|
|
95
|
+
* watchExpression?: (
|
|
96
|
+
* expr: string,
|
|
97
|
+
* listener: () => void,
|
|
98
|
+
* options?: {
|
|
99
|
+
* scopeOwned?: boolean,
|
|
100
|
+
* registerDisposer?: (disposer: () => void) => void
|
|
101
|
+
* }
|
|
102
|
+
* ) => SubscribableExpressionFunction,
|
|
103
|
+
* }} UrlExpressionRuntime
|
|
104
|
+
*/
|
|
105
|
+
/**
|
|
106
|
+
* @typedef {object} UrlDescriptor
|
|
107
|
+
* @prop {string} url
|
|
108
|
+
* @prop {string} [indexUrl]
|
|
109
|
+
* @prop {Record<string, Scalar>} [fields]
|
|
110
|
+
* @prop {"error" | "skip"} [onLoadError]
|
|
111
|
+
*/
|
|
112
|
+
/**
|
|
113
|
+
* @typedef {object} UrlDescriptorOptions
|
|
114
|
+
* @prop {UrlSourceRef | SingleUrlSourceRef | MultiUrlSourceRef | unknown} url
|
|
115
|
+
* @prop {IndexUrlSourceRef | unknown} [indexUrl]
|
|
116
|
+
* @prop {string} [baseUrl]
|
|
117
|
+
* @prop {UrlExpressionRuntime} [paramRuntime]
|
|
118
|
+
*/
|
|
119
|
+
/**
|
|
120
|
+
* Thrown when URL expansion resolves more distinct descriptors than the spec
|
|
121
|
+
* allows. Sources may handle this as an intentional empty data state.
|
|
122
|
+
*/
|
|
123
|
+
export class UrlLimitExceededError extends Error {
|
|
124
|
+
/**
|
|
125
|
+
* @param {number} count
|
|
126
|
+
* @param {number} maxValues
|
|
127
|
+
*/
|
|
128
|
+
constructor(count: number, maxValues: number);
|
|
129
|
+
/** @type {number} */
|
|
130
|
+
count: number;
|
|
131
|
+
/** @type {number} */
|
|
132
|
+
maxValues: number;
|
|
133
|
+
}
|
|
134
|
+
export type Scalar = import("../../spec/channel.js").Scalar;
|
|
135
|
+
export type UrlSourceRef = import("../../spec/data.js").UrlSourceRef;
|
|
136
|
+
export type SingleUrlSourceRef = import("../../spec/data.js").SingleUrlSourceRef;
|
|
137
|
+
export type MultiUrlSourceRef = import("../../spec/data.js").MultiUrlSourceRef;
|
|
138
|
+
export type IndexUrlSourceRef = import("../../spec/data.js").IndexUrlSourceRef;
|
|
139
|
+
export type UrlTemplate = import("../../spec/data.js").UrlTemplate;
|
|
140
|
+
export type IndexUrlTemplate = import("../../spec/data.js").IndexUrlTemplate;
|
|
141
|
+
export type ExprRef = import("../../spec/parameter.js").ExprRef;
|
|
142
|
+
export type ExpressionFunction = () => unknown;
|
|
143
|
+
export type SubscribableExpressionFunction = ExpressionFunction & {
|
|
144
|
+
subscribe?: (listener: () => void) => () => void;
|
|
145
|
+
};
|
|
146
|
+
export type UrlExpressionRuntime = {
|
|
147
|
+
createExpression: (expr: string) => SubscribableExpressionFunction;
|
|
148
|
+
watchExpression?: (expr: string, listener: () => void, options?: {
|
|
149
|
+
scopeOwned?: boolean;
|
|
150
|
+
registerDisposer?: (disposer: () => void) => void;
|
|
151
|
+
}) => SubscribableExpressionFunction;
|
|
152
|
+
};
|
|
153
|
+
export type UrlDescriptor = {
|
|
154
|
+
url: string;
|
|
155
|
+
indexUrl?: string;
|
|
156
|
+
fields?: Record<string, Scalar>;
|
|
157
|
+
onLoadError?: "error" | "skip";
|
|
158
|
+
};
|
|
159
|
+
export type UrlDescriptorOptions = {
|
|
160
|
+
url: UrlSourceRef | SingleUrlSourceRef | MultiUrlSourceRef | unknown;
|
|
161
|
+
indexUrl?: IndexUrlSourceRef | unknown;
|
|
162
|
+
baseUrl?: string;
|
|
163
|
+
paramRuntime?: UrlExpressionRuntime;
|
|
164
|
+
};
|
|
165
|
+
//# sourceMappingURL=urlDescriptor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"urlDescriptor.d.ts","sourceRoot":"","sources":["../../../../src/data/sources/urlDescriptor.js"],"names":[],"mappings":"AAgFA;;;;;;GAMG;AACH,iDAHW,oBAAoB,GAClB,OAAO,CAAC,aAAa,EAAE,CAAC,CAapC;AAED;;;;;;;;GAQG;AACH,sDAJW,oBAAoB,cACpB,MAAM,GACJ,OAAO,CAAC,aAAa,CAAC,CAQlC;AAED;;;;;;;;;;;;GAYG;AACH,uDARW;IACN,GAAG,EAAE,YAAY,GAAG,kBAAkB,GAAG,iBAAiB,GAAG,OAAO,CAAC;IACrE,QAAQ,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC;IACvC,YAAY,EAAE,oBAAoB,CAAC;IACnC,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC;CACnD,QAgBH;AAED;;;;;;;;GAQG;AACH,uDAHW,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GACpB,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAoC/D;AAED;;;;;;;GAOG;AACH,uCALmC,CAAC,SAAtB,MAAM,CAAC,MAAM,EAAE,GAAG,CAAE,SACvB,CAAC,WACD,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GACpB,CAAC,CAIb;AAED;;;;;GAKG;AACH,6CALmC,CAAC,SAAtB,MAAM,CAAC,MAAM,EAAE,GAAG,CAAE,QACvB,CAAC,EAAE,WACH,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GACpB,CAAC,EAAE,CAYf;AAoBD;;;;;;;;GAQG;AACH,wCALa,CAAC,cACH,aAAa,QACb,MAAM,OAAO,CAAC,CAAC,CAAC,GACd,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,CAWlC;AAED;;;;;GAKG;AACH,6CAFW,aAAa,UAUvB;AAlQD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH;;;;;;GAMG;AAEH;;;;;;GAMG;AAEH;;;GAGG;AACH;IAOI;;;OAGG;IACH,mBAHW,MAAM,aACN,MAAM,EAShB;IAjBD,qBAAqB;IACrB,OADW,MAAM,CACX;IAEN,qBAAqB;IACrB,WADW,MAAM,CACP;CAcb;qBA9DY,OAAO,uBAAuB,EAAE,MAAM;2BACtC,OAAO,oBAAoB,EAAE,YAAY;iCACzC,OAAO,oBAAoB,EAAE,kBAAkB;gCAC/C,OAAO,oBAAoB,EAAE,iBAAiB;gCAC9C,OAAO,oBAAoB,EAAE,iBAAiB;0BAC9C,OAAO,oBAAoB,EAAE,WAAW;+BACxC,OAAO,oBAAoB,EAAE,gBAAgB;sBAC7C,OAAO,yBAAyB,EAAE,OAAO;iCACzC,MAAM,OAAO;6CACb,kBAAkB,GAAG;IAAE,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,IAAI,KAAK,MAAM,IAAI,CAAA;CAAE;mCACzE;IACN,gBAAgB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,8BAA8B,CAAC;IACnE,eAAe,CAAC,EAAE,CACd,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,IAAI,EACpB,OAAO,CAAC,EAAE;QACN,UAAU,CAAC,EAAE,OAAO,CAAC;QACrB,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,IAAI,KAAK,IAAI,CAAA;KACpD,KACA,8BAA8B,CAAC;CACvC;;SAKM,MAAM;eACN,MAAM;aACN,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;kBACtB,OAAO,GAAG,MAAM;;;SAKhB,YAAY,GAAG,kBAAkB,GAAG,iBAAiB,GAAG,OAAO;eAC/D,iBAAiB,GAAG,OAAO;cAC3B,MAAM;mBACN,oBAAoB"}
|