@fluidframework/core-interfaces 2.0.0-internal.6.1.0 → 2.0.0-internal.6.2.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/CHANGELOG.md +31 -0
- package/README.md +4 -3
- package/dist/error.d.ts +105 -0
- package/dist/error.d.ts.map +1 -0
- package/dist/error.js +33 -0
- package/dist/error.js.map +1 -0
- package/dist/events.d.ts +249 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +7 -0
- package/dist/events.js.map +1 -0
- package/dist/index.d.ts +6 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -5
- package/dist/index.js.map +1 -1
- package/dist/logger.d.ts +18 -4
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js.map +1 -1
- package/lib/error.d.ts +105 -0
- package/lib/error.d.ts.map +1 -0
- package/lib/error.js +30 -0
- package/lib/error.js.map +1 -0
- package/lib/events.d.ts +249 -0
- package/lib/events.d.ts.map +1 -0
- package/lib/events.js +6 -0
- package/lib/events.js.map +1 -0
- package/lib/index.d.ts +6 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib/logger.d.ts +18 -4
- package/lib/logger.d.ts.map +1 -1
- package/lib/logger.js.map +1 -1
- package/package.json +5 -5
- package/src/error.ts +117 -0
- package/src/events.ts +430 -0
- package/src/index.ts +34 -13
- package/src/logger.ts +28 -4
package/lib/index.d.ts
CHANGED
|
@@ -2,11 +2,14 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
+
export type { IDisposable } from "./disposable";
|
|
6
|
+
export { FluidErrorTypes, IErrorBase, IGenericError, IUsageError, IThrottlingWarning, } from "./error";
|
|
7
|
+
export type { ExtendEventProvider, IErrorEvent, IEvent, IEventProvider, IEventThisPlaceHolder, IEventTransformer, ReplaceIEventThisPlaceHolder, TransformedEvent, } from "./events";
|
|
5
8
|
export { IFluidLoadable, IProvideFluidLoadable, IFluidRunnable, IProvideFluidRunnable, } from "./fluidLoadable";
|
|
9
|
+
export { IFluidPackageEnvironment, IFluidPackage, isFluidPackage, IFluidCodeDetailsConfig, IFluidCodeDetails, isFluidCodeDetails, IFluidCodeDetailsComparer, IProvideFluidCodeDetailsComparer, } from "./fluidPackage";
|
|
6
10
|
export { IRequest, IRequestHeader, IResponse, IProvideFluidRouter, IFluidRouter, } from "./fluidRouter";
|
|
7
11
|
export { IFluidHandleContext, IProvideFluidHandleContext, IFluidHandle, IProvideFluidHandle, } from "./handles";
|
|
8
|
-
export { IFluidPackageEnvironment, IFluidPackage, isFluidPackage, IFluidCodeDetailsConfig, IFluidCodeDetails, isFluidCodeDetails, IFluidCodeDetailsComparer, IProvideFluidCodeDetailsComparer, } from "./fluidPackage";
|
|
9
|
-
export { FluidObjectProviderKeys, FluidObject, FluidObjectKeys } from "./provider";
|
|
10
|
-
export type { IDisposable } from "./disposable";
|
|
11
12
|
export type { ILoggingError, ITaggedTelemetryPropertyType, ITelemetryBaseEvent, ITelemetryBaseLogger, ITelemetryErrorEvent, ITelemetryGenericEvent, ITelemetryLogger, ITelemetryPerformanceEvent, ITelemetryProperties, TelemetryEventCategory, TelemetryEventPropertyType, } from "./logger";
|
|
13
|
+
export { LogLevel } from "./logger";
|
|
14
|
+
export { FluidObjectProviderKeys, FluidObject, FluidObjectKeys } from "./provider";
|
|
12
15
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,OAAO,EACN,eAAe,EACf,UAAU,EACV,aAAa,EACb,WAAW,EACX,kBAAkB,GAClB,MAAM,SAAS,CAAC;AAEjB,YAAY,EACX,mBAAmB,EACnB,WAAW,EACX,MAAM,EACN,cAAc,EACd,qBAAqB,EACrB,iBAAiB,EACjB,4BAA4B,EAC5B,gBAAgB,GAChB,MAAM,UAAU,CAAC;AAElB,OAAO,EACN,cAAc,EACd,qBAAqB,EACrB,cAAc,EACd,qBAAqB,GACrB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACN,wBAAwB,EACxB,aAAa,EACb,cAAc,EACd,uBAAuB,EACvB,iBAAiB,EACjB,kBAAkB,EAClB,yBAAyB,EACzB,gCAAgC,GAChC,MAAM,gBAAgB,CAAC;AAKxB,OAAO,EACN,QAAQ,EACR,cAAc,EACd,SAAS,EACT,mBAAmB,EACnB,YAAY,GACZ,MAAM,eAAe,CAAC;AAEvB,OAAO,EACN,mBAAmB,EACnB,0BAA0B,EAC1B,YAAY,EACZ,mBAAmB,GACnB,MAAM,WAAW,CAAC;AAEnB,YAAY,EACX,aAAa,EACb,4BAA4B,EAC5B,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,sBAAsB,EACtB,gBAAgB,EAChB,0BAA0B,EAC1B,oBAAoB,EACpB,sBAAsB,EACtB,0BAA0B,GAC1B,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EAAE,uBAAuB,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
+
export { FluidErrorTypes, } from "./error";
|
|
5
6
|
export { IFluidLoadable, IFluidRunnable, } from "./fluidLoadable";
|
|
7
|
+
export { isFluidPackage, isFluidCodeDetails, IFluidCodeDetailsComparer, } from "./fluidPackage";
|
|
6
8
|
// Typescript forgets the index signature when customers augment IRequestHeader if we export *.
|
|
7
9
|
// So we export the explicit members as a workaround:
|
|
8
10
|
// https://github.com/microsoft/TypeScript/issues/18877#issuecomment-476921038
|
|
9
11
|
export { IFluidRouter, } from "./fluidRouter";
|
|
10
12
|
export { IFluidHandleContext, IFluidHandle, } from "./handles";
|
|
11
|
-
export { isFluidPackage, isFluidCodeDetails, IFluidCodeDetailsComparer, } from "./fluidPackage";
|
|
12
13
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EACN,eAAe,GAKf,MAAM,SAAS,CAAC;AAajB,OAAO,EACN,cAAc,EAEd,cAAc,GAEd,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAGN,cAAc,EAGd,kBAAkB,EAClB,yBAAyB,GAEzB,MAAM,gBAAgB,CAAC;AAExB,+FAA+F;AAC/F,qDAAqD;AACrD,8EAA8E;AAC9E,OAAO,EAKN,YAAY,GACZ,MAAM,eAAe,CAAC;AAEvB,OAAO,EACN,mBAAmB,EAEnB,YAAY,GAEZ,MAAM,WAAW,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport type { IDisposable } from \"./disposable\";\n\nexport {\n\tFluidErrorTypes,\n\tIErrorBase,\n\tIGenericError,\n\tIUsageError,\n\tIThrottlingWarning,\n} from \"./error\";\n\nexport type {\n\tExtendEventProvider,\n\tIErrorEvent,\n\tIEvent,\n\tIEventProvider,\n\tIEventThisPlaceHolder,\n\tIEventTransformer,\n\tReplaceIEventThisPlaceHolder,\n\tTransformedEvent,\n} from \"./events\";\n\nexport {\n\tIFluidLoadable,\n\tIProvideFluidLoadable,\n\tIFluidRunnable,\n\tIProvideFluidRunnable,\n} from \"./fluidLoadable\";\n\nexport {\n\tIFluidPackageEnvironment,\n\tIFluidPackage,\n\tisFluidPackage,\n\tIFluidCodeDetailsConfig,\n\tIFluidCodeDetails,\n\tisFluidCodeDetails,\n\tIFluidCodeDetailsComparer,\n\tIProvideFluidCodeDetailsComparer,\n} from \"./fluidPackage\";\n\n// Typescript forgets the index signature when customers augment IRequestHeader if we export *.\n// So we export the explicit members as a workaround:\n// https://github.com/microsoft/TypeScript/issues/18877#issuecomment-476921038\nexport {\n\tIRequest,\n\tIRequestHeader,\n\tIResponse,\n\tIProvideFluidRouter,\n\tIFluidRouter,\n} from \"./fluidRouter\";\n\nexport {\n\tIFluidHandleContext,\n\tIProvideFluidHandleContext,\n\tIFluidHandle,\n\tIProvideFluidHandle,\n} from \"./handles\";\n\nexport type {\n\tILoggingError,\n\tITaggedTelemetryPropertyType,\n\tITelemetryBaseEvent,\n\tITelemetryBaseLogger,\n\tITelemetryErrorEvent,\n\tITelemetryGenericEvent,\n\tITelemetryLogger,\n\tITelemetryPerformanceEvent,\n\tITelemetryProperties,\n\tTelemetryEventCategory,\n\tTelemetryEventPropertyType,\n} from \"./logger\";\nexport { LogLevel } from \"./logger\";\nexport { FluidObjectProviderKeys, FluidObject, FluidObjectKeys } from \"./provider\";\n"]}
|
package/lib/logger.d.ts
CHANGED
|
@@ -39,12 +39,21 @@ export interface ITelemetryBaseEvent extends ITelemetryProperties {
|
|
|
39
39
|
category: string;
|
|
40
40
|
eventName: string;
|
|
41
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* Enum to specify a level to the log to filter out logs based on the level.
|
|
44
|
+
*/
|
|
45
|
+
export declare const enum LogLevel {
|
|
46
|
+
verbose = 0,
|
|
47
|
+
default = 10,
|
|
48
|
+
error = 20
|
|
49
|
+
}
|
|
42
50
|
/**
|
|
43
51
|
* Interface to output telemetry events.
|
|
44
52
|
* Implemented by hosting app / loader
|
|
45
53
|
*/
|
|
46
54
|
export interface ITelemetryBaseLogger {
|
|
47
|
-
send(event: ITelemetryBaseEvent): void;
|
|
55
|
+
send(event: ITelemetryBaseEvent, logLevel?: LogLevel): void;
|
|
56
|
+
minLogLevel?: LogLevel;
|
|
48
57
|
}
|
|
49
58
|
/**
|
|
50
59
|
* Informational (non-error) telemetry event
|
|
@@ -87,23 +96,28 @@ export interface ITelemetryLogger extends ITelemetryBaseLogger {
|
|
|
87
96
|
* Actual implementation that sends telemetry event
|
|
88
97
|
* Implemented by derived classes
|
|
89
98
|
* @param event - Telemetry event to send over
|
|
99
|
+
* @param logLevel - optional level of the log.
|
|
90
100
|
*/
|
|
91
|
-
send(event: ITelemetryBaseEvent): void;
|
|
101
|
+
send(event: ITelemetryBaseEvent, logLevel?: LogLevel): void;
|
|
92
102
|
/**
|
|
93
103
|
* Send information telemetry event
|
|
94
104
|
* @param event - Event to send
|
|
95
105
|
* @param error - optional error object to log
|
|
106
|
+
* @param logLevel - optional level of the log.
|
|
96
107
|
*/
|
|
97
|
-
sendTelemetryEvent(event: ITelemetryGenericEvent, error?: any): void;
|
|
108
|
+
sendTelemetryEvent(event: ITelemetryGenericEvent, error?: any, logLevel?: LogLevel.verbose | LogLevel.default): void;
|
|
98
109
|
/**
|
|
99
110
|
* Send error telemetry event
|
|
100
111
|
* @param event - Event to send
|
|
112
|
+
* @param error - optional error object to log
|
|
101
113
|
*/
|
|
102
114
|
sendErrorEvent(event: ITelemetryErrorEvent, error?: any): void;
|
|
103
115
|
/**
|
|
104
116
|
* Send performance telemetry event
|
|
105
117
|
* @param event - Event to send
|
|
118
|
+
* @param error - optional error object to log
|
|
119
|
+
* @param logLevel - optional level of the log.
|
|
106
120
|
*/
|
|
107
|
-
sendPerformanceEvent(event: ITelemetryPerformanceEvent, error?: any): void;
|
|
121
|
+
sendPerformanceEvent(event: ITelemetryPerformanceEvent, error?: any, logLevel?: LogLevel.verbose | LogLevel.default): void;
|
|
108
122
|
}
|
|
109
123
|
//# sourceMappingURL=logger.d.ts.map
|
package/lib/logger.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,oBAAY,sBAAsB,GAAG,SAAS,GAAG,OAAO,GAAG,aAAa,CAAC;AAEzE;;;;;;GAMG;AACH,oBAAY,0BAA0B,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;AAE/E;;;;GAIG;AACH,MAAM,WAAW,4BAA4B;IAC5C,KAAK,EAAE,0BAA0B,CAAC;IAClC,GAAG,EAAE,MAAM,CAAC;CACZ;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACpC,CAAC,KAAK,EAAE,MAAM,GAAG,0BAA0B,GAAG,4BAA4B,CAAC;CAC3E;AAED;;;;;GAKG;AACH,MAAM,WAAW,mBAAoB,SAAQ,oBAAoB;IAChE,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CAClB;AAED;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACpC,IAAI,CAAC,KAAK,EAAE,mBAAmB,GAAG,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,oBAAY,sBAAsB,GAAG,SAAS,GAAG,OAAO,GAAG,aAAa,CAAC;AAEzE;;;;;;GAMG;AACH,oBAAY,0BAA0B,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;AAE/E;;;;GAIG;AACH,MAAM,WAAW,4BAA4B;IAC5C,KAAK,EAAE,0BAA0B,CAAC;IAClC,GAAG,EAAE,MAAM,CAAC;CACZ;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACpC,CAAC,KAAK,EAAE,MAAM,GAAG,0BAA0B,GAAG,4BAA4B,CAAC;CAC3E;AAED;;;;;GAKG;AACH,MAAM,WAAW,mBAAoB,SAAQ,oBAAoB;IAChE,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,0BAAkB,QAAQ;IACzB,OAAO,IAAI;IACX,OAAO,KAAK;IACZ,KAAK,KAAK;CACV;AAED;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACpC,IAAI,CAAC,KAAK,EAAE,mBAAmB,EAAE,QAAQ,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC;IAE5D,WAAW,CAAC,EAAE,QAAQ,CAAC;CACvB;AAED;;;GAGG;AACH,MAAM,WAAW,sBAAuB,SAAQ,oBAAoB;IACnE,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,sBAAsB,CAAC;CAClC;AAED;;;GAGG;AACH,MAAM,WAAW,oBAAqB,SAAQ,oBAAoB;IACjE,SAAS,EAAE,MAAM,CAAC;CAClB;AAED;;;GAGG;AACH,MAAM,WAAW,0BAA2B,SAAQ,sBAAsB;IACzE,QAAQ,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,aAAc,SAAQ,KAAK;IAC3C;;OAEG;IACH,sBAAsB,IAAI,oBAAoB,CAAC;CAC/C;AAED;;;;GAIG;AACH,MAAM,WAAW,gBAAiB,SAAQ,oBAAoB;IAC7D;;;;;OAKG;IACH,IAAI,CAAC,KAAK,EAAE,mBAAmB,EAAE,QAAQ,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC;IAE5D;;;;;OAKG;IAEH,kBAAkB,CACjB,KAAK,EAAE,sBAAsB,EAC7B,KAAK,CAAC,EAAE,GAAG,EACX,QAAQ,CAAC,EAAE,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,OAAO,GAC5C,IAAI,CAAC;IAER;;;;OAIG;IAEH,cAAc,CAAC,KAAK,EAAE,oBAAoB,EAAE,KAAK,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC;IAE/D;;;;;OAKG;IAEH,oBAAoB,CACnB,KAAK,EAAE,0BAA0B,EACjC,KAAK,CAAC,EAAE,GAAG,EACX,QAAQ,CAAC,EAAE,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,OAAO,GAC5C,IAAI,CAAC;CACR"}
|
package/lib/logger.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Examples of known categories, however category can be any string for extensibility.\n */\nexport type TelemetryEventCategory = \"generic\" | \"error\" | \"performance\";\n\n/**\n * Property types that can be logged.\n *\n * @remarks Logging entire objects is considered extremely dangerous from a telemetry point of view because people can\n * easily add fields to objects that shouldn't be logged and not realize it's going to be logged.\n * General best practice is to explicitly log the fields you care about from objects.\n */\nexport type TelemetryEventPropertyType = string | number | boolean | undefined;\n\n/**\n * A property to be logged to telemetry containing both the value and a tag. Tags are generic strings that can be used\n * to mark pieces of information that should be organized or handled differently by loggers in various first or third\n * party scenarios. For example, tags are used to mark data that should not be stored in logs for privacy reasons.\n */\nexport interface ITaggedTelemetryPropertyType {\n\tvalue: TelemetryEventPropertyType;\n\ttag: string;\n}\n\n/**\n * JSON-serializable properties, which will be logged with telemetry.\n */\nexport interface ITelemetryProperties {\n\t[index: string]: TelemetryEventPropertyType | ITaggedTelemetryPropertyType;\n}\n\n/**\n * Base interface for logging telemetry statements.\n * Can contain any number of properties that get serialized as json payload.\n * @param category - category of the event, like \"error\", \"performance\", \"generic\", etc.\n * @param eventName - name of the event.\n */\nexport interface ITelemetryBaseEvent extends ITelemetryProperties {\n\tcategory: string;\n\teventName: string;\n}\n\n/**\n * Interface to output telemetry events.\n * Implemented by hosting app / loader\n */\nexport interface ITelemetryBaseLogger {\n\tsend(event: ITelemetryBaseEvent): void;\n}\n\n/**\n * Informational (non-error) telemetry event\n * Maps to category = \"generic\"\n */\nexport interface ITelemetryGenericEvent extends ITelemetryProperties {\n\teventName: string;\n\tcategory?: TelemetryEventCategory;\n}\n\n/**\n * Error telemetry event.\n * Maps to category = \"error\"\n */\nexport interface ITelemetryErrorEvent extends ITelemetryProperties {\n\teventName: string;\n}\n\n/**\n * Performance telemetry event.\n * Maps to category = \"performance\"\n */\nexport interface ITelemetryPerformanceEvent extends ITelemetryGenericEvent {\n\tduration?: number; // Duration of event (optional)\n}\n\n/**\n * An error object that supports exporting its properties to be logged to telemetry\n */\nexport interface ILoggingError extends Error {\n\t/**\n\t * Return all properties from this object that should be logged to telemetry\n\t */\n\tgetTelemetryProperties(): ITelemetryProperties;\n}\n\n/**\n * ITelemetryLogger interface contains various helper telemetry methods,\n * encoding in one place schemas for various types of Fluid telemetry events.\n * Creates sub-logger that appends properties to all events\n */\nexport interface ITelemetryLogger extends ITelemetryBaseLogger {\n\t/**\n\t * Actual implementation that sends telemetry event\n\t * Implemented by derived classes\n\t * @param event - Telemetry event to send over\n\t */\n\tsend(event: ITelemetryBaseEvent): void;\n\n\t/**\n\t * Send information telemetry event\n\t * @param event - Event to send\n\t * @param error - optional error object to log\n\t */\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tsendTelemetryEvent(
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Examples of known categories, however category can be any string for extensibility.\n */\nexport type TelemetryEventCategory = \"generic\" | \"error\" | \"performance\";\n\n/**\n * Property types that can be logged.\n *\n * @remarks Logging entire objects is considered extremely dangerous from a telemetry point of view because people can\n * easily add fields to objects that shouldn't be logged and not realize it's going to be logged.\n * General best practice is to explicitly log the fields you care about from objects.\n */\nexport type TelemetryEventPropertyType = string | number | boolean | undefined;\n\n/**\n * A property to be logged to telemetry containing both the value and a tag. Tags are generic strings that can be used\n * to mark pieces of information that should be organized or handled differently by loggers in various first or third\n * party scenarios. For example, tags are used to mark data that should not be stored in logs for privacy reasons.\n */\nexport interface ITaggedTelemetryPropertyType {\n\tvalue: TelemetryEventPropertyType;\n\ttag: string;\n}\n\n/**\n * JSON-serializable properties, which will be logged with telemetry.\n */\nexport interface ITelemetryProperties {\n\t[index: string]: TelemetryEventPropertyType | ITaggedTelemetryPropertyType;\n}\n\n/**\n * Base interface for logging telemetry statements.\n * Can contain any number of properties that get serialized as json payload.\n * @param category - category of the event, like \"error\", \"performance\", \"generic\", etc.\n * @param eventName - name of the event.\n */\nexport interface ITelemetryBaseEvent extends ITelemetryProperties {\n\tcategory: string;\n\teventName: string;\n}\n\n/**\n * Enum to specify a level to the log to filter out logs based on the level.\n */\nexport const enum LogLevel {\n\tverbose = 0, // To log any verbose event for example when you are debugging something.\n\tdefault = 10, // Default log level\n\terror = 20, // To log errors.\n}\n\n/**\n * Interface to output telemetry events.\n * Implemented by hosting app / loader\n */\nexport interface ITelemetryBaseLogger {\n\tsend(event: ITelemetryBaseEvent, logLevel?: LogLevel): void;\n\n\tminLogLevel?: LogLevel;\n}\n\n/**\n * Informational (non-error) telemetry event\n * Maps to category = \"generic\"\n */\nexport interface ITelemetryGenericEvent extends ITelemetryProperties {\n\teventName: string;\n\tcategory?: TelemetryEventCategory;\n}\n\n/**\n * Error telemetry event.\n * Maps to category = \"error\"\n */\nexport interface ITelemetryErrorEvent extends ITelemetryProperties {\n\teventName: string;\n}\n\n/**\n * Performance telemetry event.\n * Maps to category = \"performance\"\n */\nexport interface ITelemetryPerformanceEvent extends ITelemetryGenericEvent {\n\tduration?: number; // Duration of event (optional)\n}\n\n/**\n * An error object that supports exporting its properties to be logged to telemetry\n */\nexport interface ILoggingError extends Error {\n\t/**\n\t * Return all properties from this object that should be logged to telemetry\n\t */\n\tgetTelemetryProperties(): ITelemetryProperties;\n}\n\n/**\n * ITelemetryLogger interface contains various helper telemetry methods,\n * encoding in one place schemas for various types of Fluid telemetry events.\n * Creates sub-logger that appends properties to all events\n */\nexport interface ITelemetryLogger extends ITelemetryBaseLogger {\n\t/**\n\t * Actual implementation that sends telemetry event\n\t * Implemented by derived classes\n\t * @param event - Telemetry event to send over\n\t * @param logLevel - optional level of the log.\n\t */\n\tsend(event: ITelemetryBaseEvent, logLevel?: LogLevel): void;\n\n\t/**\n\t * Send information telemetry event\n\t * @param event - Event to send\n\t * @param error - optional error object to log\n\t * @param logLevel - optional level of the log.\n\t */\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tsendTelemetryEvent(\n\t\tevent: ITelemetryGenericEvent,\n\t\terror?: any,\n\t\tlogLevel?: LogLevel.verbose | LogLevel.default,\n\t): void;\n\n\t/**\n\t * Send error telemetry event\n\t * @param event - Event to send\n\t * @param error - optional error object to log\n\t */\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tsendErrorEvent(event: ITelemetryErrorEvent, error?: any): void;\n\n\t/**\n\t * Send performance telemetry event\n\t * @param event - Event to send\n\t * @param error - optional error object to log\n\t * @param logLevel - optional level of the log.\n\t */\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tsendPerformanceEvent(\n\t\tevent: ITelemetryPerformanceEvent,\n\t\terror?: any,\n\t\tlogLevel?: LogLevel.verbose | LogLevel.default,\n\t): void;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/core-interfaces",
|
|
3
|
-
"version": "2.0.0-internal.6.
|
|
3
|
+
"version": "2.0.0-internal.6.2.0",
|
|
4
4
|
"description": "Fluid object interfaces",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -15,11 +15,11 @@
|
|
|
15
15
|
"module": "lib/index.js",
|
|
16
16
|
"types": "dist/index.d.ts",
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@fluid-tools/build-cli": "^0.
|
|
18
|
+
"@fluid-tools/build-cli": "^0.23.0",
|
|
19
19
|
"@fluidframework/build-common": "^2.0.0",
|
|
20
|
-
"@fluidframework/build-tools": "^0.
|
|
21
|
-
"@fluidframework/core-interfaces-previous": "npm:@fluidframework/core-interfaces@2.0.0-internal.6.
|
|
22
|
-
"@fluidframework/eslint-config-fluid": "^2.
|
|
20
|
+
"@fluidframework/build-tools": "^0.23.0",
|
|
21
|
+
"@fluidframework/core-interfaces-previous": "npm:@fluidframework/core-interfaces@2.0.0-internal.6.1.1",
|
|
22
|
+
"@fluidframework/eslint-config-fluid": "^2.1.0",
|
|
23
23
|
"@microsoft/api-extractor": "^7.34.4",
|
|
24
24
|
"@types/node": "^16.18.38",
|
|
25
25
|
"concurrently": "^7.6.0",
|
package/src/error.ts
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { ITelemetryProperties } from "./index";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Error types the Fluid Framework may report.
|
|
10
|
+
*/
|
|
11
|
+
export const FluidErrorTypes = {
|
|
12
|
+
/**
|
|
13
|
+
* Some error, most likely an exception caught by runtime and propagated to container as critical error
|
|
14
|
+
*/
|
|
15
|
+
genericError: "genericError",
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Throttling error from server. Server is busy and is asking not to reconnect for some time
|
|
19
|
+
*/
|
|
20
|
+
throttlingError: "throttlingError",
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Data loss error detected by Container / DeltaManager. Likely points to storage issue.
|
|
24
|
+
*/
|
|
25
|
+
dataCorruptionError: "dataCorruptionError",
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Error encountered when processing an operation. May correlate with data corruption.
|
|
29
|
+
*/
|
|
30
|
+
dataProcessingError: "dataProcessingError",
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Error indicating an API is being used improperly resulting in an invalid operation.
|
|
34
|
+
*/
|
|
35
|
+
usageError: "usageError",
|
|
36
|
+
} as const;
|
|
37
|
+
export type FluidErrorTypes = typeof FluidErrorTypes[keyof typeof FluidErrorTypes];
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Base interface for all errors and warnings emitted the container.
|
|
41
|
+
*
|
|
42
|
+
* @remarks
|
|
43
|
+
*
|
|
44
|
+
* We are in the process of unifying error types across layers of the Framework. For now we have only migrated
|
|
45
|
+
* those from container-definitions. Once fully migrated, this will be a base interface for all errors and
|
|
46
|
+
* warnings emitted by the Fluid Framework. Currently only the container layer is using IErrorBase.
|
|
47
|
+
* Runtime and others will follow soon.
|
|
48
|
+
*/
|
|
49
|
+
export interface IErrorBase extends Partial<Error> {
|
|
50
|
+
/**
|
|
51
|
+
* A type tag differentiating kinds of errors emitted by the container.
|
|
52
|
+
*
|
|
53
|
+
* @see See {@link FluidErrorTypes#genericError} for some common examples.
|
|
54
|
+
* - container
|
|
55
|
+
* - runtime
|
|
56
|
+
* - drivers
|
|
57
|
+
*/
|
|
58
|
+
readonly errorType: string;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* See {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error | Error.message}
|
|
62
|
+
*
|
|
63
|
+
* @remarks
|
|
64
|
+
*
|
|
65
|
+
* Privacy Note - This is a freeform string that we may not control in all cases (e.g. a dependency throws an error)
|
|
66
|
+
* If there are known cases where this contains privacy-sensitive data it will be tagged and included in the result
|
|
67
|
+
* of getTelemetryProperties. When logging, consider fetching it that way rather than straight from this field.
|
|
68
|
+
*/
|
|
69
|
+
readonly message: string;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* See {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/name | Error.name}
|
|
73
|
+
*/
|
|
74
|
+
readonly name?: string;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* See {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/stack | Error.stack}
|
|
78
|
+
*/
|
|
79
|
+
readonly stack?: string;
|
|
80
|
+
/**
|
|
81
|
+
* Returns all properties of this error object that are either safe to log
|
|
82
|
+
* or not explicitly tagged as containing privacy-sensitive data.
|
|
83
|
+
*/
|
|
84
|
+
getTelemetryProperties?(): ITelemetryProperties;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Generic wrapper for an unrecognized/uncategorized error object
|
|
89
|
+
*/
|
|
90
|
+
export interface IGenericError extends IErrorBase {
|
|
91
|
+
/**
|
|
92
|
+
* {@inheritDoc IErrorBase.errorType}
|
|
93
|
+
*/
|
|
94
|
+
readonly errorType: typeof FluidErrorTypes.genericError;
|
|
95
|
+
error?: any;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Error indicating an API is being used improperly resulting in an invalid operation.
|
|
100
|
+
*/
|
|
101
|
+
export interface IUsageError extends IErrorBase {
|
|
102
|
+
/**
|
|
103
|
+
* {@inheritDoc IErrorBase.errorType}
|
|
104
|
+
*/
|
|
105
|
+
readonly errorType: typeof FluidErrorTypes.usageError;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Warning emitted when requests to storage are being throttled
|
|
110
|
+
*/
|
|
111
|
+
export interface IThrottlingWarning extends IErrorBase {
|
|
112
|
+
/**
|
|
113
|
+
* {@inheritDoc IErrorBase.errorType}
|
|
114
|
+
*/
|
|
115
|
+
readonly errorType: typeof FluidErrorTypes.throttlingError;
|
|
116
|
+
readonly retryAfterSeconds: number;
|
|
117
|
+
}
|