Skip to content

StandardNestedFetcher

Defined in: nested.ts:112, nested.ts:171

A fetcher that returns all nested entries

Key features:

  • Tracks nested objects in properties, arrays, sets, and maps
  • Iterates every nested object as an StandardNestedFetcher.Entry, carrying its key, its key path and its data
  • Narrows iteration to one annotated member with getForKey
  • Maintains parent-child relationships

Nothing is cached: every iteration reads the annotated members again and calls transform again, so a derivation that iterates is re-evaluated whenever any observable read along the way changes.
Symbol keys are not supported, nor are map keys with no key path form, such as objects and booleans.
A key path is the address a nested object is reached by, so two annotated members that resolve to one — as same-named private members of a parent and a child class do — are rejected at construction.
The contents of a single member can still produce entries that share a key path, such as a map holding both 0 and "0": every one of them is fetched, and iteration yields each one.

T extends object

Entry<T> = object

Defined in: nested.ts:178

Entry representing a nested object

Used when iterating over nested objects to provide context about their location

T extends object

readonly data: T

Defined in: nested.ts:184

Data

readonly key: KeyPath

Defined in: nested.ts:180

Name of the field containing the nested object

readonly keyPath: KeyPath

Defined in: nested.ts:182

Full path to the nested object

new StandardNestedFetcher<T>(target, transform): StandardNestedFetcher<T>

Defined in: nested.ts:123

object

The target object

(entry: StandardNestedFetcher.Entry<any>) => T | null

A function that transforms the entry to the desired type.
If the function returns null, the entry is ignored.
It runs during iteration, so the observables it reads are tracked by whatever derivation iterates — which is what lets it filter entries reactively, and what makes a wide-reading transform re-run often.

StandardNestedFetcher<T>

[iterator](): Generator<StandardNestedFetcher.Entry<T>, void, unknown>

Defined in: nested.ts:153

Iterate over all entries

Generator<StandardNestedFetcher.Entry<T>, void, unknown>

Iterable.[iterator]


getForKey(keyPath): Generator<StandardNestedFetcher.Entry<T>, void, unknown>

Defined in: nested.ts:162

Iterate over all entries for the given key path

KeyPath

Generator<StandardNestedFetcher.Entry<T>, void, unknown>