@itwin/presentation-common
Version:
Common pieces for iModel.js presentation packages
198 lines • 13.5 kB
TypeScript
/** @packageDocumentation
* @module RPC
*/
import { Id64String } from "@itwin/core-bentley";
import { IModelRpcProps, RpcInterface } from "@itwin/core-common";
import { DescriptorJSON, DescriptorOverrides, SelectClassInfoJSON } from "./content/Descriptor.js";
import { ItemJSON } from "./content/Item.js";
import { DisplayValueGroup } from "./content/Value.js";
import { ClientDiagnostics, ClientDiagnosticsOptions } from "./Diagnostics.js";
import { CompressedClassInfoJSON, InstanceKey } from "./EC.js";
import { ElementProperties } from "./ElementProperties.js";
import { PresentationStatus } from "./Error.js";
import { NodeKey } from "./hierarchy/Key.js";
import { Node } from "./hierarchy/Node.js";
import { NodePathElement } from "./hierarchy/NodePathElement.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, SelectionScopeRequestOptions, SingleElementPropertiesRequestOptions } from "./PresentationManagerOptions.js";
import { RulesetVariableJSON } from "./RulesetVariables.js";
import { SelectionScope } from "./selection/SelectionScope.js";
import { Omit, PagedResponse } from "./Utils.js";
/**
* Base options for all presentation RPC requests.
* @public
*/
export type PresentationRpcRequestOptions<TManagerRequestOptions> = Omit<TManagerRequestOptions, "imodel" | "diagnostics"> & {
/** @internal ID of the client requesting data */
clientId?: string;
/** RPC request diagnostics options. */
diagnostics?: RpcDiagnosticsOptions;
};
/**
* Data structure for presentation RPC responses
* @public
*/
export interface PresentationRpcResponseData<TResult = undefined> {
/** Response status code */
statusCode: PresentationStatus;
/** In case of an error response, the error message */
errorMessage?: string;
/** In case of a success response, the result */
result?: TResult;
/** Diagnostics response. */
diagnostics?: ClientDiagnostics;
}
/**
* Data structure for RPC diagnostics options.
* @public
*/
export type RpcDiagnosticsOptions = Omit<ClientDiagnosticsOptions, "handler">;
/**
* A promise of [[PresentationRpcResponseData]].
* @public
*/
export type PresentationRpcResponse<TResult = undefined> = Promise<PresentationRpcResponseData<TResult>>;
/**
* Data structure for hierarchy request options.
* @public
* @deprecated in 5.2 - will not be removed until after 2026-10-01. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)
* package for creating hierarchies.
*/
export type HierarchyRpcRequestOptions = PresentationRpcRequestOptions<HierarchyRequestOptions<never, NodeKey, RulesetVariableJSON>>;
/**
* Data structure for hierarchy level descriptor RPC request options.
* @public
* @deprecated in 5.2 - will not be removed until after 2026-10-01. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)
* package for creating hierarchies.
*/
export type HierarchyLevelDescriptorRpcRequestOptions = PresentationRpcRequestOptions<HierarchyLevelDescriptorRequestOptions<never, NodeKey, RulesetVariableJSON>>;
/**
* Data structure for filtering hierarchy by ECInstance paths request options.
* @public
* @deprecated in 5.2 - will not be removed until after 2026-10-01. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)
* package for creating hierarchies.
*/
export type FilterByInstancePathsHierarchyRpcRequestOptions = PresentationRpcRequestOptions<FilterByInstancePathsHierarchyRequestOptions<never, RulesetVariableJSON>>;
/**
* Data structure for filtering hierarchy by text request options.
* @public
* @deprecated in 5.2 - will not be removed until after 2026-10-01. Use the new [@itwin/presentation-hierarchies](https://github.com/iTwin/presentation/blob/master/packages/hierarchies/README.md)
* package for creating hierarchies.
*/
export type FilterByTextHierarchyRpcRequestOptions = PresentationRpcRequestOptions<FilterByTextHierarchyRequestOptions<never, RulesetVariableJSON>>;
/**
* Data structure for content sources RPC request options.
* @public
*/
export type ContentSourcesRpcRequestOptions = PresentationRpcRequestOptions<ContentSourcesRequestOptions<never>>;
/**
* Data structure for content sources RPC response.
* @public
*/
export interface ContentSourcesRpcResult {
/** A list of objects containing content source information. */
sources: SelectClassInfoJSON<Id64String>[];
/** An `ECClassId` => [[CompressedClassInfoJSON]] map for deserializing [[sources]]. */
classesMap: {
[id: string]: CompressedClassInfoJSON;
};
}
/**
* Data structure for content descriptor RPC request options.
* @public
*/
export type ContentDescriptorRpcRequestOptions = PresentationRpcRequestOptions<ContentDescriptorRequestOptions<never, KeySetJSON, RulesetVariableJSON>>;
/**
* Data structure for content RPC request options.
* @public
*/
export type ContentRpcRequestOptions = PresentationRpcRequestOptions<ContentRequestOptions<never, DescriptorOverrides, KeySetJSON, RulesetVariableJSON>>;
/**
* Data structure for single element properties RPC request options.
* @public
*/
export type SingleElementPropertiesRpcRequestOptions = PresentationRpcRequestOptions<Omit<SingleElementPropertiesRequestOptions<never, never>, "contentParser">>;
/**
* Data structure for distinct values' request options.
* @public
*/
export type DistinctValuesRpcRequestOptions = PresentationRpcRequestOptions<DistinctValuesRequestOptions<never, DescriptorOverrides, KeySetJSON, RulesetVariableJSON>>;
/**
* Data structure for content instance keys' request options.
* @public
*/
export type ContentInstanceKeysRpcRequestOptions = PresentationRpcRequestOptions<ContentInstanceKeysRequestOptions<never, KeySetJSON, RulesetVariableJSON>>;
/**
* Data structure for label request options.
* @public
*/
export type DisplayLabelRpcRequestOptions = PresentationRpcRequestOptions<DisplayLabelRequestOptions<never, InstanceKey>>;
/**
* Data structure for labels request options.
* @public
*/
export type DisplayLabelsRpcRequestOptions = PresentationRpcRequestOptions<DisplayLabelsRequestOptions<never, InstanceKey>>;
/**
* Data structure for selection scope request options.
* @public
* @deprecated in 5.0 - will not be removed until after 2026-06-13. Use `computeSelection` from [@itwin/unified-selection](https://github.com/iTwin/presentation/blob/master/packages/unified-selection/README.md#selection-scopes) package instead.
*/
export type SelectionScopeRpcRequestOptions = PresentationRpcRequestOptions<SelectionScopeRequestOptions<never>>;
/**
* Request options data structure for computing selection based on given selection scope and element IDs.
* @public
* @deprecated in 5.0 - will not be removed until after 2026-06-13. Use `computeSelection` from [@itwin/unified-selection](https://github.com/iTwin/presentation/blob/master/packages/unified-selection/README.md#selection-scopes) package instead.
*/
export type ComputeSelectionRpcRequestOptions = PresentationRpcRequestOptions<ComputeSelectionRequestOptions<never>>;
/**
* Interface used for communication between Presentation backend and frontend.
* @public
*/
export declare class PresentationRpcInterface extends RpcInterface {
/** The immutable name of the interface. */
static readonly interfaceName = "PresentationRpcInterface";
/** The semantic version of the interface. */
static interfaceVersion: string;
/** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */
getNodesCount(_token: IModelRpcProps, _options: HierarchyRpcRequestOptions): PresentationRpcResponse<number>;
/** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */
getPagedNodes(_token: IModelRpcProps, _options: Paged<HierarchyRpcRequestOptions>): PresentationRpcResponse<PagedResponse<Node>>;
/** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */
getNodesDescriptor(_token: IModelRpcProps, _options: HierarchyLevelDescriptorRpcRequestOptions): PresentationRpcResponse<string | DescriptorJSON | undefined>;
/** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */
getNodePaths(_token: IModelRpcProps, _options: FilterByInstancePathsHierarchyRpcRequestOptions): PresentationRpcResponse<NodePathElement[]>;
/** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */
getFilteredNodePaths(_token: IModelRpcProps, _options: FilterByTextHierarchyRpcRequestOptions): PresentationRpcResponse<NodePathElement[]>;
/** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */
getContentSources(_token: IModelRpcProps, _options: ContentSourcesRpcRequestOptions): PresentationRpcResponse<ContentSourcesRpcResult>;
/** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */
getContentDescriptor(_token: IModelRpcProps, _options: ContentDescriptorRpcRequestOptions): PresentationRpcResponse<DescriptorJSON | undefined>;
/** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */
getContentSetSize(_token: IModelRpcProps, _options: ContentRpcRequestOptions): PresentationRpcResponse<number>;
/** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */
getPagedContent(_token: IModelRpcProps, _options: Paged<ContentRpcRequestOptions>): PresentationRpcResponse<{
descriptor: DescriptorJSON;
contentSet: PagedResponse<ItemJSON>;
} | undefined>;
/** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */
getPagedContentSet(_token: IModelRpcProps, _options: Paged<ContentRpcRequestOptions>): PresentationRpcResponse<PagedResponse<ItemJSON>>;
/** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */
getElementProperties(_token: IModelRpcProps, _options: SingleElementPropertiesRpcRequestOptions): PresentationRpcResponse<ElementProperties | undefined>;
/** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */
getPagedDistinctValues(_token: IModelRpcProps, _options: DistinctValuesRpcRequestOptions): PresentationRpcResponse<PagedResponse<DisplayValueGroup>>;
/** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */
getContentInstanceKeys(_token: IModelRpcProps, _options: ContentInstanceKeysRpcRequestOptions): PresentationRpcResponse<{
total: number;
items: KeySetJSON;
}>;
/** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */
getDisplayLabelDefinition(_token: IModelRpcProps, _options: DisplayLabelRpcRequestOptions): PresentationRpcResponse<LabelDefinition>;
/** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */
getPagedDisplayLabelDefinitions(_token: IModelRpcProps, _options: DisplayLabelsRpcRequestOptions): PresentationRpcResponse<PagedResponse<LabelDefinition>>;
/** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */
getSelectionScopes(_token: IModelRpcProps, _options: SelectionScopeRpcRequestOptions): PresentationRpcResponse<SelectionScope[]>;
/** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */
computeSelection(_token: IModelRpcProps, _options: ComputeSelectionRpcRequestOptions): PresentationRpcResponse<KeySetJSON>;
}
//# sourceMappingURL=PresentationRpcInterface.d.ts.map