@jbrowse/core 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.
- package/BaseFeatureWidget/BaseFeatureDetail/ArrayValue.js +1 -2
- package/BaseFeatureWidget/BaseFeatureDetail/Attributes.js +4 -8
- package/BaseFeatureWidget/BaseFeatureDetail/BaseCard.d.ts +1 -1
- package/BaseFeatureWidget/BaseFeatureDetail/BaseCard.js +1 -2
- package/BaseFeatureWidget/BaseFeatureDetail/BasicValue.js +2 -3
- package/BaseFeatureWidget/BaseFeatureDetail/CoreDetails.d.ts +1 -1
- package/BaseFeatureWidget/BaseFeatureDetail/CoreDetails.js +2 -3
- package/BaseFeatureWidget/BaseFeatureDetail/DataGridDetails.js +22 -25
- package/BaseFeatureWidget/BaseFeatureDetail/FeatureDetails.d.ts +2 -2
- package/BaseFeatureWidget/BaseFeatureDetail/FeatureDetails.js +6 -8
- package/BaseFeatureWidget/BaseFeatureDetail/Position.d.ts +1 -1
- package/BaseFeatureWidget/BaseFeatureDetail/SimpleField.js +1 -1
- package/BaseFeatureWidget/BaseFeatureDetail/UriField.js +1 -1
- package/BaseFeatureWidget/BaseFeatureDetail/index.d.ts +3 -4
- package/BaseFeatureWidget/BaseFeatureDetail/index.js +5 -9
- package/BaseFeatureWidget/BaseFeatureDetail/util.js +0 -5
- package/BaseFeatureWidget/SequenceFeatureDetails/SequenceFeatureDetails.d.ts +2 -2
- package/BaseFeatureWidget/SequenceFeatureDetails/SequenceFeatureDetails.js +0 -7
- package/BaseFeatureWidget/SequenceFeatureDetails/SequenceFeaturePanel.d.ts +2 -2
- package/BaseFeatureWidget/SequenceFeatureDetails/SequenceFeaturePanel.js +1 -7
- package/BaseFeatureWidget/SequenceFeatureDetails/SequencePanel.d.ts +3 -3
- package/BaseFeatureWidget/SequenceFeatureDetails/SequencePanel.js +24 -33
- package/BaseFeatureWidget/SequenceFeatureDetails/dialogs/HelpDialog.js +1 -2
- package/BaseFeatureWidget/SequenceFeatureDetails/dialogs/SequenceDialog.d.ts +2 -2
- package/BaseFeatureWidget/SequenceFeatureDetails/dialogs/SequenceDialog.js +3 -4
- package/BaseFeatureWidget/SequenceFeatureDetails/dialogs/SequenceFeatureMenu.d.ts +2 -2
- package/BaseFeatureWidget/SequenceFeatureDetails/dialogs/SequenceFeatureMenu.js +3 -6
- package/BaseFeatureWidget/SequenceFeatureDetails/dialogs/SequenceTypeSelector.d.ts +1 -1
- package/BaseFeatureWidget/SequenceFeatureDetails/dialogs/SettingsDialog.d.ts +1 -1
- package/BaseFeatureWidget/SequenceFeatureDetails/dialogs/SettingsDialog.js +2 -2
- package/BaseFeatureWidget/SequenceFeatureDetails/hooks.d.ts +2 -2
- package/BaseFeatureWidget/SequenceFeatureDetails/hooks.js +1 -2
- package/BaseFeatureWidget/SequenceFeatureDetails/model.d.ts +2 -35
- package/BaseFeatureWidget/SequenceFeatureDetails/model.js +19 -44
- package/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/CDNASequence.d.ts +3 -3
- package/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/CDSSequence.d.ts +2 -2
- package/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/CDSSequence.js +5 -6
- package/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/GenomicSequence.d.ts +2 -2
- package/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/GenomicSequence.js +0 -1
- package/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/ProteinSequence.d.ts +2 -2
- package/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/ProteinSequence.js +0 -2
- package/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/SequenceDisplay.d.ts +1 -1
- package/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/SequenceDisplay.js +1 -3
- package/BaseFeatureWidget/SequenceFeatureDetails/util.js +1 -5
- package/BaseFeatureWidget/stateModelFactory.d.ts +3 -94
- package/BaseFeatureWidget/stateModelFactory.js +3 -73
- package/BaseFeatureWidget/types.d.ts +3 -3
- package/BaseFeatureWidget/util.js +0 -4
- package/CorePlugin.d.ts +1 -1
- package/CorePlugin.js +2 -5
- package/Plugin.d.ts +2 -5
- package/Plugin.js +0 -3
- package/PluginLoader.d.ts +1 -1
- package/PluginLoader.js +2 -19
- package/PluginManager.d.ts +15 -31
- package/PluginManager.js +11 -39
- package/ReExports/DataGrid.js +0 -1
- package/ReExports/list.d.ts +0 -5
- package/ReExports/list.js +0 -5
- package/ReExports/modules.d.ts +22 -20
- package/ReExports/modules.js +16 -25
- package/TextSearch/BaseResults.d.ts +3 -3
- package/TextSearch/TextSearchManager.d.ts +4 -16
- package/TextSearch/TextSearchManager.js +1 -13
- package/assemblyManager/assembly.d.ts +5 -100
- package/assemblyManager/assembly.js +27 -143
- package/assemblyManager/assemblyConfigSchema.d.ts +1 -34
- package/assemblyManager/assemblyConfigSchema.js +12 -46
- package/assemblyManager/assemblyManager.d.ts +7 -57
- package/assemblyManager/assemblyManager.js +2 -57
- package/configuration/configurationSchema.d.ts +4 -4
- package/configuration/configurationSchema.js +2 -14
- package/configuration/configurationSlot.d.ts +1 -12
- package/configuration/configurationSlot.js +2 -32
- package/configuration/index.d.ts +2 -2
- package/configuration/index.js +2 -2
- package/configuration/types.d.ts +2 -3
- package/configuration/util.d.ts +1 -25
- package/configuration/util.js +19 -56
- package/data_adapters/BaseAdapter/BaseAdapter.d.ts +4 -14
- package/data_adapters/BaseAdapter/BaseAdapter.js +1 -10
- package/data_adapters/BaseAdapter/BaseFeatureDataAdapter.d.ts +10 -114
- package/data_adapters/BaseAdapter/BaseFeatureDataAdapter.js +13 -79
- package/data_adapters/BaseAdapter/BaseOptions.d.ts +2 -2
- package/data_adapters/BaseAdapter/BaseRefNameAliasAdapter.d.ts +2 -2
- package/data_adapters/BaseAdapter/BaseSequenceAdapter.d.ts +3 -6
- package/data_adapters/BaseAdapter/BaseTextSearchAdapter.d.ts +3 -3
- package/data_adapters/BaseAdapter/RegionsAdapter.d.ts +3 -3
- package/data_adapters/BaseAdapter/index.d.ts +4 -4
- package/data_adapters/BaseAdapter/types.d.ts +2 -2
- package/data_adapters/BaseAdapter/util.d.ts +6 -6
- package/data_adapters/CytobandAdapter/CytobandAdapter.d.ts +2 -1
- package/data_adapters/CytobandAdapter/CytobandAdapter.js +11 -12
- package/data_adapters/CytobandAdapter/configSchema.d.ts +0 -3
- package/data_adapters/CytobandAdapter/configSchema.js +1 -7
- package/data_adapters/CytobandAdapter/index.d.ts +1 -1
- package/data_adapters/CytobandAdapter/index.js +1 -1
- package/data_adapters/dataAdapterCache.d.ts +4 -21
- package/data_adapters/dataAdapterCache.js +0 -19
- package/package.json +4 -5
- package/pluggableElementTypes/AdapterType.d.ts +2 -2
- package/pluggableElementTypes/AddTrackWorkflowType.d.ts +2 -2
- package/pluggableElementTypes/ConnectionType.d.ts +3 -3
- package/pluggableElementTypes/DisplayType.d.ts +3 -9
- package/pluggableElementTypes/InternetAccountType.d.ts +2 -2
- package/pluggableElementTypes/PluggableElementBase.d.ts +1 -1
- package/pluggableElementTypes/PluggableElementBase.js +2 -2
- package/pluggableElementTypes/RpcMethodType.d.ts +5 -11
- package/pluggableElementTypes/RpcMethodType.js +7 -19
- package/pluggableElementTypes/RpcMethodTypeWithFiltersAndRenameRegions.d.ts +9 -0
- package/pluggableElementTypes/RpcMethodTypeWithFiltersAndRenameRegions.js +35 -0
- package/pluggableElementTypes/TextSearchAdapterType.d.ts +2 -2
- package/pluggableElementTypes/TrackType.d.ts +3 -3
- package/pluggableElementTypes/ViewType.d.ts +3 -3
- package/pluggableElementTypes/WidgetType.d.ts +4 -3
- package/pluggableElementTypes/index.d.ts +11 -11
- package/pluggableElementTypes/models/BaseConnectionModelFactory.d.ts +2 -29
- package/pluggableElementTypes/models/BaseConnectionModelFactory.js +1 -28
- package/pluggableElementTypes/models/BaseDisplayModel.d.ts +3 -83
- package/pluggableElementTypes/models/BaseDisplayModel.js +2 -69
- package/pluggableElementTypes/models/BaseTrackModel.d.ts +4 -46
- package/pluggableElementTypes/models/BaseTrackModel.js +0 -58
- package/pluggableElementTypes/models/BaseViewModel.d.ts +2 -42
- package/pluggableElementTypes/models/BaseViewModel.js +2 -38
- package/pluggableElementTypes/models/InternetAccountModel.d.ts +3 -119
- package/pluggableElementTypes/models/InternetAccountModel.js +3 -123
- package/pluggableElementTypes/models/baseConnectionConfig.d.ts +0 -6
- package/pluggableElementTypes/models/baseConnectionConfig.js +1 -13
- package/pluggableElementTypes/models/baseInternetAccountConfig.d.ts +0 -15
- package/pluggableElementTypes/models/baseInternetAccountConfig.js +1 -23
- package/pluggableElementTypes/models/baseTrackConfig.d.ts +2 -53
- package/pluggableElementTypes/models/baseTrackConfig.js +1 -58
- package/pluggableElementTypes/renderers/BoxRendererType.d.ts +7 -15
- package/pluggableElementTypes/renderers/BoxRendererType.js +3 -14
- package/pluggableElementTypes/renderers/CircularChordRendererType.d.ts +3 -2
- package/pluggableElementTypes/renderers/CircularChordRendererType.js +1 -6
- package/pluggableElementTypes/renderers/ComparativeServerSideRendererType.d.ts +6 -21
- package/pluggableElementTypes/renderers/ComparativeServerSideRendererType.js +2 -25
- package/pluggableElementTypes/renderers/FeatureRendererType.d.ts +5 -47
- package/pluggableElementTypes/renderers/FeatureRendererType.js +15 -68
- package/pluggableElementTypes/renderers/RendererType.d.ts +4 -8
- package/pluggableElementTypes/renderers/RendererType.js +1 -5
- package/pluggableElementTypes/renderers/RpcRenderedSvgGroup.d.ts +2 -2
- package/pluggableElementTypes/renderers/RpcRenderedSvgGroup.js +3 -12
- package/pluggableElementTypes/renderers/ServerSideRenderedContent.d.ts +1 -1
- package/pluggableElementTypes/renderers/ServerSideRenderedContent.js +6 -14
- package/pluggableElementTypes/renderers/ServerSideRendererType.d.ts +9 -49
- package/pluggableElementTypes/renderers/ServerSideRendererType.js +7 -57
- package/pluggableElementTypes/renderers/index.d.ts +1 -1
- package/pluggableElementTypes/renderers/util/serializableFilterChain.js +1 -3
- package/rpc/BaseRpcDriver.d.ts +3 -4
- package/rpc/BaseRpcDriver.js +20 -80
- package/rpc/MainThreadRpcDriver.d.ts +3 -7
- package/rpc/MainThreadRpcDriver.js +0 -5
- package/rpc/RpcManager.d.ts +3 -3
- package/rpc/RpcManager.js +2 -4
- package/rpc/WebWorkerRpcDriver.d.ts +3 -2
- package/rpc/WebWorkerRpcDriver.js +2 -13
- package/rpc/baseRpcConfig.d.ts +0 -3
- package/rpc/baseRpcConfig.js +1 -7
- package/rpc/configSchema.d.ts +0 -6
- package/rpc/configSchema.js +2 -11
- package/rpc/mainThreadRpcConfig.js +1 -7
- package/rpc/methods/CoreFreeResources.d.ts +0 -6
- package/rpc/methods/CoreFreeResources.js +2 -9
- package/rpc/methods/CoreGetFeatureDensityStats.d.ts +4 -5
- package/rpc/methods/CoreGetFeatureDensityStats.js +1 -1
- package/rpc/methods/CoreGetFeatureDetails.d.ts +2 -7
- package/rpc/methods/CoreGetFeatureDetails.js +0 -5
- package/rpc/methods/CoreGetFeatures.d.ts +5 -5
- package/rpc/methods/CoreGetFeatures.js +4 -5
- package/rpc/methods/CoreGetFileInfo.d.ts +1 -2
- package/rpc/methods/CoreGetFileInfo.js +1 -1
- package/rpc/methods/CoreGetMetadata.d.ts +1 -2
- package/rpc/methods/CoreGetMetadata.js +1 -1
- package/rpc/methods/CoreGetRefNames.d.ts +1 -2
- package/rpc/methods/CoreGetRefNames.js +1 -1
- package/rpc/methods/CoreRender.d.ts +2 -6
- package/rpc/methods/CoreRender.js +5 -7
- package/rpc/methods/util.d.ts +3 -3
- package/rpc/methods/util.js +0 -1
- package/rpc/webWorkerRpcConfig.js +1 -7
- package/stories/JBrowseCore.stories.d.ts +1 -1
- package/stories/JBrowseCore.stories.js +3 -3
- package/stories/examples/WithSequencePanel.d.ts +1 -1
- package/stories/examples/WithSequencePanel.js +3 -3
- package/tsconfig.build.tsbuildinfo +1 -1
- package/ui/AppLogo.d.ts +1 -1
- package/ui/AppLogo.js +0 -2
- package/ui/AssemblySelector.d.ts +2 -2
- package/ui/AssemblySelector.js +5 -5
- package/ui/BaseTooltip.js +2 -6
- package/ui/CascadingMenu.d.ts +2 -2
- package/ui/CascadingMenu.js +3 -4
- package/ui/CascadingMenuButton.d.ts +1 -1
- package/ui/CascadingMenuButton.js +1 -1
- package/ui/ColorPicker.js +1 -7
- package/ui/Dialog.d.ts +1 -1
- package/ui/Dialog.js +2 -6
- package/ui/DropDownMenu.d.ts +1 -1
- package/ui/DropDownMenu.js +2 -2
- package/ui/EditableTypography.d.ts +1 -1
- package/ui/EditableTypography.js +1 -5
- package/ui/ErrorBoundary.d.ts +2 -1
- package/ui/ErrorMessage.js +2 -9
- package/ui/ErrorMessageStackTraceDialog.js +2 -10
- package/ui/FactoryResetDialog.js +1 -1
- package/ui/FatalErrorDialog.js +1 -1
- package/ui/FileSelector/FileSelector.d.ts +4 -3
- package/ui/FileSelector/FileSelector.js +40 -40
- package/ui/FileSelector/LocalFileChooser.d.ts +1 -1
- package/ui/FileSelector/LocalFileChooser.js +0 -1
- package/ui/FileSelector/UrlChooser.d.ts +4 -3
- package/ui/FileSelector/UrlChooser.js +6 -2
- package/ui/Icons.d.ts +1 -1
- package/ui/Icons.js +1 -7
- package/ui/LoadingEllipses.d.ts +1 -1
- package/ui/LoadingEllipses.js +3 -3
- package/ui/Menu.d.ts +1 -1
- package/ui/Menu.js +3 -10
- package/ui/MenuButton.d.ts +1 -1
- package/ui/ResizeHandle.js +2 -2
- package/ui/ReturnToImportFormDialog.js +1 -1
- package/ui/SanitizedHTML.js +2 -19
- package/ui/Snackbar.d.ts +2 -2
- package/ui/Snackbar.js +1 -2
- package/ui/SnackbarModel.d.ts +1 -26
- package/ui/SnackbarModel.js +2 -30
- package/ui/colors.d.ts +1 -1
- package/ui/colors.js +1 -1
- package/ui/react-colorful.js +0 -3
- package/ui/theme.d.ts +1 -1
- package/ui/theme.js +24 -84
- package/util/Base1DUtils.d.ts +1 -1
- package/util/Base1DUtils.js +0 -12
- package/util/Base1DViewModel.d.ts +4 -81
- package/util/Base1DViewModel.js +4 -108
- package/util/QuickLRU.js +0 -9
- package/util/TimeTraveller.js +0 -4
- package/util/aborting.d.ts +0 -20
- package/util/aborting.js +0 -31
- package/util/analytics.js +1 -12
- package/util/blockTypes.d.ts +0 -11
- package/util/blockTypes.js +0 -13
- package/util/calculateDynamicBlocks.d.ts +1 -20
- package/util/calculateDynamicBlocks.js +1 -22
- package/util/calculateStaticBlocks.d.ts +2 -2
- package/util/calculateStaticBlocks.js +0 -2
- package/util/color/cssColorsLevel4.js +0 -1
- package/util/color/index.d.ts +0 -19
- package/util/color/index.js +0 -30
- package/util/compositeMap.js +0 -2
- package/util/dedupe.js +0 -1
- package/util/formatFastaStrings.d.ts +0 -13
- package/util/formatFastaStrings.js +0 -13
- package/util/idMaker.d.ts +1 -1
- package/util/idMaker.js +16 -12
- package/util/index.d.ts +25 -173
- package/util/index.js +87 -326
- package/util/io/RemoteFileWithRangeCache.d.ts +3 -2
- package/util/io/RemoteFileWithRangeCache.js +6 -10
- package/util/io/index.d.ts +3 -4
- package/util/io/index.js +3 -17
- package/util/jexl.js +3 -13
- package/util/jexlStrings.d.ts +0 -6
- package/util/jexlStrings.js +0 -8
- package/util/layouts/BaseLayout.d.ts +1 -1
- package/util/layouts/GranularRectLayout.d.ts +1 -17
- package/util/layouts/GranularRectLayout.js +4 -81
- package/util/layouts/MultiLayout.d.ts +1 -6
- package/util/layouts/MultiLayout.js +0 -6
- package/util/layouts/PrecomputedLayout.d.ts +1 -4
- package/util/layouts/PrecomputedLayout.js +0 -5
- package/util/layouts/PrecomputedMultiLayout.js +0 -2
- package/util/layouts/SceneGraph.d.ts +0 -12
- package/util/layouts/SceneGraph.js +0 -13
- package/util/makeAbortableReaction.d.ts +2 -0
- package/util/makeAbortableReaction.js +50 -0
- package/util/map-obj.js +0 -4
- package/util/mst-reflection.d.ts +1 -14
- package/util/mst-reflection.js +1 -28
- package/util/nanoid.js +0 -31
- package/util/nextTick.d.ts +1 -0
- package/util/nextTick.js +6 -0
- package/util/offscreenCanvasPonyfill.d.ts +0 -1
- package/util/offscreenCanvasPonyfill.js +1 -9
- package/util/offscreenCanvasUtils.js +1 -8
- package/util/range.d.ts +0 -25
- package/util/range.js +0 -34
- package/util/rxjs.d.ts +3 -7
- package/util/rxjs.js +2 -9
- package/util/simpleFeature.d.ts +0 -58
- package/util/simpleFeature.js +0 -35
- package/util/stats.d.ts +4 -34
- package/util/stats.js +0 -60
- package/util/stopToken.d.ts +3 -0
- package/util/stopToken.js +29 -0
- package/util/tracks.d.ts +3 -25
- package/util/tracks.js +0 -30
- package/util/types/index.d.ts +14 -30
- package/util/types/index.js +5 -14
- package/util/types/mst.js +0 -9
- package/util/types/util.d.ts +2 -9
- package/util/useMeasure.js +0 -1
- package/util/when.d.ts +1 -15
- package/util/when.js +3 -70
- package/rpc/remoteAbortSignals.d.ts +0 -36
- package/rpc/remoteAbortSignals.js +0 -79
|
@@ -1,86 +1,52 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const configuration_1 = require("../configuration");
|
|
4
|
-
/**
|
|
5
|
-
* #config BaseAssembly
|
|
6
|
-
* #category assemblyManagement
|
|
7
|
-
* This corresponds to the assemblies section of the config
|
|
8
|
-
*/
|
|
9
4
|
function assemblyConfigSchema(pluginManager) {
|
|
10
5
|
return (0, configuration_1.ConfigurationSchema)('BaseAssembly', {
|
|
11
|
-
/**
|
|
12
|
-
* #slot
|
|
13
|
-
* aliases are "reference name aliases" e.g. aliases for hg38 might be
|
|
14
|
-
* "GRCh38"
|
|
15
|
-
*/
|
|
16
6
|
aliases: {
|
|
17
7
|
type: 'stringArray',
|
|
18
8
|
defaultValue: [],
|
|
19
9
|
description: 'Other possible names for the assembly',
|
|
20
10
|
},
|
|
21
|
-
/**
|
|
22
|
-
* #slot
|
|
23
|
-
* sequence refers to a reference sequence track that has an adapter
|
|
24
|
-
* containing, importantly, a sequence adapter such as
|
|
25
|
-
* IndexedFastaAdapter
|
|
26
|
-
*/
|
|
27
11
|
sequence: pluginManager.getTrackType('ReferenceSequenceTrack')
|
|
28
12
|
.configSchema,
|
|
29
|
-
/**
|
|
30
|
-
* #slot
|
|
31
|
-
*/
|
|
32
13
|
refNameColors: {
|
|
33
14
|
type: 'stringArray',
|
|
34
15
|
defaultValue: [],
|
|
35
16
|
description: 'Define custom colors for each reference sequence. Will cycle through this list if there are not enough colors for every sequence.',
|
|
36
17
|
},
|
|
37
18
|
refNameAliases: (0, configuration_1.ConfigurationSchema)('RefNameAliases', {
|
|
38
|
-
/**
|
|
39
|
-
* #slot refNameAliases.adapter
|
|
40
|
-
* refNameAliases help resolve e.g. chr1 and 1 as the same entity the
|
|
41
|
-
* data for refNameAliases are fetched from an adapter, that is
|
|
42
|
-
* commonly a tsv like chromAliases.txt from UCSC or similar
|
|
43
|
-
*/
|
|
44
19
|
adapter: pluginManager.pluggableConfigSchemaType('adapter'),
|
|
45
20
|
}, {
|
|
46
21
|
preProcessSnapshot: snap => {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
22
|
+
return !snap.adapter
|
|
23
|
+
? {
|
|
24
|
+
adapter: {
|
|
25
|
+
type: 'RefNameAliasAdapter',
|
|
26
|
+
},
|
|
27
|
+
}
|
|
28
|
+
: snap;
|
|
52
29
|
},
|
|
53
30
|
}),
|
|
54
31
|
cytobands: (0, configuration_1.ConfigurationSchema)('Cytoband', {
|
|
55
|
-
/**
|
|
56
|
-
* #slot cytobands.adapter
|
|
57
|
-
* cytoband data is fetched from an adapter, and can be displayed by
|
|
58
|
-
* a view type as ideograms
|
|
59
|
-
*/
|
|
60
32
|
adapter: pluginManager.pluggableConfigSchemaType('adapter'),
|
|
61
33
|
}, {
|
|
62
34
|
preProcessSnapshot: snap => {
|
|
63
|
-
// allow cytoBand to be unspecified
|
|
64
35
|
return !snap.adapter
|
|
65
|
-
? {
|
|
36
|
+
? {
|
|
37
|
+
adapter: {
|
|
38
|
+
type: 'CytobandAdapter',
|
|
39
|
+
},
|
|
40
|
+
}
|
|
66
41
|
: snap;
|
|
67
42
|
},
|
|
68
43
|
}),
|
|
69
|
-
/**
|
|
70
|
-
* #slot
|
|
71
|
-
*/
|
|
72
44
|
displayName: {
|
|
73
45
|
type: 'string',
|
|
74
46
|
defaultValue: '',
|
|
75
47
|
description: 'A human readable display name for the assembly e.g. "Homo sapiens (hg38)" while the assembly name may just be "hg38"',
|
|
76
48
|
},
|
|
77
49
|
}, {
|
|
78
|
-
/**
|
|
79
|
-
* #identifier name
|
|
80
|
-
* the name acts as a unique identifier in the config, so it cannot be
|
|
81
|
-
* duplicated. it usually a short human readable "id" like hg38, but you
|
|
82
|
-
* can also optionally customize the assembly "displayName" config slot
|
|
83
|
-
*/
|
|
84
50
|
explicitIdentifier: 'name',
|
|
85
51
|
});
|
|
86
52
|
}
|
|
@@ -1,19 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
1
|
+
import type { AnyConfigurationModel } from '../configuration';
|
|
2
|
+
import type { Assembly } from './assembly';
|
|
3
|
+
import type PluginManager from '../PluginManager';
|
|
4
|
+
import type RpcManager from '../rpc/RpcManager';
|
|
5
|
+
import type { IAnyType } from 'mobx-state-tree';
|
|
6
6
|
type AdapterConf = Record<string, unknown>;
|
|
7
|
-
/**
|
|
8
|
-
* #stateModel AssemblyManager
|
|
9
|
-
*/
|
|
10
7
|
declare function assemblyManagerFactory(conf: IAnyType, pm: PluginManager): import("mobx-state-tree").IModelType<{
|
|
11
|
-
/**
|
|
12
|
-
* #property
|
|
13
|
-
* this is automatically managed by an autorun which looks in the parent
|
|
14
|
-
* session.assemblies, session.sessionAssemblies, and
|
|
15
|
-
* session.temporaryAssemblies
|
|
16
|
-
*/
|
|
17
8
|
assemblies: import("mobx-state-tree").IArrayType<import("mobx-state-tree").IModelType<{
|
|
18
9
|
configuration: import("mobx-state-tree").IMaybe<import("mobx-state-tree").IReferenceType<IAnyType>>;
|
|
19
10
|
}, {
|
|
@@ -228,9 +219,6 @@ declare function assemblyManagerFactory(conf: IAnyType, pm: PluginManager): impo
|
|
|
228
219
|
}>;
|
|
229
220
|
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>>;
|
|
230
221
|
} & {
|
|
231
|
-
/**
|
|
232
|
-
* #method
|
|
233
|
-
*/
|
|
234
222
|
get(asmName: string): ({
|
|
235
223
|
configuration: any;
|
|
236
224
|
} & import("mobx-state-tree/dist/internal").NonEmptyObject & {
|
|
@@ -372,23 +360,10 @@ declare function assemblyManagerFactory(conf: IAnyType, pm: PluginManager): impo
|
|
|
372
360
|
[x: string]: string;
|
|
373
361
|
}>;
|
|
374
362
|
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>) | undefined;
|
|
375
|
-
/**
|
|
376
|
-
* #getter
|
|
377
|
-
*/
|
|
378
363
|
readonly assemblyNamesList: any[];
|
|
379
|
-
/**
|
|
380
|
-
* #getter
|
|
381
|
-
* looks at jbrowse.assemblies, session.sessionAssemblies, and
|
|
382
|
-
* session.temporaryAssemblies to load from
|
|
383
|
-
*/
|
|
384
364
|
readonly assemblyList: AnyConfigurationModel[];
|
|
385
365
|
readonly rpcManager: RpcManager;
|
|
386
366
|
} & {
|
|
387
|
-
/**
|
|
388
|
-
* #method
|
|
389
|
-
* use this method instead of assemblyManager.get(assemblyName)
|
|
390
|
-
* to get an assembly with regions loaded
|
|
391
|
-
*/
|
|
392
367
|
waitForAssembly(assemblyName: string): Promise<({
|
|
393
368
|
configuration: any;
|
|
394
369
|
} & import("mobx-state-tree/dist/internal").NonEmptyObject & {
|
|
@@ -530,47 +505,22 @@ declare function assemblyManagerFactory(conf: IAnyType, pm: PluginManager): impo
|
|
|
530
505
|
[x: string]: string;
|
|
531
506
|
}>;
|
|
532
507
|
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>) | undefined>;
|
|
533
|
-
/**
|
|
534
|
-
* #method
|
|
535
|
-
*/
|
|
536
508
|
getRefNameMapForAdapter(adapterConf: AdapterConf, assemblyName: string | undefined, opts: {
|
|
537
|
-
|
|
509
|
+
stopToken?: string;
|
|
538
510
|
sessionId: string;
|
|
539
511
|
}): Promise<{
|
|
540
512
|
[x: string]: string;
|
|
541
513
|
} | undefined>;
|
|
542
|
-
/**
|
|
543
|
-
* #method
|
|
544
|
-
*/
|
|
545
514
|
getReverseRefNameMapForAdapter(adapterConf: AdapterConf, assemblyName: string | undefined, opts: {
|
|
546
|
-
|
|
515
|
+
stopToken?: string;
|
|
547
516
|
sessionId: string;
|
|
548
517
|
}): Promise<{
|
|
549
518
|
[x: string]: string;
|
|
550
519
|
} | undefined>;
|
|
551
|
-
/**
|
|
552
|
-
* #method
|
|
553
|
-
*/
|
|
554
520
|
isValidRefName(refName: string, assemblyName: string): boolean;
|
|
555
521
|
} & {
|
|
556
522
|
afterAttach(): void;
|
|
557
|
-
/**
|
|
558
|
-
* #action
|
|
559
|
-
* private: you would generally want to add to manipulate
|
|
560
|
-
* jbrowse.assemblies, session.sessionAssemblies, or
|
|
561
|
-
* session.temporaryAssemblies instead of using this directly
|
|
562
|
-
*/
|
|
563
523
|
removeAssembly(asm: Assembly): void;
|
|
564
|
-
/**
|
|
565
|
-
* #action
|
|
566
|
-
* private: you would generally want to add to manipulate
|
|
567
|
-
* jbrowse.assemblies, session.sessionAssemblies, or
|
|
568
|
-
* session.temporaryAssemblies instead of using this directly
|
|
569
|
-
*
|
|
570
|
-
* this can take an active instance of an assembly, in which case it is
|
|
571
|
-
* referred to, or it can take an identifier e.g. assembly name, which is
|
|
572
|
-
* used as a reference. snapshots cannot be used
|
|
573
|
-
*/
|
|
574
524
|
addAssembly(configuration: any): void;
|
|
575
525
|
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
|
|
576
526
|
export default assemblyManagerFactory;
|
|
@@ -3,24 +3,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const mobx_state_tree_1 = require("mobx-state-tree");
|
|
7
6
|
const mobx_1 = require("mobx");
|
|
8
|
-
|
|
9
|
-
const util_1 = require("../util");
|
|
7
|
+
const mobx_state_tree_1 = require("mobx-state-tree");
|
|
10
8
|
const configuration_1 = require("../configuration");
|
|
9
|
+
const util_1 = require("../util");
|
|
11
10
|
const assembly_1 = __importDefault(require("./assembly"));
|
|
12
|
-
/**
|
|
13
|
-
* #stateModel AssemblyManager
|
|
14
|
-
*/
|
|
15
11
|
function assemblyManagerFactory(conf, pm) {
|
|
16
12
|
return mobx_state_tree_1.types
|
|
17
13
|
.model({
|
|
18
|
-
/**
|
|
19
|
-
* #property
|
|
20
|
-
* this is automatically managed by an autorun which looks in the parent
|
|
21
|
-
* session.assemblies, session.sessionAssemblies, and
|
|
22
|
-
* session.temporaryAssemblies
|
|
23
|
-
*/
|
|
24
14
|
assemblies: mobx_state_tree_1.types.array((0, assembly_1.default)(conf, pm)),
|
|
25
15
|
})
|
|
26
16
|
.views(self => ({
|
|
@@ -35,26 +25,13 @@ function assemblyManagerFactory(conf, pm) {
|
|
|
35
25
|
},
|
|
36
26
|
}))
|
|
37
27
|
.views(self => ({
|
|
38
|
-
/**
|
|
39
|
-
* #method
|
|
40
|
-
*/
|
|
41
28
|
get(asmName) {
|
|
42
29
|
return self.assemblyNameMap[asmName];
|
|
43
30
|
},
|
|
44
|
-
/**
|
|
45
|
-
* #getter
|
|
46
|
-
*/
|
|
47
31
|
get assemblyNamesList() {
|
|
48
32
|
return this.assemblyList.map(asm => asm.name);
|
|
49
33
|
},
|
|
50
|
-
/**
|
|
51
|
-
* #getter
|
|
52
|
-
* looks at jbrowse.assemblies, session.sessionAssemblies, and
|
|
53
|
-
* session.temporaryAssemblies to load from
|
|
54
|
-
*/
|
|
55
34
|
get assemblyList() {
|
|
56
|
-
// name is the explicit identifier and can be accessed without getConf,
|
|
57
|
-
// hence the union with {name:string}
|
|
58
35
|
const { jbrowse: { assemblies }, session: { sessionAssemblies = [], temporaryAssemblies = [] } = {}, } = (0, mobx_state_tree_1.getParent)(self);
|
|
59
36
|
return [
|
|
60
37
|
...assemblies,
|
|
@@ -67,11 +44,6 @@ function assemblyManagerFactory(conf, pm) {
|
|
|
67
44
|
},
|
|
68
45
|
}))
|
|
69
46
|
.views(self => ({
|
|
70
|
-
/**
|
|
71
|
-
* #method
|
|
72
|
-
* use this method instead of assemblyManager.get(assemblyName)
|
|
73
|
-
* to get an assembly with regions loaded
|
|
74
|
-
*/
|
|
75
47
|
async waitForAssembly(assemblyName) {
|
|
76
48
|
if (!assemblyName) {
|
|
77
49
|
throw new Error('no assembly name supplied to waitForAssembly');
|
|
@@ -83,7 +55,6 @@ function assemblyManagerFactory(conf, pm) {
|
|
|
83
55
|
assembly = self.get(assemblyName);
|
|
84
56
|
}
|
|
85
57
|
catch (e) {
|
|
86
|
-
// ignore
|
|
87
58
|
}
|
|
88
59
|
}
|
|
89
60
|
if (!assembly) {
|
|
@@ -92,14 +63,10 @@ function assemblyManagerFactory(conf, pm) {
|
|
|
92
63
|
await assembly.load();
|
|
93
64
|
await (0, util_1.when)(() => !!(assembly.regions && assembly.refNameAliases) || !!assembly.error);
|
|
94
65
|
if (assembly.error) {
|
|
95
|
-
// eslint-disable-next-line @typescript-eslint/only-throw-error
|
|
96
66
|
throw assembly.error;
|
|
97
67
|
}
|
|
98
68
|
return assembly;
|
|
99
69
|
},
|
|
100
|
-
/**
|
|
101
|
-
* #method
|
|
102
|
-
*/
|
|
103
70
|
async getRefNameMapForAdapter(adapterConf, assemblyName, opts) {
|
|
104
71
|
if (assemblyName) {
|
|
105
72
|
const asm = await this.waitForAssembly(assemblyName);
|
|
@@ -107,9 +74,6 @@ function assemblyManagerFactory(conf, pm) {
|
|
|
107
74
|
}
|
|
108
75
|
return {};
|
|
109
76
|
},
|
|
110
|
-
/**
|
|
111
|
-
* #method
|
|
112
|
-
*/
|
|
113
77
|
async getReverseRefNameMapForAdapter(adapterConf, assemblyName, opts) {
|
|
114
78
|
if (assemblyName) {
|
|
115
79
|
const asm = await this.waitForAssembly(assemblyName);
|
|
@@ -117,9 +81,6 @@ function assemblyManagerFactory(conf, pm) {
|
|
|
117
81
|
}
|
|
118
82
|
return {};
|
|
119
83
|
},
|
|
120
|
-
/**
|
|
121
|
-
* #method
|
|
122
|
-
*/
|
|
123
84
|
isValidRefName(refName, assemblyName) {
|
|
124
85
|
const assembly = self.get(assemblyName);
|
|
125
86
|
if (assembly) {
|
|
@@ -144,25 +105,9 @@ function assemblyManagerFactory(conf, pm) {
|
|
|
144
105
|
}
|
|
145
106
|
}, { fireImmediately: true, name: 'assemblyManagerAfterAttach' }));
|
|
146
107
|
},
|
|
147
|
-
/**
|
|
148
|
-
* #action
|
|
149
|
-
* private: you would generally want to add to manipulate
|
|
150
|
-
* jbrowse.assemblies, session.sessionAssemblies, or
|
|
151
|
-
* session.temporaryAssemblies instead of using this directly
|
|
152
|
-
*/
|
|
153
108
|
removeAssembly(asm) {
|
|
154
109
|
self.assemblies.remove(asm);
|
|
155
110
|
},
|
|
156
|
-
/**
|
|
157
|
-
* #action
|
|
158
|
-
* private: you would generally want to add to manipulate
|
|
159
|
-
* jbrowse.assemblies, session.sessionAssemblies, or
|
|
160
|
-
* session.temporaryAssemblies instead of using this directly
|
|
161
|
-
*
|
|
162
|
-
* this can take an active instance of an assembly, in which case it is
|
|
163
|
-
* referred to, or it can take an identifier e.g. assembly name, which is
|
|
164
|
-
* used as a reference. snapshots cannot be used
|
|
165
|
-
*/
|
|
166
111
|
addAssembly(configuration) {
|
|
167
112
|
self.assemblies.push({ configuration });
|
|
168
113
|
},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
export type {
|
|
1
|
+
import type { ConfigSlotDefinition } from './configurationSlot';
|
|
2
|
+
import type { AnyConfigurationSchemaType } from './types';
|
|
3
|
+
import type { IAnyType } from 'mobx-state-tree';
|
|
4
|
+
export type { AnyConfigurationModel, AnyConfigurationSchemaType, AnyConfigurationSlot, AnyConfigurationSlotType, } from './types';
|
|
5
5
|
export interface ConfigurationSchemaDefinition {
|
|
6
6
|
[n: string]: ConfigSlotDefinition | ConfigurationSchemaDefinition | string | number | IAnyType;
|
|
7
7
|
}
|
|
@@ -6,9 +6,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.ConfigurationSchema = ConfigurationSchema;
|
|
7
7
|
exports.ConfigurationReference = ConfigurationReference;
|
|
8
8
|
const mobx_state_tree_1 = require("mobx-state-tree");
|
|
9
|
-
const mst_1 = require("../util/types/mst");
|
|
10
9
|
const configurationSlot_1 = __importDefault(require("./configurationSlot"));
|
|
11
10
|
const util_1 = require("./util");
|
|
11
|
+
const mst_1 = require("../util/types/mst");
|
|
12
12
|
function isEmptyObject(thing) {
|
|
13
13
|
return (typeof thing === 'object' &&
|
|
14
14
|
!Array.isArray(thing) &&
|
|
@@ -23,8 +23,6 @@ function preprocessConfigurationSchemaArguments(modelName, inputSchemaDefinition
|
|
|
23
23
|
if (typeof modelName !== 'string') {
|
|
24
24
|
throw new Error('first arg must be string name of the model that this config schema goes with');
|
|
25
25
|
}
|
|
26
|
-
// if we have a base configuration schema that we are
|
|
27
|
-
// extending, grab the slot definitions from that
|
|
28
26
|
let schemaDefinition = inputSchemaDefinition;
|
|
29
27
|
let options = inputOptions;
|
|
30
28
|
if ((_a = inputOptions.baseConfiguration) === null || _a === void 0 ? void 0 : _a.jbrowseSchemaDefinition) {
|
|
@@ -41,7 +39,6 @@ function preprocessConfigurationSchemaArguments(modelName, inputSchemaDefinition
|
|
|
41
39
|
return { schemaDefinition, options };
|
|
42
40
|
}
|
|
43
41
|
function makeConfigurationSchemaModel(modelName, schemaDefinition, options) {
|
|
44
|
-
// now assemble the MST model of the configuration schema
|
|
45
42
|
const modelDefinition = {};
|
|
46
43
|
let identifier;
|
|
47
44
|
if (options.explicitlyTyped) {
|
|
@@ -81,8 +78,6 @@ function makeConfigurationSchemaModel(modelName, schemaDefinition, options) {
|
|
|
81
78
|
Object.entries(schemaDefinition).forEach(([slotName, slotDefinition]) => {
|
|
82
79
|
if (((0, mobx_state_tree_1.isType)(slotDefinition) && (0, mobx_state_tree_1.isLateType)(slotDefinition)) ||
|
|
83
80
|
(0, util_1.isConfigurationSchemaType)(slotDefinition)) {
|
|
84
|
-
// this is either an MST late() type (which we assume to be a sub-configuration),
|
|
85
|
-
// or an actual sub-configuration
|
|
86
81
|
modelDefinition[slotName] = slotDefinition;
|
|
87
82
|
}
|
|
88
83
|
else if (typeof slotDefinition === 'string' ||
|
|
@@ -90,7 +85,6 @@ function makeConfigurationSchemaModel(modelName, schemaDefinition, options) {
|
|
|
90
85
|
volatileConstants[slotName] = slotDefinition;
|
|
91
86
|
}
|
|
92
87
|
else if (typeof slotDefinition === 'object') {
|
|
93
|
-
// this is a slot definition
|
|
94
88
|
if (!slotDefinition.type) {
|
|
95
89
|
throw new Error(`no type set for config slot ${modelName}.${slotName}`);
|
|
96
90
|
}
|
|
@@ -120,7 +114,7 @@ function makeConfigurationSchemaModel(modelName, schemaDefinition, options) {
|
|
|
120
114
|
},
|
|
121
115
|
}));
|
|
122
116
|
if (Object.keys(volatileConstants).length) {
|
|
123
|
-
completeModel = completeModel.volatile((
|
|
117
|
+
completeModel = completeModel.volatile(() => volatileConstants);
|
|
124
118
|
}
|
|
125
119
|
if (options.actions) {
|
|
126
120
|
completeModel = completeModel.actions(options.actions);
|
|
@@ -139,7 +133,6 @@ function makeConfigurationSchemaModel(modelName, schemaDefinition, options) {
|
|
|
139
133
|
completeModel = completeModel.postProcessSnapshot(snap => {
|
|
140
134
|
const newSnap = {};
|
|
141
135
|
let matchesDefault = true;
|
|
142
|
-
// let keyCount = 0
|
|
143
136
|
for (const [key, value] of Object.entries(snap)) {
|
|
144
137
|
if (matchesDefault) {
|
|
145
138
|
if (typeof defaultSnap[key] === 'object' && typeof value === 'object') {
|
|
@@ -155,7 +148,6 @@ function makeConfigurationSchemaModel(modelName, schemaDefinition, options) {
|
|
|
155
148
|
volatileConstants[key] === undefined &&
|
|
156
149
|
!isEmptyObject(value) &&
|
|
157
150
|
!isEmptyArray(value)) {
|
|
158
|
-
// keyCount += 1
|
|
159
151
|
newSnap[key] = value;
|
|
160
152
|
}
|
|
161
153
|
}
|
|
@@ -172,15 +164,11 @@ function makeConfigurationSchemaModel(modelName, schemaDefinition, options) {
|
|
|
172
164
|
function ConfigurationSchema(modelName, inputSchemaDefinition, inputOptions) {
|
|
173
165
|
const { schemaDefinition, options } = preprocessConfigurationSchemaArguments(modelName, inputSchemaDefinition, inputOptions);
|
|
174
166
|
const schemaType = makeConfigurationSchemaModel(modelName, schemaDefinition, options);
|
|
175
|
-
// saving a couple of jbrowse-specific things in the type object. hope nobody gets mad.
|
|
176
167
|
schemaType.isJBrowseConfigurationSchema = true;
|
|
177
168
|
schemaType.jbrowseSchemaDefinition = schemaDefinition;
|
|
178
169
|
schemaType.jbrowseSchemaOptions = options;
|
|
179
170
|
return schemaType;
|
|
180
171
|
}
|
|
181
172
|
function ConfigurationReference(schemaType) {
|
|
182
|
-
// we cast this to SCHEMATYPE, because the reference *should* behave just
|
|
183
|
-
// like the object it points to. It won't be undefined (this is a
|
|
184
|
-
// `reference`, not a `safeReference`)
|
|
185
173
|
return mobx_state_tree_1.types.union(mobx_state_tree_1.types.reference(schemaType), schemaType);
|
|
186
174
|
}
|
|
@@ -1,22 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { IAnyComplexType, IAnyModelType } from 'mobx-state-tree';
|
|
2
2
|
export interface ConfigSlotDefinition {
|
|
3
|
-
/** human-readable description of the slot's meaning */
|
|
4
3
|
description?: string;
|
|
5
|
-
/** custom base MST model for the slot's value */
|
|
6
4
|
model?: IAnyModelType | IAnyComplexType;
|
|
7
|
-
/** name of the type of slot, e.g. "string", "number", "stringArray" */
|
|
8
5
|
type: string;
|
|
9
|
-
/** default value of the slot */
|
|
10
6
|
defaultValue: any;
|
|
11
|
-
/** parameter names of the function callback */
|
|
12
7
|
contextVariable?: string[];
|
|
13
8
|
}
|
|
14
|
-
/**
|
|
15
|
-
* builds a MST model for a configuration slot
|
|
16
|
-
*
|
|
17
|
-
* @param slotName -
|
|
18
|
-
* @param definition -
|
|
19
|
-
*/
|
|
20
9
|
export default function ConfigSlot(slotName: string, { description, model, type, defaultValue, contextVariable, }: ConfigSlotDefinition): import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IModelType<{
|
|
21
10
|
name: import("mobx-state-tree").ISimpleType<string>;
|
|
22
11
|
description: import("mobx-state-tree").ISimpleType<string>;
|
|
@@ -2,11 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = ConfigSlot;
|
|
4
4
|
const mobx_state_tree_1 = require("mobx-state-tree");
|
|
5
|
+
const util_1 = require("../util");
|
|
5
6
|
const jexlStrings_1 = require("../util/jexlStrings");
|
|
6
7
|
const mst_1 = require("../util/types/mst");
|
|
7
|
-
|
|
8
|
-
function isValidColorString( /* str */) {
|
|
9
|
-
// TODO: check all the crazy cases for whether it's a valid HTML/CSS color string
|
|
8
|
+
function isValidColorString() {
|
|
10
9
|
return true;
|
|
11
10
|
}
|
|
12
11
|
const typeModels = {
|
|
@@ -22,7 +21,6 @@ const typeModels = {
|
|
|
22
21
|
fileLocation: mst_1.FileLocation,
|
|
23
22
|
frozen: mobx_state_tree_1.types.frozen(),
|
|
24
23
|
};
|
|
25
|
-
// default values we use if the defaultValue is malformed or does not work
|
|
26
24
|
const fallbackDefaults = {
|
|
27
25
|
stringArray: [],
|
|
28
26
|
stringArrayMap: {},
|
|
@@ -50,14 +48,12 @@ const objectJSON = (self) => ({
|
|
|
50
48
|
},
|
|
51
49
|
},
|
|
52
50
|
});
|
|
53
|
-
// custom actions for modifying the value models
|
|
54
51
|
const typeModelExtensions = {
|
|
55
52
|
fileLocation: objectJSON,
|
|
56
53
|
number: literalJSON,
|
|
57
54
|
integer: literalJSON,
|
|
58
55
|
boolean: literalJSON,
|
|
59
56
|
frozen: objectJSON,
|
|
60
|
-
// special actions for working with stringArray slots
|
|
61
57
|
stringArray: (self) => ({
|
|
62
58
|
views: {
|
|
63
59
|
get valueJSON() {
|
|
@@ -128,21 +124,10 @@ const typeModelExtensions = {
|
|
|
128
124
|
},
|
|
129
125
|
}),
|
|
130
126
|
};
|
|
131
|
-
// const FunctionStringType = types.refinement(
|
|
132
|
-
// 'FunctionString',
|
|
133
|
-
// types.string,
|
|
134
|
-
// str => functionRegexp.test(str),
|
|
135
|
-
// )
|
|
136
127
|
const JexlStringType = mobx_state_tree_1.types.refinement('JexlString', mobx_state_tree_1.types.string, str => str.startsWith('jexl:'));
|
|
137
128
|
function json(value) {
|
|
138
129
|
return (value === null || value === void 0 ? void 0 : value.toJSON) ? value.toJSON() : `"${value}"`;
|
|
139
130
|
}
|
|
140
|
-
/**
|
|
141
|
-
* builds a MST model for a configuration slot
|
|
142
|
-
*
|
|
143
|
-
* @param slotName -
|
|
144
|
-
* @param definition -
|
|
145
|
-
*/
|
|
146
131
|
function ConfigSlot(slotName, { description = '', model, type, defaultValue, contextVariable = [], }) {
|
|
147
132
|
if (!type) {
|
|
148
133
|
throw new Error('type name required');
|
|
@@ -156,8 +141,6 @@ function ConfigSlot(slotName, { description = '', model, type, defaultValue, con
|
|
|
156
141
|
if (defaultValue === undefined) {
|
|
157
142
|
throw new Error("no 'defaultValue' provided");
|
|
158
143
|
}
|
|
159
|
-
// if the `type` is something like `color`, then the model name
|
|
160
|
-
// here will be `ColorConfigSlot`
|
|
161
144
|
const configSlotModelName = `${slotName
|
|
162
145
|
.charAt(0)
|
|
163
146
|
.toUpperCase()}${slotName.slice(1)}ConfigSlot`;
|
|
@@ -179,20 +162,14 @@ function ConfigSlot(slotName, { description = '', model, type, defaultValue, con
|
|
|
179
162
|
.views(self => ({
|
|
180
163
|
get expr() {
|
|
181
164
|
if (self.isCallback) {
|
|
182
|
-
// compile as jexl function
|
|
183
165
|
const { pluginManager } = (0, util_1.getEnv)(self);
|
|
184
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
185
166
|
if (!pluginManager && typeof jest === 'undefined') {
|
|
186
167
|
console.warn('no pluginManager detected on config env (if you dynamically instantiate a config, for example in renderProps for your display model, check that you add the env argument)');
|
|
187
168
|
}
|
|
188
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
189
169
|
return (0, jexlStrings_1.stringToJexlExpression)(String(self.value), pluginManager === null || pluginManager === void 0 ? void 0 : pluginManager.jexl);
|
|
190
170
|
}
|
|
191
171
|
return { evalSync: () => self.value };
|
|
192
172
|
},
|
|
193
|
-
// JS representation of the value of this slot, suitable
|
|
194
|
-
// for embedding in either JSON or a JS function string.
|
|
195
|
-
// many of the data types override this in typeModelExtensions
|
|
196
173
|
get valueJSON() {
|
|
197
174
|
if (self.isCallback) {
|
|
198
175
|
return undefined;
|
|
@@ -233,7 +210,6 @@ function ConfigSlot(slotName, { description = '', model, type, defaultValue, con
|
|
|
233
210
|
if (!self.isCallback) {
|
|
234
211
|
return;
|
|
235
212
|
}
|
|
236
|
-
// try calling it with no arguments
|
|
237
213
|
try {
|
|
238
214
|
const funcResult = self.expr.evalSync();
|
|
239
215
|
if (funcResult !== undefined) {
|
|
@@ -242,20 +218,14 @@ function ConfigSlot(slotName, { description = '', model, type, defaultValue, con
|
|
|
242
218
|
}
|
|
243
219
|
}
|
|
244
220
|
catch (e) {
|
|
245
|
-
/* ignore */
|
|
246
221
|
}
|
|
247
222
|
self.value = defaultValue;
|
|
248
|
-
// if it is still a callback (happens if the defaultValue is a
|
|
249
|
-
// callback), then use the last-resort fallback default
|
|
250
|
-
// if defaultValue has jexl: string, run this part
|
|
251
223
|
if (!(type in fallbackDefaults)) {
|
|
252
224
|
throw new Error(`no fallbackDefault defined for type ${type}`);
|
|
253
225
|
}
|
|
254
226
|
self.value = fallbackDefaults[type];
|
|
255
227
|
},
|
|
256
228
|
}));
|
|
257
|
-
// if there are any type-specific extensions (views or actions)
|
|
258
|
-
// to the slot, add those in
|
|
259
229
|
if (typeModelExtensions[type]) {
|
|
260
230
|
slot = slot.extend(typeModelExtensions[type]);
|
|
261
231
|
}
|
package/configuration/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export type {
|
|
1
|
+
export { ConfigurationReference, ConfigurationSchema, } from './configurationSchema';
|
|
2
|
+
export type { AnyConfiguration, AnyConfigurationModel, AnyConfigurationSchemaType, AnyConfigurationSlot, AnyConfigurationSlotType, } from './types';
|
|
3
3
|
export * from './util';
|
package/configuration/index.js
CHANGED
|
@@ -14,8 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.
|
|
17
|
+
exports.ConfigurationSchema = exports.ConfigurationReference = void 0;
|
|
18
18
|
var configurationSchema_1 = require("./configurationSchema");
|
|
19
|
-
Object.defineProperty(exports, "ConfigurationSchema", { enumerable: true, get: function () { return configurationSchema_1.ConfigurationSchema; } });
|
|
20
19
|
Object.defineProperty(exports, "ConfigurationReference", { enumerable: true, get: function () { return configurationSchema_1.ConfigurationReference; } });
|
|
20
|
+
Object.defineProperty(exports, "ConfigurationSchema", { enumerable: true, get: function () { return configurationSchema_1.ConfigurationSchema; } });
|
|
21
21
|
__exportStar(require("./util"), exports);
|
package/configuration/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { ConfigurationSchemaType, ConfigurationSchemaOptions } from './configurationSchema';
|
|
1
|
+
import type { ConfigurationSchemaOptions, ConfigurationSchemaType } from './configurationSchema';
|
|
3
2
|
import type ConfigSlot from './configurationSlot';
|
|
3
|
+
import type { IStateTreeNode, Instance, SnapshotOut } from 'mobx-state-tree';
|
|
4
4
|
export type GetOptions<SCHEMA> = SCHEMA extends ConfigurationSchemaType<any, infer OPTIONS> ? OPTIONS : never;
|
|
5
5
|
export type GetBase<SCHEMA> = SCHEMA extends undefined ? never : GetOptions<SCHEMA> extends ConfigurationSchemaOptions<undefined, any> ? undefined : GetOptions<SCHEMA> extends ConfigurationSchemaOptions<infer BASE extends AnyConfigurationSchemaType, any> ? BASE : never;
|
|
6
6
|
export type GetExplicitIdentifier<SCHEMA> = GetOptions<SCHEMA> extends ConfigurationSchemaOptions<any, infer EXPLICIT_IDENTIFIER extends string> ? EXPLICIT_IDENTIFIER : never;
|
|
@@ -10,6 +10,5 @@ export type AnyConfigurationSchemaType = ConfigurationSchemaType<any, any>;
|
|
|
10
10
|
export type AnyConfigurationModel = Instance<AnyConfigurationSchemaType>;
|
|
11
11
|
export type AnyConfigurationSlotType = ReturnType<typeof ConfigSlot>;
|
|
12
12
|
export type AnyConfigurationSlot = Instance<AnyConfigurationSlotType>;
|
|
13
|
-
/** any configuration model, or snapshot thereof */
|
|
14
13
|
export type AnyConfiguration = AnyConfigurationModel | SnapshotOut<AnyConfigurationModel>;
|
|
15
14
|
export type ConfigurationModel<SCHEMA extends AnyConfigurationSchemaType> = Instance<SCHEMA>;
|
package/configuration/util.d.ts
CHANGED
|
@@ -1,32 +1,8 @@
|
|
|
1
|
-
import { AnyConfigurationModel, AnyConfigurationSchemaType,
|
|
2
|
-
/**
|
|
3
|
-
* given a configuration model (an instance of a ConfigurationSchema),
|
|
4
|
-
* read the configuration variable at the given path
|
|
5
|
-
*
|
|
6
|
-
* @param model - instance of ConfigurationSchema
|
|
7
|
-
* @param slotPaths - array of paths to read
|
|
8
|
-
* @param args - extra arguments e.g. for a feature callback,
|
|
9
|
-
* will be sent to each of the slotNames
|
|
10
|
-
*/
|
|
1
|
+
import type { AnyConfigurationModel, AnyConfigurationSchemaType, ConfigurationSchemaForModel, ConfigurationSlotName } from './types';
|
|
11
2
|
export declare function readConfObject<CONFMODEL extends AnyConfigurationModel>(confObject: CONFMODEL, slotPath?: ConfigurationSlotName<ConfigurationSchemaForModel<CONFMODEL>> | string[], args?: Record<string, unknown>): any;
|
|
12
|
-
/**
|
|
13
|
-
* helper method for readConfObject, reads the config from a mst model
|
|
14
|
-
*
|
|
15
|
-
* @param model - object containing a 'configuration' member
|
|
16
|
-
* @param slotPaths - array of paths to read
|
|
17
|
-
* @param args - extra arguments e.g. for a feature callback,
|
|
18
|
-
* will be sent to each of the slotNames
|
|
19
|
-
*/
|
|
20
3
|
export declare function getConf<CONFMODEL extends AnyConfigurationModel>(model: {
|
|
21
4
|
configuration: CONFMODEL;
|
|
22
5
|
}, slotPath?: Parameters<typeof readConfObject<CONFMODEL>>[1], args?: Parameters<typeof readConfObject<CONFMODEL>>[2]): any;
|
|
23
|
-
/**
|
|
24
|
-
* given a union of explicitly typed configuration schema types,
|
|
25
|
-
* extract an array of the type names contained in the union
|
|
26
|
-
*
|
|
27
|
-
* @param unionType -
|
|
28
|
-
* @returns Array of type names contained in the union
|
|
29
|
-
*/
|
|
30
6
|
export declare function getTypeNamesFromExplicitlyTypedUnion(maybeUnionType: unknown): string[];
|
|
31
7
|
export declare function isBareConfigurationSchemaType(thing: unknown): thing is AnyConfigurationSchemaType;
|
|
32
8
|
export declare function isConfigurationSchemaType(thing: unknown): thing is AnyConfigurationSchemaType;
|