This version (v0.7) has not been published to npm yet.
Skip to content

Reference / @getenginex/sdk/query / queryScope

queryScope() ​

queryScope(source): QueryScope

Query scope of a client: the core's (createEnginexClient) or the object of a product package registered with registerProductClient (from @getenginex/sdk/extension). It makes no request and reads the session only when a key is built.

For SDK packages (@getenginex/sdk-igaming, @getenginex/sdk-predictions) and adapters: an app uses createQueries/createMutations and the product packages' factories.

Parameters ​

source ​

object

The core client, or the public object of a registered product package.

Returns ​

QueryScope

Example ​

ts
import { queryScope } from '@getenginex/sdk/query'

export function createIgamingQueries(igaming: IgamingClient) {
  const scope = queryScope(igaming)
  return {
    casino: {
      listGames: (input?: ListGamesInput) =>
        scope.publicQuery('casino', 'listGames', (i, o) => igaming.casino.listGames(i, o), input),
    },
  }
}

Throws ​

CONFIGURATION_ERROR if source is neither a core client (with session.get()) nor a registered product (e.g. a { ...igaming } copy). Identify it with isEnginexError(error, 'CONFIGURATION_ERROR').