@jbrowse/core 2.17.0 → 2.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (308) hide show
  1. package/BaseFeatureWidget/BaseFeatureDetail/ArrayValue.js +1 -2
  2. package/BaseFeatureWidget/BaseFeatureDetail/Attributes.js +4 -8
  3. package/BaseFeatureWidget/BaseFeatureDetail/BaseCard.d.ts +1 -1
  4. package/BaseFeatureWidget/BaseFeatureDetail/BaseCard.js +1 -2
  5. package/BaseFeatureWidget/BaseFeatureDetail/BasicValue.js +2 -3
  6. package/BaseFeatureWidget/BaseFeatureDetail/CoreDetails.d.ts +1 -1
  7. package/BaseFeatureWidget/BaseFeatureDetail/CoreDetails.js +2 -3
  8. package/BaseFeatureWidget/BaseFeatureDetail/DataGridDetails.js +22 -25
  9. package/BaseFeatureWidget/BaseFeatureDetail/FeatureDetails.d.ts +2 -2
  10. package/BaseFeatureWidget/BaseFeatureDetail/FeatureDetails.js +6 -8
  11. package/BaseFeatureWidget/BaseFeatureDetail/Position.d.ts +1 -1
  12. package/BaseFeatureWidget/BaseFeatureDetail/SimpleField.js +1 -1
  13. package/BaseFeatureWidget/BaseFeatureDetail/UriField.js +1 -1
  14. package/BaseFeatureWidget/BaseFeatureDetail/index.d.ts +1 -1
  15. package/BaseFeatureWidget/BaseFeatureDetail/index.js +1 -7
  16. package/BaseFeatureWidget/BaseFeatureDetail/util.js +0 -5
  17. package/BaseFeatureWidget/SequenceFeatureDetails/SequenceFeatureDetails.d.ts +2 -2
  18. package/BaseFeatureWidget/SequenceFeatureDetails/SequenceFeatureDetails.js +0 -7
  19. package/BaseFeatureWidget/SequenceFeatureDetails/SequenceFeaturePanel.d.ts +2 -2
  20. package/BaseFeatureWidget/SequenceFeatureDetails/SequenceFeaturePanel.js +1 -7
  21. package/BaseFeatureWidget/SequenceFeatureDetails/SequencePanel.d.ts +3 -3
  22. package/BaseFeatureWidget/SequenceFeatureDetails/SequencePanel.js +24 -33
  23. package/BaseFeatureWidget/SequenceFeatureDetails/dialogs/HelpDialog.js +1 -2
  24. package/BaseFeatureWidget/SequenceFeatureDetails/dialogs/SequenceDialog.d.ts +2 -2
  25. package/BaseFeatureWidget/SequenceFeatureDetails/dialogs/SequenceDialog.js +3 -4
  26. package/BaseFeatureWidget/SequenceFeatureDetails/dialogs/SequenceFeatureMenu.d.ts +2 -2
  27. package/BaseFeatureWidget/SequenceFeatureDetails/dialogs/SequenceFeatureMenu.js +3 -6
  28. package/BaseFeatureWidget/SequenceFeatureDetails/dialogs/SequenceTypeSelector.d.ts +1 -1
  29. package/BaseFeatureWidget/SequenceFeatureDetails/dialogs/SettingsDialog.d.ts +1 -1
  30. package/BaseFeatureWidget/SequenceFeatureDetails/dialogs/SettingsDialog.js +2 -2
  31. package/BaseFeatureWidget/SequenceFeatureDetails/hooks.d.ts +2 -2
  32. package/BaseFeatureWidget/SequenceFeatureDetails/hooks.js +1 -2
  33. package/BaseFeatureWidget/SequenceFeatureDetails/model.d.ts +2 -56
  34. package/BaseFeatureWidget/SequenceFeatureDetails/model.js +1 -56
  35. package/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/CDNASequence.d.ts +3 -3
  36. package/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/CDSSequence.d.ts +2 -2
  37. package/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/CDSSequence.js +5 -6
  38. package/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/GenomicSequence.d.ts +2 -2
  39. package/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/GenomicSequence.js +0 -1
  40. package/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/ProteinSequence.d.ts +2 -2
  41. package/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/ProteinSequence.js +0 -2
  42. package/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/SequenceDisplay.d.ts +1 -1
  43. package/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/SequenceDisplay.js +1 -3
  44. package/BaseFeatureWidget/SequenceFeatureDetails/util.js +1 -5
  45. package/BaseFeatureWidget/stateModelFactory.d.ts +2 -93
  46. package/BaseFeatureWidget/stateModelFactory.js +3 -73
  47. package/BaseFeatureWidget/types.d.ts +3 -3
  48. package/BaseFeatureWidget/util.js +0 -4
  49. package/CorePlugin.d.ts +1 -1
  50. package/CorePlugin.js +2 -5
  51. package/Plugin.d.ts +2 -5
  52. package/Plugin.js +0 -3
  53. package/PluginLoader.d.ts +1 -1
  54. package/PluginLoader.js +2 -19
  55. package/PluginManager.d.ts +15 -31
  56. package/PluginManager.js +11 -39
  57. package/ReExports/DataGrid.js +0 -1
  58. package/ReExports/list.d.ts +0 -5
  59. package/ReExports/list.js +0 -5
  60. package/ReExports/modules.d.ts +22 -20
  61. package/ReExports/modules.js +16 -25
  62. package/TextSearch/BaseResults.d.ts +3 -3
  63. package/TextSearch/TextSearchManager.d.ts +4 -16
  64. package/TextSearch/TextSearchManager.js +1 -13
  65. package/assemblyManager/assembly.d.ts +5 -100
  66. package/assemblyManager/assembly.js +27 -143
  67. package/assemblyManager/assemblyConfigSchema.d.ts +1 -34
  68. package/assemblyManager/assemblyConfigSchema.js +12 -46
  69. package/assemblyManager/assemblyManager.d.ts +7 -57
  70. package/assemblyManager/assemblyManager.js +2 -57
  71. package/configuration/configurationSchema.d.ts +4 -4
  72. package/configuration/configurationSchema.js +2 -14
  73. package/configuration/configurationSlot.d.ts +1 -12
  74. package/configuration/configurationSlot.js +2 -32
  75. package/configuration/index.d.ts +2 -2
  76. package/configuration/index.js +2 -2
  77. package/configuration/types.d.ts +2 -3
  78. package/configuration/util.d.ts +1 -25
  79. package/configuration/util.js +19 -56
  80. package/data_adapters/BaseAdapter/BaseAdapter.d.ts +4 -14
  81. package/data_adapters/BaseAdapter/BaseAdapter.js +1 -10
  82. package/data_adapters/BaseAdapter/BaseFeatureDataAdapter.d.ts +5 -114
  83. package/data_adapters/BaseAdapter/BaseFeatureDataAdapter.js +3 -79
  84. package/data_adapters/BaseAdapter/BaseOptions.d.ts +2 -2
  85. package/data_adapters/BaseAdapter/BaseRefNameAliasAdapter.d.ts +2 -2
  86. package/data_adapters/BaseAdapter/BaseSequenceAdapter.d.ts +3 -6
  87. package/data_adapters/BaseAdapter/BaseTextSearchAdapter.d.ts +3 -3
  88. package/data_adapters/BaseAdapter/RegionsAdapter.d.ts +3 -3
  89. package/data_adapters/BaseAdapter/index.d.ts +4 -4
  90. package/data_adapters/BaseAdapter/types.d.ts +2 -2
  91. package/data_adapters/BaseAdapter/util.d.ts +6 -6
  92. package/data_adapters/CytobandAdapter/CytobandAdapter.d.ts +1 -1
  93. package/data_adapters/CytobandAdapter/CytobandAdapter.js +1 -2
  94. package/data_adapters/CytobandAdapter/configSchema.d.ts +0 -3
  95. package/data_adapters/CytobandAdapter/configSchema.js +1 -7
  96. package/data_adapters/CytobandAdapter/index.d.ts +1 -1
  97. package/data_adapters/CytobandAdapter/index.js +1 -1
  98. package/data_adapters/dataAdapterCache.d.ts +4 -21
  99. package/data_adapters/dataAdapterCache.js +0 -19
  100. package/package.json +3 -4
  101. package/pluggableElementTypes/AdapterType.d.ts +2 -2
  102. package/pluggableElementTypes/AddTrackWorkflowType.d.ts +2 -2
  103. package/pluggableElementTypes/ConnectionType.d.ts +3 -3
  104. package/pluggableElementTypes/DisplayType.d.ts +3 -9
  105. package/pluggableElementTypes/InternetAccountType.d.ts +2 -2
  106. package/pluggableElementTypes/PluggableElementBase.d.ts +1 -1
  107. package/pluggableElementTypes/PluggableElementBase.js +2 -2
  108. package/pluggableElementTypes/RpcMethodType.d.ts +5 -11
  109. package/pluggableElementTypes/RpcMethodType.js +7 -19
  110. package/pluggableElementTypes/RpcMethodTypeWithFiltersAndRenameRegions.d.ts +9 -0
  111. package/pluggableElementTypes/RpcMethodTypeWithFiltersAndRenameRegions.js +35 -0
  112. package/pluggableElementTypes/TextSearchAdapterType.d.ts +2 -2
  113. package/pluggableElementTypes/TrackType.d.ts +3 -3
  114. package/pluggableElementTypes/ViewType.d.ts +3 -3
  115. package/pluggableElementTypes/WidgetType.d.ts +4 -3
  116. package/pluggableElementTypes/index.d.ts +11 -11
  117. package/pluggableElementTypes/models/BaseConnectionModelFactory.d.ts +2 -29
  118. package/pluggableElementTypes/models/BaseConnectionModelFactory.js +1 -28
  119. package/pluggableElementTypes/models/BaseDisplayModel.d.ts +3 -83
  120. package/pluggableElementTypes/models/BaseDisplayModel.js +2 -69
  121. package/pluggableElementTypes/models/BaseTrackModel.d.ts +4 -46
  122. package/pluggableElementTypes/models/BaseTrackModel.js +0 -58
  123. package/pluggableElementTypes/models/BaseViewModel.d.ts +2 -42
  124. package/pluggableElementTypes/models/BaseViewModel.js +2 -38
  125. package/pluggableElementTypes/models/InternetAccountModel.d.ts +3 -119
  126. package/pluggableElementTypes/models/InternetAccountModel.js +3 -123
  127. package/pluggableElementTypes/models/baseConnectionConfig.d.ts +0 -6
  128. package/pluggableElementTypes/models/baseConnectionConfig.js +1 -13
  129. package/pluggableElementTypes/models/baseInternetAccountConfig.d.ts +0 -15
  130. package/pluggableElementTypes/models/baseInternetAccountConfig.js +1 -23
  131. package/pluggableElementTypes/models/baseTrackConfig.d.ts +2 -53
  132. package/pluggableElementTypes/models/baseTrackConfig.js +1 -58
  133. package/pluggableElementTypes/renderers/BoxRendererType.d.ts +7 -15
  134. package/pluggableElementTypes/renderers/BoxRendererType.js +3 -14
  135. package/pluggableElementTypes/renderers/CircularChordRendererType.d.ts +3 -2
  136. package/pluggableElementTypes/renderers/CircularChordRendererType.js +1 -6
  137. package/pluggableElementTypes/renderers/ComparativeServerSideRendererType.d.ts +6 -21
  138. package/pluggableElementTypes/renderers/ComparativeServerSideRendererType.js +2 -25
  139. package/pluggableElementTypes/renderers/FeatureRendererType.d.ts +5 -47
  140. package/pluggableElementTypes/renderers/FeatureRendererType.js +15 -68
  141. package/pluggableElementTypes/renderers/RendererType.d.ts +4 -8
  142. package/pluggableElementTypes/renderers/RendererType.js +1 -5
  143. package/pluggableElementTypes/renderers/RpcRenderedSvgGroup.d.ts +2 -2
  144. package/pluggableElementTypes/renderers/RpcRenderedSvgGroup.js +3 -12
  145. package/pluggableElementTypes/renderers/ServerSideRenderedContent.d.ts +1 -1
  146. package/pluggableElementTypes/renderers/ServerSideRenderedContent.js +6 -14
  147. package/pluggableElementTypes/renderers/ServerSideRendererType.d.ts +9 -49
  148. package/pluggableElementTypes/renderers/ServerSideRendererType.js +7 -57
  149. package/pluggableElementTypes/renderers/index.d.ts +1 -1
  150. package/pluggableElementTypes/renderers/util/serializableFilterChain.js +1 -3
  151. package/rpc/BaseRpcDriver.d.ts +3 -4
  152. package/rpc/BaseRpcDriver.js +20 -80
  153. package/rpc/MainThreadRpcDriver.d.ts +3 -7
  154. package/rpc/MainThreadRpcDriver.js +0 -5
  155. package/rpc/RpcManager.d.ts +3 -3
  156. package/rpc/RpcManager.js +2 -4
  157. package/rpc/WebWorkerRpcDriver.d.ts +3 -2
  158. package/rpc/WebWorkerRpcDriver.js +2 -13
  159. package/rpc/baseRpcConfig.d.ts +0 -3
  160. package/rpc/baseRpcConfig.js +1 -7
  161. package/rpc/configSchema.d.ts +0 -6
  162. package/rpc/configSchema.js +2 -11
  163. package/rpc/mainThreadRpcConfig.js +1 -7
  164. package/rpc/methods/CoreFreeResources.d.ts +0 -6
  165. package/rpc/methods/CoreFreeResources.js +2 -9
  166. package/rpc/methods/CoreGetFeatureDensityStats.d.ts +4 -5
  167. package/rpc/methods/CoreGetFeatureDensityStats.js +1 -1
  168. package/rpc/methods/CoreGetFeatureDetails.d.ts +2 -7
  169. package/rpc/methods/CoreGetFeatureDetails.js +0 -5
  170. package/rpc/methods/CoreGetFeatures.d.ts +5 -5
  171. package/rpc/methods/CoreGetFeatures.js +4 -5
  172. package/rpc/methods/CoreGetFileInfo.d.ts +1 -2
  173. package/rpc/methods/CoreGetFileInfo.js +1 -1
  174. package/rpc/methods/CoreGetMetadata.d.ts +1 -2
  175. package/rpc/methods/CoreGetMetadata.js +1 -1
  176. package/rpc/methods/CoreGetRefNames.d.ts +1 -2
  177. package/rpc/methods/CoreGetRefNames.js +1 -1
  178. package/rpc/methods/CoreRender.d.ts +2 -6
  179. package/rpc/methods/CoreRender.js +5 -7
  180. package/rpc/methods/util.d.ts +3 -3
  181. package/rpc/methods/util.js +0 -1
  182. package/rpc/webWorkerRpcConfig.js +1 -7
  183. package/stories/JBrowseCore.stories.d.ts +1 -1
  184. package/stories/JBrowseCore.stories.js +3 -3
  185. package/stories/examples/WithSequencePanel.d.ts +1 -1
  186. package/stories/examples/WithSequencePanel.js +3 -3
  187. package/tsconfig.build.tsbuildinfo +1 -1
  188. package/ui/AppLogo.d.ts +1 -1
  189. package/ui/AppLogo.js +0 -2
  190. package/ui/AssemblySelector.d.ts +2 -2
  191. package/ui/AssemblySelector.js +0 -3
  192. package/ui/BaseTooltip.js +2 -6
  193. package/ui/CascadingMenu.d.ts +2 -2
  194. package/ui/CascadingMenu.js +3 -4
  195. package/ui/CascadingMenuButton.d.ts +1 -1
  196. package/ui/CascadingMenuButton.js +1 -1
  197. package/ui/ColorPicker.js +1 -7
  198. package/ui/Dialog.d.ts +1 -1
  199. package/ui/Dialog.js +2 -6
  200. package/ui/DropDownMenu.d.ts +1 -1
  201. package/ui/DropDownMenu.js +2 -2
  202. package/ui/EditableTypography.d.ts +1 -1
  203. package/ui/EditableTypography.js +1 -5
  204. package/ui/ErrorBoundary.d.ts +2 -1
  205. package/ui/ErrorMessage.js +2 -9
  206. package/ui/ErrorMessageStackTraceDialog.js +2 -10
  207. package/ui/FactoryResetDialog.js +1 -1
  208. package/ui/FatalErrorDialog.js +1 -1
  209. package/ui/FileSelector/FileSelector.d.ts +4 -3
  210. package/ui/FileSelector/FileSelector.js +40 -40
  211. package/ui/FileSelector/LocalFileChooser.d.ts +1 -1
  212. package/ui/FileSelector/LocalFileChooser.js +0 -1
  213. package/ui/FileSelector/UrlChooser.d.ts +4 -3
  214. package/ui/FileSelector/UrlChooser.js +5 -3
  215. package/ui/Icons.d.ts +1 -1
  216. package/ui/Icons.js +1 -7
  217. package/ui/LoadingEllipses.d.ts +1 -1
  218. package/ui/LoadingEllipses.js +3 -3
  219. package/ui/Menu.d.ts +1 -1
  220. package/ui/Menu.js +3 -10
  221. package/ui/MenuButton.d.ts +1 -1
  222. package/ui/ResizeHandle.js +2 -2
  223. package/ui/ReturnToImportFormDialog.js +1 -1
  224. package/ui/SanitizedHTML.js +1 -21
  225. package/ui/Snackbar.d.ts +2 -2
  226. package/ui/Snackbar.js +1 -2
  227. package/ui/SnackbarModel.d.ts +1 -26
  228. package/ui/SnackbarModel.js +2 -30
  229. package/ui/colors.d.ts +1 -1
  230. package/ui/colors.js +1 -1
  231. package/ui/react-colorful.js +0 -3
  232. package/ui/theme.d.ts +1 -1
  233. package/ui/theme.js +0 -40
  234. package/util/Base1DUtils.d.ts +1 -1
  235. package/util/Base1DUtils.js +0 -12
  236. package/util/Base1DViewModel.d.ts +4 -81
  237. package/util/Base1DViewModel.js +4 -108
  238. package/util/QuickLRU.js +0 -9
  239. package/util/TimeTraveller.js +0 -4
  240. package/util/aborting.d.ts +0 -20
  241. package/util/aborting.js +0 -31
  242. package/util/analytics.js +1 -12
  243. package/util/blockTypes.d.ts +0 -11
  244. package/util/blockTypes.js +0 -13
  245. package/util/calculateDynamicBlocks.d.ts +1 -20
  246. package/util/calculateDynamicBlocks.js +1 -22
  247. package/util/calculateStaticBlocks.d.ts +2 -2
  248. package/util/calculateStaticBlocks.js +0 -2
  249. package/util/color/cssColorsLevel4.js +0 -1
  250. package/util/color/index.d.ts +0 -19
  251. package/util/color/index.js +0 -30
  252. package/util/compositeMap.js +0 -2
  253. package/util/dedupe.js +0 -1
  254. package/util/formatFastaStrings.d.ts +0 -13
  255. package/util/formatFastaStrings.js +0 -13
  256. package/util/idMaker.d.ts +1 -1
  257. package/util/idMaker.js +16 -12
  258. package/util/index.d.ts +16 -164
  259. package/util/index.js +22 -282
  260. package/util/io/RemoteFileWithRangeCache.d.ts +3 -2
  261. package/util/io/RemoteFileWithRangeCache.js +6 -10
  262. package/util/io/index.d.ts +3 -4
  263. package/util/io/index.js +3 -17
  264. package/util/jexl.js +3 -13
  265. package/util/jexlStrings.d.ts +0 -6
  266. package/util/jexlStrings.js +0 -8
  267. package/util/layouts/BaseLayout.d.ts +1 -1
  268. package/util/layouts/GranularRectLayout.d.ts +1 -17
  269. package/util/layouts/GranularRectLayout.js +4 -81
  270. package/util/layouts/MultiLayout.d.ts +1 -6
  271. package/util/layouts/MultiLayout.js +0 -6
  272. package/util/layouts/PrecomputedLayout.d.ts +1 -4
  273. package/util/layouts/PrecomputedLayout.js +0 -5
  274. package/util/layouts/PrecomputedMultiLayout.js +0 -2
  275. package/util/layouts/SceneGraph.d.ts +0 -12
  276. package/util/layouts/SceneGraph.js +0 -13
  277. package/util/makeAbortableReaction.d.ts +2 -0
  278. package/util/makeAbortableReaction.js +50 -0
  279. package/util/map-obj.js +0 -4
  280. package/util/mst-reflection.d.ts +1 -14
  281. package/util/mst-reflection.js +1 -28
  282. package/util/nanoid.js +0 -31
  283. package/util/nextTick.d.ts +1 -0
  284. package/util/nextTick.js +6 -0
  285. package/util/offscreenCanvasPonyfill.d.ts +0 -1
  286. package/util/offscreenCanvasPonyfill.js +1 -9
  287. package/util/offscreenCanvasUtils.js +1 -8
  288. package/util/range.d.ts +0 -25
  289. package/util/range.js +0 -34
  290. package/util/rxjs.d.ts +3 -7
  291. package/util/rxjs.js +2 -9
  292. package/util/simpleFeature.d.ts +0 -50
  293. package/util/simpleFeature.js +0 -35
  294. package/util/stats.d.ts +3 -26
  295. package/util/stats.js +0 -25
  296. package/util/stopToken.d.ts +3 -0
  297. package/util/stopToken.js +29 -0
  298. package/util/tracks.d.ts +3 -25
  299. package/util/tracks.js +0 -30
  300. package/util/types/index.d.ts +14 -30
  301. package/util/types/index.js +5 -14
  302. package/util/types/mst.js +0 -9
  303. package/util/types/util.d.ts +2 -9
  304. package/util/useMeasure.js +0 -1
  305. package/util/when.d.ts +1 -15
  306. package/util/when.js +3 -70
  307. package/rpc/remoteAbortSignals.d.ts +0 -36
  308. package/rpc/remoteAbortSignals.js +0 -79
