@orangecharts/wrun-chart-host 0.2.0 → 0.4.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 (342) hide show
  1. package/README.md +22 -8
  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/scriptEditor/builtin-script-snippets.d.ts +133 -0
  23. package/dist/constants/scriptEditor/builtin-script-snippets.js +451 -0
  24. package/dist/constants/venue-presets.constants.d.ts +10 -0
  25. package/dist/constants/venue-presets.constants.js +22 -0
  26. package/dist/enums/chart.enum.d.ts +68 -0
  27. package/dist/enums/chart.enum.js +70 -0
  28. package/dist/helpers/data.helpers.d.ts +2 -0
  29. package/dist/helpers/data.helpers.js +14 -0
  30. package/dist/host-env.d.ts +163 -5
  31. package/dist/host-ports.types.d.ts +431 -0
  32. package/dist/host-ports.types.js +1 -0
  33. package/dist/index.d.ts +138 -0
  34. package/dist/index.js +138 -0
  35. package/dist/indicators/controls/technical-script/technical-script-input-rendering.d.ts +86 -0
  36. package/dist/indicators/controls/technical-script/technical-script-input-rendering.js +179 -0
  37. package/dist/interfaces/asset-venue.interface.d.ts +91 -0
  38. package/dist/interfaces/asset-venue.interface.js +1 -0
  39. package/dist/interfaces/cancel-reason.interface.d.ts +24 -0
  40. package/dist/interfaces/cancel-reason.interface.js +2 -0
  41. package/dist/interfaces/catalog-display.interface.d.ts +3 -0
  42. package/dist/interfaces/catalog-display.interface.js +1 -0
  43. package/dist/interfaces/cme-realtime.interface.d.ts +251 -0
  44. package/dist/interfaces/cme-realtime.interface.js +46 -0
  45. package/dist/interfaces/feed.interface.d.ts +80 -0
  46. package/dist/interfaces/feed.interface.js +7 -0
  47. package/dist/interfaces/market-kind.interface.d.ts +8 -0
  48. package/dist/interfaces/market-kind.interface.js +1 -0
  49. package/dist/interfaces/opra-realtime.interface.d.ts +224 -0
  50. package/dist/interfaces/opra-realtime.interface.js +105 -0
  51. package/dist/interfaces/option-instrument.interface.d.ts +32 -0
  52. package/dist/interfaces/option-instrument.interface.js +1 -0
  53. package/dist/interfaces/options-chain-scope.interface.d.ts +29 -0
  54. package/dist/interfaces/options-chain-scope.interface.js +7 -0
  55. package/dist/interfaces/prediction-market.interface.d.ts +88 -0
  56. package/dist/interfaces/prediction-market.interface.js +8 -0
  57. package/dist/interfaces/wrun-runtime.interface.d.ts +5 -0
  58. package/dist/kscript-data/controls/live-trades-merge.util.d.ts +185 -0
  59. package/dist/kscript-data/controls/live-trades-merge.util.js +357 -0
  60. package/dist/settings-templates/frvp-fields.d.ts +27 -0
  61. package/dist/settings-templates/frvp-fields.js +108 -0
  62. package/dist/settings-templates/index.d.ts +119 -0
  63. package/dist/settings-templates/index.js +442 -0
  64. package/dist/settings-templates/indicator-fields.d.ts +56 -0
  65. package/dist/settings-templates/indicator-fields.js +793 -0
  66. package/dist/settings-templates/tool-rules.d.ts +59 -0
  67. package/dist/settings-templates/tool-rules.js +49 -0
  68. package/dist/settings-templates/tool-tables.generated.d.ts +2 -0
  69. package/dist/settings-templates/tool-tables.generated.js +1668 -0
  70. package/dist/utility/blk-market.util.d.ts +5 -0
  71. package/dist/utility/blk-market.util.js +12 -0
  72. package/dist/utility/chart/chart-load-phase.util.d.ts +32 -0
  73. package/dist/utility/chart/chart-load-phase.util.js +78 -0
  74. package/dist/utility/chart/cme-cache-context.util.d.ts +108 -0
  75. package/dist/utility/chart/cme-cache-context.util.js +166 -0
  76. package/dist/utility/chart/cme-session-bucket.util.d.ts +82 -0
  77. package/dist/utility/chart/cme-session-bucket.util.js +343 -0
  78. package/dist/utility/chart/cme-trade-calendar.util.d.ts +26 -0
  79. package/dist/utility/chart/cme-trade-calendar.util.js +147 -0
  80. package/dist/utility/chart/continuous-contracts.util.d.ts +138 -0
  81. package/dist/utility/chart/continuous-contracts.util.js +374 -0
  82. package/dist/utility/chart/date-labelled-interval.leaf.d.ts +15 -0
  83. package/dist/utility/chart/date-labelled-interval.leaf.js +19 -0
  84. package/dist/utility/chart/feed-interval.util.d.ts +119 -0
  85. package/dist/utility/chart/feed-interval.util.js +321 -0
  86. package/dist/utility/chart/fetch-dedupe-policy.util.d.ts +110 -0
  87. package/dist/utility/chart/fetch-dedupe-policy.util.js +407 -0
  88. package/dist/utility/chart/footprint-band.util.d.ts +76 -0
  89. package/dist/utility/chart/footprint-band.util.js +205 -0
  90. package/dist/utility/chart/footprint-cell-identity.util.d.ts +82 -0
  91. package/dist/utility/chart/footprint-cell-identity.util.js +346 -0
  92. package/dist/utility/chart/formula-calendar.util.d.ts +27 -0
  93. package/dist/utility/chart/formula-calendar.util.js +59 -0
  94. package/dist/utility/chart/history-wall.util.d.ts +67 -0
  95. package/dist/utility/chart/history-wall.util.js +87 -0
  96. package/dist/utility/chart/index-mode.util.d.ts +66 -0
  97. package/dist/utility/chart/index-mode.util.js +360 -0
  98. package/dist/utility/chart/indicator-coverage-planner.util.d.ts +217 -0
  99. package/dist/utility/chart/indicator-coverage-planner.util.js +443 -0
  100. package/dist/utility/chart/indicator-coverage-state.util.d.ts +33 -0
  101. package/dist/utility/chart/indicator-coverage-state.util.js +110 -0
  102. package/dist/utility/chart/indicator-gap-detector.util.d.ts +127 -0
  103. package/dist/utility/chart/indicator-gap-detector.util.js +260 -0
  104. package/dist/utility/chart/indicator-gap-repair.util.d.ts +88 -0
  105. package/dist/utility/chart/indicator-gap-repair.util.js +177 -0
  106. package/dist/utility/chart/indicator-inflight-registry.util.d.ts +26 -0
  107. package/dist/utility/chart/indicator-inflight-registry.util.js +254 -0
  108. package/dist/utility/chart/indicator-run-interval.util.d.ts +130 -0
  109. package/dist/utility/chart/indicator-run-interval.util.js +268 -0
  110. package/dist/utility/chart/interval-registry.util.d.ts +23 -0
  111. package/dist/utility/chart/interval-registry.util.js +83 -0
  112. package/dist/utility/chart/kscript-main-grid-stages.util.d.ts +21 -0
  113. package/dist/utility/chart/kscript-main-grid-stages.util.js +332 -0
  114. package/dist/utility/chart/legacy-exchange.leaf.d.ts +11 -0
  115. package/dist/utility/chart/legacy-exchange.leaf.js +43 -0
  116. package/dist/utility/chart/live-bucket.util.d.ts +66 -0
  117. package/dist/utility/chart/live-bucket.util.js +165 -0
  118. package/dist/utility/chart/market-session-schedule.util.d.ts +91 -0
  119. package/dist/utility/chart/market-session-schedule.util.js +337 -0
  120. package/dist/utility/chart/marketKind.util.d.ts +181 -0
  121. package/dist/utility/chart/marketKind.util.js +371 -0
  122. package/dist/utility/chart/opra-read-access.leaf.d.ts +26 -0
  123. package/dist/utility/chart/opra-read-access.leaf.js +25 -0
  124. package/dist/utility/chart/prediction-identity.util.d.ts +159 -0
  125. package/dist/utility/chart/prediction-identity.util.js +236 -0
  126. package/dist/utility/chart/rth-session.util.d.ts +352 -0
  127. package/dist/utility/chart/rth-session.util.js +926 -0
  128. package/dist/utility/chart/titan-constants.pin.d.ts +43 -0
  129. package/dist/utility/chart/titan-constants.pin.js +50 -0
  130. package/dist/utility/chart/us-equities-session.util.d.ts +127 -0
  131. package/dist/utility/chart/us-equities-session.util.js +251 -0
  132. package/dist/utility/chart/window-geometry.leaf.d.ts +119 -0
  133. package/dist/utility/chart/window-geometry.leaf.js +391 -0
  134. package/dist/utility/chart/window-owner.leaf.d.ts +19 -0
  135. package/dist/utility/chart/window-owner.leaf.js +24 -0
  136. package/dist/utility/chart/wrun-bar-session-facts.util.d.ts +100 -0
  137. package/dist/utility/chart/wrun-bar-session-facts.util.js +354 -0
  138. package/dist/utility/chart/wrun-wire-ref.util.d.ts +23 -0
  139. package/dist/utility/chart/wrun-wire-ref.util.js +16 -0
  140. package/dist/utility/common/safe-math-eval.d.ts +18 -0
  141. package/dist/utility/common/safe-math-eval.js +160 -0
  142. package/dist/utility/common/time.util.d.ts +134 -0
  143. package/dist/utility/common/time.util.js +428 -0
  144. package/dist/utility/common/transformations.util.d.ts +126 -0
  145. package/dist/utility/common/transformations.util.js +711 -0
  146. package/dist/utility/common/visible-timeout.util.d.ts +17 -0
  147. package/dist/utility/common/visible-timeout.util.js +75 -0
  148. package/dist/utility/exchange-normalization.util.d.ts +8 -0
  149. package/dist/utility/exchange-normalization.util.js +32 -0
  150. package/dist/utility/html-escape.leaf.d.ts +11 -0
  151. package/dist/utility/html-escape.leaf.js +20 -0
  152. package/dist/utility/intl-locale.util.d.ts +2 -0
  153. package/dist/utility/intl-locale.util.js +28 -0
  154. package/dist/utility/number-format.util.d.ts +14 -1
  155. package/dist/utility/number-format.util.js +50 -19
  156. package/dist/utility/options/option-symbol.util.d.ts +28 -0
  157. package/dist/utility/options/option-symbol.util.js +176 -0
  158. package/dist/utility/options/option-trade-units.util.d.ts +190 -0
  159. package/dist/utility/options/option-trade-units.util.js +283 -0
  160. package/dist/utility/options/option-venue.util.d.ts +75 -0
  161. package/dist/utility/options/option-venue.util.js +85 -0
  162. package/dist/utility/pool-symbol.leaf.d.ts +34 -0
  163. package/dist/utility/pool-symbol.leaf.js +95 -0
  164. package/dist/utility/scriptEditor/wrun-runtime-diagnostics.leaf.d.ts +109 -0
  165. package/dist/utility/scriptEditor/wrun-runtime-diagnostics.leaf.js +302 -0
  166. package/dist/utility/symbol-selection/contract-expiry.util.d.ts +39 -0
  167. package/dist/utility/symbol-selection/contract-expiry.util.js +111 -0
  168. package/dist/utility/v2/gate-plane.util.d.ts +58 -0
  169. package/dist/utility/v2/gate-plane.util.js +99 -0
  170. package/dist/utility/v2/gate-session-latch.util.d.ts +22 -0
  171. package/dist/utility/v2/gate-session-latch.util.js +34 -0
  172. package/dist/utility/watchlist/import/tradingview-symbols.leaf.d.ts +76 -0
  173. package/dist/utility/watchlist/import/tradingview-symbols.leaf.js +221 -0
  174. package/dist/utility/wrun/sources/host-grid-landing.d.ts +15 -0
  175. package/dist/utility/wrun/sources/host-grid-landing.js +26 -0
  176. package/dist/utility/wrun/sources/lanes/bitfinex_funding.d.ts +27 -0
  177. package/dist/utility/wrun/sources/lanes/bitfinex_funding.js +85 -0
  178. package/dist/utility/wrun/sources/lanes/economic.d.ts +27 -0
  179. package/dist/utility/wrun/sources/lanes/economic.js +79 -0
  180. package/dist/utility/wrun/sources/lanes/etf_holdings.d.ts +35 -0
  181. package/dist/utility/wrun/sources/lanes/etf_holdings.js +165 -0
  182. package/dist/utility/wrun/sources/lanes/etf_premium.d.ts +19 -0
  183. package/dist/utility/wrun/sources/lanes/etf_premium.js +114 -0
  184. package/dist/utility/wrun/sources/lanes/ethena_positions.d.ts +30 -0
  185. package/dist/utility/wrun/sources/lanes/ethena_positions.js +51 -0
  186. package/dist/utility/wrun/sources/lanes/index.d.ts +2 -0
  187. package/dist/utility/wrun/sources/lanes/index.js +32 -0
  188. package/dist/utility/wrun/sources/lanes/long_short_ratio.d.ts +17 -0
  189. package/dist/utility/wrun/sources/lanes/long_short_ratio.js +47 -0
  190. package/dist/utility/wrun/sources/lanes/option_daily.d.ts +58 -0
  191. package/dist/utility/wrun/sources/lanes/option_daily.js +111 -0
  192. package/dist/utility/wrun/sources/lanes/option_stats_10m.d.ts +27 -0
  193. package/dist/utility/wrun/sources/lanes/option_stats_10m.js +21 -0
  194. package/dist/utility/wrun/sources/lanes/options_flow.d.ts +50 -0
  195. package/dist/utility/wrun/sources/lanes/options_flow.js +155 -0
  196. package/dist/utility/wrun/sources/lanes/options_oi.d.ts +29 -0
  197. package/dist/utility/wrun/sources/lanes/options_oi.js +59 -0
  198. package/dist/utility/wrun/sources/lanes/options_volume.d.ts +38 -0
  199. package/dist/utility/wrun/sources/lanes/options_volume.js +63 -0
  200. package/dist/utility/wrun/sources/lanes/series.d.ts +67 -0
  201. package/dist/utility/wrun/sources/lanes/series.js +321 -0
  202. package/dist/utility/wrun/sources/lanes/token_supply.d.ts +30 -0
  203. package/dist/utility/wrun/sources/lanes/token_supply.js +145 -0
  204. package/dist/utility/wrun/sources/lanes/treasury_balance.d.ts +25 -0
  205. package/dist/utility/wrun/sources/lanes/treasury_balance.js +47 -0
  206. package/dist/utility/wrun/sources/lanes/volatility_index.d.ts +21 -0
  207. package/dist/utility/wrun/sources/lanes/volatility_index.js +11 -0
  208. package/dist/utility/wrun/sources/opra-option-lanes.util.d.ts +215 -0
  209. package/dist/utility/wrun/sources/opra-option-lanes.util.js +477 -0
  210. package/dist/utility/wrun/sources/registry.d.ts +21 -0
  211. package/dist/utility/wrun/sources/registry.js +237 -0
  212. package/dist/utility/wrun/sources/row-lane-registry.d.ts +28 -0
  213. package/dist/utility/wrun/sources/row-lane-registry.js +230 -0
  214. package/dist/utility/wrun/sources/row-lanes/index.d.ts +2 -0
  215. package/dist/utility/wrun/sources/row-lanes/index.js +12 -0
  216. package/dist/utility/wrun/sources/row-lanes/option_contract_flow.d.ts +2 -0
  217. package/dist/utility/wrun/sources/row-lanes/option_contract_flow.js +38 -0
  218. package/dist/utility/wrun/sources/row-lanes/option_contract_state.d.ts +55 -0
  219. package/dist/utility/wrun/sources/row-lanes/option_contract_state.js +126 -0
  220. package/dist/utility/wrun/sources/row-lanes/option_prints.d.ts +4 -0
  221. package/dist/utility/wrun/sources/row-lanes/option_prints.js +191 -0
  222. package/dist/utility/wrun/sources/row-lanes/option_strikes.d.ts +62 -0
  223. package/dist/utility/wrun/sources/row-lanes/option_strikes.js +147 -0
  224. package/dist/utility/wrun/sources/row-lanes/option_surface.d.ts +70 -0
  225. package/dist/utility/wrun/sources/row-lanes/option_surface.js +144 -0
  226. package/dist/utility/wrun/sources/wrun-poll-lane.types.d.ts +309 -0
  227. package/dist/utility/wrun/sources/wrun-poll-lane.types.js +26 -0
  228. package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +350 -0
  229. package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +576 -0
  230. package/dist/utility/wrun/sources/wrun-row-lane.types.d.ts +275 -0
  231. package/dist/utility/wrun/sources/wrun-row-lane.types.js +16 -0
  232. package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +207 -0
  233. package/dist/utility/wrun/sources/wrun-row-lanes.util.js +450 -0
  234. package/dist/utility/wrun/wrun-browser-sources.leaf.d.ts +28 -0
  235. package/dist/utility/wrun/wrun-browser-sources.leaf.js +66 -0
  236. package/dist/utility/wrun/wrun-cloud-record.util.d.ts +65 -0
  237. package/dist/utility/wrun/wrun-cloud-record.util.js +121 -0
  238. package/dist/utility/wrun/wrun-daily-lane.util.d.ts +95 -0
  239. package/dist/utility/wrun/wrun-daily-lane.util.js +297 -0
  240. package/dist/utility/wrun/wrun-deadline.util.d.ts +52 -0
  241. package/dist/utility/wrun/wrun-deadline.util.js +82 -0
  242. package/dist/utility/wrun/wrun-etf-flow-lane.util.d.ts +94 -0
  243. package/dist/utility/wrun/wrun-etf-flow-lane.util.js +224 -0
  244. package/dist/utility/wrun/wrun-etf-funds.util.d.ts +82 -0
  245. package/dist/utility/wrun/wrun-etf-funds.util.js +242 -0
  246. package/dist/utility/wrun/wrun-frames.d.ts +20 -1
  247. package/dist/utility/wrun/wrun-frames.js +103 -49
  248. package/dist/utility/wrun/wrun-hosted-wire-caps.d.ts +2 -2
  249. package/dist/utility/wrun/wrun-hosted-wire-caps.js +27 -0
  250. package/dist/utility/wrun/wrun-lane-refusal.leaf.d.ts +22 -0
  251. package/dist/utility/wrun/wrun-lane-refusal.leaf.js +32 -0
  252. package/dist/utility/wrun/wrun-lane-warmup.util.d.ts +18 -0
  253. package/dist/utility/wrun/wrun-lane-warmup.util.js +112 -0
  254. package/dist/utility/wrun/wrun-leg-close.util.d.ts +57 -0
  255. package/dist/utility/wrun/wrun-leg-close.util.js +187 -0
  256. package/dist/utility/wrun/wrun-leg-fetch.util.d.ts +144 -0
  257. package/dist/utility/wrun/wrun-leg-fetch.util.js +212 -0
  258. package/dist/utility/wrun/wrun-leg-stream-classes.d.ts +73 -0
  259. package/dist/utility/wrun/wrun-leg-stream-classes.js +86 -0
  260. package/dist/utility/wrun/wrun-levels-child.util.d.ts +101 -6
  261. package/dist/utility/wrun/wrun-levels-child.util.js +335 -157
  262. package/dist/utility/wrun/wrun-memory-clamp.util.d.ts +33 -0
  263. package/dist/utility/wrun/wrun-memory-clamp.util.js +146 -0
  264. package/dist/utility/wrun/wrun-odds-template-market.util.d.ts +51 -0
  265. package/dist/utility/wrun/wrun-odds-template-market.util.js +251 -0
  266. package/dist/utility/wrun/wrun-opra-flow.leaf.d.ts +65 -0
  267. package/dist/utility/wrun/wrun-opra-flow.leaf.js +94 -0
  268. package/dist/utility/wrun/wrun-opra-lane.util.d.ts +47 -0
  269. package/dist/utility/wrun/wrun-opra-lane.util.js +58 -0
  270. package/dist/utility/wrun/wrun-opra-stats.leaf.d.ts +49 -0
  271. package/dist/utility/wrun/wrun-opra-stats.leaf.js +115 -0
  272. package/dist/utility/wrun/wrun-opra-underlying.util.d.ts +12 -0
  273. package/dist/utility/wrun/wrun-opra-underlying.util.js +1 -0
  274. package/dist/utility/wrun/wrun-option-contract-flow.util.d.ts +142 -0
  275. package/dist/utility/wrun/wrun-option-contract-flow.util.js +451 -0
  276. package/dist/utility/wrun/wrun-option-knobs.util.d.ts +43 -0
  277. package/dist/utility/wrun/wrun-option-knobs.util.js +81 -0
  278. package/dist/utility/wrun/wrun-option-prints.util.d.ts +144 -0
  279. package/dist/utility/wrun/wrun-option-prints.util.js +356 -0
  280. package/dist/utility/wrun/wrun-option-summary-lane.util.d.ts +102 -0
  281. package/dist/utility/wrun/wrun-option-summary-lane.util.js +143 -0
  282. package/dist/utility/wrun/wrun-options-chain.util.d.ts +308 -0
  283. package/dist/utility/wrun/wrun-options-chain.util.js +502 -0
  284. package/dist/utility/wrun/wrun-overlay-identity.util.d.ts +9 -4
  285. package/dist/utility/wrun/wrun-overlay-identity.util.js +16 -6
  286. package/dist/utility/wrun/wrun-panel-mount.lazy.d.ts +10 -0
  287. package/dist/utility/wrun/wrun-panel-mount.lazy.js +68 -0
  288. package/dist/utility/wrun/wrun-panel-mount.util.d.ts +377 -0
  289. package/dist/utility/wrun/wrun-panel-mount.util.js +2251 -0
  290. package/dist/utility/wrun/wrun-param-map.util.d.ts +298 -0
  291. package/dist/utility/wrun/wrun-param-map.util.js +581 -0
  292. package/dist/utility/wrun/wrun-pause-dim.util.d.ts +52 -0
  293. package/dist/utility/wrun/wrun-pause-dim.util.js +153 -0
  294. package/dist/utility/wrun/wrun-pin-spelling.util.d.ts +149 -0
  295. package/dist/utility/wrun/wrun-pin-spelling.util.js +523 -0
  296. package/dist/utility/wrun/wrun-pin-venues.util.d.ts +116 -0
  297. package/dist/utility/wrun/wrun-pin-venues.util.js +320 -0
  298. package/dist/utility/wrun/wrun-pinned-interval.util.d.ts +20 -0
  299. package/dist/utility/wrun/wrun-pinned-interval.util.js +47 -0
  300. package/dist/utility/wrun/wrun-plot-gate.types.d.ts +23 -0
  301. package/dist/utility/wrun/wrun-plot-gate.types.js +7 -0
  302. package/dist/utility/wrun/wrun-present-bits.util.d.ts +37 -0
  303. package/dist/utility/wrun/wrun-present-bits.util.js +73 -0
  304. package/dist/utility/wrun/wrun-protocol-pending.util.d.ts +33 -0
  305. package/dist/utility/wrun/wrun-protocol-pending.util.js +57 -0
  306. package/dist/utility/wrun/wrun-refusal.util.d.ts +41 -1
  307. package/dist/utility/wrun/wrun-refusal.util.js +69 -2
  308. package/dist/utility/wrun/wrun-registry-errors.util.d.ts +1 -14
  309. package/dist/utility/wrun/wrun-registry-errors.util.js +0 -16
  310. package/dist/utility/wrun/wrun-row-source.d.ts +158 -0
  311. package/dist/utility/wrun/wrun-row-source.js +75 -0
  312. package/dist/utility/wrun/wrun-run-health.util.d.ts +155 -0
  313. package/dist/utility/wrun/wrun-run-health.util.js +273 -0
  314. package/dist/utility/wrun/wrun-run-interval-projection.types.d.ts +14 -0
  315. package/dist/utility/wrun/wrun-run-interval-projection.types.js +1 -0
  316. package/dist/utility/wrun/wrun-socket-row-source.d.ts +439 -0
  317. package/dist/utility/wrun/wrun-socket-row-source.js +1689 -0
  318. package/dist/utility/wrun/wrun-socket-session-losses.util.d.ts +18 -0
  319. package/dist/utility/wrun/wrun-socket-session-losses.util.js +25 -0
  320. package/dist/utility/wrun/wrun-source-rows.util.d.ts +911 -0
  321. package/dist/utility/wrun/wrun-source-rows.util.js +2597 -0
  322. package/dist/utility/wrun/wrun-tape-source.util.d.ts +82 -0
  323. package/dist/utility/wrun/wrun-tape-source.util.js +151 -0
  324. package/dist/utility/wrun/wrun-tier-grid.util.d.ts +137 -0
  325. package/dist/utility/wrun/wrun-tier-grid.util.js +279 -0
  326. package/dist/utility/wrun/wrun-trades-lane.util.d.ts +52 -0
  327. package/dist/utility/wrun/wrun-trades-lane.util.js +58 -0
  328. package/dist/utility/wrun/wrun-volume-profile-lane.util.d.ts +41 -0
  329. package/dist/utility/wrun/wrun-volume-profile-lane.util.js +66 -0
  330. package/dist/utility/wrun-display-name.util.d.ts +33 -0
  331. package/dist/utility/wrun-display-name.util.js +64 -0
  332. package/dist/workers/constants/kscript-transport-codes.d.ts +15 -0
  333. package/dist/workers/constants/kscript-transport-codes.js +15 -0
  334. package/dist/workers/constants/socket-slots.d.ts +574 -0
  335. package/dist/workers/constants/socket-slots.js +539 -0
  336. package/dist/workers/utils/number.worker.util.d.ts +5 -0
  337. package/dist/workers/utils/number.worker.util.js +10 -0
  338. package/dist/workers/utils/time.worker.util.d.ts +12 -0
  339. package/dist/workers/utils/time.worker.util.js +24 -0
  340. package/dist/workers/utils/volume-profile.worker.util.d.ts +200 -0
  341. package/dist/workers/utils/volume-profile.worker.util.js +631 -0
  342. package/package.json +10 -4
