@itwin/presentation-common
Version:
Common pieces for iModel.js presentation packages
116 lines • 7.67 kB
JavaScript
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
/** @packageDocumentation
* @module RPC
*/
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import { RpcInterface, RpcOperation } from "@itwin/core-common";
import { deepReplaceNullsToUndefined } from "./Utils.js";
/**
* Interface used for communication between Presentation backend and frontend.
* @public
*/
let PresentationRpcInterface = class PresentationRpcInterface extends RpcInterface {
/** The immutable name of the interface. */
static interfaceName = "PresentationRpcInterface";
/** The semantic version of the interface. */
static interfaceVersion = "5.0.0";
/*===========================================================================================
NOTE: Any add/remove/change to the methods below requires an update of the interface version.
NOTE: Please consult the README in core/common/src/rpc for the semantic versioning rules.
===========================================================================================*/
/** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */
async getNodesCount(_token, _options) {
return this.forward(arguments);
}
/** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */
async getPagedNodes(_token, _options) {
return deepReplaceNullsToUndefined(await this.forward(arguments));
}
/** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */
async getNodesDescriptor(_token, _options) {
return deepReplaceNullsToUndefined(await this.forward(arguments));
}
/** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */
// TODO: add paged version of this (#387280)
async getNodePaths(_token, _options) {
return deepReplaceNullsToUndefined(await this.forward(arguments));
}
/** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */
// TODO: add paged version of this (#387280)
async getFilteredNodePaths(_token, _options) {
return deepReplaceNullsToUndefined(await this.forward(arguments));
}
/** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */
async getContentSources(_token, _options) {
return deepReplaceNullsToUndefined(await this.forward(arguments));
}
/** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */
async getContentDescriptor(_token, _options) {
const response = await this.forward(arguments);
return {
...response,
...(response.result ? { result: JSON.parse(response.result) } : {}),
};
}
/** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */
async getContentSetSize(_token, _options) {
return this.forward(arguments);
}
/** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */
async getPagedContent(_token, _options) {
const rpcResponse = await this.forward(arguments);
return {
...rpcResponse,
...(rpcResponse.result
? /* c8 ignore next */ { result: { ...rpcResponse.result, contentSet: deepReplaceNullsToUndefined(rpcResponse.result.contentSet) } }
: {}),
};
}
/** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */
async getPagedContentSet(_token, _options) {
return deepReplaceNullsToUndefined(await this.forward(arguments));
}
/** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */
async getElementProperties(_token, _options) {
return deepReplaceNullsToUndefined(await this.forward(arguments));
}
/** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */
async getPagedDistinctValues(_token, _options) {
return deepReplaceNullsToUndefined(await this.forward(arguments));
}
/** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */
async getContentInstanceKeys(_token, _options) {
return this.forward(arguments);
}
/** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */
async getDisplayLabelDefinition(_token, _options) {
return deepReplaceNullsToUndefined(await this.forward(arguments));
}
/** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */
async getPagedDisplayLabelDefinitions(_token, _options) {
return deepReplaceNullsToUndefined(await this.forward(arguments));
}
/** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */
// eslint-disable-next-line @typescript-eslint/no-deprecated
async getSelectionScopes(_token, _options) {
return this.forward(arguments);
}
/** @deprecated in 4.10 - will not be removed until after 2026-06-13. Use [PresentationManager]($presentation-frontend) instead of calling the RPC interface directly. */
// eslint-disable-next-line @typescript-eslint/no-deprecated
async computeSelection(_token, _options) {
return this.forward(arguments);
}
};
PresentationRpcInterface = __decorate([
RpcOperation.setDefaultPolicy({ retryInterval: () => 0 })
], PresentationRpcInterface);
export { PresentationRpcInterface };
//# sourceMappingURL=PresentationRpcInterface.js.map