@orangecharts/wrun-chart-host 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +72 -0
- package/dist/constants/governed-exchanges.constants.d.ts +11 -0
- package/dist/constants/governed-exchanges.constants.js +11 -0
- package/dist/constants/indicator-sets.constants.d.ts +8 -0
- package/dist/constants/indicator-sets.constants.js +8 -0
- package/dist/constants/interval.constants.d.ts +34 -0
- package/dist/constants/interval.constants.js +121 -0
- package/dist/constants/scriptEditor/technicalIndicatorScriptKeys.constants.d.ts +28 -0
- package/dist/constants/scriptEditor/technicalIndicatorScriptKeys.constants.js +65 -0
- package/dist/constants/tpo-color-schemes.constants.d.ts +30 -0
- package/dist/constants/tpo-color-schemes.constants.js +32 -0
- package/dist/host-env.d.ts +102 -0
- package/dist/host-env.js +26 -0
- package/dist/index.d.ts +93 -0
- package/dist/index.js +96 -0
- package/dist/indicators/controls/tpo-letter.util.d.ts +2 -0
- package/dist/indicators/controls/tpo-letter.util.js +13 -0
- package/dist/indicators/controls/tpo-session.util.d.ts +99 -0
- package/dist/indicators/controls/tpo-session.util.js +389 -0
- package/dist/interfaces/kscript-diagnostics.interface.d.ts +64 -0
- package/dist/interfaces/kscript-diagnostics.interface.js +1 -0
- package/dist/interfaces/om-panel-data.interface.d.ts +103 -0
- package/dist/interfaces/om-panel-data.interface.js +7 -0
- package/dist/interfaces/wrun-runtime.interface.d.ts +2659 -0
- package/dist/interfaces/wrun-runtime.interface.js +55 -0
- package/dist/utility/chart/calendar-interval.util.d.ts +24 -0
- package/dist/utility/chart/calendar-interval.util.js +81 -0
- package/dist/utility/chart/candle-bar-end.util.d.ts +15 -0
- package/dist/utility/chart/candle-bar-end.util.js +23 -0
- package/dist/utility/chart/cme-realtime.util.d.ts +24 -0
- package/dist/utility/chart/cme-realtime.util.js +53 -0
- package/dist/utility/chart/interval-ladder.util.d.ts +27 -0
- package/dist/utility/chart/interval-ladder.util.js +92 -0
- package/dist/utility/chart/kscript-drawing-prep.util.d.ts +40 -0
- package/dist/utility/chart/kscript-drawing-prep.util.js +184 -0
- package/dist/utility/chart/kscript-drawing-safe-area.util.d.ts +95 -0
- package/dist/utility/chart/kscript-drawing-safe-area.util.js +805 -0
- package/dist/utility/chart/kscript-legend-entries.util.d.ts +166 -0
- package/dist/utility/chart/kscript-legend-entries.util.js +538 -0
- package/dist/utility/chart/kscript-output-role.util.d.ts +32 -0
- package/dist/utility/chart/kscript-output-role.util.js +215 -0
- package/dist/utility/chart/kscript-provenance-keys.util.d.ts +22 -0
- package/dist/utility/chart/kscript-provenance-keys.util.js +56 -0
- package/dist/utility/chart/kscript-run-result-normalize.util.d.ts +53 -0
- package/dist/utility/chart/kscript-run-result-normalize.util.js +476 -0
- package/dist/utility/chart/kscript-run-result-shape.util.d.ts +14 -0
- package/dist/utility/chart/kscript-run-result-shape.util.js +66 -0
- package/dist/utility/chart/kscript-titancharts-container.util.d.ts +29 -0
- package/dist/utility/chart/kscript-titancharts-container.util.js +151 -0
- package/dist/utility/chart/kscript-viewport-overlays.util.d.ts +83 -0
- package/dist/utility/chart/kscript-viewport-overlays.util.js +443 -0
- package/dist/utility/chart/om-panel-push-style.util.d.ts +78 -0
- package/dist/utility/chart/om-panel-push-style.util.js +301 -0
- package/dist/utility/chart/om-panel.util.d.ts +166 -0
- package/dist/utility/chart/om-panel.util.js +815 -0
- package/dist/utility/chart/om-series.util.d.ts +42 -0
- package/dist/utility/chart/om-series.util.js +330 -0
- package/dist/utility/chart/om-target.util.d.ts +11 -0
- package/dist/utility/chart/om-target.util.js +24 -0
- package/dist/utility/chart/om-widget.util.d.ts +148 -0
- package/dist/utility/chart/om-widget.util.js +413 -0
- package/dist/utility/chart/overlay-output-budget.util.d.ts +16 -0
- package/dist/utility/chart/overlay-output-budget.util.js +109 -0
- package/dist/utility/chart/overlay-paint-flags.util.d.ts +24 -0
- package/dist/utility/chart/overlay-paint-flags.util.js +55 -0
- package/dist/utility/chart/profile-row-height.util.d.ts +21 -0
- package/dist/utility/chart/profile-row-height.util.js +110 -0
- package/dist/utility/chart/session-interval.util.d.ts +1 -0
- package/dist/utility/chart/session-interval.util.js +35 -0
- package/dist/utility/chart/technical-script-legend-value.util.d.ts +18 -0
- package/dist/utility/chart/technical-script-legend-value.util.js +53 -0
- package/dist/utility/chart/trading-day.util.d.ts +70 -0
- package/dist/utility/chart/trading-day.util.js +238 -0
- package/dist/utility/chart/wrun-legend-name.util.d.ts +25 -0
- package/dist/utility/chart/wrun-legend-name.util.js +87 -0
- package/dist/utility/chart/wrun-run-result.util.d.ts +977 -0
- package/dist/utility/chart/wrun-run-result.util.js +5179 -0
- package/dist/utility/chart/wrun-visibility-chart.util.d.ts +25 -0
- package/dist/utility/chart/wrun-visibility-chart.util.js +22 -0
- package/dist/utility/indicators/heatmap-sensitivity.util.d.ts +62 -0
- package/dist/utility/indicators/heatmap-sensitivity.util.js +82 -0
- package/dist/utility/number-format.util.d.ts +68 -0
- package/dist/utility/number-format.util.js +188 -0
- package/dist/utility/v2/opra-governed.util.d.ts +1 -0
- package/dist/utility/v2/opra-governed.util.js +13 -0
- package/dist/utility/wrun/wrun-auto-row.util.d.ts +54 -0
- package/dist/utility/wrun/wrun-auto-row.util.js +96 -0
- package/dist/utility/wrun/wrun-batched-marks.util.d.ts +341 -0
- package/dist/utility/wrun/wrun-batched-marks.util.js +938 -0
- package/dist/utility/wrun/wrun-batched-readout.util.d.ts +75 -0
- package/dist/utility/wrun/wrun-batched-readout.util.js +171 -0
- package/dist/utility/wrun/wrun-box-segment.util.d.ts +185 -0
- package/dist/utility/wrun/wrun-box-segment.util.js +570 -0
- package/dist/utility/wrun/wrun-build-memo.util.d.ts +133 -0
- package/dist/utility/wrun/wrun-build-memo.util.js +301 -0
- package/dist/utility/wrun/wrun-builtin-twin-ports.util.d.ts +25 -0
- package/dist/utility/wrun/wrun-builtin-twin-ports.util.js +75 -0
- package/dist/utility/wrun/wrun-builtin-twin.util.d.ts +9 -0
- package/dist/utility/wrun/wrun-builtin-twin.util.js +40 -0
- package/dist/utility/wrun/wrun-canvas-cache.util.d.ts +28 -0
- package/dist/utility/wrun/wrun-canvas-cache.util.js +56 -0
- package/dist/utility/wrun/wrun-canvas-readout.util.d.ts +69 -0
- package/dist/utility/wrun/wrun-canvas-readout.util.js +53 -0
- package/dist/utility/wrun/wrun-canvases.util.d.ts +295 -0
- package/dist/utility/wrun/wrun-canvases.util.js +1432 -0
- package/dist/utility/wrun/wrun-cap-notice.util.d.ts +77 -0
- package/dist/utility/wrun/wrun-cap-notice.util.js +296 -0
- package/dist/utility/wrun/wrun-card-style.util.d.ts +154 -0
- package/dist/utility/wrun/wrun-card-style.util.js +539 -0
- package/dist/utility/wrun/wrun-chart-context.util.d.ts +89 -0
- package/dist/utility/wrun/wrun-chart-context.util.js +213 -0
- package/dist/utility/wrun/wrun-chart-names.util.d.ts +23 -0
- package/dist/utility/wrun/wrun-chart-names.util.js +33 -0
- package/dist/utility/wrun/wrun-chart-time.util.d.ts +12 -0
- package/dist/utility/wrun/wrun-chart-time.util.js +23 -0
- package/dist/utility/wrun/wrun-child-overlay-id.util.d.ts +13 -0
- package/dist/utility/wrun/wrun-child-overlay-id.util.js +44 -0
- package/dist/utility/wrun/wrun-color-facts.util.d.ts +40 -0
- package/dist/utility/wrun/wrun-color-facts.util.js +88 -0
- package/dist/utility/wrun/wrun-color-settings.lazy.d.ts +26 -0
- package/dist/utility/wrun/wrun-color-settings.lazy.js +9 -0
- package/dist/utility/wrun/wrun-color-settings.util.d.ts +351 -0
- package/dist/utility/wrun/wrun-color-settings.util.js +1363 -0
- package/dist/utility/wrun/wrun-footprint-modes.util.d.ts +23 -0
- package/dist/utility/wrun/wrun-footprint-modes.util.js +24 -0
- package/dist/utility/wrun/wrun-frames.d.ts +217 -0
- package/dist/utility/wrun/wrun-frames.js +1021 -0
- package/dist/utility/wrun/wrun-handles.util.d.ts +792 -0
- package/dist/utility/wrun/wrun-handles.util.js +2050 -0
- package/dist/utility/wrun/wrun-heatmap-cell-budget.util.d.ts +156 -0
- package/dist/utility/wrun/wrun-heatmap-cell-budget.util.js +342 -0
- package/dist/utility/wrun/wrun-hosted-wire-caps.d.ts +218 -0
- package/dist/utility/wrun/wrun-hosted-wire-caps.js +667 -0
- package/dist/utility/wrun/wrun-hosted-wire.util.d.ts +40 -0
- package/dist/utility/wrun/wrun-hosted-wire.util.js +27 -0
- package/dist/utility/wrun/wrun-hover.util.d.ts +182 -0
- package/dist/utility/wrun/wrun-hover.util.js +534 -0
- package/dist/utility/wrun/wrun-hud-looks.util.d.ts +246 -0
- package/dist/utility/wrun/wrun-hud-looks.util.js +587 -0
- package/dist/utility/wrun/wrun-integration-budget.util.d.ts +47 -0
- package/dist/utility/wrun/wrun-integration-budget.util.js +122 -0
- package/dist/utility/wrun/wrun-latest-snapshot.d.ts +19 -0
- package/dist/utility/wrun/wrun-latest-snapshot.js +7 -0
- package/dist/utility/wrun/wrun-levels-child.util.d.ts +131 -0
- package/dist/utility/wrun/wrun-levels-child.util.js +514 -0
- package/dist/utility/wrun/wrun-lifecycle.contract.d.ts +75 -0
- package/dist/utility/wrun/wrun-lifecycle.contract.js +9 -0
- package/dist/utility/wrun/wrun-market-facts.util.d.ts +116 -0
- package/dist/utility/wrun/wrun-market-facts.util.js +238 -0
- package/dist/utility/wrun/wrun-output-style.util.d.ts +344 -0
- package/dist/utility/wrun/wrun-output-style.util.js +1239 -0
- package/dist/utility/wrun/wrun-overlay-identity.util.d.ts +84 -0
- package/dist/utility/wrun/wrun-overlay-identity.util.js +142 -0
- package/dist/utility/wrun/wrun-overlay-result.util.d.ts +120 -0
- package/dist/utility/wrun/wrun-overlay-result.util.js +219 -0
- package/dist/utility/wrun/wrun-pack.util.d.ts +70 -0
- package/dist/utility/wrun/wrun-pack.util.js +301 -0
- package/dist/utility/wrun/wrun-pane-format.util.d.ts +180 -0
- package/dist/utility/wrun/wrun-pane-format.util.js +299 -0
- package/dist/utility/wrun/wrun-panel-style.lazy.d.ts +25 -0
- package/dist/utility/wrun/wrun-panel-style.lazy.js +15 -0
- package/dist/utility/wrun/wrun-panel-style.util.d.ts +174 -0
- package/dist/utility/wrun/wrun-panel-style.util.js +726 -0
- package/dist/utility/wrun/wrun-param-values.util.d.ts +69 -0
- package/dist/utility/wrun/wrun-param-values.util.js +230 -0
- package/dist/utility/wrun/wrun-refusal.util.d.ts +263 -0
- package/dist/utility/wrun/wrun-refusal.util.js +1259 -0
- package/dist/utility/wrun/wrun-registry-errors.util.d.ts +199 -0
- package/dist/utility/wrun/wrun-registry-errors.util.js +257 -0
- package/dist/utility/wrun/wrun-render-select.util.d.ts +336 -0
- package/dist/utility/wrun/wrun-render-select.util.js +1157 -0
- package/dist/utility/wrun/wrun-script-inputs.util.d.ts +434 -0
- package/dist/utility/wrun/wrun-script-inputs.util.js +1971 -0
- package/dist/utility/wrun/wrun-setting-words.lazy.d.ts +20 -0
- package/dist/utility/wrun/wrun-setting-words.lazy.js +9 -0
- package/dist/utility/wrun/wrun-setting-words.util.d.ts +79 -0
- package/dist/utility/wrun/wrun-setting-words.util.js +176 -0
- package/dist/utility/wrun/wrun-socket-row-store.d.ts +98 -0
- package/dist/utility/wrun/wrun-socket-row-store.js +417 -0
- package/dist/utility/wrun/wrun-style-flags.util.d.ts +18 -0
- package/dist/utility/wrun/wrun-style-flags.util.js +21 -0
- package/dist/utility/wrun/wrun-style-words.util.d.ts +148 -0
- package/dist/utility/wrun/wrun-style-words.util.js +439 -0
- package/dist/utility/wrun/wrun-table-look.util.d.ts +125 -0
- package/dist/utility/wrun/wrun-table-look.util.js +225 -0
- package/dist/utility/wrun/wrun-text-look.util.d.ts +51 -0
- package/dist/utility/wrun/wrun-text-look.util.js +227 -0
- package/dist/utility/wrun/wrun-text-params.util.d.ts +106 -0
- package/dist/utility/wrun/wrun-text-params.util.js +171 -0
- package/dist/utility/wrun/wrun-tpo-rows.util.d.ts +71 -0
- package/dist/utility/wrun/wrun-tpo-rows.util.js +438 -0
- package/dist/utility/wrun/wrun-twin-compute-inputs.util.d.ts +14 -0
- package/dist/utility/wrun/wrun-twin-compute-inputs.util.js +58 -0
- package/dist/utility/wrun/wrun-visibility-table.d.ts +437 -0
- package/dist/utility/wrun/wrun-visibility-table.js +237 -0
- package/dist/utility/wrun/wrun-volume-profile.util.d.ts +37 -0
- package/dist/utility/wrun/wrun-volume-profile.util.js +278 -0
- package/package.json +38 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THE run-value derivation (`wrunParamValuesFromSettings`) and the host-fill context it reads, as a thin fact: the
|
|
3
|
+
* anchored tools' history demand reads it on the boot path, so it lives apart from the settings builders
|
|
4
|
+
* (wrun-script-inputs.util re-exports it) and keeps them off the pre-candle closure. Its imports are settings readers
|
|
5
|
+
* the boot path already holds.
|
|
6
|
+
*/
|
|
7
|
+
import type { WrunIndicatorMetadata, WrunMetadataParam } from '../../interfaces/wrun-runtime.interface.js';
|
|
8
|
+
/** What the host fills into `host_fill` params at run time: the chart
|
|
9
|
+
* market's tick size and price precision, the chart's bar interval in
|
|
10
|
+
* seconds, its background / text / candle up / candle down / grid colour as
|
|
11
|
+
* the kit's packed signed i32 (wrun-chart-context.util), and the market's
|
|
12
|
+
* five facts as their codes (wrun-chart-market-facts.util); absent = the
|
|
13
|
+
* declared default (0, unknown). */
|
|
14
|
+
export interface WrunHostFillContext {
|
|
15
|
+
tickSize?: number;
|
|
16
|
+
pricePrecision?: number;
|
|
17
|
+
intervalSec?: number;
|
|
18
|
+
bgColor?: number;
|
|
19
|
+
fgColor?: number;
|
|
20
|
+
/** WRUN-STYLE TH-candle-colors: `chart.up_color()`, `chart.down_color()`,
|
|
21
|
+
* `chart.grid_color()`. */
|
|
22
|
+
upColor?: number;
|
|
23
|
+
downColor?: number;
|
|
24
|
+
gridColor?: number;
|
|
25
|
+
/** WRUN-GAPS-1005, `market.kind()`, `market.point_value()`, `market.zone()`
|
|
26
|
+
* and `market.quote_is_usd()`: the kind code, the point value, the zone
|
|
27
|
+
* index and the quote code of the chart's market. */
|
|
28
|
+
kind?: number;
|
|
29
|
+
pointValue?: number;
|
|
30
|
+
zone?: number;
|
|
31
|
+
quoteIsUsd?: number;
|
|
32
|
+
/** WRUN-SESSION, `market.session_open()`: the minute on the market's clock
|
|
33
|
+
* its trade day opens (1020 on the CME family, else 0). The context carries
|
|
34
|
+
* it from wrunMarketFactsFor now; paramRunValue reads it once the chart's
|
|
35
|
+
* kit pin (0.65.0) has the `session_open` host_fill word. */
|
|
36
|
+
sessionOpen?: number;
|
|
37
|
+
}
|
|
38
|
+
export declare function nonEmptyString(value: unknown): string | undefined;
|
|
39
|
+
export declare function finiteNumber(value: unknown): number | undefined;
|
|
40
|
+
/** A multi param's option labels, index i = bit i: `option_labels` (padded
|
|
41
|
+
* or cut to `multi_bits` when declared). Empty when the sheet gives none. */
|
|
42
|
+
export declare function wrunMultiLabels(param: WrunMetadataParam): string[];
|
|
43
|
+
/** A time param's value as epoch seconds: a finite number (milliseconds
|
|
44
|
+
* scaled down), a numeric text, `YYYY-MM-DD` or `YYYY-MM-DD HH:MM[:SS]`
|
|
45
|
+
* (UTC), or any ISO instant; undefined when unusable. */
|
|
46
|
+
export declare function wrunTimeValue(raw: unknown): number | undefined;
|
|
47
|
+
export declare function toggleValue(raw: unknown): boolean | undefined;
|
|
48
|
+
export declare function numericValue(raw: unknown): number | undefined;
|
|
49
|
+
/** A bitmask from a number, a numeric string, or a list of bit indexes
|
|
50
|
+
* (arithmetic: a mask may outgrow 32-bit bitwise ops). */
|
|
51
|
+
export declare function bitmaskValue(raw: unknown): number | undefined;
|
|
52
|
+
/** The param values a run computes with, by name (the ONE derivation of the
|
|
53
|
+
* run's init() arguments, buildWrunInitArgs over these; the alert arm and
|
|
54
|
+
* the cloud createScript lane pack the same numbers): the overlay's flat
|
|
55
|
+
* setting as a finite number, else the declared default, else 0. A number
|
|
56
|
+
* field's value as is, a toggle 1/0, a select its option value as a number
|
|
57
|
+
* (a host-applied select's index; a label or an index into the options
|
|
58
|
+
* resolves, an index past them reads as the default), a colour param the
|
|
59
|
+
* packed colour of its setting (its own key, or its element of the
|
|
60
|
+
* colour-array row), else of its default, a time epoch seconds (a UTC
|
|
61
|
+
* `YYYY-MM-DD HH:MM` text parses, epoch milliseconds scale down), a price a
|
|
62
|
+
* number, a multi its bitmask within the declared options (a list of bit
|
|
63
|
+
* indexes folds), a list its slots and count (`<name>_i`, `<name>_n`, or
|
|
64
|
+
* one array under the composite key), a range its `_lo` / `_hi`, a session its
|
|
65
|
+
* minutes (an `HH:MM` text parses) and tz index, a unit its `_unit` index,
|
|
66
|
+
* a symbol 0, a `host_fill` param the chart market's tick size, price
|
|
67
|
+
* precision or fact code from `host` (else its default). Never NaN. An om style knob
|
|
68
|
+
* has none (it never reaches init()); style rows are not params. */
|
|
69
|
+
export declare function wrunParamValuesFromSettings(metadata: Pick<WrunIndicatorMetadata, 'params'>, settings: unknown, host?: WrunHostFillContext): Record<string, number>;
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import { isWrunColorParam, isWrunStyleParam, wrunColorArrayMembers, wrunColorParamPacked, wrunParamChoices, wrunSelectParamValue, } from './wrun-color-settings.util.js';
|
|
2
|
+
import { wrunTextByteLength, wrunTextParamValue } from './wrun-text-params.util.js';
|
|
3
|
+
export function nonEmptyString(value) {
|
|
4
|
+
return typeof value === 'string' && value.trim() !== '' ? value : undefined;
|
|
5
|
+
}
|
|
6
|
+
export function finiteNumber(value) {
|
|
7
|
+
return typeof value === 'number' && Number.isFinite(value) ? value : undefined;
|
|
8
|
+
}
|
|
9
|
+
/** A multi param's option labels, index i = bit i: `option_labels` (padded
|
|
10
|
+
* or cut to `multi_bits` when declared). Empty when the sheet gives none. */
|
|
11
|
+
export function wrunMultiLabels(param) {
|
|
12
|
+
const labels = Array.isArray(param.option_labels) ? param.option_labels : [];
|
|
13
|
+
const bits = finiteNumber(param.multi_bits);
|
|
14
|
+
const count = bits !== undefined && Number.isInteger(bits) && bits > 0 ? bits : labels.length;
|
|
15
|
+
return Array.from({ length: count }, (_, at) => nonEmptyString(labels[at]) ?? String(at));
|
|
16
|
+
}
|
|
17
|
+
/** Epoch seconds can only reach this in the year 5138: a time at or past
|
|
18
|
+
* it is epoch MILLISECONDS (the chart's own clock, what a chart pick
|
|
19
|
+
* hands over) and reads as such. */
|
|
20
|
+
const WRUN_EPOCH_MS_FLOOR = 1e11;
|
|
21
|
+
/** A time param's value as epoch seconds: a finite number (milliseconds
|
|
22
|
+
* scaled down), a numeric text, `YYYY-MM-DD` or `YYYY-MM-DD HH:MM[:SS]`
|
|
23
|
+
* (UTC), or any ISO instant; undefined when unusable. */
|
|
24
|
+
export function wrunTimeValue(raw) {
|
|
25
|
+
if (typeof raw === 'number') {
|
|
26
|
+
if (!Number.isFinite(raw))
|
|
27
|
+
return undefined;
|
|
28
|
+
return Math.abs(raw) >= WRUN_EPOCH_MS_FLOOR ? raw / 1000 : raw;
|
|
29
|
+
}
|
|
30
|
+
if (typeof raw !== 'string')
|
|
31
|
+
return undefined;
|
|
32
|
+
const trimmed = raw.trim();
|
|
33
|
+
if (trimmed === '')
|
|
34
|
+
return undefined;
|
|
35
|
+
const numeric = Number(trimmed);
|
|
36
|
+
if (Number.isFinite(numeric))
|
|
37
|
+
return wrunTimeValue(numeric);
|
|
38
|
+
const plain = /^(\d{4})-(\d{2})-(\d{2})(?:[ T](\d{2}):(\d{2})(?::(\d{2}))?)?$/.exec(trimmed);
|
|
39
|
+
if (plain) {
|
|
40
|
+
const [, y, m, d, hh = '0', mm = '0', ss = '0'] = plain;
|
|
41
|
+
return Date.UTC(Number(y), Number(m) - 1, Number(d), Number(hh), Number(mm), Number(ss)) / 1000;
|
|
42
|
+
}
|
|
43
|
+
const parsed = Date.parse(trimmed);
|
|
44
|
+
return Number.isFinite(parsed) ? parsed / 1000 : undefined;
|
|
45
|
+
}
|
|
46
|
+
/** A session edge as minutes from midnight: a finite number as itself, an
|
|
47
|
+
* `HH:MM` clock text (00:00 to 23:59), a numeric text. */
|
|
48
|
+
function parseWrunMinutes(raw) {
|
|
49
|
+
if (typeof raw === 'number')
|
|
50
|
+
return Number.isFinite(raw) ? raw : undefined;
|
|
51
|
+
if (typeof raw !== 'string')
|
|
52
|
+
return undefined;
|
|
53
|
+
const clock = /^(\d{1,2}):(\d{2})$/.exec(raw.trim());
|
|
54
|
+
if (clock) {
|
|
55
|
+
const [hours, minutes] = [Number(clock[1]), Number(clock[2])];
|
|
56
|
+
return hours <= 23 && minutes <= 59 ? hours * 60 + minutes : undefined;
|
|
57
|
+
}
|
|
58
|
+
const numeric = Number(raw);
|
|
59
|
+
return raw.trim() !== '' && Number.isFinite(numeric) ? numeric : undefined;
|
|
60
|
+
}
|
|
61
|
+
export function toggleValue(raw) {
|
|
62
|
+
if (typeof raw === 'boolean')
|
|
63
|
+
return raw;
|
|
64
|
+
if (typeof raw === 'number')
|
|
65
|
+
return Number.isFinite(raw) ? raw !== 0 : undefined;
|
|
66
|
+
if (typeof raw === 'string') {
|
|
67
|
+
const word = raw.trim().toLowerCase();
|
|
68
|
+
if (word === 'true' || word === '1' || word === 'on')
|
|
69
|
+
return true;
|
|
70
|
+
if (word === 'false' || word === '0' || word === 'off')
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
return undefined;
|
|
74
|
+
}
|
|
75
|
+
export function numericValue(raw) {
|
|
76
|
+
if (typeof raw === 'number')
|
|
77
|
+
return Number.isFinite(raw) ? raw : undefined;
|
|
78
|
+
if (typeof raw === 'string' && raw.trim() !== '') {
|
|
79
|
+
const value = Number(raw);
|
|
80
|
+
return Number.isFinite(value) ? value : undefined;
|
|
81
|
+
}
|
|
82
|
+
return undefined;
|
|
83
|
+
}
|
|
84
|
+
/** A bitmask from a number, a numeric string, or a list of bit indexes
|
|
85
|
+
* (arithmetic: a mask may outgrow 32-bit bitwise ops). */
|
|
86
|
+
export function bitmaskValue(raw) {
|
|
87
|
+
if (Array.isArray(raw)) {
|
|
88
|
+
const bits = new Set();
|
|
89
|
+
for (const bit of raw) {
|
|
90
|
+
const index = numericValue(bit);
|
|
91
|
+
if (index === undefined || !Number.isInteger(index) || index < 0 || index > 52)
|
|
92
|
+
return undefined;
|
|
93
|
+
bits.add(index);
|
|
94
|
+
}
|
|
95
|
+
return [...bits].reduce((mask, index) => mask + 2 ** index, 0);
|
|
96
|
+
}
|
|
97
|
+
const value = numericValue(raw);
|
|
98
|
+
return value === undefined ? undefined : Math.max(0, Math.floor(value));
|
|
99
|
+
}
|
|
100
|
+
function finiteOr(value, fallback) {
|
|
101
|
+
return value !== undefined && Number.isFinite(value) ? value : fallback;
|
|
102
|
+
}
|
|
103
|
+
/** One param's run value from the flat settings (see wrunParamValuesFromSettings). */
|
|
104
|
+
function paramRunValue(param, flat, host) {
|
|
105
|
+
const fallback = typeof param.default === 'number' && Number.isFinite(param.default) ? param.default : 0;
|
|
106
|
+
if (param.host_fill === 'tick_size')
|
|
107
|
+
return finiteOr(finiteNumber(host?.tickSize), fallback);
|
|
108
|
+
if (param.host_fill === 'price_precision')
|
|
109
|
+
return finiteOr(finiteNumber(host?.pricePrecision), fallback);
|
|
110
|
+
if (param.host_fill === 'interval_sec')
|
|
111
|
+
return finiteOr(finiteNumber(host?.intervalSec), fallback);
|
|
112
|
+
if (param.host_fill === 'bg_color')
|
|
113
|
+
return finiteOr(finiteNumber(host?.bgColor), fallback);
|
|
114
|
+
if (param.host_fill === 'fg_color')
|
|
115
|
+
return finiteOr(finiteNumber(host?.fgColor), fallback);
|
|
116
|
+
if (param.host_fill === 'up_color')
|
|
117
|
+
return finiteOr(finiteNumber(host?.upColor), fallback);
|
|
118
|
+
if (param.host_fill === 'down_color')
|
|
119
|
+
return finiteOr(finiteNumber(host?.downColor), fallback);
|
|
120
|
+
if (param.host_fill === 'grid_color')
|
|
121
|
+
return finiteOr(finiteNumber(host?.gridColor), fallback);
|
|
122
|
+
if (param.host_fill === 'kind')
|
|
123
|
+
return finiteOr(finiteNumber(host?.kind), fallback);
|
|
124
|
+
if (param.host_fill === 'point_value')
|
|
125
|
+
return finiteOr(finiteNumber(host?.pointValue), fallback);
|
|
126
|
+
if (param.host_fill === 'zone')
|
|
127
|
+
return finiteOr(finiteNumber(host?.zone), fallback);
|
|
128
|
+
if (param.host_fill === 'quote_is_usd')
|
|
129
|
+
return finiteOr(finiteNumber(host?.quoteIsUsd), fallback);
|
|
130
|
+
if (param.host_fill === 'session_open')
|
|
131
|
+
return finiteOr(finiteNumber(host?.sessionOpen), fallback);
|
|
132
|
+
const raw = flat?.[param.name];
|
|
133
|
+
switch (param.type) {
|
|
134
|
+
case 'symbol':
|
|
135
|
+
// The pick is a string the browser host applies to the bound inputs;
|
|
136
|
+
// the module's slot stays 0 on every host.
|
|
137
|
+
return 0;
|
|
138
|
+
case 'text':
|
|
139
|
+
// The init slot carries the UTF-8 byte count of the words the text
|
|
140
|
+
// channel hands over (wrunTextParamsForRun reads the same value), so
|
|
141
|
+
// init arg counts match on every host and a host without the channel
|
|
142
|
+
// still serves the slot.
|
|
143
|
+
return wrunTextByteLength(wrunTextParamValue(param, raw));
|
|
144
|
+
case 'boolean': {
|
|
145
|
+
const own = Number(raw);
|
|
146
|
+
if (Number.isFinite(own))
|
|
147
|
+
return own !== 0 ? 1 : 0;
|
|
148
|
+
const word = toggleValue(raw);
|
|
149
|
+
return (word === undefined ? fallback !== 0 : word) ? 1 : 0;
|
|
150
|
+
}
|
|
151
|
+
case 'time':
|
|
152
|
+
return finiteOr(wrunTimeValue(raw), fallback);
|
|
153
|
+
case 'multi': {
|
|
154
|
+
const mask = bitmaskValue(raw);
|
|
155
|
+
if (mask === undefined)
|
|
156
|
+
return fallback;
|
|
157
|
+
// Bits past the declared options (a mask stored before the author
|
|
158
|
+
// dropped one) fall away; clamping would switch every option on.
|
|
159
|
+
const bits = wrunMultiLabels(param).length;
|
|
160
|
+
return bits > 0 ? mask % 2 ** bits : mask;
|
|
161
|
+
}
|
|
162
|
+
case 'select': {
|
|
163
|
+
// The one select read (the dialog's, the sheet seam's): an option value
|
|
164
|
+
// or label resolves to its value, an integer that names no option reads
|
|
165
|
+
// as an index into the options, anything else (an index past them: a
|
|
166
|
+
// choice persisted before the author dropped an option) keeps the
|
|
167
|
+
// declared default. So the module never receives an unclamped index,
|
|
168
|
+
// and the init arg is the value the dialog shows. A select without a
|
|
169
|
+
// usable choice set is the number field below.
|
|
170
|
+
if (wrunParamChoices(param) === undefined)
|
|
171
|
+
break;
|
|
172
|
+
return wrunSelectParamValue(param, raw) ?? fallback;
|
|
173
|
+
}
|
|
174
|
+
default:
|
|
175
|
+
break;
|
|
176
|
+
}
|
|
177
|
+
if (param.session_end === 'start' || param.session_end === 'end')
|
|
178
|
+
return finiteOr(parseWrunMinutes(raw), fallback);
|
|
179
|
+
// The pre-key read, byte for byte: Number() of the flat setting (a toggle
|
|
180
|
+
// stored as true/false reads 1/0, a select's numeric string its value).
|
|
181
|
+
const own = Number(raw);
|
|
182
|
+
if (Number.isFinite(own))
|
|
183
|
+
return own;
|
|
184
|
+
const list = nonEmptyString(param.list);
|
|
185
|
+
if (list !== undefined) {
|
|
186
|
+
// The composite's own key, when a caller stores the list as one array.
|
|
187
|
+
const array = flat?.[list];
|
|
188
|
+
if (Array.isArray(array)) {
|
|
189
|
+
if (param.list_end === 'count')
|
|
190
|
+
return array.length;
|
|
191
|
+
if (typeof param.list_index === 'number')
|
|
192
|
+
return finiteOr(numericValue(array[param.list_index]), fallback);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
return fallback;
|
|
196
|
+
}
|
|
197
|
+
/** The param values a run computes with, by name (the ONE derivation of the
|
|
198
|
+
* run's init() arguments, buildWrunInitArgs over these; the alert arm and
|
|
199
|
+
* the cloud createScript lane pack the same numbers): the overlay's flat
|
|
200
|
+
* setting as a finite number, else the declared default, else 0. A number
|
|
201
|
+
* field's value as is, a toggle 1/0, a select its option value as a number
|
|
202
|
+
* (a host-applied select's index; a label or an index into the options
|
|
203
|
+
* resolves, an index past them reads as the default), a colour param the
|
|
204
|
+
* packed colour of its setting (its own key, or its element of the
|
|
205
|
+
* colour-array row), else of its default, a time epoch seconds (a UTC
|
|
206
|
+
* `YYYY-MM-DD HH:MM` text parses, epoch milliseconds scale down), a price a
|
|
207
|
+
* number, a multi its bitmask within the declared options (a list of bit
|
|
208
|
+
* indexes folds), a list its slots and count (`<name>_i`, `<name>_n`, or
|
|
209
|
+
* one array under the composite key), a range its `_lo` / `_hi`, a session its
|
|
210
|
+
* minutes (an `HH:MM` text parses) and tz index, a unit its `_unit` index,
|
|
211
|
+
* a symbol 0, a `host_fill` param the chart market's tick size, price
|
|
212
|
+
* precision or fact code from `host` (else its default). Never NaN. An om style knob
|
|
213
|
+
* has none (it never reaches init()); style rows are not params. */
|
|
214
|
+
export function wrunParamValuesFromSettings(metadata, settings, host) {
|
|
215
|
+
const flat = settings !== null && typeof settings === 'object' ? settings : undefined;
|
|
216
|
+
const params = metadata.params ?? [];
|
|
217
|
+
const members = wrunColorArrayMembers(params);
|
|
218
|
+
const values = {};
|
|
219
|
+
for (const param of params) {
|
|
220
|
+
if (isWrunStyleParam(param))
|
|
221
|
+
continue;
|
|
222
|
+
if (isWrunColorParam(param)) {
|
|
223
|
+
values[param.name] = wrunColorParamPacked(param, flat, members);
|
|
224
|
+
continue;
|
|
225
|
+
}
|
|
226
|
+
const value = paramRunValue(param, flat, host);
|
|
227
|
+
values[param.name] = Number.isFinite(value) ? value : 0;
|
|
228
|
+
}
|
|
229
|
+
return values;
|
|
230
|
+
}
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
import { WRUN_KIT_REFUSAL_STAGES, wrunKitRefusalStageOf, type WrunFrameRefusal, type WrunKitRefusalStage } from './wrun-hosted-wire-caps.js';
|
|
2
|
+
export type WrunRefusalClass = 'legs-empty' | 'feed-missing' | 'no-options' | 'coin-outside-feed' | 'interval-unserved' | 'service-no-answer' | 'waiting' | 'cme-wall' | 'pin-refused' | 'index-unserved' | 'too-big' | 'live-stopped' | 'not-reached' | 'nothing-ready' | 'slots' | 'not-added' | 'run-failed';
|
|
3
|
+
export type WrunRefusalOut = {
|
|
4
|
+
kind: 'switch-market';
|
|
5
|
+
exchange: string;
|
|
6
|
+
symbol: string;
|
|
7
|
+
label: string;
|
|
8
|
+
} | {
|
|
9
|
+
kind: 'works-on';
|
|
10
|
+
} | {
|
|
11
|
+
kind: 'try-interval';
|
|
12
|
+
interval: string;
|
|
13
|
+
} | {
|
|
14
|
+
kind: 'open-settings';
|
|
15
|
+
} | {
|
|
16
|
+
kind: 'retry';
|
|
17
|
+
}
|
|
18
|
+
/** A live session the row cap stopped: the overlay's full rerun (the door's Retry) restarts it. */
|
|
19
|
+
| {
|
|
20
|
+
kind: 'resume-live';
|
|
21
|
+
} | {
|
|
22
|
+
kind: 'free-slots';
|
|
23
|
+
} | {
|
|
24
|
+
kind: 'go-to-line';
|
|
25
|
+
line: number;
|
|
26
|
+
} | {
|
|
27
|
+
kind: 'open-editor';
|
|
28
|
+
}
|
|
29
|
+
/** Draft targets only: run the tab on its chart without a window. */
|
|
30
|
+
| {
|
|
31
|
+
kind: 'run-on-chart';
|
|
32
|
+
}
|
|
33
|
+
/** A failure a rerun repeats on a source that cannot be opened: report it (the legend card's own
|
|
34
|
+
* Report button stands for it). */
|
|
35
|
+
| {
|
|
36
|
+
kind: 'report';
|
|
37
|
+
}
|
|
38
|
+
/** The app cannot read what the cloud answered (a reply without the hosted wire): reload the page,
|
|
39
|
+
* which loads the app the cloud speaks to. */
|
|
40
|
+
| {
|
|
41
|
+
kind: 'reload';
|
|
42
|
+
};
|
|
43
|
+
export interface WrunRefusalMarket {
|
|
44
|
+
exchange: string;
|
|
45
|
+
symbol: string;
|
|
46
|
+
coin?: string;
|
|
47
|
+
label: string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* What a record carries for the monitoring join (WRUN-REPORTS-CLASSES C1), never words: the socket ask and the
|
|
51
|
+
* run attempt it answered, and how the server's answer read (wrun-hosted-wire-caps `wrunServerAnswerVerdict`).
|
|
52
|
+
* Written after `details` in the canonical string, each only when present.
|
|
53
|
+
*/
|
|
54
|
+
export interface WrunRefusalTelemetry {
|
|
55
|
+
/** The cloud ask's socket stamp (`wrun-socket-<chart>-<overlay>-<n>`): the server's refusal line carries it too. */
|
|
56
|
+
clientRequestId?: string;
|
|
57
|
+
/** The run attempt the refusal answered (the refusal surface's token, `<chart>:<overlay>#<generation>`). */
|
|
58
|
+
attemptId?: string;
|
|
59
|
+
/** The server superseded the overlay's live session from elsewhere (another chart or tab took its instance id). */
|
|
60
|
+
foreignSupersede?: true;
|
|
61
|
+
/** The server answered a code the answer table has no row for: shown with its code. */
|
|
62
|
+
unknownCode?: true;
|
|
63
|
+
}
|
|
64
|
+
/** The ONE record, serialized in this key order with the params sorted by key. */
|
|
65
|
+
export interface WrunRefusal extends WrunRefusalTelemetry {
|
|
66
|
+
v: 1;
|
|
67
|
+
cls: WrunRefusalClass;
|
|
68
|
+
/** C2 maps (cls, variant) to the sentence and chip keys. */
|
|
69
|
+
variant: string;
|
|
70
|
+
indicatorName: string;
|
|
71
|
+
market?: WrunRefusalMarket;
|
|
72
|
+
/** Exactly the C2 variant's params; `count` / `n` is the plural choice. */
|
|
73
|
+
params: Readonly<Record<string, string | number>>;
|
|
74
|
+
/** note: drew with a gap; paused: nothing drawn. */
|
|
75
|
+
severity: 'note' | 'paused';
|
|
76
|
+
out: WrunRefusalOut;
|
|
77
|
+
/** The raiser's technical text: Copy details, and a run-failed record's detail line (its first line). */
|
|
78
|
+
details: string;
|
|
79
|
+
}
|
|
80
|
+
export type WrunRefusalOverlayTarget = {
|
|
81
|
+
chartIndex: number;
|
|
82
|
+
indicatorId: string;
|
|
83
|
+
};
|
|
84
|
+
/** The chart the refused run targeted (never "the active chart") and its window intent. */
|
|
85
|
+
export type WrunRefusalDraftTarget = {
|
|
86
|
+
tabId: string;
|
|
87
|
+
chartIndex: number;
|
|
88
|
+
window: boolean;
|
|
89
|
+
};
|
|
90
|
+
export interface WrunRefusalSeed {
|
|
91
|
+
cls: WrunRefusalClass;
|
|
92
|
+
variant?: string;
|
|
93
|
+
params?: Record<string, string | number>;
|
|
94
|
+
market?: WrunRefusalMarket;
|
|
95
|
+
out?: WrunRefusalOut;
|
|
96
|
+
severity?: 'note' | 'paused';
|
|
97
|
+
}
|
|
98
|
+
export interface WrunRefusalContext {
|
|
99
|
+
indicatorName: string;
|
|
100
|
+
/** The source can be opened in the editor (`wrunOverlayEditable`), never assumed. */
|
|
101
|
+
editable: boolean;
|
|
102
|
+
hasSettings: boolean;
|
|
103
|
+
chart?: {
|
|
104
|
+
exchange: string;
|
|
105
|
+
symbol: string;
|
|
106
|
+
coin?: string;
|
|
107
|
+
interval?: string;
|
|
108
|
+
indexMode: boolean;
|
|
109
|
+
cme: boolean;
|
|
110
|
+
cryptoVenue: boolean;
|
|
111
|
+
};
|
|
112
|
+
/** The declared source class of an input by index (picks the too-big variant). */
|
|
113
|
+
inputClassAt?: (inputIndex: number) => string | undefined;
|
|
114
|
+
/** The caller's `wrunSwitchTargetFor` answer (C5), so this module stays pure. */
|
|
115
|
+
switchTarget?: WrunRefusalOut;
|
|
116
|
+
}
|
|
117
|
+
export type WrunRefusalAttemptToken = {
|
|
118
|
+
key: string;
|
|
119
|
+
generation: number;
|
|
120
|
+
origin: 'user' | 'system';
|
|
121
|
+
};
|
|
122
|
+
export interface WrunAddGateRefusal {
|
|
123
|
+
reason: 'slots' | 'cme-venue' | 'mode' | 'pane-budget' | 'duplicate' | 'chart-gone' | 'other';
|
|
124
|
+
slots?: {
|
|
125
|
+
charge: number;
|
|
126
|
+
used: number;
|
|
127
|
+
limit: number;
|
|
128
|
+
scope: 'chart' | 'layout';
|
|
129
|
+
chartIndex: number;
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
/** Every class, in the C2 precedence order (paused before note decides first). */
|
|
133
|
+
export declare const WRUN_REFUSAL_CLASSES: readonly WrunRefusalClass[];
|
|
134
|
+
/**
|
|
135
|
+
* The label of an odds leg's market when its input has no description ("the event market").
|
|
136
|
+
* wrun-overlay-run.util reads it into a refusal's market label and `markets` param when the leg
|
|
137
|
+
* refuses, which can happen during a boot restore, and that module loads lazily (outside the
|
|
138
|
+
* pre-candle closure). The full literal key lives here, in the closure, so the boot scanner keeps
|
|
139
|
+
* it in the boot locale bundle and the refusal never stores the untranslated key.
|
|
140
|
+
*/
|
|
141
|
+
export declare const WRUN_REFUSAL_EVENT_MARKET_KEY = "wrun.refusal.market.event";
|
|
142
|
+
/**
|
|
143
|
+
* The words of every row-builder class and registered poll lane (C4 `feed`): a `feed` param holds
|
|
144
|
+
* a builtin class (`trade_volume_by_size`) or a lane key (`bitfinex_margin_rate`; a class served
|
|
145
|
+
* by several lanes is named by the lane its input reads). Full literal keys, so the boot scanner
|
|
146
|
+
* harvests them. The spec fails when a builtin class or a registered lane has no row here.
|
|
147
|
+
*/
|
|
148
|
+
export declare const WRUN_REFUSAL_FEED_KEYS: Readonly<Record<string, string>>;
|
|
149
|
+
/** The full literal key of a feed's words, or undefined for a word that names no feed. */
|
|
150
|
+
export declare function wrunRefusalFeedKey(feed: unknown): string | undefined;
|
|
151
|
+
/** The variants of a class, in C2 order (the spec walks every one). */
|
|
152
|
+
export declare function wrunRefusalVariants(cls: WrunRefusalClass): string[];
|
|
153
|
+
/** Equal records give equal strings: a fixed key order, the params sorted by key, the telemetry last. */
|
|
154
|
+
export declare function serializeWrunRefusal(r: WrunRefusal): string;
|
|
155
|
+
/** The record a value holds (its canonical string, or the object itself), or null for anything
|
|
156
|
+
* that is not a well-formed `v: 1` record. */
|
|
157
|
+
export declare function parseWrunRefusal(value: unknown): WrunRefusal | null;
|
|
158
|
+
/** C2 precedence: paused before note, then the class order, then the canonical string (a total
|
|
159
|
+
* order, so the top refusal of a set never depends on arrival order). */
|
|
160
|
+
export declare function compareWrunRefusals(a: WrunRefusal, b: WrunRefusal): number;
|
|
161
|
+
/** Attach the raiser's seed to the error it throws. The nearest raiser wins: a seed already on the
|
|
162
|
+
* error stays. A non-object throwable is returned as it is. */
|
|
163
|
+
export declare function attachWrunRefusal<T>(error: T, seed: WrunRefusalSeed): T;
|
|
164
|
+
/** The seed a raiser attached, or undefined. */
|
|
165
|
+
export declare function wrunRefusalSeedOf(error: unknown): WrunRefusalSeed | undefined;
|
|
166
|
+
/** Annotate the completed record on the error (the decision of the outermost site that made it:
|
|
167
|
+
* a later annotation replaces an earlier one), so a caller downstream (the loader's catch, the
|
|
168
|
+
* editor console) reads the same record instead of deciding again. */
|
|
169
|
+
export declare function annotateWrunErrorRefusal<T>(error: T, r: WrunRefusal): T;
|
|
170
|
+
/** The completed record an error carries, or undefined. */
|
|
171
|
+
export declare function wrunRefusalOf(error: unknown): WrunRefusal | undefined;
|
|
172
|
+
/** Stamp what the raiser knows of the answer on the error it throws (the cloud lane's transport: the ask's socket
|
|
173
|
+
* stamp, the run attempt, a foreign supersede); the record `wrunRefusalFor` completes carries it. Merged over an
|
|
174
|
+
* earlier stamp. A non-object throwable is returned as it is. */
|
|
175
|
+
export declare function stampWrunRefusalTelemetry<T>(error: T, telemetry: WrunRefusalTelemetry): T;
|
|
176
|
+
/** The telemetry a raiser stamped on an error (stampWrunRefusalTelemetry), or none. */
|
|
177
|
+
export declare function wrunRefusalTelemetryOf(error: unknown): WrunRefusalTelemetry;
|
|
178
|
+
/**
|
|
179
|
+
* Whether the overlay's source can be opened in the editor (the OUT ladders read it, so Open in
|
|
180
|
+
* editor never appears for an opaque package):
|
|
181
|
+
* - a live editor tab whose `scriptId ?? id` is `settings.editorRunKey` (`hasEditorTab` answers);
|
|
182
|
+
* - a saved draft: `settings.wrunDraftRef.scriptDocId`;
|
|
183
|
+
* - a registry package the fork loader can open (`wrun-registry-fork.util.ts`): a browser lane
|
|
184
|
+
* ref (`wrunRegistryRef.package`), never a hosted record (`wrunRef`, the Cloud target), never a
|
|
185
|
+
* ref that names a closed source mode (`sourceMode` other than "open") or several files. The
|
|
186
|
+
* persisted ref carries no source mode today, so a compiled-only version answers true here and
|
|
187
|
+
* its Open in editor ends `unavailable` when the fork refuses.
|
|
188
|
+
*/
|
|
189
|
+
export declare function wrunOverlayEditable(settings: Record<string, unknown> | undefined, hasEditorTab: (runKey: string) => boolean): boolean;
|
|
190
|
+
/** The kit's refusal stages live in the import-free leaf the answer table reads (the socket worker reads it too). */
|
|
191
|
+
export { WRUN_KIT_REFUSAL_STAGES, wrunKitRefusalStageOf, type WrunKitRefusalStage };
|
|
192
|
+
/** The whole-run refusal code of a cloud reply the chart reads no rows from: a reply without the
|
|
193
|
+
* hosted wire (a server on the legacy pre-styled path; the socket row source refuses it). */
|
|
194
|
+
export declare const WRUN_LEGACY_RESULT_CODE = "wrun_legacy_result";
|
|
195
|
+
/** The whole-run refusal code of a create the server superseded while it was the overlay's live attempt (no newer
|
|
196
|
+
* attempt of this chart replaced it: another chart or tab created the same instance id). The socket row source
|
|
197
|
+
* answers it; its record is `session-lost` (WRUN-REPORTS-CLASSES C1). */
|
|
198
|
+
export declare const WRUN_SESSION_LOST_CODE = "wrun_session_lost";
|
|
199
|
+
/** The `session-lost` record's seed: a note whose way out is Retry. Never retried on its own: the heal reads the
|
|
200
|
+
* socket row source's refusal as one the same ask repeats, and another chart's session would go the same way. */
|
|
201
|
+
export declare function wrunSessionLostSeed(): WrunRefusalSeed;
|
|
202
|
+
/**
|
|
203
|
+
* The record seed of a refusal the cloud answered, by its code and the facts its frame carried
|
|
204
|
+
* (wrun-hosted-wire-caps `WrunFrameRefusal`), never its sentence: the no-candles answer is the browser
|
|
205
|
+
* lane's no-bars record (`waiting`, row 37); a reply without the hosted wire refuses with the reload
|
|
206
|
+
* way out; a code the settings answer opens them; the leg, window and tape refusals and the tab's caps
|
|
207
|
+
* say the browser lane's own words; the options chain and the pin codes read as the browser lane's own
|
|
208
|
+
* table reads them, with the chart's coin; anything else says the generic words with its code. Every
|
|
209
|
+
* seed but `waiting` and the reload carries the code, so the record names what the cloud said.
|
|
210
|
+
*/
|
|
211
|
+
export declare function wrunCloudRefusalSeed(code: string, facts?: Omit<WrunFrameRefusal, 'code'>, ctx?: Pick<WrunRefusalContext, 'chart'>): WrunRefusalSeed;
|
|
212
|
+
/** The record seed of a presentation family a source left out of a batch that drew (a note: the rest
|
|
213
|
+
* drew), with the code the source answered for it. */
|
|
214
|
+
export declare function wrunLeftOutRefusalSeed(family: string, code: string): WrunRefusalSeed;
|
|
215
|
+
/**
|
|
216
|
+
* The seed of an input interval pin finer than the chart's (`planWrunPinnedWires`): a pinned leg is a
|
|
217
|
+
* whole number of chart bars, so the chart must be the pin's interval or a divisor of it, strictly
|
|
218
|
+
* finer for an input that views the pin (confirmed, forming, offset: the chart's own interval has
|
|
219
|
+
* nothing to view). `at-most` with the coarsest picker interval that serves it as the way out; none
|
|
220
|
+
* (a pin finer than every picker interval): the run-failed words.
|
|
221
|
+
*/
|
|
222
|
+
export declare function wrunPinFinerSeed(pinMs: number, strictlyFiner: boolean): WrunRefusalSeed;
|
|
223
|
+
/** The seed `wrunRefusalFor` reads off a rejection (a cloud refusal by its code included). Never throws. */
|
|
224
|
+
export declare function wrunRefusalSeedFor(error: unknown, ctx: WrunRefusalContext): WrunRefusalSeed;
|
|
225
|
+
/**
|
|
226
|
+
* The completed record for a rejection (or a bare seed), against the chart's facts. Never throws.
|
|
227
|
+
* Order: a record already annotated on the error; an attached (or bare) seed; a cloud refusal by its
|
|
228
|
+
* code (`wrunCloudRefusalSeed`: a socket row source's whole-run refusal, or the code a cloud error
|
|
229
|
+
* frame names; the cloud's no-candles answer -> waiting); the stable codes the browser lane prints
|
|
230
|
+
* (`wrun_cell_block_too_large`, picking chain or block by the input's class; `wrun_options_chain_*`;
|
|
231
|
+
* `wrun_pin_venue_refused`; the TPO letter check's words -> interval-unserved `at-most` on the
|
|
232
|
+
* chart's own bars); `WrunNoBarsError` -> waiting; `WrunDeadlineError` -> not-reached;
|
|
233
|
+
* an unseeded `WrunSourceDataUnavailableError` -> service-no-answer; else run-failed. A server answer
|
|
234
|
+
* reads through the one answer table first (wrun-hosted-wire-caps): a superseded create's answer is the
|
|
235
|
+
* `session-lost` note, one a second ask may pass keeps Retry. The record carries the raiser's telemetry
|
|
236
|
+
* (stampWrunRefusalTelemetry) and `unknownCode` for a code the table has no row for.
|
|
237
|
+
*/
|
|
238
|
+
export declare function wrunRefusalFor(errorOrSeed: unknown, ctx: WrunRefusalContext): WrunRefusal;
|
|
239
|
+
/** The translate a surface injects: vue-i18n's translate with named params and, for a plural key,
|
|
240
|
+
* the plural choice. */
|
|
241
|
+
export type WrunRefusalTranslate = (key: string, params?: object, plural?: number) => string;
|
|
242
|
+
/** The longest detail line a surface shows. */
|
|
243
|
+
export declare const WRUN_REFUSAL_DETAIL_MAX = 160;
|
|
244
|
+
/**
|
|
245
|
+
* The line a run-failed `generic` or `code` record shows under its sentence: the first line of the
|
|
246
|
+
* raiser's text, trimmed, at most `WRUN_REFUSAL_DETAIL_MAX` characters. '' for every other record
|
|
247
|
+
* (its sentence names the cause) and for a record without text.
|
|
248
|
+
*/
|
|
249
|
+
export declare function wrunRefusalDetailOf(r: Pick<WrunRefusal, 'cls' | 'variant' | 'details'>): string;
|
|
250
|
+
/**
|
|
251
|
+
* The ONE text path: chip, sentence, OUT label and severity word of a record, in the injected
|
|
252
|
+
* translate's locale, and its detail line (`wrunRefusalDetailOf`, the raiser's own words, never
|
|
253
|
+
* translated). `name` and `market` render from the record when the variant does not carry
|
|
254
|
+
* them as params; a `feed` param renders as its `wrun.refusal.feed.*` words; plural keys pass the
|
|
255
|
+
* record's `count` / `n` as the plural choice. A note has no severity word.
|
|
256
|
+
*/
|
|
257
|
+
export declare function wrunRefusalTexts(r: WrunRefusal, t: WrunRefusalTranslate): {
|
|
258
|
+
chip: string;
|
|
259
|
+
sentence: string;
|
|
260
|
+
outLabel: string;
|
|
261
|
+
severityWord: string;
|
|
262
|
+
detail: string;
|
|
263
|
+
};
|