@orangecharts/wrun-chart-host 0.1.0 → 0.3.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 (337) hide show
  1. package/README.md +39 -6
  2. package/dist/constants/common.constants.d.ts +15 -0
  3. package/dist/constants/common.constants.js +23 -0
  4. package/dist/constants/data-source.constants.d.ts +1 -0
  5. package/dist/constants/data-source.constants.js +1 -0
  6. package/dist/constants/economic.constants.d.ts +39 -0
  7. package/dist/constants/economic.constants.js +77 -0
  8. package/dist/constants/etf-covered-coins.constants.d.ts +1 -0
  9. package/dist/constants/etf-covered-coins.constants.js +9 -0
  10. package/dist/constants/feature-flags.constants.d.ts +60 -0
  11. package/dist/constants/feature-flags.constants.js +308 -0
  12. package/dist/constants/feature-limits.constants.d.ts +134 -0
  13. package/dist/constants/feature-limits.constants.js +155 -0
  14. package/dist/constants/marketCapabilities.constants.d.ts +87 -0
  15. package/dist/constants/marketCapabilities.constants.js +213 -0
  16. package/dist/constants/option-venues.constants.d.ts +100 -0
  17. package/dist/constants/option-venues.constants.js +167 -0
  18. package/dist/constants/overlay-data.constants.d.ts +53 -0
  19. package/dist/constants/overlay-data.constants.js +80 -0
  20. package/dist/constants/pane-grid.constants.d.ts +15 -0
  21. package/dist/constants/pane-grid.constants.js +17 -0
  22. package/dist/constants/venue-presets.constants.d.ts +10 -0
  23. package/dist/constants/venue-presets.constants.js +22 -0
  24. package/dist/enums/chart.enum.d.ts +68 -0
  25. package/dist/enums/chart.enum.js +70 -0
  26. package/dist/helpers/data.helpers.d.ts +2 -0
  27. package/dist/helpers/data.helpers.js +14 -0
  28. package/dist/host-env.d.ts +161 -5
  29. package/dist/host-ports.types.d.ts +446 -0
  30. package/dist/host-ports.types.js +1 -0
  31. package/dist/index.d.ts +131 -0
  32. package/dist/index.js +131 -0
  33. package/dist/indicators/controls/technical-script/technical-script-input-rendering.d.ts +86 -0
  34. package/dist/indicators/controls/technical-script/technical-script-input-rendering.js +179 -0
  35. package/dist/interfaces/asset-venue.interface.d.ts +91 -0
  36. package/dist/interfaces/asset-venue.interface.js +1 -0
  37. package/dist/interfaces/cancel-reason.interface.d.ts +24 -0
  38. package/dist/interfaces/cancel-reason.interface.js +2 -0
  39. package/dist/interfaces/catalog-display.interface.d.ts +3 -0
  40. package/dist/interfaces/catalog-display.interface.js +1 -0
  41. package/dist/interfaces/cme-realtime.interface.d.ts +251 -0
  42. package/dist/interfaces/cme-realtime.interface.js +46 -0
  43. package/dist/interfaces/feed.interface.d.ts +80 -0
  44. package/dist/interfaces/feed.interface.js +7 -0
  45. package/dist/interfaces/market-kind.interface.d.ts +8 -0
  46. package/dist/interfaces/market-kind.interface.js +1 -0
  47. package/dist/interfaces/opra-realtime.interface.d.ts +224 -0
  48. package/dist/interfaces/opra-realtime.interface.js +105 -0
  49. package/dist/interfaces/option-instrument.interface.d.ts +32 -0
  50. package/dist/interfaces/option-instrument.interface.js +1 -0
  51. package/dist/interfaces/options-chain-scope.interface.d.ts +29 -0
  52. package/dist/interfaces/options-chain-scope.interface.js +7 -0
  53. package/dist/interfaces/prediction-market.interface.d.ts +88 -0
  54. package/dist/interfaces/prediction-market.interface.js +8 -0
  55. package/dist/interfaces/wrun-runtime.interface.d.ts +5 -0
  56. package/dist/kscript-data/controls/live-trades-merge.util.d.ts +185 -0
  57. package/dist/kscript-data/controls/live-trades-merge.util.js +357 -0
  58. package/dist/settings-templates/frvp-fields.d.ts +27 -0
  59. package/dist/settings-templates/frvp-fields.js +108 -0
  60. package/dist/settings-templates/index.d.ts +119 -0
  61. package/dist/settings-templates/index.js +442 -0
  62. package/dist/settings-templates/indicator-fields.d.ts +56 -0
  63. package/dist/settings-templates/indicator-fields.js +793 -0
  64. package/dist/settings-templates/tool-rules.d.ts +59 -0
  65. package/dist/settings-templates/tool-rules.js +49 -0
  66. package/dist/settings-templates/tool-tables.generated.d.ts +2 -0
  67. package/dist/settings-templates/tool-tables.generated.js +1668 -0
  68. package/dist/utility/blk-market.util.d.ts +5 -0
  69. package/dist/utility/blk-market.util.js +12 -0
  70. package/dist/utility/chart/chart-load-phase.util.d.ts +32 -0
  71. package/dist/utility/chart/chart-load-phase.util.js +78 -0
  72. package/dist/utility/chart/cme-cache-context.util.d.ts +108 -0
  73. package/dist/utility/chart/cme-cache-context.util.js +166 -0
  74. package/dist/utility/chart/cme-session-bucket.util.d.ts +82 -0
  75. package/dist/utility/chart/cme-session-bucket.util.js +343 -0
  76. package/dist/utility/chart/cme-trade-calendar.util.d.ts +26 -0
  77. package/dist/utility/chart/cme-trade-calendar.util.js +147 -0
  78. package/dist/utility/chart/continuous-contracts.util.d.ts +138 -0
  79. package/dist/utility/chart/continuous-contracts.util.js +374 -0
  80. package/dist/utility/chart/feed-interval.util.d.ts +119 -0
  81. package/dist/utility/chart/feed-interval.util.js +321 -0
  82. package/dist/utility/chart/fetch-dedupe-policy.util.d.ts +110 -0
  83. package/dist/utility/chart/fetch-dedupe-policy.util.js +407 -0
  84. package/dist/utility/chart/footprint-band.util.d.ts +76 -0
  85. package/dist/utility/chart/footprint-band.util.js +205 -0
  86. package/dist/utility/chart/footprint-cell-identity.util.d.ts +82 -0
  87. package/dist/utility/chart/footprint-cell-identity.util.js +346 -0
  88. package/dist/utility/chart/formula-calendar.util.d.ts +27 -0
  89. package/dist/utility/chart/formula-calendar.util.js +59 -0
  90. package/dist/utility/chart/history-wall.util.d.ts +67 -0
  91. package/dist/utility/chart/history-wall.util.js +87 -0
  92. package/dist/utility/chart/index-mode.util.d.ts +66 -0
  93. package/dist/utility/chart/index-mode.util.js +360 -0
  94. package/dist/utility/chart/indicator-coverage-planner.util.d.ts +217 -0
  95. package/dist/utility/chart/indicator-coverage-planner.util.js +443 -0
  96. package/dist/utility/chart/indicator-coverage-state.util.d.ts +33 -0
  97. package/dist/utility/chart/indicator-coverage-state.util.js +110 -0
  98. package/dist/utility/chart/indicator-gap-detector.util.d.ts +127 -0
  99. package/dist/utility/chart/indicator-gap-detector.util.js +260 -0
  100. package/dist/utility/chart/indicator-gap-repair.util.d.ts +88 -0
  101. package/dist/utility/chart/indicator-gap-repair.util.js +177 -0
  102. package/dist/utility/chart/indicator-inflight-registry.util.d.ts +26 -0
  103. package/dist/utility/chart/indicator-inflight-registry.util.js +254 -0
  104. package/dist/utility/chart/interval-registry.util.d.ts +23 -0
  105. package/dist/utility/chart/interval-registry.util.js +83 -0
  106. package/dist/utility/chart/kscript-main-grid-stages.util.d.ts +21 -0
  107. package/dist/utility/chart/kscript-main-grid-stages.util.js +332 -0
  108. package/dist/utility/chart/legacy-exchange.leaf.d.ts +11 -0
  109. package/dist/utility/chart/legacy-exchange.leaf.js +43 -0
  110. package/dist/utility/chart/live-bucket.util.d.ts +66 -0
  111. package/dist/utility/chart/live-bucket.util.js +165 -0
  112. package/dist/utility/chart/market-session-schedule.util.d.ts +91 -0
  113. package/dist/utility/chart/market-session-schedule.util.js +337 -0
  114. package/dist/utility/chart/marketKind.util.d.ts +181 -0
  115. package/dist/utility/chart/marketKind.util.js +371 -0
  116. package/dist/utility/chart/om-panel.util.js +6 -0
  117. package/dist/utility/chart/om-widget.util.d.ts +4 -0
  118. package/dist/utility/chart/opra-read-access.leaf.d.ts +26 -0
  119. package/dist/utility/chart/opra-read-access.leaf.js +25 -0
  120. package/dist/utility/chart/prediction-identity.util.d.ts +159 -0
  121. package/dist/utility/chart/prediction-identity.util.js +236 -0
  122. package/dist/utility/chart/rth-session.util.d.ts +352 -0
  123. package/dist/utility/chart/rth-session.util.js +926 -0
  124. package/dist/utility/chart/titan-constants.pin.d.ts +43 -0
  125. package/dist/utility/chart/titan-constants.pin.js +50 -0
  126. package/dist/utility/chart/us-equities-session.util.d.ts +127 -0
  127. package/dist/utility/chart/us-equities-session.util.js +251 -0
  128. package/dist/utility/chart/wrun-bar-session-facts.util.d.ts +100 -0
  129. package/dist/utility/chart/wrun-bar-session-facts.util.js +354 -0
  130. package/dist/utility/chart/wrun-run-result.util.js +10 -0
  131. package/dist/utility/chart/wrun-wire-ref.util.d.ts +23 -0
  132. package/dist/utility/chart/wrun-wire-ref.util.js +16 -0
  133. package/dist/utility/common/safe-math-eval.d.ts +18 -0
  134. package/dist/utility/common/safe-math-eval.js +160 -0
  135. package/dist/utility/common/time.util.d.ts +134 -0
  136. package/dist/utility/common/time.util.js +428 -0
  137. package/dist/utility/common/transformations.util.d.ts +126 -0
  138. package/dist/utility/common/transformations.util.js +711 -0
  139. package/dist/utility/common/visible-timeout.util.d.ts +17 -0
  140. package/dist/utility/common/visible-timeout.util.js +75 -0
  141. package/dist/utility/exchange-normalization.util.d.ts +8 -0
  142. package/dist/utility/exchange-normalization.util.js +32 -0
  143. package/dist/utility/intl-locale.util.d.ts +2 -0
  144. package/dist/utility/intl-locale.util.js +28 -0
  145. package/dist/utility/number-format.util.d.ts +14 -1
  146. package/dist/utility/number-format.util.js +50 -19
  147. package/dist/utility/options/option-symbol.util.d.ts +28 -0
  148. package/dist/utility/options/option-symbol.util.js +176 -0
  149. package/dist/utility/options/option-trade-units.util.d.ts +190 -0
  150. package/dist/utility/options/option-trade-units.util.js +283 -0
  151. package/dist/utility/options/option-venue.util.d.ts +75 -0
  152. package/dist/utility/options/option-venue.util.js +85 -0
  153. package/dist/utility/pool-symbol.leaf.d.ts +34 -0
  154. package/dist/utility/pool-symbol.leaf.js +95 -0
  155. package/dist/utility/scriptEditor/wrun-runtime-diagnostics.leaf.d.ts +109 -0
  156. package/dist/utility/scriptEditor/wrun-runtime-diagnostics.leaf.js +302 -0
  157. package/dist/utility/symbol-selection/contract-expiry.util.d.ts +39 -0
  158. package/dist/utility/symbol-selection/contract-expiry.util.js +111 -0
  159. package/dist/utility/v2/gate-plane.util.d.ts +58 -0
  160. package/dist/utility/v2/gate-plane.util.js +99 -0
  161. package/dist/utility/v2/gate-session-latch.util.d.ts +22 -0
  162. package/dist/utility/v2/gate-session-latch.util.js +34 -0
  163. package/dist/utility/watchlist/import/tradingview-symbols.leaf.d.ts +76 -0
  164. package/dist/utility/watchlist/import/tradingview-symbols.leaf.js +221 -0
  165. package/dist/utility/wrun/sources/host-grid-landing.d.ts +15 -0
  166. package/dist/utility/wrun/sources/host-grid-landing.js +26 -0
  167. package/dist/utility/wrun/sources/lanes/bitfinex_funding.d.ts +27 -0
  168. package/dist/utility/wrun/sources/lanes/bitfinex_funding.js +85 -0
  169. package/dist/utility/wrun/sources/lanes/economic.d.ts +27 -0
  170. package/dist/utility/wrun/sources/lanes/economic.js +79 -0
  171. package/dist/utility/wrun/sources/lanes/etf_holdings.d.ts +35 -0
  172. package/dist/utility/wrun/sources/lanes/etf_holdings.js +165 -0
  173. package/dist/utility/wrun/sources/lanes/etf_premium.d.ts +19 -0
  174. package/dist/utility/wrun/sources/lanes/etf_premium.js +114 -0
  175. package/dist/utility/wrun/sources/lanes/ethena_positions.d.ts +30 -0
  176. package/dist/utility/wrun/sources/lanes/ethena_positions.js +51 -0
  177. package/dist/utility/wrun/sources/lanes/index.d.ts +2 -0
  178. package/dist/utility/wrun/sources/lanes/index.js +32 -0
  179. package/dist/utility/wrun/sources/lanes/long_short_ratio.d.ts +17 -0
  180. package/dist/utility/wrun/sources/lanes/long_short_ratio.js +47 -0
  181. package/dist/utility/wrun/sources/lanes/option_daily.d.ts +30 -0
  182. package/dist/utility/wrun/sources/lanes/option_daily.js +53 -0
  183. package/dist/utility/wrun/sources/lanes/option_stats_10m.d.ts +23 -0
  184. package/dist/utility/wrun/sources/lanes/option_stats_10m.js +20 -0
  185. package/dist/utility/wrun/sources/lanes/options_flow.d.ts +50 -0
  186. package/dist/utility/wrun/sources/lanes/options_flow.js +155 -0
  187. package/dist/utility/wrun/sources/lanes/options_oi.d.ts +29 -0
  188. package/dist/utility/wrun/sources/lanes/options_oi.js +59 -0
  189. package/dist/utility/wrun/sources/lanes/options_volume.d.ts +38 -0
  190. package/dist/utility/wrun/sources/lanes/options_volume.js +63 -0
  191. package/dist/utility/wrun/sources/lanes/series.d.ts +67 -0
  192. package/dist/utility/wrun/sources/lanes/series.js +321 -0
  193. package/dist/utility/wrun/sources/lanes/token_supply.d.ts +30 -0
  194. package/dist/utility/wrun/sources/lanes/token_supply.js +145 -0
  195. package/dist/utility/wrun/sources/lanes/treasury_balance.d.ts +25 -0
  196. package/dist/utility/wrun/sources/lanes/treasury_balance.js +47 -0
  197. package/dist/utility/wrun/sources/lanes/volatility_index.d.ts +21 -0
  198. package/dist/utility/wrun/sources/lanes/volatility_index.js +11 -0
  199. package/dist/utility/wrun/sources/opra-option-lanes.util.d.ts +196 -0
  200. package/dist/utility/wrun/sources/opra-option-lanes.util.js +446 -0
  201. package/dist/utility/wrun/sources/registry.d.ts +21 -0
  202. package/dist/utility/wrun/sources/registry.js +207 -0
  203. package/dist/utility/wrun/sources/row-lane-registry.d.ts +28 -0
  204. package/dist/utility/wrun/sources/row-lane-registry.js +230 -0
  205. package/dist/utility/wrun/sources/row-lanes/index.d.ts +2 -0
  206. package/dist/utility/wrun/sources/row-lanes/index.js +12 -0
  207. package/dist/utility/wrun/sources/row-lanes/option_contract_flow.d.ts +2 -0
  208. package/dist/utility/wrun/sources/row-lanes/option_contract_flow.js +38 -0
  209. package/dist/utility/wrun/sources/row-lanes/option_contract_state.d.ts +6 -0
  210. package/dist/utility/wrun/sources/row-lanes/option_contract_state.js +70 -0
  211. package/dist/utility/wrun/sources/row-lanes/option_prints.d.ts +4 -0
  212. package/dist/utility/wrun/sources/row-lanes/option_prints.js +191 -0
  213. package/dist/utility/wrun/sources/row-lanes/option_strikes.d.ts +13 -0
  214. package/dist/utility/wrun/sources/row-lanes/option_strikes.js +137 -0
  215. package/dist/utility/wrun/sources/row-lanes/option_surface.d.ts +38 -0
  216. package/dist/utility/wrun/sources/row-lanes/option_surface.js +150 -0
  217. package/dist/utility/wrun/sources/wrun-poll-lane.types.d.ts +275 -0
  218. package/dist/utility/wrun/sources/wrun-poll-lane.types.js +26 -0
  219. package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +224 -0
  220. package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +394 -0
  221. package/dist/utility/wrun/sources/wrun-row-lane.types.d.ts +283 -0
  222. package/dist/utility/wrun/sources/wrun-row-lane.types.js +16 -0
  223. package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +205 -0
  224. package/dist/utility/wrun/sources/wrun-row-lanes.util.js +469 -0
  225. package/dist/utility/wrun/wrun-browser-sources.leaf.d.ts +28 -0
  226. package/dist/utility/wrun/wrun-browser-sources.leaf.js +66 -0
  227. package/dist/utility/wrun/wrun-cloud-record.util.d.ts +65 -0
  228. package/dist/utility/wrun/wrun-cloud-record.util.js +121 -0
  229. package/dist/utility/wrun/wrun-color-settings.util.js +1 -1
  230. package/dist/utility/wrun/wrun-daily-lane.util.d.ts +95 -0
  231. package/dist/utility/wrun/wrun-daily-lane.util.js +297 -0
  232. package/dist/utility/wrun/wrun-deadline.util.d.ts +52 -0
  233. package/dist/utility/wrun/wrun-deadline.util.js +82 -0
  234. package/dist/utility/wrun/wrun-etf-flow-lane.util.d.ts +94 -0
  235. package/dist/utility/wrun/wrun-etf-flow-lane.util.js +224 -0
  236. package/dist/utility/wrun/wrun-etf-funds.util.d.ts +82 -0
  237. package/dist/utility/wrun/wrun-etf-funds.util.js +242 -0
  238. package/dist/utility/wrun/wrun-failure-cause.d.ts +39 -0
  239. package/dist/utility/wrun/wrun-failure-cause.js +94 -0
  240. package/dist/utility/wrun/wrun-frames.d.ts +28 -3
  241. package/dist/utility/wrun/wrun-frames.js +132 -52
  242. package/dist/utility/wrun/wrun-hosted-wire-caps.d.ts +167 -4
  243. package/dist/utility/wrun/wrun-hosted-wire-caps.js +47 -2
  244. package/dist/utility/wrun/wrun-hosted-wire.util.d.ts +5 -2
  245. package/dist/utility/wrun/wrun-hosted-wire.util.js +4 -2
  246. package/dist/utility/wrun/wrun-lane-refusal.leaf.d.ts +22 -0
  247. package/dist/utility/wrun/wrun-lane-refusal.leaf.js +32 -0
  248. package/dist/utility/wrun/wrun-lane-warmup.util.d.ts +18 -0
  249. package/dist/utility/wrun/wrun-lane-warmup.util.js +112 -0
  250. package/dist/utility/wrun/wrun-leg-close.util.d.ts +57 -0
  251. package/dist/utility/wrun/wrun-leg-close.util.js +187 -0
  252. package/dist/utility/wrun/wrun-leg-fetch.util.d.ts +144 -0
  253. package/dist/utility/wrun/wrun-leg-fetch.util.js +212 -0
  254. package/dist/utility/wrun/wrun-leg-stream-classes.d.ts +73 -0
  255. package/dist/utility/wrun/wrun-leg-stream-classes.js +86 -0
  256. package/dist/utility/wrun/wrun-levels-child.util.d.ts +101 -6
  257. package/dist/utility/wrun/wrun-levels-child.util.js +335 -157
  258. package/dist/utility/wrun/wrun-memory-clamp.util.d.ts +33 -0
  259. package/dist/utility/wrun/wrun-memory-clamp.util.js +146 -0
  260. package/dist/utility/wrun/wrun-odds-template-market.util.d.ts +51 -0
  261. package/dist/utility/wrun/wrun-odds-template-market.util.js +251 -0
  262. package/dist/utility/wrun/wrun-opra-flow.leaf.d.ts +65 -0
  263. package/dist/utility/wrun/wrun-opra-flow.leaf.js +94 -0
  264. package/dist/utility/wrun/wrun-opra-lane.util.d.ts +47 -0
  265. package/dist/utility/wrun/wrun-opra-lane.util.js +58 -0
  266. package/dist/utility/wrun/wrun-opra-stats.leaf.d.ts +30 -0
  267. package/dist/utility/wrun/wrun-opra-stats.leaf.js +96 -0
  268. package/dist/utility/wrun/wrun-opra-underlying.util.d.ts +12 -0
  269. package/dist/utility/wrun/wrun-opra-underlying.util.js +1 -0
  270. package/dist/utility/wrun/wrun-option-contract-flow.util.d.ts +142 -0
  271. package/dist/utility/wrun/wrun-option-contract-flow.util.js +451 -0
  272. package/dist/utility/wrun/wrun-option-knobs.util.d.ts +43 -0
  273. package/dist/utility/wrun/wrun-option-knobs.util.js +81 -0
  274. package/dist/utility/wrun/wrun-option-prints.util.d.ts +144 -0
  275. package/dist/utility/wrun/wrun-option-prints.util.js +356 -0
  276. package/dist/utility/wrun/wrun-option-summary-lane.util.d.ts +102 -0
  277. package/dist/utility/wrun/wrun-option-summary-lane.util.js +143 -0
  278. package/dist/utility/wrun/wrun-options-chain.util.d.ts +308 -0
  279. package/dist/utility/wrun/wrun-options-chain.util.js +502 -0
  280. package/dist/utility/wrun/wrun-overlay-identity.util.d.ts +9 -4
  281. package/dist/utility/wrun/wrun-overlay-identity.util.js +16 -6
  282. package/dist/utility/wrun/wrun-pack.util.d.ts +6 -2
  283. package/dist/utility/wrun/wrun-pack.util.js +13 -3
  284. package/dist/utility/wrun/wrun-param-map.util.d.ts +298 -0
  285. package/dist/utility/wrun/wrun-param-map.util.js +581 -0
  286. package/dist/utility/wrun/wrun-param-values.util.d.ts +8 -0
  287. package/dist/utility/wrun/wrun-param-values.util.js +8 -0
  288. package/dist/utility/wrun/wrun-pin-spelling.util.d.ts +149 -0
  289. package/dist/utility/wrun/wrun-pin-spelling.util.js +523 -0
  290. package/dist/utility/wrun/wrun-pin-venues.util.d.ts +116 -0
  291. package/dist/utility/wrun/wrun-pin-venues.util.js +320 -0
  292. package/dist/utility/wrun/wrun-pinned-interval.util.d.ts +20 -0
  293. package/dist/utility/wrun/wrun-pinned-interval.util.js +47 -0
  294. package/dist/utility/wrun/wrun-present-bits.util.d.ts +37 -0
  295. package/dist/utility/wrun/wrun-present-bits.util.js +73 -0
  296. package/dist/utility/wrun/wrun-protocol-pending.util.d.ts +33 -0
  297. package/dist/utility/wrun/wrun-protocol-pending.util.js +57 -0
  298. package/dist/utility/wrun/wrun-refusal.util.d.ts +95 -7
  299. package/dist/utility/wrun/wrun-refusal.util.js +314 -18
  300. package/dist/utility/wrun/wrun-registry-errors.util.d.ts +1 -14
  301. package/dist/utility/wrun/wrun-registry-errors.util.js +0 -16
  302. package/dist/utility/wrun/wrun-render-select.util.js +1 -0
  303. package/dist/utility/wrun/wrun-row-market.util.d.ts +29 -0
  304. package/dist/utility/wrun/wrun-row-market.util.js +92 -0
  305. package/dist/utility/wrun/wrun-row-source.d.ts +158 -0
  306. package/dist/utility/wrun/wrun-row-source.js +75 -0
  307. package/dist/utility/wrun/wrun-run-health.util.d.ts +155 -0
  308. package/dist/utility/wrun/wrun-run-health.util.js +273 -0
  309. package/dist/utility/wrun/wrun-socket-row-source.d.ts +439 -0
  310. package/dist/utility/wrun/wrun-socket-row-source.js +1689 -0
  311. package/dist/utility/wrun/wrun-socket-session-losses.util.d.ts +18 -0
  312. package/dist/utility/wrun/wrun-socket-session-losses.util.js +25 -0
  313. package/dist/utility/wrun/wrun-source-rows.util.d.ts +911 -0
  314. package/dist/utility/wrun/wrun-source-rows.util.js +2597 -0
  315. package/dist/utility/wrun/wrun-symbol-code.util.d.ts +32 -0
  316. package/dist/utility/wrun/wrun-symbol-code.util.js +56 -0
  317. package/dist/utility/wrun/wrun-tape-source.util.d.ts +82 -0
  318. package/dist/utility/wrun/wrun-tape-source.util.js +151 -0
  319. package/dist/utility/wrun/wrun-tier-grid.util.d.ts +137 -0
  320. package/dist/utility/wrun/wrun-tier-grid.util.js +279 -0
  321. package/dist/utility/wrun/wrun-trades-lane.util.d.ts +52 -0
  322. package/dist/utility/wrun/wrun-trades-lane.util.js +58 -0
  323. package/dist/utility/wrun/wrun-volume-profile-lane.util.d.ts +41 -0
  324. package/dist/utility/wrun/wrun-volume-profile-lane.util.js +66 -0
  325. package/dist/utility/wrun-display-name.util.d.ts +33 -0
  326. package/dist/utility/wrun-display-name.util.js +64 -0
  327. package/dist/workers/constants/kscript-transport-codes.d.ts +15 -0
  328. package/dist/workers/constants/kscript-transport-codes.js +15 -0
  329. package/dist/workers/constants/socket-slots.d.ts +574 -0
  330. package/dist/workers/constants/socket-slots.js +539 -0
  331. package/dist/workers/utils/number.worker.util.d.ts +5 -0
  332. package/dist/workers/utils/number.worker.util.js +10 -0
  333. package/dist/workers/utils/time.worker.util.d.ts +12 -0
  334. package/dist/workers/utils/time.worker.util.js +24 -0
  335. package/dist/workers/utils/volume-profile.worker.util.d.ts +200 -0
  336. package/dist/workers/utils/volume-profile.worker.util.js +631 -0
  337. package/package.json +10 -4
