Query API

Methods for locally accessing and iterating the token tree.

You access each of the query methods over:

sdtfEngine.query.[method]

getTokenState

Get a tokenState instance from the tokens token tree.

function getTokenState(
  path: Array<string>
):
  | { status: "resolved"; tokenState: TokenState<Type> }
  | { status: "unresolvable"; reason: "DOES_NOT_EXIST" };

getGroupState

Get a groupState instance from the tokens token tree.

function getGroupState(
  path: Array<string>
):
  | { status: "resolved"; groupState: GroupState }
  | { status: "unresolvable"; reason: "DOES_NOT_EXIST" };

getCollectionState

Get a collectionState instance from the tokens token tree.

function getCollectionState(
  path: Array<string>
):
  | { status: 'resolved'; collectionState: CollectionState }
  | { status: 'unresolvable'; reason: 'DOES_NOT_EXIST' };

getNearestCollectionState

Get the collectionState instance enclosing the given path.

function getNearestCollectionState(
  path: Array<string>
):     | { status: 'resolved'; collectionState: CollectionState }
  | { status: 'unresolvable'; reason: 'DOES_NOT_EXIST' };

getAllTokenStates

Get all tokenState instances from the tokens token tree.

function getAllTokenStates(): Array<TokenState>;

getAllGroupStates

Get all groupState instances from the tokens token tree.

function getAllGroupStates(): Array<GroupState>;

getAllCollectionStates

Get all collectionState instances from the tokens token tree.

function getAllCollectionStates(): Array<CollectionState>;

getAllNodeStates

Get all tokenState, groupState and collectionState instances from the tokens token tree.

function getAllNodeStates(): Array<TokenState | GroupState | CollectionState>;

getTokenChildrenOf

Get the tokenState instances that are children of the given path.

function getTokenChildrenOf(path: Array<string>): Array<TokenState>;

getGroupChildrenOf

Get the groupState instances that are children of the given path.

function getGroupChildrenOf(path: Array<string>): Array<GroupState>;

getCollectionChildrenOf

Get the collectionState instances that are children of the given path.

function getCollectionChildrenOf(path: Array<string>): Array<CollectionState>;

getChildrenOf

Get the tokenState, groupState and collectionState instances that are children of the given path.

function getChildrenOf(path: Array<string>, depth: number): Array<TokenState | GroupState | CollectionState>;

getParentsOf

Get the groupState and collectionState instances that are parents of the given path.

function getParentsOf(path: Array<string>, depth: number): Array<TokenState | GroupState | CollectionState>;

getGroupChildren

Get groupState instances that are direct children of the given path.

function getGroupChildren(path: Array<string>): Array<GroupState>;

getTokenChildren

Get tokenState instances that are direct children of the given path.

function getTokenChildren(path: Array<string>): Array<TokenState>;

getCollectionChildren

Get collectionState instances that are direct children of the given path.

function getCollectionChildren(path: Array<string>): Array<CollectionState>;

renderJSONTree

Get the JSON representation of the tokens token tree.

function renderJSONTree(renderOptions: RenderOptions): JSON;

getAliasReference

Get the aliasReference instance from given coordinates.

function getAliasReference(
  from: AliasReferenceCoordinates
): Result<AliasReference, SDTFError>;

getAllAliasReferences

Get all aliasReference instances from the tokens token tree.

function getAllAliasReferences(): Array<AliasReference>;

getAliasReferencesTo

Get all aliasReference instances that reference the given "to" coordinates.

function getAliasReferencesTo(
  to: Partial<AliasReferenceCoordinates>,
  options: AliasReferenceResolvabilityOptions
): Array<AliasReference>;

getAliasReferencesFrom

Get all aliasReference instances that reference the given "from" coordinates.

function getAliasReferencesFrom(
  from: Partial<AliasReferenceCoordinates>,
  options: AliasReferenceResolvabilityOptions
): Array<AliasReference>;

getStatefulAliasReference

Get the statefulAliasReference instance of the given "from" coordinates.

function getStatefulAliasReference(
  from: AliasReferenceCoordinates
): Result<StatefulAliasReference, SDTFError>;

getStatefulAliasReferencesTo

Get the statefulAliasReference instances that reference the given "to" coordinates.

function getStatefulAliasReferencesTo(
  to: Partial<AliasReferenceCoordinates>,
  options: AliasReferenceResolvabilityOptions
): Array<StatefulAliasReference>;

getStatefulAliasReferencesFrom

Get the statefulAliasReference instances that reference the given "from" coordinates.

function getStatefulAliasReferencesFrom(
  from: Partial<AliasReferenceCoordinates>,
  options: AliasReferenceResolvabilityOptions
): Array<StatefulAliasReference>;

Last updated