UNPKG

@microsoft/kiota

Version:

npm package exposing Kiota CLI functionality to TypeScript

26 lines 1.26 kB
import * as rpc from "vscode-jsonrpc/node"; import connectToKiota from "../connect"; /** * Updates the clients by connecting to Kiota and sending a request to update. * * @param {UpdateClientsConfiguration} config - The configuration object containing the following properties: * @param {boolean} config.cleanOutput - Whether to clean the output directory before updating. * @param {boolean} config.clearCache - Whether to clear the cache before updating. * @param {string} config.workspacePath - The path to the workspace where the clients are located. * * @returns {Promise<KiotaLogEntry[] | undefined>} A promise that resolves to an array of Kiota log entries if the update is successful, or undefined if there is an error. * * @throws {Error} Throws an error if the result of the update is an instance of Error. */ export async function updateClients({ cleanOutput, clearCache, workspacePath }) { const result = await connectToKiota(async (connection) => { const request = new rpc.RequestType3("Update"); return await connection.sendRequest(request, workspacePath, cleanOutput, clearCache); }); if (result instanceof Error) { throw result; } return result; } ; //# sourceMappingURL=updateClients.js.map