@fluidframework/core-interfaces 2.0.0-dev.5.3.2.178189 → 2.0.0-dev.6.4.0.191457
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/.eslintrc.js +1 -1
- package/CHANGELOG.md +75 -0
- package/README.md +4 -3
- package/Removing-IFluidRouter.md +113 -0
- 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 +251 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +7 -0
- package/dist/events.js.map +1 -0
- package/dist/fluidLoadable.d.ts.map +1 -1
- package/dist/fluidLoadable.js.map +1 -1
- package/dist/fluidPackage.d.ts +1 -1
- package/dist/fluidPackage.d.ts.map +1 -1
- package/dist/fluidPackage.js +7 -4
- package/dist/fluidPackage.js.map +1 -1
- package/dist/fluidRouter.d.ts.map +1 -1
- package/dist/fluidRouter.js.map +1 -1
- package/dist/index.d.ts +13 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -5
- package/dist/index.js.map +1 -1
- package/dist/logger.d.ts +64 -9
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js +9 -0
- package/dist/logger.js.map +1 -1
- package/dist/provider.d.ts +11 -5
- package/dist/provider.d.ts.map +1 -1
- package/dist/provider.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 +251 -0
- package/lib/events.d.ts.map +1 -0
- package/lib/events.js +6 -0
- package/lib/events.js.map +1 -0
- package/lib/fluidLoadable.d.ts.map +1 -1
- package/lib/fluidLoadable.js.map +1 -1
- package/lib/fluidPackage.d.ts +1 -1
- package/lib/fluidPackage.d.ts.map +1 -1
- package/lib/fluidPackage.js +7 -4
- package/lib/fluidPackage.js.map +1 -1
- package/lib/fluidRouter.d.ts.map +1 -1
- package/lib/fluidRouter.js.map +1 -1
- package/lib/index.d.ts +13 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +3 -1
- package/lib/index.js.map +1 -1
- package/lib/logger.d.ts +64 -9
- package/lib/logger.d.ts.map +1 -1
- package/lib/logger.js +8 -1
- package/lib/logger.js.map +1 -1
- package/lib/provider.d.ts +11 -5
- package/lib/provider.d.ts.map +1 -1
- package/lib/provider.js.map +1 -1
- package/package.json +8 -9
- package/src/error.ts +121 -0
- package/src/events.ts +432 -0
- package/src/fluidLoadable.ts +2 -0
- package/src/fluidPackage.ts +5 -2
- package/src/fluidRouter.ts +6 -0
- package/src/index.ts +45 -21
- package/src/logger.ts +82 -11
- package/src/provider.ts +11 -5
package/lib/fluidRouter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fluidRouter.js","sourceRoot":"","sources":["../src/fluidRouter.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"fluidRouter.js","sourceRoot":"","sources":["../src/fluidRouter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAyBH,MAAM,CAAC,MAAM,YAAY,GAA8B,cAAc,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport interface IRequestHeader {\n\t// TODO: Use `unknown` instead (API-Breaking)\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t[index: string]: any;\n}\n\nexport interface IRequest {\n\turl: string;\n\theaders?: IRequestHeader;\n}\n\nexport interface IResponse {\n\tmimeType: string;\n\tstatus: number;\n\t// TODO: Use `unknown` instead (API-Breaking)\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tvalue: any;\n\t// TODO: Use `unknown` instead (API-Breaking)\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\theaders?: { [key: string]: any };\n\tstack?: string;\n}\n\nexport const IFluidRouter: keyof IProvideFluidRouter = \"IFluidRouter\";\n\n/**\n * Request routing\n */\nexport interface IProvideFluidRouter {\n\treadonly IFluidRouter: IFluidRouter;\n}\nexport interface IFluidRouter extends IProvideFluidRouter {\n\trequest(request: IRequest): Promise<IResponse>;\n}\n"]}
|
package/lib/index.d.ts
CHANGED
|
@@ -2,11 +2,21 @@
|
|
|
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 {
|
|
12
|
+
export type { ILoggingError, ITaggedTelemetryPropertyType, // deprecated
|
|
13
|
+
ITelemetryBaseEvent, ITelemetryBaseLogger, ITelemetryBaseProperties, ITelemetryErrorEvent, // deprecated
|
|
14
|
+
ITelemetryGenericEvent, // deprecated
|
|
15
|
+
ITelemetryLogger, // deprecated
|
|
16
|
+
ITelemetryPerformanceEvent, // deprecated
|
|
17
|
+
ITelemetryProperties, // deprecated
|
|
18
|
+
Tagged, TelemetryEventCategory, // deprecated
|
|
19
|
+
TelemetryBaseEventPropertyType, TelemetryEventPropertyType, } from "./logger";
|
|
20
|
+
export { LogLevel } from "./logger";
|
|
9
21
|
export { FluidObjectProviderKeys, FluidObject, FluidObjectKeys } from "./provider";
|
|
10
|
-
export type { IDisposable } from "./disposable";
|
|
11
|
-
export type { ILoggingError, ITaggedTelemetryPropertyType, ITelemetryBaseEvent, ITelemetryBaseLogger, ITelemetryErrorEvent, ITelemetryGenericEvent, ITelemetryLogger, ITelemetryPerformanceEvent, ITelemetryProperties, TelemetryEventCategory, TelemetryEventPropertyType, } from "./logger";
|
|
12
22
|
//# 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,EAAE,aAAa;AAC3C,mBAAmB,EACnB,oBAAoB,EACpB,wBAAwB,EACxB,oBAAoB,EAAE,aAAa;AACnC,sBAAsB,EAAE,aAAa;AACrC,gBAAgB,EAAE,aAAa;AAC/B,0BAA0B,EAAE,aAAa;AACzC,oBAAoB,EAAE,aAAa;AACnC,MAAM,EACN,sBAAsB,EAAE,aAAa;AACrC,8BAA8B,EAC9B,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,13 @@
|
|
|
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 {
|
|
13
|
+
export { LogLevel } from "./logger";
|
|
12
14
|
//# 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;AAkBnB,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,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, // deprecated\n\tITelemetryBaseEvent,\n\tITelemetryBaseLogger,\n\tITelemetryBaseProperties,\n\tITelemetryErrorEvent, // deprecated\n\tITelemetryGenericEvent, // deprecated\n\tITelemetryLogger, // deprecated\n\tITelemetryPerformanceEvent, // deprecated\n\tITelemetryProperties, // deprecated\n\tTagged,\n\tTelemetryEventCategory, // deprecated\n\tTelemetryBaseEventPropertyType,\n\tTelemetryEventPropertyType, // deprecated\n} from \"./logger\";\nexport { LogLevel } from \"./logger\";\nexport { FluidObjectProviderKeys, FluidObject, FluidObjectKeys } from \"./provider\";\n"]}
|
package/lib/logger.d.ts
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
6
|
* Examples of known categories, however category can be any string for extensibility.
|
|
7
|
+
*
|
|
8
|
+
* @deprecated Moved to \@fluidframework/telemetry-utils package
|
|
7
9
|
*/
|
|
8
10
|
export declare type TelemetryEventCategory = "generic" | "error" | "performance";
|
|
9
11
|
/**
|
|
@@ -13,12 +15,29 @@ export declare type TelemetryEventCategory = "generic" | "error" | "performance"
|
|
|
13
15
|
* easily add fields to objects that shouldn't be logged and not realize it's going to be logged.
|
|
14
16
|
* General best practice is to explicitly log the fields you care about from objects.
|
|
15
17
|
*/
|
|
18
|
+
export declare type TelemetryBaseEventPropertyType = TelemetryEventPropertyType;
|
|
19
|
+
/**
|
|
20
|
+
* {@inheritDoc TelemetryBaseEventPropertyType}
|
|
21
|
+
*
|
|
22
|
+
* @deprecated Renamed to {@link TelemetryBaseEventPropertyType}
|
|
23
|
+
*/
|
|
16
24
|
export declare type TelemetryEventPropertyType = string | number | boolean | undefined;
|
|
17
25
|
/**
|
|
18
|
-
* A property to be logged to telemetry
|
|
19
|
-
*
|
|
26
|
+
* A property to be logged to telemetry may require a tag indicating the value may contain sensitive data.
|
|
27
|
+
* This type wraps a value of the given type V in an object along with a string tag (type can be further specified as T).
|
|
28
|
+
*
|
|
29
|
+
* This indicates that the value should be organized or handled differently by loggers in various first or third
|
|
20
30
|
* party scenarios. For example, tags are used to mark data that should not be stored in logs for privacy reasons.
|
|
21
31
|
*/
|
|
32
|
+
export interface Tagged<V, T extends string = string> {
|
|
33
|
+
value: V;
|
|
34
|
+
tag: T;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* @see {@link Tagged} for info on tagging
|
|
38
|
+
*
|
|
39
|
+
* @deprecated Use Tagged\<TelemetryBaseEventPropertyType\>
|
|
40
|
+
*/
|
|
22
41
|
export interface ITaggedTelemetryPropertyType {
|
|
23
42
|
value: TelemetryEventPropertyType;
|
|
24
43
|
tag: string;
|
|
@@ -26,8 +45,14 @@ export interface ITaggedTelemetryPropertyType {
|
|
|
26
45
|
/**
|
|
27
46
|
* JSON-serializable properties, which will be logged with telemetry.
|
|
28
47
|
*/
|
|
48
|
+
export declare type ITelemetryBaseProperties = ITelemetryProperties;
|
|
49
|
+
/**
|
|
50
|
+
* {@inheritDoc ITelemetryBaseProperties}
|
|
51
|
+
*
|
|
52
|
+
* @deprecated Renamed to {@link ITelemetryBaseProperties}
|
|
53
|
+
*/
|
|
29
54
|
export interface ITelemetryProperties {
|
|
30
|
-
[index: string]: TelemetryEventPropertyType |
|
|
55
|
+
[index: string]: TelemetryEventPropertyType | Tagged<TelemetryEventPropertyType>;
|
|
31
56
|
}
|
|
32
57
|
/**
|
|
33
58
|
* Base interface for logging telemetry statements.
|
|
@@ -35,20 +60,36 @@ export interface ITelemetryProperties {
|
|
|
35
60
|
* @param category - category of the event, like "error", "performance", "generic", etc.
|
|
36
61
|
* @param eventName - name of the event.
|
|
37
62
|
*/
|
|
38
|
-
export interface ITelemetryBaseEvent extends
|
|
63
|
+
export interface ITelemetryBaseEvent extends ITelemetryBaseProperties {
|
|
39
64
|
category: string;
|
|
40
65
|
eventName: string;
|
|
41
66
|
}
|
|
67
|
+
/**
|
|
68
|
+
* Specify levels of the logs.
|
|
69
|
+
*/
|
|
70
|
+
export declare const LogLevel: {
|
|
71
|
+
readonly verbose: 10;
|
|
72
|
+
readonly default: 20;
|
|
73
|
+
readonly error: 30;
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* Specify a level to the log to filter out logs based on the level.
|
|
77
|
+
*/
|
|
78
|
+
export declare type LogLevel = typeof LogLevel[keyof typeof LogLevel];
|
|
42
79
|
/**
|
|
43
80
|
* Interface to output telemetry events.
|
|
44
81
|
* Implemented by hosting app / loader
|
|
45
82
|
*/
|
|
46
83
|
export interface ITelemetryBaseLogger {
|
|
47
|
-
send(event: ITelemetryBaseEvent): void;
|
|
84
|
+
send(event: ITelemetryBaseEvent, logLevel?: LogLevel): void;
|
|
85
|
+
minLogLevel?: LogLevel;
|
|
48
86
|
}
|
|
49
87
|
/**
|
|
50
88
|
* Informational (non-error) telemetry event
|
|
51
89
|
* Maps to category = "generic"
|
|
90
|
+
*
|
|
91
|
+
* @deprecated For internal use within FluidFramework, use ITelemetryGenericEventExt in \@fluidframework/telemetry-utils.
|
|
92
|
+
* No replacement intended for FluidFramework consumers.
|
|
52
93
|
*/
|
|
53
94
|
export interface ITelemetryGenericEvent extends ITelemetryProperties {
|
|
54
95
|
eventName: string;
|
|
@@ -57,6 +98,9 @@ export interface ITelemetryGenericEvent extends ITelemetryProperties {
|
|
|
57
98
|
/**
|
|
58
99
|
* Error telemetry event.
|
|
59
100
|
* Maps to category = "error"
|
|
101
|
+
*
|
|
102
|
+
* @deprecated For internal use within FluidFramework, use ITelemetryErrorEventExt in \@fluidframework/telemetry-utils.
|
|
103
|
+
* No replacement intended for FluidFramework consumers.
|
|
60
104
|
*/
|
|
61
105
|
export interface ITelemetryErrorEvent extends ITelemetryProperties {
|
|
62
106
|
eventName: string;
|
|
@@ -64,6 +108,9 @@ export interface ITelemetryErrorEvent extends ITelemetryProperties {
|
|
|
64
108
|
/**
|
|
65
109
|
* Performance telemetry event.
|
|
66
110
|
* Maps to category = "performance"
|
|
111
|
+
*
|
|
112
|
+
* @deprecated For internal use within FluidFramework, use ITelemetryPerformanceEventExt in \@fluidframework/telemetry-utils.
|
|
113
|
+
* No replacement intended for FluidFramework consumers.
|
|
67
114
|
*/
|
|
68
115
|
export interface ITelemetryPerformanceEvent extends ITelemetryGenericEvent {
|
|
69
116
|
duration?: number;
|
|
@@ -75,35 +122,43 @@ export interface ILoggingError extends Error {
|
|
|
75
122
|
/**
|
|
76
123
|
* Return all properties from this object that should be logged to telemetry
|
|
77
124
|
*/
|
|
78
|
-
getTelemetryProperties():
|
|
125
|
+
getTelemetryProperties(): ITelemetryBaseProperties;
|
|
79
126
|
}
|
|
80
127
|
/**
|
|
81
128
|
* ITelemetryLogger interface contains various helper telemetry methods,
|
|
82
129
|
* encoding in one place schemas for various types of Fluid telemetry events.
|
|
83
130
|
* Creates sub-logger that appends properties to all events
|
|
131
|
+
*
|
|
132
|
+
* @deprecated For internal use within FluidFramework, use ITelemetryLoggerExt in \@fluidframework/telemetry-utils.
|
|
133
|
+
* No replacement intended for FluidFramework consumers.
|
|
84
134
|
*/
|
|
85
135
|
export interface ITelemetryLogger extends ITelemetryBaseLogger {
|
|
86
136
|
/**
|
|
87
137
|
* Actual implementation that sends telemetry event
|
|
88
138
|
* Implemented by derived classes
|
|
89
139
|
* @param event - Telemetry event to send over
|
|
140
|
+
* @param logLevel - optional level of the log.
|
|
90
141
|
*/
|
|
91
|
-
send(event: ITelemetryBaseEvent): void;
|
|
142
|
+
send(event: ITelemetryBaseEvent, logLevel?: LogLevel): void;
|
|
92
143
|
/**
|
|
93
144
|
* Send information telemetry event
|
|
94
145
|
* @param event - Event to send
|
|
95
146
|
* @param error - optional error object to log
|
|
147
|
+
* @param logLevel - optional level of the log.
|
|
96
148
|
*/
|
|
97
|
-
sendTelemetryEvent(event: ITelemetryGenericEvent, error?: any): void;
|
|
149
|
+
sendTelemetryEvent(event: ITelemetryGenericEvent, error?: any, logLevel?: typeof LogLevel.verbose | typeof LogLevel.default): void;
|
|
98
150
|
/**
|
|
99
151
|
* Send error telemetry event
|
|
100
152
|
* @param event - Event to send
|
|
153
|
+
* @param error - optional error object to log
|
|
101
154
|
*/
|
|
102
155
|
sendErrorEvent(event: ITelemetryErrorEvent, error?: any): void;
|
|
103
156
|
/**
|
|
104
157
|
* Send performance telemetry event
|
|
105
158
|
* @param event - Event to send
|
|
159
|
+
* @param error - optional error object to log
|
|
160
|
+
* @param logLevel - optional level of the log.
|
|
106
161
|
*/
|
|
107
|
-
sendPerformanceEvent(event: ITelemetryPerformanceEvent, error?: any): void;
|
|
162
|
+
sendPerformanceEvent(event: ITelemetryPerformanceEvent, error?: any, logLevel?: typeof LogLevel.verbose | typeof LogLevel.default): void;
|
|
108
163
|
}
|
|
109
164
|
//# 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
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;GAIG;AACH,oBAAY,sBAAsB,GAAG,SAAS,GAAG,OAAO,GAAG,aAAa,CAAC;AAEzE;;;;;;GAMG;AACH,oBAAY,8BAA8B,GAAG,0BAA0B,CAAC;AAExE;;;;GAIG;AACH,oBAAY,0BAA0B,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;AAE/E;;;;;;GAMG;AACH,MAAM,WAAW,MAAM,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,GAAG,MAAM;IACnD,KAAK,EAAE,CAAC,CAAC;IACT,GAAG,EAAE,CAAC,CAAC;CACP;AAED;;;;GAIG;AACH,MAAM,WAAW,4BAA4B;IAC5C,KAAK,EAAE,0BAA0B,CAAC;IAClC,GAAG,EAAE,MAAM,CAAC;CACZ;AAED;;GAEG;AACH,oBAAY,wBAAwB,GAAG,oBAAoB,CAAC;AAE5D;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACpC,CAAC,KAAK,EAAE,MAAM,GAAG,0BAA0B,GAAG,MAAM,CAAC,0BAA0B,CAAC,CAAC;CACjF;AAED;;;;;GAKG;AACH,MAAM,WAAW,mBAAoB,SAAQ,wBAAwB;IACpE,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,eAAO,MAAM,QAAQ;;;;CAIX,CAAC;AAEX;;GAEG;AACH,oBAAY,QAAQ,GAAG,OAAO,QAAQ,CAAC,MAAM,OAAO,QAAQ,CAAC,CAAC;AAE9D;;;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;;;;;;GAMG;AACH,MAAM,WAAW,sBAAuB,SAAQ,oBAAoB;IACnE,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,sBAAsB,CAAC;CAClC;AAED;;;;;;GAMG;AACH,MAAM,WAAW,oBAAqB,SAAQ,oBAAoB;IACjE,SAAS,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;GAMG;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,wBAAwB,CAAC;CACnD;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,gBAAiB,SAAQ,oBAAoB;IAC7D;;;;;OAKG;IACH,IAAI,CAAC,KAAK,EAAE,mBAAmB,EAAE,QAAQ,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC;IAE5D;;;;;OAKG;IACH,kBAAkB,CACjB,KAAK,EAAE,sBAAsB,EAG7B,KAAK,CAAC,EAAE,GAAG,EACX,QAAQ,CAAC,EAAE,OAAO,QAAQ,CAAC,OAAO,GAAG,OAAO,QAAQ,CAAC,OAAO,GAC1D,IAAI,CAAC;IAER;;;;OAIG;IAEH,cAAc,CAAC,KAAK,EAAE,oBAAoB,EAAE,KAAK,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC;IAE/D;;;;;OAKG;IACH,oBAAoB,CACnB,KAAK,EAAE,0BAA0B,EAGjC,KAAK,CAAC,EAAE,GAAG,EACX,QAAQ,CAAC,EAAE,OAAO,QAAQ,CAAC,OAAO,GAAG,OAAO,QAAQ,CAAC,OAAO,GAC1D,IAAI,CAAC;CACR"}
|
package/lib/logger.js
CHANGED
|
@@ -2,5 +2,12 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Specify levels of the logs.
|
|
7
|
+
*/
|
|
8
|
+
export const LogLevel = {
|
|
9
|
+
verbose: 10,
|
|
10
|
+
default: 20,
|
|
11
|
+
error: 30, // To log errors.
|
|
12
|
+
};
|
|
6
13
|
//# sourceMappingURL=logger.js.map
|
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
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAwEH;;GAEG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG;IACvB,OAAO,EAAE,EAAE;IACX,OAAO,EAAE,EAAE;IACX,KAAK,EAAE,EAAE,EAAE,iBAAiB;CACnB,CAAC","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 *\n * @deprecated Moved to \\@fluidframework/telemetry-utils package\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 TelemetryBaseEventPropertyType = TelemetryEventPropertyType;\n\n/**\n * {@inheritDoc TelemetryBaseEventPropertyType}\n *\n * @deprecated Renamed to {@link TelemetryBaseEventPropertyType}\n */\nexport type TelemetryEventPropertyType = string | number | boolean | undefined;\n\n/**\n * A property to be logged to telemetry may require a tag indicating the value may contain sensitive data.\n * This type wraps a value of the given type V in an object along with a string tag (type can be further specified as T).\n *\n * This indicates that the value 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 Tagged<V, T extends string = string> {\n\tvalue: V;\n\ttag: T;\n}\n\n/**\n * @see {@link Tagged} for info on tagging\n *\n * @deprecated Use Tagged\\<TelemetryBaseEventPropertyType\\>\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 type ITelemetryBaseProperties = ITelemetryProperties;\n\n/**\n * {@inheritDoc ITelemetryBaseProperties}\n *\n * @deprecated Renamed to {@link ITelemetryBaseProperties}\n */\nexport interface ITelemetryProperties {\n\t[index: string]: TelemetryEventPropertyType | Tagged<TelemetryEventPropertyType>;\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 ITelemetryBaseProperties {\n\tcategory: string;\n\teventName: string;\n}\n\n/**\n * Specify levels of the logs.\n */\nexport const LogLevel = {\n\tverbose: 10, // To log any verbose event for example when you are debugging something.\n\tdefault: 20, // Default log level\n\terror: 30, // To log errors.\n} as const;\n\n/**\n * Specify a level to the log to filter out logs based on the level.\n */\nexport type LogLevel = typeof LogLevel[keyof typeof LogLevel];\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 *\n * @deprecated For internal use within FluidFramework, use ITelemetryGenericEventExt in \\@fluidframework/telemetry-utils.\n * No replacement intended for FluidFramework consumers.\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 *\n * @deprecated For internal use within FluidFramework, use ITelemetryErrorEventExt in \\@fluidframework/telemetry-utils.\n * No replacement intended for FluidFramework consumers.\n */\nexport interface ITelemetryErrorEvent extends ITelemetryProperties {\n\teventName: string;\n}\n\n/**\n * Performance telemetry event.\n * Maps to category = \"performance\"\n *\n * @deprecated For internal use within FluidFramework, use ITelemetryPerformanceEventExt in \\@fluidframework/telemetry-utils.\n * No replacement intended for FluidFramework consumers.\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(): ITelemetryBaseProperties;\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 *\n * @deprecated For internal use within FluidFramework, use ITelemetryLoggerExt in \\@fluidframework/telemetry-utils.\n * No replacement intended for FluidFramework consumers.\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\tsendTelemetryEvent(\n\t\tevent: ITelemetryGenericEvent,\n\t\t// TODO: Use `unknown` instead (API-Breaking)\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\terror?: any,\n\t\tlogLevel?: typeof LogLevel.verbose | typeof 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\tsendPerformanceEvent(\n\t\tevent: ITelemetryPerformanceEvent,\n\t\t// TODO: Use `unknown` instead (API-Breaking)\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\terror?: any,\n\t\tlogLevel?: typeof LogLevel.verbose | typeof LogLevel.default,\n\t): void;\n}\n"]}
|
package/lib/provider.d.ts
CHANGED
|
@@ -3,13 +3,18 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
|
-
* This utility type is meant for internal use by {@link FluidObject}
|
|
7
6
|
* Produces a valid FluidObject key given a type and a property.
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
*
|
|
8
10
|
* A valid FluidObject key is a property that exists on the incoming type
|
|
9
11
|
* as well as on the type of the property itself. For example: `IProvideFoo.IFoo.IFoo`
|
|
10
12
|
* This aligns with the FluidObject pattern expected to be used with all FluidObjects.
|
|
11
13
|
*
|
|
14
|
+
* This utility type is meant for internal use by {@link FluidObject}
|
|
15
|
+
*
|
|
12
16
|
* @example
|
|
17
|
+
*
|
|
13
18
|
* ```typescript
|
|
14
19
|
* interface IProvideFoo{
|
|
15
20
|
* IFoo: IFoo
|
|
@@ -18,10 +23,9 @@
|
|
|
18
23
|
* foobar();
|
|
19
24
|
* }
|
|
20
25
|
* ```
|
|
21
|
-
* This pattern enables discovery, and delegation in a standard way which is central
|
|
22
|
-
* to FluidObject pattern
|
|
23
26
|
*
|
|
24
|
-
*
|
|
27
|
+
* This pattern enables discovery, and delegation in a standard way which is central
|
|
28
|
+
* to FluidObject pattern.
|
|
25
29
|
*/
|
|
26
30
|
export declare type FluidObjectProviderKeys<T, TProp extends keyof T = keyof T> = string extends TProp ? never : number extends TProp ? never : TProp extends keyof Required<T>[TProp] ? Required<T>[TProp] extends Required<Required<T>[TProp]>[TProp] ? TProp : never : never;
|
|
27
31
|
/**
|
|
@@ -33,7 +37,9 @@ export declare type FluidObjectProviderKeys<T, TProp extends keyof T = keyof T>
|
|
|
33
37
|
* FluidObject without a generic argument.
|
|
34
38
|
*
|
|
35
39
|
* @example
|
|
36
|
-
*
|
|
40
|
+
*
|
|
41
|
+
* For example, if we have an interface like the following:
|
|
42
|
+
*
|
|
37
43
|
* ```typescript
|
|
38
44
|
* interface IProvideFoo{
|
|
39
45
|
* IFoo: IFoo
|
package/lib/provider.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,oBAAY,uBAAuB,CAAC,CAAC,EAAE,KAAK,SAAS,MAAM,CAAC,GAAG,MAAM,CAAC,IAAI,MAAM,SAAS,KAAK,GAC3F,KAAK,GACL,MAAM,SAAS,KAAK,GACpB,KAAK,GACL,KAAK,SAAS,MAAM,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GACtC,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,GAC7D,KAAK,GACL,KAAK,GACN,KAAK,CAAC;AAET;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,oBAAY,WAAW,CAAC,CAAC,GAAG,OAAO,IAAI;KACrC,CAAC,IAAI,uBAAuB,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;CACxC,CAAC;AAEF;;;;;;;;GAQG;AACH,oBAAY,eAAe,CAAC,CAAC,IAAI,MAAM,WAAW,CAAC,CAAC,CAAC,CAAC"}
|
package/lib/provider.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../src/provider.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 *
|
|
1
|
+
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../src/provider.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 * Produces a valid FluidObject key given a type and a property.\n *\n * @remarks\n *\n * A valid FluidObject key is a property that exists on the incoming type\n * as well as on the type of the property itself. For example: `IProvideFoo.IFoo.IFoo`\n * This aligns with the FluidObject pattern expected to be used with all FluidObjects.\n *\n * This utility type is meant for internal use by {@link FluidObject}\n *\n * @example\n *\n * ```typescript\n * interface IProvideFoo{\n * IFoo: IFoo\n * }\n * interface IFoo extends IProvideFoo{\n * foobar();\n * }\n * ```\n *\n * This pattern enables discovery, and delegation in a standard way which is central\n * to FluidObject pattern.\n */\nexport type FluidObjectProviderKeys<T, TProp extends keyof T = keyof T> = string extends TProp\n\t? never\n\t: number extends TProp\n\t? never // exclude indexers [key:string |number]: any\n\t: TProp extends keyof Required<T>[TProp] // TProp is a property of T, and T[TProp]\n\t? Required<T>[TProp] extends Required<Required<T>[TProp]>[TProp] // T[TProp] is the same type as T[TProp][TProp]\n\t\t? TProp\n\t\t: never\n\t: never;\n\n/**\n * This utility type take interface(s) that follow the FluidObject pattern, and produces\n * a new type that can be used for inspection and discovery of those interfaces.\n *\n * It is meant to be used with types that are known to implement the FluidObject pattern.\n * A common way to specify a type implements the FluidObject pattern is to expose it as a\n * FluidObject without a generic argument.\n *\n * @example\n *\n * For example, if we have an interface like the following:\n *\n * ```typescript\n * interface IProvideFoo{\n * IFoo: IFoo\n * }\n * interface IFoo extends IProvideFoo{\n * foobar();\n * }\n * ```\n *\n * and a function that returns a FluidObject. You would do the following\n *\n * `const maybeFoo: FluidObject<IFoo> = getFluidObject()`;\n *\n * Either IFoo or IProvideFoo are valid generic arguments. In both case\n * maybeFoo will be of type `{IFoo?: IFoo}`. If IFoo is not undefined,\n * then the FluidObject provides IFoo, and it can be used.\n *\n * You can inspect multiple types via a intersection. For example:\n * `FluidObject<IFoo & IBar>`\n *\n */\nexport type FluidObject<T = unknown> = {\n\t[P in FluidObjectProviderKeys<T>]?: T[P];\n};\n\n/**\n * This utility type creates a type that is the union of all keys on the generic type\n * which implement the FluidObject pattern.\n *\n * See {@link FluidObject}\n *\n * For example `FluidObjectKeys<IFoo & IBar>` would result in `\"IFoo\" | \"IBar\"`\n *\n */\nexport type FluidObjectKeys<T> = keyof FluidObject<T>;\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/core-interfaces",
|
|
3
|
-
"version": "2.0.0-dev.
|
|
3
|
+
"version": "2.0.0-dev.6.4.0.191457",
|
|
4
4
|
"description": "Fluid object interfaces",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -15,14 +15,13 @@
|
|
|
15
15
|
"module": "lib/index.js",
|
|
16
16
|
"types": "dist/index.d.ts",
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@fluid-tools/build-cli": "^0.
|
|
19
|
-
"@fluidframework/build-common": "^
|
|
20
|
-
"@fluidframework/build-tools": "^0.
|
|
21
|
-
"@fluidframework/core-interfaces-previous": "npm:@fluidframework/core-interfaces@2.0.0-internal.
|
|
22
|
-
"@fluidframework/eslint-config-fluid": "^2.
|
|
18
|
+
"@fluid-tools/build-cli": "^0.22.0",
|
|
19
|
+
"@fluidframework/build-common": "^2.0.0",
|
|
20
|
+
"@fluidframework/build-tools": "^0.22.0",
|
|
21
|
+
"@fluidframework/core-interfaces-previous": "npm:@fluidframework/core-interfaces@2.0.0-internal.6.3.0",
|
|
22
|
+
"@fluidframework/eslint-config-fluid": "^2.1.0",
|
|
23
23
|
"@microsoft/api-extractor": "^7.34.4",
|
|
24
|
-
"@types/node": "^
|
|
25
|
-
"concurrently": "^7.6.0",
|
|
24
|
+
"@types/node": "^16.18.38",
|
|
26
25
|
"copyfiles": "^2.4.1",
|
|
27
26
|
"eslint": "~8.6.0",
|
|
28
27
|
"prettier": "~2.6.2",
|
|
@@ -43,7 +42,7 @@
|
|
|
43
42
|
"ci:build:docs": "api-extractor run --typescript-compiler-folder ../../../node_modules/typescript && copyfiles -u 1 ./_api-extractor-temp/doc-models/* ../../../_api-extractor-temp/",
|
|
44
43
|
"ci:test": "echo No test for this package",
|
|
45
44
|
"ci:test:coverage": "echo No test for this package",
|
|
46
|
-
"clean": "rimraf dist lib *.tsbuildinfo *.build.log",
|
|
45
|
+
"clean": "rimraf --glob 'dist' 'lib' '*.tsbuildinfo' '*.build.log' '_api-extractor-temp'",
|
|
47
46
|
"eslint": "eslint --format stylish src",
|
|
48
47
|
"eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
|
|
49
48
|
"format": "npm run prettier:fix",
|
package/src/error.ts
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { ITelemetryBaseProperties } 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
|
+
/**
|
|
82
|
+
* Returns all properties of this error object that are fit for logging.
|
|
83
|
+
* Some may be tagged to indicate they contain some kind of sensitive data.
|
|
84
|
+
*/
|
|
85
|
+
getTelemetryProperties?(): ITelemetryBaseProperties;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Generic wrapper for an unrecognized/uncategorized error object
|
|
90
|
+
*/
|
|
91
|
+
export interface IGenericError extends IErrorBase {
|
|
92
|
+
/**
|
|
93
|
+
* {@inheritDoc IErrorBase.errorType}
|
|
94
|
+
*/
|
|
95
|
+
readonly errorType: typeof FluidErrorTypes.genericError;
|
|
96
|
+
|
|
97
|
+
// TODO: Use `unknown` instead (API-Breaking)
|
|
98
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
99
|
+
error?: any;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Error indicating an API is being used improperly resulting in an invalid operation.
|
|
104
|
+
*/
|
|
105
|
+
export interface IUsageError extends IErrorBase {
|
|
106
|
+
/**
|
|
107
|
+
* {@inheritDoc IErrorBase.errorType}
|
|
108
|
+
*/
|
|
109
|
+
readonly errorType: typeof FluidErrorTypes.usageError;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Warning emitted when requests to storage are being throttled
|
|
114
|
+
*/
|
|
115
|
+
export interface IThrottlingWarning extends IErrorBase {
|
|
116
|
+
/**
|
|
117
|
+
* {@inheritDoc IErrorBase.errorType}
|
|
118
|
+
*/
|
|
119
|
+
readonly errorType: typeof FluidErrorTypes.throttlingError;
|
|
120
|
+
readonly retryAfterSeconds: number;
|
|
121
|
+
}
|