ApiClientConfig interface

Interface for API Client configuration. Includes an optional function to retrieve the access token dynamically.

Properties

baseUrl

Base URL of the Rayfin backend the client targets. Use an absolute URL (for example, the deployed Fabric item URL) to call a backend directly, or an empty string ('') to keep requests same-origin so a dev-server proxy can forward them.

functionsBaseUrl

Optional override for the functions invocation host. When set, function invocations (client.functions.<name>.invoke(...)) are routed to ${functionsBaseUrl}/api/<name> (Azure Functions Core Tools convention) instead of the default ${baseUrl}/functions/<name>/invoke path that goes through the Fabric InvokeController. Set this in local-debug scenarios (e.g. from import.meta.env.VITE_RAYFIN_FUNCTIONS_URL) to point the frontend at a locally-running func start process while data calls continue to hit the deployed Fabric item via baseUrl.

getAccessToken

Returns the current access token to attach as a bearer token, or null.

headers

Default headers merged into every request.

onAuthExhausted

Callback when retry after refresh also returns 401.

onRefreshNeeded

Invoked when a 401 response indicates the access token must be refreshed.

publishableKey

Publishable key used for service-level authentication. Required.

timeout

Default request timeout in milliseconds (defaults to 30000).

useProxy

Property Details

baseUrl

Base URL of the Rayfin backend the client targets. Use an absolute URL (for example, the deployed Fabric item URL) to call a backend directly, or an empty string ('') to keep requests same-origin so a dev-server proxy can forward them.

baseUrl: string

Property Value

string

functionsBaseUrl

Optional override for the functions invocation host. When set, function invocations (client.functions.<name>.invoke(...)) are routed to ${functionsBaseUrl}/api/<name> (Azure Functions Core Tools convention) instead of the default ${baseUrl}/functions/<name>/invoke path that goes through the Fabric InvokeController. Set this in local-debug scenarios (e.g. from import.meta.env.VITE_RAYFIN_FUNCTIONS_URL) to point the frontend at a locally-running func start process while data calls continue to hit the deployed Fabric item via baseUrl.

functionsBaseUrl?: string

Property Value

string

getAccessToken

Returns the current access token to attach as a bearer token, or null.

getAccessToken?: () => null | string

Property Value

() => null | string

headers

Default headers merged into every request.

headers?: Record<string, string>

Property Value

Record<string, string>

onAuthExhausted

Callback when retry after refresh also returns 401.

onAuthExhausted?: () => void

Property Value

() => void

onRefreshNeeded

Invoked when a 401 response indicates the access token must be refreshed.

onRefreshNeeded?: () => Promise<void>

Property Value

() => Promise<void>

publishableKey

Publishable key used for service-level authentication. Required.

publishableKey: string

Property Value

string

timeout

Default request timeout in milliseconds (defaults to 30000).

timeout?: number

Property Value

number

useProxy

Warning

This API is now deprecated.

This option no longer has any effect and will be removed in a future major release. The client no longer inspects the runtime environment to rewrite URLs. To route requests through a development proxy, set baseUrl to an empty string ('') so requests stay same-origin, and configure your dev server proxy accordingly. To call a backend directly, pass its absolute URL as baseUrl.

useProxy?: boolean

Property Value

boolean