/** @packageDocumentation * @module RpcInterface */ import { BeEvent } from "@bentley/bentleyjs-core"; import { IModelRpcProps } from "../../IModel"; import { RpcInterface } from "../../RpcInterface"; import { RpcConfiguration } from "./RpcConfiguration"; import { RpcRequestEvent, RpcRequestStatus, RpcResponseCacheControl } from "./RpcConstants"; import { RpcNotFoundResponse } from "./RpcControl"; import { RpcSerializedValue } from "./RpcMarshaling"; import { RpcOperation } from "./RpcOperation"; import { RpcProtocol } from "./RpcProtocol"; /** @public */ export declare class ResponseLike implements Response { private _data; get body(): null; arrayBuffer(): Promise; blob(): Promise; formData(): Promise; json(): Promise; text(): Promise; get bodyUsed(): boolean; get headers(): Headers; get ok(): boolean; get redirected(): boolean; get status(): number; get statusText(): string; get trailer(): Promise; get type(): ResponseType; get url(): string; clone(): this; constructor(data: any); } /** Supplies an IModelRpcProps for an RPC request. * @public */ export declare type RpcRequestTokenSupplier_T = (request: RpcRequest) => IModelRpcProps | undefined; /** Supplies the initial retry interval for an RPC request. * @public */ export declare type RpcRequestInitialRetryIntervalSupplier_T = (configuration: RpcConfiguration) => number; /** Notification callback for an RPC request. * @public */ export declare type RpcRequestCallback_T = (request: RpcRequest) => void; /** Determines if caching is permitted for a RPC response. * @public */ export declare type RpcResponseCachingCallback_T = (request: RpcRequest) => RpcResponseCacheControl; /** Runtime information related to the operation load of one or more RPC interfaces. * @public */ export interface RpcOperationsProfile { readonly lastRequest: number; readonly lastResponse: number; } /** Handles RPC request events. * @public */ export declare type RpcRequestEventHandler = (type: RpcRequestEvent, request: RpcRequest) => void; /** Resolves "not found" responses for RPC requests. * @public */ export declare type RpcRequestNotFoundHandler = (request: RpcRequest, response: RpcNotFoundResponse, resubmit: () => void, reject: (reason: any) => void) => void; /** A RPC operation request. * @public */ export declare abstract class RpcRequest { private static _activeRequests; private _resolve; protected _resolveRaw: (value?: Response | PromiseLike | undefined) => void; private _reject; private _rejectRaw; private _created; private _lastSubmitted; private _lastUpdated; private _status; private _extendedStatus; private _connecting; private _active; private _hasRawListener; private _raw; private _sending?; private _attempts; private _retryAfter; private _transientFaults; protected _response: Response | undefined; protected _rawPromise: Promise; /** All RPC requests that are currently in flight. */ static get activeRequests(): ReadonlyMap; /** Events raised by RpcRequest. See [[RpcRequestEvent]] */ static readonly events: BeEvent; /** Resolvers for "not found" requests. See [[RpcRequestNotFoundHandler]] */ static readonly notFoundHandlers: BeEvent; /** The aggregate operations profile of all active RPC interfaces. */ static get aggregateLoad(): RpcOperationsProfile; /** * The request for the current RPC operation. * @note The return value of this function is only reliable if program control was received from a RPC interface class member function that directly returns the result of calling RpcInterface.forward. */ static current(context: RpcInterface): RpcRequest; /** The unique identifier of this request. */ readonly id: string; /** The operation for this request. */ readonly operation: RpcOperation; /** The parameters for this request. */ parameters: any[]; /** The RPC client instance for this request. */ readonly client: RpcInterface; /** Convenience access to the protocol of this request. */ readonly protocol: RpcProtocol; /** The implementation response for this request. */ readonly response: Promise; /** The status of this request. */ get status(): RpcRequestStatus; /** Extended status information for this request (if available). */ get extendedStatus(): string; /** The last submission for this request. */ get lastSubmitted(): number; /** The last status update received for this request. */ get lastUpdated(): number; /** The target interval (in milliseconds) between submission attempts for this request. */ retryInterval: number; /** Whether a connection is active for this request. */ get connecting(): boolean; /** Whether this request is pending. */ get pending(): boolean; /** The elapsed time for this request. */ get elapsed(): number; /** A protocol-specific path identifier for this request. */ path: string; /** A protocol-specific method identifier for this request. */ method: string; /** An attempt-specific value for when to next retry this request. */ get retryAfter(): number | null; /** Finds the first parameter of a given structural type if present. */ findParameterOfType(requiredProperties: { [index: string]: string; }): T | undefined; /** Finds the first IModelRpcProps parameter if present. */ findTokenPropsParameter(): IModelRpcProps | undefined; /** The raw implementation response for this request. */ get rawResponse(): Promise; /** Constructs an RPC request. */ constructor(client: RpcInterface, operation: string, parameters: any[]); /** Override to send the request. */ protected abstract send(): Promise; /** Override to load response value. */ protected abstract load(): Promise; /** Override to set request header values. */ protected abstract setHeader(name: string, value: string): void; /** Sets the last updated time for the request. */ protected setLastUpdatedTime(): void; /** Override to describe available headers based on a protocol-specific criteria (such as a CORS whitelist). */ protected isHeaderAvailable(_name: string): boolean; protected computeRetryAfter(attempts: number): number; protected recordTransientFault(): void; protected resetTransientFaultCount(): void; cancel(): void; submit(): Promise; protected handleUnknownResponse(code: number): void; private handleResponse; private handleResolved; private handleRejected; private handleNoContent; private handleNotFound; private resolve; private resolveRaw; protected reject(reason: any): void; /** @internal */ dispose(): void; private setPending; private handleTransientError; protected setHeaders(): Promise; private setStatus; } /** @internal */ export declare const initializeRpcRequest: () => void; //# sourceMappingURL=RpcRequest.d.ts.map