@fluidframework/telemetry-utils 2.0.0-dev.7.4.0.215747 → 2.0.0-dev.7.4.0.216897
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/api-extractor-lint.json +13 -0
- package/api-extractor.json +0 -4
- package/api-report/telemetry-utils.api.md +57 -54
- package/dist/config.d.ts +44 -3
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +30 -0
- package/dist/config.js.map +1 -1
- package/dist/error.d.ts +2 -0
- package/dist/error.d.ts.map +1 -1
- package/dist/error.js +2 -0
- package/dist/error.js.map +1 -1
- package/dist/errorLogging.d.ts +7 -2
- package/dist/errorLogging.d.ts.map +1 -1
- package/dist/errorLogging.js +7 -2
- package/dist/errorLogging.js.map +1 -1
- package/dist/eventEmitterWithErrorHandling.d.ts +8 -0
- package/dist/eventEmitterWithErrorHandling.d.ts.map +1 -1
- package/dist/eventEmitterWithErrorHandling.js +8 -0
- package/dist/eventEmitterWithErrorHandling.js.map +1 -1
- package/dist/events.d.ts +15 -0
- package/dist/events.d.ts.map +1 -1
- package/dist/events.js +16 -0
- package/dist/events.js.map +1 -1
- package/dist/fluidErrorBase.d.ts +8 -0
- package/dist/fluidErrorBase.d.ts.map +1 -1
- package/dist/fluidErrorBase.js +6 -0
- package/dist/fluidErrorBase.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/logger.d.ts +117 -17
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js +82 -12
- package/dist/logger.js.map +1 -1
- package/dist/mockLogger.d.ts +2 -0
- package/dist/mockLogger.d.ts.map +1 -1
- package/dist/mockLogger.js +2 -0
- package/dist/mockLogger.js.map +1 -1
- package/dist/sampledTelemetryHelper.d.ts +7 -3
- package/dist/sampledTelemetryHelper.d.ts.map +1 -1
- package/dist/sampledTelemetryHelper.js +7 -3
- package/dist/sampledTelemetryHelper.js.map +1 -1
- package/dist/telemetry-utils-alpha.d.ts +121 -610
- package/dist/telemetry-utils-beta.d.ts +121 -610
- package/dist/telemetry-utils-public.d.ts +121 -610
- package/dist/telemetry-utils-untrimmed.d.ts +242 -38
- package/dist/telemetryTypes.d.ts +32 -8
- package/dist/telemetryTypes.d.ts.map +1 -1
- package/dist/telemetryTypes.js.map +1 -1
- package/dist/thresholdCounter.d.ts +3 -2
- package/dist/thresholdCounter.d.ts.map +1 -1
- package/dist/thresholdCounter.js +3 -2
- package/dist/thresholdCounter.js.map +1 -1
- package/dist/utils.d.ts +6 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +6 -0
- package/dist/utils.js.map +1 -1
- package/lib/config.d.ts +44 -3
- package/lib/config.d.ts.map +1 -1
- package/lib/config.js +30 -0
- package/lib/config.js.map +1 -1
- package/lib/error.d.ts +2 -0
- package/lib/error.d.ts.map +1 -1
- package/lib/error.js +2 -0
- package/lib/error.js.map +1 -1
- package/lib/errorLogging.d.ts +7 -2
- package/lib/errorLogging.d.ts.map +1 -1
- package/lib/errorLogging.js +7 -2
- package/lib/errorLogging.js.map +1 -1
- package/lib/eventEmitterWithErrorHandling.d.ts +8 -0
- package/lib/eventEmitterWithErrorHandling.d.ts.map +1 -1
- package/lib/eventEmitterWithErrorHandling.js +8 -0
- package/lib/eventEmitterWithErrorHandling.js.map +1 -1
- package/lib/events.d.ts +15 -0
- package/lib/events.d.ts.map +1 -1
- package/lib/events.js +16 -0
- package/lib/events.js.map +1 -1
- package/lib/fluidErrorBase.d.ts +8 -0
- package/lib/fluidErrorBase.d.ts.map +1 -1
- package/lib/fluidErrorBase.js +6 -0
- package/lib/fluidErrorBase.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/logger.d.ts +117 -17
- package/lib/logger.d.ts.map +1 -1
- package/lib/logger.js +82 -12
- package/lib/logger.js.map +1 -1
- package/lib/mockLogger.d.ts +2 -0
- package/lib/mockLogger.d.ts.map +1 -1
- package/lib/mockLogger.js +2 -0
- package/lib/mockLogger.js.map +1 -1
- package/lib/sampledTelemetryHelper.d.ts +7 -3
- package/lib/sampledTelemetryHelper.d.ts.map +1 -1
- package/lib/sampledTelemetryHelper.js +7 -3
- package/lib/sampledTelemetryHelper.js.map +1 -1
- package/lib/telemetry-utils-alpha.d.ts +121 -610
- package/lib/telemetry-utils-beta.d.ts +121 -610
- package/lib/telemetry-utils-public.d.ts +121 -610
- package/lib/telemetry-utils-untrimmed.d.ts +242 -38
- package/lib/telemetryTypes.d.ts +32 -8
- package/lib/telemetryTypes.d.ts.map +1 -1
- package/lib/telemetryTypes.js.map +1 -1
- package/lib/thresholdCounter.d.ts +3 -2
- package/lib/thresholdCounter.d.ts.map +1 -1
- package/lib/thresholdCounter.js +3 -2
- package/lib/thresholdCounter.js.map +1 -1
- package/lib/utils.d.ts +6 -0
- package/lib/utils.d.ts.map +1 -1
- package/lib/utils.js +6 -0
- package/lib/utils.js.map +1 -1
- package/package.json +7 -6
- package/src/config.ts +44 -3
- package/src/error.ts +2 -0
- package/src/errorLogging.ts +7 -2
- package/src/eventEmitterWithErrorHandling.ts +8 -0
- package/src/events.ts +18 -0
- package/src/fluidErrorBase.ts +8 -0
- package/src/index.ts +1 -0
- package/src/logger.ts +125 -17
- package/src/mockLogger.ts +2 -0
- package/src/sampledTelemetryHelper.ts +7 -3
- package/src/telemetryTypes.ts +32 -8
- package/src/thresholdCounter.ts +3 -2
- package/src/utils.ts +6 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
|
3
|
+
"extends": "../../../common/build/build-common/api-extractor-lint.json",
|
|
4
|
+
"messages": {
|
|
5
|
+
"extractorMessageReporting": {
|
|
6
|
+
// TODO: remove once base config has this enabled as an error
|
|
7
|
+
"ae-incompatible-release-tags": {
|
|
8
|
+
"logLevel": "error",
|
|
9
|
+
"addToApiReportFile": false
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
package/api-extractor.json
CHANGED
|
@@ -3,10 +3,6 @@
|
|
|
3
3
|
"extends": "../../../common/build/build-common/api-extractor-base.json",
|
|
4
4
|
"messages": {
|
|
5
5
|
"extractorMessageReporting": {
|
|
6
|
-
// TODO: Fix violations and remove this rule override
|
|
7
|
-
"ae-missing-release-tag": {
|
|
8
|
-
"logLevel": "none"
|
|
9
|
-
},
|
|
10
6
|
// TODO: Add missing documentation and remove this rule override
|
|
11
7
|
"ae-undocumented": {
|
|
12
8
|
"logLevel": "none"
|
|
@@ -29,29 +29,24 @@ import { TelemetryBaseEventPropertyType } from '@fluidframework/core-interfaces'
|
|
|
29
29
|
import { TelemetryEventPropertyType } from '@fluidframework/core-interfaces';
|
|
30
30
|
import { TypedEventEmitter } from '@fluid-internal/client-utils';
|
|
31
31
|
|
|
32
|
-
// @
|
|
32
|
+
// @internal
|
|
33
33
|
export type ConfigTypes = string | number | boolean | number[] | string[] | boolean[] | undefined;
|
|
34
34
|
|
|
35
|
-
// @
|
|
35
|
+
// @internal (undocumented)
|
|
36
36
|
export const connectedEventName = "connected";
|
|
37
37
|
|
|
38
|
-
// @
|
|
38
|
+
// @internal
|
|
39
39
|
export function createChildLogger(props?: {
|
|
40
40
|
logger?: ITelemetryBaseLogger;
|
|
41
41
|
namespace?: string;
|
|
42
42
|
properties?: ITelemetryLoggerPropertyBags;
|
|
43
43
|
}): ITelemetryLoggerExt;
|
|
44
44
|
|
|
45
|
-
// @
|
|
45
|
+
// @internal
|
|
46
46
|
export function createChildMonitoringContext(props: Parameters<typeof createChildLogger>[0]): MonitoringContext;
|
|
47
47
|
|
|
48
|
-
// @
|
|
49
|
-
export function createMultiSinkLogger(props:
|
|
50
|
-
namespace?: string;
|
|
51
|
-
properties?: ITelemetryLoggerPropertyBags;
|
|
52
|
-
loggers?: (ITelemetryBaseLogger | undefined)[];
|
|
53
|
-
tryInheritProperties?: true;
|
|
54
|
-
}): ITelemetryLoggerExt;
|
|
48
|
+
// @internal
|
|
49
|
+
export function createMultiSinkLogger(props: MultiSinkLoggerProperties): ITelemetryLoggerExt;
|
|
55
50
|
|
|
56
51
|
// @internal
|
|
57
52
|
export function createSampledLogger(logger: ITelemetryLoggerExt, eventSampler?: IEventSampler): ISampledTelemetryLogger;
|
|
@@ -74,17 +69,17 @@ export class DataProcessingError extends LoggingError implements IErrorBase, IFl
|
|
|
74
69
|
static wrapIfUnrecognized(originalError: unknown, dataProcessingCodepath: string, messageLike?: Partial<Pick<ISequencedDocumentMessage, "clientId" | "sequenceNumber" | "clientSequenceNumber" | "referenceSequenceNumber" | "minimumSequenceNumber" | "timestamp">>): IFluidErrorBase;
|
|
75
70
|
}
|
|
76
71
|
|
|
77
|
-
// @
|
|
72
|
+
// @internal (undocumented)
|
|
78
73
|
export const disconnectedEventName = "disconnected";
|
|
79
74
|
|
|
80
|
-
// @
|
|
75
|
+
// @internal
|
|
81
76
|
export class EventEmitterWithErrorHandling<TEvent extends IEvent = IEvent> extends TypedEventEmitter<TEvent> {
|
|
82
77
|
constructor(errorHandler: (eventName: EventEmitterEventType, error: any) => void);
|
|
83
78
|
// (undocumented)
|
|
84
79
|
emit(event: EventEmitterEventType, ...args: unknown[]): boolean;
|
|
85
80
|
}
|
|
86
81
|
|
|
87
|
-
// @
|
|
82
|
+
// @internal
|
|
88
83
|
export const eventNamespaceSeparator: ":";
|
|
89
84
|
|
|
90
85
|
// @internal
|
|
@@ -94,7 +89,7 @@ export function extractLogSafeErrorProperties(error: unknown, sanitizeStack: boo
|
|
|
94
89
|
stack?: string | undefined;
|
|
95
90
|
};
|
|
96
91
|
|
|
97
|
-
// @
|
|
92
|
+
// @internal
|
|
98
93
|
export const extractSafePropertiesFromMessage: (messageLike: Partial<Pick<ISequencedDocumentMessage, "clientId" | "sequenceNumber" | "clientSequenceNumber" | "referenceSequenceNumber" | "minimumSequenceNumber" | "timestamp">>) => {
|
|
99
94
|
messageClientId: string | undefined;
|
|
100
95
|
messageSequenceNumber: number | undefined;
|
|
@@ -104,7 +99,7 @@ export const extractSafePropertiesFromMessage: (messageLike: Partial<Pick<ISeque
|
|
|
104
99
|
messageTimestamp: number | undefined;
|
|
105
100
|
};
|
|
106
101
|
|
|
107
|
-
// @
|
|
102
|
+
// @internal (undocumented)
|
|
108
103
|
export function formatTick(tick: number): number;
|
|
109
104
|
|
|
110
105
|
// @internal
|
|
@@ -125,12 +120,12 @@ export class GenericError extends LoggingError implements IGenericError, IFluidE
|
|
|
125
120
|
// @internal
|
|
126
121
|
export const getCircularReplacer: () => (key: string, value: unknown) => any;
|
|
127
122
|
|
|
128
|
-
// @
|
|
123
|
+
// @internal
|
|
129
124
|
export const hasErrorInstanceId: (x: unknown) => x is {
|
|
130
125
|
errorInstanceId: string;
|
|
131
126
|
};
|
|
132
127
|
|
|
133
|
-
// @
|
|
128
|
+
// @internal
|
|
134
129
|
export interface IConfigProvider extends IConfigProviderBase {
|
|
135
130
|
// (undocumented)
|
|
136
131
|
getBoolean(name: string): boolean | undefined;
|
|
@@ -146,7 +141,7 @@ export interface IConfigProvider extends IConfigProviderBase {
|
|
|
146
141
|
getStringArray(name: string): string[] | undefined;
|
|
147
142
|
}
|
|
148
143
|
|
|
149
|
-
// @
|
|
144
|
+
// @internal
|
|
150
145
|
export interface IConfigProviderBase {
|
|
151
146
|
// (undocumented)
|
|
152
147
|
getRawConfig(name: string): ConfigTypes;
|
|
@@ -163,7 +158,7 @@ export interface IFluidErrorAnnotations {
|
|
|
163
158
|
props?: ITelemetryBaseProperties;
|
|
164
159
|
}
|
|
165
160
|
|
|
166
|
-
// @
|
|
161
|
+
// @internal
|
|
167
162
|
export interface IFluidErrorBase extends Error {
|
|
168
163
|
addTelemetryProperties: (props: ITelemetryProperties) => void;
|
|
169
164
|
readonly errorInstanceId: string;
|
|
@@ -174,7 +169,7 @@ export interface IFluidErrorBase extends Error {
|
|
|
174
169
|
readonly stack?: string;
|
|
175
170
|
}
|
|
176
171
|
|
|
177
|
-
// @
|
|
172
|
+
// @internal
|
|
178
173
|
export interface IPerformanceEventMarkers {
|
|
179
174
|
// (undocumented)
|
|
180
175
|
cancel?: "generic" | "error";
|
|
@@ -192,19 +187,19 @@ export interface ISampledTelemetryLogger extends ITelemetryLoggerExt {
|
|
|
192
187
|
// @internal
|
|
193
188
|
export function isExternalError(error: unknown): boolean;
|
|
194
189
|
|
|
195
|
-
// @
|
|
190
|
+
// @internal
|
|
196
191
|
export function isFluidError(error: unknown): error is IFluidErrorBase;
|
|
197
192
|
|
|
198
|
-
// @
|
|
193
|
+
// @internal
|
|
199
194
|
export const isILoggingError: (x: unknown) => x is ILoggingError;
|
|
200
195
|
|
|
201
|
-
// @
|
|
196
|
+
// @internal
|
|
202
197
|
export function isTaggedTelemetryPropertyValue(x: Tagged<TelemetryEventPropertyTypeExt> | TelemetryEventPropertyTypeExt): x is Tagged<TelemetryEventPropertyTypeExt>;
|
|
203
198
|
|
|
204
|
-
// @
|
|
199
|
+
// @internal
|
|
205
200
|
export function isValidLegacyError(error: unknown): error is Omit<IFluidErrorBase, "errorInstanceId">;
|
|
206
201
|
|
|
207
|
-
// @
|
|
202
|
+
// @internal @deprecated
|
|
208
203
|
export interface ITaggedTelemetryPropertyTypeExt {
|
|
209
204
|
// (undocumented)
|
|
210
205
|
tag: string;
|
|
@@ -212,13 +207,13 @@ export interface ITaggedTelemetryPropertyTypeExt {
|
|
|
212
207
|
value: TelemetryEventPropertyTypeExt;
|
|
213
208
|
}
|
|
214
209
|
|
|
215
|
-
// @
|
|
210
|
+
// @internal
|
|
216
211
|
export interface ITelemetryErrorEventExt extends ITelemetryPropertiesExt {
|
|
217
212
|
// (undocumented)
|
|
218
213
|
eventName: string;
|
|
219
214
|
}
|
|
220
215
|
|
|
221
|
-
// @
|
|
216
|
+
// @internal
|
|
222
217
|
export interface ITelemetryEventExt extends ITelemetryPropertiesExt {
|
|
223
218
|
// (undocumented)
|
|
224
219
|
category: string;
|
|
@@ -226,7 +221,7 @@ export interface ITelemetryEventExt extends ITelemetryPropertiesExt {
|
|
|
226
221
|
eventName: string;
|
|
227
222
|
}
|
|
228
223
|
|
|
229
|
-
// @
|
|
224
|
+
// @internal
|
|
230
225
|
export interface ITelemetryGenericEventExt extends ITelemetryPropertiesExt {
|
|
231
226
|
// (undocumented)
|
|
232
227
|
category?: TelemetryEventCategory;
|
|
@@ -234,20 +229,20 @@ export interface ITelemetryGenericEventExt extends ITelemetryPropertiesExt {
|
|
|
234
229
|
eventName: string;
|
|
235
230
|
}
|
|
236
231
|
|
|
237
|
-
// @
|
|
232
|
+
// @internal
|
|
238
233
|
export interface ITelemetryLoggerExt extends ITelemetryBaseLogger {
|
|
239
234
|
sendErrorEvent(event: ITelemetryErrorEventExt, error?: unknown): void;
|
|
240
235
|
sendPerformanceEvent(event: ITelemetryPerformanceEventExt, error?: unknown, logLevel?: typeof LogLevel.verbose | typeof LogLevel.default): void;
|
|
241
236
|
sendTelemetryEvent(event: ITelemetryGenericEventExt, error?: unknown, logLevel?: typeof LogLevel.verbose | typeof LogLevel.default): void;
|
|
242
237
|
}
|
|
243
238
|
|
|
244
|
-
// @
|
|
239
|
+
// @internal (undocumented)
|
|
245
240
|
export interface ITelemetryLoggerPropertyBag {
|
|
246
241
|
// (undocumented)
|
|
247
242
|
[index: string]: TelemetryEventPropertyTypes | (() => TelemetryEventPropertyTypes);
|
|
248
243
|
}
|
|
249
244
|
|
|
250
|
-
// @
|
|
245
|
+
// @internal (undocumented)
|
|
251
246
|
export interface ITelemetryLoggerPropertyBags {
|
|
252
247
|
// (undocumented)
|
|
253
248
|
all?: ITelemetryLoggerPropertyBag;
|
|
@@ -255,19 +250,19 @@ export interface ITelemetryLoggerPropertyBags {
|
|
|
255
250
|
error?: ITelemetryLoggerPropertyBag;
|
|
256
251
|
}
|
|
257
252
|
|
|
258
|
-
// @
|
|
253
|
+
// @internal
|
|
259
254
|
export interface ITelemetryPerformanceEventExt extends ITelemetryGenericEventExt {
|
|
260
255
|
// (undocumented)
|
|
261
256
|
duration?: number;
|
|
262
257
|
}
|
|
263
258
|
|
|
264
|
-
// @
|
|
259
|
+
// @internal
|
|
265
260
|
export interface ITelemetryPropertiesExt {
|
|
266
261
|
// (undocumented)
|
|
267
262
|
[index: string]: TelemetryEventPropertyTypeExt | Tagged<TelemetryEventPropertyTypeExt>;
|
|
268
263
|
}
|
|
269
264
|
|
|
270
|
-
// @
|
|
265
|
+
// @internal
|
|
271
266
|
export function loggerToMonitoringContext<L extends ITelemetryBaseLogger = ITelemetryLoggerExt>(logger: L): MonitoringContext<L>;
|
|
272
267
|
|
|
273
268
|
// @internal
|
|
@@ -282,13 +277,13 @@ export class LoggingError extends Error implements ILoggingError, Omit<IFluidErr
|
|
|
282
277
|
static typeCheck(object: unknown): object is LoggingError;
|
|
283
278
|
}
|
|
284
279
|
|
|
285
|
-
// @
|
|
280
|
+
// @internal @deprecated
|
|
286
281
|
export function logIfFalse(condition: unknown, logger: ITelemetryBaseLogger, event: string | ITelemetryGenericEvent): condition is true;
|
|
287
282
|
|
|
288
|
-
// @
|
|
283
|
+
// @internal
|
|
289
284
|
export function mixinMonitoringContext<L extends ITelemetryBaseLogger = ITelemetryLoggerExt>(logger: L, ...configs: (IConfigProviderBase | undefined)[]): MonitoringContext<L>;
|
|
290
285
|
|
|
291
|
-
// @
|
|
286
|
+
// @internal
|
|
292
287
|
export class MockLogger implements ITelemetryBaseLogger {
|
|
293
288
|
constructor(minLogLevel?: LogLevel | undefined);
|
|
294
289
|
assertMatch(expectedEvents: Omit<ITelemetryBaseEvent, "category">[], message?: string, inlineDetailsProp?: boolean): void;
|
|
@@ -310,7 +305,7 @@ export class MockLogger implements ITelemetryBaseLogger {
|
|
|
310
305
|
toTelemetryLogger(): ITelemetryLoggerExt;
|
|
311
306
|
}
|
|
312
307
|
|
|
313
|
-
// @
|
|
308
|
+
// @internal
|
|
314
309
|
export interface MonitoringContext<L extends ITelemetryBaseLogger = ITelemetryLoggerExt> {
|
|
315
310
|
// (undocumented)
|
|
316
311
|
config: IConfigProvider;
|
|
@@ -318,19 +313,27 @@ export interface MonitoringContext<L extends ITelemetryBaseLogger = ITelemetryLo
|
|
|
318
313
|
logger: L;
|
|
319
314
|
}
|
|
320
315
|
|
|
316
|
+
// @internal
|
|
317
|
+
export interface MultiSinkLoggerProperties {
|
|
318
|
+
loggers?: (ITelemetryBaseLogger | undefined)[];
|
|
319
|
+
namespace?: string;
|
|
320
|
+
properties?: ITelemetryLoggerPropertyBags;
|
|
321
|
+
tryInheritProperties?: true;
|
|
322
|
+
}
|
|
323
|
+
|
|
321
324
|
// @internal
|
|
322
325
|
export const NORMALIZED_ERROR_TYPE = "genericError";
|
|
323
326
|
|
|
324
327
|
// @internal
|
|
325
328
|
export function normalizeError(error: unknown, annotations?: IFluidErrorAnnotations): IFluidErrorBase;
|
|
326
329
|
|
|
327
|
-
// @
|
|
330
|
+
// @internal
|
|
328
331
|
export function numberFromString(str: string | null | undefined): string | number | undefined;
|
|
329
332
|
|
|
330
333
|
// @internal
|
|
331
334
|
export function overwriteStack(error: IFluidErrorBase | LoggingError, stack: string): void;
|
|
332
335
|
|
|
333
|
-
// @
|
|
336
|
+
// @internal
|
|
334
337
|
export class PerformanceEvent {
|
|
335
338
|
protected constructor(logger: ITelemetryLoggerExt, event: ITelemetryGenericEvent, markers?: IPerformanceEventMarkers, recordHeapSize?: boolean, emitLogs?: boolean);
|
|
336
339
|
// (undocumented)
|
|
@@ -347,13 +350,13 @@ export class PerformanceEvent {
|
|
|
347
350
|
static timedExecAsync<T>(logger: ITelemetryLoggerExt, event: ITelemetryGenericEvent, callback: (event: PerformanceEvent) => Promise<T>, markers?: IPerformanceEventMarkers, recordHeapSize?: boolean, sampleThreshold?: number): Promise<T>;
|
|
348
351
|
}
|
|
349
352
|
|
|
350
|
-
// @
|
|
353
|
+
// @internal
|
|
351
354
|
export function raiseConnectedEvent(logger: ITelemetryLoggerExt, emitter: EventEmitter, connected: boolean, clientId?: string, disconnectedReason?: string): void;
|
|
352
355
|
|
|
353
|
-
// @
|
|
356
|
+
// @internal (undocumented)
|
|
354
357
|
export function safeRaiseEvent(emitter: EventEmitter, logger: ITelemetryLoggerExt, event: string, ...args: unknown[]): void;
|
|
355
358
|
|
|
356
|
-
// @
|
|
359
|
+
// @internal
|
|
357
360
|
export class SampledTelemetryHelper implements IDisposable {
|
|
358
361
|
constructor(eventBase: ITelemetryGenericEvent, logger: ITelemetryLoggerExt, sampleThreshold: number, includeAggregateMetrics?: boolean, perBucketProperties?: Map<string, ITelemetryProperties>);
|
|
359
362
|
// (undocumented)
|
|
@@ -363,10 +366,10 @@ export class SampledTelemetryHelper implements IDisposable {
|
|
|
363
366
|
measure<T>(codeToMeasure: () => T, bucket?: string): T;
|
|
364
367
|
}
|
|
365
368
|
|
|
366
|
-
// @
|
|
369
|
+
// @internal
|
|
367
370
|
export const sessionStorageConfigProvider: Lazy<IConfigProviderBase>;
|
|
368
371
|
|
|
369
|
-
// @
|
|
372
|
+
// @internal
|
|
370
373
|
export const tagCodeArtifacts: <T extends Record<string, TelemetryEventPropertyType | (() => TelemetryBaseEventPropertyType)>>(values: T) => { [P in keyof T]: (T[P] extends () => TelemetryBaseEventPropertyType ? () => {
|
|
371
374
|
value: ReturnType<T[P]>;
|
|
372
375
|
tag: TelemetryDataTag.CodeArtifact;
|
|
@@ -375,7 +378,7 @@ export const tagCodeArtifacts: <T extends Record<string, TelemetryEventPropertyT
|
|
|
375
378
|
tag: TelemetryDataTag.CodeArtifact;
|
|
376
379
|
}) | (T[P] extends undefined ? undefined : never); };
|
|
377
380
|
|
|
378
|
-
// @
|
|
381
|
+
// @internal
|
|
379
382
|
export const tagData: <T extends TelemetryDataTag, V extends Record<string, TelemetryEventPropertyType | (() => TelemetryBaseEventPropertyType)>>(tag: T, values: V) => { [P in keyof V]: (V[P] extends () => TelemetryBaseEventPropertyType ? () => {
|
|
380
383
|
value: ReturnType<V[P]>;
|
|
381
384
|
tag: T;
|
|
@@ -384,32 +387,32 @@ export const tagData: <T extends TelemetryDataTag, V extends Record<string, Tele
|
|
|
384
387
|
tag: T;
|
|
385
388
|
}) | (V[P] extends undefined ? undefined : never); };
|
|
386
389
|
|
|
387
|
-
// @
|
|
390
|
+
// @internal @deprecated (undocumented)
|
|
388
391
|
export class TaggedLoggerAdapter implements ITelemetryBaseLogger {
|
|
389
392
|
constructor(logger: ITelemetryBaseLogger);
|
|
390
393
|
// (undocumented)
|
|
391
394
|
send(eventWithTagsMaybe: ITelemetryBaseEvent): void;
|
|
392
395
|
}
|
|
393
396
|
|
|
394
|
-
// @
|
|
397
|
+
// @internal
|
|
395
398
|
export enum TelemetryDataTag {
|
|
396
399
|
CodeArtifact = "CodeArtifact",
|
|
397
400
|
UserData = "UserData"
|
|
398
401
|
}
|
|
399
402
|
|
|
400
|
-
// @
|
|
403
|
+
// @internal
|
|
401
404
|
export type TelemetryEventCategory = "generic" | "error" | "performance";
|
|
402
405
|
|
|
403
|
-
// @
|
|
406
|
+
// @internal
|
|
404
407
|
export type TelemetryEventPropertyTypeExt = string | number | boolean | undefined | (string | number | boolean)[] | {
|
|
405
408
|
[key: string]: // Flat objects can have the same properties as the event itself
|
|
406
409
|
string | number | boolean | undefined | (string | number | boolean)[];
|
|
407
410
|
};
|
|
408
411
|
|
|
409
|
-
// @
|
|
412
|
+
// @internal (undocumented)
|
|
410
413
|
export type TelemetryEventPropertyTypes = ITelemetryBaseProperties[string];
|
|
411
414
|
|
|
412
|
-
// @
|
|
415
|
+
// @internal @deprecated
|
|
413
416
|
export class TelemetryNullLogger implements ITelemetryLoggerExt {
|
|
414
417
|
// (undocumented)
|
|
415
418
|
send(event: ITelemetryBaseEvent): void;
|
|
@@ -421,7 +424,7 @@ export class TelemetryNullLogger implements ITelemetryLoggerExt {
|
|
|
421
424
|
sendTelemetryEvent(event: ITelemetryGenericEvent, error?: unknown): void;
|
|
422
425
|
}
|
|
423
426
|
|
|
424
|
-
// @
|
|
427
|
+
// @internal
|
|
425
428
|
export class ThresholdCounter {
|
|
426
429
|
constructor(threshold: number, logger: ITelemetryLoggerExt, thresholdMultiple?: number);
|
|
427
430
|
send(eventName: string, value: number): void;
|
package/dist/config.d.ts
CHANGED
|
@@ -6,15 +6,24 @@ import { ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
|
|
|
6
6
|
import { Lazy } from "@fluidframework/core-utils";
|
|
7
7
|
import { createChildLogger } from "./logger";
|
|
8
8
|
import { ITelemetryLoggerExt } from "./telemetryTypes";
|
|
9
|
+
/**
|
|
10
|
+
* Types supported by {@link IConfigProviderBase}.
|
|
11
|
+
*
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
9
14
|
export type ConfigTypes = string | number | boolean | number[] | string[] | boolean[] | undefined;
|
|
10
15
|
/**
|
|
11
|
-
* Base interface for providing configurations to enable/disable/control features
|
|
16
|
+
* Base interface for providing configurations to enable/disable/control features.
|
|
17
|
+
*
|
|
18
|
+
* @internal
|
|
12
19
|
*/
|
|
13
20
|
export interface IConfigProviderBase {
|
|
14
21
|
getRawConfig(name: string): ConfigTypes;
|
|
15
22
|
}
|
|
16
23
|
/**
|
|
17
|
-
* Explicitly typed interface for reading configurations
|
|
24
|
+
* Explicitly typed interface for reading configurations.
|
|
25
|
+
*
|
|
26
|
+
* @internal
|
|
18
27
|
*/
|
|
19
28
|
export interface IConfigProvider extends IConfigProviderBase {
|
|
20
29
|
getBoolean(name: string): boolean | undefined;
|
|
@@ -28,6 +37,8 @@ export interface IConfigProvider extends IConfigProviderBase {
|
|
|
28
37
|
* Creates a base configuration provider based on `sessionStorage`
|
|
29
38
|
*
|
|
30
39
|
* @returns A lazy initialized base configuration provider with `sessionStorage` as the underlying config store
|
|
40
|
+
*
|
|
41
|
+
* @internal
|
|
31
42
|
*/
|
|
32
43
|
export declare const sessionStorageConfigProvider: Lazy<IConfigProviderBase>;
|
|
33
44
|
/**
|
|
@@ -56,14 +67,44 @@ export declare class CachedConfigProvider implements IConfigProvider {
|
|
|
56
67
|
private getCacheEntry;
|
|
57
68
|
}
|
|
58
69
|
/**
|
|
59
|
-
* A type containing both a telemetry logger and a configuration provider
|
|
70
|
+
* A type containing both a telemetry logger and a configuration provider.
|
|
71
|
+
*
|
|
72
|
+
* @internal
|
|
60
73
|
*/
|
|
61
74
|
export interface MonitoringContext<L extends ITelemetryBaseLogger = ITelemetryLoggerExt> {
|
|
62
75
|
config: IConfigProvider;
|
|
63
76
|
logger: L;
|
|
64
77
|
}
|
|
78
|
+
/**
|
|
79
|
+
* Determines whether or not the provided object is a {@link MonitoringContext}.
|
|
80
|
+
* @remarks Can be used for type-narrowing.
|
|
81
|
+
*
|
|
82
|
+
* @internal
|
|
83
|
+
*/
|
|
65
84
|
export declare function loggerIsMonitoringContext<L extends ITelemetryBaseLogger = ITelemetryLoggerExt>(obj: L): obj is L & MonitoringContext<L>;
|
|
85
|
+
/**
|
|
86
|
+
* Creates a {@link MonitoringContext} from the provided logger, if it isn't already one.
|
|
87
|
+
*
|
|
88
|
+
* @internal
|
|
89
|
+
*/
|
|
66
90
|
export declare function loggerToMonitoringContext<L extends ITelemetryBaseLogger = ITelemetryLoggerExt>(logger: L): MonitoringContext<L>;
|
|
91
|
+
/**
|
|
92
|
+
* Creates a {@link MonitoringContext} from the provided logger.
|
|
93
|
+
*
|
|
94
|
+
* @remarks
|
|
95
|
+
* Assumes that the provided logger is not itself already a {@link MonitoringContext}, and will throw an error if it is.
|
|
96
|
+
* If you are unsure, use {@link loggerToMonitoringContext} instead.
|
|
97
|
+
*
|
|
98
|
+
* @throws If the provided logger is already a {@link MonitoringContext}.
|
|
99
|
+
*
|
|
100
|
+
* @internal
|
|
101
|
+
*/
|
|
67
102
|
export declare function mixinMonitoringContext<L extends ITelemetryBaseLogger = ITelemetryLoggerExt>(logger: L, ...configs: (IConfigProviderBase | undefined)[]): MonitoringContext<L>;
|
|
103
|
+
/**
|
|
104
|
+
* Creates a child logger with a {@link MonitoringContext}.
|
|
105
|
+
*
|
|
106
|
+
* @see {@link loggerToMonitoringContext}
|
|
107
|
+
* @internal
|
|
108
|
+
*/
|
|
68
109
|
export declare function createChildMonitoringContext(props: Parameters<typeof createChildLogger>[0]): MonitoringContext;
|
|
69
110
|
//# sourceMappingURL=config.d.ts.map
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAoB,MAAM,UAAU,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAEvD,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,OAAO,EAAE,GAAG,SAAS,CAAC;AAElG
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAoB,MAAM,UAAU,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAEvD;;;;GAIG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,OAAO,EAAE,GAAG,SAAS,CAAC;AAElG;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IACnC,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;CACxC;AAED;;;;GAIG;AACH,MAAM,WAAW,eAAgB,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EAAE,GAAG,SAAS;IAIlD,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW;IAIvC,OAAO,CAAC,aAAa;CAsBrB;AAED;;;;GAIG;AACH,MAAM,WAAW,iBAAiB,CAAC,CAAC,SAAS,oBAAoB,GAAG,mBAAmB;IACtF,MAAM,EAAE,eAAe,CAAC;IACxB,MAAM,EAAE,CAAC,CAAC;CACV;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,CAAC,SAAS,oBAAoB,GAAG,mBAAmB,EAC7F,GAAG,EAAE,CAAC,GACJ,GAAG,IAAI,CAAC,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAGjC;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,CAAC,SAAS,oBAAoB,GAAG,mBAAmB,EAC7F,MAAM,EAAE,CAAC,GACP,iBAAiB,CAAC,CAAC,CAAC,CAKtB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,SAAS,oBAAoB,GAAG,mBAAmB,EAC1F,MAAM,EAAE,CAAC,EACT,GAAG,OAAO,EAAE,CAAC,mBAAmB,GAAG,SAAS,CAAC,EAAE,GAC7C,iBAAiB,CAAC,CAAC,CAAC,CAgBtB;AAOD;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAC3C,KAAK,EAAE,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC,CAAC,CAAC,GAC5C,iBAAiB,CAEnB"}
|
package/dist/config.js
CHANGED
|
@@ -7,6 +7,8 @@ const logger_1 = require("./logger");
|
|
|
7
7
|
* Creates a base configuration provider based on `sessionStorage`
|
|
8
8
|
*
|
|
9
9
|
* @returns A lazy initialized base configuration provider with `sessionStorage` as the underlying config store
|
|
10
|
+
*
|
|
11
|
+
* @internal
|
|
10
12
|
*/
|
|
11
13
|
exports.sessionStorageConfigProvider = new core_utils_1.Lazy(() => (0, exports.inMemoryConfigProvider)(safeSessionStorage()));
|
|
12
14
|
const NullConfigProvider = {
|
|
@@ -191,11 +193,22 @@ class CachedConfigProvider {
|
|
|
191
193
|
}
|
|
192
194
|
}
|
|
193
195
|
exports.CachedConfigProvider = CachedConfigProvider;
|
|
196
|
+
/**
|
|
197
|
+
* Determines whether or not the provided object is a {@link MonitoringContext}.
|
|
198
|
+
* @remarks Can be used for type-narrowing.
|
|
199
|
+
*
|
|
200
|
+
* @internal
|
|
201
|
+
*/
|
|
194
202
|
function loggerIsMonitoringContext(obj) {
|
|
195
203
|
const maybeConfig = obj;
|
|
196
204
|
return isConfigProviderBase(maybeConfig?.config) && maybeConfig?.logger !== undefined;
|
|
197
205
|
}
|
|
198
206
|
exports.loggerIsMonitoringContext = loggerIsMonitoringContext;
|
|
207
|
+
/**
|
|
208
|
+
* Creates a {@link MonitoringContext} from the provided logger, if it isn't already one.
|
|
209
|
+
*
|
|
210
|
+
* @internal
|
|
211
|
+
*/
|
|
199
212
|
function loggerToMonitoringContext(logger) {
|
|
200
213
|
if (loggerIsMonitoringContext(logger)) {
|
|
201
214
|
return logger;
|
|
@@ -203,6 +216,17 @@ function loggerToMonitoringContext(logger) {
|
|
|
203
216
|
return mixinMonitoringContext(logger, exports.sessionStorageConfigProvider.value);
|
|
204
217
|
}
|
|
205
218
|
exports.loggerToMonitoringContext = loggerToMonitoringContext;
|
|
219
|
+
/**
|
|
220
|
+
* Creates a {@link MonitoringContext} from the provided logger.
|
|
221
|
+
*
|
|
222
|
+
* @remarks
|
|
223
|
+
* Assumes that the provided logger is not itself already a {@link MonitoringContext}, and will throw an error if it is.
|
|
224
|
+
* If you are unsure, use {@link loggerToMonitoringContext} instead.
|
|
225
|
+
*
|
|
226
|
+
* @throws If the provided logger is already a {@link MonitoringContext}.
|
|
227
|
+
*
|
|
228
|
+
* @internal
|
|
229
|
+
*/
|
|
206
230
|
function mixinMonitoringContext(logger, ...configs) {
|
|
207
231
|
if (loggerIsMonitoringContext(logger)) {
|
|
208
232
|
throw new Error("Logger is already a monitoring context");
|
|
@@ -225,6 +249,12 @@ function isConfigProviderBase(obj) {
|
|
|
225
249
|
const maybeConfig = obj;
|
|
226
250
|
return typeof maybeConfig?.getRawConfig === "function";
|
|
227
251
|
}
|
|
252
|
+
/**
|
|
253
|
+
* Creates a child logger with a {@link MonitoringContext}.
|
|
254
|
+
*
|
|
255
|
+
* @see {@link loggerToMonitoringContext}
|
|
256
|
+
* @internal
|
|
257
|
+
*/
|
|
228
258
|
function createChildMonitoringContext(props) {
|
|
229
259
|
return loggerToMonitoringContext((0, logger_1.createChildLogger)(props));
|
|
230
260
|
}
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";;;AAKA,2DAAkD;AAClD,qCAA+D;AAuB/D;;;;GAIG;AACU,QAAA,4BAA4B,GAAG,IAAI,iBAAI,CAAsB,GAAG,EAAE,CAC9E,IAAA,8BAAsB,EAAC,kBAAkB,EAAE,CAAC,CAC5C,CAAC;AAEF,MAAM,kBAAkB,GAAwB;IAC/C,YAAY,EAAE,GAAG,EAAE,CAAC,SAAS;CAC7B,CAAC;AAEF;;;;;;GAMG;AACI,MAAM,sBAAsB,GAAG,CAAC,OAA4B,EAAuB,EAAE;IAC3F,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,IAAI,EAAE;QAC9C,OAAO,IAAI,oBAAoB,CAAC,SAAS,EAAE;YAC1C,YAAY,EAAE,CAAC,IAAY,EAA2B,EAAE;gBACvD,IAAI;oBACH,OAAO,kBAAkB,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,SAAS,CAAC,EAAE,GAAG,CAAC;iBACnE;gBAAC,MAAM;oBACP,OAAO,SAAS,CAAC;iBACjB;YACF,CAAC;SACD,CAAC,CAAC;KACH;IACD,OAAO,kBAAkB,CAAC;AAC3B,CAAC,CAAC;AAbW,QAAA,sBAAsB,0BAajC;AAaF,SAAS,eAAe,CAAC,IAAY;IACpC,QAAQ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AS,oBAAoB,CAAC,GAAY;IACzC,MAAM,WAAW,GAAG,GAA+C,CAAC;IACpE,OAAO,OAAO,WAAW,EAAE,YAAY,KAAK,UAAU,CAAC;AACxD,CAAC;AAED,SAAgB,4BAA4B,CAC3C,KAA8C;IAE9C,OAAO,yBAAyB,CAAC,IAAA,0BAAiB,EAAC,KAAK,CAAC,CAAC,CAAC;AAC5D,CAAC;AAJD,oEAIC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { ITelemetryBaseLogger } from \"@fluidframework/core-interfaces\";\nimport { Lazy } from \"@fluidframework/core-utils\";\nimport { createChildLogger, tagCodeArtifacts } from \"./logger\";\nimport { ITelemetryLoggerExt } from \"./telemetryTypes\";\n\nexport type ConfigTypes = string | number | boolean | number[] | string[] | boolean[] | undefined;\n\n/**\n * Base interface for providing configurations to enable/disable/control features\n */\nexport interface IConfigProviderBase {\n\tgetRawConfig(name: string): ConfigTypes;\n}\n\n/**\n * Explicitly typed interface for reading configurations\n */\nexport interface IConfigProvider extends IConfigProviderBase {\n\tgetBoolean(name: string): boolean | undefined;\n\tgetNumber(name: string): number | undefined;\n\tgetString(name: string): string | undefined;\n\tgetBooleanArray(name: string): boolean[] | undefined;\n\tgetNumberArray(name: string): number[] | undefined;\n\tgetStringArray(name: string): string[] | undefined;\n}\n/**\n * Creates a base configuration provider based on `sessionStorage`\n *\n * @returns A lazy initialized base configuration provider with `sessionStorage` as the underlying config store\n */\nexport const sessionStorageConfigProvider = new Lazy<IConfigProviderBase>(() =>\n\tinMemoryConfigProvider(safeSessionStorage()),\n);\n\nconst NullConfigProvider: IConfigProviderBase = {\n\tgetRawConfig: () => undefined,\n};\n\n/**\n * Creates a base configuration provider based on the supplied `Storage` instance\n *\n * @param storage - instance of `Storage` to be used as storage media for the config\n * @returns A base configuration provider with\n * the supplied `Storage` instance as the underlying config store\n */\nexport const inMemoryConfigProvider = (storage: Storage | undefined): IConfigProviderBase => {\n\tif (storage !== undefined && storage !== null) {\n\t\treturn new CachedConfigProvider(undefined, {\n\t\t\tgetRawConfig: (name: string): ConfigTypes | undefined => {\n\t\t\t\ttry {\n\t\t\t\t\treturn stronglyTypedParse(storage.getItem(name) ?? undefined)?.raw;\n\t\t\t\t} catch {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\t\t\t},\n\t\t});\n\t}\n\treturn NullConfigProvider;\n};\n\ninterface ConfigTypeStringToType {\n\tnumber: number;\n\tstring: string;\n\tboolean: boolean;\n\t[\"number[]\"]: number[];\n\t[\"string[]\"]: string[];\n\t[\"boolean[]\"]: boolean[];\n}\n\ntype PrimitiveTypeStrings = \"number\" | \"string\" | \"boolean\";\n\nfunction isPrimitiveType(type: string): type is PrimitiveTypeStrings {\n\tswitch (type) {\n\t\tcase \"boolean\":\n\t\tcase \"number\":\n\t\tcase \"string\": {\n\t\t\treturn true;\n\t\t}\n\t\tdefault: {\n\t\t\treturn false;\n\t\t}\n\t}\n}\n\ninterface StronglyTypedValue extends Partial<ConfigTypeStringToType> {\n\traw: ConfigTypes;\n}\n/**\n * Takes any supported config type, and returns the value with a strong type. If the type of\n * the config is not a supported type undefined will be returned.\n * The user of this function should cache the result to avoid duplicated work.\n *\n * Strings will be attempted to be parsed and coerced into a strong config type.\n * if it is not possible to parsed and coerce a string to a strong config type the original string\n * will be return with a string type for the consumer to handle further if necessary.\n */\nfunction stronglyTypedParse(input: ConfigTypes): StronglyTypedValue | undefined {\n\tlet output: ConfigTypes = input;\n\tlet defaultReturn: Pick<StronglyTypedValue, \"raw\" | \"string\"> | undefined;\n\t// we do special handling for strings to try and coerce\n\t// them into a config type if we can. This makes it easy\n\t// for config sources like sessionStorage which only\n\t// holds strings\n\tif (typeof input === \"string\") {\n\t\ttry {\n\t\t\toutput = JSON.parse(input) as ConfigTypes;\n\t\t\t// we succeeded in parsing, but we don't support parsing\n\t\t\t// for any object as we can't do it type safely\n\t\t\t// so in this case, the default return will be string\n\t\t\t// rather than undefined, and the consumer\n\t\t\t// can parse, as we don't want to provide\n\t\t\t// a false sense of security by just\n\t\t\t// casting.\n\t\t\tdefaultReturn = { raw: input, string: input };\n\t\t} catch {\n\t\t\t// No-op\n\t\t}\n\t}\n\n\tif (output === undefined) {\n\t\treturn defaultReturn;\n\t}\n\n\tconst outputType = typeof output;\n\tif (isPrimitiveType(outputType)) {\n\t\treturn { ...defaultReturn, raw: input, [outputType]: output };\n\t}\n\n\tif (Array.isArray(output)) {\n\t\tconst firstType = typeof output[0];\n\t\t// ensure the first elements is a primitive type\n\t\tif (!isPrimitiveType(firstType)) {\n\t\t\treturn defaultReturn;\n\t\t}\n\t\t// ensue all the elements types are homogeneous\n\t\t// aka they all have the same type as the first\n\t\tfor (const v of output) {\n\t\t\tif (typeof v !== firstType) {\n\t\t\t\treturn defaultReturn;\n\t\t\t}\n\t\t}\n\t\treturn { ...defaultReturn, raw: input, [`${firstType}[]`]: output };\n\t}\n\n\treturn defaultReturn;\n}\n\n/**\n * `sessionStorage` is undefined in some environments such as Node and web pages with session storage disabled.\n */\nconst safeSessionStorage = (): Storage | undefined => {\n\t// For some configurations accessing \"globalThis.sessionStorage\" throws\n\t// \"'sessionStorage' property from 'Window': Access is denied for this document\" rather than returning undefined.\n\t// Therefor check for it before accessing.\n\ttry {\n\t\t// Using globalThis and checking for undefined is preferred over just accessing global sessionStorage\n\t\t// since it avoids an exception when running in node.\n\t\t// In some cases this has returned null when disabled in the browser, so ensure its undefined in that case:\n\t\treturn globalThis.sessionStorage ?? undefined;\n\t} catch {\n\t\t// For browsers which error on the above when session storage is disabled:\n\t\treturn undefined;\n\t}\n};\n\n/**\n * Implementation of {@link IConfigProvider} which contains nested {@link IConfigProviderBase} instances\n */\nexport class CachedConfigProvider implements IConfigProvider {\n\tprivate readonly configCache = new Map<string, StronglyTypedValue>();\n\tprivate readonly orderedBaseProviders: (IConfigProviderBase | undefined)[];\n\n\tconstructor(\n\t\tprivate readonly logger?: ITelemetryBaseLogger,\n\t\t...orderedBaseProviders: (IConfigProviderBase | undefined)[]\n\t) {\n\t\tthis.orderedBaseProviders = [];\n\t\tconst knownProviders = new Set<IConfigProviderBase>();\n\t\tconst candidateProviders = [...orderedBaseProviders];\n\t\twhile (candidateProviders.length > 0) {\n\t\t\tconst baseProvider = candidateProviders.shift()!;\n\t\t\tif (\n\t\t\t\tbaseProvider !== undefined &&\n\t\t\t\tisConfigProviderBase(baseProvider) &&\n\t\t\t\t!knownProviders.has(baseProvider)\n\t\t\t) {\n\t\t\t\tknownProviders.add(baseProvider);\n\t\t\t\tif (baseProvider instanceof CachedConfigProvider) {\n\t\t\t\t\tcandidateProviders.push(...baseProvider.orderedBaseProviders);\n\t\t\t\t} else {\n\t\t\t\t\tthis.orderedBaseProviders.push(baseProvider);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tgetBoolean(name: string): boolean | undefined {\n\t\treturn this.getCacheEntry(name)?.boolean;\n\t}\n\tgetNumber(name: string): number | undefined {\n\t\treturn this.getCacheEntry(name)?.number;\n\t}\n\tgetString(name: string): string | undefined {\n\t\treturn this.getCacheEntry(name)?.string;\n\t}\n\tgetBooleanArray(name: string): boolean[] | undefined {\n\t\treturn this.getCacheEntry(name)?.[\"boolean[]\"];\n\t}\n\tgetNumberArray(name: string): number[] | undefined {\n\t\treturn this.getCacheEntry(name)?.[\"number[]\"];\n\t}\n\tgetStringArray(name: string): string[] | undefined {\n\t\treturn this.getCacheEntry(name)?.[\"string[]\"];\n\t}\n\n\tgetRawConfig(name: string): ConfigTypes {\n\t\treturn this.getCacheEntry(name)?.raw;\n\t}\n\n\tprivate getCacheEntry(name: string): StronglyTypedValue | undefined {\n\t\tif (!this.configCache.has(name)) {\n\t\t\tfor (const provider of this.orderedBaseProviders) {\n\t\t\t\tconst parsed = stronglyTypedParse(provider?.getRawConfig(name));\n\t\t\t\tif (parsed !== undefined) {\n\t\t\t\t\tthis.configCache.set(name, parsed);\n\t\t\t\t\tthis.logger?.send({\n\t\t\t\t\t\tcategory: \"generic\",\n\t\t\t\t\t\teventName: \"ConfigRead\",\n\t\t\t\t\t\t...tagCodeArtifacts({\n\t\t\t\t\t\t\tconfigName: name,\n\t\t\t\t\t\t\tconfigValue: JSON.stringify(parsed),\n\t\t\t\t\t\t}),\n\t\t\t\t\t});\n\t\t\t\t\treturn parsed;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// configs are immutable, if the first lookup returned no results, all lookups should\n\t\t\tthis.configCache.set(name, { raw: undefined });\n\t\t}\n\t\treturn this.configCache.get(name);\n\t}\n}\n\n/**\n * A type containing both a telemetry logger and a configuration provider\n */\nexport interface MonitoringContext<L extends ITelemetryBaseLogger = ITelemetryLoggerExt> {\n\tconfig: IConfigProvider;\n\tlogger: L;\n}\n\nexport function loggerIsMonitoringContext<L extends ITelemetryBaseLogger = ITelemetryLoggerExt>(\n\tobj: L,\n): obj is L & MonitoringContext<L> {\n\tconst maybeConfig = obj as Partial<MonitoringContext<L>> | undefined;\n\treturn isConfigProviderBase(maybeConfig?.config) && maybeConfig?.logger !== undefined;\n}\n\nexport function loggerToMonitoringContext<L extends ITelemetryBaseLogger = ITelemetryLoggerExt>(\n\tlogger: L,\n): MonitoringContext<L> {\n\tif (loggerIsMonitoringContext<L>(logger)) {\n\t\treturn logger;\n\t}\n\treturn mixinMonitoringContext<L>(logger, sessionStorageConfigProvider.value);\n}\n\nexport function mixinMonitoringContext<L extends ITelemetryBaseLogger = ITelemetryLoggerExt>(\n\tlogger: L,\n\t...configs: (IConfigProviderBase | undefined)[]\n): MonitoringContext<L> {\n\tif (loggerIsMonitoringContext<L>(logger)) {\n\t\tthrow new Error(\"Logger is already a monitoring context\");\n\t}\n\t/**\n\t * this is the tricky bit we use for now to smuggle monitoring context around.\n\t * To the logger we mixin both config and itself, so mc.logger === logger as it is self-referential.\n\t * We then expose it as a Monitoring context, so via types we hide the outer logger methods.\n\t * To layers that expect just a logger we can pass mc.logger, but this is still a MonitoringContext\n\t * so if a deeper layer then converts that logger to a monitoring context it can find the smuggled properties\n\t * of the MonitoringContext and get the config provider.\n\t */\n\tconst mc: L & Partial<MonitoringContext<L>> = logger;\n\tmc.config = new CachedConfigProvider(logger, ...configs);\n\tmc.logger = logger;\n\treturn mc as MonitoringContext<L>;\n}\n\nfunction isConfigProviderBase(obj: unknown): obj is IConfigProviderBase {\n\tconst maybeConfig = obj as Partial<IConfigProviderBase> | undefined;\n\treturn typeof maybeConfig?.getRawConfig === \"function\";\n}\n\nexport function createChildMonitoringContext(\n\tprops: Parameters<typeof createChildLogger>[0],\n): MonitoringContext {\n\treturn loggerToMonitoringContext(createChildLogger(props));\n}\n"]}
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";;;AAKA,2DAAkD;AAClD,qCAA+D;AAgC/D;;;;;;GAMG;AACU,QAAA,4BAA4B,GAAG,IAAI,iBAAI,CAAsB,GAAG,EAAE,CAC9E,IAAA,8BAAsB,EAAC,kBAAkB,EAAE,CAAC,CAC5C,CAAC;AAEF,MAAM,kBAAkB,GAAwB;IAC/C,YAAY,EAAE,GAAG,EAAE,CAAC,SAAS;CAC7B,CAAC;AAEF;;;;;;GAMG;AACI,MAAM,sBAAsB,GAAG,CAAC,OAA4B,EAAuB,EAAE;IAC3F,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,IAAI,EAAE;QAC9C,OAAO,IAAI,oBAAoB,CAAC,SAAS,EAAE;YAC1C,YAAY,EAAE,CAAC,IAAY,EAA2B,EAAE;gBACvD,IAAI;oBACH,OAAO,kBAAkB,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,SAAS,CAAC,EAAE,GAAG,CAAC;iBACnE;gBAAC,MAAM;oBACP,OAAO,SAAS,CAAC;iBACjB;YACF,CAAC;SACD,CAAC,CAAC;KACH;IACD,OAAO,kBAAkB,CAAC;AAC3B,CAAC,CAAC;AAbW,QAAA,sBAAsB,0BAajC;AAaF,SAAS,eAAe,CAAC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AAM,CAAC;IACnB,OAAO,EAA0B,CAAC;AACnC,CAAC;AAnBD,wDAmBC;AAED,SAAS,oBAAoB,CAAC,GAAY;IACzC,MAAM,WAAW,GAAG,GAA+C,CAAC;IACpE,OAAO,OAAO,WAAW,EAAE,YAAY,KAAK,UAAU,CAAC;AACxD,CAAC;AAED;;;;;GAKG;AACH,SAAgB,4BAA4B,CAC3C,KAA8C;IAE9C,OAAO,yBAAyB,CAAC,IAAA,0BAAiB,EAAC,KAAK,CAAC,CAAC,CAAC;AAC5D,CAAC;AAJD,oEAIC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { ITelemetryBaseLogger } from \"@fluidframework/core-interfaces\";\nimport { Lazy } from \"@fluidframework/core-utils\";\nimport { createChildLogger, tagCodeArtifacts } from \"./logger\";\nimport { ITelemetryLoggerExt } from \"./telemetryTypes\";\n\n/**\n * Types supported by {@link IConfigProviderBase}.\n *\n * @internal\n */\nexport type ConfigTypes = string | number | boolean | number[] | string[] | boolean[] | undefined;\n\n/**\n * Base interface for providing configurations to enable/disable/control features.\n *\n * @internal\n */\nexport interface IConfigProviderBase {\n\tgetRawConfig(name: string): ConfigTypes;\n}\n\n/**\n * Explicitly typed interface for reading configurations.\n *\n * @internal\n */\nexport interface IConfigProvider extends IConfigProviderBase {\n\tgetBoolean(name: string): boolean | undefined;\n\tgetNumber(name: string): number | undefined;\n\tgetString(name: string): string | undefined;\n\tgetBooleanArray(name: string): boolean[] | undefined;\n\tgetNumberArray(name: string): number[] | undefined;\n\tgetStringArray(name: string): string[] | undefined;\n}\n/**\n * Creates a base configuration provider based on `sessionStorage`\n *\n * @returns A lazy initialized base configuration provider with `sessionStorage` as the underlying config store\n *\n * @internal\n */\nexport const sessionStorageConfigProvider = new Lazy<IConfigProviderBase>(() =>\n\tinMemoryConfigProvider(safeSessionStorage()),\n);\n\nconst NullConfigProvider: IConfigProviderBase = {\n\tgetRawConfig: () => undefined,\n};\n\n/**\n * Creates a base configuration provider based on the supplied `Storage` instance\n *\n * @param storage - instance of `Storage` to be used as storage media for the config\n * @returns A base configuration provider with\n * the supplied `Storage` instance as the underlying config store\n */\nexport const inMemoryConfigProvider = (storage: Storage | undefined): IConfigProviderBase => {\n\tif (storage !== undefined && storage !== null) {\n\t\treturn new CachedConfigProvider(undefined, {\n\t\t\tgetRawConfig: (name: string): ConfigTypes | undefined => {\n\t\t\t\ttry {\n\t\t\t\t\treturn stronglyTypedParse(storage.getItem(name) ?? undefined)?.raw;\n\t\t\t\t} catch {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\t\t\t},\n\t\t});\n\t}\n\treturn NullConfigProvider;\n};\n\ninterface ConfigTypeStringToType {\n\tnumber: number;\n\tstring: string;\n\tboolean: boolean;\n\t[\"number[]\"]: number[];\n\t[\"string[]\"]: string[];\n\t[\"boolean[]\"]: boolean[];\n}\n\ntype PrimitiveTypeStrings = \"number\" | \"string\" | \"boolean\";\n\nfunction isPrimitiveType(type: string): type is PrimitiveTypeStrings {\n\tswitch (type) {\n\t\tcase \"boolean\":\n\t\tcase \"number\":\n\t\tcase \"string\": {\n\t\t\treturn true;\n\t\t}\n\t\tdefault: {\n\t\t\treturn false;\n\t\t}\n\t}\n}\n\ninterface StronglyTypedValue extends Partial<ConfigTypeStringToType> {\n\traw: ConfigTypes;\n}\n/**\n * Takes any supported config type, and returns the value with a strong type. If the type of\n * the config is not a supported type undefined will be returned.\n * The user of this function should cache the result to avoid duplicated work.\n *\n * Strings will be attempted to be parsed and coerced into a strong config type.\n * if it is not possible to parsed and coerce a string to a strong config type the original string\n * will be return with a string type for the consumer to handle further if necessary.\n */\nfunction stronglyTypedParse(input: ConfigTypes): StronglyTypedValue | undefined {\n\tlet output: ConfigTypes = input;\n\tlet defaultReturn: Pick<StronglyTypedValue, \"raw\" | \"string\"> | undefined;\n\t// we do special handling for strings to try and coerce\n\t// them into a config type if we can. This makes it easy\n\t// for config sources like sessionStorage which only\n\t// holds strings\n\tif (typeof input === \"string\") {\n\t\ttry {\n\t\t\toutput = JSON.parse(input) as ConfigTypes;\n\t\t\t// we succeeded in parsing, but we don't support parsing\n\t\t\t// for any object as we can't do it type safely\n\t\t\t// so in this case, the default return will be string\n\t\t\t// rather than undefined, and the consumer\n\t\t\t// can parse, as we don't want to provide\n\t\t\t// a false sense of security by just\n\t\t\t// casting.\n\t\t\tdefaultReturn = { raw: input, string: input };\n\t\t} catch {\n\t\t\t// No-op\n\t\t}\n\t}\n\n\tif (output === undefined) {\n\t\treturn defaultReturn;\n\t}\n\n\tconst outputType = typeof output;\n\tif (isPrimitiveType(outputType)) {\n\t\treturn { ...defaultReturn, raw: input, [outputType]: output };\n\t}\n\n\tif (Array.isArray(output)) {\n\t\tconst firstType = typeof output[0];\n\t\t// ensure the first elements is a primitive type\n\t\tif (!isPrimitiveType(firstType)) {\n\t\t\treturn defaultReturn;\n\t\t}\n\t\t// ensue all the elements types are homogeneous\n\t\t// aka they all have the same type as the first\n\t\tfor (const v of output) {\n\t\t\tif (typeof v !== firstType) {\n\t\t\t\treturn defaultReturn;\n\t\t\t}\n\t\t}\n\t\treturn { ...defaultReturn, raw: input, [`${firstType}[]`]: output };\n\t}\n\n\treturn defaultReturn;\n}\n\n/**\n * `sessionStorage` is undefined in some environments such as Node and web pages with session storage disabled.\n */\nconst safeSessionStorage = (): Storage | undefined => {\n\t// For some configurations accessing \"globalThis.sessionStorage\" throws\n\t// \"'sessionStorage' property from 'Window': Access is denied for this document\" rather than returning undefined.\n\t// Therefor check for it before accessing.\n\ttry {\n\t\t// Using globalThis and checking for undefined is preferred over just accessing global sessionStorage\n\t\t// since it avoids an exception when running in node.\n\t\t// In some cases this has returned null when disabled in the browser, so ensure its undefined in that case:\n\t\treturn globalThis.sessionStorage ?? undefined;\n\t} catch {\n\t\t// For browsers which error on the above when session storage is disabled:\n\t\treturn undefined;\n\t}\n};\n\n/**\n * Implementation of {@link IConfigProvider} which contains nested {@link IConfigProviderBase} instances\n */\nexport class CachedConfigProvider implements IConfigProvider {\n\tprivate readonly configCache = new Map<string, StronglyTypedValue>();\n\tprivate readonly orderedBaseProviders: (IConfigProviderBase | undefined)[];\n\n\tconstructor(\n\t\tprivate readonly logger?: ITelemetryBaseLogger,\n\t\t...orderedBaseProviders: (IConfigProviderBase | undefined)[]\n\t) {\n\t\tthis.orderedBaseProviders = [];\n\t\tconst knownProviders = new Set<IConfigProviderBase>();\n\t\tconst candidateProviders = [...orderedBaseProviders];\n\t\twhile (candidateProviders.length > 0) {\n\t\t\tconst baseProvider = candidateProviders.shift()!;\n\t\t\tif (\n\t\t\t\tbaseProvider !== undefined &&\n\t\t\t\tisConfigProviderBase(baseProvider) &&\n\t\t\t\t!knownProviders.has(baseProvider)\n\t\t\t) {\n\t\t\t\tknownProviders.add(baseProvider);\n\t\t\t\tif (baseProvider instanceof CachedConfigProvider) {\n\t\t\t\t\tcandidateProviders.push(...baseProvider.orderedBaseProviders);\n\t\t\t\t} else {\n\t\t\t\t\tthis.orderedBaseProviders.push(baseProvider);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tgetBoolean(name: string): boolean | undefined {\n\t\treturn this.getCacheEntry(name)?.boolean;\n\t}\n\tgetNumber(name: string): number | undefined {\n\t\treturn this.getCacheEntry(name)?.number;\n\t}\n\tgetString(name: string): string | undefined {\n\t\treturn this.getCacheEntry(name)?.string;\n\t}\n\tgetBooleanArray(name: string): boolean[] | undefined {\n\t\treturn this.getCacheEntry(name)?.[\"boolean[]\"];\n\t}\n\tgetNumberArray(name: string): number[] | undefined {\n\t\treturn this.getCacheEntry(name)?.[\"number[]\"];\n\t}\n\tgetStringArray(name: string): string[] | undefined {\n\t\treturn this.getCacheEntry(name)?.[\"string[]\"];\n\t}\n\n\tgetRawConfig(name: string): ConfigTypes {\n\t\treturn this.getCacheEntry(name)?.raw;\n\t}\n\n\tprivate getCacheEntry(name: string): StronglyTypedValue | undefined {\n\t\tif (!this.configCache.has(name)) {\n\t\t\tfor (const provider of this.orderedBaseProviders) {\n\t\t\t\tconst parsed = stronglyTypedParse(provider?.getRawConfig(name));\n\t\t\t\tif (parsed !== undefined) {\n\t\t\t\t\tthis.configCache.set(name, parsed);\n\t\t\t\t\tthis.logger?.send({\n\t\t\t\t\t\tcategory: \"generic\",\n\t\t\t\t\t\teventName: \"ConfigRead\",\n\t\t\t\t\t\t...tagCodeArtifacts({\n\t\t\t\t\t\t\tconfigName: name,\n\t\t\t\t\t\t\tconfigValue: JSON.stringify(parsed),\n\t\t\t\t\t\t}),\n\t\t\t\t\t});\n\t\t\t\t\treturn parsed;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// configs are immutable, if the first lookup returned no results, all lookups should\n\t\t\tthis.configCache.set(name, { raw: undefined });\n\t\t}\n\t\treturn this.configCache.get(name);\n\t}\n}\n\n/**\n * A type containing both a telemetry logger and a configuration provider.\n *\n * @internal\n */\nexport interface MonitoringContext<L extends ITelemetryBaseLogger = ITelemetryLoggerExt> {\n\tconfig: IConfigProvider;\n\tlogger: L;\n}\n\n/**\n * Determines whether or not the provided object is a {@link MonitoringContext}.\n * @remarks Can be used for type-narrowing.\n *\n * @internal\n */\nexport function loggerIsMonitoringContext<L extends ITelemetryBaseLogger = ITelemetryLoggerExt>(\n\tobj: L,\n): obj is L & MonitoringContext<L> {\n\tconst maybeConfig = obj as Partial<MonitoringContext<L>> | undefined;\n\treturn isConfigProviderBase(maybeConfig?.config) && maybeConfig?.logger !== undefined;\n}\n\n/**\n * Creates a {@link MonitoringContext} from the provided logger, if it isn't already one.\n *\n * @internal\n */\nexport function loggerToMonitoringContext<L extends ITelemetryBaseLogger = ITelemetryLoggerExt>(\n\tlogger: L,\n): MonitoringContext<L> {\n\tif (loggerIsMonitoringContext<L>(logger)) {\n\t\treturn logger;\n\t}\n\treturn mixinMonitoringContext<L>(logger, sessionStorageConfigProvider.value);\n}\n\n/**\n * Creates a {@link MonitoringContext} from the provided logger.\n *\n * @remarks\n * Assumes that the provided logger is not itself already a {@link MonitoringContext}, and will throw an error if it is.\n * If you are unsure, use {@link loggerToMonitoringContext} instead.\n *\n * @throws If the provided logger is already a {@link MonitoringContext}.\n *\n * @internal\n */\nexport function mixinMonitoringContext<L extends ITelemetryBaseLogger = ITelemetryLoggerExt>(\n\tlogger: L,\n\t...configs: (IConfigProviderBase | undefined)[]\n): MonitoringContext<L> {\n\tif (loggerIsMonitoringContext<L>(logger)) {\n\t\tthrow new Error(\"Logger is already a monitoring context\");\n\t}\n\t/**\n\t * this is the tricky bit we use for now to smuggle monitoring context around.\n\t * To the logger we mixin both config and itself, so mc.logger === logger as it is self-referential.\n\t * We then expose it as a Monitoring context, so via types we hide the outer logger methods.\n\t * To layers that expect just a logger we can pass mc.logger, but this is still a MonitoringContext\n\t * so if a deeper layer then converts that logger to a monitoring context it can find the smuggled properties\n\t * of the MonitoringContext and get the config provider.\n\t */\n\tconst mc: L & Partial<MonitoringContext<L>> = logger;\n\tmc.config = new CachedConfigProvider(logger, ...configs);\n\tmc.logger = logger;\n\treturn mc as MonitoringContext<L>;\n}\n\nfunction isConfigProviderBase(obj: unknown): obj is IConfigProviderBase {\n\tconst maybeConfig = obj as Partial<IConfigProviderBase> | undefined;\n\treturn typeof maybeConfig?.getRawConfig === \"function\";\n}\n\n/**\n * Creates a child logger with a {@link MonitoringContext}.\n *\n * @see {@link loggerToMonitoringContext}\n * @internal\n */\nexport function createChildMonitoringContext(\n\tprops: Parameters<typeof createChildLogger>[0],\n): MonitoringContext {\n\treturn loggerToMonitoringContext(createChildLogger(props));\n}\n"]}
|
package/dist/error.d.ts
CHANGED
|
@@ -88,6 +88,8 @@ export declare class DataProcessingError extends LoggingError implements IErrorB
|
|
|
88
88
|
* Extracts specific properties from the provided message that we know are safe to log.
|
|
89
89
|
*
|
|
90
90
|
* @param messageLike - Message to include info about via telemetry props.
|
|
91
|
+
*
|
|
92
|
+
* @internal
|
|
91
93
|
*/
|
|
92
94
|
export declare const extractSafePropertiesFromMessage: (messageLike: Partial<Pick<ISequencedDocumentMessage, "clientId" | "sequenceNumber" | "clientSequenceNumber" | "referenceSequenceNumber" | "minimumSequenceNumber" | "timestamp">>) => {
|
|
93
95
|
messageClientId: string | undefined;
|
package/dist/error.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAEN,aAAa,EACb,UAAU,EACV,wBAAwB,EACxB,WAAW,EACX,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AAEjF,OAAO,EACN,YAAY,EAKZ,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEnD;;;;GAIG;AACH,qBAAa,YAAa,SAAQ,YAAa,YAAW,aAAa,EAAE,eAAe;aAatE,KAAK,CAAC;IAZvB,QAAQ,CAAC,SAAS,iBAAgC;IAElD;;;;;OAKG;gBAEF,OAAO,EAAE,MAAM,EAGC,KAAK,CAAC,KAAK,EAC3B,KAAK,CAAC,EAAE,wBAAwB;CAKjC;AAED;;;;GAIG;AACH,qBAAa,UAAW,SAAQ,YAAa,YAAW,WAAW,EAAE,eAAe;IACnF,QAAQ,CAAC,SAAS,eAA8B;gBAEpC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,wBAAwB;CAG7D;AAED;;;;;GAKG;AACH,qBAAa,mBAAoB,SAAQ,YAAa,YAAW,UAAU,EAAE,eAAe;IAC3F,QAAQ,CAAC,SAAS,wBAAuC;IACzD,QAAQ,CAAC,QAAQ,SAAS;gBAEd,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,wBAAwB;CAG5D;AAED;;;;;;;;;;GAUG;AACH,qBAAa,mBAAoB,SAAQ,YAAa,YAAW,UAAU,EAAE,eAAe;IAC3F;;OAEG;IACH,SAAgB,SAAS,wBAAuC;IAEhE,SAAg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|
|
|
129
129
|
* Extracts specific properties from the provided message that we know are safe to log.
|
|
130
130
|
*
|
|
131
131
|
* @param messageLike - Message to include info about via telemetry props.
|
|
132
|
+
*
|
|
133
|
+
* @internal
|
|
132
134
|
*/
|
|
133
135
|
const extractSafePropertiesFromMessage = (messageLike) => ({
|
|
134
136
|
messageClientId: messageLike.clientId === null ? "null" : messageLike.clientId,
|