SDTFClient
The client to use SDTFEngine and Parsers Pipeline APIs. It provides methods for interacting with the token tree of a repository.
Properties
engine
This property represents the SDTF engine used by the SDTFClient.
repository
This property represents the repository that the SDTFClient is interacting with.
Methods
getJSONTokenTree
Returns the JSON token tree from the current repository.
clone
Create a new SDTFClient instance to avoid mutating the current token tree. Especially useful when you want to perform multiple distinct operations on the same token tree.
pick
Narrow the current token tree by picking a subtree based on the given path.
query
Create a clone of the current SDTF and only keep the selection of the query. When creating a new tree it's possible that tokens, groups and collections names will collide.
renameNode
Rename a node to a new name. If you specify a type, it'll rename the node only if it's matching the type parameter. If it doesn't, it'll throw an error.
Example
update
Execute an update on the current token tree. Note that the update won't be applied to the remote repository.
withQuery
Execute multiple updater functions with the same query.
resolveAliases
Resolve aliases in the current token tree. Useful before pick to avoid unresolvable aliases.
remove
Narrow the current token tree by removing any matching node based on the given query.
reset
Resets the current token tree to its initial value. The initial value being the token tree of the repository at the time of the creation of the first SDTFClient instance.
executeEngine
Tap into the current token tree to perform custom side effects.
forEachTokenState
Iterate against the tokenStates of the current token tree.
mapTokenStates
Iterate against the tokenStates of the current token tree, and accumulate the results in an array.
getTokenState
Get a token state for a given path.
getAllTokenStates
Get all the token states.
forEachCollectionState
Iterate against the collectionStates of the current token tree.
mapCollectionStates
Iterate against the collectionStates of the current token tree, and accumulate the results in an array.
getCollectionState
Get a collection state for a given path.
getAllCollectionStates
Get all the collection states.
forEachGroupState
Iterate against the groupStates of the current token tree.
mapGroupStates
Iterate against the groupStates of the current token tree, and accumulate the results in an array.
getGroupState
Get a group state for a given path.
getAllGroupStates
Get all the group states.
forEachQueryResult
Iterate against the nodeStates given by the query.
mapQueryResults
Iterate against the nodeStates given by the query, and accumulate the result in an array.
createParsersPipelines
Create a parsers engine executor from the custom or built-in parser functions passed as arguments. All pipelines are executed in parallel, if you need to chain parsers, have a look to the chainParserFunctions
util.
createParsersPipelinesFromRules
Create a parsers engine executor from the built-in parser rules passed as arguments. All pipelines are executed in parallel, if you need to chain parsers, have a look to the chainParserFunctions util.
Last updated