UNPKG

@infosel-sdk/core

Version:

Core SDK for Infosel financial services platform. Provides essential infrastructure for authentication, HTTP/GraphQL communication, storage management, and error handling.

39 lines (38 loc) 1.91 kB
import { AxiosInstance, AxiosResponse, InternalAxiosRequestConfig } from 'axios'; import TokenAuthProvider from '../data/data_access/token_auth_provider'; import { AuthConfiguration, AuthConfigurationBuilder } from '../domain/configuration'; import AppStorage from '../domain/data_access/app_storage'; import AuthInterceptor from '../domain/data_access/auth_interceptor'; import AuthProvider from '../domain/data_access/auth_provider'; import AuthProviderConfig from '../domain/data_access/auth_provider/config'; import { TokenAuthProviderConfig } from '../domain/data_access/token_auth_provider/config'; export interface SdkConfig { readonly mode?: 'qa' | 'prod'; readonly realm?: string; readonly authProviderConfig: AuthProviderConfig | TokenAuthProviderConfig; readonly storage?: AppStorage; } export interface ModernSdkConfig { readonly authConfiguration: AuthConfiguration; readonly storage?: AppStorage; } export default class InfoselSdkManager { readonly mode: 'qa' | 'prod'; readonly authProvider: AuthProvider | TokenAuthProvider; readonly storage: AppStorage; private _authInterceptor?; private realm; constructor(mode: 'qa' | 'prod', authProvider: AuthProvider | TokenAuthProvider, storage?: AppStorage, realm?: string); getRealm(): string; get authInterceptor(): AuthInterceptor<AxiosInstance, InternalAxiosRequestConfig, AxiosResponse>; static init({ mode, realm, authProviderConfig, storage, }: SdkConfig): InfoselSdkManager; /** * Modern initialization method using AuthConfigurationBuilder * This provides better validation and centralized configuration management */ static initWithConfiguration({ authConfiguration, storage, }: ModernSdkConfig): InfoselSdkManager; /** * Creates an AuthConfigurationBuilder for fluent configuration */ static configBuilder(): AuthConfigurationBuilder; }