@@ -0,0 +1,394 @@
1
+ import { wrunOptionsStopSeed } from '../wrun-refusal.util.js';
2
+ import { wrunPollLaneGlobalClasses, wrunPollLanes, wrunPollLanesOfClass } from './registry.js';
3
+ import { refuseWrunPollInput, WRUN_POLL_LANE_ID_PREFIX, } from './wrun-poll-lane.types.js';
4
+ import { WRUN_DAILY_LANE_INTERVAL_KEY, wrunDailyLaneFetchFrom, wrunDailyLaneFetchTo, wrunDailyLaneReconcileFrom, wrunDailyLaneReconcileTo, } from '../wrun-daily-lane.util.js';
5
+ import { assertWrunOpraLaneReadable } from '../wrun-opra-lane.util.js';
6
+ import { wrunHostGridAsks, wrunHostGridFetchTo, wrunLandScalarRowsOnHostBars } from '../wrun-tier-grid.util.js';
7
+ /**
8
+ * The static plan: every input whose class the registry serves, in declaration order, with the
9
+ * lane serving its field and the field's column. Refused by name: a celled input (poll lanes
10
+ * are scalar) and a field no lane of the class serves (the message lists the served ones).
11
+ * Empty when the sheet reads no registry class.
12
+ */
13
+ export function planWrunPollLaneInputs(metadata) {
14
+ const planned = [];
15
+ if (wrunPollLanes().length === 0)
16
+ return planned;
17
+ const inputs = [...metadata.inputs].sort((a, b) => a.index - b.index);
18
+ for (const input of inputs) {
19
+ const source = metadata.inputSources[input.name];
20
+ if (!source)
21
+ continue;
22
+ const lanes = wrunPollLanesOfClass(source.source);
23
+ if (lanes.length === 0)
24
+ continue;
25
+ const label = `Input '${input.name}' (${source.source})`;
26
+ if (input.cellType === 'array') {
27
+ throw new Error(`${label} is celled: ${source.source} serves one scalar per bar, a scalar input`);
28
+ }
29
+ const field = source.field ?? '';
30
+ const lane = lanes.find((candidate) => Object.prototype.hasOwnProperty.call(candidate.fields, field));
31
+ if (lane === undefined) {
32
+ const served = lanes.flatMap((candidate) => Object.keys(candidate.fields));
33
+ throw new Error(`${label}: unknown ${source.source} field '${String(source.field)}' (the served fields: ${served.join(', ')})`);
34
+ }
35
+ planned.push({ inputIndex: input.index, inputName: input.name, source, lane, column: lane.fields[field] });
36
+ }
37
+ return planned;
38
+ }
39
+ /** A value's canonical text: object keys sorted at every depth, `undefined` members dropped (the instance key's
40
+ * suffix, here and for the row lanes). */
41
+ export function stableJson(value) {
42
+ if (Array.isArray(value))
43
+ return `[${value.map((item) => stableJson(item)).join(',')}]`;
44
+ if (value !== null && typeof value === 'object') {
45
+ const record = value;
46
+ const members = Object.keys(record)
47
+ .filter((key) => record[key] !== undefined)
48
+ .sort()
49
+ .map((key) => `${JSON.stringify(key)}:${stableJson(record[key])}`);
50
+ return `{${members.join(',')}}`;
51
+ }
52
+ return JSON.stringify(value) ?? 'null';
53
+ }
54
+ /** The id of the lane instance `extras` names: `poll:<laneKey>` when the ask carries no extras,
55
+ * else the extras' canonical text appended, so equal asks are ONE instance whatever order
56
+ * their fields were written in and different asks never collide. */
57
+ export function wrunPollLaneInstanceKey(laneKey, extras) {
58
+ const named = Object.keys(extras).some((key) => extras[key] !== undefined);
59
+ return `${WRUN_POLL_LANE_ID_PREFIX}${laneKey}${named ? stableJson(extras) : ''}`;
60
+ }
61
+ /** Why a lane reading the chart's market is not served on an index-mode chart, as its refusal
62
+ * says it: such a chart serves candles, time and the global series (named by class). */
63
+ export function wrunPollLaneIndexModeReason() {
64
+ const served = wrunPollLaneGlobalClasses();
65
+ const native = wrunPollLaneNativeRowsClasses();
66
+ const own = native.length > 0 ? `, the series of its own market read from another plane (${native.join(', ')})` : '';
67
+ const serves = served.length > 0
68
+ ? `candles, time${own} and the series that name their own subject (${served.join(', ')})`
69
+ : `candles${own === '' ? ' and time' : `, time${own}`}`;
70
+ return `is not served on this chart: it reads the chart's own market, and a stock, forex, commodity or DEX chart serves ${serves}`;
71
+ }
72
+ /** The classes of the per-bar native-rows lanes (`nativeRows`), served on index-mode charts too, once each,
73
+ * in file order. */
74
+ function wrunPollLaneNativeRowsClasses() {
75
+ const classes = [];
76
+ for (const lane of wrunPollLanes()) {
77
+ if (lane.nativeRows === true && !classes.includes(lane.sourceClass))
78
+ classes.push(lane.sourceClass);
79
+ }
80
+ return classes;
81
+ }
82
+ /** Whether a lane is served on an index-mode chart: a `global` one (its own subject) or a `nativeRows` one
83
+ * (the chart's own market read from another plane, on the native-rows path). */
84
+ function wrunPollLaneServedOnIndexMode(lane) {
85
+ return lane.global === true || lane.nativeRows === true;
86
+ }
87
+ /** Why an `opra` lane is not served on a chart whose options ride no OPRA plane, as its refusal says it. */
88
+ const WRUN_POLL_OPRA_UNADMITTED_REASON = "is not served on this chart: it reads US options data, which a US stock or ETF chart (its underlying's options) and an OPRA option contract chart serve";
89
+ /** The technical words of an OPRA lane a known stop keeps off the chart (Copy details), by the stop's reason. */
90
+ export function wrunOpraPlaneStopDetail(stop) {
91
+ return stop === 'flag-off'
92
+ ? 'is not served for this account yet: the opra flag is off, so no US options data is read on any chart'
93
+ : 'is not served on this chart: an index chart does not ride the OPRA plane yet, so no US options data is read for it';
94
+ }
95
+ function wrunPollLanePlanResult(lanes, missingFeeds) {
96
+ const result = [...lanes];
97
+ Object.defineProperty(result, 'lanes', { value: lanes, enumerable: false });
98
+ Object.defineProperty(result, 'missingFeeds', { value: missingFeeds, enumerable: false });
99
+ return result;
100
+ }
101
+ /**
102
+ * The run's plan against the chart, before any fetch: every registry input's `plan()` in
103
+ * declaration order (the first refusal by name wins, like every other pre-fetch refusal),
104
+ * grouped into lane instances by lane and payload extras. Empty when the sheet reads no
105
+ * registry class.
106
+ *
107
+ * On an index-mode chart (US stocks, forex, commodities, DEX: `isIndexModeExchange` answers for
108
+ * the chart's exchange) the chart's fetch answers nothing for a source other than candles asked
109
+ * on the chart's own exchange, so a lane that reads the chart's market is not served there (the
110
+ * capability evidence, never an empty window):
111
+ * - an input of such a lane that declares `missing: "nan"` or `"zero"` is dropped from planning
112
+ * (its lane's `plan` never runs, no fetch) and named in `missingFeeds` under its lane key: the
113
+ * row builder hands it an empty lane, so it reads its fill on every bar and the run draws;
114
+ * - any other input of such a lane (the default `carry` policy has nothing to carry) refuses by
115
+ * name (`wrunPollLaneIndexModeReason`), seeded `feed-missing` with its lane key.
116
+ * Both say "it comes from crypto markets" only when the chart is provably no crypto venue
117
+ * (`isCryptoVenueExchange` answers false; a DEX pool is index-mode AND a crypto venue), the
118
+ * neutral market words otherwise.
119
+ *
120
+ * A `global` lane (a series naming its own subject: a publisher's series, a token's supply, a
121
+ * venue's asset) is planned there like anywhere; its asks ride the fetch's native-rows path
122
+ * (`wrunPollLaneFetchOptions`), so the asked window stands and the control's own rows return
123
+ * instead of the chart's span re-stamped onto its sparse bars, and its daily landing finds the
124
+ * day's first bar on a session grid (wrun-daily-lane.util). The chart's index-mode verdict
125
+ * reaches each lane's `plan` as `ctx.indexMode`, the venue verdict as `ctx.cryptoVenue`.
126
+ *
127
+ * A `nativeRows` lane (a per-bar series of the chart's own market read from another plane: a stock
128
+ * chart's US options) is planned there too: its asks ride the native-rows path and land on the host
129
+ * bar grid (`barGrid`).
130
+ *
131
+ * An `opra` lane (US options data) is refused by name before its lane's `plan` runs for a run that may
132
+ * not read the OPRA plane (`mayReadOpra` over `run`: an official package always, a draft or community
133
+ * package only under the `opra-user-scripts` flag; absent reads closed): `opra-official-only:<class>`.
134
+ * It is served only where the chart's options ride the plane (`run.isOpraPlaneExchange`): on any other chart
135
+ * an input of it that declared a missing fill is dropped like an index-mode one, any other refuses by name.
136
+ * A chart whose options list on OPRA but ride no plane for a known reason (`run.opraPlaneStop`: the `opra`
137
+ * flag dark, `flag-off`; an index chart the router sends no OPRA read for, `chart-kind`) says that reason in the
138
+ * note and in the refusal (`options-stopped`), never "this market has no such feed".
139
+ * The run's facts reach an `opra` lane's `plan` as `ctx.official` and `ctx.opraUserScripts`.
140
+ *
141
+ * An input the market leaves undemanded (its `needed_by` leaves the market out, wrunSheetWithLaneDemand) is planned
142
+ * nowhere, before all of the above: no wall, no admission, no `plan`, no fetch, no note; the row builder reads its
143
+ * fill on every bar.
144
+ *
145
+ * The predicates are injected (the run pass hands the chart's own `checkIsIndexMode` and its
146
+ * crypto-venue rule), so this module, which the row builder imports, stays off those modules'
147
+ * import graphs; without one no chart reads as index-mode, and without the other the venue is
148
+ * unknown (the neutral words).
149
+ */
150
+ export async function planWrunPollLanes(metadata, chart, isIndexModeExchange = () => false, isCryptoVenueExchange, run) {
151
+ const instances = new Map();
152
+ const missing = new Map();
153
+ const indexModeChart = isIndexModeExchange(chart.exchange);
154
+ const cryptoVenue = isCryptoVenueExchange?.(chart.exchange);
155
+ for (const planned of planWrunPollLaneInputs(metadata)) {
156
+ if (planned.source.undemanded === true)
157
+ continue;
158
+ const ctx = {
159
+ ...chart,
160
+ inputName: planned.inputName,
161
+ sourceClass: planned.lane.sourceClass,
162
+ indexMode: indexModeChart,
163
+ cryptoVenue,
164
+ // The run's OPRA facts reach the plan of a lane that reads OPRA (`opra`, the lanes the decision concerns);
165
+ // every other lane's context is as it always was. Absent reads closed.
166
+ ...(run !== undefined && planned.lane.opra === true
167
+ ? { official: run.official === true, opraUserScripts: run.opraUserScripts === true }
168
+ : {}),
169
+ };
170
+ // The OPRA wall first: a run the plane is closed to reads no US options, on any chart.
171
+ if (planned.lane.opra === true)
172
+ assertWrunOpraLaneReadable(run, ctx);
173
+ // An OPRA lane is served where the chart's options ride the plane; any other lane reading the chart's market
174
+ // is not served on an index-mode chart.
175
+ const offPlane = planned.lane.opra === true && run?.isOpraPlaneExchange !== undefined && !run.isOpraPlaneExchange(chart.exchange);
176
+ if (offPlane || (indexModeChart && !wrunPollLaneServedOnIndexMode(planned.lane))) {
177
+ // A chart whose options DO list on OPRA is off the plane for a known reason (the flag, the router): the note
178
+ // and the refusal say that reason, never "this market has no such feed".
179
+ const stop = offPlane ? run?.opraPlaneStop?.(chart.exchange) : undefined;
180
+ const reason = stop !== undefined
181
+ ? wrunOpraPlaneStopDetail(stop)
182
+ : offPlane
183
+ ? WRUN_POLL_OPRA_UNADMITTED_REASON
184
+ : wrunPollLaneIndexModeReason();
185
+ const fill = planned.source.missing;
186
+ if (fill === 'nan' || fill === 'zero') {
187
+ const feed = planned.lane.laneKey;
188
+ const details = `Input '${ctx.inputName}' (${ctx.sourceClass}) ${reason}; it declares missing: "${fill}", so it reads that fill on every bar`;
189
+ const entry = missing.get(feed);
190
+ if (entry === undefined) {
191
+ missing.set(feed, {
192
+ inputNames: [planned.inputName],
193
+ feed,
194
+ variant: cryptoVenue === false ? 'crypto-only' : 'market',
195
+ details,
196
+ ...(stop !== undefined ? { stop } : {}),
197
+ });
198
+ }
199
+ else {
200
+ entry.inputNames.push(planned.inputName);
201
+ entry.details = `${entry.details}\n${details}`;
202
+ }
203
+ continue;
204
+ }
205
+ refuseWrunPollInput(ctx, reason, stop !== undefined
206
+ ? wrunOptionsStopSeed(stop, { severity: 'paused' })
207
+ : {
208
+ cls: 'feed-missing',
209
+ variant: cryptoVenue === false ? 'crypto-only' : 'market-paused',
210
+ params: { feed: planned.lane.laneKey },
211
+ severity: 'paused',
212
+ });
213
+ }
214
+ const answered = await planned.lane.plan(planned.source, ctx);
215
+ const extras = {};
216
+ for (const [key, value] of Object.entries(answered ?? {}))
217
+ if (value !== undefined)
218
+ extras[key] = value;
219
+ const key = wrunPollLaneInstanceKey(planned.lane.laneKey, extras);
220
+ let instance = instances.get(key);
221
+ if (instance === undefined) {
222
+ instance = {
223
+ key,
224
+ sourceClass: planned.lane.sourceClass,
225
+ laneKey: planned.lane.laneKey,
226
+ extras,
227
+ inputIndexes: [],
228
+ };
229
+ instances.set(key, instance);
230
+ }
231
+ instance.inputIndexes.push(planned.inputIndex);
232
+ }
233
+ return wrunPollLanePlanResult([...instances.values()], [...missing.values()]);
234
+ }
235
+ /** The lane instances of `planWrunPollLanes` alone (the array every caller that plans no notes
236
+ * reads): the same plan, the same refusals by name, an input that declared a missing fill on an
237
+ * index-mode chart dropped. */
238
+ export async function planWrunPollLaneInstances(metadata, chart, isIndexModeExchange, isCryptoVenueExchange, run) {
239
+ return (await planWrunPollLanes(metadata, chart, isIndexModeExchange, isCryptoVenueExchange, run)).lanes;
240
+ }
241
+ /**
242
+ * Whether a lane must answer rows for the package: true when any input reading it (`reads`)
243
+ * rides the default carry policy (an absent series has nothing to carry, so an empty lane
244
+ * refuses loud); when every such input declares `missing: "nan"` or `"zero"` the lane stays
245
+ * quiet and the inputs read that fill. The funding lane's rule, for any lane.
246
+ */
247
+ export function wrunLaneRowsRequired(metadata, reads) {
248
+ return metadata.inputs.some((input) => {
249
+ const source = metadata.inputSources[input.name];
250
+ if (!source || !reads(input, source))
251
+ return false;
252
+ return source.missing === undefined || source.missing === 'carry';
253
+ });
254
+ }
255
+ /** `wrunLaneRowsRequired` for one registry lane instance (the inputs it serves). */
256
+ export function wrunPollLaneRequired(metadata, instance) {
257
+ return wrunLaneRowsRequired(metadata, (input) => instance.inputIndexes.includes(input.index));
258
+ }
259
+ /**
260
+ * The first input of a lane instance, in declaration order, that rides the default carry policy
261
+ * and whose column holds NO finite value anywhere in the lane's answer (`rows`: the full answer,
262
+ * a daily lane's lookback included, so a series printed once before the chart window passes);
263
+ * undefined when every such input has one. A `null` cell is no value, never 0 (the controls lay
264
+ * `null` where the gateway has none), and a 0 is a value.
265
+ *
266
+ * The empty-answer rule (`wrunPollLaneRequired`) counts rows; this is the same rule per field. A
267
+ * lane can answer a row for every bar and no value for one field (Bitfinex publishes the margin
268
+ * rate for `fUSD` and `fETH`, not `fBTC`; a token's supply row leaves a field the gateway does
269
+ * not hold for it unset): under `carry` the input would read NaN on every bar with no message.
270
+ * An input declaring `missing: "nan"` or `"zero"` has said what an absent value reads as and
271
+ * stays quiet.
272
+ */
273
+ export function wrunPollLaneValuelessInput(metadata, instance, lane, rows) {
274
+ if (rows.length === 0)
275
+ return undefined;
276
+ const valued = new Map();
277
+ const columnHasValue = (column) => {
278
+ let has = valued.get(column);
279
+ if (has === undefined) {
280
+ has = rows.some((row) => {
281
+ const cell = row[column];
282
+ return cell !== null && cell !== undefined && Number.isFinite(Number(cell));
283
+ });
284
+ valued.set(column, has);
285
+ }
286
+ return has;
287
+ };
288
+ const inputs = [...metadata.inputs].sort((a, b) => a.index - b.index);
289
+ for (const input of inputs) {
290
+ if (!instance.inputIndexes.includes(input.index))
291
+ continue;
292
+ const source = metadata.inputSources[input.name];
293
+ if (!source || (source.missing !== undefined && source.missing !== 'carry'))
294
+ continue;
295
+ const field = source.field ?? '';
296
+ if (!Object.prototype.hasOwnProperty.call(lane.fields, field))
297
+ continue;
298
+ if (!columnHasValue(lane.fields[field]))
299
+ return { inputName: input.name, field };
300
+ }
301
+ return undefined;
302
+ }
303
+ /** The interval a lane's asks name (the fetch's `interval` option): its fixed one, `1d` for a
304
+ * daily join that names none, undefined for the chart's own. */
305
+ export function wrunPollLaneFetchInterval(lane) {
306
+ if (lane.interval !== undefined)
307
+ return lane.interval;
308
+ return lane.join === 'bar' ? undefined : WRUN_DAILY_LANE_INTERVAL_KEY;
309
+ }
310
+ /** The fetch options a lane's asks carry (the full run's and the reconcile's alike): its
311
+ * interval (`wrunPollLaneFetchInterval`) and, for a `global` or a `nativeRows` lane, the native-rows
312
+ * path (the asked window stands and the control's own rows return on an index-mode chart too).
313
+ * Undefined when the ask carries neither (the chart's own interval, the chart's own market). */
314
+ export function wrunPollLaneFetchOptions(lane) {
315
+ const interval = wrunPollLaneFetchInterval(lane);
316
+ const options = {};
317
+ if (interval !== undefined)
318
+ options.interval = interval;
319
+ if (wrunPollLaneServedOnIndexMode(lane))
320
+ options.nativeRows = true;
321
+ return Object.keys(options).length === 0 ? undefined : options;
322
+ }
323
+ /** Where the full run's ask opens for a chart window opening at `fromTs`: there for a `bar`
324
+ * join, at the first row's day (its `lookbackDays` earlier) for a daily one. */
325
+ export function wrunPollLaneFetchFrom(lane, fromTs) {
326
+ return lane.join === 'bar' ? fromTs : wrunDailyLaneFetchFrom(fromTs, lane.join.lookbackDays);
327
+ }
328
+ /** Where the full run's ask closes for a chart whose last bar opens at `lastBarTs` on a grid of
329
+ * `intervalMs`: at that open for a `bar` join, at that bar's END for a host-grid one (`barGrid`: its
330
+ * rows are a tier's buckets, the forming bar's included); for a daily one at that open on an intraday or
331
+ * daily chart and at the bar's END on a coarser one (`wrunDailyLaneFetchTo`: the forming week
332
+ * or month holds days after its open). */
333
+ export function wrunPollLaneFetchTo(lane, lastBarTs, intervalMs, nowMs) {
334
+ if (lane.join !== 'bar')
335
+ return wrunDailyLaneFetchTo(lastBarTs, intervalMs, nowMs);
336
+ return lane.barGrid !== undefined ? wrunHostGridFetchTo(lastBarTs, intervalMs) : lastBarTs;
337
+ }
338
+ /** Where a reconcile's ask closes for a chart-bar window closing at `toTs`: there for a `bar`
339
+ * join; for a daily one the day after the clock's day when the window closed before it on a
340
+ * chart coarser than a day (`wrunDailyLaneReconcileTo`, the forming bar of a session grid). */
341
+ export function wrunPollLaneReconcileTo(lane, toTs, intervalMs, nowMs) {
342
+ return lane.join === 'bar' ? toTs : wrunDailyLaneReconcileTo(toTs, intervalMs, nowMs);
343
+ }
344
+ /** Where a reconcile's ask (and its answer's authority) opens for the chart-bar window opening
345
+ * at `fromTs`, in a session whose first row is `sessionFirstRowTs`: at `fromTs` for a `bar`
346
+ * join; for a daily one where the full run's ask would open for that window (its day, the
347
+ * lane's `lookbackDays` earlier), never before the session's own full run opened
348
+ * (`wrunDailyLaneReconcileFrom`). A daily row is often published after its stamp date (a daily
349
+ * rate the next business day, a monthly series weeks later), so the lane's lookback is the
350
+ * publication-lag horizon: a reconcile that opened at the window's own day never fetched such
351
+ * a row, and the live tail kept a value a fresh full run no longer showed. */
352
+ export function wrunPollLaneReconcileFrom(lane, fromTs, sessionFirstRowTs) {
353
+ if (lane.join === 'bar')
354
+ return fromTs;
355
+ return wrunDailyLaneReconcileFrom(fromTs, sessionFirstRowTs, lane.join.lookbackDays);
356
+ }
357
+ /** The payload field a host-grid lane's ask names its backend tier in (`WrunPollLaneBarGrid.tiers`, a tier's
358
+ * `key`): the K control asks that tier. */
359
+ export const WRUN_POLL_LANE_TIER_FIELD = 'tier';
360
+ /**
361
+ * A lane's rows over a chart window, landed on the host bars when it is a host-grid lane (`barGrid`): its asks
362
+ * under the tier rule (`wrunHostGridAsks` over the window's host bars: one per run of bars on a tier, the
363
+ * tier's key in its extras as `tier`), each answer landed by the lane's landing (`wrunLandScalarRowsOnHostBars`:
364
+ * a flow summed per bar, a snapshot's newest sealed row, sealed by its ask's tier), ascending. A bar no tier
365
+ * retains asks nothing and reads no row. Any other lane is asked once over `[fromTs, toTs]` (`fallback`), its
366
+ * rows as they come. `ask` is the caller's fetch (the full run's, a reconcile's).
367
+ */
368
+ export async function fetchWrunPollLaneHostGridRows(lane, extras, window, fallback, ask) {
369
+ const grid = lane.barGrid;
370
+ if (grid === undefined)
371
+ return ask(extras, fallback.fromTs, fallback.toTs);
372
+ const { asks } = wrunHostGridAsks({
373
+ tiers: grid.tiers,
374
+ barOpens: window.barOpens,
375
+ intervalMs: window.intervalMs,
376
+ nowMs: window.nowMs,
377
+ });
378
+ const answers = await Promise.all(asks.map(async (gridAsk) => {
379
+ const askExtras = gridAsk.tier === undefined ? extras : { ...extras, [WRUN_POLL_LANE_TIER_FIELD]: gridAsk.tier.key };
380
+ const rows = await ask(askExtras, gridAsk.fromMs, gridAsk.toMs);
381
+ return wrunLandScalarRowsOnHostBars(rows, grid.landing, {
382
+ intervalMs: window.intervalMs,
383
+ barGrid: window.barGrid,
384
+ tierMs: gridAsk.tier?.ms,
385
+ nowMs: window.nowMs,
386
+ });
387
+ }));
388
+ const byBar = new Map();
389
+ for (const landed of answers) {
390
+ for (const row of landed)
391
+ byBar.set(Number(row[0]), row);
392
+ }
393
+ return [...byBar.entries()].sort((a, b) => a[0] - b[0]).map(([, row]) => row);
394
+ }