@tidal-ts/core 0.13.0 → 0.15.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/dist/derive.d.ts +36 -3
- package/dist/derive.js +15 -5
- package/dist/index.d.ts +1 -1
- package/package.json +1 -1
package/dist/derive.d.ts
CHANGED
|
@@ -418,6 +418,35 @@ export interface DeriveSkip {
|
|
|
418
418
|
code?: string;
|
|
419
419
|
reason: string;
|
|
420
420
|
}
|
|
421
|
+
/**
|
|
422
|
+
* One step of a fold as the engine ran it — `@pond-ts/process`'s per-node
|
|
423
|
+
* report (`RunResult.nodes`), passed through so a host can show what each
|
|
424
|
+
* step cost and whether it was served warm (a pipeline view's badges).
|
|
425
|
+
*
|
|
426
|
+
* How it relates to `skipped`: a spec that fails BEFORE it compiles (an
|
|
427
|
+
* unknown column or op, a bad param, the wrong inputs) is in `skipped` only —
|
|
428
|
+
* a view that draws `nodes` alone loses it. A spec that ran but whose column
|
|
429
|
+
* could not be appended (refolding a folded series) is in both: here with a
|
|
430
|
+
* real `ms`, and in `skipped`.
|
|
431
|
+
*/
|
|
432
|
+
export interface DeriveNodeTiming {
|
|
433
|
+
/** The step's id — the same string as `deriveId(spec)`. */
|
|
434
|
+
id: string;
|
|
435
|
+
/** Whether this fold read the step's value. The engine reports a compiled
|
|
436
|
+
* spec nothing selected as not pulled (its `ms` then says nothing);
|
|
437
|
+
* {@link applyDerivedReport} selects every spec, so here it is always
|
|
438
|
+
* true. */
|
|
439
|
+
pulled: boolean;
|
|
440
|
+
/** Served from the engine's cache rather than computed this fold. Under the
|
|
441
|
+
* cold bind {@link applyDerivedReport} does today, always false. */
|
|
442
|
+
cached: boolean;
|
|
443
|
+
/** Milliseconds attributable to the step, to 3 decimal places. */
|
|
444
|
+
ms: number;
|
|
445
|
+
/** Upstream ids in input order: a step's `deriveId`, or a raw column. A
|
|
446
|
+
* PICKED input (`{ from, output }`) is its source step's id alone — which
|
|
447
|
+
* output it read is not said, so two picks of one step read the same. */
|
|
448
|
+
inputs: readonly string[];
|
|
449
|
+
}
|
|
421
450
|
/**
|
|
422
451
|
* Fold a set of derive specs onto a series, appending each spec's output
|
|
423
452
|
* column (`deriveId(spec)`) and REPORTING what didn't fold — `bind` + `run`
|
|
@@ -425,11 +454,14 @@ export interface DeriveSkip {
|
|
|
425
454
|
* (unknown column, bad params — a preset can reference a column that no
|
|
426
455
|
* longer exists) is skipped rather than thrown, its dependents skip with it,
|
|
427
456
|
* and each lands in `skipped` exactly once (the engine reports a failing spec
|
|
428
|
-
* per pass — plan + selector — so entries dedupe on the spec's id).
|
|
457
|
+
* per pass — plan + selector — so entries dedupe on the spec's id). `nodes`
|
|
458
|
+
* is the engine's per-step report: what each step cost, and whether it was
|
|
459
|
+
* served warm ({@link DeriveNodeTiming}). Since
|
|
429
460
|
* 0.62.0 nothing is pre-filtered: broken specs flow through and report, which
|
|
430
461
|
* is what the chip UI reads (Tidal's pairs plan, the ghost-spread debt).
|
|
431
|
-
* Duplicate specs in the set are one node by content-addressing.
|
|
432
|
-
* deterministic (memo-friendly)
|
|
462
|
+
* Duplicate specs in the set are one node by content-addressing. `series`
|
|
463
|
+
* and `skipped` are pure + deterministic (memo-friendly); the `ms` in `nodes`
|
|
464
|
+
* is wall-clock.
|
|
433
465
|
*
|
|
434
466
|
* Deliberately a **cold bind per fold** for now — same cost shape as the local
|
|
435
467
|
* fold it replaced, kept simple while semantics settle. The warm long-lived
|
|
@@ -439,6 +471,7 @@ export interface DeriveSkip {
|
|
|
439
471
|
export declare function applyDerivedReport(series: DerivedSeries, specs: readonly DeriveSpec[], units?: Units): {
|
|
440
472
|
series: DerivedSeries;
|
|
441
473
|
skipped: DeriveSkip[];
|
|
474
|
+
nodes: DeriveNodeTiming[];
|
|
442
475
|
};
|
|
443
476
|
/** {@link applyDerivedReport} without the report — the fold most render paths
|
|
444
477
|
* want (the chart's column-absence handling is the render half of the skip
|
package/dist/derive.js
CHANGED
|
@@ -571,11 +571,14 @@ function outputUnit(spec, index, unitOf) {
|
|
|
571
571
|
* (unknown column, bad params — a preset can reference a column that no
|
|
572
572
|
* longer exists) is skipped rather than thrown, its dependents skip with it,
|
|
573
573
|
* and each lands in `skipped` exactly once (the engine reports a failing spec
|
|
574
|
-
* per pass — plan + selector — so entries dedupe on the spec's id).
|
|
574
|
+
* per pass — plan + selector — so entries dedupe on the spec's id). `nodes`
|
|
575
|
+
* is the engine's per-step report: what each step cost, and whether it was
|
|
576
|
+
* served warm ({@link DeriveNodeTiming}). Since
|
|
575
577
|
* 0.62.0 nothing is pre-filtered: broken specs flow through and report, which
|
|
576
578
|
* is what the chip UI reads (Tidal's pairs plan, the ghost-spread debt).
|
|
577
|
-
* Duplicate specs in the set are one node by content-addressing.
|
|
578
|
-
* deterministic (memo-friendly)
|
|
579
|
+
* Duplicate specs in the set are one node by content-addressing. `series`
|
|
580
|
+
* and `skipped` are pure + deterministic (memo-friendly); the `ms` in `nodes`
|
|
581
|
+
* is wall-clock.
|
|
579
582
|
*
|
|
580
583
|
* Deliberately a **cold bind per fold** for now — same cost shape as the local
|
|
581
584
|
* fold it replaced, kept simple while semantics settle. The warm long-lived
|
|
@@ -584,7 +587,7 @@ function outputUnit(spec, index, unitOf) {
|
|
|
584
587
|
*/
|
|
585
588
|
export function applyDerivedReport(series, specs, units) {
|
|
586
589
|
if (specs.length === 0)
|
|
587
|
-
return { series, skipped: [] };
|
|
590
|
+
return { series, skipped: [], nodes: [] };
|
|
588
591
|
// NOT idempotent over an already-folded series: an output column that
|
|
589
592
|
// already exists collides at assembly, that spec skips, and any spec
|
|
590
593
|
// NESTING it skips with it (pinned by test). No render path refolds today
|
|
@@ -621,7 +624,14 @@ export function applyDerivedReport(series, specs, units) {
|
|
|
621
624
|
if (!skipped.has(id))
|
|
622
625
|
skipped.set(id, { id, code: s.code, reason: s.reason });
|
|
623
626
|
}
|
|
624
|
-
|
|
627
|
+
const nodes = result.nodes.map(({ id, pulled, cached, ms, inputs }) => ({
|
|
628
|
+
id,
|
|
629
|
+
pulled,
|
|
630
|
+
cached,
|
|
631
|
+
ms,
|
|
632
|
+
inputs,
|
|
633
|
+
}));
|
|
634
|
+
return { series: result.series ?? series, skipped: [...skipped.values()], nodes };
|
|
625
635
|
}
|
|
626
636
|
/** {@link applyDerivedReport} without the report — the fold most render paths
|
|
627
637
|
* want (the chart's column-absence handling is the render half of the skip
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export { BAR_INTERVAL_MS, type Instrument, type InstrumentKind, type BarInterval
|
|
|
2
2
|
export { generatePriceSeries, buildPriceSeries, DEMO_INSTRUMENTS, PRICE_SCHEMA, type PriceSeriesOptions, type PriceSeries, type PriceRow, } from './fixture.js';
|
|
3
3
|
export { generateVolSeries, buildVolSeries, VOL_SCHEMA, VOL_TENORS, DEFAULT_VOL_TENOR, impliedCol, hvCol, rvCol, rvCenCol, skewCol, type VolSeries, type VolColumns, type VolTenor, type VolSeriesOptions, } from './vol.js';
|
|
4
4
|
export { aggregateColumn, floorToWindow, liveWindowMs, ohlcWindow, sessionGrid, WINDOW_MS, WINDOW_LADDER, MIN_BAR_PX, autoBarWindow, type BarReducer, type SeriesWindow, } from './aggregate.js';
|
|
5
|
-
export { applyDerived, applyDerivedReport, COMPARE_PREFIX, deriveId, deriveLineage, inputNames, substituteInput, hasPairOp, isBrokenId, isPairOp, isValidSpec, opHasPeriod, PERIOD_BOUNDS, readNumericColumn, partStudyLabel, readPart, readPairParts, specUnit, studyCatalog, TIDAL_OPS, BAND_OUTPUTS, opParams, isStudyOp, studyTag, opIsBand, opInputs, opIsMulti, opOutputs, primaryOutput, studyInputOf, studyPick, fanPick, withFanOutput, withStudyOutput, studyColumn, BAR_PRICE_COLUMNS, withStudyColumn, type StudyPick, isPickedInput, opNeedsColumns, TARGET_ROLES, opSharesSourceAxis, type OpParam, usesCompare, type DeriveSkip, type PairPart, type PartStudy, type StudyOption, type NumericColumnReader, DEFAULT_PERIOD, type DeriveInput, type PickedDeriveOutput, type DeriveSpec, type DeriveOp, type TidalOp, type PairOp, } from './derive.js';
|
|
5
|
+
export { applyDerived, applyDerivedReport, COMPARE_PREFIX, deriveId, deriveLineage, inputNames, substituteInput, hasPairOp, isBrokenId, isPairOp, isValidSpec, opHasPeriod, PERIOD_BOUNDS, readNumericColumn, partStudyLabel, readPart, readPairParts, specUnit, studyCatalog, TIDAL_OPS, BAND_OUTPUTS, opParams, isStudyOp, studyTag, opIsBand, opInputs, opIsMulti, opOutputs, primaryOutput, studyInputOf, studyPick, fanPick, withFanOutput, withStudyOutput, studyColumn, BAR_PRICE_COLUMNS, withStudyColumn, type StudyPick, isPickedInput, opNeedsColumns, TARGET_ROLES, opSharesSourceAxis, type OpParam, usesCompare, type DeriveSkip, type DeriveNodeTiming, type PairPart, type PartStudy, type StudyOption, type NumericColumnReader, DEFAULT_PERIOD, type DeriveInput, type PickedDeriveOutput, type DeriveSpec, type DeriveOp, type TidalOp, type PairOp, } from './derive.js';
|
|
6
6
|
export { joinUnderPrefix } from './join.js';
|
|
7
7
|
export { columnExtent } from './extent.js';
|
|
8
8
|
export { snapshotToTimeSeries, appendToRows, type PondSnapshot, type PondAppend, type PondValue, type WireColumnSpec, } from './columnar.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tidal-ts/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Financial time-series vocabulary on pond-ts: the study/derive seam, the vol schema, bar windows, the columnar adapter and session helpers.",
|
|
6
6
|
"license": "MIT",
|