RayfinClient class
One application client, composed from independently typed capabilities.
Example
const client = RayfinClient.create({
baseUrl: 'https://app.example/backend',
publishableKey: 'pk-example',
auth: suppliedToken({ accessToken: () => currentToken }),
services: {
reports: (http) => ({
load: () => http.get('/reports'),
}),
},
});
await client.reports.load();
client.dispose();
Properties
| errors | Canonical SDK error classes for convenient |
| runtime |
All resolved deployment values supplied at construction. |
Methods
| create<TAuth, TServices>(Rayfin |
Create a client with exactly the service and authentication APIs selected. Factories run once, after authentication is attached to the shared transport. |
| dispose() | Release local resources once and prevent new shared-transport requests. Does not sign out, clear persisted credentials, or cancel in-flight calls. Already-dispatched calls may finish, but cannot send retries after disposal. An already-issued browser-session refresh may persist rotated credentials; disposal is not a barrier for pending network or storage work. |
Property Details
errors
Canonical SDK error classes for convenient instanceof checks.
static errors: { AuthError: typeof AuthError, NetworkError: typeof NetworkError, SdkError: typeof SdkError }
Property Value
{ AuthError: typeof AuthError, NetworkError: typeof NetworkError, SdkError: typeof SdkError }
runtimeConfig
All resolved deployment values supplied at construction.
runtimeConfig?: RayfinRuntimeConfig
Property Value
Method Details
create<TAuth, TServices>(RayfinClientConfig<TAuth, TServices>)
Create a client with exactly the service and authentication APIs selected. Factories run once, after authentication is attached to the shared transport.
static function create<TAuth, TServices>(config: RayfinClientConfig<TAuth, TServices>): ComposedRayfinClient<TServices, TAuth>
Parameters
- config
-
RayfinClientConfig<TAuth, TServices>
Returns
ComposedRayfinClient<TServices, TAuth>
dispose()
Release local resources once and prevent new shared-transport requests. Does not sign out, clear persisted credentials, or cancel in-flight calls. Already-dispatched calls may finish, but cannot send retries after disposal. An already-issued browser-session refresh may persist rotated credentials; disposal is not a barrier for pending network or storage work.
function dispose()