Skip to main content

Interface: RollUpContext

Defined in: model/field.ts:398

ComputeContext plus the Field currently rolling up. Shipped Aggregators (sum, min) read ctx.field; a consumer Aggregator names any declared key.

values/numericValues cover the common "one field off my children" case (issue #124) — they read the pass's own child list, never parent.children(), because a Rollup child carries the value this same bottom-up pass just gave it and the store does not (ADR 0017).

Extends​

Properties​

field​

readonly field: FieldKey

Defined in: model/field.ts:399


timeZone​

readonly timeZone: string

Defined in: model/field.ts:303

Inherited from​

ComputeContext.timeZone

Methods​

children()​

children(row): readonly StoredEntry<Record<string, unknown>>[]

Defined in: model/field.ts:358

One step down: Depot → Van 1, Van 2. One tree read, no allocation beyond the array returned.

Exactly one level, and that is load-bearing for a Rollup: a parent's value already aggregates its subtree when the bottom-up pass reaches it, so reaching past one level here would double count a grandchild both under its parent and again under its grandparent. descendants and leaves are how a consumer reaches past one level, under their own names.

Parameters​

row​

StoredEntry

Returns​

readonly StoredEntry<Record<string, unknown>>[]

Inherited from​

ComputeContext.children


descendants()​

descendants(row): readonly StoredEntry<Record<string, unknown>>[]

Defined in: model/field.ts:362

All the way down, never row itself: Depot → Van 1, Van 2, Crate A, Crate B. A subtree walk, one tree read per node found. Mirrors Entry.descendants() on the live row; this is the pass's own tree instead of the store's.

Parameters​

row​

StoredEntry

Returns​

readonly StoredEntry<Record<string, unknown>>[]

Inherited from​

ComputeContext.descendants


hasChildren()​

hasChildren(row): boolean

Defined in: model/field.ts:378

True when row derives (ADR 0013): hasChildren(Van 1) is true, hasChildren(Crate A) is false. The cost follows the binding, and there are three: the store reads a cached child index and never builds the list (data/entry-store.ts), a Rollup pass reads the length of the very list children(row) hands back, and the bare default derives it from children(row). All three agree with children(row).length > 0, so a caller never has to know which one answered. Mirrors Entry.hasChildren on the live row, which is a property because it reads a cached index and allocates nothing (ADR 0017 rule 4).

Parameters​

row​

StoredEntry

Returns​

boolean

Inherited from​

ComputeContext.hasChildren


hierarchyParentId()​

hierarchyParentId(): EntryId | undefined

Defined in: model/field.ts:382

The tree's answer to this row's parent, through the checked hierarchy source (ADR 0020) — the same answer entry.parent()?.id gives, never read('parentId')'s stored value (ADR 0024). Bound to the row this pass is computing (ADR 0017 amendment, rule 2).

Returns​

EntryId | undefined

Inherited from​

ComputeContext.hierarchyParentId


leaves()​

leaves(row): readonly StoredEntry<Record<string, unknown>>[]

Defined in: model/field.ts:370

The bottom rows of row's subtree: Depot → Van 2, Crate A, Crate B. A leaf answers itself: leaves(Van 2) is [Van 2], not [], while descendants(Van 2) is []. A subtree of one leaf has one leaf.

A subtree walk, one tree read per node found, same cost as descendants. A node whose fetched children list is empty is the leaf; this never asks hasChildren and never filters descendants's result.

Parameters​

row​

StoredEntry

Returns​

readonly StoredEntry<Record<string, unknown>>[]

Inherited from​

ComputeContext.leaves


numericValues()​

numericValues(key?): readonly number[]

Defined in: model/field.ts:408

Like values, but keeps only finite numbers — holes and non-numeric values drop, same rule shipped sum/min/max already follow.

Parameters​

key?​

FieldKey

Returns​

readonly number[]


read()​

read<K>(key): CoreFieldValue<K> | undefined

Defined in: model/field.ts:351

Another Field on this same row — a core key, or another Field's compute. Bound to the row this pass is computing; not a structure question, so it takes no row (ADR 0017 amendment, rule 2).

Type Parameters​

K​

K extends FieldKey

Parameters​

key​

K

Returns​

CoreFieldValue<K> | undefined

Inherited from​

ComputeContext.read


values()​

Call Signature​

values(): readonly unknown[]

Defined in: model/field.ts:404

key read off each child, in order, defaulting to ctx.field. A child with no value is a hole (undefined). With no key, a consumer Field's own values stay unknown. key read off each child, typed by the key the way ctx.read(key) is — ctx.values('duration') is readonly (Duration | undefined)[], and a consumer key stays unknown.

Returns​

readonly unknown[]

Call Signature​

values<K>(key): readonly (CoreFieldValue<K> | undefined)[]

Defined in: model/field.ts:405

Type Parameters​
K​

K extends FieldKey

Parameters​
key​

K

Returns​

readonly (CoreFieldValue<K> | undefined)[]