@azure/msal-common 14.3.0 → 14.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/account/AuthToken.mjs +1 -1
- package/dist/account/CcsCredential.mjs +1 -1
- package/dist/account/ClientInfo.mjs +1 -1
- package/dist/authority/Authority.d.ts.map +1 -1
- package/dist/authority/Authority.mjs +2 -3
- package/dist/authority/Authority.mjs.map +1 -1
- package/dist/authority/AuthorityFactory.mjs +1 -1
- package/dist/authority/AuthorityMetadata.mjs +1 -1
- package/dist/authority/AuthorityOptions.mjs +1 -1
- package/dist/authority/AuthorityType.mjs +1 -1
- package/dist/authority/CloudInstanceDiscoveryErrorResponse.mjs +1 -1
- package/dist/authority/CloudInstanceDiscoveryResponse.mjs +1 -1
- package/dist/authority/OpenIdConfigResponse.mjs +1 -1
- package/dist/authority/ProtocolMode.mjs +1 -1
- package/dist/authority/RegionDiscovery.mjs +1 -1
- package/dist/cache/CacheManager.d.ts +24 -19
- package/dist/cache/CacheManager.d.ts.map +1 -1
- package/dist/cache/CacheManager.mjs +36 -23
- package/dist/cache/CacheManager.mjs.map +1 -1
- package/dist/cache/entities/AccountEntity.mjs +1 -1
- package/dist/cache/entities/AppMetadataEntity.mjs +1 -1
- package/dist/cache/entities/AuthorityMetadataEntity.mjs +1 -1
- package/dist/cache/entities/CacheRecord.mjs +1 -1
- package/dist/cache/entities/ServerTelemetryEntity.d.ts +2 -9
- package/dist/cache/entities/ServerTelemetryEntity.d.ts.map +1 -1
- package/dist/cache/entities/ThrottlingEntity.mjs +1 -1
- package/dist/cache/persistence/TokenCacheContext.mjs +1 -1
- package/dist/cache/utils/CacheHelpers.d.ts +6 -0
- package/dist/cache/utils/CacheHelpers.d.ts.map +1 -1
- package/dist/cache/utils/CacheHelpers.mjs +19 -3
- package/dist/cache/utils/CacheHelpers.mjs.map +1 -1
- package/dist/client/AuthorizationCodeClient.d.ts +2 -1
- package/dist/client/AuthorizationCodeClient.d.ts.map +1 -1
- package/dist/client/AuthorizationCodeClient.mjs +3 -9
- package/dist/client/AuthorizationCodeClient.mjs.map +1 -1
- package/dist/client/BaseClient.mjs +1 -1
- package/dist/client/RefreshTokenClient.d.ts.map +1 -1
- package/dist/client/RefreshTokenClient.mjs +2 -2
- package/dist/client/RefreshTokenClient.mjs.map +1 -1
- package/dist/client/SilentFlowClient.d.ts.map +1 -1
- package/dist/client/SilentFlowClient.mjs +5 -3
- package/dist/client/SilentFlowClient.mjs.map +1 -1
- package/dist/config/ClientConfiguration.mjs +1 -1
- package/dist/crypto/ICrypto.d.ts +3 -3
- package/dist/crypto/ICrypto.d.ts.map +1 -1
- package/dist/crypto/ICrypto.mjs +1 -1
- package/dist/crypto/ICrypto.mjs.map +1 -1
- package/dist/crypto/JoseHeader.d.ts +3 -3
- package/dist/crypto/JoseHeader.d.ts.map +1 -1
- package/dist/crypto/JoseHeader.mjs +3 -3
- package/dist/crypto/JoseHeader.mjs.map +1 -1
- package/dist/crypto/PopTokenGenerator.d.ts.map +1 -1
- package/dist/crypto/PopTokenGenerator.mjs +3 -3
- package/dist/crypto/PopTokenGenerator.mjs.map +1 -1
- package/dist/crypto/SignedHttpRequest.d.ts +4 -0
- package/dist/crypto/SignedHttpRequest.d.ts.map +1 -1
- package/dist/error/AuthError.mjs +1 -1
- package/dist/error/AuthErrorCodes.mjs +1 -1
- package/dist/error/ClientAuthError.mjs +1 -1
- package/dist/error/ClientAuthErrorCodes.mjs +1 -1
- package/dist/error/ClientConfigurationError.mjs +1 -1
- package/dist/error/ClientConfigurationErrorCodes.mjs +1 -1
- package/dist/error/InteractionRequiredAuthError.mjs +1 -1
- package/dist/error/InteractionRequiredAuthErrorCodes.mjs +1 -1
- package/dist/error/JoseHeaderError.mjs +1 -1
- package/dist/error/JoseHeaderErrorCodes.mjs +1 -1
- package/dist/error/ServerError.mjs +1 -1
- package/dist/index.cjs +139 -201
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +4 -3
- package/dist/index.mjs.map +1 -1
- package/dist/logger/Logger.mjs +1 -1
- package/dist/network/INetworkModule.mjs +1 -1
- package/dist/network/NetworkManager.mjs +1 -1
- package/dist/network/RequestThumbprint.d.ts +2 -0
- package/dist/network/RequestThumbprint.d.ts.map +1 -1
- package/dist/network/ThrottlingUtils.mjs +1 -1
- package/dist/packageMetadata.d.ts +1 -1
- package/dist/packageMetadata.mjs +2 -2
- package/dist/request/AuthenticationHeaderParser.mjs +1 -1
- package/dist/request/BaseAuthRequest.d.ts +3 -0
- package/dist/request/BaseAuthRequest.d.ts.map +1 -1
- package/dist/request/RequestParameterBuilder.mjs +1 -1
- package/dist/request/RequestValidator.mjs +1 -1
- package/dist/request/ScopeSet.mjs +1 -1
- package/dist/response/ResponseHandler.mjs +1 -1
- package/dist/telemetry/performance/PerformanceClient.mjs +1 -1
- package/dist/telemetry/performance/PerformanceEvent.d.ts +8 -1
- package/dist/telemetry/performance/PerformanceEvent.d.ts.map +1 -1
- package/dist/telemetry/performance/PerformanceEvent.mjs +6 -2
- package/dist/telemetry/performance/PerformanceEvent.mjs.map +1 -1
- package/dist/telemetry/performance/StubPerformanceClient.mjs +1 -1
- package/dist/telemetry/server/ServerTelemetryManager.d.ts.map +1 -1
- package/dist/telemetry/server/ServerTelemetryManager.mjs +11 -8
- package/dist/telemetry/server/ServerTelemetryManager.mjs.map +1 -1
- package/dist/url/UrlString.d.ts +2 -37
- package/dist/url/UrlString.d.ts.map +1 -1
- package/dist/url/UrlString.mjs +7 -126
- package/dist/url/UrlString.mjs.map +1 -1
- package/dist/utils/Constants.d.ts +2 -3
- package/dist/utils/Constants.d.ts.map +1 -1
- package/dist/utils/Constants.mjs +3 -4
- package/dist/utils/Constants.mjs.map +1 -1
- package/dist/utils/FunctionWrappers.mjs +1 -1
- package/dist/utils/ProtocolUtils.mjs +1 -1
- package/dist/utils/StringUtils.mjs +1 -1
- package/dist/utils/TimeUtils.mjs +1 -1
- package/dist/utils/UrlUtils.d.ts +11 -0
- package/dist/utils/UrlUtils.d.ts.map +1 -0
- package/dist/utils/UrlUtils.mjs +52 -0
- package/dist/utils/UrlUtils.mjs.map +1 -0
- package/package.json +1 -1
- package/src/authority/Authority.ts +2 -3
- package/src/cache/CacheManager.ts +63 -22
- package/src/cache/entities/ServerTelemetryEntity.ts +2 -30
- package/src/cache/utils/CacheHelpers.ts +21 -0
- package/src/client/AuthorizationCodeClient.ts +3 -13
- package/src/client/RefreshTokenClient.ts +7 -1
- package/src/client/SilentFlowClient.ts +8 -4
- package/src/crypto/ICrypto.ts +7 -2
- package/src/crypto/JoseHeader.ts +4 -4
- package/src/crypto/PopTokenGenerator.ts +2 -0
- package/src/crypto/SignedHttpRequest.ts +6 -0
- package/src/index.ts +3 -1
- package/src/network/RequestThumbprint.ts +2 -0
- package/src/packageMetadata.ts +1 -1
- package/src/request/BaseAuthRequest.ts +3 -0
- package/src/telemetry/performance/PerformanceEvent.ts +12 -1
- package/src/telemetry/server/ServerTelemetryManager.ts +12 -6
- package/src/url/UrlString.ts +6 -153
- package/src/utils/Constants.ts +3 -3
- package/src/utils/UrlUtils.ts +60 -0
- package/dist/cache/entities/ServerTelemetryEntity.mjs +0 -34
- package/dist/cache/entities/ServerTelemetryEntity.mjs.map +0 -1
package/src/url/UrlString.ts
CHANGED
|
@@ -3,22 +3,14 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { ServerAuthorizationCodeResponse } from "../response/ServerAuthorizationCodeResponse";
|
|
7
6
|
import {
|
|
8
7
|
createClientConfigurationError,
|
|
9
8
|
ClientConfigurationErrorCodes,
|
|
10
9
|
} from "../error/ClientConfigurationError";
|
|
11
|
-
import {
|
|
12
|
-
ClientAuthErrorCodes,
|
|
13
|
-
createClientAuthError,
|
|
14
|
-
} from "../error/ClientAuthError";
|
|
15
10
|
import { StringUtils } from "../utils/StringUtils";
|
|
16
11
|
import { IUri } from "./IUri";
|
|
17
|
-
import {
|
|
18
|
-
|
|
19
|
-
Constants,
|
|
20
|
-
ServerResponseType,
|
|
21
|
-
} from "../utils/Constants";
|
|
12
|
+
import { AADAuthorityConstants, Constants } from "../utils/Constants";
|
|
13
|
+
import * as UrlUtils from "../utils/UrlUtils";
|
|
22
14
|
|
|
23
15
|
/**
|
|
24
16
|
* Url object class which can perform various transformations on url strings.
|
|
@@ -39,7 +31,7 @@ export class UrlString {
|
|
|
39
31
|
);
|
|
40
32
|
}
|
|
41
33
|
|
|
42
|
-
if (!
|
|
34
|
+
if (!url.includes("#")) {
|
|
43
35
|
this._urlString = UrlString.canonicalizeUri(url);
|
|
44
36
|
}
|
|
45
37
|
}
|
|
@@ -142,13 +134,6 @@ export class UrlString {
|
|
|
142
134
|
return UrlString.constructAuthorityUriFromObject(urlObject);
|
|
143
135
|
}
|
|
144
136
|
|
|
145
|
-
/**
|
|
146
|
-
* Returns the anchor part(#) of the URL
|
|
147
|
-
*/
|
|
148
|
-
getHash(): string {
|
|
149
|
-
return UrlString.parseHash(this.urlString);
|
|
150
|
-
}
|
|
151
|
-
|
|
152
137
|
/**
|
|
153
138
|
* Parses out the components from a url string.
|
|
154
139
|
* @returns An object with the various components. Please cache this value insted of calling this multiple times on the same url.
|
|
@@ -221,58 +206,6 @@ export class UrlString {
|
|
|
221
206
|
return relativeUrl;
|
|
222
207
|
}
|
|
223
208
|
|
|
224
|
-
/**
|
|
225
|
-
* Parses hash string from given string. Returns empty string if no hash symbol is found.
|
|
226
|
-
* @param hashString
|
|
227
|
-
*/
|
|
228
|
-
static parseHash(hashString: string): string {
|
|
229
|
-
const hashIndex1 = hashString.indexOf("#");
|
|
230
|
-
const hashIndex2 = hashString.indexOf("#/");
|
|
231
|
-
if (hashIndex2 > -1) {
|
|
232
|
-
return hashString.substring(hashIndex2 + 2);
|
|
233
|
-
} else if (hashIndex1 > -1) {
|
|
234
|
-
return hashString.substring(hashIndex1 + 1);
|
|
235
|
-
}
|
|
236
|
-
return Constants.EMPTY_STRING;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
/**
|
|
240
|
-
* Parses query string from given string. Returns empty string if no query symbol is found.
|
|
241
|
-
* @param queryString
|
|
242
|
-
*/
|
|
243
|
-
static parseQueryString(queryString: string): string {
|
|
244
|
-
const queryIndex1 = queryString.indexOf("?");
|
|
245
|
-
const queryIndex2 = queryString.indexOf("/?");
|
|
246
|
-
if (queryIndex2 > -1) {
|
|
247
|
-
return queryString.substring(queryIndex2 + 2);
|
|
248
|
-
} else if (queryIndex1 > -1) {
|
|
249
|
-
return queryString.substring(queryIndex1 + 1);
|
|
250
|
-
}
|
|
251
|
-
return Constants.EMPTY_STRING;
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
/**
|
|
255
|
-
* Parses query server response string from given string.
|
|
256
|
-
* Extract hash between '?code=' and '#' if trailing '# is present.
|
|
257
|
-
* Returns empty string if no query symbol is found.
|
|
258
|
-
* @param queryString
|
|
259
|
-
*/
|
|
260
|
-
static parseQueryServerResponse(queryString: string): string {
|
|
261
|
-
const queryIndex1 = queryString.indexOf("?code");
|
|
262
|
-
const queryIndex2 = queryString.indexOf("/?code");
|
|
263
|
-
const hashIndex = queryString.indexOf("#");
|
|
264
|
-
if (queryIndex2 > -1 && hashIndex > -1) {
|
|
265
|
-
return queryString.substring(queryIndex2 + 2, hashIndex);
|
|
266
|
-
} else if (queryIndex2 > -1) {
|
|
267
|
-
return queryString.substring(queryIndex2 + 2);
|
|
268
|
-
} else if (queryIndex1 > -1 && hashIndex > -1) {
|
|
269
|
-
return queryString.substring(queryIndex1 + 1, hashIndex);
|
|
270
|
-
} else if (queryIndex1 > -1) {
|
|
271
|
-
return queryString.substring(queryIndex1 + 1);
|
|
272
|
-
}
|
|
273
|
-
return Constants.EMPTY_STRING;
|
|
274
|
-
}
|
|
275
|
-
|
|
276
209
|
static constructAuthorityUriFromObject(urlObject: IUri): UrlString {
|
|
277
210
|
return new UrlString(
|
|
278
211
|
urlObject.Protocol +
|
|
@@ -283,91 +216,11 @@ export class UrlString {
|
|
|
283
216
|
);
|
|
284
217
|
}
|
|
285
218
|
|
|
286
|
-
/**
|
|
287
|
-
* Returns URL hash as server auth code response object.
|
|
288
|
-
*/
|
|
289
|
-
static getDeserializedHash(hash: string): ServerAuthorizationCodeResponse {
|
|
290
|
-
// Check if given hash is empty
|
|
291
|
-
if (!hash) {
|
|
292
|
-
return {};
|
|
293
|
-
}
|
|
294
|
-
// Strip the # symbol if present
|
|
295
|
-
const parsedHash = UrlString.parseHash(hash);
|
|
296
|
-
// If # symbol was not present, above will return empty string, so give original hash value
|
|
297
|
-
const deserializedHash: ServerAuthorizationCodeResponse =
|
|
298
|
-
StringUtils.queryStringToObject<ServerAuthorizationCodeResponse>(
|
|
299
|
-
parsedHash || hash
|
|
300
|
-
);
|
|
301
|
-
// Check if deserialization didn't work
|
|
302
|
-
if (!deserializedHash) {
|
|
303
|
-
throw createClientAuthError(
|
|
304
|
-
ClientAuthErrorCodes.hashNotDeserialized
|
|
305
|
-
);
|
|
306
|
-
}
|
|
307
|
-
return deserializedHash;
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
/**
|
|
311
|
-
* Returns URL query string as server auth code response object.
|
|
312
|
-
*/
|
|
313
|
-
static getDeserializedQueryString(
|
|
314
|
-
query: string
|
|
315
|
-
): ServerAuthorizationCodeResponse {
|
|
316
|
-
// Check if given query is empty
|
|
317
|
-
if (!query) {
|
|
318
|
-
return {};
|
|
319
|
-
}
|
|
320
|
-
// Strip the ? symbol if present
|
|
321
|
-
const parsedQueryString = UrlString.parseQueryString(query);
|
|
322
|
-
// If ? symbol was not present, above will return empty string, so give original query value
|
|
323
|
-
const deserializedQueryString: ServerAuthorizationCodeResponse =
|
|
324
|
-
StringUtils.queryStringToObject<ServerAuthorizationCodeResponse>(
|
|
325
|
-
parsedQueryString || query
|
|
326
|
-
);
|
|
327
|
-
// Check if deserialization didn't work
|
|
328
|
-
if (!deserializedQueryString) {
|
|
329
|
-
throw createClientAuthError(
|
|
330
|
-
ClientAuthErrorCodes.hashNotDeserialized
|
|
331
|
-
);
|
|
332
|
-
}
|
|
333
|
-
return deserializedQueryString;
|
|
334
|
-
}
|
|
335
|
-
/**
|
|
336
|
-
* Returns either deserialized query string or deserialized hash, depending on the serverResponseType
|
|
337
|
-
* as a server auth code response object.
|
|
338
|
-
*/
|
|
339
|
-
static getDeserializedCodeResponse(
|
|
340
|
-
serverResponseType: ServerResponseType | undefined,
|
|
341
|
-
hashFragment: string
|
|
342
|
-
): ServerAuthorizationCodeResponse {
|
|
343
|
-
const hashUrlString = new UrlString(hashFragment);
|
|
344
|
-
let serverParams: ServerAuthorizationCodeResponse;
|
|
345
|
-
if (serverResponseType === ServerResponseType.QUERY) {
|
|
346
|
-
serverParams = UrlString.getDeserializedQueryString(hashFragment);
|
|
347
|
-
} else {
|
|
348
|
-
serverParams = UrlString.getDeserializedHash(
|
|
349
|
-
hashUrlString.getHash()
|
|
350
|
-
);
|
|
351
|
-
}
|
|
352
|
-
return serverParams;
|
|
353
|
-
}
|
|
354
|
-
|
|
355
219
|
/**
|
|
356
220
|
* Check if the hash of the URL string contains known properties
|
|
221
|
+
* @deprecated This API will be removed in a future version
|
|
357
222
|
*/
|
|
358
|
-
static hashContainsKnownProperties(
|
|
359
|
-
|
|
360
|
-
// Hash doesn't contain key/value pairs
|
|
361
|
-
return false;
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
const parameters: ServerAuthorizationCodeResponse =
|
|
365
|
-
UrlString.getDeserializedHash(hash);
|
|
366
|
-
return !!(
|
|
367
|
-
parameters.code ||
|
|
368
|
-
parameters.error_description ||
|
|
369
|
-
parameters.error ||
|
|
370
|
-
parameters.state
|
|
371
|
-
);
|
|
223
|
+
static hashContainsKnownProperties(response: string): boolean {
|
|
224
|
+
return !!UrlUtils.getDeserializedResponse(response);
|
|
372
225
|
}
|
|
373
226
|
}
|
package/src/utils/Constants.ts
CHANGED
|
@@ -51,7 +51,6 @@ export const Constants = {
|
|
|
51
51
|
IMDS_TIMEOUT: 2000,
|
|
52
52
|
AZURE_REGION_AUTO_DISCOVER_FLAG: "TryAutoDetect",
|
|
53
53
|
REGIONAL_AUTH_PUBLIC_CLOUD_SUFFIX: "login.microsoft.com",
|
|
54
|
-
REGIONAL_AUTH_NON_MSI_QUERY_STRING: "allowestsrnonmsi=true",
|
|
55
54
|
KNOWN_PUBLIC_CLOUDS: [
|
|
56
55
|
"login.microsoftonline.com",
|
|
57
56
|
"login.windows.net",
|
|
@@ -434,11 +433,12 @@ export const CacheOutcome = {
|
|
|
434
433
|
} as const;
|
|
435
434
|
export type CacheOutcome = (typeof CacheOutcome)[keyof typeof CacheOutcome];
|
|
436
435
|
|
|
437
|
-
export const
|
|
436
|
+
export const JsonWebTokenTypes = {
|
|
438
437
|
Jwt: "JWT",
|
|
439
438
|
Jwk: "JWK",
|
|
440
439
|
Pop: "pop",
|
|
441
440
|
} as const;
|
|
442
|
-
export type
|
|
441
|
+
export type JsonWebTokenTypes =
|
|
442
|
+
(typeof JsonWebTokenTypes)[keyof typeof JsonWebTokenTypes];
|
|
443
443
|
|
|
444
444
|
export const ONE_DAY_IN_MS = 86400000;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { ServerAuthorizationCodeResponse } from "../response/ServerAuthorizationCodeResponse";
|
|
7
|
+
import {
|
|
8
|
+
ClientAuthErrorCodes,
|
|
9
|
+
createClientAuthError,
|
|
10
|
+
} from "../error/ClientAuthError";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Parses hash string from given string. Returns empty string if no hash symbol is found.
|
|
14
|
+
* @param hashString
|
|
15
|
+
*/
|
|
16
|
+
export function stripLeadingHashOrQuery(responseString: string): string {
|
|
17
|
+
if (responseString.startsWith("#/")) {
|
|
18
|
+
return responseString.substring(2);
|
|
19
|
+
} else if (
|
|
20
|
+
responseString.startsWith("#") ||
|
|
21
|
+
responseString.startsWith("?")
|
|
22
|
+
) {
|
|
23
|
+
return responseString.substring(1);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return responseString;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Returns URL hash as server auth code response object.
|
|
31
|
+
*/
|
|
32
|
+
export function getDeserializedResponse(
|
|
33
|
+
responseString: string
|
|
34
|
+
): ServerAuthorizationCodeResponse | null {
|
|
35
|
+
// Check if given hash is empty
|
|
36
|
+
if (!responseString || responseString.indexOf("=") < 0) {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
try {
|
|
40
|
+
// Strip the # or ? symbol if present
|
|
41
|
+
const normalizedResponse = stripLeadingHashOrQuery(responseString);
|
|
42
|
+
// If # symbol was not present, above will return empty string, so give original hash value
|
|
43
|
+
const deserializedHash: ServerAuthorizationCodeResponse =
|
|
44
|
+
Object.fromEntries(new URLSearchParams(normalizedResponse));
|
|
45
|
+
|
|
46
|
+
// Check for known response properties
|
|
47
|
+
if (
|
|
48
|
+
deserializedHash.code ||
|
|
49
|
+
deserializedHash.error ||
|
|
50
|
+
deserializedHash.error_description ||
|
|
51
|
+
deserializedHash.state
|
|
52
|
+
) {
|
|
53
|
+
return deserializedHash;
|
|
54
|
+
}
|
|
55
|
+
} catch (e) {
|
|
56
|
+
throw createClientAuthError(ClientAuthErrorCodes.hashNotDeserialized);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/*! @azure/msal-common v14.3.0 2023-10-30 */
|
|
2
|
-
'use strict';
|
|
3
|
-
import { SERVER_TELEM_CONSTANTS } from '../../utils/Constants.mjs';
|
|
4
|
-
|
|
5
|
-
/*
|
|
6
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
7
|
-
* Licensed under the MIT License.
|
|
8
|
-
*/
|
|
9
|
-
class ServerTelemetryEntity {
|
|
10
|
-
constructor() {
|
|
11
|
-
this.failedRequests = [];
|
|
12
|
-
this.errors = [];
|
|
13
|
-
this.cacheHits = 0;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* validates if a given cache entry is "Telemetry", parses <key,value>
|
|
17
|
-
* @param key
|
|
18
|
-
* @param entity
|
|
19
|
-
*/
|
|
20
|
-
static isServerTelemetryEntity(key, entity) {
|
|
21
|
-
const validateKey = key.indexOf(SERVER_TELEM_CONSTANTS.CACHE_KEY) === 0;
|
|
22
|
-
let validateEntity = true;
|
|
23
|
-
if (entity) {
|
|
24
|
-
validateEntity =
|
|
25
|
-
entity.hasOwnProperty("failedRequests") &&
|
|
26
|
-
entity.hasOwnProperty("errors") &&
|
|
27
|
-
entity.hasOwnProperty("cacheHits");
|
|
28
|
-
}
|
|
29
|
-
return validateKey && validateEntity;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export { ServerTelemetryEntity };
|
|
34
|
-
//# sourceMappingURL=ServerTelemetryEntity.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ServerTelemetryEntity.mjs","sources":["../../../src/cache/entities/ServerTelemetryEntity.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAOA;AACI;;;AAUA,MAAA,qBAAA,CAAA;;;;AAIG,QAAA,IAAA,CAAA,SAAA,GAAA,CAAA,CAAA;AACH,KAAA;AAcH;;;;;;;;;;;;;;;;;;;;"}
|