Estructura inicial del proyecto

This commit is contained in:
2026-06-02 16:57:08 +00:00
commit 8b306b9afc
9864 changed files with 1435687 additions and 0 deletions

View File

@ -0,0 +1,20 @@
/*! @azure/msal-common v16.6.2 2026-05-19 */
'use strict';
import { createClientAuthError } from '../error/ClientAuthError.mjs';
import { methodNotImplemented } from '../error/ClientAuthErrorCodes.mjs';
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
const StubbedNetworkModule = {
sendGetRequestAsync: () => {
return Promise.reject(createClientAuthError(methodNotImplemented));
},
sendPostRequestAsync: () => {
return Promise.reject(createClientAuthError(methodNotImplemented));
},
};
export { StubbedNetworkModule };
//# sourceMappingURL=INetworkModule.mjs.map

View File

@ -0,0 +1 @@
{"version":3,"file":"INetworkModule.mjs","sources":["../../src/network/INetworkModule.ts"],"sourcesContent":[null],"names":["ClientAuthErrorCodes.methodNotImplemented"],"mappings":";;;;;AAAA;;;AAGG;AA4CU,MAAA,oBAAoB,GAAmB;IAChD,mBAAmB,EAAE,MAAK;QACtB,OAAO,OAAO,CAAC,MAAM,CACjB,qBAAqB,CAACA,oBAAyC,CAAC,CACnE,CAAC;KACL;IACD,oBAAoB,EAAE,MAAK;QACvB,OAAO,OAAO,CAAC,MAAM,CACjB,qBAAqB,CAACA,oBAAyC,CAAC,CACnE,CAAC;KACL;;;;;"}

View File

@ -0,0 +1,24 @@
/*! @azure/msal-common v16.6.2 2026-05-19 */
'use strict';
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
function getRequestThumbprint(clientId, request, homeAccountId) {
return {
clientId: clientId,
authority: request.authority,
scopes: request.scopes,
homeAccountIdentifier: homeAccountId,
claims: request.claims,
authenticationScheme: request.authenticationScheme,
resourceRequestMethod: request.resourceRequestMethod,
resourceRequestUri: request.resourceRequestUri,
shrClaims: request.shrClaims,
sshKid: request.sshKid,
embeddedClientId: request.embeddedClientId || request.extraParameters?.clientId,
};
}
export { getRequestThumbprint };
//# sourceMappingURL=RequestThumbprint.mjs.map

View File

