Commit 3a84cbd5 authored by Ahmet Turan Koçak's avatar Ahmet Turan Koçak
Browse files

Initial commit

parents
{"version":3,"file":"PerformanceClient.d.ts","sourceRoot":"","sources":["../../../src/telemetry/performance/PerformanceClient.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,0BAA0B,EAAE,kBAAkB,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAC;AACnH,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAA0B,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAE/G,8BAAsB,iBAAkB,YAAW,kBAAkB;IACjE,SAAS,CAAC,SAAS,EAAE,MAAM,CAAC;IAC5B,SAAS,CAAC,WAAW,EAAE,MAAM,CAAC;IAC9B,SAAS,CAAC,cAAc,EAAE,MAAM,CAAC;IACjC,SAAS,CAAC,oBAAoB,EAAE,oBAAoB,CAAC;IACrD,SAAS,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC3B,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,2BAA2B,CAAC,CAAC;IAE9D;;;;;OAKG;IACH,SAAS,CAAC,qBAAqB,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAAC;IAE5E;;;OAGG;IACH,SAAS,CAAC,2BAA2B,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IAEjE;;;;;OAKG;IACH,SAAS,CAAC,gBAAgB,EAAE,GAAG,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAAC;IAEjE;;;;;;;;;;OAUG;gBACS,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,oBAAoB,EAAE,oBAAoB;IAaxJ;;;;;;;OAOG;IACH,QAAQ,CAAC,4BAA4B,CAAC,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,uBAAuB;IAE1G;;;;;OAKG;IACH,QAAQ,CAAC,UAAU,IAAI,MAAM;IAE7B;;;;;;OAMG;IACH,gBAAgB,CAAC,WAAW,EAAE,iBAAiB,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,0BAA0B;IAiEpG;;;;;;OAMG;IACH,cAAc,CAAC,KAAK,EAAE,gBAAgB,GAAG,gBAAgB,GAAG,IAAI;IA6BhE;;;;OAIG;IACH,eAAe,CAAC,MAAM,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,GAAI,IAAI;IAWnE;;;;;;;;OAQG;IACH,OAAO,CAAC,yBAAyB;IAWjC;;;;;;OAMG;IACH,OAAO,CAAC,gBAAgB;IAIxB;;;;;OAKG;IACH,iBAAiB,CAAC,WAAW,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,GAAG,IAAI;IA8E9E;;;;OAIG;IACH,mBAAmB,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI;IAKhD;;;;;OAKG;IACH,sBAAsB,CAAC,QAAQ,EAAE,2BAA2B,GAAG,MAAM;IAQrE;;;;;OAKG;IACH,yBAAyB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;IAYtD;;;;;OAKG;IACH,UAAU,CAAC,MAAM,EAAE,gBAAgB,EAAE,EAAE,aAAa,EAAE,MAAM,GAAG,IAAI;CAStE"}
\ No newline at end of file
/*! @azure/msal-common v9.0.1 2022-12-07 */
'use strict';
import { __assign } from '../../_virtual/_tslib.js';
import { PerformanceEventStatus } from './PerformanceEvent.js';
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
var PerformanceClient = /** @class */ (function () {
/**
* Creates an instance of PerformanceClient,
* an abstract class containing core performance telemetry logic.
*
* @constructor
* @param {string} clientId Client ID of the application
* @param {string} authority Authority used by the application
* @param {Logger} logger Logger used by the application
* @param {string} libraryName Name of the library
* @param {string} libraryVersion Version of the library
*/
function PerformanceClient(clientId, authority, logger, libraryName, libraryVersion, applicationTelemetry) {
this.authority = authority;
this.libraryName = libraryName;
this.libraryVersion = libraryVersion;
this.applicationTelemetry = applicationTelemetry;
this.clientId = clientId;
this.logger = logger;
this.callbacks = new Map();
this.eventsByCorrelationId = new Map();
this.staticFieldsByCorrelationId = new Map();
this.measurementsById = new Map();
}
/**
* Starts measuring performance for a given operation. Returns a function that should be used to end the measurement.
*
* @param {PerformanceEvents} measureName
* @param {?string} [correlationId]
* @returns {InProgressPerformanceEvent}
*/
PerformanceClient.prototype.startMeasurement = function (measureName, correlationId) {
var _this = this;
var _a, _b;
// Generate a placeholder correlation if the request does not provide one
var eventCorrelationId = correlationId || this.generateId();
if (!correlationId) {
this.logger.info("PerformanceClient: No correlation id provided for " + measureName + ", generating", eventCorrelationId);
}
this.logger.trace("PerformanceClient: Performance measurement started for " + measureName, eventCorrelationId);
var performanceMeasurement = this.startPerformanceMeasuremeant(measureName, eventCorrelationId);
performanceMeasurement.startMeasurement();
var inProgressEvent = {
eventId: this.generateId(),
status: PerformanceEventStatus.InProgress,
authority: this.authority,
libraryName: this.libraryName,
libraryVersion: this.libraryVersion,
clientId: this.clientId,
name: measureName,
startTimeMs: Date.now(),
correlationId: eventCorrelationId,
};
// Store in progress events so they can be discarded if not ended properly
this.cacheEventByCorrelationId(inProgressEvent);
var staticFields = {
appName: (_a = this.applicationTelemetry) === null || _a === void 0 ? void 0 : _a.appName,
appVersion: (_b = this.applicationTelemetry) === null || _b === void 0 ? void 0 : _b.appVersion,
};
this.addStaticFields(staticFields, eventCorrelationId);
this.cacheMeasurement(inProgressEvent, performanceMeasurement);
// Return the event and functions the caller can use to properly end/flush the measurement
return {
endMeasurement: function (event) {
var completedEvent = _this.endMeasurement(__assign(__assign({}, inProgressEvent), event));
if (completedEvent) {
// Cache event so that submeasurements can be added downstream
_this.cacheEventByCorrelationId(completedEvent);
}
return completedEvent;
},
flushMeasurement: function () {
return _this.flushMeasurements(inProgressEvent.name, inProgressEvent.correlationId);
},
discardMeasurement: function () {
return _this.discardMeasurements(inProgressEvent.correlationId);
},
addStaticFields: function (fields) {
return _this.addStaticFields(fields, inProgressEvent.correlationId);
},
measurement: performanceMeasurement,
event: inProgressEvent
};
};
/**
* Stops measuring the performance for an operation. Should only be called directly by PerformanceClient classes,
* as consumers should instead use the function returned by startMeasurement.
*
* @param {PerformanceEvent} event
* @returns {(PerformanceEvent | null)}
*/
PerformanceClient.prototype.endMeasurement = function (event) {
var performanceMeasurement = this.measurementsById.get(event.eventId);
if (performanceMeasurement) {
// Immediately delete so that the same event isnt ended twice
this.measurementsById.delete(event.eventId);
performanceMeasurement.endMeasurement();
var durationMs = performanceMeasurement.flushMeasurement();
// null indicates no measurement was taken (e.g. needed performance APIs not present)
if (durationMs !== null) {
this.logger.trace("PerformanceClient: Performance measurement ended for " + event.name + ": " + durationMs + " ms", event.correlationId);
var completedEvent = __assign(__assign({
// Allow duration to be overwritten when event ends (e.g. testing), but not status
durationMs: Math.round(durationMs) }, event), { status: PerformanceEventStatus.Completed });
return completedEvent;
}
else {
this.logger.trace("PerformanceClient: Performance measurement not taken", event.correlationId);
}
}
else {
this.logger.trace("PerformanceClient: Measurement not found for " + event.eventId, event.correlationId);
}
return null;
};
/**
* Saves extra information to be emitted when the measurements are flushed
* @param fields
* @param correlationId
*/
PerformanceClient.prototype.addStaticFields = function (fields, correlationId) {
var existingStaticFields = this.staticFieldsByCorrelationId.get(correlationId);
if (existingStaticFields) {
this.logger.trace("PerformanceClient: Updating static fields");
this.staticFieldsByCorrelationId.set(correlationId, __assign(__assign({}, existingStaticFields), fields));
}
else {
this.logger.trace("PerformanceClient: Adding static fields");
this.staticFieldsByCorrelationId.set(correlationId, fields);
}
};
/**
* Upserts event into event cache.
* First key is the correlation id, second key is the event id.
* Allows for events to be grouped by correlation id,
* and to easily allow for properties on them to be updated.
*
* @private
* @param {PerformanceEvent} event
*/
PerformanceClient.prototype.cacheEventByCorrelationId = function (event) {
var existingEvents = this.eventsByCorrelationId.get(event.correlationId);
if (existingEvents) {
this.logger.trace("PerformanceClient: Performance measurement for " + event.name + " added/updated", event.correlationId);
existingEvents.set(event.eventId, event);
}
else {
this.logger.trace("PerformanceClient: Performance measurement for " + event.name + " started", event.correlationId);
this.eventsByCorrelationId.set(event.correlationId, new Map().set(event.eventId, event));
}
};
/**
* Cache measurements by their id.
*
* @private
* @param {PerformanceEvent} event
* @param {IPerformanceMeasurement} measurement
*/
PerformanceClient.prototype.cacheMeasurement = function (event, measurement) {
this.measurementsById.set(event.eventId, measurement);
};
/**
* Gathers and emits performance events for measurements taked for the given top-level API and correlation ID.
*
* @param {PerformanceEvents} measureName
* @param {string} correlationId
*/
PerformanceClient.prototype.flushMeasurements = function (measureName, correlationId) {
var _this = this;
this.logger.trace("PerformanceClient: Performance measurements flushed for " + measureName, correlationId);
var eventsForCorrelationId = this.eventsByCorrelationId.get(correlationId);
if (eventsForCorrelationId) {
this.discardMeasurements(correlationId);
/*
* Manually end incomplete submeasurements to ensure there arent orphaned/never ending events.
* Incomplete submeasurements are likely an instrumentation bug that should be fixed.
* IE only supports Map.forEach.
*/
var completedEvents_1 = [];
eventsForCorrelationId.forEach(function (event) {
if (event.name !== measureName && event.status !== PerformanceEventStatus.Completed) {
_this.logger.trace("PerformanceClient: Incomplete submeasurement " + event.name + " found for " + measureName, correlationId);
var completedEvent = _this.endMeasurement(event);
if (completedEvent) {
completedEvents_1.push(completedEvent);
}
}
completedEvents_1.push(event);
});
// Sort events by start time (earliest first)
var sortedCompletedEvents = completedEvents_1.sort(function (eventA, eventB) { return eventA.startTimeMs - eventB.startTimeMs; });
// Take completed top level event and add completed submeasurements durations as properties
var topLevelEvents = sortedCompletedEvents.filter(function (event) { return event.name === measureName && event.status === PerformanceEventStatus.Completed; });
if (topLevelEvents.length > 0) {
/*
* Only take the first top-level event if there are multiple events with the same correlation id.
* This greatly simplifies logic for submeasurements.
*/
if (topLevelEvents.length > 1) {
this.logger.verbose("PerformanceClient: Multiple distinct top-level performance events found, using the first", correlationId);
}
var topLevelEvent = topLevelEvents[0];
this.logger.verbose("PerformanceClient: Measurement found for " + measureName, correlationId);
// Build event object with top level and sub measurements
var eventToEmit = sortedCompletedEvents.reduce(function (previous, current) {
if (current.name !== measureName) {
_this.logger.trace("PerformanceClient: Complete submeasurement found for " + current.name, correlationId);
// TODO: Emit additional properties for each subMeasurement
var subMeasurementName = current.name + "DurationMs";
/*
* Some code paths, such as resolving an authority, can occur multiple times.
* Only take the first measurement, since the second could be read from the cache,
* or due to the same correlation id being used for two distinct requests.
*/
if (!previous[subMeasurementName]) {
previous[subMeasurementName] = current.durationMs;
}
else {
_this.logger.verbose("PerformanceClient: Submeasurement for " + measureName + " already exists for " + current.name + ", ignoring", correlationId);
}
}
return previous;
}, topLevelEvent);
var staticFields = this.staticFieldsByCorrelationId.get(correlationId);
var finalEvent = __assign(__assign({}, eventToEmit), staticFields);
this.emitEvents([finalEvent], eventToEmit.correlationId);
}
else {
this.logger.verbose("PerformanceClient: No completed top-level measurements found for " + measureName, correlationId);
}
}
else {
this.logger.verbose("PerformanceClient: No measurements found", correlationId);
}
};
/**
* Removes measurements for a given correlation id.
*
* @param {string} correlationId
*/
PerformanceClient.prototype.discardMeasurements = function (correlationId) {
this.logger.trace("PerformanceClient: Performance measurements discarded", correlationId);
this.eventsByCorrelationId.delete(correlationId);
};
/**
* Registers a callback function to receive performance events.
*
* @param {PerformanceCallbackFunction} callback
* @returns {string}
*/
PerformanceClient.prototype.addPerformanceCallback = function (callback) {
var callbackId = this.generateId();
this.callbacks.set(callbackId, callback);
this.logger.verbose("PerformanceClient: Performance callback registered with id: " + callbackId);
return callbackId;
};
/**
* Removes a callback registered with addPerformanceCallback.
*
* @param {string} callbackId
* @returns {boolean}
*/
PerformanceClient.prototype.removePerformanceCallback = function (callbackId) {
var result = this.callbacks.delete(callbackId);
if (result) {
this.logger.verbose("PerformanceClient: Performance callback " + callbackId + " removed.");
}
else {
this.logger.verbose("PerformanceClient: Performance callback " + callbackId + " not removed.");
}
return result;
};
/**
* Emits events to all registered callbacks.
*
* @param {PerformanceEvent[]} events
* @param {?string} [correlationId]
*/
PerformanceClient.prototype.emitEvents = function (events, correlationId) {
var _this = this;
this.logger.verbose("PerformanceClient: Emitting performance events", correlationId);
this.callbacks.forEach(function (callback, callbackId) {
_this.logger.trace("PerformanceClient: Emitting event to callback " + callbackId, correlationId);
callback.apply(null, [events]);
});
};
return PerformanceClient;
}());
export { PerformanceClient };
//# sourceMappingURL=PerformanceClient.js.map
{"version":3,"file":"PerformanceClient.js","sources":["../../../src/telemetry/performance/PerformanceClient.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ApplicationTelemetry } from \"../../config/ClientConfiguration\";\nimport { Logger } from \"../../logger/Logger\";\nimport { InProgressPerformanceEvent, IPerformanceClient, PerformanceCallbackFunction } from \"./IPerformanceClient\";\nimport { IPerformanceMeasurement } from \"./IPerformanceMeasurement\";\nimport { PerformanceEvent, PerformanceEvents, PerformanceEventStatus, StaticFields } from \"./PerformanceEvent\";\n\nexport abstract class PerformanceClient implements IPerformanceClient {\n protected authority: string;\n protected libraryName: string;\n protected libraryVersion: string;\n protected applicationTelemetry: ApplicationTelemetry;\n protected clientId: string;\n protected logger: Logger;\n protected callbacks: Map<string, PerformanceCallbackFunction>;\n\n /**\n * Multiple events with the same correlation id.\n * Double keyed by correlation id and event id.\n * @protected\n * @type {Map<string, Map<string, PerformanceEvent>>}\n */\n protected eventsByCorrelationId: Map<string, Map<string, PerformanceEvent>>;\n\n /**\n * Fields to be emitted which are scoped to the top level request and whose value will not change in submeasurements\n * For example: App name, version, etc.\n */\n protected staticFieldsByCorrelationId: Map<string, StaticFields>;\n\n /**\n * Underlying performance measurements for each operation\n *\n * @protected\n * @type {Map<string, IPerformanceMeasurement>}\n */\n protected measurementsById: Map<string, IPerformanceMeasurement>;\n\n /**\n * Creates an instance of PerformanceClient, \n * an abstract class containing core performance telemetry logic.\n *\n * @constructor\n * @param {string} clientId Client ID of the application\n * @param {string} authority Authority used by the application\n * @param {Logger} logger Logger used by the application\n * @param {string} libraryName Name of the library\n * @param {string} libraryVersion Version of the library\n */\n constructor(clientId: string, authority: string, logger: Logger, libraryName: string, libraryVersion: string, applicationTelemetry: ApplicationTelemetry) {\n this.authority = authority;\n this.libraryName = libraryName;\n this.libraryVersion = libraryVersion;\n this.applicationTelemetry = applicationTelemetry;\n this.clientId = clientId;\n this.logger = logger;\n this.callbacks = new Map();\n this.eventsByCorrelationId = new Map();\n this.staticFieldsByCorrelationId = new Map();\n this.measurementsById = new Map();\n }\n\n /**\n * Starts and returns an platform-specific implementation of IPerformanceMeasurement.\n *\n * @abstract\n * @param {string} measureName\n * @param {string} correlationId\n * @returns {IPerformanceMeasurement}\n */\n abstract startPerformanceMeasuremeant(measureName: string, correlationId: string): IPerformanceMeasurement;\n\n /**\n * Generates and returns a unique id, typically a guid.\n *\n * @abstract\n * @returns {string}\n */\n abstract generateId(): string;\n\n /**\n * Starts measuring performance for a given operation. Returns a function that should be used to end the measurement.\n *\n * @param {PerformanceEvents} measureName\n * @param {?string} [correlationId]\n * @returns {InProgressPerformanceEvent}\n */\n startMeasurement(measureName: PerformanceEvents, correlationId?: string): InProgressPerformanceEvent {\n // Generate a placeholder correlation if the request does not provide one\n const eventCorrelationId = correlationId || this.generateId();\n if (!correlationId) {\n this.logger.info(`PerformanceClient: No correlation id provided for ${measureName}, generating`, eventCorrelationId);\n }\n\n this.logger.trace(`PerformanceClient: Performance measurement started for ${measureName}`, eventCorrelationId);\n const performanceMeasurement = this.startPerformanceMeasuremeant(measureName, eventCorrelationId);\n performanceMeasurement.startMeasurement();\n\n const inProgressEvent: PerformanceEvent = {\n eventId: this.generateId(),\n status: PerformanceEventStatus.InProgress,\n authority: this.authority,\n libraryName: this.libraryName,\n libraryVersion: this.libraryVersion,\n clientId: this.clientId,\n name: measureName,\n startTimeMs: Date.now(),\n correlationId: eventCorrelationId,\n };\n\n // Store in progress events so they can be discarded if not ended properly\n this.cacheEventByCorrelationId(inProgressEvent);\n\n const staticFields: StaticFields = {\n appName: this.applicationTelemetry?.appName,\n appVersion: this.applicationTelemetry?.appVersion,\n };\n this.addStaticFields(staticFields, eventCorrelationId);\n this.cacheMeasurement(inProgressEvent, performanceMeasurement);\n\n // Return the event and functions the caller can use to properly end/flush the measurement\n return {\n endMeasurement: (event?: Partial<PerformanceEvent>): PerformanceEvent | null => {\n const completedEvent = this.endMeasurement({\n // Initial set of event properties\n ...inProgressEvent,\n // Properties set when event ends\n ...event\n });\n\n if (completedEvent) {\n // Cache event so that submeasurements can be added downstream\n this.cacheEventByCorrelationId(completedEvent);\n }\n\n return completedEvent;\n },\n flushMeasurement: () => {\n return this.flushMeasurements(inProgressEvent.name, inProgressEvent.correlationId);\n },\n discardMeasurement: () => {\n return this.discardMeasurements(inProgressEvent.correlationId);\n },\n addStaticFields: (fields: StaticFields) => {\n return this.addStaticFields(fields, inProgressEvent.correlationId);\n },\n measurement: performanceMeasurement,\n event: inProgressEvent\n };\n\n }\n\n /**\n * Stops measuring the performance for an operation. Should only be called directly by PerformanceClient classes,\n * as consumers should instead use the function returned by startMeasurement.\n *\n * @param {PerformanceEvent} event\n * @returns {(PerformanceEvent | null)}\n */\n endMeasurement(event: PerformanceEvent): PerformanceEvent | null {\n const performanceMeasurement = this.measurementsById.get(event.eventId);\n if (performanceMeasurement) {\n // Immediately delete so that the same event isnt ended twice\n this.measurementsById.delete(event.eventId);\n performanceMeasurement.endMeasurement();\n const durationMs = performanceMeasurement.flushMeasurement();\n // null indicates no measurement was taken (e.g. needed performance APIs not present)\n if (durationMs !== null) {\n this.logger.trace(`PerformanceClient: Performance measurement ended for ${event.name}: ${durationMs} ms`, event.correlationId);\n\n const completedEvent: PerformanceEvent = {\n // Allow duration to be overwritten when event ends (e.g. testing), but not status\n durationMs: Math.round(durationMs),\n ...event,\n status: PerformanceEventStatus.Completed,\n };\n\n return completedEvent;\n } else {\n this.logger.trace(\"PerformanceClient: Performance measurement not taken\", event.correlationId);\n }\n } else {\n this.logger.trace(`PerformanceClient: Measurement not found for ${event.eventId}`, event.correlationId);\n }\n\n return null;\n }\n\n /**\n * Saves extra information to be emitted when the measurements are flushed\n * @param fields \n * @param correlationId \n */\n addStaticFields(fields: StaticFields, correlationId: string) : void{\n const existingStaticFields = this.staticFieldsByCorrelationId.get(correlationId);\n if (existingStaticFields) {\n this.logger.trace(\"PerformanceClient: Updating static fields\");\n this.staticFieldsByCorrelationId.set(correlationId, {...existingStaticFields, ...fields});\n } else {\n this.logger.trace(\"PerformanceClient: Adding static fields\");\n this.staticFieldsByCorrelationId.set(correlationId, fields);\n }\n }\n\n /**\n * Upserts event into event cache.\n * First key is the correlation id, second key is the event id.\n * Allows for events to be grouped by correlation id,\n * and to easily allow for properties on them to be updated.\n *\n * @private\n * @param {PerformanceEvent} event\n */\n private cacheEventByCorrelationId(event: PerformanceEvent) {\n const existingEvents = this.eventsByCorrelationId.get(event.correlationId);\n if (existingEvents) {\n this.logger.trace(`PerformanceClient: Performance measurement for ${event.name} added/updated`, event.correlationId);\n existingEvents.set(event.eventId, event);\n } else {\n this.logger.trace(`PerformanceClient: Performance measurement for ${event.name} started`, event.correlationId);\n this.eventsByCorrelationId.set(event.correlationId, new Map().set(event.eventId, event));\n }\n }\n\n /**\n * Cache measurements by their id.\n *\n * @private\n * @param {PerformanceEvent} event\n * @param {IPerformanceMeasurement} measurement\n */\n private cacheMeasurement(event: PerformanceEvent, measurement: IPerformanceMeasurement) {\n this.measurementsById.set(event.eventId, measurement);\n }\n\n /**\n * Gathers and emits performance events for measurements taked for the given top-level API and correlation ID.\n *\n * @param {PerformanceEvents} measureName\n * @param {string} correlationId\n */\n flushMeasurements(measureName: PerformanceEvents, correlationId: string): void {\n this.logger.trace(`PerformanceClient: Performance measurements flushed for ${measureName}`, correlationId);\n const eventsForCorrelationId = this.eventsByCorrelationId.get(correlationId);\n if (eventsForCorrelationId) {\n this.discardMeasurements(correlationId);\n\n /*\n * Manually end incomplete submeasurements to ensure there arent orphaned/never ending events.\n * Incomplete submeasurements are likely an instrumentation bug that should be fixed.\n * IE only supports Map.forEach.\n */\n const completedEvents: PerformanceEvent[] = [];\n eventsForCorrelationId.forEach(event => {\n if (event.name !== measureName && event.status !== PerformanceEventStatus.Completed) {\n this.logger.trace(`PerformanceClient: Incomplete submeasurement ${event.name} found for ${measureName}`, correlationId);\n\n const completedEvent = this.endMeasurement(event);\n if (completedEvent) {\n completedEvents.push(completedEvent);\n }\n }\n\n completedEvents.push(event);\n });\n\n // Sort events by start time (earliest first)\n const sortedCompletedEvents = completedEvents.sort((eventA, eventB) => eventA.startTimeMs - eventB.startTimeMs);\n\n // Take completed top level event and add completed submeasurements durations as properties\n const topLevelEvents = sortedCompletedEvents.filter(event => event.name === measureName && event.status === PerformanceEventStatus.Completed);\n if (topLevelEvents.length > 0) {\n /*\n * Only take the first top-level event if there are multiple events with the same correlation id.\n * This greatly simplifies logic for submeasurements.\n */\n if (topLevelEvents.length > 1) {\n this.logger.verbose(\"PerformanceClient: Multiple distinct top-level performance events found, using the first\", correlationId);\n }\n const topLevelEvent = topLevelEvents[0];\n\n this.logger.verbose(`PerformanceClient: Measurement found for ${measureName}`, correlationId);\n\n // Build event object with top level and sub measurements\n const eventToEmit = sortedCompletedEvents.reduce((previous, current) => {\n if (current.name !== measureName) {\n this.logger.trace(`PerformanceClient: Complete submeasurement found for ${current.name}`, correlationId);\n // TODO: Emit additional properties for each subMeasurement\n const subMeasurementName = `${current.name}DurationMs`;\n /*\n * Some code paths, such as resolving an authority, can occur multiple times.\n * Only take the first measurement, since the second could be read from the cache,\n * or due to the same correlation id being used for two distinct requests.\n */\n if (!previous[subMeasurementName]) {\n previous[subMeasurementName] = current.durationMs;\n } else {\n this.logger.verbose(`PerformanceClient: Submeasurement for ${measureName} already exists for ${current.name}, ignoring`, correlationId);\n }\n }\n\n return previous;\n }, topLevelEvent);\n\n const staticFields = this.staticFieldsByCorrelationId.get(correlationId);\n const finalEvent: PerformanceEvent = {\n ...eventToEmit,\n ...staticFields\n };\n\n this.emitEvents([finalEvent], eventToEmit.correlationId);\n } else {\n this.logger.verbose(`PerformanceClient: No completed top-level measurements found for ${measureName}`, correlationId);\n }\n } else {\n this.logger.verbose(\"PerformanceClient: No measurements found\", correlationId);\n }\n }\n\n /**\n * Removes measurements for a given correlation id.\n *\n * @param {string} correlationId\n */\n discardMeasurements(correlationId: string): void {\n this.logger.trace(\"PerformanceClient: Performance measurements discarded\", correlationId);\n this.eventsByCorrelationId.delete(correlationId);\n }\n\n /**\n * Registers a callback function to receive performance events.\n *\n * @param {PerformanceCallbackFunction} callback\n * @returns {string}\n */\n addPerformanceCallback(callback: PerformanceCallbackFunction): string {\n const callbackId = this.generateId();\n this.callbacks.set(callbackId, callback);\n this.logger.verbose(`PerformanceClient: Performance callback registered with id: ${callbackId}`);\n\n return callbackId;\n }\n\n /**\n * Removes a callback registered with addPerformanceCallback.\n *\n * @param {string} callbackId\n * @returns {boolean}\n */\n removePerformanceCallback(callbackId: string): boolean {\n const result = this.callbacks.delete(callbackId);\n\n if (result) {\n this.logger.verbose(`PerformanceClient: Performance callback ${callbackId} removed.`);\n } else {\n this.logger.verbose(`PerformanceClient: Performance callback ${callbackId} not removed.`);\n }\n\n return result;\n }\n\n /**\n * Emits events to all registered callbacks.\n *\n * @param {PerformanceEvent[]} events\n * @param {?string} [correlationId]\n */\n emitEvents(events: PerformanceEvent[], correlationId: string): void {\n this.logger.verbose(\"PerformanceClient: Emitting performance events\", correlationId);\n\n this.callbacks.forEach((callback: PerformanceCallbackFunction, callbackId: string) => {\n this.logger.trace(`PerformanceClient: Emitting event to callback ${callbackId}`, correlationId);\n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C,CAAC;YAChG,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;AACnC,SAAC,CAAC,CAAC;KACN,CAAA;IAEL,OAAC,iBAAA,CAAA;AAAD,CAAC,EAAA;;;;"}
\ No newline at end of file
{"version":3,"file":"PerformanceEvent.d.ts","sourceRoot":"","sources":["../../../src/telemetry/performance/PerformanceEvent.ts"],"names":[],"mappings":"AAKA;;;;;GAKG;AACH,oBAAY,iBAAiB;IAEzB;;;OAGG;IACH,kBAAkB,uBAAuB;IAEzC;;;OAGG;IACH,0BAA0B,+BAA+B;IAEzD;;;OAGG;IACH,kBAAkB,uBAAuB;IAEzC;;;OAGG;IACH,uBAAuB,4BAA4B;IAEnD;;;OAGG;IACH,iBAAiB,sBAAsB;IAEvC;;;OAGG;IACH,gCAAgC,qCAAqC;IAErE;;;OAGG;IACH,iBAAiB,sBAAsB;IAEvC;;;OAGG;IACH,6BAA6B,kCAAkC;IAE/D;;;OAGG;IACH,8BAA8B,mCAAmC;IAEjE;;;OAGG;IACH,+BAA+B,oCAAoC;IAEnE;;;OAGG;IACH,SAAS,cAAc;IAEvB;;;OAGG;IACH,+CAA+C,oDAAoD;IAEnG;;;OAGG;IACH,8BAA8B,mCAAmC;IAEjE;;;OAGG;IACH,mCAAmC,wCAAwC;IAC3E;;OAEG;IACH,mCAAmC,wCAAwC;IAC3E;;OAEG;IACH,gBAAgB,oBAAoB;IACpC;;OAEG;IACH,kCAAkC,uCAAuC;IACzE;;OAEG;IACH,oBAAoB,yBAAyB;IAE7C;;OAEG;IACH,qCAAqC,0CAA0C;IAE/E;;OAEG;IACH,8BAA8B,mCAAmC;IAEjE;;OAEG;IACH,oDAAoD,yDAAyD;CAChH;AAED;;;;;GAKG;AACH,oBAAY,sBAAsB;IAC9B,UAAU,IAAA;IACV,UAAU,IAAA;IACV,SAAS,IAAA;CACZ;AAED;;GAEG;AACH,oBAAY,YAAY,GAAG;IACvB;;;;OAIG;IACH,iB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U,CAAC,EAAE,MAAM,CAAC;IAEpB;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAElC;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAE3B;;;;OAIG;IACH,IAAI,EAAE,iBAAiB,CAAC;IAExB;;;;;OAKG;IACH,mBAAmB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEpC;;;;OAIG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAEzB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;;OAIG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;;;OAIG;IACH,cAAc,EAAE,MAAM,CAAC;IAEvB;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;CACrB,CAAC"}
\ No newline at end of file
/*! @azure/msal-common v9.0.1 2022-12-07 */
'use strict';
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
/**
* Enumeration of operations that are instrumented by have their performance measured by the PerformanceClient.
*
* @export
* @enum {number}
*/
var PerformanceEvents;
(function (PerformanceEvents) {
/**
* acquireTokenByCode API (msal-browser and msal-node).
* Used to acquire tokens by trading an authorization code against the token endpoint.
*/
PerformanceEvents["AcquireTokenByCode"] = "acquireTokenByCode";
/**
* acquireTokenByRefreshToken API (msal-browser and msal-node).
* Used to renew an access token using a refresh token against the token endpoint.
*/
PerformanceEvents["AcquireTokenByRefreshToken"] = "acquireTokenByRefreshToken";
/**
* acquireTokenSilent API (msal-browser and msal-node).
* Used to silently acquire a new access token (from the cache or the network).
*/
PerformanceEvents["AcquireTokenSilent"] = "acquireTokenSilent";
/**
* acquireTokenSilentAsync (msal-browser).
* Internal API for acquireTokenSilent.
*/
PerformanceEvents["AcquireTokenSilentAsync"] = "acquireTokenSilentAsync";
/**
* acquireTokenPopup (msal-browser).
* Used to acquire a new access token interactively through pop ups
*/
PerformanceEvents["AcquireTokenPopup"] = "acquireTokenPopup";
/**
* getPublicKeyThumbprint API in CryptoOpts class (msal-browser).
* Used to generate a public/private keypair and generate a public key thumbprint for pop requests.
*/
PerformanceEvents["CryptoOptsGetPublicKeyThumbprint"] = "cryptoOptsGetPublicKeyThumbprint";
/**
* signJwt API in CryptoOpts class (msal-browser).
* Used to signed a pop token.
*/
PerformanceEvents["CryptoOptsSignJwt"] = "cryptoOptsSignJwt";
/**
* acquireToken API in the SilentCacheClient class (msal-browser).
* Used to read access tokens from the cache.
*/
PerformanceEvents["SilentCacheClientAcquireToken"] = "silentCacheClientAcquireToken";
/**
* acquireToken API in the SilentIframeClient class (msal-browser).
* Used to acquire a new set of tokens from the authorize endpoint in a hidden iframe.
*/
PerformanceEvents["SilentIframeClientAcquireToken"] = "silentIframeClientAcquireToken";
/**
* acquireToken API in SilentRereshClient (msal-browser).
* Used to acquire a new set of tokens from the token endpoint using a refresh token.
*/
PerformanceEvents["SilentRefreshClientAcquireToken"] = "silentRefreshClientAcquireToken";
/**
* ssoSilent API (msal-browser).
* Used to silently acquire an authorization code and set of tokens using a hidden iframe.
*/
PerformanceEvents["SsoSilent"] = "ssoSilent";
/**
* getDiscoveredAuthority API in StandardInteractionClient class (msal-browser).
* Used to load authority metadata for a request.
*/
PerformanceEvents["StandardInteractionClientGetDiscoveredAuthority"] = "standardInteractionClientGetDiscoveredAuthority";
/**
* acquireToken APIs in msal-browser.
* Used to make an /authorize endpoint call with native brokering enabled.
*/
PerformanceEvents["FetchAccountIdWithNativeBroker"] = "fetchAccountIdWithNativeBroker";
/**
* acquireToken API in NativeInteractionClient class (msal-browser).
* Used to acquire a token from Native component when native brokering is enabled.
*/
PerformanceEvents["NativeInteractionClientAcquireToken"] = "nativeInteractionClientAcquireToken";
/**
* Time spent creating default headers for requests to token endpoint
*/
PerformanceEvents["BaseClientCreateTokenRequestHeaders"] = "baseClientCreateTokenRequestHeaders";
/**
* Used to measure the time taken for completing embedded-broker handshake (PW-Broker).
*/
PerformanceEvents["BrokerHandhshake"] = "brokerHandshake";
/**
* acquireTokenByRefreshToken API in BrokerClientApplication (PW-Broker) .
*/
PerformanceEvents["AcquireTokenByRefreshTokenInBroker"] = "acquireTokenByRefreshTokenInBroker";
/**
* Time taken for token acquisition by broker
*/
PerformanceEvents["AcquireTokenByBroker"] = "acquireTokenByBroker";
/**
* Time spent on the network for refresh token acquisition
*/
PerformanceEvents["RefreshTokenClientExecuteTokenRequest"] = "refreshTokenClientExecuteTokenRequest";
/**
* Time taken for acquiring refresh token , records RT size
*/
PerformanceEvents["RefreshTokenClientAcquireToken"] = "refreshTokenClientAcquireToken";
/**
* Time taken for acquiring cached refresh token
*/
PerformanceEvents["RefreshTokenClientAcquireTokenWithCachedRefreshToken"] = "refreshTokenClientAcquireTokenWithCachedRefreshToken";
})(PerformanceEvents || (PerformanceEvents = {}));
/**
* State of the performance event.
*
* @export
* @enum {number}
*/
var PerformanceEventStatus;
(function (PerformanceEventStatus) {
PerformanceEventStatus[PerformanceEventStatus["NotStarted"] = 0] = "NotStarted";
PerformanceEventStatus[PerformanceEventStatus["InProgress"] = 1] = "InProgress";
PerformanceEventStatus[PerformanceEventStatus["Completed"] = 2] = "Completed";
})(PerformanceEventStatus || (PerformanceEventStatus = {}));
export { PerformanceEventStatus, PerformanceEvents };
//# sourceMappingURL=PerformanceEvent.js.map
{"version":3,"file":"PerformanceEvent.js","sources":["../../../src/telemetry/performance/PerformanceEvent.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Enumeration of operations that are instrumented by have their performance measured by the PerformanceClient.\n *\n * @export\n * @enum {number}\n */\nexport enum PerformanceEvents {\n\n /**\n * acquireTokenByCode API (msal-browser and msal-node).\n * Used to acquire tokens by trading an authorization code against the token endpoint.\n */\n AcquireTokenByCode = \"acquireTokenByCode\",\n\n /**\n * acquireTokenByRefreshToken API (msal-browser and msal-node).\n * Used to renew an access token using a refresh token against the token endpoint.\n */\n AcquireTokenByRefreshToken = \"acquireTokenByRefreshToken\",\n\n /**\n * acquireTokenSilent API (msal-browser and msal-node).\n * Used to silently acquire a new access token (from the cache or the network).\n */\n AcquireTokenSilent = \"acquireTokenSilent\",\n\n /**\n * acquireTokenSilentAsync (msal-browser).\n * Internal API for acquireTokenSilent.\n */\n AcquireTokenSilentAsync = \"acquireTokenSilentAsync\",\n\n /**\n * acquireTokenPopup (msal-browser).\n * Used to acquire a new access token interactively through pop ups\n */\n AcquireTokenPopup = \"acquireTokenPopup\",\n\n /**\n * getPublicKeyThumbprint API in CryptoOpts class (msal-browser).\n * Used to generate a public/private keypair and generate a public key thumbprint for pop requests.\n */\n CryptoOptsGetPublicKeyThumbprint = \"cryptoOptsGetPublicKeyThumbprint\",\n\n /**\n * signJwt API in CryptoOpts class (msal-browser).\n * Used to signed a pop token.\n */\n CryptoOptsSignJwt = \"cryptoOptsSignJwt\",\n\n /**\n * acquireToken API in the SilentCacheClient class (msal-browser).\n * Used to read access tokens from the cache.\n */\n SilentCacheClientAcquireToken = \"silentCacheClientAcquireToken\",\n\n /**\n * acquireToken API in the SilentIframeClient class (msal-browser).\n * Used to acquire a new set of tokens from the authorize endpoint in a hidden iframe.\n */\n SilentIframeClientAcquireToken = \"silentIframeClientAcquireToken\",\n\n /**\n * acquireToken API in SilentRereshClient (msal-browser).\n * Used to acquire a new set of tokens from the token endpoint using a refresh token.\n */\n SilentRefreshClientAcquireToken = \"silentRefreshClientAcquireToken\",\n\n /**\n * ssoSilent API (msal-browser).\n * Used to silently acquire an authorization code and set of tokens using a hidden iframe.\n */\n SsoSilent = \"ssoSilent\",\n\n /**\n * getDiscoveredAuthority API in StandardInteractionClient class (msal-browser).\n * Used to load authority metadata for a request.\n */\n StandardInteractionClientGetDiscoveredAuthority = \"standardInteractionClientGetDiscoveredAuthority\",\n\n /**\n * acquireToken APIs in msal-browser.\n * Used to make an /authorize endpoint call with native brokering enabled.\n */\n FetchAccountIdWithNativeBroker = \"fetchAccountIdWithNativeBroker\",\n\n /**\n * acquireToken API in NativeInteractionClient class (msal-browser).\n * Used to acquire a token from Native component when native brokering is enabled.\n */\n NativeInteractionClientAcquireToken = \"nativeInteractionClientAcquireToken\",\n /**\n * Time spent creating default headers for requests to token endpoint\n */\n BaseClientCreateTokenRequestHeaders = \"baseClientCreateTokenRequestHeaders\",\n /**\n * Used to measure the time taken for completing embedded-broker handshake (PW-Broker).\n */\n BrokerHandhshake = \"brokerHandshake\",\n /**\n * acquireTokenByRefreshToken API in BrokerClientApplication (PW-Broker) .\n */\n AcquireTokenByRefreshTokenInBroker = \"acquireTokenByRefreshTokenInBroker\",\n /**\n * Time taken for token acquisition by broker\n */\n AcquireTokenByBroker = \"acquireTokenByBroker\",\n\n /**\n * Time spent on the network for refresh token acquisition\n */\n RefreshTokenClientExecuteTokenRequest = \"refreshTokenClientExecuteTokenRequest\",\n\n /**\n * Time taken for acquiring refresh token , records RT size\n */\n RefreshTokenClientAcquireToken = \"refreshTokenClientAcquireToken\",\n\n /**\n * Time taken for acquiring cached refresh token \n */\n RefreshTokenClientAcquireTokenWithCachedRefreshToken = \"refreshTokenClientAcquireTokenWithCachedRefreshToken\",\n}\n\n/**\n * State of the performance event.\n *\n * @export\n * @enum {number}\n */\nexport enum PerformanceEventStatus {\n NotStarted,\n InProgress,\n Completed\n}\n\n/**\n * Fields whose value will not change throughout a request\n */\nexport type StaticFields = { \n /**\n * The Silent Token Cache Lookup Policy\n *\n * @type {?(number | undefined)}\n */\n cacheLookupPolicy?: number | undefined,\n\n /**\n * Size of the id token\n *\n * @type {number}\n */\n idTokenSize?: number,\n \n /**\n * \n * Size of the access token\n *\n * @type {number}\n */\n \n accessTokenSize?: number,\n\n /**\n * \n * Size of the refresh token\n *\n * @type {number}\n */\n\n refreshTokenSize?: number | undefined,\n \n /**\n * Application name as specified by the app.\n *\n * @type {?string}\n */\n appName?: string,\n \n /**\n * Application version as specified by the app.\n *\n * @type {?string}\n */\n appVersion?: string,\n\n /**\n * The following are fields that may be emitted in native broker scenarios\n */\n extensionId?: string,\n extensionVersion?: string\n matsBrokerVersion?: string;\n matsAccountJoinOnStart?: string;\n matsAccountJoinOnEnd?: string;\n matsDeviceJoin?: string;\n matsPromptBehavior?: string;\n matsApiErrorCode?: number;\n matsUiVisible?: boolean;\n matsSilentCode?: number;\n matsSilentBiSubCode?: number;\n matsSilentMessage?: string;\n matsSilentStatus?: number;\n matsHttpStatus?: number\n matsHttpEventCount?: number;\n};\n\n/**\n * Performance measurement taken by the library, including metadata about the request and application.\n *\n * @export\n * @typedef {PerformanceEvent}\n */\nexport type PerformanceEvent = StaticFields & {\n /**\n * Unique id for the event\n *\n * @type {string}\n */\n eventId: string,\n\n /**\n * State of the perforance measure.\n *\n * @type {PerformanceEventStatus}\n */\n status: PerformanceEventStatus,\n\n /**\n * Login authority used for the request\n *\n * @type {string}\n */\n authority: string,\n\n /**\n * Client id for the application\n *\n * @type {string}\n */\n clientId: string\n\n /**\n * Correlation ID used for the request\n *\n * @type {string}\n */\n correlationId: string,\n\n /**\n * End-to-end duration in milliseconds.\n * @date 3/22/2022 - 3:40:05 PM\n *\n * @type {number}\n */\n durationMs?: number,\n\n /**\n * Visibility of the page when the event completed.\n * Read from: https://developer.mozilla.org/docs/Web/API/Page_Visibility_API\n *\n * @type {?(string | null)}\n */\n endPageVisibility?: string | null,\n\n /**\n * Whether the result was retrieved from the cache.\n *\n * @type {(boolean | null)}\n */\n fromCache?: boolean | null,\n\n /**\n * Event name (usually in the form of classNameFunctionName)\n *\n * @type {PerformanceEvents}\n */\n name: PerformanceEvents,\n\n /**\n * Visibility of the page when the event completed.\n * Read from: https://developer.mozilla.org/docs/Web/API/Page_Visibility_API\n *\n * @type {?(string | null)}\n */\n startPageVisibility?: string | null,\n\n /**\n * Unix millisecond timestamp when the event was initiated.\n *\n * @type {number}\n */\n startTimeMs: number,\n\n /**\n * Whether or the operation completed successfully.\n *\n * @type {(boolean | null)}\n */\n success?: boolean | null,\n\n /**\n * Add specific error code in case of failure\n *\n * @type {string}\n */\n errorCode?: string,\n\n /**\n * Add specific sub error code in case of failure\n *\n * @type {string}\n */\n subErrorCode?: string,\n\n /**\n * Name of the library used for the operation.\n *\n * @type {string}\n */\n libraryName: string,\n\n /**\n * Version of the library used for the operation.\n *\n * @type {string}\n */\n libraryVersion: string,\n\n /**\n * Whether the response is from a native component (e.g., WAM)\n *\n * @type {?boolean}\n */\n isNativeBroker?: boolean,\n\n /**\n * Request ID returned from the response\n * \n * @type {?string}\n */\n requestId?: string\n};\n"],"names":[],"mappings":";;AAAA;;;AAGG;AAEH;;;;;AAKG;IACS,kBAoHX;AApHD,CAAA,UAAY,iBAAiB,EAAA;AAEzB;;;AAGG;AACH,IAAA,iBAAA,CAAA,oBAAA,CAAA,GAAA,oBAAyC,CAAA;AAEzC;;;AAGG;AACH,IAAA,iBAAA,CAAA,4BAAA,CAAA,GAAA,4BAAyD,CAAA;AAEzD;;;AAGG;AACH,IAAA,iBAAA,CAAA,oBAAA,CAAA,GAAA,oBAAyC,CAAA;AAEzC;;;AAGG;AACH,IAAA,iBAAA,CAAA,yBAAA,CAAA,GAAA,yBAAmD,CAAA;AAEnD;;;AAGG;AACH,IAAA,iBAAA,CAAA,mBAAA,CAAA,GAAA,mBAAuC,CAAA;AAEvC;;;AAGG;AACH,IAAA,iBAAA,CAAA,kCAAA,CAAA,GAAA,kCAAqE,CAAA;AAErE;;;AAGG;AACH,IAAA,iBAAA,CAAA,mBAAA,CAAA,GAAA,mBAAuC,CAAA;AAEvC;;;AAGG;AACH,IAAA,iBAAA,CAAA,+BAAA,CAAA,GAAA,+BAA+D,CAAA;AAE/D;;;AAGG;AACH,IAAA,iBAAA,CAAA,gCAAA,CAAA,GAAA,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,CAAA,GAAA,CAAA,CAAA,GAAA,WAAS,CAAA;AACb,CAAC,EAJW,sBAAsB,KAAtB,sBAAsB,GAIjC,EAAA,CAAA,CAAA;;;;"}
\ No newline at end of file
{"version":3,"file":"StubPerformanceClient.d.ts","sourceRoot":"","sources":["../../../src/telemetry/performance/StubPerformanceClient.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,qBAAa,0BAA2B,YAAW,uBAAuB;IAEtE,gBAAgB,IAAI,IAAI;IAExB,cAAc,IAAI,IAAI;IACtB,gBAAgB,IAAI,MAAM,GAAG,IAAI;CAIpC;AAED,qBAAa,qBAAsB,SAAQ,iBAAkB,YAAW,kBAAkB;IACtF,UAAU,IAAI,MAAM;IAIpB,4BAA4B,IAAI,uBAAuB;CAG1D"}
\ No newline at end of file
/*! @azure/msal-common v9.0.1 2022-12-07 */
'use strict';
import { __extends } from '../../_virtual/_tslib.js';
import { PerformanceClient } from './PerformanceClient.js';
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
var StubPerformanceMeasurement = /** @class */ (function () {
function StubPerformanceMeasurement() {
}
/* eslint-disable-next-line @typescript-eslint/no-empty-function */
StubPerformanceMeasurement.prototype.startMeasurement = function () { };
/* eslint-disable-next-line @typescript-eslint/no-empty-function */
StubPerformanceMeasurement.prototype.endMeasurement = function () { };
StubPerformanceMeasurement.prototype.flushMeasurement = function () {
return null;
};
return StubPerformanceMeasurement;
}());
var StubPerformanceClient = /** @class */ (function (_super) {
__extends(StubPerformanceClient, _super);
function StubPerformanceClient() {
return _super !== null && _super.apply(this, arguments) || this;
}
StubPerformanceClient.prototype.generateId = function () {
return "callback-id";
};
StubPerformanceClient.prototype.startPerformanceMeasuremeant = function () {
return new StubPerformanceMeasurement();
};
return StubPerformanceClient;
}(PerformanceClient));
export { StubPerformanceClient, StubPerformanceMeasurement };
//# sourceMappingURL=StubPerformanceClient.js.map
{"version":3,"file":"StubPerformanceClient.js","sources":["../../../src/telemetry/performance/StubPerformanceClient.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IPerformanceClient } from \"./IPerformanceClient\";\nimport { IPerformanceMeasurement } from \"./IPerformanceMeasurement\";\nimport { PerformanceClient } from \"./PerformanceClient\";\n\nexport class StubPerformanceMeasurement implements IPerformanceMeasurement {\n /* eslint-disable-next-line @typescript-eslint/no-empty-function */\n startMeasurement(): void { }\n /* eslint-disable-next-line @typescript-eslint/no-empty-function */\n endMeasurement(): void { }\n flushMeasurement(): number | null {\n return null;\n }\n \n}\n\nexport class StubPerformanceClient extends PerformanceClient implements IPerformanceClient {\n generateId(): string {\n return \"callback-id\";\n }\n \n startPerformanceMeasuremeant(): IPerformanceMeasurement {\n return new StubPerformanceMeasurement();\n }\n}\n"],"names":[],"mappings":";;;;;AAAA;;;AAGG;AAMH,IAAA,0BAAA,kBAAA,YAAA;AAAA,IAAA,SAAA,0BAAA,GAAA;KASC;;IAPG,0BAAgB,CAAA,SAAA,CAAA,gBAAA,GAAhB,eAA4B,CAAA;;IAE5B,0BAAc,CAAA,SAAA,CAAA,cAAA,GAAd,eAA0B,CAAA;AAC1B,IAAA,0BAAA,CAAA,SAAA,CAAA,gBAAgB,GAAhB,YAAA;AACI,QAAA,OAAO,IAAI,CAAC;KACf,CAAA;IAEL,OAAC,0BAAA,CAAA;AAAD,CAAC,EAAA,EAAA;AAED,IAAA,qBAAA,kBAAA,UAAA,MAAA,EAAA;IAA2C,SAAiB,CAAA,qBAAA,EAAA,MAAA,CAAA,CAAA;AAA5D,IAAA,SAAA,qBAAA,GAAA;;KAQC;AAPG,IAAA,qBAAA,CAAA,SAAA,CAAA,UAAU,GAAV,YAAA;AACI,QAAA,OAAO,aAAa,CAAC;KACxB,CAAA;AAED,IAAA,qBAAA,CAAA,SAAA,CAAA,4BAA4B,GAA5B,YAAA;QACI,OAAO,IAAI,0BAA0B,EAAE,CAAC;KAC3C,CAAA;IACL,OAAC,qBAAA,CAAA;AAAD,CARA,CAA2C,iBAAiB,CAQ3D;;;;"}
\ No newline at end of file
{"version":3,"file":"ServerTelemetryManager.d.ts","sourceRoot":"","sources":["../../../src/telemetry/server/ServerTelemetryManager.ts"],"names":[],"mappings":"AAKA,OAAO,EAAsC,YAAY,EAA8D,MAAM,uBAAuB,CAAC;AACrJ,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,qBAAqB,EAAE,MAAM,4CAA4C,CAAC;AAEnF,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAElF,qBAAa,sBAAsB;IAC/B,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,iBAAiB,CAAS;IAClC,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,UAAU,CAAqB;IACvC,OAAO,CAAC,YAAY,CAAqC;IACzD,OAAO,CAAC,aAAa,CAAsC;IAC3D,OAAO,CAAC,YAAY,CAA2C;gBAEnD,gBAAgB,EAAE,sBAAsB,EAAE,YAAY,EAAE,YAAY;IAUhF;;OAEG;IACH,iCAAiC,IAAI,MAAM;IAS3C;;OAEG;IACH,8BAA8B,IAAI,MAAM;IAexC;;;OAGG;IACH,kBAAkB,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI;IA0B1C;;OAEG;IACH,kBAAkB,IAAI,MAAM;IAQ5B;;OAEG;IACH,eAAe,IAAI,qBAAqB;IAOxC;;OAEG;IACH,mBAAmB,IAAI,IAAI;IAiB3B;;;OAGG;IACH,MAAM,CAAC,eAAe,CAAC,qBAAqB,EAAE,qBAAqB,GAAG,MAAM;IAyB5E;;;;OAIG;IACH,wBAAwB,IAAI,MAAM;IAUlC;;;;;OAKG;IACH,6BAA6B,CAAC,uBAAuB,EAAE,uBAAuB,GAAG,IAAI;IAMrF;;OAEG;IACH,eAAe,CAAC,YAAY,EAAE,YAAY,GAAG,IAAI;CAGpD"}
\ No newline at end of file
/*! @azure/msal-common v9.0.1 2022-12-07 */
'use strict';
import { SERVER_TELEM_CONSTANTS, CacheOutcome, Constants, Separators } from '../../utils/Constants.js';
import { ServerTelemetryEntity } from '../../cache/entities/ServerTelemetryEntity.js';
import { StringUtils } from '../../utils/StringUtils.js';
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
var ServerTelemetryManager = /** @class */ (function () {
function ServerTelemetryManager(telemetryRequest, cacheManager) {
this.cacheOutcome = CacheOutcome.NO_CACHE_HIT;
this.cacheManager = cacheManager;
this.apiId = telemetryRequest.apiId;
this.correlationId = telemetryRequest.correlationId;
this.wrapperSKU = telemetryRequest.wrapperSKU || Constants.EMPTY_STRING;
this.wrapperVer = telemetryRequest.wrapperVer || Constants.EMPTY_STRING;
this.telemetryCacheKey = SERVER_TELEM_CONSTANTS.CACHE_KEY + Separators.CACHE_KEY_SEPARATOR + telemetryRequest.clientId;
}
/**
* API to add MSER Telemetry to request
*/
ServerTelemetryManager.prototype.generateCurrentRequestHeaderValue = function () {
var request = "" + this.apiId + SERVER_TELEM_CONSTANTS.VALUE_SEPARATOR + this.cacheOutcome;
var platformFields = [this.wrapperSKU, this.wrapperVer].join(SERVER_TELEM_CONSTANTS.VALUE_SEPARATOR);
var regionDiscoveryFields = this.getRegionDiscoveryFields();
var requestWithRegionDiscoveryFields = [request, regionDiscoveryFields].join(SERVER_TELEM_CONSTANTS.VALUE_SEPARATOR);
return [SERVER_TELEM_CONSTANTS.SCHEMA_VERSION, requestWithRegionDiscoveryFields, platformFields].join(SERVER_TELEM_CONSTANTS.CATEGORY_SEPARATOR);
};
/**
* API to add MSER Telemetry for the last failed request
*/
ServerTelemetryManager.prototype.generateLastRequestHeaderValue = function () {
var lastRequests = this.getLastRequests();
var maxErrors = ServerTelemetryManager.maxErrorsToSend(lastRequests);
var failedRequests = lastRequests.failedRequests.slice(0, 2 * maxErrors).join(SERVER_TELEM_CONSTANTS.VALUE_SEPARATOR);
var errors = lastRequests.errors.slice(0, maxErrors).join(SERVER_TELEM_CONSTANTS.VALUE_SEPARATOR);
var errorCount = lastRequests.errors.length;
// Indicate whether this header contains all data or partial data
var overflow = maxErrors < errorCount ? SERVER_TELEM_CONSTANTS.OVERFLOW_TRUE : SERVER_TELEM_CONSTANTS.OVERFLOW_FALSE;
var platformFields = [errorCount, overflow].join(SERVER_TELEM_CONSTANTS.VALUE_SEPARATOR);
return [SERVER_TELEM_CONSTANTS.SCHEMA_VERSION, lastRequests.cacheHits, failedRequests, errors, platformFields].join(SERVER_TELEM_CONSTANTS.CATEGORY_SEPARATOR);
};
/**
* API to cache token failures for MSER data capture
* @param error
*/
ServerTelemetryManager.prototype.cacheFailedRequest = function (error) {
var lastRequests = this.getLastRequests();
if (lastRequests.errors.length >= SERVER_TELEM_CONSTANTS.MAX_CACHED_ERRORS) {
// Remove a cached error to make room, first in first out
lastRequests.failedRequests.shift(); // apiId
lastRequests.failedRequests.shift(); // correlationId
lastRequests.errors.shift();
}
lastRequests.failedRequests.push(this.apiId, this.correlationId);
if (!StringUtils.isEmpty(error.subError)) {
lastRequests.errors.push(error.subError);
}
else if (!StringUtils.isEmpty(error.errorCode)) {
lastRequests.errors.push(error.errorCode);
}
else if (!!error && error.toString()) {
lastRequests.errors.push(error.toString());
}
else {
lastRequests.errors.push(SERVER_TELEM_CONSTANTS.UNKNOWN_ERROR);
}
this.cacheManager.setServerTelemetry(this.telemetryCacheKey, lastRequests);
return;
};
/**
* Update server telemetry cache entry by incrementing cache hit counter
*/
ServerTelemetryManager.prototype.incrementCacheHits = function () {
var lastRequests = this.getLastRequests();
lastRequests.cacheHits += 1;
this.cacheManager.setServerTelemetry(this.telemetryCacheKey, lastRequests);
return lastRequests.cacheHits;
};
/**
* Get the server telemetry entity from cache or initialize a new one
*/
ServerTelemetryManager.prototype.getLastRequests = function () {
var initialValue = new ServerTelemetryEntity();
var lastRequests = this.cacheManager.getServerTelemetry(this.telemetryCacheKey);
return lastRequests || initialValue;
};
/**
* Remove server telemetry cache entry
*/
ServerTelemetryManager.prototype.clearTelemetryCache = function () {
var lastRequests = this.getLastRequests();
var numErrorsFlushed = ServerTelemetryManager.maxErrorsToSend(lastRequests);
var errorCount = lastRequests.errors.length;
if (numErrorsFlushed === errorCount) {
// All errors were sent on last request, clear Telemetry cache
this.cacheManager.removeItem(this.telemetryCacheKey);
}
else {
// Partial data was flushed to server, construct a new telemetry cache item with errors that were not flushed
var serverTelemEntity = new ServerTelemetryEntity();
serverTelemEntity.failedRequests = lastRequests.failedRequests.slice(numErrorsFlushed * 2); // failedRequests contains 2 items for each error
serverTelemEntity.errors = lastRequests.errors.slice(numErrorsFlushed);
this.cacheManager.setServerTelemetry(this.telemetryCacheKey, serverTelemEntity);
}
};
/**
* Returns the maximum number of errors that can be flushed to the server in the next network request
* @param serverTelemetryEntity
*/
ServerTelemetryManager.maxErrorsToSend = function (serverTelemetryEntity) {
var i;
var maxErrors = 0;
var dataSize = 0;
var errorCount = serverTelemetryEntity.errors.length;
for (i = 0; i < errorCount; i++) {
// failedRequests parameter contains pairs of apiId and correlationId, multiply index by 2 to preserve pairs
var apiId = serverTelemetryEntity.failedRequests[2 * i] || Constants.EMPTY_STRING;
var correlationId = serverTelemetryEntity.failedRequests[2 * i + 1] || Constants.EMPTY_STRING;
var errorCode = serverTelemetryEntity.errors[i] || Constants.EMPTY_STRING;
// Count number of characters that would be added to header, each character is 1 byte. Add 3 at the end to account for separators
dataSize += apiId.toString().length + correlationId.toString().length + errorCode.length + 3;
if (dataSize < SERVER_TELEM_CONSTANTS.MAX_LAST_HEADER_BYTES) {
// Adding this entry to the header would still keep header size below the limit
maxErrors += 1;
}
else {
break;
}
}
return maxErrors;
};
/**
* Get the region discovery fields
*
* @returns string
*/
ServerTelemetryManager.prototype.getRegionDiscoveryFields = function () {
var regionDiscoveryFields = [];
regionDiscoveryFields.push(this.regionUsed || Constants.EMPTY_STRING);
regionDiscoveryFields.push(this.regionSource || Constants.EMPTY_STRING);
regionDiscoveryFields.push(this.regionOutcome || Constants.EMPTY_STRING);
return regionDiscoveryFields.join(",");
};
/**
* Update the region discovery metadata
*
* @param regionDiscoveryMetadata
* @returns void
*/
ServerTelemetryManager.prototype.updateRegionDiscoveryMetadata = function (regionDiscoveryMetadata) {
this.regionUsed = regionDiscoveryMetadata.region_used;
this.regionSource = regionDiscoveryMetadata.region_source;
this.regionOutcome = regionDiscoveryMetadata.region_outcome;
};
/**
* Set cache outcome
*/
ServerTelemetryManager.prototype.setCacheOutcome = function (cacheOutcome) {
this.cacheOutcome = cacheOutcome;
};
return ServerTelemetryManager;
}());
export { ServerTelemetryManager };
//# sourceMappingURL=ServerTelemetryManager.js.map
{"version":3,"file":"ServerTelemetryManager.js","sources":["../../../src/telemetry/server/ServerTelemetryManager.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { SERVER_TELEM_CONSTANTS, Separators, CacheOutcome, Constants, RegionDiscoverySources, RegionDiscoveryOutcomes } from \"../../utils/Constants\";\nimport { CacheManager } from \"../../cache/CacheManager\";\nimport { AuthError } from \"../../error/AuthError\";\nimport { ServerTelemetryRequest } from \"./ServerTelemetryRequest\";\nimport { ServerTelemetryEntity } from \"../../cache/entities/ServerTelemetryEntity\";\nimport { StringUtils } from \"../../utils/StringUtils\";\nimport { RegionDiscoveryMetadata } from \"../../authority/RegionDiscoveryMetadata\";\n\nexport class ServerTelemetryManager {\n private cacheManager: CacheManager;\n private apiId: number;\n private correlationId: string;\n private telemetryCacheKey: string;\n private wrapperSKU: String;\n private wrapperVer: String;\n private regionUsed: string | undefined;\n private regionSource: RegionDiscoverySources | undefined;\n private regionOutcome: RegionDiscoveryOutcomes | undefined;\n private cacheOutcome: CacheOutcome = CacheOutcome.NO_CACHE_HIT;\n\n constructor(telemetryRequest: ServerTelemetryRequest, cacheManager: CacheManager) {\n this.cacheManager = cacheManager;\n this.apiId = telemetryRequest.apiId;\n this.correlationId = telemetryRequest.correlationId;\n this.wrapperSKU = telemetryRequest.wrapperSKU || Constants.EMPTY_STRING;\n this.wrapperVer = telemetryRequest.wrapperVer || Constants.EMPTY_STRING;\n\n this.telemetryCacheKey = SERVER_TELEM_CONSTANTS.CACHE_KEY + Separators.CACHE_KEY_SEPARATOR + telemetryRequest.clientId;\n }\n\n /**\n * API to add MSER Telemetry to request\n */\n generateCurrentRequestHeaderValue(): string {\n const request = `${this.apiId}${SERVER_TELEM_CONSTANTS.VALUE_SEPARATOR}${this.cacheOutcome}`;\n const platformFields = [this.wrapperSKU, this.wrapperVer].join(SERVER_TELEM_CONSTANTS.VALUE_SEPARATOR);\n const regionDiscoveryFields = this.getRegionDiscoveryFields();\n const requestWithRegionDiscoveryFields = [request, regionDiscoveryFields].join(SERVER_TELEM_CONSTANTS.VALUE_SEPARATOR);\n\n return [SERVER_TELEM_CONSTANTS.SCHEMA_VERSION, requestWithRegionDiscoveryFields, platformFields].join(SERVER_TELEM_CONSTANTS.CATEGORY_SEPARATOR);\n }\n\n /**\n * API to add MSER Telemetry for the last failed request\n */\n generateLastRequestHeaderValue(): string {\n const lastRequests = this.getLastRequests();\n\n const maxErrors = ServerTelemetryManager.maxErrorsToSend(lastRequests);\n const failedRequests = lastRequests.failedRequests.slice(0, 2*maxErrors).join(SERVER_TELEM_CONSTANTS.VALUE_SEPARATOR);\n const errors = lastRequests.errors.slice(0, maxErrors).join(SERVER_TELEM_CONSTANTS.VALUE_SEPARATOR);\n const errorCount = lastRequests.errors.length;\n\n // Indicate whether this header contains all data or partial data\n const overflow = maxErrors < errorCount ? SERVER_TELEM_CONSTANTS.OVERFLOW_TRUE : SERVER_TELEM_CONSTANTS.OVERFLOW_FALSE;\n const platformFields = [errorCount, overflow].join(SERVER_TELEM_CONSTANTS.VALUE_SEPARATOR);\n\n return [SERVER_TELEM_CONSTANTS.SCHEMA_VERSION, lastRequests.cacheHits, failedRequests, errors, platformFields].join(SERVER_TELEM_CONSTANTS.CATEGORY_SEPARATOR);\n }\n\n /**\n * API to cache token failures for MSER data capture\n * @param error\n */\n cacheFailedRequest(error: AuthError): void {\n const lastRequests = this.getLastRequests();\n if (lastRequests.errors.length >= SERVER_TELEM_CONSTANTS.MAX_CACHED_ERRORS) {\n // Remove a cached error to make room, first in first out\n lastRequests.failedRequests.shift(); // apiId\n lastRequests.failedRequests.shift(); // correlationId\n lastRequests.errors.shift();\n }\n \n lastRequests.failedRequests.push(this.apiId, this.correlationId);\n\n if (!StringUtils.isEmpty(error.subError)) {\n lastRequests.errors.push(error.subError);\n } else if (!StringUtils.isEmpty(error.errorCode)) {\n lastRequests.errors.push(error.errorCode);\n } else if (!!error && error.toString()) {\n lastRequests.errors.push(error.toString());\n } else {\n lastRequests.errors.push(SERVER_TELEM_CONSTANTS.UNKNOWN_ERROR);\n }\n\n this.cacheManager.setServerTelemetry(this.telemetryCacheKey, lastRequests);\n\n return;\n }\n\n /**\n * Update server telemetry cache entry by incrementing cache hit counter\n */\n incrementCacheHits(): number {\n const lastRequests = this.getLastRequests();\n lastRequests.cacheHits += 1;\n\n this.cacheManager.setServerTelemetry(this.telemetryCacheKey, lastRequests);\n return lastRequests.cacheHits;\n }\n\n /**\n * Get the server telemetry entity from cache or initialize a new one\n */\n getLastRequests(): ServerTelemetryEntity {\n const initialValue: ServerTelemetryEntity = new ServerTelemetryEntity();\n const lastRequests = this.cacheManager.getServerTelemetry(this.telemetryCacheKey) as ServerTelemetryEntity;\n\n return lastRequests || initialValue;\n }\n\n /**\n * Remove server telemetry cache entry\n */\n clearTelemetryCache(): void {\n const lastRequests = this.getLastRequests();\n const numErrorsFlushed = ServerTelemetryManager.maxErrorsToSend(lastRequests);\n const errorCount = lastRequests.errors.length;\n if (numErrorsFlushed === errorCount) {\n // All errors were sent on last request, clear Telemetry cache\n this.cacheManager.removeItem(this.telemetryCacheKey);\n } else {\n // Partial data was flushed to server, construct a new telemetry cache item with errors that were not flushed\n const serverTelemEntity = new ServerTelemetryEntity();\n serverTelemEntity.failedRequests = lastRequests.failedRequests.slice(numErrorsFlushed*2); // failedRequests contains 2 items for each error\n serverTelemEntity.errors = lastRequests.errors.slice(numErrorsFlushed);\n\n this.cacheManager.setServerTelemetry(this.telemetryCacheKey, serverTelemEntity);\n }\n }\n\n /**\n * Returns the maximum number of errors that can be flushed to the server in the next network request\n * @param serverTelemetryEntity\n */\n static maxErrorsToSend(serverTelemetryEntity: ServerTelemetryEntity): number {\n let i;\n let maxErrors = 0;\n let dataSize = 0;\n const errorCount = serverTelemetryEntity.errors.length;\n for (i = 0; i < errorCount; i++) {\n // failedRequests parameter contains pairs of apiId and correlationId, multiply index by 2 to preserve pairs\n const apiId = serverTelemetryEntity.failedRequests[2*i] || Constants.EMPTY_STRING;\n const correlationId = serverTelemetryEntity.failedRequests[2*i + 1] || Constants.EMPTY_STRING;\n const errorCode = serverTelemetryEntity.errors[i] || Constants.EMPTY_STRING;\n\n // Count number of characters that would be added to header, each character is 1 byte. Add 3 at the end to account for separators\n dataSize += apiId.toString().length + correlationId.toString().length + errorCode.length + 3;\n\n if (dataSize < SERVER_TELEM_CONSTANTS.MAX_LAST_HEADER_BYTES) {\n // Adding this entry to the header would still keep header size below the limit\n maxErrors += 1;\n } else {\n break;\n }\n }\n\n return maxErrors;\n }\n\n /**\n * Get the region discovery fields\n * \n * @returns string\n */\n getRegionDiscoveryFields(): string {\n const regionDiscoveryFields: string[] = [];\n\n regionDiscoveryFields.push(this.regionUsed || Constants.EMPTY_STRING);\n regionDiscoveryFields.push(this.regionSource || Constants.EMPTY_STRING);\n regionDiscoveryFields.push(this.regionOutcome || Constants.EMPTY_STRING);\n\n return regionDiscoveryFields.join(\",\");\n }\n\n /**\n * Update the region discovery metadata\n * \n * @param regionDiscoveryMetadata\n * @returns void\n */\n updateRegionDiscoveryMetadata(regionDiscoveryMetadata: RegionDiscoveryMetadata): void {\n this.regionUsed = regionDiscoveryMetadata.region_used;\n this.regionSource = regionDiscoveryMetadata.region_source;\n this.regionOutcome = regionDiscoveryMetadata.region_outcome;\n }\n\n /**\n * Set cache outcome \n */\n setCacheOutcome(cacheOutcome: CacheOutcome): void {\n this.cacheOutcome = cacheOutcome;\n }\n}\n"],"names":[],"mappings":";;;;;;AAAA;;;AAGG;AAUH,IAAA,sBAAA,kBAAA,YAAA;IAYI,SAAY,sBAAA,CAAA,gBAAwC,EAAE,YAA0B,EAAA;AAFxE,QAAA,IAAA,CAAA,YAAY,GAAiB,YAAY,CAAC,YAAY,CAAC;AAG3D,QAAA,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;AACjC,QAAA,IAAI,CAAC,KAAK,GAAG,gBAAgB,CAAC,KAAK,CAAC;AACpC,QAAA,IAAI,CAAC,aAAa,GAAG,gBAAgB,CAAC,aAAa,CAAC;QACpD,IAAI,CAAC,UAAU,GAAG,gBAAgB,CAAC,UAAU,IAAI,SAAS,CAAC,YAAY,CAAC;QACxE,IAAI,CAAC,UAAU,GAAG,gBAAgB,CAAC,UAAU,IAAI,SAAS,CAAC,YAAY,CAAC;AAExE,QAAA,IAAI,CAAC,iBAAiB,GAAG,sBAAsB,CAAC,SAAS,GAAG,UAAU,CAAC,mBAAmB,GAAG,gBAAgB,CAAC,QAAQ,CAAC;KAC1H;AAED;;AAEG;AACH,IAAA,sBAAA,CAAA,SAAA,CAAA,iCAAiC,GAAjC,YAAA;AACI,QAAA,IAAM,OAAO,GAAG,EAAG,GAAA,IAAI,CAAC,KAAK,GAAG,sBAAsB,CAAC,eAAe,GAAG,IAAI,CAAC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AAA;AAED,QAAA,OAAO,SAAS,CAAC;KACpB,CAAA;AAED;;;;AAIG;AACH,IAAA,sBAAA,CAAA,SAAA,CAAA,wBAAwB,GAAxB,YAAA;QACI,IAAM,qBAAqB,GAAa,EAAE,CAAC;QAE3C,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,IAAI,SAAS,CAAC,YAAY,CAAC,CAAC;QACtE,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,IAAI,SAAS,CAAC,YAAY,CAAC,CAAC;QACxE,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,IAAI,SAAS,CAAC,YAAY,CAAC,CAAC;AAEzE,QAAA,OAAO,qBAAqB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;KAC1C,CAAA;AAED;;;;;AAKG;IACH,sBAA6B,CAAA,SAAA,CAAA,6BAAA,GAA7B,UAA8B,uBAAgD,EAAA;AAC1E,QAAA,IAAI,CAAC,UAAU,GAAG,uBAAuB,CAAC,WAAW,CAAC;AACtD,QAAA,IAAI,CAAC,YAAY,GAAG,uBAAuB,CAAC,aAAa,CAAC;AAC1D,QAAA,IAAI,CAAC,aAAa,GAAG,uBAAuB,CAAC,cAAc,CAAC;KAC/D,CAAA;AAED;;AAEG;IACH,sBAAe,CAAA,SAAA,CAAA,eAAA,GAAf,UAAgB,YAA0B,EAAA;AACtC,QAAA,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;KACpC,CAAA;IACL,OAAC,sBAAA,CAAA;AAAD,CAAC,EAAA;;;;"}
\ No newline at end of file
{"version":3,"file":"ServerTelemetryRequest.d.ts","sourceRoot":"","sources":["../../../src/telemetry/server/ServerTelemetryRequest.ts"],"names":[],"mappings":"AAKA,oBAAY,sBAAsB,GAAG;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC"}
\ No newline at end of file
{"version":3,"file":"IUri.d.ts","sourceRoot":"","sources":["../../src/url/IUri.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,MAAM,WAAW,IAAI;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;CACvB"}
\ No newline at end of file
{"version":3,"file":"UrlString.d.ts","sourceRoot":"","sources":["../../src/url/UrlString.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,+BAA+B,EAAE,MAAM,6CAA6C,CAAC;AAI9F,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAG9B;;GAEG;AACH,qBAAa,SAAS;IAGlB,OAAO,CAAC,UAAU,CAAS;IAC3B,IAAW,SAAS,IAAI,MAAM,CAE7B;gBAEW,GAAG,EAAE,MAAM;IAYvB;;;OAGG;IACH,MAAM,CAAC,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAoB3C;;OAEG;IACH,aAAa,IAAI,IAAI;IAoBrB;;;;OAIG;IACH,MAAM,CAAC,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM;IAQlE;;;OAGG;IACH,MAAM,CAAC,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAI7C;;;;OAIG;IACH,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS;IAS9C;;OAEG;IACH,OAAO,IAAI,MAAM;IAIjB;;;OAGG;IACH,gBAAgB,IAAI,IAAI;IA4BxB,MAAM,CAAC,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAY5C,MAAM,CAAC,cAAc,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM;IAWnE;;;OAGG;IACH,MAAM,CAAC,SAAS,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM;IAW5C;;;OAGG;IACH,MAAM,CAAC,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM;IAWpD,MAAM,CAAC,+BAA+B,CAAC,SAAS,EAAE,IAAI,GAAG,SAAS;IAIlE;;OAEG;IACH,MAAM,CAAC,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,+BAA+B;IAgBzE;;OAEG;IACH,MAAM,CAAC,0BAA0B,CAAC,KAAK,EAAE,MAAM,GAAG,+BAA+B;IAgBjF;;OAEG;IACH,MAAM,CAAC,2BAA2B,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;CAc5D"}
\ No newline at end of file
/*! @azure/msal-common v9.0.1 2022-12-07 */
'use strict';
import { ClientConfigurationError } from '../error/ClientConfigurationError.js';
import { ClientAuthError } from '../error/ClientAuthError.js';
import { StringUtils } from '../utils/StringUtils.js';
import { AADAuthorityConstants, Constants } from '../utils/Constants.js';
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
/**
* Url object class which can perform various transformations on url strings.
*/
var UrlString = /** @class */ (function () {
function UrlString(url) {
this._urlString = url;
if (StringUtils.isEmpty(this._urlString)) {
// Throws error if url is empty
throw ClientConfigurationError.createUrlEmptyError();
}
if (StringUtils.isEmpty(this.getHash())) {
this._urlString = UrlString.canonicalizeUri(url);
}
}
Object.defineProperty(UrlString.prototype, "urlString", {
get: function () {
return this._urlString;
},
enumerable: false,
configurable: true
});
/**
* Ensure urls are lower case and end with a / character.
* @param url
*/
UrlString.canonicalizeUri = function (url) {
if (url) {
var lowerCaseUrl = url.toLowerCase();
if (StringUtils.endsWith(lowerCaseUrl, "?")) {
lowerCaseUrl = lowerCaseUrl.slice(0, -1);
}
else if (StringUtils.endsWith(lowerCaseUrl, "?/")) {
lowerCaseUrl = lowerCaseUrl.slice(0, -2);
}
if (!StringUtils.endsWith(lowerCaseUrl, "/")) {
lowerCaseUrl += "/";
}
return lowerCaseUrl;
}
return url;
};
/**
* Throws if urlString passed is not a valid authority URI string.
*/
UrlString.prototype.validateAsUri = function () {
// Attempts to parse url for uri components
var components;
try {
components = this.getUrlComponents();
}
catch (e) {
throw ClientConfigurationError.createUrlParseError(e);
}
// Throw error if URI or path segments are not parseable.
if (!components.HostNameAndPort || !components.PathSegments) {
throw ClientConfigurationError.createUrlParseError("Given url string: " + this.urlString);
}
// Throw error if uri is insecure.
if (!components.Protocol || components.Protocol.toLowerCase() !== "https:") {
throw ClientConfigurationError.createInsecureAuthorityUriError(this.urlString);
}
};
/**
* Given a url and a query string return the url with provided query string appended
* @param url
* @param queryString
*/
UrlString.appendQueryString = function (url, queryString) {
if (StringUtils.isEmpty(queryString)) {
return url;
}
return url.indexOf("?") < 0 ? url + "?" + queryString : url + "&" + queryString;
};
/**
* Returns a url with the hash removed
* @param url
*/
UrlString.removeHashFromUrl = function (url) {
return UrlString.canonicalizeUri(url.split("#")[0]);
};
/**
* Given a url like https://a:b/common/d?e=f#g, and a tenantId, returns https://a:b/tenantId/d
* @param href The url
* @param tenantId The tenant id to replace
*/
UrlString.prototype.replaceTenantPath = function (tenantId) {
var urlObject = this.getUrlComponents();
var pathArray = urlObject.PathSegments;
if (tenantId && (pathArray.length !== 0 && (pathArray[0] === AADAuthorityConstants.COMMON || pathArray[0] === AADAuthorityConstants.ORGANIZATIONS))) {
pathArray[0] = tenantId;
}
return UrlString.constructAuthorityUriFromObject(urlObject);
};
/**
* Returns the anchor part(#) of the URL
*/
UrlString.prototype.getHash = function () {
return UrlString.parseHash(this.urlString);
};
/**
* Parses out the components from a url string.
* @returns An object with the various components. Please cache this value insted of calling this multiple times on the same url.
*/
UrlString.prototype.getUrlComponents = function () {
// https://gist.github.com/curtisz/11139b2cfcaef4a261e0
var regEx = RegExp("^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?");
// If url string does not match regEx, we throw an error
var match = this.urlString.match(regEx);
if (!match) {
throw ClientConfigurationError.createUrlParseError("Given url string: " + this.urlString);
}
// Url component object
var urlComponents = {
Protocol: match[1],
HostNameAndPort: match[4],
AbsolutePath: match[5],
QueryString: match[7]
};
var pathSegments = urlComponents.AbsolutePath.split("/");
pathSegments = pathSegments.filter(function (val) { return val && val.length > 0; }); // remove empty elements
urlComponents.PathSegments = pathSegments;
if (!StringUtils.isEmpty(urlComponents.QueryString) && urlComponents.QueryString.endsWith("/")) {
urlComponents.QueryString = urlComponents.QueryString.substring(0, urlComponents.QueryString.length - 1);
}
return urlComponents;
};
UrlString.getDomainFromUrl = function (url) {
var regEx = RegExp("^([^:/?#]+://)?([^/?#]*)");
var match = url.match(regEx);
if (!match) {
throw ClientConfigurationError.createUrlParseError("Given url string: " + url);
}
return match[2];
};
UrlString.getAbsoluteUrl = function (relativeUrl, baseUrl) {
if (relativeUrl[0] === Constants.FORWARD_SLASH) {
var url = new UrlString(baseUrl);
var baseComponents = url.getUrlComponents();
return baseComponents.Protocol + "//" + baseComponents.HostNameAndPort + relativeUrl;
}
return relativeUrl;
};
/**
* Parses hash string from given string. Returns empty string if no hash symbol is found.
* @param hashString
*/
UrlString.parseHash = function (hashString) {
var hashIndex1 = hashString.indexOf("#");
var hashIndex2 = hashString.indexOf("#/");
if (hashIndex2 > -1) {
return hashString.substring(hashIndex2 + 2);
}
else if (hashIndex1 > -1) {
return hashString.substring(hashIndex1 + 1);
}
return Constants.EMPTY_STRING;
};
/**
* Parses query string from given string. Returns empty string if no query symbol is found.
* @param queryString
*/
UrlString.parseQueryString = function (queryString) {
var queryIndex1 = queryString.indexOf("?");
var queryIndex2 = queryString.indexOf("/?");
if (queryIndex2 > -1) {
return queryString.substring(queryIndex2 + 2);
}
else if (queryIndex1 > -1) {
return queryString.substring(queryIndex1 + 1);
}
return Constants.EMPTY_STRING;
};
UrlString.constructAuthorityUriFromObject = function (urlObject) {
return new UrlString(urlObject.Protocol + "//" + urlObject.HostNameAndPort + "/" + urlObject.PathSegments.join("/"));
};
/**
* Returns URL hash as server auth code response object.
*/
UrlString.getDeserializedHash = function (hash) {
// Check if given hash is empty
if (StringUtils.isEmpty(hash)) {
return {};
}
// Strip the # symbol if present
var parsedHash = UrlString.parseHash(hash);
// If # symbol was not present, above will return empty string, so give original hash value
var deserializedHash = StringUtils.queryStringToObject(StringUtils.isEmpty(parsedHash) ? hash : parsedHash);
// Check if deserialization didn't work
if (!deserializedHash) {
throw ClientAuthError.createHashNotDeserializedError(JSON.stringify(deserializedHash));
}
return deserializedHash;
};
/**
* Returns URL query string as server auth code response object.
*/
UrlString.getDeserializedQueryString = function (query) {
// Check if given query is empty
if (StringUtils.isEmpty(query)) {
return {};
}
// Strip the ? symbol if present
var parsedQueryString = UrlString.parseQueryString(query);
// If ? symbol was not present, above will return empty string, so give original query value
var deserializedQueryString = StringUtils.queryStringToObject(StringUtils.isEmpty(parsedQueryString) ? query : parsedQueryString);
// Check if deserialization didn't work
if (!deserializedQueryString) {
throw ClientAuthError.createHashNotDeserializedError(JSON.stringify(deserializedQueryString));
}
return deserializedQueryString;
};
/**
* Check if the hash of the URL string contains known properties
*/
UrlString.hashContainsKnownProperties = function (hash) {
if (StringUtils.isEmpty(hash) || hash.indexOf("=") < 0) {
// Hash doesn't contain key/value pairs
return false;
}
var parameters = UrlString.getDeserializedHash(hash);
return !!(parameters.code ||
parameters.error_description ||
parameters.error ||
parameters.state);
};
return UrlString;
}());
export { UrlString };
//# sourceMappingURL=UrlString.js.map
{"version":3,"file":"UrlString.js","sources":["../../src/url/UrlString.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ServerAuthorizationCodeResponse } from \"../response/ServerAuthorizationCodeResponse\";\nimport { ClientConfigurationError } from \"../error/ClientConfigurationError\";\nimport { ClientAuthError } from \"../error/ClientAuthError\";\nimport { StringUtils } from \"../utils/StringUtils\";\nimport { IUri } from \"./IUri\";\nimport { AADAuthorityConstants, Constants } from \"../utils/Constants\";\n\n/**\n * Url object class which can perform various transformations on url strings.\n */\nexport class UrlString {\n\n // internal url string field\n private _urlString: string;\n public get urlString(): string {\n return this._urlString;\n }\n\n constructor(url: string) {\n this._urlString = url;\n if (StringUtils.isEmpty(this._urlString)) {\n // Throws error if url is empty\n throw ClientConfigurationError.createUrlEmptyError();\n }\n\n if (StringUtils.isEmpty(this.getHash())) {\n this._urlString = UrlString.canonicalizeUri(url);\n }\n }\n\n /**\n * Ensure urls are lower case and end with a / character.\n * @param url\n */\n static canonicalizeUri(url: string): string {\n if (url) {\n let lowerCaseUrl = url.toLowerCase();\n\n if (StringUtils.endsWith(lowerCaseUrl, \"?\")) {\n lowerCaseUrl = lowerCaseUrl.slice(0, -1);\n } else if (StringUtils.endsWith(lowerCaseUrl, \"?/\")) {\n lowerCaseUrl = lowerCaseUrl.slice(0, -2);\n }\n\n if (!StringUtils.endsWith(lowerCaseUrl, \"/\")) {\n lowerCaseUrl += \"/\";\n }\n\n return lowerCaseUrl;\n }\n\n return url;\n }\n\n /**\n * Throws if urlString passed is not a valid authority URI string.\n */\n validateAsUri(): void {\n // Attempts to parse url for uri components\n let components;\n try {\n components = this.getUrlComponents();\n } catch (e) {\n throw ClientConfigurationError.createUrlParseError(e);\n }\n\n // Throw error if URI or path segments are not parseable.\n if (!components.HostNameAndPort || !components.PathSegments) {\n throw ClientConfigurationError.createUrlParseError(`Given url string: ${this.urlString}`);\n }\n\n // Throw error if uri is insecure.\n if(!components.Protocol || components.Protocol.toLowerCase() !== \"https:\") {\n throw ClientConfigurationError.createInsecureAuthorityUriError(this.urlString);\n }\n }\n\n /**\n * Given a url and a query string return the url with provided query string appended\n * @param url\n * @param queryString\n */\n static appendQueryString(url: string, queryString: string): string {\n if (StringUtils.isEmpty(queryString)) {\n return url;\n }\n\n return url.indexOf(\"?\") < 0 ? `${url}?${queryString}` : `${url}&${queryString}`;\n }\n\n /**\n * Returns a url with the hash removed\n * @param url\n */\n static removeHashFromUrl(url: string): string {\n return UrlString.canonicalizeUri(url.split(\"#\")[0]);\n }\n\n /**\n * Given a url like https://a:b/common/d?e=f#g, and a tenantId, returns https://a:b/tenantId/d\n * @param href The url\n * @param tenantId The tenant id to replace\n */\n replaceTenantPath(tenantId: string): UrlString {\n const urlObject = this.getUrlComponents();\n const pathArray = urlObject.PathSegments;\n if (tenantId && (pathArray.length !== 0 && (pathArray[0] === AADAuthorityConstants.COMMON || pathArray[0] === AADAuthorityConstants.ORGANIZATIONS))) {\n pathArray[0] = tenantId;\n }\n return UrlString.constructAuthorityUriFromObject(urlObject);\n }\n\n /**\n * Returns the anchor part(#) of the URL\n */\n getHash(): string {\n return UrlString.parseHash(this.urlString);\n }\n\n /**\n * Parses out the components from a url string.\n * @returns An object with the various components. Please cache this value insted of calling this multiple times on the same url.\n */\n getUrlComponents(): IUri {\n // https://gist.github.com/curtisz/11139b2cfcaef4a261e0\n const regEx = RegExp(\"^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\\\?([^#]*))?(#(.*))?\");\n\n // If url string does not match regEx, we throw an error\n const match = this.urlString.match(regEx);\n if (!match) {\n throw ClientConfigurationError.createUrlParseError(`Given url string: ${this.urlString}`);\n }\n\n // Url component object\n const urlComponents = {\n Protocol: match[1],\n HostNameAndPort: match[4],\n AbsolutePath: match[5],\n QueryString: match[7]\n } as IUri;\n\n let pathSegments = urlComponents.AbsolutePath.split(\"/\");\n pathSegments = pathSegments.filter((val) => val && val.length > 0); // remove empty elements\n urlComponents.PathSegments = pathSegments;\n\n if (!StringUtils.isEmpty(urlComponents.QueryString) && urlComponents.QueryString.endsWith(\"/\")) {\n urlComponents.QueryString = urlComponents.QueryString.substring(0, urlComponents.QueryString.length-1);\n }\n return urlComponents;\n }\n\n static getDomainFromUrl(url: string): string {\n const regEx = RegExp(\"^([^:/?#]+://)?([^/?#]*)\");\n\n const match = url.match(regEx);\n\n if (!match) {\n throw ClientConfigurationError.createUrlParseError(`Given url string: ${url}`);\n }\n\n return match[2];\n }\n\n static getAbsoluteUrl(relativeUrl: string, baseUrl: string): string {\n if (relativeUrl[0] === Constants.FORWARD_SLASH) {\n const url = new UrlString(baseUrl);\n const baseComponents = url.getUrlComponents();\n\n return baseComponents.Protocol + \"//\" + baseComponents.HostNameAndPort + relativeUrl;\n }\n\n return relativeUrl;\n }\n\n /**\n * Parses hash string from given string. Returns empty string if no hash symbol is found.\n * @param hashString\n */\n static parseHash(hashString: string): string {\n const hashIndex1 = hashString.indexOf(\"#\");\n const hashIndex2 = hashString.indexOf(\"#/\");\n if (hashIndex2 > -1) {\n return hashString.substring(hashIndex2 + 2);\n } else if (hashIndex1 > -1) {\n return hashString.substring(hashIndex1 + 1);\n }\n return Constants.EMPTY_STRING;\n }\n\n /**\n * Parses query string from given string. Returns empty string if no query symbol is found.\n * @param queryString\n */\n static parseQueryString(queryString: string): string {\n const queryIndex1 = queryString.indexOf(\"?\");\n const queryIndex2 = queryString.indexOf(\"/?\");\n if (queryIndex2 > -1) {\n return queryString.substring(queryIndex2 + 2);\n } else if (queryIndex1 > -1) {\n return queryString.substring(queryIndex1 + 1);\n }\n return Constants.EMPTY_STRING;\n }\n\n static constructAuthorityUriFromObject(urlObject: IUri): UrlString {\n return new UrlString(urlObject.Protocol + \"//\" + urlObject.HostNameAndPort + \"/\" + urlObject.PathSegments.join(\"/\"));\n }\n\n /**\n * Returns URL hash as server auth code response object.\n */\n static getDeserializedHash(hash: string): ServerAuthorizationCodeResponse {\n // Check if given hash is empty\n if (StringUtils.isEmpty(hash)) {\n return {};\n }\n // Strip the # symbol if present\n const parsedHash = UrlString.parseHash(hash);\n // If # symbol was not present, above will return empty string, so give original hash value\n const deserializedHash: ServerAuthorizationCodeResponse = StringUtils.queryStringToObject<ServerAuthorizationCodeResponse>(StringUtils.isEmpty(parsedHash) ? hash : parsedHash);\n // Check if deserialization didn't work\n if (!deserializedHash) {\n throw ClientAuthError.createHashNotDeserializedError(JSON.stringify(deserializedHash));\n }\n return deserializedHash;\n }\n\n /**\n * Returns URL query string as server auth code response object.\n */\n static getDeserializedQueryString(query: string): ServerAuthorizationCodeResponse {\n // Check if given query is empty\n if (StringUtils.isEmpty(query)) {\n return {};\n }\n // Strip the ? symbol if present\n const parsedQueryString = UrlString.parseQueryString(query);\n // If ? symbol was not present, above will return empty string, so give original query value\n const deserializedQueryString: ServerAuthorizationCodeResponse = StringUtils.queryStringToObject<ServerAuthorizationCodeResponse>(StringUtils.isEmpty(parsedQueryString) ? query : parsedQueryString);\n // Check if deserialization didn't work\n if (!deserializedQueryString) {\n throw ClientAuthError.createHashNotDeserializedError(JSON.stringify(deserializedQueryString));\n }\n return deserializedQueryString;\n }\n\n /**\n * Check if the hash of the URL string contains known properties\n */\n static hashContainsKnownProperties(hash: string): boolean {\n if (StringUtils.isEmpty(hash) || hash.indexOf(\"=\") < 0) {\n // Hash doesn't contain key/value pairs\n return false;\n }\n\n const parameters: ServerAuthorizationCodeResponse = UrlString.getDeserializedHash(hash);\n return !!(\n parameters.code ||\n parameters.error_description ||\n parameters.error ||\n parameters.state\n );\n }\n}\n"],"names":[],"mappings":";;;;;;;AAAA;;;AAGG;AASH;;AAEG;AACH,IAAA,SAAA,kBAAA,YAAA;AAQI,IAAA,SAAA,SAAA,CAAY,GAAW,EAAA;AACnB,QAAA,IAAI,CAAC,UAAU,GAAG,GAAG,CAAC;QACtB,IAAI,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE;;AAEtC,YAAA,MAAM,wBAAwB,CAAC,mBAAmB,EAAE,CAAC;AACxD,SAAA;QAED,IAAI,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,EAAE;YACrC,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;AACpD,SAAA;KACJ;AAdD,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ACL,OAAC,SAAA,CAAA;AAAD,CAAC,EAAA;;;;"}
\ No newline at end of file
export declare const Constants: {
LIBRARY_NAME: string;
SKU: string;
CACHE_PREFIX: string;
DEFAULT_AUTHORITY: string;
DEFAULT_AUTHORITY_HOST: string;
DEFAULT_COMMON_TENANT: string;
ADFS: string;
DSTS: string;
AAD_INSTANCE_DISCOVERY_ENDPT: string;
RESOURCE_DELIM: string;
NO_ACCOUNT: string;
CLAIMS: string;
CONSUMER_UTID: string;
OPENID_SCOPE: string;
PROFILE_SCOPE: string;
OFFLINE_ACCESS_SCOPE: string;
EMAIL_SCOPE: string;
CODE_RESPONSE_TYPE: string;
CODE_GRANT_TYPE: string;
RT_GRANT_TYPE: string;
FRAGMENT_RESPONSE_MODE: string;
S256_CODE_CHALLENGE_METHOD: string;
URL_FORM_CONTENT_TYPE: string;
AUTHORIZATION_PENDING: string;
NOT_DEFINED: string;
EMPTY_STRING: string;
NOT_APPLICABLE: string;
FORWARD_SLASH: string;
IMDS_ENDPOINT: string;
IMDS_VERSION: string;
IMDS_TIMEOUT: number;
AZURE_REGION_AUTO_DISCOVER_FLAG: string;
REGIONAL_AUTH_PUBLIC_CLOUD_SUFFIX: string;
REGIONAL_AUTH_NON_MSI_QUERY_STRING: string;
KNOWN_PUBLIC_CLOUDS: string[];
TOKEN_RESPONSE_TYPE: string;
ID_TOKEN_RESPONSE_TYPE: string;
SHR_NONCE_VALIDITY: number;
INVALID_INSTANCE: string;
};
export declare const OIDC_DEFAULT_SCOPES: string[];
export declare const OIDC_SCOPES: string[];
/**
* Request header names
*/
export declare enum HeaderNames {
CONTENT_TYPE = "Content-Type",
RETRY_AFTER = "Retry-After",
CCS_HEADER = "X-AnchorMailbox",
WWWAuthenticate = "WWW-Authenticate",
AuthenticationInfo = "Authentication-Info",
X_MS_REQUEST_ID = "x-ms-request-id"
}
/**
* Persistent cache keys MSAL which stay while user is logged in.
*/
export declare enum PersistentCacheKeys {
ID_TOKEN = "idtoken",
CLIENT_INFO = "client.info",
ADAL_ID_TOKEN = "adal.idtoken",
ERROR = "error",
ERROR_DESC = "error.description",
ACTIVE_ACCOUNT = "active-account",
ACTIVE_ACCOUNT_FILTERS = "active-account-filters"
}
/**
* String constants related to AAD Authority
*/
export declare enum AADAuthorityConstants {
COMMON = "common",
ORGANIZATIONS = "organizations",
CONSUMERS = "consumers"
}
/**
* Keys in the hashParams sent by AAD Server
*/
export declare enum AADServerParamKeys {
CLIENT_ID = "client_id",
REDIRECT_URI = "redirect_uri",
RESPONSE_TYPE = "response_type",
RESPONSE_MODE = "response_mode",
GRANT_TYPE = "grant_type",
CLAIMS = "claims",
SCOPE = "scope",
ERROR = "error",
ERROR_DESCRIPTION = "error_description",
ACCESS_TOKEN = "access_token",
ID_TOKEN = "id_token",
REFRESH_TOKEN = "refresh_token",
EXPIRES_IN = "expires_in",
STATE = "state",
NONCE = "nonce",
PROMPT = "prompt",
SESSION_STATE = "session_state",
CLIENT_INFO = "client_info",
CODE = "code",
CODE_CHALLENGE = "code_challenge",
CODE_CHALLENGE_METHOD = "code_challenge_method",
CODE_VERIFIER = "code_verifier",
CLIENT_REQUEST_ID = "client-request-id",
X_CLIENT_SKU = "x-client-SKU",
X_CLIENT_VER = "x-client-VER",
X_CLIENT_OS = "x-client-OS",
X_CLIENT_CPU = "x-client-CPU",
X_CLIENT_CURR_TELEM = "x-client-current-telemetry",
X_CLIENT_LAST_TELEM = "x-client-last-telemetry",
X_MS_LIB_CAPABILITY = "x-ms-lib-capability",
X_APP_NAME = "x-app-name",
X_APP_VER = "x-app-ver",
POST_LOGOUT_URI = "post_logout_redirect_uri",
ID_TOKEN_HINT = "id_token_hint",
DEVICE_CODE = "device_code",
CLIENT_SECRET = "client_secret",
CLIENT_ASSERTION = "client_assertion",
CLIENT_ASSERTION_TYPE = "client_assertion_type",
TOKEN_TYPE = "token_type",
REQ_CNF = "req_cnf",
OBO_ASSERTION = "assertion",
REQUESTED_TOKEN_USE = "requested_token_use",
ON_BEHALF_OF = "on_behalf_of",
FOCI = "foci",
CCS_HEADER = "X-AnchorMailbox",
RETURN_SPA_CODE = "return_spa_code",
NATIVE_BROKER = "nativebroker",
LOGOUT_HINT = "logout_hint"
}
/**
* Claims request keys
*/
export declare enum ClaimsRequestKeys {
ACCESS_TOKEN = "access_token",
XMS_CC = "xms_cc"
}
/**
* we considered making this "enum" in the request instead of string, however it looks like the allowed list of
* prompt values kept changing over past couple of years. There are some undocumented prompt values for some
* internal partners too, hence the choice of generic "string" type instead of the "enum"
*/
export declare const PromptValue: {
LOGIN: string;
SELECT_ACCOUNT: string;
C
\ No newline at end of file
{"version":3,"file":"Constants.d.ts","sourceRoot":"","sources":["../../src/utils/Constants.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkDrB,CAAC;AAEF,eAAO,MAAM,mBAAmB,UAI/B,CAAC;AAEF,eAAO,MAAM,WAAW,UAGvB,CAAC;AAEF;;GAEG;AACH,oBAAY,WAAW;IACnB,YAAY,iBAAiB;IAC7B,WAAW,gBAAgB;IAC3B,UAAU,oBAAoB;IAC9B,eAAe,qBAAqB;IACpC,kBAAkB,wBAAwB;IAC1C,eAAe,oBAAoB;CACtC;AAED;;GAEG;AACH,oBAAY,mBAAmB;IAC3B,QAAQ,YAAY;IACpB,WAAW,gBAAgB;IAC3B,aAAa,iBAAiB;IAC9B,KAAK,UAAU;IACf,UAAU,sBAAsB;IAChC,cAAc,mBAAmB;IACjC,sBAAsB,2BAA2B;CACpD;AAED;;GAEG;AACH,oBAAY,qBAAqB;IAC7B,MAAM,WAAW;IACjB,aAAa,kBAAkB;IAC/B,SAAS,cAAc;CAC1B;AAED;;GAEG;AACH,oBAAY,kBAAkB;IAC1B,SAAS,cAAc;IACvB,YAAY,iBAAiB;IAC7B,aAAa,kBAAkB;IAC/B,aAAa,kBAAkB;IAC/B,UAAU,eAAe;IACzB,MAAM,WAAW;IACjB,KAAK,UAAU;IACf,K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eAAO,MAAM,WAAW,gBAAgB,CAAC;AACzC,eAAO,MAAM,aAAa,MAAM,CAAC;AAEjC,eAAO,MAAM,4BAA4B;;;CAGxC,CAAC;AAEF,oBAAY,uBAAuB;IAC/B,MAAM,WAAW;IACjB,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,gBAAgB,qBAAoB;CACvC;AAED,eAAO,MAAM,sBAAsB;;;;;;;;;;;CAWlC,CAAC;AAEF;;GAEG;AACH,oBAAY,oBAAoB;IAC5B,MAAM,WAAW;IACjB,GAAG,QAAQ;IACX,GAAG,aAAa;CACnB;AAED;;GAEG;AACH,eAAO,MAAM,mBAAmB;;;;;CAS/B,CAAC;AAEF,eAAO,MAAM,MAAM;;;CAGlB,CAAC;AAEF;;GAEG;AACH,oBAAY,sBAAsB;IAC9B,QAAQ,aAAa;IACrB,QAAQ,aAAa;CACxB;AAED;;GAEG;AACH,oBAAa,aAAa;IACtB,WAAW,MAAM;IACjB,cAAc,MAAM;CACvB;AAED;;GAEG;AACH,oBAAY,sBAAsB;IAC9B,qBAAqB,MAAM;IAC3B,cAAc,MAAM;IACpB,oBAAoB,MAAM;IAC1B,IAAI,MAAM;CACb;AAED;;GAEG;AACH,oBAAY,uBAAuB;IAC/B,2BAA2B,MAAM;IACjC,4BAA4B,MAAM;IAClC,uBAAuB,MAAM;IAC7B,mCAAmC,MAAM;IACzC,+BAA+B,MAAM;CACxC;AAED,oBAAY,YAAY;IACpB,YAAY,MAAM;IAClB,aAAa,MAAM;IACnB,sBAAsB,MAAM;IAC5B,2BAA2B,MAAM;IACjC,2BAA2B,MAAM;CACpC;AAED,oBAAY,SAAS;IACjB,GAAG,QAAQ;IACX,GAAG,QAAQ;CACd;AAED,eAAO,MAAM,aAAa,WAAW,CAAC"}
\ No newline at end of file
/*! @azure/msal-common v9.0.1 2022-12-07 */
'use strict';
import { __spreadArrays } from '../_virtual/_tslib.js';
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
var Constants = {
LIBRARY_NAME: "MSAL.JS",
SKU: "msal.js.common",
// Prefix for all library cache entries
CACHE_PREFIX: "msal",
// default authority
DEFAULT_AUTHORITY: "https://login.microsoftonline.com/common/",
DEFAULT_AUTHORITY_HOST: "login.microsoftonline.com",
DEFAULT_COMMON_TENANT: "common",
// ADFS String
ADFS: "adfs",
DSTS: "dstsv2",
// Default AAD Instance Discovery Endpoint
AAD_INSTANCE_DISCOVERY_ENDPT: "https://login.microsoftonline.com/common/discovery/instance?api-version=1.1&authorization_endpoint=",
// Resource delimiter - used for certain cache entries
RESOURCE_DELIM: "|",
// Placeholder for non-existent account ids/objects
NO_ACCOUNT: "NO_ACCOUNT",
// Claims
CLAIMS: "claims",
// Consumer UTID
CONSUMER_UTID: "9188040d-6c67-4c5b-b112-36a304b66dad",
// Default scopes
OPENID_SCOPE: "openid",
PROFILE_SCOPE: "profile",
OFFLINE_ACCESS_SCOPE: "offline_access",
EMAIL_SCOPE: "email",
// Default response type for authorization code flow
CODE_RESPONSE_TYPE: "code",
CODE_GRANT_TYPE: "authorization_code",
RT_GRANT_TYPE: "refresh_token",
FRAGMENT_RESPONSE_MODE: "fragment",
S256_CODE_CHALLENGE_METHOD: "S256",
URL_FORM_CONTENT_TYPE: "application/x-www-form-urlencoded;charset=utf-8",
AUTHORIZATION_PENDING: "authorization_pending",
NOT_DEFINED: "not_defined",
EMPTY_STRING: "",
NOT_APPLICABLE: "N/A",
FORWARD_SLASH: "/",
IMDS_ENDPOINT: "http://169.254.169.254/metadata/instance/compute/location",
IMDS_VERSION: "2020-06-01",
IMDS_TIMEOUT: 2000,
AZURE_REGION_AUTO_DISCOVER_FLAG: "TryAutoDetect",
REGIONAL_AUTH_PUBLIC_CLOUD_SUFFIX: "login.microsoft.com",
REGIONAL_AUTH_NON_MSI_QUERY_STRING: "allowestsrnonmsi=true",
KNOWN_PUBLIC_CLOUDS: ["login.microsoftonline.com", "login.windows.net", "login.microsoft.com", "sts.windows.net"],
TOKEN_RESPONSE_TYPE: "token",
ID_TOKEN_RESPONSE_TYPE: "id_token",
SHR_NONCE_VALIDITY: 240,
INVALID_INSTANCE: "invalid_instance",
};
var OIDC_DEFAULT_SCOPES = [
Constants.OPENID_SCOPE,
Constants.PROFILE_SCOPE,
Constants.OFFLINE_ACCESS_SCOPE
];
var OIDC_SCOPES = __spreadArrays(OIDC_DEFAULT_SCOPES, [
Constants.EMAIL_SCOPE
]);
/**
* Request header names
*/
var HeaderNames;
(function (HeaderNames) {
HeaderNames["CONTENT_TYPE"] = "Content-Type";
HeaderNames["RETRY_AFTER"] = "Retry-After";
HeaderNames["CCS_HEADER"] = "X-AnchorMailbox";
HeaderNames["WWWAuthenticate"] = "WWW-Authenticate";
HeaderNames["AuthenticationInfo"] = "Authentication-Info";
HeaderNames["X_MS_REQUEST_ID"] = "x-ms-request-id";
})(HeaderNames || (HeaderNames = {}));
/**
* Persistent cache keys MSAL which stay while user is logged in.
*/
var PersistentCacheKeys;
(function (PersistentCacheKeys) {
PersistentCacheKeys["ID_TOKEN"] = "idtoken";
PersistentCacheKeys["CLIENT_INFO"] = "client.info";
PersistentCacheKeys["ADAL_ID_TOKEN"] = "adal.idtoken";
PersistentCacheKeys["ERROR"] = "error";
PersistentCacheKeys["ERROR_DESC"] = "error.description";
PersistentCacheKeys["ACTIVE_ACCOUNT"] = "active-account";
PersistentCacheKeys["ACTIVE_ACCOUNT_FILTERS"] = "active-account-filters"; // new cache entry for active_account for a more robust version for browser
})(PersistentCacheKeys || (PersistentCacheKeys = {}));
/**
* String constants related to AAD Authority
*/
var AADAuthorityConstants;
(function (AADAuthorityConstants) {
AADAuthorityConstants["COMMON"] = "common";
AADAuthorityConstants["ORGANIZATIONS"] = "organizations";
AADAuthorityConstants["CONSUMERS"] = "consumers";
})(AADAuthorityConstants || (AADAuthorityConstants = {}));
/**
* Keys in the hashParams sent by AAD Server
*/
var AADServerParamKeys;
(function (AADServerParamKeys) {
AADServerParamKeys["CLIENT_ID"] = "client_id";
AADServerParamKeys["REDIRECT_URI"] = "redirect_uri";
AADServerParamKeys["RESPONSE_TYPE"] = "response_type";
AADServerParamKeys["RESPONSE_MODE"] = "response_mode";
AADServerParamKeys["GRANT_TYPE"] = "grant_type";
AADServerParamKeys["CLAIMS"] = "claims";
AADServerParamKeys["SCOPE"] = "scope";
AADServerParamKeys["ERROR"] = "error";
AADServerParamKeys["ERROR_DESCRIPTION"] = "error_description";
AADServerParamKeys["ACCESS_TOKEN"] = "access_token";
AADServerParamKeys["ID_TOKEN"] = "id_token";
AADServerParamKeys["REFRESH_TOKEN"] = "refresh_token";
AADServerParamKeys["EXPIRES_IN"] = "expires_in";
AADServerParamKeys["STATE"] = "state";
AADServerParamKeys["NONCE"] = "nonce";
AADServerParamKeys["PROMPT"] = "prompt";
AADServerParamKeys["SESSION_STATE"] = "session_state";
AADServerParamKeys["CLIENT_INFO"] = "client_info";
AADServerParamKeys["CODE"] = "code";
AADServerParamKeys["CODE_CHALLENGE"] = "code_challenge";
AADServerParamKeys["CODE_CHALLENGE_METHOD"] = "code_challenge_method";
AADServerParamKeys["CODE_VERIFIER"] = "code_verifier";
AADServerParamKeys["CLIENT_REQUEST_ID"] = "client-request-id";
AADServerParamKeys["X_CLIENT_SKU"] = "x-client-SKU";
AADServerParamKeys["X_CLIENT_VER"] = "x-client-VER";
AADServerParamKeys["X_CLIENT_OS"] = "x-client-OS";
AADServerParamKeys["X_CLIENT_CPU"] = "x-client-CPU";
AADServerParamKeys["X_CLIENT_CURR_TELEM"] = "x-client-current-telemetry";
AADServerParamKeys["X_CLIENT_LAST_TELEM"] = "x-client-last-telemetry";
AADServerParamKeys["X_MS_LIB_CAPABILITY"] = "x-ms-lib-capability";
AADServerParamKeys["X_APP_NAME"] = "x-app-name";
AADServerParamKeys["X_APP_VER"] = "x-app-ver";
AADServerParamKeys["POST_LOGOUT_URI"] = "post_logout_redirect_uri";
AADServerParamKeys["ID_TOKEN_HINT"] = "id_token_hint";
AADServerParamKeys["DEVICE_CODE"] = "device_code";
AADServerParamKeys["CLIENT_SECRET"] = "client_secret";
AADServerParamKeys["CLIENT_ASSERTION"] = "client_assertion";
AADServerParamKeys["CLIENT_ASSERTION_TYPE"] = "client_assertion_type";
AADServerParamKeys["TOKEN_TYPE"] = "token_type";
AADServerParamKeys["REQ_CNF"] = "req_cnf";
AADServerParamKeys["OBO_ASSERTION"] = "assertion";
AADServerParamKeys["REQUESTED_TOKEN_USE"] = "requested_token_use";
AADServerParamKeys["ON_BEHALF_OF"] = "on_behalf_of";
AADServerParamKeys["FOCI"] = "foci";
AADServerParamKeys["CCS_HEADER"] = "X-AnchorMailbox";
AADServerParamKeys["RETURN_SPA_CODE"] = "return_spa_code";
AADServerParamKeys["NATIVE_BROKER"] = "nativebroker";
AADServerParamKeys["LOGOUT_HINT"] = "logout_hint";
})(AADServerParamKeys || (AADServerParamKeys = {}));
/**
* Claims request keys
*/
var ClaimsRequestKeys;
(function (ClaimsRequestKeys) {
ClaimsRequestKeys["ACCESS_TOKEN"] = "access_token";
ClaimsRequestKeys["XMS_CC"] = "xms_cc";
})(ClaimsRequestKeys || (ClaimsRequestKeys = {}));
/**
* we considered making this "enum" in the request instead of string, however it looks like the allowed list of
* prompt values kept changing over past couple of years. There are some undocumented prompt values for some
* internal partners too, hence the choice of generic "string" type instead of the "enum"
*/
var PromptValue = {
LOGIN: "login",
SELECT_ACCOUNT: "select_account",
CONSENT: "consent",
NONE: "none",
CREATE: "create",
NO_SESSION: "no_session"
};
/**
* SSO Types - generated to populate hints
*/
var SSOTypes;
(function (SSOTypes) {
SSOTypes["ACCOUNT"] = "account";
SSOTypes["SID"] = "sid";
SSOTypes["LOGIN_HINT"] = "login_hint";
SSOTypes["ID_TOKEN"] = "id_token";
SSOTypes["DOMAIN_HINT"] = "domain_hint";
SSOTypes["ORGANIZATIONS"] = "organizations";
SSOTypes["CONSUMERS"] = "consumers";
SSOTypes["ACCOUNT_ID"] = "accountIdentifier";
SSOTypes["HOMEACCOUNT_ID"] = "homeAccountIdentifier";
})(SSOTypes || (SSOTypes = {}));
/**
* allowed values for codeVerifier
*/
var CodeChallengeMethodValues = {
PLAIN: "plain",
S256: "S256"
};
/**
* allowed values for response_mode
*/
var ResponseMode;
(function (ResponseMode) {
ResponseMode["QUERY"] = "query";
ResponseMode["FRAGMENT"] = "fragment";
ResponseMode["FORM_POST"] = "form_post";
})(ResponseMode || (ResponseMode = {}));
/**
* allowed grant_type
*/
var GrantType;
(function (GrantType) {
GrantType["IMPLICIT_GRANT"] = "implicit";
GrantType["AUTHORIZATION_CODE_GRANT"] = "authorization_code";
GrantType["CLIENT_CREDENTIALS_GRANT"] = "client_credentials";
GrantType["RESOURCE_OWNER_PASSWORD_GRANT"] = "password";
GrantType["REFRESH_TOKEN_GRANT"] = "refresh_token";
GrantType["DEVICE_CODE_GRANT"] = "device_code";
GrantType["JWT_BEARER"] = "urn:ietf:params:oauth:grant-type:jwt-bearer";
})(GrantType || (GrantType = {}));
/**
* Account types in Cache
*/
var CacheAccountType;
(function (CacheAccountType) {
CacheAccountType["MSSTS_ACCOUNT_TYPE"] = "MSSTS";
CacheAccountType["ADFS_ACCOUNT_TYPE"] = "ADFS";
CacheAccountType["MSAV1_ACCOUNT_TYPE"] = "MSA";
CacheAccountType["GENERIC_ACCOUNT_TYPE"] = "Generic"; // NTLM, Kerberos, FBA, Basic etc
})(CacheAccountType || (CacheAccountType = {}));
/**
* Separators used in cache
*/
var Separators;
(function (Separators) {
Separators["CACHE_KEY_SEPARATOR"] = "-";
Separators["CLIENT_INFO_SEPARATOR"] = ".";
})(Separators || (Separators = {}));
/**
* Credential Type stored in the cache
*/
var CredentialType;
(function (CredentialType) {
CredentialType["ID_TOKEN"] = "IdToken";
CredentialType["ACCESS_TOKEN"] = "AccessToken";
CredentialType["ACCESS_TOKEN_WITH_AUTH_SCHEME"] = "AccessToken_With_AuthScheme";
CredentialType["REFRESH_TOKEN"] = "RefreshToken";
})(CredentialType || (CredentialType = {}));
/**
* Credential Type stored in the cache
*/
var CacheSchemaType;
(function (CacheSchemaType) {
CacheSchemaType["ACCOUNT"] = "Account";
CacheSchemaType["CREDENTIAL"] = "Credential";
CacheSchemaType["ID_TOKEN"] = "IdToken";
CacheSchemaType["ACCESS_TOKEN"] = "AccessToken";
CacheSchemaType["REFRESH_TOKEN"] = "RefreshToken";
CacheSchemaType["APP_METADATA"] = "AppMetadata";
CacheSchemaType["TEMPORARY"] = "TempCache";
CacheSchemaType["TELEMETRY"] = "Telemetry";
CacheSchemaType["UNDEFINED"] = "Undefined";
CacheSchemaType["THROTTLING"] = "Throttling";
})(CacheSchemaType || (CacheSchemaType = {}));
/**
* Combine all cache types
*/
var CacheType;
(function (CacheType) {
CacheType[CacheType["ADFS"] = 1001] = "ADFS";
CacheType[CacheType["MSA"] = 1002] = "MSA";
CacheType[CacheType["MSSTS"] = 1003] = "MSSTS";
CacheType[CacheType["GENERIC"] = 1004] = "GENERIC";
CacheType[CacheType["ACCESS_TOKEN"] = 2001] = "ACCESS_TOKEN";
CacheType[CacheType["REFRESH_TOKEN"] = 2002] = "REFRESH_TOKEN";
CacheType[CacheType["ID_TOKEN"] = 2003] = "ID_TOKEN";
CacheType[CacheType["APP_METADATA"] = 3001] = "APP_METADATA";
CacheType[CacheType["UNDEFINED"] = 9999] = "UNDEFINED";
})(CacheType || (CacheType = {}));
/**
* More Cache related constants
*/
var APP_METADATA = "appmetadata";
var CLIENT_INFO = "client_info";
var THE_FAMILY_ID = "1";
var AUTHORITY_METADATA_CONSTANTS = {
CACHE_KEY: "authority-metadata",
REFRESH_TIME_SECONDS: 3600 * 24 // 24 Hours
};
var AuthorityMetadataSource;
(function (AuthorityMetadataSource) {
AuthorityMetadataSource["CONFIG"] = "config";
AuthorityMetadataSource["CACHE"] = "cache";
AuthorityMetadataSource["NETWORK"] = "network";
AuthorityMetadataSource["HARDCODED_VALUES"] = "hardcoded_values";
})(AuthorityMetadataSource || (AuthorityMetadataSource = {}));
var SERVER_TELEM_CONSTANTS = {
SCHEMA_VERSION: 5,
MAX_CUR_HEADER_BYTES: 80,
MAX_LAST_HEADER_BYTES: 330,
MAX_CACHED_ERRORS: 50,
CACHE_KEY: "server-telemetry",
CATEGORY_SEPARATOR: "|",
VALUE_SEPARATOR: ",",
OVERFLOW_TRUE: "1",
OVERFLOW_FALSE: "0",
UNKNOWN_ERROR: "unknown_error"
};
/**
* Type of the authentication request
*/
var AuthenticationScheme;
(function (AuthenticationScheme) {
AuthenticationScheme["BEARER"] = "Bearer";
AuthenticationScheme["POP"] = "pop";
AuthenticationScheme["SSH"] = "ssh-cert";
})(AuthenticationScheme || (AuthenticationScheme = {}));
/**
* Constants related to throttling
*/
var ThrottlingConstants = {
// Default time to throttle RequestThumbprint in seconds
DEFAULT_THROTTLE_TIME_SECONDS: 60,
// Default maximum time to throttle in seconds, overrides what the server sends back
DEFAULT_MAX_THROTTLE_TIME_SECONDS: 3600,
// Prefix for storing throttling entries
THROTTLING_PREFIX: "throttling",
// Value assigned to the x-ms-lib-capability header to indicate to the server the library supports throttling
X_MS_LIB_CAPABILITY_VALUE: "retry-after, h429"
};
var Errors = {
INVALID_GRANT_ERROR: "invalid_grant",
CLIENT_MISMATCH_ERROR: "client_mismatch",
};
/**
* Password grant parameters
*/
var PasswordGrantConstants;
(function (PasswordGrantConstants) {
PasswordGrantConstants["username"] = "username";
PasswordGrantConstants["password"] = "password";
})(PasswordGrantConstants || (PasswordGrantConstants = {}));
/**
* Response codes
*/
var ResponseCodes;
(function (ResponseCodes) {
ResponseCodes[ResponseCodes["httpSuccess"] = 200] = "httpSuccess";
ResponseCodes[ResponseCodes["httpBadRequest"] = 400] = "httpBadRequest";
})(ResponseCodes || (ResponseCodes = {}));
/**
* Region Discovery Sources
*/
var RegionDiscoverySources;
(function (RegionDiscoverySources) {
RegionDiscoverySources["FAILED_AUTO_DETECTION"] = "1";
RegionDiscoverySources["INTERNAL_CACHE"] = "2";
RegionDiscoverySources["ENVIRONMENT_VARIABLE"] = "3";
RegionDiscoverySources["IMDS"] = "4";
})(RegionDiscoverySources || (RegionDiscoverySources = {}));
/**
* Region Discovery Outcomes
*/
var RegionDiscoveryOutcomes;
(function (RegionDiscoveryOutcomes) {
RegionDiscoveryOutcomes["CONFIGURED_MATCHES_DETECTED"] = "1";
RegionDiscoveryOutcomes["CONFIGURED_NO_AUTO_DETECTION"] = "2";
RegionDiscoveryOutcomes["CONFIGURED_NOT_DETECTED"] = "3";
RegionDiscoveryOutcomes["AUTO_DETECTION_REQUESTED_SUCCESSFUL"] = "4";
RegionDiscoveryOutcomes["AUTO_DETECTION_REQUESTED_FAILED"] = "5";
})(RegionDiscoveryOutcomes || (RegionDiscoveryOutcomes = {}));
var CacheOutcome;
(function (CacheOutcome) {
CacheOutcome["NO_CACHE_HIT"] = "0";
CacheOutcome["FORCE_REFRESH"] = "1";
CacheOutcome["NO_CACHED_ACCESS_TOKEN"] = "2";
CacheOutcome["CACHED_ACCESS_TOKEN_EXPIRED"] = "3";
CacheOutcome["REFRESH_CACHED_ACCESS_TOKEN"] = "4";
})(CacheOutcome || (CacheOutcome = {}));
var JsonTypes;
(function (JsonTypes) {
JsonTypes["Jwt"] = "JWT";
JsonTypes["Jwk"] = "JWK";
})(JsonTypes || (JsonTypes = {}));
var ONE_DAY_IN_MS = 86400000;
export { AADAuthorityConstants, AADServerParamKeys, APP_METADATA, AUTHORITY_METADATA_CONSTANTS, AuthenticationScheme, AuthorityMetadataSource, CLIENT_INFO, CacheAccountType, CacheOutcome, CacheSchemaType, CacheType, ClaimsRequestKeys, CodeChallengeMethodValues, Constants, CredentialType, Errors, GrantType, HeaderNames, JsonTypes, OIDC_DEFAULT_SCOPES, OIDC_SCOPES, ONE_DAY_IN_MS, PasswordGrantConstants, PersistentCacheKeys, PromptValue, RegionDiscoveryOutcomes, RegionDiscoverySources, ResponseCodes, ResponseMode, SERVER_TELEM_CONSTANTS, SSOTypes, Separators, THE_FAMILY_ID, ThrottlingConstants };
//# sourceMappingURL=Constants.js.map
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment