UNPKG

@itwin/presentation-common

Version:

Common pieces for iModel.js presentation packages

78 lines 5.69 kB
/** @packageDocumentation * @module RPC */ import { IModelRpcProps } from "@itwin/core-common"; import { DescriptorJSON, DescriptorOverrides } from "./content/Descriptor.js"; import { ItemJSON } from "./content/Item.js"; import { ClientDiagnosticsAttribute } from "./Diagnostics.js"; import { InstanceKey } from "./EC.js"; import { NodeKey } from "./hierarchy/Key.js"; import { Node } from "./hierarchy/Node.js"; import { KeySetJSON } from "./KeySet.js"; import { LabelDefinition } from "./LabelDefinition.js"; import { ComputeSelectionRequestOptions, ContentDescriptorRequestOptions, ContentInstanceKeysRequestOptions, ContentRequestOptions, ContentSourcesRequestOptions, DisplayLabelRequestOptions, DisplayLabelsRequestOptions, DistinctValuesRequestOptions, FilterByInstancePathsHierarchyRequestOptions, FilterByTextHierarchyRequestOptions, HierarchyLevelDescriptorRequestOptions, HierarchyRequestOptions, Paged, RequestOptions, SelectionScopeRequestOptions } from "./PresentationManagerOptions.js"; import { ContentSourcesRpcResult, PresentationRpcRequestOptions, PresentationRpcResponse } from "./PresentationRpcInterface.js"; import { RulesetVariableJSON } from "./RulesetVariables.js"; import { SelectionScope } from "./selection/SelectionScope.js"; import { PagedResponse } from "./Utils.js"; import { NodePathElement } from "./hierarchy/NodePathElement.js"; import { DisplayValueGroup } from "./content/Value.js"; /** * Configuration parameters for [[RpcRequestsHandler]]. * * @internal */ export interface RpcRequestsHandlerProps { /** * Optional ID used to identify client that requests data. If not specified, * the handler creates a unique GUID as a client id. * @internal */ clientId?: string; /** @internal */ timeout?: number; } /** * RPC requests handler that wraps [[PresentationRpcInterface]] and * adds handling for cases when backend needs to be synced with client * state. * * @internal */ export declare class RpcRequestsHandler { /** Timeout for how long the handler going to wait for RPC request to be fulfilled before throwing a timeout error. */ readonly timeout: number; /** ID that identifies this handler as a client */ readonly clientId: string; constructor(props?: RpcRequestsHandlerProps); private get rpcClient(); private requestWithTimeout; /** * Send the request to backend. We'll wait for the response for `this.timeout` ms, and if we don't get the response by * then, we'll throw an error. */ request<TResult, TOptions extends RequestOptions<IModelRpcProps> & ClientDiagnosticsAttribute, TArg = any>(func: (token: IModelRpcProps, options: PresentationRpcRequestOptions<TOptions>, ...args: TArg[]) => PresentationRpcResponse<TResult>, options: TOptions, ...additionalOptions: TArg[]): Promise<TResult>; getNodesCount(options: HierarchyRequestOptions<IModelRpcProps, NodeKey, RulesetVariableJSON> & ClientDiagnosticsAttribute): Promise<number>; getPagedNodes(options: Paged<HierarchyRequestOptions<IModelRpcProps, NodeKey, RulesetVariableJSON>> & ClientDiagnosticsAttribute): Promise<PagedResponse<Node>>; getNodesDescriptor(options: HierarchyLevelDescriptorRequestOptions<IModelRpcProps, NodeKey, RulesetVariableJSON> & ClientDiagnosticsAttribute): Promise<DescriptorJSON | undefined>; getNodePaths(options: FilterByInstancePathsHierarchyRequestOptions<IModelRpcProps, RulesetVariableJSON> & ClientDiagnosticsAttribute): Promise<NodePathElement[]>; getFilteredNodePaths(options: FilterByTextHierarchyRequestOptions<IModelRpcProps, RulesetVariableJSON> & ClientDiagnosticsAttribute): Promise<NodePathElement[]>; getContentSources(options: ContentSourcesRequestOptions<IModelRpcProps> & ClientDiagnosticsAttribute): Promise<ContentSourcesRpcResult>; getContentDescriptor(options: ContentDescriptorRequestOptions<IModelRpcProps, KeySetJSON, RulesetVariableJSON> & ClientDiagnosticsAttribute): Promise<DescriptorJSON | undefined>; getContentSetSize(options: ContentRequestOptions<IModelRpcProps, DescriptorOverrides, KeySetJSON, RulesetVariableJSON> & ClientDiagnosticsAttribute): Promise<number>; getPagedContent(options: Paged<ContentRequestOptions<IModelRpcProps, DescriptorOverrides, KeySetJSON, RulesetVariableJSON> & ClientDiagnosticsAttribute>): Promise<{ descriptor: DescriptorJSON; contentSet: PagedResponse<ItemJSON>; } | undefined>; getPagedContentSet(options: Paged<ContentRequestOptions<IModelRpcProps, DescriptorOverrides, KeySetJSON, RulesetVariableJSON> & ClientDiagnosticsAttribute>): Promise<PagedResponse<ItemJSON>>; getPagedDistinctValues(options: DistinctValuesRequestOptions<IModelRpcProps, DescriptorOverrides, KeySetJSON, RulesetVariableJSON> & ClientDiagnosticsAttribute): Promise<PagedResponse<DisplayValueGroup>>; getContentInstanceKeys(options: ContentInstanceKeysRequestOptions<IModelRpcProps, KeySetJSON, RulesetVariableJSON> & ClientDiagnosticsAttribute): Promise<{ total: number; items: KeySetJSON; }>; getDisplayLabelDefinition(options: DisplayLabelRequestOptions<IModelRpcProps, InstanceKey> & ClientDiagnosticsAttribute): Promise<LabelDefinition>; getPagedDisplayLabelDefinitions(options: DisplayLabelsRequestOptions<IModelRpcProps, InstanceKey> & ClientDiagnosticsAttribute): Promise<PagedResponse<LabelDefinition>>; getSelectionScopes(options: SelectionScopeRequestOptions<IModelRpcProps> & ClientDiagnosticsAttribute): Promise<SelectionScope[]>; computeSelection(options: ComputeSelectionRequestOptions<IModelRpcProps> & ClientDiagnosticsAttribute): Promise<KeySetJSON>; } //# sourceMappingURL=RpcRequestsHandler.d.ts.map