@ -0,0 +1 @@
{"version":3,"file":"RequestThumbprint.mjs","sources":["../../src/network/RequestThumbprint.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;;;AAGG;SAwBa,oBAAoB,CAChC,QAAgB,EAChB,OAAwB,EACxB,aAAsB,EAAA;IAEtB,OAAO;AACH,QAAA,QAAQ,EAAE,QAAQ;QAClB,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,MAAM,EAAE,OAAO,CAAC,MAAM;AACtB,QAAA,qBAAqB,EAAE,aAAa;QACpC,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,oBAAoB,EAAE,OAAO,CAAC,oBAAoB;QAClD,qBAAqB,EAAE,OAAO,CAAC,qBAAqB;QACpD,kBAAkB,EAAE,OAAO,CAAC,kBAAkB;QAC9C,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,gBAAgB,EACZ,OAAO,CAAC,gBAAgB,IAAI,OAAO,CAAC,eAAe,EAAE,QAAQ;KACpE,CAAC;AACN;;;;"}

View File

@ -0,0 +1,92 @@
/*! @azure/msal-common v16.6.2 2026-05-19 */
'use strict';
import { THROTTLING_PREFIX, HeaderNames, DEFAULT_THROTTLE_TIME_SECONDS, DEFAULT_MAX_THROTTLE_TIME_SECONDS } from '../utils/Constants.mjs';
import { ServerError } from '../error/ServerError.mjs';
import { getRequestThumbprint } from './RequestThumbprint.mjs';
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
/** @internal */
class ThrottlingUtils {
/**
* Prepares a RequestThumbprint to be stored as a key.
* @param thumbprint
*/
static generateThrottlingStorageKey(thumbprint) {
return `${THROTTLING_PREFIX}.${JSON.stringify(thumbprint)}`;
}
/**
* Performs necessary throttling checks before a network request.
* @param cacheManager
* @param thumbprint
*/
static preProcess(cacheManager, thumbprint, correlationId) {
const key = ThrottlingUtils.generateThrottlingStorageKey(thumbprint);
const value = cacheManager.getThrottlingCache(key, correlationId);
if (value) {
if (value.throttleTime < Date.now()) {
cacheManager.removeItem(key, correlationId);
return;
}
throw new ServerError(value.errorCodes?.join(" ") || "", value.errorMessage, value.subError);
}
}
/**
* Performs necessary throttling checks after a network request.
* @param cacheManager
* @param thumbprint
* @param response
*/
static postProcess(cacheManager, thumbprint, response, correlationId) {
if (ThrottlingUtils.checkResponseStatus(response) ||
ThrottlingUtils.checkResponseForRetryAfter(response)) {
const thumbprintValue = {
throttleTime: ThrottlingUtils.calculateThrottleTime(parseInt(response.headers[HeaderNames.RETRY_AFTER])),
error: response.body.error,
errorCodes: response.body.error_codes,
errorMessage: response.body.error_description,
subError: response.body.suberror,
};
cacheManager.setThrottlingCache(ThrottlingUtils.generateThrottlingStorageKey(thumbprint), thumbprintValue, correlationId);
}
}
/**
* Checks a NetworkResponse object's status codes against 429 or 5xx
* @param response
*/
static checkResponseStatus(response) {
return (response.status === 429 ||
(response.status >= 500 && response.status < 600));
}
/**
* Checks a NetworkResponse object's RetryAfter header
* @param response
*/
static checkResponseForRetryAfter(response) {
if (response.headers) {
return (response.headers.hasOwnProperty(HeaderNames.RETRY_AFTER) &&
(response.status < 200 || response.status >= 300));
}
return false;
}
/**
* Calculates the Unix-time value for a throttle to expire given throttleTime in seconds.
* @param throttleTime
*/
static calculateThrottleTime(throttleTime) {
const time = throttleTime <= 0 ? 0 : throttleTime;
const currentSeconds = Date.now() / 1000;
return Math.floor(Math.min(currentSeconds +
(time || DEFAULT_THROTTLE_TIME_SECONDS), currentSeconds + DEFAULT_MAX_THROTTLE_TIME_SECONDS) * 1000);
}
static removeThrottle(cacheManager, clientId, request, homeAccountIdentifier) {
const thumbprint = getRequestThumbprint(clientId, request, homeAccountIdentifier);
const key = this.generateThrottlingStorageKey(thumbprint);
cacheManager.removeItem(key, request.correlationId);
}
}
export { ThrottlingUtils };
//# sourceMappingURL=ThrottlingUtils.mjs.map

View File

@ -0,0 +1 @@
{"version":3,"file":"ThrottlingUtils.mjs","sources":["../../src/network/ThrottlingUtils.ts"],"sourcesContent":[null],"names":["Constants.THROTTLING_PREFIX","Constants.HeaderNames","Constants.DEFAULT_THROTTLE_TIME_SECONDS","Constants.DEFAULT_MAX_THROTTLE_TIME_SECONDS"],"mappings":";;;;;;AAAA;;;AAGG;AAcH;MACa,eAAe,CAAA;AACxB;;;AAGG;IACH,OAAO,4BAA4B,CAAC,UAA6B,EAAA;AAC7D,QAAA,OAAO,CAAG,EAAAA,iBAA2B,CAAI,CAAA,EAAA,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAA,CAAE,CAAC;KACzE;AAED;;;;AAIG;AACH,IAAA,OAAO,UAAU,CACb,YAA0B,EAC1B,UAA6B,EAC7B,aAAqB,EAAA;QAErB,MAAM,GAAG,GAAG,eAAe,CAAC,4BAA4B,CAAC,UAAU,CAAC,CAAC;QACrE,MAAM,KAAK,GAAG,YAAY,CAAC,kBAAkB,CAAC,GAAG,EAAE,aAAa,CAAC,CAAC;AAElE,QAAA,IAAI,KAAK,EAAE;YACP,IAAI,KAAK,CAAC,YAAY,GAAG,IAAI,CAAC,GAAG,EAAE,EAAE;AACjC,gBAAA,YAAY,CAAC,UAAU,CAAC,GAAG,EAAE,aAAa,CAAC,CAAC;gBAC5C,OAAO;AACV,aAAA;YACD,MAAM,IAAI,WAAW,CACjB,KAAK,CAAC,UAAU,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,EACjC,KAAK,CAAC,YAAY,EAClB,KAAK,CAAC,QAAQ,CACjB,CAAC;AACL,SAAA;KACJ;AAED;;;;;AAKG;IACH,OAAO,WAAW,CACd,YAA0B,EAC1B,UAA6B,EAC7B,QAA2D,EAC3D,aAAqB,EAAA;AAErB,QAAA,IACI,eAAe,CAAC,mBAAmB,CAAC,QAAQ,CAAC;AAC7C,YAAA,eAAe,CAAC,0BAA0B,CAAC,QAAQ,CAAC,EACtD;AACE,YAAA,MAAM,eAAe,GAAqB;AACtC,gBAAA,Y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