@azure/msal-common
Advanced tools
Comparing version 14.13.1 to 14.14.0
@@ -5,3 +5,4 @@ export type ServerTelemetryEntity = { | ||
cacheHits: number; | ||
nativeBrokerErrorCode?: string; | ||
}; | ||
//# sourceMappingURL=ServerTelemetryEntity.d.ts.map |
@@ -53,2 +53,3 @@ export declare const CLIENT_ID = "client_id"; | ||
export declare const DOMAIN_HINT = "domain_hint"; | ||
export declare const X_CLIENT_EXTRA_SKU = "x-client-xtra-sku"; | ||
//# sourceMappingURL=AADServerParamKeys.d.ts.map |
export declare const name = "@azure/msal-common"; | ||
export declare const version = "14.13.1"; | ||
export declare const version = "14.14.0"; | ||
//# sourceMappingURL=packageMetadata.d.ts.map |
@@ -6,2 +6,9 @@ import { CacheOutcome } from "../../utils/Constants"; | ||
import { RegionDiscoveryMetadata } from "../../authority/RegionDiscoveryMetadata"; | ||
type SkuParams = { | ||
libraryName?: string; | ||
libraryVersion?: string; | ||
extensionName?: string; | ||
extensionVersion?: string; | ||
skus?: string; | ||
}; | ||
/** @internal */ | ||
@@ -67,3 +74,8 @@ export declare class ServerTelemetryManager { | ||
setCacheOutcome(cacheOutcome: CacheOutcome): void; | ||
setNativeBrokerErrorCode(errorCode: string): void; | ||
getNativeBrokerErrorCode(): string | undefined; | ||
clearNativeBrokerErrorCode(): void; | ||
static makeExtraSkuString(params: SkuParams): string; | ||
} | ||
export {}; | ||
//# sourceMappingURL=ServerTelemetryManager.d.ts.map |
@@ -13,3 +13,3 @@ { | ||
}, | ||
"version": "14.13.1", | ||
"version": "14.14.0", | ||
"description": "Microsoft Authentication Library for js", | ||
@@ -16,0 +16,0 @@ "keywords": [ |
@@ -10,2 +10,3 @@ /* | ||
cacheHits: number; | ||
nativeBrokerErrorCode?: string; | ||
}; |
@@ -58,1 +58,2 @@ /* | ||
export const DOMAIN_HINT = "domain_hint"; | ||
export const X_CLIENT_EXTRA_SKU = "x-client-xtra-sku"; |
/* eslint-disable header/header */ | ||
export const name = "@azure/msal-common"; | ||
export const version = "14.13.1"; | ||
export const version = "14.14.0"; |
@@ -20,2 +20,65 @@ /* | ||
const skuGroupSeparator = ","; | ||
const skuValueSeparator = "|"; | ||
type SkuParams = { | ||
libraryName?: string; | ||
libraryVersion?: string; | ||
extensionName?: string; | ||
extensionVersion?: string; | ||
skus?: string; | ||
}; | ||
function makeExtraSkuString(params: SkuParams): string { | ||
const { | ||
skus, | ||
libraryName, | ||
libraryVersion, | ||
extensionName, | ||
extensionVersion, | ||
} = params; | ||
const skuMap: Map<number, (string | undefined)[]> = new Map([ | ||
[0, [libraryName, libraryVersion]], | ||
[2, [extensionName, extensionVersion]], | ||
]); | ||
let skuArr: string[] = []; | ||
if (skus?.length) { | ||
skuArr = skus.split(skuGroupSeparator); | ||
// Ignore invalid input sku param | ||
if (skuArr.length < 4) { | ||
return skus; | ||
} | ||
} else { | ||
skuArr = Array.from({ length: 4 }, () => skuValueSeparator); | ||
} | ||
skuMap.forEach((value, key) => { | ||
if (value.length === 2 && value[0]?.length && value[1]?.length) { | ||
setSku({ | ||
skuArr, | ||
index: key, | ||
skuName: value[0], | ||
skuVersion: value[1], | ||
}); | ||
} | ||
}); | ||
return skuArr.join(skuGroupSeparator); | ||
} | ||
function setSku(params: { | ||
skuArr: string[]; | ||
index: number; | ||
skuName: string; | ||
skuVersion: string; | ||
}): void { | ||
const { skuArr, index, skuName, skuVersion } = params; | ||
if (index >= skuArr.length) { | ||
return; | ||
} | ||
skuArr[index] = [skuName, skuVersion].join(skuValueSeparator); | ||
} | ||
/** @internal */ | ||
@@ -55,3 +118,8 @@ export class ServerTelemetryManager { | ||
const request = `${this.apiId}${SERVER_TELEM_CONSTANTS.VALUE_SEPARATOR}${this.cacheOutcome}`; | ||
const platformFields = [this.wrapperSKU, this.wrapperVer].join( | ||
const platformFieldsArr = [this.wrapperSKU, this.wrapperVer]; | ||
const nativeBrokerErrorCode = this.getNativeBrokerErrorCode(); | ||
if (nativeBrokerErrorCode?.length) { | ||
platformFieldsArr.push(`broker_error=${nativeBrokerErrorCode}`); | ||
} | ||
const platformFields = platformFieldsArr.join( | ||
SERVER_TELEM_CONSTANTS.VALUE_SEPARATOR | ||
@@ -282,2 +350,28 @@ ); | ||
} | ||
setNativeBrokerErrorCode(errorCode: string): void { | ||
const lastRequests = this.getLastRequests(); | ||
lastRequests.nativeBrokerErrorCode = errorCode; | ||
this.cacheManager.setServerTelemetry( | ||
this.telemetryCacheKey, | ||
lastRequests | ||
); | ||
} | ||
getNativeBrokerErrorCode(): string | undefined { | ||
return this.getLastRequests().nativeBrokerErrorCode; | ||
} | ||
clearNativeBrokerErrorCode(): void { | ||
const lastRequests = this.getLastRequests(); | ||
delete lastRequests.nativeBrokerErrorCode; | ||
this.cacheManager.setServerTelemetry( | ||
this.telemetryCacheKey, | ||
lastRequests | ||
); | ||
} | ||
static makeExtraSkuString(params: SkuParams): string { | ||
return makeExtraSkuString(params); | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2124027
38684