UNPKG

@microsoft/agents-m365copilot-core

Version:

Core functionalities for the Microsoft Agents M365 Copilot JavaScript SDK

30 lines 1.64 kB
import { TelemetryHandler, appendRequestHeader } from "@microsoft/kiota-http-fetchlibrary"; import { coreVersion } from "../utils/Version.js"; /** * Adds telemetry headers to requests made to the Agents M365 Copilot API */ export class AgentsM365CopilotTelemetryHandler extends TelemetryHandler { /** * Creates a new instance of the AgentsM365CopilotTelemetryHandler class */ constructor(agentsM365CopilotTelemetryOption) { var _a; const productPrefix = (_a = agentsM365CopilotTelemetryOption.agentsM365CopilotProductPrefix) !== null && _a !== void 0 ? _a : "agents-M365-copilot-typescript"; const coreProduct = `${productPrefix}-core/${coreVersion}`; let product = ""; if (agentsM365CopilotTelemetryOption.agentsM365CopilotServiceLibraryClientVersion) { const serviceLibVersion = agentsM365CopilotTelemetryOption.agentsM365CopilotServiceTargetVersion ? `-${agentsM365CopilotTelemetryOption.agentsM365CopilotServiceTargetVersion}` : ""; product = `${productPrefix}${serviceLibVersion}/${agentsM365CopilotTelemetryOption.agentsM365CopilotServiceLibraryClientVersion}`; } const versionHeaderValue = product ? `${product}, ${coreProduct}` : coreProduct; super({ telemetryConfigurator: (_url, requestInit, _requestOptions, _telemetryInformation) => { appendRequestHeader(requestInit, "SdkVersion", versionHeaderValue); }, getKey: () => "agentsM365CopilotTelemetryOption", }); } } //# sourceMappingURL=agentsM365CopilotTelemetryHandler.js.map