@@ -0,0 +1,320 @@
1
+ /**
2
+ * Which markets a script may pin as another market's input on the chart (the capability round's
3
+ * item 5: other markets' prices inside a script), decided once per run at plan time, before any
4
+ * fetch, and read again by the live tick's leg reconcile so the two asks cannot drift.
5
+ *
6
+ * - The CME Group family (`WRUN_PIN_REFUSED_EXCHANGES` in the shared host's sheet contract: CME, CBOT,
7
+ * NYMEX, COMEX, GLOBEX) is REFUSED by name, with the contract's own words
8
+ * (`wrun_pin_venue_refused`), on every host alike, for every market the chart's expression
9
+ * parser extracts from the pin's `exchange|symbol` (a CME market hidden behind a served exchange
10
+ * included). A pin that is not one literal market refuses too (`wrun_pin_symbol_literal`, the
11
+ * contract's code),
12
+ * and so does a multi-day leg shorter than a week on a session venue
13
+ * (`wrun_pin_session_interval_unserved`: a 3d candle there groups trading days and would be
14
+ * confirmed early). The charted market itself may be CME on an entitled chart: an own-market
15
+ * leg carries no `market` and is never a pin (the display wall decides the chart's own venue,
16
+ * `isKScriptDisplayBlockedOnExchange`).
17
+ * - An index venue (`WRUN_PIN_UNSERVED_EXCHANGES`: POLYGON_INDICES) is UNSERVED until the data
18
+ * service serves index series to scripts (WRUN-CAPS-BACKEND-REQUEST.md, ask 2a: the directory
19
+ * still holds the index rows out): the leg is soft-refused per input the way the lane refusals
20
+ * are, never fetched, never in the live context, its inputs reading their missing fill while a
21
+ * `WRUN_LEG_UNSERVED` row on the legend names the reason, so the run proceeds and the author
22
+ * can say so. Delete the venue from the list once the gateway lists it: the leg then asks
23
+ * TICKER_AGG quote candles like the forex and commodity venues (`checkIsTickerDataType`).
24
+ * - A venue word the chart's lanes cannot ask is UNKNOWN (`wrun_pin_venue_unknown`, the sheet
25
+ * contract's code): not a member of the wire's exchange enum (AMEX, SP, a chart alias such as
26
+ * BINANCE.F), or a stock listing the query layer rejects since the polygon-exchange flip (NASDAQ,
27
+ * NYSE, CBOE). Fetched, the gateway refuses it and the leg reads as an empty market, so the run
28
+ * refuses it by name before any fetch, a failed run whatever names the word: a sheet pin, a
29
+ * `param.symbol` default baked into its input's pins, or a saved pick `wrunSheetWithSettings`
30
+ * paints there. The settings row of a symbol setting holding one says so too
31
+ * (`wrunSymbolSettingUnknownVenue`). Another platform's spelling (`COINBASE:BTCUSD`) is respelled
32
+ * or refused on the run's copy before planning (wrun-pin-spelling.util).
33
+ * - Every other venue is SERVED. A leg on an index-mode market (US stocks and ETFs on POLYGON,
34
+ * FX_OTC forex, the LBMA and commodity venues) or on an index-mode chart rides dataFetch's
35
+ * native-rows path (`wrunLegNativeRowsOption`): the leg's own rows at its own stamps, never
36
+ * realigned onto a sparse grid (the realignment the old index-mode soft refusal guarded
37
+ * against), the leg core aligning them like every other leg. The k-ohlcv worker asks forex,
38
+ * commodity and index venues the TICKER_AGG quote shape (volume 0), the same candles the
39
+ * chart's own forex charts ride.
40
+ *
41
+ * Every refusal carries its record's seed (WRUN-REFUSALS, `attachWrunRefusal`): the CME family is
42
+ * `pin-refused` naming the refused market, the literal and session rules a failed run (the author's
43
+ * to fix), their words the technical details. Which inputs read a leg's FETCHED rows
44
+ * (`wrunLegFetchedRowReaders`) is decided here once, by the fetch key each wire consumes: the
45
+ * unserved rows name them, and the run pass's leg gate reads the same set.
46
+ *
47
+ * Pure and store-free (the chart's venue predicates only): the run pass and the live tick share it.
48
+ */
49
+ import { Exchange } from '@orangecharts/orange-v2-pb-common';
50
+ import { delimiter } from '../../constants/data-source.constants.js';
51
+ import { Intervals } from '../../constants/interval.constants.js';
52
+ import { checkIsIndexMode } from '../chart/index-mode.util.js';
53
+ import { normalizeLegacyExchange } from '../chart/legacy-exchange.leaf.js';
54
+ import { extractTokensFromTransformations, parsedTransformations } from '../common/transformations.util.js';
55
+ import { wrunChartHostEnv } from '../../host-env.js';
56
+ import { attachWrunRefusal } from './wrun-refusal.util.js';
57
+ /** The venues the gateway serves no series for to scripts yet: a pin on one is soft-refused per
58
+ * input with a `WRUN_LEG_UNSERVED` row naming why (never silently NaN). Remove a venue here the
59
+ * moment the gateway lists it; nothing else gates it. */
60
+ export const WRUN_PIN_UNSERVED_EXCHANGES = ['POLYGON_INDICES'];
61
+ /** A pin on a venue word the chart's lanes cannot ask (`wrunPinVenueVerdict` 'unknown'): the sheet
62
+ * contract's code (om's WRUN_PIN_VENUE_UNKNOWN_CODE; the shared host this chart loads does not
63
+ * carry it yet), refused before any fetch as a failed run. */
64
+ export const WRUN_PIN_VENUE_UNKNOWN_CODE = 'wrun_pin_venue_unknown';
65
+ /** A multi-day pin shorter than a week on a session venue: a 3d stock, forex or metals candle
66
+ * groups three trading days (a Friday bar runs into Monday), and the leg core confirms a candle
67
+ * at its open plus the span, so such a leg would show Monday's prices on Sunday rows and admit a
68
+ * still-forming candle as confirmed. 1d and 1w stay served: a US listing's confirm at its
69
+ * session close (`wrunLegCandleClose`), every other market's late, never early. */
70
+ export const WRUN_PIN_SESSION_INTERVAL_UNSERVED_CODE = 'wrun_pin_session_interval_unserved';
71
+ /** The spellings a literal market keeps: an exchange word (the chart's own transformation
72
+ * validators) and a symbol in the sheet contract's one-market spelling (`wrunPinSymbolLiteral`,
73
+ * om's `WRUN_PIN_SYMBOL_RE` read through the shared host, so the chart accepts exactly the
74
+ * symbols every other host does: letters, digits and `. _ - / : @ !`, as in `@107`, `xyz:TSLA`,
75
+ * `BTC-USDT-251226`). Whitespace, the `exchange|symbol` delimiter and every operator are what
76
+ * an expression is made of. */
77
+ const WRUN_PIN_LITERAL_EXCHANGE_RE = /^[A-Za-z0-9_.]+$/;
78
+ const DAY_MS = Intervals.DAY;
79
+ const WEEK_MS = Intervals.WEEK;
80
+ /** Every market the chart's expression parser extracts from a pin's `exchange|symbol`, the text
81
+ * the k-ohlcv control would hand the worker (duplicates kept: each is a request). */
82
+ export function wrunPinMarketsOf(exchange, symbol) {
83
+ return extractTokensFromTransformations(`${exchange}${delimiter}${symbol}`, true).map((token) => ({
84
+ exchange: token.exchange ?? '',
85
+ symbol: token.symbol ?? '',
86
+ }));
87
+ }
88
+ /** Whether a pin is one literal market: the exchange and symbol spellings above, and the
89
+ * expression parser reading the pair as exactly one market, that market. The k-ohlcv control
90
+ * concatenates `exchange|symbol` into a transformation expression and the worker asks one
91
+ * request per market the parser extracts, so a symbol carrying an operator and a second market
92
+ * would reach that market's data under the pin's declared exchange. A pin that fails refuses
93
+ * with the sheet contract's code (`WRUN_PIN_SYMBOL_LITERAL_CODE`, om owns it). */
94
+ export function wrunPinMarketIsLiteral(exchange, symbol) {
95
+ if (!WRUN_PIN_LITERAL_EXCHANGE_RE.test(exchange) || !wrunChartHostEnv().sharedHost().wrunPinSymbolLiteral(symbol))
96
+ return false;
97
+ const items = parsedTransformations(`${exchange}${delimiter}${symbol}`);
98
+ if (items.length !== 1)
99
+ return false;
100
+ const item = items[0];
101
+ return typeof item === 'object' && item !== null && item.exchange === exchange && item.symbol === symbol;
102
+ }
103
+ /** A session venue for the multi-day rule: a market whose bars sit on a trading-session grid
104
+ * (index mode: US stocks and ETFs, forex, the metals and commodities, the index venues). */
105
+ function wrunPinVenueIsSessionGrid(exchange) {
106
+ return checkIsIndexMode(exchange);
107
+ }
108
+ /** Whether the chart's lanes can ask a venue word: a member of the wire's exchange enum
109
+ * (`Exchange`, the table the symbol search derives its venues from and every series ask maps
110
+ * the word through; `getExchangeFromSymbol` hands the K_OHLCV worker an enum name), never a
111
+ * stock listing the query layer rejects since the polygon-exchange flip (`normalizeLegacyExchange`
112
+ * moves NASDAQ, NYSE, CBOE and their siblings to POLYGON on persisted records; a SAVED pin is never
113
+ * rewritten: wrun-pin-spelling.util respells the run's copy). Exact, as the wire reads the word. */
114
+ export function wrunPinVenueOnWire(exchange) {
115
+ const code = Exchange[exchange];
116
+ return (typeof code === 'number' && code !== Exchange.UNKNOWN_EXCHANGE && normalizeLegacyExchange(exchange) === exchange);
117
+ }
118
+ /** What the chart does with a pin on `exchange`: `refused` (a CME Group venue, by name, the run
119
+ * does not start), `unserved` (an index venue the gateway does not serve to scripts yet, the
120
+ * leg soft-refused), `unknown` (a venue word the chart's lanes cannot ask, `wrunPinVenueOnWire`:
121
+ * by name, the run does not start), `served` (everything else; an absent exchange is the chart's
122
+ * own market). */
123
+ export function wrunPinVenueVerdict(exchange) {
124
+ if (wrunChartHostEnv().sharedHost().wrunPinVenueRefused(exchange))
125
+ return 'refused';
126
+ if (exchange !== undefined && WRUN_PIN_UNSERVED_EXCHANGES.includes(exchange.toUpperCase())) {
127
+ return 'unserved';
128
+ }
129
+ if (exchange !== undefined && exchange !== '' && !wrunPinVenueOnWire(exchange))
130
+ return 'unknown';
131
+ return 'served';
132
+ }
133
+ /** The unknown venue's words: the input, then the sheet contract's own message (the text om's
134
+ * sheet check writes for the same word, `wrun_pin_venue_unknown: venue '<word>' ...`). */
135
+ export function wrunPinVenueUnknownMessage(inputName, exchange) {
136
+ return (`Input '${inputName}' pins exchange ${exchange}: ${WRUN_PIN_VENUE_UNKNOWN_CODE}: venue '${exchange}' is not a ` +
137
+ 'market our data serves; US stocks and ETFs are POLYGON:<TICKER>/USD');
138
+ }
139
+ /** The venue word of a symbol setting's `EXCHANGE:SYMBOL` text (split at the first colon, as
140
+ * `wrunSheetWithSettings` paints it onto the bound inputs) when its verdict is `unknown`, else
141
+ * undefined: the settings row says the run's words for it. Reads the shared host (the CME check
142
+ * first), so the caller loads it. */
143
+ export function wrunSymbolSettingUnknownVenue(text) {
144
+ const at = text.indexOf(':');
145
+ const venue = at === -1 ? '' : text.slice(0, at).trim();
146
+ return venue !== '' && wrunPinVenueVerdict(venue) === 'unknown' ? venue : undefined;
147
+ }
148
+ /** The refusal's words: the input, then the sheet contract's own message (the same text the om
149
+ * prebuild writes at declaration time and the sheet check at validation). */
150
+ export function wrunPinVenueRefusalMessage(inputName, exchange) {
151
+ return `Input '${inputName}' pins exchange ${exchange}: ${wrunChartHostEnv().sharedHost().wrunPinVenueRefusedMessage(exchange)}`;
152
+ }
153
+ /** The failed-run seed of a pin rule the author fixes in the code (not one literal market, a
154
+ * multi-day leg on a session venue). */
155
+ const WRUN_PIN_AUTHOR_RULE_SEED = Object.freeze({ cls: 'run-failed', variant: 'generic' });
156
+ /** The failed-run seed of an unknown venue: its own words (the venue named), and the settings as
157
+ * the way out when a symbol setting holds the market (a served pick fixes it), else the class's
158
+ * ladder (the source, else the report). */
159
+ export function wrunPinVenueUnknownSeed(venue, settingBound) {
160
+ return {
161
+ cls: 'run-failed',
162
+ variant: 'pin-venue-unknown',
163
+ params: { venue },
164
+ ...(settingBound ? { out: { kind: 'open-settings' } } : {}),
165
+ };
166
+ }
167
+ /** The refusal a pinned leg earns before any fetch, with its record's seed, or null when it is
168
+ * served; the one point the run pass judges every leg at (the tick's reconcile re-asks only legs
169
+ * that passed here):
170
+ * - every market the expression parser extracts from the pin's `exchange|symbol` gets the venue
171
+ * verdict (a CME Group market hidden behind a served exchange refuses by the contract's words):
172
+ * `pin-refused`, the refused market's symbol as `pin` (its exchange when it names none);
173
+ * - a pin that is not one literal market refuses (`WRUN_PIN_SYMBOL_LITERAL_CODE`): a failed run;
174
+ * - a literal market on a venue word the chart's lanes cannot ask refuses
175
+ * (`WRUN_PIN_VENUE_UNKNOWN_CODE`): a failed run, its way out the settings when `settingBound`
176
+ * (a symbol setting holds the market);
177
+ * - a multi-day leg shorter than a week on a session venue, the pinned market's or the chart's
178
+ * own, refuses (`WRUN_PIN_SESSION_INTERVAL_UNSERVED_CODE`): a failed run.
179
+ * An own-market leg (no `market`) is the chart's own venue: never a pin for the first three rules. */
180
+ export function wrunPinnedLegRefusalOf(leg, inputName, chartExchange, settingBound = false) {
181
+ const pinned = leg.market;
182
+ if (pinned !== undefined) {
183
+ const exchange = pinned.exchange ?? '';
184
+ const symbol = pinned.symbol ?? '';
185
+ for (const market of wrunPinMarketsOf(exchange, symbol)) {
186
+ if (wrunPinVenueVerdict(market.exchange) === 'refused') {
187
+ const label = market.symbol !== '' ? market.symbol : market.exchange;
188
+ return {
189
+ message: wrunPinVenueRefusalMessage(inputName, market.exchange),
190
+ seed: {
191
+ cls: 'pin-refused',
192
+ market: { exchange: market.exchange, symbol: market.symbol, label },
193
+ params: { pin: label },
194
+ },
195
+ };
196
+ }
197
+ }
198
+ if (!wrunPinMarketIsLiteral(exchange, symbol)) {
199
+ return {
200
+ message: `Input '${inputName}' pins the market '${exchange}/${symbol}' (${wrunChartHostEnv().sharedHost().WRUN_PIN_SYMBOL_LITERAL_CODE}): ` +
201
+ `a pin names one market as a literal exchange and symbol, never an expression`,
202
+ seed: WRUN_PIN_AUTHOR_RULE_SEED,
203
+ };
204
+ }
205
+ if (wrunPinVenueVerdict(exchange) === 'unknown') {
206
+ return {
207
+ message: wrunPinVenueUnknownMessage(inputName, exchange),
208
+ seed: wrunPinVenueUnknownSeed(exchange, settingBound),
209
+ };
210
+ }
211
+ }
212
+ const venue = pinned?.exchange ?? chartExchange;
213
+ if (leg.legMs > DAY_MS && leg.legMs < WEEK_MS && wrunPinVenueIsSessionGrid(venue)) {
214
+ return {
215
+ message: `Input '${inputName}' pins interval '${leg.intervalKey}' on ${venue}/${pinned?.symbol ?? 'currentSymbol'}: ` +
216
+ `a multi-day candle on a session venue groups trading days (a Friday bar runs into Monday) and would be ` +
217
+ `confirmed at its open plus the span, early and still forming (${WRUN_PIN_SESSION_INTERVAL_UNSERVED_CODE}); ` +
218
+ `pin 1d or 1w instead`,
219
+ seed: WRUN_PIN_AUTHOR_RULE_SEED,
220
+ };
221
+ }
222
+ return null;
223
+ }
224
+ /** The words of `wrunPinnedLegRefusalOf`, or null when the leg is served. */
225
+ export function wrunPinnedLegRefusal(leg, inputName, chartExchange) {
226
+ return wrunPinnedLegRefusalOf(leg, inputName, chartExchange)?.message ?? null;
227
+ }
228
+ /** Refuse by name, before any fetch, the first pinned leg in declaration order that
229
+ * `wrunPinnedLegRefusalOf` refuses (a CME Group market, declared or hidden in an expression
230
+ * symbol; a pin that is not one literal market; a venue word the chart's lanes cannot ask; a
231
+ * multi-day leg on a session venue), the refusal's seed attached to the error. `settingBoundAt`
232
+ * names the inputs a symbol setting pins (`symbol_param`): a leg one of them reads offers the
233
+ * settings as its way out. */
234
+ export function assertWrunPinnedLegVenues(legs, inputNameAt, chartExchange, settingBoundAt) {
235
+ const byInput = [...legs]
236
+ .map((leg) => ({ leg, index: Math.min(...leg.inputIndexes) }))
237
+ .sort((a, b) => a.index - b.index);
238
+ for (const { leg, index } of byInput) {
239
+ const settingBound = settingBoundAt !== undefined && leg.inputIndexes.some(settingBoundAt);
240
+ const refusal = wrunPinnedLegRefusalOf(leg, inputNameAt(index), chartExchange, settingBound);
241
+ if (refusal !== null)
242
+ throw attachWrunRefusal(new Error(refusal.message), refusal.seed);
243
+ }
244
+ }
245
+ /** The fetch key whose rows a wire reads, or undefined for a wire that reads no leg's fetched
246
+ * rows: a period, intrabar or candles wire reads its leg's; a grid wire its grid leg's; a foreign
247
+ * forming wire folds its grid leg's rows (never its period leg's); an own-market forming view
248
+ * folds the PRIMARY rows; a typed wire buckets the chart's own feed (its `legKey` is no fetch
249
+ * key) and an own-period view is a constant. */
250
+ function wrunWireFetchKey(wire) {
251
+ switch (wire.kind) {
252
+ case 'period':
253
+ case 'intrabar':
254
+ case 'candles':
255
+ return wire.leg.fetchKey;
256
+ case 'grid':
257
+ return wire.gridLeg.fetchKey;
258
+ case 'forming':
259
+ return wire.gridLeg?.fetchKey;
260
+ default:
261
+ return undefined;
262
+ }
263
+ }
264
+ /** The inputs whose wire consumes THIS leg's fetched rows, by index, ascending: matched by the
265
+ * fetch key each wire reads against the leg's (`wrunWireFetchKey`). A foreign forming view counts
266
+ * for its grid leg only; an own-market forming view, a typed feed and an own-period view never
267
+ * count. A leg with no such reader (the period leg of forming views alone) is skipped by every
268
+ * caller that judges a leg by its readers. */
269
+ export function wrunLegFetchedRowReaders(leg, wires) {
270
+ const readers = [];
271
+ for (const [index, wire] of wires)
272
+ if (wrunWireFetchKey(wire) === leg.fetchKey)
273
+ readers.push(index);
274
+ return readers.sort((a, b) => a - b);
275
+ }
276
+ /** Split the planned legs into the ones the chart serves and the ones on a venue the gateway
277
+ * does not serve to scripts yet (`WRUN_PIN_UNSERVED_EXCHANGES`). `served` keeps the planner's
278
+ * order (every served leg: what a leg without fetched-row readers means is the run pass's leg
279
+ * gate's to decide). The names an unserved leg carries are the inputs that READ its fetched rows
280
+ * (`wrunLegFetchedRowReaders`): an own-market `forming` view folds the primary rows and is left
281
+ * out (it keeps working), a foreign one is named under its grid leg only; a leg with no such
282
+ * reader is dropped silently. Call after `assertWrunPinnedLegVenues`: a refused venue never
283
+ * reaches here. */
284
+ export function partitionWrunLegsByVenue(legs, wires, inputNameAt) {
285
+ const served = [];
286
+ const unserved = [];
287
+ for (const leg of legs) {
288
+ const exchange = leg.market?.exchange;
289
+ if (exchange === undefined || wrunPinVenueVerdict(exchange) !== 'unserved') {
290
+ served.push(leg);
291
+ continue;
292
+ }
293
+ const inputNames = wrunLegFetchedRowReaders(leg, wires).map(inputNameAt);
294
+ if (inputNames.length === 0)
295
+ continue;
296
+ const symbol = leg.market?.symbol ?? 'currentSymbol';
297
+ unserved.push({
298
+ inputNames,
299
+ intervalKey: leg.intervalKey,
300
+ exchange,
301
+ symbol,
302
+ market: `${exchange}/${symbol}`,
303
+ reason: 'venue-unserved',
304
+ });
305
+ }
306
+ return { served, unserved };
307
+ }
308
+ /** Whether a leg's ask rides dataFetch's native-rows path: a leg whose market is index mode (its
309
+ * own venue, else the chart's for an own-market leg) or whose chart is, so its rows come back at
310
+ * their own stamps instead of realigned onto the chart's sparse grid (the step `dataFetch`
311
+ * applies in its A-1, A-2 and B-1 cases). A timestamp-mode leg on a timestamp-mode chart keeps
312
+ * the plain ask, byte-identical to before. */
313
+ export function wrunLegRidesNativeRows(leg, chartExchange) {
314
+ return checkIsIndexMode(leg.market?.exchange ?? chartExchange) || checkIsIndexMode(chartExchange);
315
+ }
316
+ /** The fetch option a leg's ask spreads in (the full run's lane ask and the tick's reconcile
317
+ * alike): `{ nativeRows: true }` for a leg that rides native rows, else nothing. */
318
+ export function wrunLegNativeRowsOption(leg, chartExchange) {
319
+ return wrunLegRidesNativeRows(leg, chartExchange) ? { nativeRows: true } : undefined;
320
+ }
@@ -0,0 +1,20 @@
1
+ /** The OpenMarket interval vocabulary an interval pin may use (the om
2
+ * schema enum, each mapped to the chart's own spelling, an
3
+ * `Intervals.map_unit` key). The short spellings are accepted too. Every
4
+ * entry is a FIXED span, which the as-of clock depends on: a candle
5
+ * stamped `ts` closes at `ts + ms` (a WEEK candle is stamped on its
6
+ * Monday, so its close is the next Monday). The chart's custom timeframes
7
+ * (the registry's `CUSTOM_INTERVALS`: 2m 3m 10m 45m 2h 6h 8h 12h 3d) join
8
+ * under the name of the wire interval the registry sends for each, which
9
+ * is om's word for it (`TWO_HOURS` for 2h): a leg rides the label, and the
10
+ * fetch sends it as that wire, as a chart pane and a kScript request do.
11
+ * Each opens on the epoch floor of its span, never Monday anchored. */
12
+ export declare const WRUN_PINNED_INTERVALS: Readonly<Record<string, string>>;
13
+ export interface WrunPinnedInterval {
14
+ /** The chart's spelling (what the fetch rides). */
15
+ key: string;
16
+ ms: number;
17
+ }
18
+ /** Resolve an interval pin's word (`FOUR_HOURS` or `4h`) to the chart's
19
+ * spelling and its span; undefined for anything outside the vocabulary. */
20
+ export declare function wrunPinnedIntervalOf(word: string | undefined): WrunPinnedInterval | undefined;
@@ -0,0 +1,47 @@
1
+ /**
2
+ * The interval pin vocabulary of a wrun source (`interval` on an input source): a thin fact the
3
+ * source lanes (wrun-source-rows.util) and the alert target's sheet reads
4
+ * (alert-overlay-target.util: the bell's mount gate and the resolver's server-served check) both
5
+ * parse synchronously, so the alert target reads it here without the source lanes behind it
6
+ * (docs/features/kscript/wrun/wrun-browser-runtime.md, "Boot doors").
7
+ */
8
+ import { AggregationInterval } from '@orangecharts/orange-v2-pb-common';
9
+ import { Intervals } from '../../constants/interval.constants.js';
10
+ import { CUSTOM_INTERVALS, grpcIntervalOf } from '../chart/interval-registry.util.js';
11
+ /** The OpenMarket interval vocabulary an interval pin may use (the om
12
+ * schema enum, each mapped to the chart's own spelling, an
13
+ * `Intervals.map_unit` key). The short spellings are accepted too. Every
14
+ * entry is a FIXED span, which the as-of clock depends on: a candle
15
+ * stamped `ts` closes at `ts + ms` (a WEEK candle is stamped on its
16
+ * Monday, so its close is the next Monday). The chart's custom timeframes
17
+ * (the registry's `CUSTOM_INTERVALS`: 2m 3m 10m 45m 2h 6h 8h 12h 3d) join
18
+ * under the name of the wire interval the registry sends for each, which
19
+ * is om's word for it (`TWO_HOURS` for 2h): a leg rides the label, and the
20
+ * fetch sends it as that wire, as a chart pane and a kScript request do.
21
+ * Each opens on the epoch floor of its span, never Monday anchored. */
22
+ export const WRUN_PINNED_INTERVALS = Object.freeze({
23
+ MINUTE: '1m',
24
+ FIVE_MINUTES: '5m',
25
+ FIFTEEN_MINUTES: '15m',
26
+ THIRTY_MINUTES: '30m',
27
+ HOUR: '1h',
28
+ FOUR_HOURS: '4h',
29
+ DAY: '1d',
30
+ WEEK: '1w',
31
+ ...Object.fromEntries(CUSTOM_INTERVALS.map((label) => [AggregationInterval[grpcIntervalOf(label)], label])),
32
+ });
33
+ /** Resolve an interval pin's word (`FOUR_HOURS` or `4h`) to the chart's
34
+ * spelling and its span; undefined for anything outside the vocabulary. */
35
+ export function wrunPinnedIntervalOf(word) {
36
+ if (typeof word !== 'string' || word.length === 0)
37
+ return undefined;
38
+ let key;
39
+ if (Object.prototype.hasOwnProperty.call(WRUN_PINNED_INTERVALS, word))
40
+ key = WRUN_PINNED_INTERVALS[word];
41
+ else if (Object.values(WRUN_PINNED_INTERVALS).includes(word))
42
+ key = word;
43
+ if (key === undefined)
44
+ return undefined;
45
+ const ms = Intervals.map_unit[key];
46
+ return typeof ms === 'number' && Number.isFinite(ms) && ms > 0 ? { key, ms } : undefined;
47
+ }
@@ -0,0 +1,23 @@
1
+ /**
2
+ * The engine gate's refusal types of wrun-plot-gate-notice.util.ts (which imports them back and re-exports them) as a
3
+ * type leaf: the child mount (wrun-panel-mount.util) judges its batched children with them, and it moves into the
4
+ * wrun chart-host package, which the notice's writers (the chart store, the chart group, i18n and the refusal
5
+ * surface) may not reach.
6
+ */
7
+ /** The chart a notice is written for (any engine instance). */
8
+ export interface WrunPlotGateChart {
9
+ metadata: ReadonlyArray<{
10
+ id: string;
11
+ }>;
12
+ }
13
+ /** Why the engine gate refused a batched child: its pack failed to load, or the engine has no
14
+ * renderer for its kind (an older chart). */
15
+ export type WrunPlotGateCause = 'pack-failed' | 'old-engine';
16
+ /** One refused child: its kind, its section name and the cause (and, for a layout newer than this
17
+ * build, why: diagnostic text, never copy). */
18
+ export interface WrunPlotGateRefusal {
19
+ kind: string;
20
+ name: string;
21
+ cause: WrunPlotGateCause;
22
+ reason?: string;
23
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * The engine gate's refusal types of wrun-plot-gate-notice.util.ts (which imports them back and re-exports them) as a
3
+ * type leaf: the child mount (wrun-panel-mount.util) judges its batched children with them, and it moves into the
4
+ * wrun chart-host package, which the notice's writers (the chart store, the chart group, i18n and the refusal
5
+ * surface) may not reach.
6
+ */
7
+ export {};
@@ -0,0 +1,37 @@
1
+ /**
2
+ * The `present` bitmask of the wrun options celled classes (UW-PARITY source contract v2, global
3
+ * rule 1): a host drops a tuple with any non-finite value, so every celled tuple of those classes
4
+ * ends with a `present` mask (a whole number in an f64), an absent value rides as 0 with its bit
5
+ * clear, and bit 14 marks a PARTIAL bar (a block cut down by `max_cells`, or history older than the
6
+ * retained floor or a fine tier's retention): a package treats such a bar as incomplete.
7
+ *
8
+ * The arithmetic is the om kit's own (`wrunOptionHasBit` / `wrunOptionWithBit` in
9
+ * wrun-option-cells.ts), so a mask the chart writes reads the same in a package. Pure, import-free.
10
+ */
11
+ /** The `present` bit that marks a partial bar, on every celled options class. */
12
+ export declare const WRUN_PRESENT_PARTIAL_BIT = 14;
13
+ /** Whether bit `bit` (0..52) is set in a `present` mask. A mask that is not a whole number from 0
14
+ * up, or a bit outside 0..52, reads false. */
15
+ export declare function wrunPresentHasBit(present: number, bit: number): boolean;
16
+ /** Whether a `present` mask marks a partial bar (bit 14). */
17
+ export declare function wrunPresentIsPartial(present: number): boolean;
18
+ /** A `present` mask with bit `bit` set (unchanged when it is set already, or when the mask or the bit
19
+ * is out of range). */
20
+ export declare function wrunPresentWithBit(present: number, bit: number): number;
21
+ /** A `present` mask marked partial (bit 14 set). */
22
+ export declare function wrunPresentWithPartial(present: number): number;
23
+ /** A mask of the named bits set, every other clear (bits outside 0..52 are ignored). */
24
+ export declare function wrunPresentMaskOf(bits: Iterable<number>): number;
25
+ /**
26
+ * Tuples of `width` f64s whose LAST column is a `present` mask, each marked partial: a copy whose
27
+ * mask has bit 14 set (a tuple of another width, or whose last column is not a mask, is kept as
28
+ * it is: the host's exact adapter drops it either way).
29
+ */
30
+ export declare function wrunTuplesMarkedPartial(tuples: ReadonlyArray<ReadonlyArray<number>>, width: number): number[][];
31
+ /**
32
+ * The marker tuple of a partial bar that holds no tuple at all (a bar older than every tier that could
33
+ * serve it): every value 0 (absent) and a `present` mask with bit 14 alone, so a package that reads
34
+ * the bar's block learns it is incomplete instead of reading "nothing happened". `width` counts the
35
+ * mask column.
36
+ */
37
+ export declare function wrunPartialMarkerTuple(width: number): number[];
@@ -0,0 +1,73 @@
1
+ /**
2
+ * The `present` bitmask of the wrun options celled classes (UW-PARITY source contract v2, global
3
+ * rule 1): a host drops a tuple with any non-finite value, so every celled tuple of those classes
4
+ * ends with a `present` mask (a whole number in an f64), an absent value rides as 0 with its bit
5
+ * clear, and bit 14 marks a PARTIAL bar (a block cut down by `max_cells`, or history older than the
6
+ * retained floor or a fine tier's retention): a package treats such a bar as incomplete.
7
+ *
8
+ * The arithmetic is the om kit's own (`wrunOptionHasBit` / `wrunOptionWithBit` in
9
+ * wrun-option-cells.ts), so a mask the chart writes reads the same in a package. Pure, import-free.
10
+ */
11
+ /** The `present` bit that marks a partial bar, on every celled options class. */
12
+ export const WRUN_PRESENT_PARTIAL_BIT = 14;
13
+ /** The highest bit a mask in an f64 can hold exactly (2^53 - 1 is the largest safe whole number). */
14
+ const WRUN_PRESENT_MAX_BIT = 52;
15
+ function isMask(present) {
16
+ return typeof present === 'number' && Number.isInteger(present) && present >= 0 && present <= Number.MAX_SAFE_INTEGER;
17
+ }
18
+ function isBit(bit) {
19
+ return typeof bit === 'number' && Number.isInteger(bit) && bit >= 0 && bit <= WRUN_PRESENT_MAX_BIT;
20
+ }
21
+ /** Whether bit `bit` (0..52) is set in a `present` mask. A mask that is not a whole number from 0
22
+ * up, or a bit outside 0..52, reads false. */
23
+ export function wrunPresentHasBit(present, bit) {
24
+ if (!isMask(present) || !isBit(bit))
25
+ return false;
26
+ return Math.floor(present / 2 ** bit) % 2 === 1;
27
+ }
28
+ /** Whether a `present` mask marks a partial bar (bit 14). */
29
+ export function wrunPresentIsPartial(present) {
30
+ return wrunPresentHasBit(present, WRUN_PRESENT_PARTIAL_BIT);
31
+ }
32
+ /** A `present` mask with bit `bit` set (unchanged when it is set already, or when the mask or the bit
33
+ * is out of range). */
34
+ export function wrunPresentWithBit(present, bit) {
35
+ if (!isMask(present) || !isBit(bit))
36
+ return present;
37
+ return wrunPresentHasBit(present, bit) ? present : present + 2 ** bit;
38
+ }
39
+ /** A `present` mask marked partial (bit 14 set). */
40
+ export function wrunPresentWithPartial(present) {
41
+ return wrunPresentWithBit(present, WRUN_PRESENT_PARTIAL_BIT);
42
+ }
43
+ /** A mask of the named bits set, every other clear (bits outside 0..52 are ignored). */
44
+ export function wrunPresentMaskOf(bits) {
45
+ let mask = 0;
46
+ for (const bit of bits)
47
+ mask = wrunPresentWithBit(mask, bit);
48
+ return mask;
49
+ }
50
+ /**
51
+ * Tuples of `width` f64s whose LAST column is a `present` mask, each marked partial: a copy whose
52
+ * mask has bit 14 set (a tuple of another width, or whose last column is not a mask, is kept as
53
+ * it is: the host's exact adapter drops it either way).
54
+ */
55
+ export function wrunTuplesMarkedPartial(tuples, width) {
56
+ return tuples.map((tuple) => {
57
+ const copy = [...tuple];
58
+ if (copy.length === width && isMask(copy[width - 1]))
59
+ copy[width - 1] = wrunPresentWithPartial(copy[width - 1]);
60
+ return copy;
61
+ });
62
+ }
63
+ /**
64
+ * The marker tuple of a partial bar that holds no tuple at all (a bar older than every tier that could
65
+ * serve it): every value 0 (absent) and a `present` mask with bit 14 alone, so a package that reads
66
+ * the bar's block learns it is incomplete instead of reading "nothing happened". `width` counts the
67
+ * mask column.
68
+ */
69
+ export function wrunPartialMarkerTuple(width) {
70
+ const tuple = new Array(Math.max(1, Math.floor(width))).fill(0);
71
+ tuple[tuple.length - 1] = wrunPresentWithPartial(0);
72
+ return tuple;
73
+ }
@@ -0,0 +1,33 @@
1
+ /**
2
+ * The protocol gate of a wrun source lane that reads a backend type by NAME (UW-PARITY FE lane rule 3): the
3
+ * transport sends a type as its id only when the installed protocol package (`@orangecharts/orange-v2-pb-common`)
4
+ * names it (`normalizeV2WireArgs`), and a point decodes only through the package's own message. Until the release
5
+ * that names the type, such a lane refuses by name before any fetch (`protocol-pending:<TYPE>`, seeded as
6
+ * `feed-missing` / `protocol-pending`, whose way out reloads the app: a newer app may carry the release); the
7
+ * release lights the lane up with no code change.
8
+ *
9
+ * Light at module load (a lane file imports it): the package is read lazily inside the async check, and the K
10
+ * controls and worker twins, which load the package anyway, read it synchronously (`wrunProtocolTypeIn`).
11
+ */
12
+ import { type WrunRefusalSeed } from './wrun-refusal.util.js';
13
+ /** The stem of the named refusal: `protocol-pending:<TYPE>`. */
14
+ export declare const WRUN_PROTOCOL_PENDING_CODE = "protocol-pending";
15
+ /** The named refusal of a type the protocol package does not name yet. */
16
+ export declare function wrunProtocolPendingCode(typeName: string): string;
17
+ /** Whether a protocol `Type` enum object names `typeName` (the K controls and worker twins hand their own import). */
18
+ export declare function wrunProtocolTypeIn(types: unknown, typeName: string): boolean;
19
+ /** Spec hook: the type names the protocol package is taken to name (`null` restores the installed package). */
20
+ export declare function __setWrunProtocolTypeNamesForTest(names: readonly string[] | null): void;
21
+ /** Whether the installed protocol package names `typeName` (its `Type` enum). */
22
+ export declare function wrunProtocolKnowsType(typeName: string): Promise<boolean>;
23
+ /** The record seed of the refusal: the lane's feed words, paused, the way out a reload. */
24
+ export declare function wrunProtocolPendingSeed(feed: string): WrunRefusalSeed;
25
+ /**
26
+ * Refuse an input by name, before any fetch, when the protocol package does not name the type its lane reads:
27
+ * `Input '<name>' (<class>) reads <TYPE>, which this version of the app cannot ask for yet
28
+ * (protocol-pending:<TYPE>)`. `feed` is the lane key the record's words name.
29
+ */
30
+ export declare function assertWrunProtocolType(ctx: {
31
+ inputName: string;
32
+ sourceClass: string;
33
+ }, typeName: string, feed: string): Promise<void>;
@@ -0,0 +1,57 @@
1
+ /**
2
+ * The protocol gate of a wrun source lane that reads a backend type by NAME (UW-PARITY FE lane rule 3): the
3
+ * transport sends a type as its id only when the installed protocol package (`@orangecharts/orange-v2-pb-common`)
4
+ * names it (`normalizeV2WireArgs`), and a point decodes only through the package's own message. Until the release
5
+ * that names the type, such a lane refuses by name before any fetch (`protocol-pending:<TYPE>`, seeded as
6
+ * `feed-missing` / `protocol-pending`, whose way out reloads the app: a newer app may carry the release); the
7
+ * release lights the lane up with no code change.
8
+ *
9
+ * Light at module load (a lane file imports it): the package is read lazily inside the async check, and the K
10
+ * controls and worker twins, which load the package anyway, read it synchronously (`wrunProtocolTypeIn`).
11
+ */
12
+ import { attachWrunRefusal } from './wrun-refusal.util.js';
13
+ /** The stem of the named refusal: `protocol-pending:<TYPE>`. */
14
+ export const WRUN_PROTOCOL_PENDING_CODE = 'protocol-pending';
15
+ /** The named refusal of a type the protocol package does not name yet. */
16
+ export function wrunProtocolPendingCode(typeName) {
17
+ return `${WRUN_PROTOCOL_PENDING_CODE}:${typeName}`;
18
+ }
19
+ /** Whether a protocol `Type` enum object names `typeName` (the K controls and worker twins hand their own import). */
20
+ export function wrunProtocolTypeIn(types, typeName) {
21
+ return (types !== null &&
22
+ typeof types === 'object' &&
23
+ typeof types[typeName] === 'number');
24
+ }
25
+ let typeNamesForTest = null;
26
+ /** Spec hook: the type names the protocol package is taken to name (`null` restores the installed package). */
27
+ export function __setWrunProtocolTypeNamesForTest(names) {
28
+ typeNamesForTest = names === null ? null : new Set(names);
29
+ }
30
+ /** Whether the installed protocol package names `typeName` (its `Type` enum). */
31
+ export async function wrunProtocolKnowsType(typeName) {
32
+ if (typeNamesForTest !== null)
33
+ return typeNamesForTest.has(typeName);
34
+ const { Type } = await import('@orangecharts/orange-v2-pb-common');
35
+ return wrunProtocolTypeIn(Type, typeName);
36
+ }
37
+ /** The record seed of the refusal: the lane's feed words, paused, the way out a reload. */
38
+ export function wrunProtocolPendingSeed(feed) {
39
+ return {
40
+ cls: 'feed-missing',
41
+ variant: 'protocol-pending',
42
+ params: { feed },
43
+ severity: 'paused',
44
+ out: { kind: 'reload' },
45
+ };
46
+ }
47
+ /**
48
+ * Refuse an input by name, before any fetch, when the protocol package does not name the type its lane reads:
49
+ * `Input '<name>' (<class>) reads <TYPE>, which this version of the app cannot ask for yet
50
+ * (protocol-pending:<TYPE>)`. `feed` is the lane key the record's words name.
51
+ */
52
+ export async function assertWrunProtocolType(ctx, typeName, feed) {
53
+ if (await wrunProtocolKnowsType(typeName))
54
+ return;
55
+ throw attachWrunRefusal(new Error(`Input '${ctx.inputName}' (${ctx.sourceClass}) reads ${typeName}, which this version of the app cannot ask ` +
56
+ `for yet (${wrunProtocolPendingCode(typeName)})`), wrunProtocolPendingSeed(feed));
57
+ }