import { IEvaServiceDefinition } from "@springtree/eva-services-core"; import { EvaEndpoint } from "../endpoint.js"; import { EvaContextEndpointStatus, TEvaContextRole } from "./endpoint-status.js"; import { EvaContextUser } from "./user.js"; import { IEvaServiceCallOptions } from "../service.js"; export { TEvaContextUserStatus, IJwtTokenRefresh } from "./user.js"; export { TEvaContextRole, TEvaContextReachability } from "./endpoint-status.js"; export interface IEvaContextServiceCallOptions { omitOrganizationUnitId?: boolean; omitAuthenticationToken?: boolean; } /** * An EVA context is the combination of: * - endpoint url * - endpoint role (CLOUD, WATCHTOWER, etc) * - endpoint reachability status * - an organization unit ID (optional) * - a current user (optional) * * Functionally it provides * - endpoint reachability checking (including slow indicator) * - user login status * - callService helper * - Automatic JWT token refresh when using callService helper * - Manual JWT token refresh and expiration time check * * You can disable the endpoint reachability check by setting the reachabilityCheckInterval to 0 * This will check the reachability once during startup but not afterwards */ export declare class EvaContext { /** * The EVA endpoint and its current status */ private _endpoint; get endpoint(): EvaEndpoint; endpointStatus: EvaContextEndpointStatus; /** * The current organization unit (if any) */ private _organizationUnitId?; get organizationUnitId(): string | undefined; private contextUuid; get contextId(): string; /** * The current user (if any) */ user: EvaContextUser; constructor({ applicationToken, authenticationToken, endpointUrl, organizationUnitId, reachabilityCheckInterval, reachabilityFailCheckInterval, refreshToken, role, serviceCallTimeout, slowThresholdMilliseconds, }: { applicationToken?: string; authenticationToken?: string; endpointUrl: string; organizationUnitId?: string; reachabilityCheckInterval?: number; reachabilityFailCheckInterval?: number; refreshToken?: string; role: TEvaContextRole; serviceCallTimeout?: number; slowThresholdMilliseconds?: number; }); connect(): Promise; disconnect(): void; /** * Helper method to call a service on the endpoint of this context which will automatically set: * - organization unit id * - user token * * The contextCallOptions can be used to override this behavior. * Values provided for the IEvaServiceCallOptions take priority as well. * * If the user token is a JWT token it will be refreshed if needed */ callService(serviceDefinition: new () => T, payload?: T["request"], options?: IEvaServiceCallOptions, contextCallOptions?: IEvaContextServiceCallOptions): Promise; } //# sourceMappingURL=index.d.ts.map