UNPKG

@itwin/core-common

Version:

iTwin.js components common to frontend and backend

112 lines 5.38 kB
/** @packageDocumentation * @module RpcInterface */ import { RpcInterface, RpcInterfaceDefinition } from "../../RpcInterface"; import { RpcControlChannel } from "./RpcControl"; import { RpcProtocol, RpcRequestFulfillment } from "./RpcProtocol"; import { RpcRequest } from "./RpcRequest"; import { RpcRequestContext } from "./RpcRequestContext"; import { RpcRoutingToken } from "./RpcRoutingToken"; /** @internal */ export type RpcConfigurationSupplier = (routing?: RpcRoutingToken) => { new (): RpcConfiguration; }; /** @internal */ export interface RpcRoutingMap extends RpcConfigurationSupplier { configurations: Map<number, RpcConfigurationSupplier>; } /** @internal */ export declare namespace RpcRoutingMap { function create(): RpcRoutingMap; } /** A RpcConfiguration specifies how calls on an RPC interface will be marshalled, plus other operating parameters. * RpcConfiguration is the base class for specific configurations. * @beta */ export declare abstract class RpcConfiguration { /** Whether development mode is enabled. * @note This parameter determines whether developer convenience features like backend stack traces are available. */ static developmentMode: boolean; /** Whether frontend checks that are relevant in a cloud-hosted routing scenario are disabled. */ static disableRoutingValidation: boolean; /** Whether strict mode is enabled. * This parameter determines system behaviors relating to strict checking: * - Whether an error is thrown if the type marshaling system encounters an unregistered type (only in strict mode). */ static strictMode: boolean; /** * Whether to throw an error when the IModelRpcProps in the operation parameter list differs from the token in the URL. * @note By default, a warning is logged and the operation is allowed to proceed. * @note The parameter token is always replaced by the url token (unless RpcOperationPolicy.allowTokenMismatch is set). */ static throwOnTokenMismatch: boolean; /** @internal Sets the configuration supplier for an RPC interface class. */ static assign<T extends RpcInterface>(definition: RpcInterfaceDefinition<T>, supplier: RpcConfigurationSupplier): void; /** Sets the configuration supplier for an RPC interface class for a given routing. */ static assignWithRouting<T extends RpcInterface>(definition: RpcInterfaceDefinition<T>, routing: RpcRoutingToken, configuration: new () => RpcConfiguration): void; /** Obtains the instance of an RPC configuration class. */ static obtain<T extends RpcConfiguration>(configurationConstructor: new () => T): T; /** @internal Enables passing of application-specific context with each RPC request. */ static requestContext: RpcRequestContext; /** @internal */ attached: RpcInterfaceDefinition[]; /** The protocol of the configuration. * @internal */ abstract readonly protocol: RpcProtocol; /** The RPC interfaces managed by the configuration. */ abstract readonly interfaces: () => RpcInterfaceDefinition[]; /** @internal */ allowAttachedInterfaces: boolean; /** @internal */ get attachedInterfaces(): ReadonlyArray<RpcInterfaceDefinition>; /** The target interval (in milliseconds) between connection attempts for pending RPC operation requests. */ pendingOperationRetryInterval: number; /** The maximum number of transient faults permitted before request failure. */ transientFaultLimit: number; /** @internal */ readonly routing: RpcRoutingToken; /** The control channel for the configuration. * @internal */ readonly controlChannel: RpcControlChannel; /** @internal */ attach<T extends RpcInterface>(definition: RpcInterfaceDefinition<T>): void; /** Initializes the RPC interfaces managed by the configuration. */ static initializeInterfaces(configuration: RpcConfiguration): void; /** @internal */ static supply(definition: RpcInterface): RpcConfiguration; /** @internal */ onRpcClientInitialized(definition: RpcInterfaceDefinition, client: RpcInterface): void; /** @internal */ onRpcImplInitialized(definition: RpcInterfaceDefinition, impl: RpcInterface): void; /** @internal */ onRpcClientTerminated(definition: RpcInterfaceDefinition, client: RpcInterface): void; /** @internal */ onRpcImplTerminated(definition: RpcInterfaceDefinition, impl: RpcInterface): void; } /** A default configuration that can be used for basic testing within a library. * @internal */ export declare class RpcDefaultConfiguration extends RpcConfiguration { interfaces: () => never[]; protocol: RpcProtocol; } /** A default protocol that can be used for basic testing within a library. * @internal */ export declare class RpcDirectProtocol extends RpcProtocol { readonly requestType: typeof RpcDirectRequest; } /** A default request type that can be used for basic testing within a library. * @internal */ export declare class RpcDirectRequest extends RpcRequest { headers: Map<string, string>; fulfillment: RpcRequestFulfillment | undefined; protected send(): Promise<number>; protected setHeader(name: string, value: string): void; protected load(): Promise<import("./RpcMarshaling").RpcSerializedValue>; } //# sourceMappingURL=RpcConfiguration.d.ts.map