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 IDcollection_idReturns the ID of a collection
Connect
  • connect
  • connect_p
Connect to a ledger server/group using URL address(es)
ClosecloseCloses a connection
DB
  • db
  • db_p
Returns a queryable database from the connection
Delete Ledgerdelete_ledgerDeletes a ledger
Ledger Infoledger_infoReturns information about a ledger, including blocks, indexes and current state
Ledger Listledger_listReturns list of ledgers that the connected Fluree instances is currently serving
Ledger Statsledger_statsReturns ledger stats, including db size and number of flakes
New Ledgernew_ledgerCreates a new ledger
Predicate IDpredicate_idReturns the ID of a predicate
Predicate Namepredicate_nameReturns the name of a predicate
Resolve Ledgerresolve_ledgerResolves 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 Queryblock_queryBlock queries in FlureeQL syntax
Collection Flakescollection_flakesReturns the spot index for the requested collection
GraphQLgraphqlQueries or transactions in GraphQL syntax, as a string
Historyhistory_queryHistory queries in FlureeQL syntax
Multi-Querymulti_queryMulti-Queries in FlureeQL syntax
QueryqueryQuery in FlureeQL syntax
SPARQLsparqlQueries in SPARQL syntax, as a string
SQLsqlQueries in SQL syntax

Transactions

ActionFunctionExplanation
Monitor Transactionmonitor_txReturns the results of the monitor transaction request or a timeout
TransacttransactSubmits a transaction for a ledger
Create Command from transactiontx__GT_commandHelper function taking a transaction, filling out incomplete parts, to produce a signed command.
ActionFunctionExplanation
Account IDaccount_idReturns the account ID given either 1) a public key or 2) a message and signature
HTTP Signaturehttp_signatureTakes an HTTP request and creates an HTTP signature using a private key
Public Key from Privatepublic_key_from_privateReturns a public key given a private key
Public Key from Messagepublic_keyReturns a public key from a message and a signature
New Private Keynew_private_keyGenerates 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 Passwordpassword_generateAttempts to generate a new user-auth.
Password Loginpassword_loginValidates user and password combination against a ledger, returning a JSON Web Token (JWT) if successful.
Renew Tokenrenew_tokenRenews a valid JWT

Listener

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

Testing

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

Other

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

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