UNPKG

@microsoft/kiota

Version:

npm package exposing Kiota CLI functionality to TypeScript

26 lines 889 B
import * as rpc from "vscode-jsonrpc/node"; import connectToKiota from '../connect'; /** * Retrieves the version of Kiota by connecting to the Kiota service. * * @returns {Promise<string | undefined>} A promise that resolves to the Kiota version string if available, otherwise undefined. * @throws {Error} If an error occurs while connecting to the Kiota service or retrieving the version. */ export async function getKiotaVersion() { const result = await connectToKiota(async (connection) => { const request = new rpc.RequestType0("GetVersion"); return await connection.sendRequest(request); }); if (result instanceof Error) { throw result; } if (result) { const version = result.split("+")[0]; if (version) { return version; } } return undefined; } ; //# sourceMappingURL=getKiotaVersion.js.map