Type Alias: TermSetSelector
@kortexya/reasoninglayer / TermSetSelector
Type Alias: TermSetSelector
Section titled “Type Alias: TermSetSelector”TermSetSelector = {
documentId:string;type:"document"; } | {documentId:string;type:"document_version"; } | {path:string;type:"collection"; } | {ids:string[];type:"term_ids"; } | {includeDescendants?:boolean;sortName:string;type:"sort"; } | {osfql:string;type:"query"; } | {filter?:TermSetSelector;snapshotId:string;type:"snapshot"; } | {at:string;filter?:TermSetSelector;type:"as_of"; }
Defined in: src/types/osf-diff.ts:35
Selects a set of Psi-terms to diff.
Union Members
Section titled “Union Members”Type Literal
Section titled “Type Literal”{ documentId: string; type: "document"; }
All terms extracted from one document.
Type Literal
Section titled “Type Literal”{ documentId: string; type: "document_version"; }
Alias of document used by the version-chain endpoints.
Type Literal
Section titled “Type Literal”{ path: string; type: "collection"; }
Union of all documents in a collection path.
Type Literal
Section titled “Type Literal”{ ids: string[]; type: "term_ids"; }
An explicit list of term IDs.
Type Literal
Section titled “Type Literal”{ includeDescendants?: boolean; sortName: string; type: "sort"; }
All terms of a sort (optionally including descendant sorts).
Type Literal
Section titled “Type Literal”{ osfql: string; type: "query"; }
The result set of an OSFQL FINDALL/MATCH query.
Type Literal
Section titled “Type Literal”{ filter?: TermSetSelector; snapshotId: string; type: "snapshot"; }
The set as captured in a tenant snapshot (optionally filtered).
Type Literal
Section titled “Type Literal”{ at: string; filter?: TermSetSelector; type: "as_of"; }
The set as of a timestamp (RFC 3339), optionally filtered.
Remarks
Section titled “Remarks”A union discriminated by type. The OSF diff engine compares any two sets
of OSF terms — a document is just one way to select a set; others are
collections, sorts, OSFQL query results, snapshots, or points in time.
snapshot and as_of accept an optional nested filter, so selections
compose recursively (e.g. “the terms of sort clause as of 2026-01-01”).
This is the canonical definition, mirroring the backend, where the enum lives
in the OSF diff module (osfkb_domain::extraction::osf_diff::TermSetSelector)
and is imported by the temporal-series and coherence endpoints. The temporal
surface re-exports it — there is exactly one definition.
Serialized to the wire as a tagged snake_case object — for example
{"type":"sort","sort_name":"clause","include_descendants":true}. This is a
plain JSON tagged union, not the tagged ValueDto value format. The SDK
surface is camelCase (sortName); the normalizer converts it at the boundary.
The backend publishes the selector as a free-form JSON object
(#[schema(value_type = Object)]), which erases the union in the OpenAPI
spec; the SDK hand-writes it against the Rust source, whose own doc comment
states “the variants double as the wire format”.
Example
Section titled “Example”const byDocument: TermSetSelector = { type: 'document', documentId: '3f0c...' };const bySort: TermSetSelector = { type: 'sort', sortName: 'clause', includeDescendants: true };const historic: TermSetSelector = { type: 'as_of', at: '2026-01-01T00:00:00Z', filter: bySort };