/*! @azure/msal-common v14.12.0 2024-06-10 */ 'use strict'; import { ThrottlingUtils } from './ThrottlingUtils.mjs'; import { AuthError } from '../error/AuthError.mjs'; import { createClientAuthError } from '../error/ClientAuthError.mjs'; import { networkError } from '../error/ClientAuthErrorCodes.mjs'; /* * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. */ /** @internal */ class NetworkManager { constructor(networkClient, cacheManager) { this.networkClient = networkClient; this.cacheManager = cacheManager; } /** * Wraps sendPostRequestAsync with necessary preflight and postflight logic * @param thumbprint * @param tokenEndpoint * @param options */ async sendPostRequest(thumbprint, tokenEndpoint, options) { ThrottlingUtils.preProcess(this.cacheManager, thumbprint); let response; try { response = await this.networkClient.sendPostRequestAsync(tokenEndpoint, options); } catch (e) { if (e instanceof AuthError) { throw e; } else { throw createClientAuthError(networkError); } } ThrottlingUtils.postProcess(this.cacheManager, thumbprint, response); return response; } } export { NetworkManager }; //# sourceMappingURL=NetworkManager.mjs.map