Global

Members

(constant) SlashDBConsumer

Use to access params passed though use of SlashDBProvider.

useContext hook from React can be used instead of SlashDBConsumer in practice
such as:
import { useContext} from 'react';
import { SlashDBContext } from './Context';
useContext(SlashDBContext);

Source:

(constant) SlashDBContext

Create custom Context to be used with provider, consumer and useContext hook. For param sharing without need to pass it
down from parent to child at each level of the component tree.

Source:

Methods

checkClientAuthStatus(instanceName) → {boolean}

Helper to check client authentication status - used in Auth clientIsAuthenticated method

Parameters:
Name Type Description
instanceName string

the SlashDB client instance check

Source:
Returns:

flag indicating if client is currently authenticated to SlashDB server

Type
boolean

removeSdbClients(instanceNameopt)

Helper to logout and remove SlashDB clients - used in Auth logout method

Parameters:
Name Type Attributes Description
instanceName string <optional>

the SlashDB client instance to log out; if undefined, all clients are logged out

Source:

SlashDBProvider(setUpOptions)

Custom React component for build in use of Provider from createContext. Use: ....children
by defining SlashDBProvider element in project we can pass params to it which will be accessable thoughout project.
See SlashDBConsumer for more info on how to use params passed. I.e. Wrap App component so that context data is avaliable
throughout application.

Parameters:
Name Type Description
setUpOptions Object

holds the setup parameter: setUpOptions is an object of key value pairs.

Properties
Name Type Description
host string

hostname/IP address of the SlashDB instance, including protocol and port number (e.g. http://192.168.1.1:8080)

apiKey string

optional API key associated with username

sso Object

optional settings to login with Single Sign-On

Properties
Name Type Description
idpId string

optional identity provider id configured in SlashDB

redirectUri string

optional redirect uri to redirect browser after sign in

popUp boolean

optional flag to sign in against the identity provider with a Pop Up window (false by default)

Source:

useDataDiscovery(database, resource, defaultFilteropt, instanceNameopt) → {array}

Hook for accessing SlashDB Data Discovery feature

Parameters:
Name Type Attributes Default Description
database string

name of the database containing the desired resource/table

resource string

the resource/table to discover

defaultFilter string | DataDiscoveryFilter <optional>

optional string/DataDiscovery filter object containing a default filter for the resource

instanceName string <optional>
default

optional name of SlashDB client that has been previously created with useSetUp() hook; default is 'default'

Source:
Returns:

array, first element is data for given resource/table and subsequent elements are function references to execute on-demand GET/POST/PUT/DELETE calls on the resource

Type
array

useExecuteQuery(queryName, defaultParamsopt, defHttpMethod, instanceNameopt) → {array}

Hook for accessing SlashDB SQL Pass-Thru feature

Parameters:
Name Type Attributes Default Description
queryName string

name of the query to execute

defaultParams string | SQLPassThruFilter <optional>

optional string/SQLPassThruFilter filter object containing parameters for the query

defHttpMethod string get

optional parameter to set the HTTP method used by the query; default is 'get'

instanceName string <optional>
default

optional name of SlashDB client that has been previously created with useSetUp() hook; default is 'default'

Source:
Returns:

array, first element is data for given resource/table and second element is function reference to execute query on demand

Type
array

useSetUp(instanceNameopt, configopt) → {SlashDBClient}

Create a SlashDB client object for use with hooks and store in a local registry. If no parameters are provided, create a client object using
the parameters configured with the SlashDBProvider component

Parameters:
Name Type Attributes Default Description
instanceName string <optional>
default

a name to identify the client in the registry; if not provided, will be named 'default'

config Object <optional>

holds the setup parameter: config is an object of key value pairs.

Properties
Name Type Attributes Description
host string <optional>

hostname of the SlashDB instance to connect to, with protocol/port

apiKey string <optional>

API key for the username

sso Object <optional>

optional settings to login with Single Sign-On

Properties
Name Type Attributes Description
idpId Object <optional>

optional identity provider id configured in SlashDB

redirectUri Object <optional>

optional redirect uri to redirect browser after sign in

popUp Object <optional>

optional flag to sign in against the identity provider with a Pop Up window (false by default)

Source:
Returns:

a reference to the SlashDB client that was created

Type
SlashDBClient