Configuration
Constructor Options
The BshEngine constructor accepts the following options:
interface BshEngineOptions {
host?: string;
apiKey?: string;
jwtToken?: string;
refreshToken?: string;
clientFn?: BshClientFn;
authFn?: BshAuthFn;
refreshTokenFn?: BshRefreshTokenFn;
onTokenRefreshed?: BshOnTokenRefreshedFn;
tenantFn?: BshTenantFn;
preInterceptors?: BshPreInterceptor[];
postInterceptors?: BshPostInterceptor[];
errorInterceptors?: BshErrorInterceptor[];
}
const bshEngine = new BshEngine(options);| Option | Description | Reference |
|---|---|---|
host | The URL of the BSH Engine instance | |
apiKey | The API key for authentication | API Key Authentication |
jwtToken | The JWT access token | JWT Authentication |
refreshToken | The refresh token for JWT renewal | Auto Refresh |
clientFn | The custom HTTP client function | Custom HTTP Client |
authFn | The custom authentication function | Custom Authentication |
refreshTokenFn | The custom refresh token function | Auto Refresh |
onTokenRefreshed | Optional callback invoked with the new access token when the engine silently refreshes JWT during a request; use it to persist the token for your next authFn or jwtToken read | Auto Refresh |
tenantFn | Optional async function that returns the active tenant id; when non-empty, the SDK sends X-Tenant-Id on every request (common for admin users operating in a selected tenant) | Tenants Service |
preInterceptors | The request interceptors | Pre-Interceptors |
postInterceptors | The response interceptors | Post-Interceptors |
errorInterceptors | The error interceptors | Error Interceptors |