package/util/stats.js CHANGED
@@ -6,16 +6,6 @@ exports.scoresToStats = scoresToStats;
6
6
  exports.blankStats = blankStats;
7
7
  const rxjs_1 = require("rxjs");
8
8
  const operators_1 = require("rxjs/operators");
9
- /**
10
- * calculate standard deviation using the 'shortcut method' that accepts
11
- * the sum and the sum squares of the elements
12
- *
13
- * @param sum - sum(i, 1..n)
14
- * @param sumSquares - sum(i^2, 1..n)
15
- * @param n - number of elements
16
- * @param population - boolean: use population instead of sample correction
17
- * @returns - the estimated std deviation
18
- */
19
9
  function calcStdFromSums(sum, sumSquares, n, population = false) {
20
10
  if (n === 0) {
21
11
  return 0;
@@ -25,7 +15,6 @@ function calcStdFromSums(sum, sumSquares, n, population = false) {
25
15
  variance = sumSquares / n - (sum * sum) / (n * n);
26
16
  }
27
17
  else {
28
- // sample correction is n-1
29
18
  variance = sumSquares - (sum * sum) / n;
30
19
  if (n > 1) {
31
20
  variance /= n - 1;
@@ -33,12 +22,6 @@ function calcStdFromSums(sum, sumSquares, n, population = false) {
33
22
  }
34
23
  return variance < 0 ? 0 : Math.sqrt(variance);
35
24
  }
36
- /**
37
- * @param stats - a summary stats object with scoreSum, featureCount,
38
- * scoreSumSquares, and basesCovered
39
- * @returns - a summary stats object with
40
- * scoreMean, scoreStdDev, and featureDensity added
41
- */
42
25
  function rectifyStats(s) {
43
26
  return {
44
27
  ...s,
@@ -47,13 +30,6 @@ function rectifyStats(s) {
47
30
  featureDensity: (s.featureCount || 1) / s.basesCovered,
48
31
  };
49
32
  }
50
- /**
51
- * transform a list of scores to summary statistics
52
- *
53
- * @param region - object with start, end
54
- * @param features - array of features which are possibly summary features
55
- * @returns - object with scoreMax, scoreMin, scoreSum, scoreSumSquares, etc
56
- */
57
33
  async function scoresToStats(region, feats) {
58
34
  const { start, end } = region;
59
35
  const seed = {
@@ -76,7 +52,6 @@ async function scoresToStats(region, feats) {
76
52
  found = true;
77
53
  return acc;
78
54
  }, seed)));
79
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
80
55
  return found
81
56
  ? rectifyStats({
82
57
  scoreMax,
@@ -0,0 +1,3 @@
1
+ export declare function createStopToken(): string;
2
+ export declare function stopStopToken(stopToken: string): void;
3
+ export declare function checkStopToken(stopToken?: string): void;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createStopToken = createStopToken;
4
+ exports.stopStopToken = stopStopToken;
5
+ exports.checkStopToken = checkStopToken;
6
+ function isWebWorker() {
7
+ return (typeof WorkerGlobalScope !== 'undefined' &&
8
+ self instanceof WorkerGlobalScope);
9
+ }
10
+ function createStopToken() {
11
+ var _a;
12
+ return ((_a = URL.createObjectURL) === null || _a === void 0 ? void 0 : _a.call(URL, new Blob())) || `${Math.random()}`;
13
+ }
14
+ function stopStopToken(stopToken) {
15
+ var _a;
16
+ (_a = URL.revokeObjectURL) === null || _a === void 0 ? void 0 : _a.call(URL, stopToken);
17
+ }
18
+ function checkStopToken(stopToken) {
19
+ if (typeof jest === 'undefined' && stopToken !== undefined && isWebWorker()) {
20
+ const xhr = new XMLHttpRequest();
21
+ xhr.open('GET', stopToken, false);
22
+ try {
23
+ xhr.send(null);
24
+ }
25
+ catch (e) {
26
+ throw new Error('aborted');
27
+ }
28
+ }
29
+ }
package/util/tracks.d.ts CHANGED
@@ -1,20 +1,11 @@
1
- import { IAnyStateTreeNode } from 'mobx-state-tree';
2
- import { PreFileLocation, FileLocation } from './types';
3
- import { AnyConfigurationModel } from '../configuration';
1
+ import type { FileLocation, PreFileLocation } from './types';
2
+ import type { AnyConfigurationModel } from '../configuration';
3
+ import type { IAnyStateTreeNode } from 'mobx-state-tree';
4
4
  export declare function getTrackAssemblyNames(track: IAnyStateTreeNode & {
5
5
  configuration: AnyConfigurationModel;
6
6
  }): string[];
7
7
  export declare function getConfAssemblyNames(conf: AnyConfigurationModel): string[];
8
- /**
9
- * return the rpcSessionId of the highest parent node in the tree that has an
10
- * rpcSessionId */
11
8
  export declare function getRpcSessionId(thisNode: IAnyStateTreeNode): string;
12
- /**
13
- * given an MST node, get the renderprops of the first parent container that
14
- * has renderProps
15
- * @param node -
16
- * @returns renderprops, or empty object if none found
17
- */
18
9
  export declare function getParentRenderProps(node: IAnyStateTreeNode): any;
19
10
  export declare const UNKNOWN = "UNKNOWN";
20
11
  export declare const UNSUPPORTED = "UNSUPPORTED";
@@ -26,12 +17,6 @@ export declare function storeBlobLocation(location: PreFileLocation): import("./
26
17
  blobId: string;
27
18
  locationType: string;
28
19
  };
29
- /**
30
- * creates a new location from the provided location including the appropriate suffix and location type
31
- * @param location - the FileLocation
32
- * @param suffix - the file suffix (e.g. .bam)
33
- * @returns the constructed location object from the provided parameters
34
- */
35
20
  export declare function makeIndex(location: FileLocation, suffix: string): import("./types").BlobLocation | {
36
21
  uri: string;
37
22
  locationType: string;
@@ -41,13 +26,6 @@ export declare function makeIndex(location: FileLocation, suffix: string): impor
41
26
  locationType: string;
42
27
  uri?: undefined;
43
28
  };
44
- /**
45
- * constructs a potential index file (with suffix) from the provided file name
46
- * @param name - the name of the index file
47
- * @param typeA - one option of a potential two file suffix (e.g. CSI, BAI)
48
- * @param typeB - the second option of a potential two file suffix (e.g. CSI, BAI)
49
- * @returns a likely name of the index file for a given filename
50
- */
51
29
  export declare function makeIndexType(name: string | undefined, typeA: string, typeB: string): string;
52
30
  export interface AdapterConfig {
53
31
  type: string;
package/util/tracks.js CHANGED
@@ -20,14 +20,12 @@ exports.getTrackName = getTrackName;
20
20
  const mobx_state_tree_1 = require("mobx-state-tree");
21
21
  const index_1 = require("./index");
22
22
  const configuration_1 = require("../configuration");
23
- /* utility functions for use by track models and so forth */
24
23
  function getTrackAssemblyNames(track) {
25
24
  return getConfAssemblyNames(track.configuration);
26
25
  }
27
26
  function getConfAssemblyNames(conf) {
28
27
  const trackAssemblyNames = (0, configuration_1.readConfObject)(conf, 'assemblyNames');
29
28
  if (!trackAssemblyNames) {
30
- // Check if it's an assembly sequence track
31
29
  const parent = (0, mobx_state_tree_1.getParent)(conf);
32
30
  if ('sequence' in parent) {
33
31
  return [(0, configuration_1.readConfObject)(parent, 'name')];
@@ -38,9 +36,6 @@ function getConfAssemblyNames(conf) {
38
36
  }
39
37
  return trackAssemblyNames;
40
38
  }
41
- /**
42
- * return the rpcSessionId of the highest parent node in the tree that has an
43
- * rpcSessionId */
44
39
  function getRpcSessionId(thisNode) {
45
40
  let highestRpcSessionId;
46
41
  for (let node = thisNode; !(0, mobx_state_tree_1.isRoot)(node); node = (0, mobx_state_tree_1.getParent)(node)) {
@@ -53,12 +48,6 @@ function getRpcSessionId(thisNode) {
53
48
  }
54
49
  return highestRpcSessionId;
55
50
  }
56
- /**
57
- * given an MST node, get the renderprops of the first parent container that
58
- * has renderProps
59
- * @param node -
60
- * @returns renderprops, or empty object if none found
61
- */
62
51
  function getParentRenderProps(node) {
63
52
  for (let currentNode = (0, mobx_state_tree_1.getParent)(node); !(0, mobx_state_tree_1.isRoot)(currentNode); currentNode = (0, mobx_state_tree_1.getParent)(currentNode)) {
64
53
  if ('renderProps' in currentNode) {
@@ -70,22 +59,16 @@ function getParentRenderProps(node) {
70
59
  exports.UNKNOWN = 'UNKNOWN';
71
60
  exports.UNSUPPORTED = 'UNSUPPORTED';
72
61
  let blobMap = {};
73
- // get a specific blob
74
62
  function getBlob(id) {
75
63
  return blobMap[id];
76
64
  }
77
- // used to export entire context to webworker
78
65
  function getBlobMap() {
79
66
  return blobMap;
80
67
  }
81
- // used in new contexts like webworkers
82
68
  function setBlobMap(map) {
83
69
  blobMap = map;
84
70
  }
85
71
  let counter = 0;
86
- // blob files are stored in a global map. the blobId is based on a combination
87
- // of timestamp plus counter to be unique across sessions and fast repeated
88
- // calls
89
72
  function storeBlobLocation(location) {
90
73
  if ('blob' in location) {
91
74
  const blobId = `b${+Date.now()}-${counter++}`;
@@ -94,12 +77,6 @@ function storeBlobLocation(location) {
94
77
  }
95
78
  return location;
96
79
  }
97
- /**
98
- * creates a new location from the provided location including the appropriate suffix and location type
99
- * @param location - the FileLocation
100
- * @param suffix - the file suffix (e.g. .bam)
101
- * @returns the constructed location object from the provided parameters
102
- */
103
80
  function makeIndex(location, suffix) {
104
81
  if ('uri' in location) {
105
82
  return { uri: location.uri + suffix, locationType: 'UriLocation' };
@@ -112,13 +89,6 @@ function makeIndex(location, suffix) {
112
89
  }
113
90
  return location;
114
91
  }
115
- /**
116
- * constructs a potential index file (with suffix) from the provided file name
117
- * @param name - the name of the index file
118
- * @param typeA - one option of a potential two file suffix (e.g. CSI, BAI)
119
- * @param typeB - the second option of a potential two file suffix (e.g. CSI, BAI)
120
- * @returns a likely name of the index file for a given filename
121
- */
122
92
  function makeIndexType(name, typeA, typeB) {
123
93
  return (name === null || name === void 0 ? void 0 : name.toUpperCase().endsWith(typeA)) ? typeA : typeB;
124
94
  }
@@ -1,17 +1,16 @@
1
- import React from 'react';
2
- import { Instance, SnapshotIn, IAnyStateTreeNode, IStateTreeNode, IType } from 'mobx-state-tree';
3
- import { ThemeOptions } from '@mui/material';
4
- import { AnyConfigurationModel } from '../../configuration';
5
- import TextSearchManager from '../../TextSearch/TextSearchManager';
6
- import { MenuItem } from '../../ui';
7
- import RpcManager from '../../rpc/RpcManager';
8
- import { Feature } from '../simpleFeature';
9
- import { BaseInternetAccountModel } from '../../pluggableElementTypes/models';
1
+ import type React from 'react';
2
+ import type { BlobLocation as MUBlobLocation, LocalPathLocation as MULocalPathLocation, NoAssemblyRegion as MUNoAssemblyRegion, Region as MUIRegion, UriLocation as MUUriLocation } from './mst';
3
+ import type TextSearchManager from '../../TextSearch/TextSearchManager';
10
4
  import type assemblyManager from '../../assemblyManager';
11
- import type { NoAssemblyRegion as MUNoAssemblyRegion, Region as MUIRegion, LocalPathLocation as MULocalPathLocation, UriLocation as MUUriLocation, BlobLocation as MUBlobLocation } from './mst';
5
+ import type { AnyConfigurationModel } from '../../configuration';
6
+ import type { BaseInternetAccountModel } from '../../pluggableElementTypes/models';
7
+ import type RpcManager from '../../rpc/RpcManager';
8
+ import type { MenuItem } from '../../ui';
9
+ import type { Feature } from '../simpleFeature';
10
+ import type { ThemeOptions } from '@mui/material';
11
+ import type { IAnyStateTreeNode, IStateTreeNode, IType, Instance, SnapshotIn } from 'mobx-state-tree';
12
12
  export * from './util';
13
- /** abstract type for a model that contains multiple views */
14
- export interface AbstractViewContainer extends IStateTreeNode<IType<any, unknown, any>> {
13
+ export interface AbstractViewContainer extends IStateTreeNode<IType<any, any, any>> {
15
14
  views: AbstractViewModel[];
16
15
  removeView(view: AbstractViewModel): void;
17
16
  addView(typeName: string, initialState?: Record<string, unknown>): AbstractViewModel;
@@ -41,7 +40,6 @@ export interface JBrowsePlugin {
41
40
  image?: string;
42
41
  }
43
42
  export type DialogComponentType = React.LazyExoticComponent<React.FC<any>> | React.FC<any>;
44
- /** minimum interface that all session state models must implement */
45
43
  export interface AbstractSessionModel extends AbstractViewContainer {
46
44
  jbrowse: IAnyStateTreeNode;
47
45
  drawerPosition?: string;
@@ -97,17 +95,14 @@ export interface AbstractSessionModel extends AbstractViewContainer {
97
95
  tracks: AnyConfigurationModel[];
98
96
  }
99
97
  export declare function isSessionModel(thing: unknown): thing is AbstractSessionModel;
100
- /** abstract interface for a session allows editing configurations */
101
98
  export interface SessionWithConfigEditing extends AbstractSessionModel {
102
99
  editConfiguration(configuration: AnyConfigurationModel): void;
103
100
  }
104
- export declare function isSessionModelWithConfigEditing(thing: unknown): thing is SessionWithConfigEditing;
105
- /** abstract interface for a session allows adding tracks */
106
- export interface SessionWithConfigEditing extends AbstractSessionModel {
101
+ export declare function isSessionModelWithConfigEditing(t: unknown): t is SessionWithConfigEditing;
102
+ export interface SessionWithAddTracks extends AbstractSessionModel {
107
103
  addTrackConf(configuration: AnyConfigurationModel | SnapshotIn<AnyConfigurationModel>): void;
108
104
  }
109
- export declare function isSessionWithAddTracks(thing: unknown): thing is SessionWithConfigEditing;
110
- /** abstract interface for a session allows adding tracks */
105
+ export declare function isSessionWithAddTracks(t: unknown): t is SessionWithAddTracks;
111
106
  export interface SessionWithShareURL extends AbstractSessionModel {
112
107
  shareURL: string;
113
108
  }
@@ -116,7 +111,6 @@ export interface Widget {
116
111
  type: string;
117
112
  id: string;
118
113
  }
119
- /** abstract interface for a session that manages widgets */
120
114
  export interface SessionWithWidgets extends AbstractSessionModel {
121
115
  minimized: boolean;
122
116
  visibleWidget?: Widget;
@@ -152,18 +146,15 @@ export interface SessionWithSessionPlugins extends AbstractSessionModel {
152
146
  removeSessionPlugin: Function;
153
147
  }
154
148
  export declare function isSessionWithSessionPlugins(thing: unknown): thing is SessionWithSessionPlugins;
155
- /** abstract interface for a session that manages a global selection */
156
149
  export interface SelectionContainer extends AbstractSessionModel {
157
150
  selection?: unknown;
158
151
  setSelection(thing: unknown): void;
159
152
  }
160
153
  export declare function isSelectionContainer(thing: unknown): thing is SelectionContainer;
161
- /** abstract interface for a session allows applying focus to views and widgets */
162
154
  export interface SessionWithFocusedViewAndDrawerWidgets extends SessionWithDrawerWidgets {
163
155
  focusedViewId: string | undefined;
164
156
  setFocusedViewId(id: string): void;
165
157
  }
166
- /** minimum interface that all view state models must implement */
167
158
  export interface AbstractViewModel {
168
159
  id: string;
169
160
  type: string;
@@ -194,7 +185,6 @@ export interface TrackViewModel extends AbstractViewModel {
194
185
  hideTrack(trackId: string): void;
195
186
  }
196
187
  export declare function isTrackViewModel(thing: unknown): thing is TrackViewModel;
197
- /** minimum interface for the root MST model of a JBrowse app */
198
188
  export interface AbstractRootModel {
199
189
  jbrowse: IAnyStateTreeNode;
200
190
  session?: AbstractSessionModel;
@@ -202,7 +192,6 @@ export interface AbstractRootModel {
202
192
  adminMode?: boolean;
203
193
  error?: unknown;
204
194
  }
205
- /** root model with more included for the heavier JBrowse web and desktop app */
206
195
  export interface AppRootModel extends AbstractRootModel {
207
196
  internetAccounts: BaseInternetAccountModel[];
208
197
  findAppropriateInternetAccount(location: UriLocation): BaseInternetAccountModel | undefined;
@@ -213,7 +202,6 @@ export interface RootModelWithInternetAccounts extends AbstractRootModel {
213
202
  findAppropriateInternetAccount(location: UriLocation): BaseInternetAccountModel | undefined;
214
203
  }
215
204
  export declare function isRootModelWithInternetAccounts(thing: unknown): thing is RootModelWithInternetAccounts;
216
- /** a root model that manages global menus */
217
205
  export interface AbstractMenuManager {
218
206
  appendMenu(menuName: string): void;
219
207
  insertMenu(menuName: string, position: number): number;
@@ -225,10 +213,6 @@ export interface AbstractMenuManager {
225
213
  export declare function isAbstractMenuManager(thing: unknown): thing is AbstractMenuManager;
226
214
  export interface NoAssemblyRegion extends SnapshotIn<typeof MUNoAssemblyRegion> {
227
215
  }
228
- /**
229
- * a description of a specific genomic region. assemblyName, refName, start,
230
- * end, and reversed
231
- */
232
216
  export interface Region extends SnapshotIn<typeof MUIRegion> {
233
217
  }
234
218
  export interface AugmentedRegion extends Region {
@@ -54,13 +54,11 @@ function isSessionModel(thing) {
54
54
  'rpcManager' in thing &&
55
55
  'configuration' in thing);
56
56
  }
57
- function isSessionModelWithConfigEditing(thing) {
58
- return isSessionModel(thing) && 'editConfiguration' in thing;
57
+ function isSessionModelWithConfigEditing(t) {
58
+ return isSessionModel(t) && 'editConfiguration' in t;
59
59
  }
60
- function isSessionWithAddTracks(thing) {
61
- return (
62
- // @ts-expect-error
63
- isSessionModel(thing) && 'addTrackConf' in thing && !thing.disableAddTracks);
60
+ function isSessionWithAddTracks(t) {
61
+ return (isSessionModel(t) && 'addTrackConf' in t && !t.disableAddTracks);
64
62
  }
65
63
  function isSessionWithShareURL(thing) {
66
64
  return isSessionModel(thing) && 'shareURL' in thing && !!thing.shareURL;
@@ -93,14 +91,12 @@ function isTrackModel(thing) {
93
91
  return (typeof thing === 'object' &&
94
92
  thing !== null &&
95
93
  'configuration' in thing &&
96
- // @ts-expect-error
97
94
  thing.configuration.trackId);
98
95
  }
99
96
  function isDisplayModel(thing) {
100
97
  return (typeof thing === 'object' &&
101
98
  thing !== null &&
102
99
  'configuration' in thing &&
103
- // @ts-expect-error
104
100
  thing.configuration.displayId);
105
101
  }
106
102
  function isTrackViewModel(thing) {
@@ -165,16 +161,11 @@ class RetryError extends Error {
165
161
  exports.RetryError = RetryError;
166
162
  function isAuthNeededException(exception) {
167
163
  return (exception instanceof Error &&
168
- // DOMException
169
164
  (exception.name === 'AuthNeededError' ||
170
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
171
165
  exception.url !== undefined));
172
166
  }
173
167
  function isRetryException(exception) {
174
- return (
175
- // DOMException
176
- exception.name === 'RetryError' ||
177
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
168
+ return (exception.name === 'RetryError' ||
178
169
  exception.internetAccountId !== undefined);
179
170
  }
180
171
  var TextSearchManager_1 = require("../../TextSearch/TextSearchManager");
package/util/types/mst.js CHANGED
@@ -23,7 +23,6 @@ exports.LocalPathLocation = mobx_state_tree_1.types.model('LocalPathLocation', {
23
23
  locationType: mobx_state_tree_1.types.literal('LocalPathLocation'),
24
24
  localPath: mobx_state_tree_1.types.string,
25
25
  });
26
- // like how blobId is used to get a blob map
27
26
  exports.BlobLocation = mobx_state_tree_1.types.model('BlobLocation', {
28
27
  locationType: mobx_state_tree_1.types.literal('BlobLocation'),
29
28
  name: mobx_state_tree_1.types.string,
@@ -34,8 +33,6 @@ exports.UriLocationRaw = mobx_state_tree_1.types.model('UriLocation', {
34
33
  uri: mobx_state_tree_1.types.string,
35
34
  baseUri: mobx_state_tree_1.types.maybe(mobx_state_tree_1.types.string),
36
35
  internetAccountId: mobx_state_tree_1.types.maybe(mobx_state_tree_1.types.string),
37
- // auths information (such as tokens) needed for using this resource.
38
- // if provided, these must be completely sufficient for using it
39
36
  internetAccountPreAuthorization: mobx_state_tree_1.types.maybe(mobx_state_tree_1.types.model('InternetAccountPreAuthorization', {
40
37
  internetAccountType: mobx_state_tree_1.types.string,
41
38
  authInfo: mobx_state_tree_1.types.frozen(),
@@ -43,7 +40,6 @@ exports.UriLocationRaw = mobx_state_tree_1.types.model('UriLocation', {
43
40
  });
44
41
  exports.UriLocation = mobx_state_tree_1.types.snapshotProcessor(exports.UriLocationRaw, {
45
42
  postProcessor: snap => {
46
- // xref https://github.com/mobxjs/mobx-state-tree/issues/1524 for Omit
47
43
  const { baseUri, ...rest } = snap;
48
44
  if (!baseUri) {
49
45
  return rest;
@@ -52,17 +48,12 @@ exports.UriLocation = mobx_state_tree_1.types.snapshotProcessor(exports.UriLocat
52
48
  },
53
49
  });
54
50
  exports.FileLocation = mobx_state_tree_1.types.snapshotProcessor(mobx_state_tree_1.types.union(exports.LocalPathLocation, exports.UriLocation, exports.BlobLocation), {
55
- // @ts-expect-error
56
51
  preProcessor(snap) {
57
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
58
52
  if (!snap) {
59
53
  return undefined;
60
54
  }
61
- // @ts-expect-error
62
- // xref https://github.com/mobxjs/mobx-state-tree/issues/1524 for Omit
63
55
  const { locationType, ...rest } = snap;
64
56
  if (!locationType) {
65
- // @ts-expect-error
66
57
  const { uri, localPath, blob } = rest;
67
58
  let locationType = '';
68
59
  if (uri !== undefined) {
@@ -1,13 +1,6 @@
1
- import React from 'react';
2
- import PluginManager from '../../PluginManager';
3
- /**
4
- * Obtain the return type of a constructor function type.
5
- * Differs from core Typescript InstanceType in that it returns never if not matched.
6
- */
1
+ import type React from 'react';
2
+ import type PluginManager from '../../PluginManager';
7
3
  export type InstanceTypeRestrictive<CONSTRUCTOR extends new (...args: any[]) => any> = CONSTRUCTOR extends new (...args: any[]) => infer CLASS ? CLASS : never;
8
- /** extracts the class type from a factory function that returns a constructor */
9
4
  export type ClassReturnedBy<FACT extends (pm: PluginManager) => any> = InstanceTypeRestrictive<ReturnType<FACT>>;
10
- /** A react component with any props. Consider using something more specific if possible */
11
5
  export type AnyReactComponentType = React.ComponentType<any>;
12
- /** get the type that a predicate asserts */
13
6
  export type TypeTestedByPredicate<PREDICATE extends (thing: any) => boolean> = PREDICATE extends (thing: any) => thing is infer TYPE ? TYPE : never;
@@ -25,7 +25,6 @@ function useMeasure() {
25
25
  });
26
26
  });
27
27
  observer.observe(ref.current);
28
- // Callback fired when component is unmounted
29
28
  return () => {
30
29
  observer.disconnect();
31
30
  };
package/util/when.d.ts CHANGED
@@ -1,15 +1 @@
1
- import { IWhenOptions } from 'mobx';
2
- interface WhenOpts extends IWhenOptions {
3
- signal?: AbortSignal;
4
- }
5
- /**
6
- * Wrapper for mobx `when` that adds timeout and aborting support.
7
- */
8
- export declare function when(getter: () => boolean, { timeout, signal, name }?: WhenOpts): Promise<unknown>;
9
- /**
10
- * Wrapper for mobx `when` that makes a promise for the return value
11
- * of the given function at the point in time when it becomes not
12
- * undefined and not null.
13
- */
14
- export declare function whenPresent<FUNCTION extends () => unknown>(getter: FUNCTION, opts?: WhenOpts): Promise<NonNullable<ReturnType<FUNCTION>>>;
15
- export {};
1
+ export { when } from 'mobx';
package/util/when.js CHANGED
@@ -1,72 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.when = when;
4
- exports.whenPresent = whenPresent;
5
- const mobx_1 = require("mobx");
6
- const aborting_1 = require("./aborting");
7
- /**
8
- * Wrapper for mobx `when` that adds timeout and aborting support.
9
- */
10
- function when(getter, { timeout, signal, name } = {}) {
11
- return new Promise((resolve, reject) => {
12
- let finished = false;
13
- const whenPromise = (0, mobx_1.when)(getter);
14
- // set up timeout
15
- let timeoutId;
16
- let finishTimeout = () => { };
17
- if (timeout) {
18
- timeoutId = setTimeout(() => {
19
- if (!finished) {
20
- finished = true;
21
- whenPromise.cancel();
22
- reject(new Error(`timed out waiting for ${name || 'whenPresent'}`));
23
- }
24
- }, timeout);
25
- finishTimeout = () => {
26
- if (timeoutId) {
27
- clearTimeout(timeoutId);
28
- }
29
- };
30
- }
31
- // set up aborting
32
- if (signal) {
33
- signal.addEventListener('abort', () => {
34
- if (!finished) {
35
- finished = true;
36
- // mobx when supports a cancel method
37
- whenPromise.cancel();
38
- finishTimeout();
39
- reject((0, aborting_1.makeAbortError)());
40
- }
41
- });
42
- }
43
- whenPromise
44
- .then(() => {
45
- if (!finished) {
46
- finished = true;
47
- finishTimeout();
48
- resolve(true);
49
- }
50
- })
51
- .catch((err) => {
52
- if (!finished) {
53
- finished = true;
54
- finishTimeout();
55
- // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors
56
- reject(err);
57
- }
58
- });
59
- });
60
- }
61
- /**
62
- * Wrapper for mobx `when` that makes a promise for the return value
63
- * of the given function at the point in time when it becomes not
64
- * undefined and not null.
65
- */
66
- async function whenPresent(getter, opts = {}) {
67
- await when(() => {
68
- const val = getter();
69
- return val !== undefined && val !== null;
70
- }, opts);
71
- return getter();
72
- }
3
+ exports.when = void 0;
4
+ var mobx_1 = require("mobx");
5
+ Object.defineProperty(exports, "when", { enumerable: true, get: function () { return mobx_1.when; } });
@@ -1,36 +0,0 @@
1
- export interface RemoteAbortSignal {
2
- abortSignalId: number;
3
- }
4
- /**
5
- * assign an ID to the given abort signal and return a plain object
6
- * representation
7
- *
8
- * @param signal - the signal to serialize
9
- * @param callfunc - function used to call
10
- * a remote method, will be called like callfunc('signalAbort', signalId)
11
- */
12
- export declare function serializeAbortSignal(signal: AbortSignal, callfunc: (name: string, abortSignalId: number) => void): RemoteAbortSignal;
13
- /**
14
- * test whether a given object
15
- * @param thing - the thing to test
16
- * @returns true if the thing is a remote abort signal
17
- */
18
- export declare function isRemoteAbortSignal(thing: unknown): thing is RemoteAbortSignal;
19
- /**
20
- * deserialize the result of serializeAbortSignal into an AbortSignal
21
- *
22
- * @param signal -
23
- * @returns an abort signal that corresponds to the given ID
24
- */
25
- export declare function deserializeAbortSignal({ abortSignalId, }: RemoteAbortSignal): AbortSignal;
26
- /**
27
- * fire an abort signal from a remote abort signal ID
28
- *
29
- * @param abortSignalId -
30
- */
31
- export declare function remoteAbort(props: {
32
- signalId: number;
33
- }): void;
34
- export declare function remoteAbortRpcHandler(): {
35
- signalAbort: typeof remoteAbort;
36
- };