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

Reference / @getenginex/sdk/extension / getExtensionTransport

getExtensionTransport() ​

getExtensionTransport(client): ExtensionTransport

Gets the transport of a client created by createEnginexClient, for a product package to build its namespaces over the client app's session, tenant, hooks and validation. The transport is never exposed on the client object: only this function reaches it. After client.dispose(), every transport request rejects with CONFIGURATION_ERROR, as in the core.

Meant for SDK packages (@getenginex/sdk-igaming, @getenginex/sdk-predictions), not for apps: an app uses the methods of the client and of the product packages.

Parameters ​

client ​

object

The client returned by createEnginexClient (the same object, not a copy).

Returns ​

ExtensionTransport

Example ​

ts
import type { EnginexClient } from '@getenginex/sdk'
import { getExtensionTransport } from '@getenginex/sdk/extension'

export function createIgaming(client: EnginexClient) {
  const transport = getExtensionTransport(client)
  return { casino: createCasinoApi(transport) }
}

Throws ​

CONFIGURATION_ERROR if client is not a client created by createEnginexClient (e.g. any object or a { ...client } copy) or if it was created by a copy of the core with an incompatible transport contract. Identify it with isEnginexError(error, 'CONFIGURATION_ERROR'), not with instanceof: in CommonJS, this entry has its own copy of the EnginexError class.