@azure/msal-common 7.6.0 → 8.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/dist/_virtual/_tslib.js +1 -1
  2. package/dist/account/AuthToken.js +1 -1
  3. package/dist/account/CcsCredential.js +1 -1
  4. package/dist/account/ClientInfo.js +1 -1
  5. package/dist/authority/Authority.js +1 -1
  6. package/dist/authority/AuthorityFactory.js +1 -1
  7. package/dist/authority/AuthorityMetadata.js +1 -1
  8. package/dist/authority/AuthorityOptions.js +1 -1
  9. package/dist/authority/AuthorityType.js +1 -1
  10. package/dist/authority/CloudInstanceDiscoveryResponse.js +1 -1
  11. package/dist/authority/OpenIdConfigResponse.js +1 -1
  12. package/dist/authority/ProtocolMode.js +1 -1
  13. package/dist/authority/RegionDiscovery.js +1 -1
  14. package/dist/cache/CacheManager.js +1 -1
  15. package/dist/cache/entities/AccessTokenEntity.js +1 -1
  16. package/dist/cache/entities/AccountEntity.js +1 -1
  17. package/dist/cache/entities/AppMetadataEntity.js +1 -1
  18. package/dist/cache/entities/AuthorityMetadataEntity.js +1 -1
  19. package/dist/cache/entities/CacheRecord.js +1 -1
  20. package/dist/cache/entities/CredentialEntity.js +1 -1
  21. package/dist/cache/entities/IdTokenEntity.js +1 -1
  22. package/dist/cache/entities/RefreshTokenEntity.js +1 -1
  23. package/dist/cache/entities/ServerTelemetryEntity.js +1 -1
  24. package/dist/cache/entities/ThrottlingEntity.js +1 -1
  25. package/dist/cache/persistence/TokenCacheContext.js +1 -1
  26. package/dist/client/AuthorizationCodeClient.js +1 -1
  27. package/dist/client/BaseClient.js +1 -1
  28. package/dist/client/ClientCredentialClient.js +1 -1
  29. package/dist/client/DeviceCodeClient.js +1 -1
  30. package/dist/client/OnBehalfOfClient.js +1 -1
  31. package/dist/client/RefreshTokenClient.d.ts.map +1 -1
  32. package/dist/client/RefreshTokenClient.js +11 -11
  33. package/dist/client/RefreshTokenClient.js.map +1 -1
  34. package/dist/client/SilentFlowClient.js +1 -1
  35. package/dist/client/UsernamePasswordClient.js +1 -1
  36. package/dist/config/ClientConfiguration.js +1 -1
  37. package/dist/crypto/ICrypto.js +1 -1
  38. package/dist/crypto/JoseHeader.js +1 -1
  39. package/dist/crypto/PopTokenGenerator.js +1 -1
  40. package/dist/error/AuthError.js +1 -1
  41. package/dist/error/ClientAuthError.js +1 -1
  42. package/dist/error/ClientConfigurationError.js +1 -1
  43. package/dist/error/InteractionRequiredAuthError.js +1 -1
  44. package/dist/error/JoseHeaderError.js +1 -1
  45. package/dist/error/ServerError.js +1 -1
  46. package/dist/index.cjs.js +40 -24
  47. package/dist/index.cjs.js.map +1 -1
  48. package/dist/index.d.ts +1 -1
  49. package/dist/index.d.ts.map +1 -1
  50. package/dist/index.js +1 -1
  51. package/dist/logger/Logger.js +1 -1
  52. package/dist/network/INetworkModule.js +1 -1
  53. package/dist/network/NetworkManager.js +1 -1
  54. package/dist/network/ThrottlingUtils.js +1 -1
  55. package/dist/packageMetadata.d.ts +1 -1
  56. package/dist/packageMetadata.js +2 -2
  57. package/dist/packageMetadata.js.map +1 -1
  58. package/dist/request/AuthenticationHeaderParser.js +1 -1
  59. package/dist/request/RequestParameterBuilder.js +1 -1
  60. package/dist/request/RequestValidator.js +1 -1
  61. package/dist/request/ScopeSet.js +1 -1
  62. package/dist/response/ResponseHandler.js +1 -1
  63. package/dist/telemetry/performance/IPerformanceClient.d.ts +3 -1
  64. package/dist/telemetry/performance/IPerformanceClient.d.ts.map +1 -1
  65. package/dist/telemetry/performance/PerformanceClient.d.ts +12 -1
  66. package/dist/telemetry/performance/PerformanceClient.d.ts.map +1 -1
  67. package/dist/telemetry/performance/PerformanceClient.js +29 -13
  68. package/dist/telemetry/performance/PerformanceClient.js.map +1 -1
  69. package/dist/telemetry/performance/PerformanceEvent.d.ts +62 -39
  70. package/dist/telemetry/performance/PerformanceEvent.d.ts.map +1 -1
  71. package/dist/telemetry/performance/PerformanceEvent.js +1 -1
  72. package/dist/telemetry/performance/PerformanceEvent.js.map +1 -1
  73. package/dist/telemetry/performance/StubPerformanceClient.js +1 -1
  74. package/dist/telemetry/server/ServerTelemetryManager.js +1 -1
  75. package/dist/url/UrlString.js +1 -1
  76. package/dist/utils/Constants.js +1 -1
  77. package/dist/utils/ProtocolUtils.js +1 -1
  78. package/dist/utils/StringUtils.js +1 -1
  79. package/dist/utils/TimeUtils.js +1 -1
  80. package/package.json +1 -1
