UNPKG

@itwin/core-common

Version:

iTwin.js components common to frontend and backend

53 lines 3.05 kB
"use strict"; /*--------------------------------------------------------------------------------------------- * 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 */ Object.defineProperty(exports, "__esModule", { value: true }); exports.DevToolsRpcInterface = exports.DevToolsStatsOptions = void 0; const RpcInterface_1 = require("../RpcInterface"); const RpcManager_1 = require("../RpcManager"); /** Options to get the backend statistics * @internal */ 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 || (exports.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 */ class DevToolsRpcInterface extends RpcInterface_1.RpcInterface { /** Returns the IModelReadRpcInterface instance for the frontend. */ static getClient() { return RpcManager_1.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_1.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); } } exports.DevToolsRpcInterface = DevToolsRpcInterface; //# sourceMappingURL=DevToolsRpcInterface.js.map