@xh/hoist 73.0.0-SNAPSHOT.1744281639439 → 73.0.0-SNAPSHOT.1744315607129
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/build/types/security/Types.d.ts +10 -3
- package/package.json +1 -1
- package/security/Types.ts +10 -3
- package/security/msal/MsalClient.ts +23 -8
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -14,7 +14,14 @@ export interface AccessTokenSpec {
|
|
|
14
14
|
export type TokenMap = Record<string, Token>;
|
|
15
15
|
/** Aggregated telemetry results, produced by {@link MsalClient} when enabled via config. */
|
|
16
16
|
export interface TelemetryResults {
|
|
17
|
-
/** Stats
|
|
17
|
+
/** Stats across all events */
|
|
18
|
+
summary: {
|
|
19
|
+
successCount: number;
|
|
20
|
+
failureCount: number;
|
|
21
|
+
maxDuration: number;
|
|
22
|
+
lastFailureTime: number;
|
|
23
|
+
};
|
|
24
|
+
/** Stats by event type */
|
|
18
25
|
events: Record<string, TelemetryEventResults>;
|
|
19
26
|
}
|
|
20
27
|
/** Aggregated telemetry results for a single type of event. */
|
|
@@ -24,11 +31,11 @@ export interface TelemetryEventResults {
|
|
|
24
31
|
successCount: number;
|
|
25
32
|
failureCount: number;
|
|
26
33
|
/** Timing info (in ms) for event instances reported with duration. */
|
|
27
|
-
duration
|
|
34
|
+
duration?: {
|
|
28
35
|
count: number;
|
|
29
36
|
total: number;
|
|
30
37
|
average: number;
|
|
31
|
-
|
|
38
|
+
max: number;
|
|
32
39
|
};
|
|
33
40
|
lastFailure?: {
|
|
34
41
|
time: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xh/hoist",
|
|
3
|
-
"version": "73.0.0-SNAPSHOT.
|
|
3
|
+
"version": "73.0.0-SNAPSHOT.1744315607129",
|
|
4
4
|
"description": "Hoist add-on for building and deploying React Applications.",
|
|
5
5
|
"repository": "github:xh/hoist-react",
|
|
6
6
|
"homepage": "https://xh.io",
|
package/security/Types.ts
CHANGED
|
@@ -25,7 +25,14 @@ export type TokenMap = Record<string, Token>;
|
|
|
25
25
|
|
|
26
26
|
/** Aggregated telemetry results, produced by {@link MsalClient} when enabled via config. */
|
|
27
27
|
export interface TelemetryResults {
|
|
28
|
-
/** Stats
|
|
28
|
+
/** Stats across all events */
|
|
29
|
+
summary: {
|
|
30
|
+
successCount: number;
|
|
31
|
+
failureCount: number;
|
|
32
|
+
maxDuration: number;
|
|
33
|
+
lastFailureTime: number;
|
|
34
|
+
};
|
|
35
|
+
/** Stats by event type */
|
|
29
36
|
events: Record<string, TelemetryEventResults>;
|
|
30
37
|
}
|
|
31
38
|
|
|
@@ -36,11 +43,11 @@ export interface TelemetryEventResults {
|
|
|
36
43
|
successCount: number;
|
|
37
44
|
failureCount: number;
|
|
38
45
|
/** Timing info (in ms) for event instances reported with duration. */
|
|
39
|
-
duration
|
|
46
|
+
duration?: {
|
|
40
47
|
count: number;
|
|
41
48
|
total: number;
|
|
42
49
|
average: number;
|
|
43
|
-
|
|
50
|
+
max: number;
|
|
44
51
|
};
|
|
45
52
|
lastFailure?: {
|
|
46
53
|
time: number;
|
|
@@ -115,7 +115,7 @@ export class MsalClient extends BaseOAuthClient<MsalClientConfig, MsalTokenSpec>
|
|
|
115
115
|
private initialTokenLoad: boolean;
|
|
116
116
|
|
|
117
117
|
/** Enable telemetry via `enableTelemetry` ctor config, or via {@link enableTelemetry}. */
|
|
118
|
-
telemetryResults: TelemetryResults =
|
|
118
|
+
telemetryResults: TelemetryResults = null;
|
|
119
119
|
private _telemetryCbHandle: string = null;
|
|
120
120
|
|
|
121
121
|
constructor(config: MsalClientConfig) {
|
|
@@ -277,12 +277,20 @@ export class MsalClient extends BaseOAuthClient<MsalClientConfig, MsalTokenSpec>
|
|
|
277
277
|
return;
|
|
278
278
|
}
|
|
279
279
|
|
|
280
|
-
this.telemetryResults = {
|
|
280
|
+
this.telemetryResults = {
|
|
281
|
+
summary: {
|
|
282
|
+
successCount: 0,
|
|
283
|
+
failureCount: 0,
|
|
284
|
+
maxDuration: 0,
|
|
285
|
+
lastFailureTime: null
|
|
286
|
+
},
|
|
287
|
+
events: {}
|
|
288
|
+
};
|
|
281
289
|
|
|
282
290
|
this._telemetryCbHandle = this.client.addPerformanceCallback(events => {
|
|
283
291
|
events.forEach(e => {
|
|
284
292
|
try {
|
|
285
|
-
const {events} = this.telemetryResults,
|
|
293
|
+
const {summary, events} = this.telemetryResults,
|
|
286
294
|
{name, startTimeMs, durationMs, success, errorName, errorCode} = e,
|
|
287
295
|
eTime = startTimeMs ?? Date.now();
|
|
288
296
|
|
|
@@ -290,15 +298,16 @@ export class MsalClient extends BaseOAuthClient<MsalClientConfig, MsalTokenSpec>
|
|
|
290
298
|
firstTime: eTime,
|
|
291
299
|
lastTime: eTime,
|
|
292
300
|
successCount: 0,
|
|
293
|
-
failureCount: 0
|
|
294
|
-
duration: {count: 0, total: 0, average: 0, worst: 0},
|
|
295
|
-
lastFailure: null
|
|
301
|
+
failureCount: 0
|
|
296
302
|
});
|
|
297
303
|
eResult.lastTime = eTime;
|
|
298
304
|
|
|
299
305
|
if (success) {
|
|
306
|
+
summary.successCount++;
|
|
300
307
|
eResult.successCount++;
|
|
301
308
|
} else {
|
|
309
|
+
summary.failureCount++;
|
|
310
|
+
summary.lastFailureTime = eTime;
|
|
302
311
|
eResult.failureCount++;
|
|
303
312
|
eResult.lastFailure = {
|
|
304
313
|
time: eTime,
|
|
@@ -309,11 +318,17 @@ export class MsalClient extends BaseOAuthClient<MsalClientConfig, MsalTokenSpec>
|
|
|
309
318
|
}
|
|
310
319
|
|
|
311
320
|
if (durationMs) {
|
|
312
|
-
const
|
|
321
|
+
const duration = (eResult.duration ??= {
|
|
322
|
+
count: 0,
|
|
323
|
+
total: 0,
|
|
324
|
+
average: 0,
|
|
325
|
+
max: 0
|
|
326
|
+
});
|
|
313
327
|
duration.count++;
|
|
314
328
|
duration.total += durationMs;
|
|
315
329
|
duration.average = Math.round(duration.total / duration.count);
|
|
316
|
-
duration.
|
|
330
|
+
duration.max = Math.max(duration.max, durationMs);
|
|
331
|
+
summary.maxDuration = Math.max(summary.maxDuration, durationMs);
|
|
317
332
|
}
|
|
318
333
|
} catch (e) {
|
|
319
334
|
this.logError(`Error processing telemetry event`, e);
|