Skip to main content

Overview

Using the Node.js library, a Node.js service can be configured as a fully-functioning query peer. After establishing an initial connection, a web socket is used to communicate to a ledger server/group.

The available functions are below.

Main

ActionFunctionExplanation
Collection IDcollectionIdReturns the ID of a collection
ConnectconnectConnect to a ledger server/group using URL address(es)
ClosecloseCloses a connection
DBdbReturns a queryable database from the connection
Delete LedgerdeleteLedgerDeletes a ledger
Ledger InfoledgerInfoReturns information about a ledger, including blocks, indexes and current state
Ledger ListledgerListReturns list of ledgers that the connected Fluree instances is currently serving
New LedgernewLedgerCreates a new ledger
Predicate IDpredicateIdReturns the ID of a predicate
Predicate NamepredicateNameReturns the name of a predicate
Resolve LedgerresolveLedgerResolves a ledger identity in the current connection
SearchsearchExecutes a search against a given db (ledger instance) and flake parts
SessionsessionReturns session object for a given ledger
Subject IDsubidReturns the subject identity for a given object

Queries

ActionFunctionExplanation
Block QueryblockQueryBlock queries in FlureeQL syntax
Collection FlakescollectionFlakesReturns the spot index for the requested collection
GraphQLgraphqlQueries or transactions in GraphQL syntax, as a string
HistoryhistoryQueryHistory queries in FlureeQL syntax
Multi-QuerymultiQueryMulti-Queries in FlureeQL syntax
QueryqueryQuery in FlureeQL syntax
SPARQLsparqlQueries in SPARQL syntax, as a string
SQLsqlQueries in SQL syntax

Transactions

ActionFunctionExplanation
Monitor TransactionmonitorTxReturns the results of the monitor transaction request or a timeout
TransacttransactSubmits a transaction for a ledger
Create Command from transactiontxToCommandHelper function taking a transaction, filling out incomplete parts, to produce a signed command.
ActionFunctionExplanation
Account IDaccountIdReturns the account ID given either 1) a public key or 2) a message and signature
HTTP SignaturehttpSignatureTakes an HTTP request and creates an HTTP signature using a private key
Public Key from PrivatepublickeyFromPrivateReturns a public key given a private key
Public Key from MessagepublicKeyReturns a public key from a message and a signature
New Private KeynewPrivateKeyGenerates a new private key, returned in a map, along with the public key and account ID.
SignsignReturns a signature for a message given a private key.

Password Auth

ActionFunctionExplanation
Generate PasswordpasswordGenerateAttempts to generate a new user-auth.
Password LoginpasswordLoginValidates user and password combination against a ledger, returning a JSON Web Token (JWT) if successful.
Renew TokenrenewTokenRenews a valid JWT

Listener

ActionFunctionExplanation
Convert Block to a MapblockEventToMapTakes block event data from listen and organizes into a map of :added and :retracted elements.
ListenlistenListens to all events of a given ledger
Close ListenercloseListenerCloses a listener
ListenerslistenersReturns a list of listeners currently registered for each ledger

Testing

ActionFunctionExplanation
Forward Time TravelforwardTimeTravelReturns a new, queryable db based on a provided db and flake parts
Is Forward Time travel DB?isForwardTimeTravelReturns true if provided db is a forward-time-travel db
Query WithqueryWithExecutes a query against the provided DB, with the given flakes applied

Other

ActionFunctionExplanation
Set Default KeysetDefaultKeySets a new private key for an entire tx_group, network or ledger.
Set loggingsetLoggingSet the level of logging for Flureenjs

More information on signing queries and signing transactions can be found in the linked sections.