@pond-ts/process API Reference
    Preparing search index...

    Interface OpDef

    interface OpDef {
        family: string;
        inputs: readonly InputDef[];
        kind?: "op";
        label?: (params: Params, inputs: string) => string;
        lookback?: (params: Params) => number;
        name: string;
        outputs: readonly OutputDef[];
        params: Readonly<Record<string, ParamDef>>;
        run: (ctx: OpContext) => OpResult;
        runRange?: (ctx: RangeContext) => void | OpResult;
        summary: string;
    }
    Index

    Properties

    family: string
    inputs: readonly InputDef[]
    kind?: "op"

    Discriminates against FoldDef. Optional, because an op is the default.

    label?: (params: Params, inputs: string) => string

    Human lineage fragment, e.g. SMA(20) of iv21. Optional — a generic op(params) of inputs is derived when absent, but a label reads far better in a legend chip or a graph node.

    lookback?: (params: Params) => number

    Rows of history this op needs before a requested range for its output over that range to be fully defined — [PND-PROCHIST].

    A count-window study of period bars needs period - 1. Declaring it lets requiredHistory derive the minimum safe tail for a whole plan, so a consumer slicing a hot leading edge stops guessing: an 8-study stack over 500k rows costs 765 ms/tick, and the same stack over a 5,000-row tail 5.4 ms/tick. The window is the difference between 1.3 ticks/sec and interactive.

    An IIR op has no exact finite warm-up — an EMA depends on every row before it, decaying but never reaching zero. 4 * period is the usual engineering answer and each such op should declare it rather than have the folder assume one, because the multiplier is a claim about acceptable error and only the op knows what it is.

    Omitted means unknown, not zero, and requiredHistory reports that rather than returning a number a caller would slice against. An op that genuinely needs no history — anything element-wise — should say () => 0.

    name: string
    outputs: readonly OutputDef[]
    params: Readonly<Record<string, ParamDef>>
    run: (ctx: OpContext) => OpResult
    runRange?: (ctx: RangeContext) => void | OpResult

    Recompute only [from, to), given the previous output — [PND-PROCRANGE]. Optional, and opt-in for a reason.

    The graph calls this instead of run when it knows which rows changed and this node has a previous output to patch; otherwise it falls back to a full run, so declaring nothing is always correct and merely slower.

    Only declare it if a patched result is bit-identical to a from-scratch one. That holds for the range-exact rolling kernel ([PND-PROCKERN]) and does not hold for median, percentiles, min or max, which still sweep whole-series. An op that declares this without that property makes its answers depend on the sequence of edits that produced them — which is invisible in a test that only ever computes from scratch.

    Requires lookback, since that is what widens an upstream dirty range into this node's. Without it the graph cannot know how far back a change reaches and will not range.

    summary: string