package/dist/index.cjs.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v7.6.0 2022-10-10 */
1
+ /*! @azure/msal-common v8.0.0 2022-11-07 */
2
2
  'use strict';
3
3
  'use strict';
4
4
 
@@ -1409,7 +1409,7 @@ var Logger = /** @class */ (function () {
1409
1409
 
1410
1410
  /* eslint-disable header/header */
1411
1411
  var name = "@azure/msal-common";
1412
- var version = "7.6.0";
1412
+ var version = "8.0.0";
1413
1413
 
1414
1414
  /*
1415
1415
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6010,27 +6010,28 @@ var RefreshTokenClient = /** @class */ (function (_super) {
6010
6010
  return _super.call(this, configuration, performanceClient) || this;
6011
6011
  }
6012
6012
  RefreshTokenClient.prototype.acquireToken = function (request) {
6013
- var _a, _b;
6013
+ var _a, _b, _c;
6014
6014
  return __awaiter(this, void 0, void 0, function () {
6015
6015
  var atsMeasurement, reqTimestamp, response, requestId, responseHandler;
6016
6016
  var _this = this;
6017
- return __generator(this, function (_c) {
6018
- switch (_c.label) {
6017
+ return __generator(this, function (_d) {
6018
+ switch (_d.label) {
6019
6019
  case 0:
6020
6020
  atsMeasurement = (_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.startMeasurement(exports.PerformanceEvents.RefreshTokenClientAcquireToken, request.correlationId);
6021
6021
  this.logger.verbose("RefreshTokenClientAcquireToken called", request.correlationId);
6022
6022
  reqTimestamp = TimeUtils.nowSeconds();
6023
6023
  return [4 /*yield*/, this.executeTokenRequest(request, this.authority)];
6024
6024
  case 1:
6025
- response = _c.sent();
6026
- requestId = (_b = response.headers) === null || _b === void 0 ? void 0 : _b[exports.HeaderNames.X_MS_REQUEST_ID];
6025
+ response = _d.sent();
6026
+ atsMeasurement === null || atsMeasurement === void 0 ? void 0 : atsMeasurement.addStaticFields({
6027
+ refreshTokenSize: ((_b = response.body.refresh_token) === null || _b === void 0 ? void 0 : _b.length) || 0
6028
+ });
6029
+ requestId = (_c = response.headers) === null || _c === void 0 ? void 0 : _c[exports.HeaderNames.X_MS_REQUEST_ID];
6027
6030
  responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.config.serializableCache, this.config.persistencePlugin);
6028
6031
  responseHandler.validateTokenResponse(response.body);
6029
6032
  return [2 /*return*/, responseHandler.handleServerTokenResponse(response.body, this.authority, reqTimestamp, request, undefined, undefined, true, request.forceCache, requestId).then(function (result) {
6030
- var _a;
6031
6033
  atsMeasurement === null || atsMeasurement === void 0 ? void 0 : atsMeasurement.endMeasurement({
6032
- success: true,
6033
- refreshTokenSize: ((_a = response.body.refresh_token) === null || _a === void 0 ? void 0 : _a.length) || 0
6034
+ success: true
6034
6035
  });
6035
6036
  return result;
6036
6037
  })
@@ -6039,8 +6040,7 @@ var RefreshTokenClient = /** @class */ (function (_super) {
6039
6040
  atsMeasurement === null || atsMeasurement === void 0 ? void 0 : atsMeasurement.endMeasurement({
6040
6041
  errorCode: error.errorCode,
6041
6042
  subErrorCode: error.subError,
6042
- success: false,
6043
- refreshTokenSize: undefined
6043
+ success: false
6044
6044
  });
6045
6045
  throw error;
6046
6046
  })];
@@ -8265,6 +8265,7 @@ var PerformanceClient = /** @class */ (function () {
8265
8265
  this.logger = logger;
8266
8266
  this.callbacks = new Map();
8267
8267
  this.eventsByCorrelationId = new Map();
8268
+ this.staticFieldsByCorrelationId = new Map();
8268
8269
  this.measurementsById = new Map();
8269
8270
  }
8270
8271
  /**
@@ -8291,8 +8292,6 @@ var PerformanceClient = /** @class */ (function () {
8291
8292
  authority: this.authority,
8292
8293
  libraryName: this.libraryName,
8293
8294
  libraryVersion: this.libraryVersion,
8294
- appName: (_a = this.applicationTelemetry) === null || _a === void 0 ? void 0 : _a.appName,
8295
- appVersion: (_b = this.applicationTelemetry) === null || _b === void 0 ? void 0 : _b.appVersion,
8296
8295
  clientId: this.clientId,
8297
8296
  name: measureName,
8298
8297
  startTimeMs: Date.now(),
@@ -8300,6 +8299,11 @@ var PerformanceClient = /** @class */ (function () {
8300
8299
  };
8301
8300
  // Store in progress events so they can be discarded if not ended properly
8302
8301
  this.cacheEventByCorrelationId(inProgressEvent);
8302
+ var staticFields = {
8303
+ appName: (_a = this.applicationTelemetry) === null || _a === void 0 ? void 0 : _a.appName,
8304
+ appVersion: (_b = this.applicationTelemetry) === null || _b === void 0 ? void 0 : _b.appVersion,
8305
+ };
8306
+ this.addStaticFields(staticFields, eventCorrelationId);
8303
8307
  this.cacheMeasurement(inProgressEvent, performanceMeasurement);
8304
8308
  // Return the event and functions the caller can use to properly end/flush the measurement
8305
8309
  return {
@@ -8317,6 +8321,9 @@ var PerformanceClient = /** @class */ (function () {
8317
8321
  discardMeasurement: function () {
8318
8322
  return _this.discardMeasurements(inProgressEvent.correlationId);
8319
8323
  },
8324
+ addStaticFields: function (fields) {
8325
+ return _this.addStaticFields(fields, inProgressEvent.correlationId);
8326
+ },
8320
8327
  measurement: performanceMeasurement,
8321
8328
  event: inProgressEvent
8322
8329
  };
@@ -8352,6 +8359,22 @@ var PerformanceClient = /** @class */ (function () {
8352
8359
  }
8353
8360
  return null;
8354
8361
  };
8362
+ /**
8363
+ * Saves extra information to be emitted when the measurements are flushed
8364
+ * @param fields
8365
+ * @param correlationId
8366
+ */
8367
+ PerformanceClient.prototype.addStaticFields = function (fields, correlationId) {
8368
+ var existingStaticFields = this.staticFieldsByCorrelationId.get(correlationId);
8369
+ if (existingStaticFields) {
8370
+ this.logger.trace("PerformanceClient: Updating static fields");
8371
+ this.staticFieldsByCorrelationId.set(correlationId, __assign(__assign({}, existingStaticFields), fields));
8372
+ }
8373
+ else {
8374
+ this.logger.trace("PerformanceClient: Adding static fields");
8375
+ this.staticFieldsByCorrelationId.set(correlationId, fields);
8376
+ }
8377
+ };
8355
8378
  /**
8356
8379
  * Upserts event into event cache.
8357
8380
  * First key is the correlation id, second key is the event id.
@@ -8441,19 +8464,12 @@ var PerformanceClient = /** @class */ (function () {
8441
8464
  else {
8442
8465
  _this.logger.verbose("PerformanceClient: Submeasurement for " + measureName + " already exists for " + current.name + ", ignoring", correlationId);
8443
8466
  }
8444
- if (current.accessTokenSize) {
8445
- previous.accessTokenSize = current.accessTokenSize;
8446
- }
8447
- if (current.idTokenSize) {
8448
- previous.idTokenSize = current.idTokenSize;
8449
- }
8450
- if (current.refreshTokenSize) {
8451
- previous.refreshTokenSize = current.refreshTokenSize;
8452
- }
8453
8467
  }
8454
8468
  return previous;
8455
8469
  }, topLevelEvent);
8456
- this.emitEvents([eventToEmit], eventToEmit.correlationId);
8470
+ var staticFields = this.staticFieldsByCorrelationId.get(correlationId);
8471
+ var finalEvent = __assign(__assign({}, eventToEmit), staticFields);
8472
+ this.emitEvents([finalEvent], eventToEmit.correlationId);
8457
8473
  }
8458
8474
  else {
8459
8475
  this.logger.verbose("PerformanceClient: No completed top-level measurements found for " + measureName, correlationId);