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.

getNearestCollectionState

Get the collectionState instance enclosing the given path.

getAllTokenStates

Get all tokenState instances from the tokens token tree.

getAllGroupStates

Get all groupState instances from the tokens token tree.

getAllCollectionStates

Get all collectionState instances from the tokens token tree.

getAllNodeStates

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

getTokenChildrenOf

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

getGroupChildrenOf

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

getCollectionChildrenOf

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

getChildrenOf

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

getParentsOf

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

getGroupChildren

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

getTokenChildren

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

getCollectionChildren

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

renderJSONTree

Get the JSON representation of the tokens token tree.

getAliasReference

Get the aliasReference instance from given coordinates.

getAllAliasReferences

Get all aliasReference instances from the tokens token tree.

getAliasReferencesTo

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

getAliasReferencesFrom

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

getStatefulAliasReference

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

getStatefulAliasReferencesTo

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

getStatefulAliasReferencesFrom

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

Last updated

Was this helpful?