@microsoft/rayfin-lib package

Classes

ApiClient

A generic HTTP client to interact with the service API. Uses isomorphic fetch approach that works in both browser and Node.js environments without external dependencies when native fetch is available.

AuthError

Error specifically for issues related to authentication.

EntityNameResolver

Resolves singular and plural forms of entity names. The SDK uses this when deriving collection names for generated data operations, so the plural form an entity resolves to here determines the names you query against.

Register overrides with EntityNameResolver.setCustomPlural when the default English pluralization does not match your domain terminology.

Example

// Ensure the `Person` entity pluralizes to `people`, not `persons`.
EntityNameResolver.setCustomPlural('Person', 'People');
EntityNameResolver.getPlural('Person'); // 'People'
NetworkError

Error for network-related issues (e.g., API unreachable, bad response).

SdkError

Base custom error for the SDK. All other custom errors should extend this.

Interfaces

ApiClientConfig

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

ClientLifecycle

Resource ownership for a composed client. Register local, synchronous cleanup as soon as a resource is acquired.

RequestOptions

Request options for fetch API.

WorkloadFailure

Structured detail from a Fabric workload failure envelope.

Carried as fields rather than folded into message so callers can branch on the failure shape instead of matching substrings. Every field is optional, because the envelope is the service's shape and a missing field must not turn into a wrong claim.

Type Aliases

ClientAuthFactory

Attaches an authentication mode to a composed client's HTTP transport. Return the session API to expose as client.auth, or undefined for supplied-token authentication without a session API.

ClientServiceFactory

Creates a service using the composed client's authenticated HTTP transport.

A factory must return synchronously; promise-like service types are excluded from its result. A plain (http) => service function is sufficient when the service owns no resources requiring cleanup.

Functions

assertBrowser(string)

Asserts that the current environment is a browser. Throws SdkError with code BROWSER_ONLY when window is undefined.

isDeprecationSilenced()

Whether deprecation warnings are currently silenced.

Precedence: an explicit setDeprecationsSilenced override wins; otherwise the RAYFIN_NO_DEPRECATION environment variable ('1' or 'true', case-insensitive) silences; otherwise warnings are emitted.

setDeprecationsSilenced(boolean)

Programmatically silence or unsilence all deprecation warnings. This override takes precedence over the RAYFIN_NO_DEPRECATION environment variable and is the browser-safe way to quiet warnings.

Function Details

assertBrowser(string)

Asserts that the current environment is a browser. Throws SdkError with code BROWSER_ONLY when window is undefined.

function assertBrowser(api: string)

Parameters

api

string

Name of the API that requires a browser (used in the error message).

isDeprecationSilenced()

Whether deprecation warnings are currently silenced.

Precedence: an explicit setDeprecationsSilenced override wins; otherwise the RAYFIN_NO_DEPRECATION environment variable ('1' or 'true', case-insensitive) silences; otherwise warnings are emitted.

function isDeprecationSilenced(): boolean

Returns

boolean

setDeprecationsSilenced(boolean)

Programmatically silence or unsilence all deprecation warnings. This override takes precedence over the RAYFIN_NO_DEPRECATION environment variable and is the browser-safe way to quiet warnings.

function setDeprecationsSilenced(silenced: boolean)

Parameters

silenced

boolean

true to suppress all deprecation warnings, false to re-enable them.

Variable Details

CONNECTOR_GRAPHQL_RUNTIME_BASE_PATH

CONNECTOR_GRAPHQL_RUNTIME_BASE_PATH: "/connectors"

Type

"/connectors"

CONNECTOR_INVOKE_BASE_PATH

CONNECTOR_INVOKE_BASE_PATH: "/connector-invoke"

Type

"/connector-invoke"