"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.initializeRpcBackend = initializeRpcBackend;
const core_common_1 = require("@itwin/core-common");
const multipart_1 = require("./rpc/multipart");
const tracing_1 = require("./rpc/tracing");
const logging_1 = require("./rpc/web/logging");
const request_1 = require("./rpc/web/request");
const response_1 = require("./rpc/web/response");
let initialized = false;
/** @internal */
function initializeRpcBackend(enableOpenTelemetry = false) {
    if (initialized)
        return;
    (0, tracing_1.initializeTracing)(enableOpenTelemetry);
    core_common_1.RpcMultipart.platform.createStream = multipart_1.createMultipartStream;
    core_common_1.RpcMultipart.platform.parseRequest = multipart_1.parseMultipartRequest;
    core_common_1.RpcMultipart.platform.appendToForm = multipart_1.appendToMultipartForm;
    core_common_1.WebAppRpcRequest.backend.sendResponse = response_1.sendResponse;
    core_common_1.WebAppRpcRequest.backend.parseRequest = request_1.parseRequest;
    core_common_1.WebAppRpcLogging.initializeBackend(new logging_1.WebAppRpcLoggingBackend());
    initialized = true;
}
//# sourceMappingURL=RpcBackend.js.map