@itwin/core-common
Version:
iTwin.js components common to frontend and backend
49 lines • 2.79 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 RpcInterface
*/
import { RpcInterface } from "../RpcInterface";
import { RpcManager } from "../RpcManager";
/** Options to get the backend statistics
* @internal
*/
export var DevToolsStatsOptions;
(function (DevToolsStatsOptions) {
DevToolsStatsOptions[DevToolsStatsOptions["None"] = 0] = "None";
/** All unitized values are setup as formatted strings with the appropriate units */
DevToolsStatsOptions[DevToolsStatsOptions["FormatUnits"] = 1] = "FormatUnits";
})(DevToolsStatsOptions || (DevToolsStatsOptions = {}));
/** The purpose of this class is to house RPC methods for developer tools.
* Note that this should NOT be used in production environments.
* @internal
*/
export class DevToolsRpcInterface extends RpcInterface {
/** Returns the IModelReadRpcInterface instance for the frontend. */
static getClient() { return RpcManager.getClientForInterface(DevToolsRpcInterface); }
/** The immutable name of the interface. */
static interfaceName = "DevToolsRpcInterface";
/** The semantic version of the interface.
* @note The DevToolsRpcInterface will remain at 0.x since it is for testing only and not intended for production.
*/
static interfaceVersion = "0.7.0";
/*===========================================================================================
NOTE: Any add/remove/change to the methods below requires an update of the interface version.
NOTE: Please consult the README in this folder for the semantic versioning rules.
==========================================================================================*/
// Sends a ping and returns true if the backend received the ping
async ping(_iModelToken) { return this.forward(arguments); }
// Returns JSON object with backend performance and memory statistics
async stats(_iModelToken, _options) { return this.forward(arguments); }
// Returns JSON object with backend versions (application and iModelJs)
async versions(_iModelToken) {
const versions = await this.forward(arguments) || {};
versions.availableRpcs = await RpcManager.describeAvailableEndpoints();
return versions;
}
// Sets a new log level for the specified category and returns the old log level
async setLogLevel(_iModelToken, _loggerCategory, _logLevel) { return this.forward(arguments); }
}
//# sourceMappingURL=DevToolsRpcInterface.js.map