@microsoft/rayfin-client package
Classes
| AuthError |
Error specifically for issues related to authentication. |
| ClientCompositionError |
A composition failure retaining its original cause and any cleanup failures. Configuration and tokens are never included in the error message. |
| NetworkError |
Error for network-related issues (e.g., API unreachable, bad response). |
| RayfinClient |
One application client, composed from independently typed capabilities. Example
|
| RayfinConfigError |
Error thrown when runtime configuration loading fails. |
| 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. |
| RayfinClientConfig |
Configuration for RayfinClient.create. Select authentication explicitly and register services from their owning packages. Session options belong to the authentication adapter, not here. |
| RayfinRuntimeConfig |
All |
| ResolveRayfinConfigOptions |
Options controlling how resolveRayfinConfig fetches remote runtime configuration. To skip remote loading entirely, don't call it — construct the client directly from your own values instead. |
| SuppliedTokenOptions |
Options for externally supplied tokens, including per-request token rotation. |
Type Aliases
| ClientAuthFactory |
Attaches an authentication mode to a composed client's HTTP transport.
Return the session API to expose as |
| ClientServiceApis |
Readonly service APIs inferred from their registered factories. |
| 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 |
| ClientServices |
Service factories keyed by the namespaces they expose on a client. |
| ComposedRayfinClient |
A composed client with exactly its registered services and session API. |
| ReservedServiceName |
Names owned by the client, object prototype, or JavaScript promise protocol. |
| ValidClientServices |
Validates service names and excludes asynchronous factory results. |
Functions
| is |
Whether deprecation warnings are currently silenced. Precedence: an explicit setDeprecationsSilenced override wins; otherwise
the |
| resolve |
Resolves the config a Example
|
| set |
Programmatically silence or unsilence all deprecation warnings. This override
takes precedence over the |
| supplied |
Authenticate without creating a browser session or exposing |
Function Details
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
resolveRayfinConfig(Pick<RayfinRuntimeConfig, "publishableKey" | "apiUrl"> & Partial<RayfinRuntimeConfig>, ResolveRayfinConfigOptions)
Resolves the config a RayfinClient should be
constructed with: loads the remote rayfin.config.json (unless the caller
skips calling this function entirely), overlays it over the supplied
defaults per-field, and returns the merged baseUrl / publishableKey /
runtimeConfig. Construction itself is a plain, synchronous
RayfinClient.create(...) call — this function only resolves values.
Example
import {
RayfinClient,
RayfinConfigError,
resolveRayfinConfig,
} from '@microsoft/rayfin-client';
import { browserSession } from '@microsoft/rayfin-auth';
const resolved = await resolveRayfinConfig({
apiUrl: 'https://your-backend.example.com',
publishableKey: 'your-publishable-key',
});
const { baseUrl, publishableKey, runtimeConfig } = resolved;
if (typeof baseUrl !== 'string') {
throw new RayfinConfigError('Configure a Rayfin backend URL.', 'CONFIG_INCOMPLETE');
}
if (typeof publishableKey !== 'string' || !publishableKey.trim()) {
throw new RayfinConfigError('Configure a Rayfin publishable key.', 'CONFIG_INCOMPLETE');
}
const client = RayfinClient.create({
baseUrl,
publishableKey,
runtimeConfig,
auth: browserSession(),
});
function resolveRayfinConfig(defaults: Pick<RayfinRuntimeConfig, "publishableKey" | "apiUrl"> & Partial<RayfinRuntimeConfig>, options?: ResolveRayfinConfigOptions): Promise<{ baseUrl?: string, publishableKey?: string, runtimeConfig: RayfinRuntimeConfig }>
Parameters
- defaults
-
Pick<RayfinRuntimeConfig, "publishableKey" | "apiUrl"> & Partial<RayfinRuntimeConfig>
- options
- ResolveRayfinConfigOptions
Returns
Promise<{ baseUrl?: string, publishableKey?: string, runtimeConfig: RayfinRuntimeConfig }>
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.
suppliedToken(SuppliedTokenOptions)
Authenticate without creating a browser session or exposing client.auth.
Token refresh and rotation remain the supplied provider's responsibility.
Providers are called per request, not during synchronous client construction.
Provider failures reject the request before it is sent.
function suppliedToken(options?: SuppliedTokenOptions): ClientAuthFactory<undefined>
Parameters
- options
- SuppliedTokenOptions
Returns
ClientAuthFactory<undefined>