@fluidframework/core-interfaces 2.0.0-dev.4.4.0.162574 → 2.0.0-dev.5.3.2.178189
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 +20 -0
- package/dist/disposable.d.ts +21 -0
- package/dist/disposable.d.ts.map +1 -0
- package/dist/disposable.js +7 -0
- package/dist/disposable.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/logger.d.ts +109 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +7 -0
- package/dist/logger.js.map +1 -0
- package/dist/tsdoc-metadata.json +11 -0
- package/lib/disposable.d.ts +21 -0
- package/lib/disposable.d.ts.map +1 -0
- package/lib/disposable.js +6 -0
- package/lib/disposable.js.map +1 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/logger.d.ts +109 -0
- package/lib/logger.d.ts.map +1 -0
- package/lib/logger.js +6 -0
- package/lib/logger.js.map +1 -0
- package/package.json +9 -11
- package/src/disposable.ts +22 -0
- package/src/index.ts +14 -0
- package/src/logger.ts +125 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @fluidframework/core-interfaces
|
|
2
2
|
|
|
3
|
+
## 2.0.0-internal.5.3.0
|
|
4
|
+
|
|
5
|
+
Dependency updates only.
|
|
6
|
+
|
|
7
|
+
## 2.0.0-internal.5.2.0
|
|
8
|
+
|
|
9
|
+
Dependency updates only.
|
|
10
|
+
|
|
11
|
+
## 2.0.0-internal.5.1.0
|
|
12
|
+
|
|
13
|
+
Dependency updates only.
|
|
14
|
+
|
|
15
|
+
## 2.0.0-internal.5.0.0
|
|
16
|
+
|
|
17
|
+
Dependency updates only.
|
|
18
|
+
|
|
19
|
+
## 2.0.0-internal.4.4.0
|
|
20
|
+
|
|
21
|
+
Dependency updates only.
|
|
22
|
+
|
|
3
23
|
## 2.0.0-internal.4.1.0
|
|
4
24
|
|
|
5
25
|
Dependency updates only.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Base interface for objects that require lifetime management via explicit disposal.
|
|
7
|
+
*/
|
|
8
|
+
export interface IDisposable {
|
|
9
|
+
/**
|
|
10
|
+
* Whether or not the object has been disposed.
|
|
11
|
+
* If true, the object should be considered invalid, and its other state should be disregarded.
|
|
12
|
+
*/
|
|
13
|
+
readonly disposed: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Dispose of the object and its resources.
|
|
16
|
+
* @param error - Optional error indicating the reason for the disposal, if the object was
|
|
17
|
+
* disposed as the result of an error.
|
|
18
|
+
*/
|
|
19
|
+
dispose(error?: Error): void;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=disposable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"disposable.d.ts","sourceRoot":"","sources":["../src/disposable.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,WAAW,WAAW;IAC3B;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAE3B;;;;OAIG;IACH,OAAO,CAAC,KAAK,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC;CAC7B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"disposable.js","sourceRoot":"","sources":["../src/disposable.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 * Base interface for objects that require lifetime management via explicit disposal.\n */\nexport interface IDisposable {\n\t/**\n\t * Whether or not the object has been disposed.\n\t * If true, the object should be considered invalid, and its other state should be disregarded.\n\t */\n\treadonly disposed: boolean;\n\n\t/**\n\t * Dispose of the object and its resources.\n\t * @param error - Optional error indicating the reason for the disposal, if the object was\n\t * disposed as the result of an error.\n\t */\n\tdispose(error?: Error): void;\n}\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -7,4 +7,6 @@ export { IRequest, IRequestHeader, IResponse, IProvideFluidRouter, IFluidRouter,
|
|
|
7
7
|
export { IFluidHandleContext, IProvideFluidHandleContext, IFluidHandle, IProvideFluidHandle, } from "./handles";
|
|
8
8
|
export { IFluidPackageEnvironment, IFluidPackage, isFluidPackage, IFluidCodeDetailsConfig, IFluidCodeDetails, isFluidCodeDetails, IFluidCodeDetailsComparer, IProvideFluidCodeDetailsComparer, } from "./fluidPackage";
|
|
9
9
|
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";
|
|
10
12
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/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,cAAc,EACd,qBAAqB,EACrB,cAAc,EACd,qBAAqB,GACrB,MAAM,iBAAiB,CAAC;AAKzB,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,OAAO,EACN,wBAAwB,EACxB,aAAa,EACb,cAAc,EACd,uBAAuB,EACvB,iBAAiB,EACjB,kBAAkB,EAClB,yBAAyB,EACzB,gCAAgC,GAChC,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,uBAAuB,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,cAAc,EACd,qBAAqB,EACrB,cAAc,EACd,qBAAqB,GACrB,MAAM,iBAAiB,CAAC;AAKzB,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,OAAO,EACN,wBAAwB,EACxB,aAAa,EACb,cAAc,EACd,uBAAuB,EACvB,iBAAiB,EACjB,kBAAkB,EAClB,yBAAyB,EACzB,gCAAgC,GAChC,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,uBAAuB,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AACnF,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,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"}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,iDAKyB;AAJxB,+GAAA,cAAc,OAAA;AAEd,+GAAA,cAAc,OAAA;AAIf,+FAA+F;AAC/F,qDAAqD;AACrD,8EAA8E;AAC9E,6CAMuB;AADtB,2GAAA,YAAY,OAAA;AAGb,qCAKmB;AAJlB,8GAAA,mBAAmB,OAAA;AAEnB,uGAAA,YAAY,OAAA;AAIb,+CASwB;AANvB,8GAAA,cAAc,OAAA;AAGd,kHAAA,kBAAkB,OAAA;AAClB,yHAAA,yBAAyB,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\tIFluidLoadable,\n\tIProvideFluidLoadable,\n\tIFluidRunnable,\n\tIProvideFluidRunnable,\n} from \"./fluidLoadable\";\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 {\n\tIFluidPackageEnvironment,\n\tIFluidPackage,\n\tisFluidPackage,\n\tIFluidCodeDetailsConfig,\n\tIFluidCodeDetails,\n\tisFluidCodeDetails,\n\tIFluidCodeDetailsComparer,\n\tIProvideFluidCodeDetailsComparer,\n} from \"./fluidPackage\";\n\nexport { FluidObjectProviderKeys, FluidObject, FluidObjectKeys } from \"./provider\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,iDAKyB;AAJxB,+GAAA,cAAc,OAAA;AAEd,+GAAA,cAAc,OAAA;AAIf,+FAA+F;AAC/F,qDAAqD;AACrD,8EAA8E;AAC9E,6CAMuB;AADtB,2GAAA,YAAY,OAAA;AAGb,qCAKmB;AAJlB,8GAAA,mBAAmB,OAAA;AAEnB,uGAAA,YAAY,OAAA;AAIb,+CASwB;AANvB,8GAAA,cAAc,OAAA;AAGd,kHAAA,kBAAkB,OAAA;AAClB,yHAAA,yBAAyB,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\tIFluidLoadable,\n\tIProvideFluidLoadable,\n\tIFluidRunnable,\n\tIProvideFluidRunnable,\n} from \"./fluidLoadable\";\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 {\n\tIFluidPackageEnvironment,\n\tIFluidPackage,\n\tisFluidPackage,\n\tIFluidCodeDetailsConfig,\n\tIFluidCodeDetails,\n\tisFluidCodeDetails,\n\tIFluidCodeDetailsComparer,\n\tIProvideFluidCodeDetailsComparer,\n} from \"./fluidPackage\";\n\nexport { FluidObjectProviderKeys, FluidObject, FluidObjectKeys } from \"./provider\";\nexport type { IDisposable } from \"./disposable\";\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\";\n"]}
|
package/dist/logger.d.ts
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Examples of known categories, however category can be any string for extensibility.
|
|
7
|
+
*/
|
|
8
|
+
export declare type TelemetryEventCategory = "generic" | "error" | "performance";
|
|
9
|
+
/**
|
|
10
|
+
* Property types that can be logged.
|
|
11
|
+
*
|
|
12
|
+
* @remarks Logging entire objects is considered extremely dangerous from a telemetry point of view because people can
|
|
13
|
+
* easily add fields to objects that shouldn't be logged and not realize it's going to be logged.
|
|
14
|
+
* General best practice is to explicitly log the fields you care about from objects.
|
|
15
|
+
*/
|
|
16
|
+
export declare type TelemetryEventPropertyType = string | number | boolean | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* A property to be logged to telemetry containing both the value and a tag. Tags are generic strings that can be used
|
|
19
|
+
* to mark pieces of information that should be organized or handled differently by loggers in various first or third
|
|
20
|
+
* party scenarios. For example, tags are used to mark data that should not be stored in logs for privacy reasons.
|
|
21
|
+
*/
|
|
22
|
+
export interface ITaggedTelemetryPropertyType {
|
|
23
|
+
value: TelemetryEventPropertyType;
|
|
24
|
+
tag: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* JSON-serializable properties, which will be logged with telemetry.
|
|
28
|
+
*/
|
|
29
|
+
export interface ITelemetryProperties {
|
|
30
|
+
[index: string]: TelemetryEventPropertyType | ITaggedTelemetryPropertyType;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Base interface for logging telemetry statements.
|
|
34
|
+
* Can contain any number of properties that get serialized as json payload.
|
|
35
|
+
* @param category - category of the event, like "error", "performance", "generic", etc.
|
|
36
|
+
* @param eventName - name of the event.
|
|
37
|
+
*/
|
|
38
|
+
export interface ITelemetryBaseEvent extends ITelemetryProperties {
|
|
39
|
+
category: string;
|
|
40
|
+
eventName: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Interface to output telemetry events.
|
|
44
|
+
* Implemented by hosting app / loader
|
|
45
|
+
*/
|
|
46
|
+
export interface ITelemetryBaseLogger {
|
|
47
|
+
send(event: ITelemetryBaseEvent): void;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Informational (non-error) telemetry event
|
|
51
|
+
* Maps to category = "generic"
|
|
52
|
+
*/
|
|
53
|
+
export interface ITelemetryGenericEvent extends ITelemetryProperties {
|
|
54
|
+
eventName: string;
|
|
55
|
+
category?: TelemetryEventCategory;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Error telemetry event.
|
|
59
|
+
* Maps to category = "error"
|
|
60
|
+
*/
|
|
61
|
+
export interface ITelemetryErrorEvent extends ITelemetryProperties {
|
|
62
|
+
eventName: string;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Performance telemetry event.
|
|
66
|
+
* Maps to category = "performance"
|
|
67
|
+
*/
|
|
68
|
+
export interface ITelemetryPerformanceEvent extends ITelemetryGenericEvent {
|
|
69
|
+
duration?: number;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* An error object that supports exporting its properties to be logged to telemetry
|
|
73
|
+
*/
|
|
74
|
+
export interface ILoggingError extends Error {
|
|
75
|
+
/**
|
|
76
|
+
* Return all properties from this object that should be logged to telemetry
|
|
77
|
+
*/
|
|
78
|
+
getTelemetryProperties(): ITelemetryProperties;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* ITelemetryLogger interface contains various helper telemetry methods,
|
|
82
|
+
* encoding in one place schemas for various types of Fluid telemetry events.
|
|
83
|
+
* Creates sub-logger that appends properties to all events
|
|
84
|
+
*/
|
|
85
|
+
export interface ITelemetryLogger extends ITelemetryBaseLogger {
|
|
86
|
+
/**
|
|
87
|
+
* Actual implementation that sends telemetry event
|
|
88
|
+
* Implemented by derived classes
|
|
89
|
+
* @param event - Telemetry event to send over
|
|
90
|
+
*/
|
|
91
|
+
send(event: ITelemetryBaseEvent): void;
|
|
92
|
+
/**
|
|
93
|
+
* Send information telemetry event
|
|
94
|
+
* @param event - Event to send
|
|
95
|
+
* @param error - optional error object to log
|
|
96
|
+
*/
|
|
97
|
+
sendTelemetryEvent(event: ITelemetryGenericEvent, error?: any): void;
|
|
98
|
+
/**
|
|
99
|
+
* Send error telemetry event
|
|
100
|
+
* @param event - Event to send
|
|
101
|
+
*/
|
|
102
|
+
sendErrorEvent(event: ITelemetryErrorEvent, error?: any): void;
|
|
103
|
+
/**
|
|
104
|
+
* Send performance telemetry event
|
|
105
|
+
* @param event - Event to send
|
|
106
|
+
*/
|
|
107
|
+
sendPerformanceEvent(event: ITelemetryPerformanceEvent, error?: any): void;
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +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;CACvC;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;;;;OAIG;IACH,IAAI,CAAC,KAAK,EAAE,mBAAmB,GAAG,IAAI,CAAC;IAEvC;;;;OAIG;IAEH,kBAAkB,CAAC,KAAK,EAAE,sBAAsB,EAAE,KAAK,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC;IAErE;;;OAGG;IAEH,cAAc,CAAC,KAAK,EAAE,oBAAoB,EAAE,KAAK,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC;IAE/D;;;OAGG;IAEH,oBAAoB,CAAC,KAAK,EAAE,0BAA0B,EAAE,KAAK,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC;CAC3E"}
|
package/dist/logger.js
ADDED
|
@@ -0,0 +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(event: ITelemetryGenericEvent, error?: any): void;\n\n\t/**\n\t * Send error telemetry event\n\t * @param event - Event to send\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 */\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tsendPerformanceEvent(event: ITelemetryPerformanceEvent, error?: any): void;\n}\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// This file is read by tools that parse documentation comments conforming to the TSDoc standard.
|
|
2
|
+
// It should be published with your NPM package. It should not be tracked by Git.
|
|
3
|
+
{
|
|
4
|
+
"tsdocVersion": "0.12",
|
|
5
|
+
"toolPackages": [
|
|
6
|
+
{
|
|
7
|
+
"packageName": "@microsoft/api-extractor",
|
|
8
|
+
"packageVersion": "7.34.9"
|
|
9
|
+
}
|
|
10
|
+
]
|
|
11
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Base interface for objects that require lifetime management via explicit disposal.
|
|
7
|
+
*/
|
|
8
|
+
export interface IDisposable {
|
|
9
|
+
/**
|
|
10
|
+
* Whether or not the object has been disposed.
|
|
11
|
+
* If true, the object should be considered invalid, and its other state should be disregarded.
|
|
12
|
+
*/
|
|
13
|
+
readonly disposed: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Dispose of the object and its resources.
|
|
16
|
+
* @param error - Optional error indicating the reason for the disposal, if the object was
|
|
17
|
+
* disposed as the result of an error.
|
|
18
|
+
*/
|
|
19
|
+
dispose(error?: Error): void;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=disposable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"disposable.d.ts","sourceRoot":"","sources":["../src/disposable.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,WAAW,WAAW;IAC3B;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAE3B;;;;OAIG;IACH,OAAO,CAAC,KAAK,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC;CAC7B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"disposable.js","sourceRoot":"","sources":["../src/disposable.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 * Base interface for objects that require lifetime management via explicit disposal.\n */\nexport interface IDisposable {\n\t/**\n\t * Whether or not the object has been disposed.\n\t * If true, the object should be considered invalid, and its other state should be disregarded.\n\t */\n\treadonly disposed: boolean;\n\n\t/**\n\t * Dispose of the object and its resources.\n\t * @param error - Optional error indicating the reason for the disposal, if the object was\n\t * disposed as the result of an error.\n\t */\n\tdispose(error?: Error): void;\n}\n"]}
|
package/lib/index.d.ts
CHANGED
|
@@ -7,4 +7,6 @@ export { IRequest, IRequestHeader, IResponse, IProvideFluidRouter, IFluidRouter,
|
|
|
7
7
|
export { IFluidHandleContext, IProvideFluidHandleContext, IFluidHandle, IProvideFluidHandle, } from "./handles";
|
|
8
8
|
export { IFluidPackageEnvironment, IFluidPackage, isFluidPackage, IFluidCodeDetailsConfig, IFluidCodeDetails, isFluidCodeDetails, IFluidCodeDetailsComparer, IProvideFluidCodeDetailsComparer, } from "./fluidPackage";
|
|
9
9
|
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";
|
|
10
12
|
//# 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,cAAc,EACd,qBAAqB,EACrB,cAAc,EACd,qBAAqB,GACrB,MAAM,iBAAiB,CAAC;AAKzB,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,OAAO,EACN,wBAAwB,EACxB,aAAa,EACb,cAAc,EACd,uBAAuB,EACvB,iBAAiB,EACjB,kBAAkB,EAClB,yBAAyB,EACzB,gCAAgC,GAChC,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,uBAAuB,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,cAAc,EACd,qBAAqB,EACrB,cAAc,EACd,qBAAqB,GACrB,MAAM,iBAAiB,CAAC;AAKzB,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,OAAO,EACN,wBAAwB,EACxB,aAAa,EACb,cAAc,EACd,uBAAuB,EACvB,iBAAiB,EACjB,kBAAkB,EAClB,yBAAyB,EACzB,gCAAgC,GAChC,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,uBAAuB,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AACnF,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,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"}
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,cAAc,EAEd,cAAc,GAEd,MAAM,iBAAiB,CAAC;AAEzB,+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;AAEnB,OAAO,EAGN,cAAc,EAGd,kBAAkB,EAClB,yBAAyB,GAEzB,MAAM,gBAAgB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\tIFluidLoadable,\n\tIProvideFluidLoadable,\n\tIFluidRunnable,\n\tIProvideFluidRunnable,\n} from \"./fluidLoadable\";\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 {\n\tIFluidPackageEnvironment,\n\tIFluidPackage,\n\tisFluidPackage,\n\tIFluidCodeDetailsConfig,\n\tIFluidCodeDetails,\n\tisFluidCodeDetails,\n\tIFluidCodeDetailsComparer,\n\tIProvideFluidCodeDetailsComparer,\n} from \"./fluidPackage\";\n\nexport { FluidObjectProviderKeys, FluidObject, FluidObjectKeys } from \"./provider\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,cAAc,EAEd,cAAc,GAEd,MAAM,iBAAiB,CAAC;AAEzB,+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;AAEnB,OAAO,EAGN,cAAc,EAGd,kBAAkB,EAClB,yBAAyB,GAEzB,MAAM,gBAAgB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\tIFluidLoadable,\n\tIProvideFluidLoadable,\n\tIFluidRunnable,\n\tIProvideFluidRunnable,\n} from \"./fluidLoadable\";\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 {\n\tIFluidPackageEnvironment,\n\tIFluidPackage,\n\tisFluidPackage,\n\tIFluidCodeDetailsConfig,\n\tIFluidCodeDetails,\n\tisFluidCodeDetails,\n\tIFluidCodeDetailsComparer,\n\tIProvideFluidCodeDetailsComparer,\n} from \"./fluidPackage\";\n\nexport { FluidObjectProviderKeys, FluidObject, FluidObjectKeys } from \"./provider\";\nexport type { IDisposable } from \"./disposable\";\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\";\n"]}
|
package/lib/logger.d.ts
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Examples of known categories, however category can be any string for extensibility.
|
|
7
|
+
*/
|
|
8
|
+
export declare type TelemetryEventCategory = "generic" | "error" | "performance";
|
|
9
|
+
/**
|
|
10
|
+
* Property types that can be logged.
|
|
11
|
+
*
|
|
12
|
+
* @remarks Logging entire objects is considered extremely dangerous from a telemetry point of view because people can
|
|
13
|
+
* easily add fields to objects that shouldn't be logged and not realize it's going to be logged.
|
|
14
|
+
* General best practice is to explicitly log the fields you care about from objects.
|
|
15
|
+
*/
|
|
16
|
+
export declare type TelemetryEventPropertyType = string | number | boolean | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* A property to be logged to telemetry containing both the value and a tag. Tags are generic strings that can be used
|
|
19
|
+
* to mark pieces of information that should be organized or handled differently by loggers in various first or third
|
|
20
|
+
* party scenarios. For example, tags are used to mark data that should not be stored in logs for privacy reasons.
|
|
21
|
+
*/
|
|
22
|
+
export interface ITaggedTelemetryPropertyType {
|
|
23
|
+
value: TelemetryEventPropertyType;
|
|
24
|
+
tag: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* JSON-serializable properties, which will be logged with telemetry.
|
|
28
|
+
*/
|
|
29
|
+
export interface ITelemetryProperties {
|
|
30
|
+
[index: string]: TelemetryEventPropertyType | ITaggedTelemetryPropertyType;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Base interface for logging telemetry statements.
|
|
34
|
+
* Can contain any number of properties that get serialized as json payload.
|
|
35
|
+
* @param category - category of the event, like "error", "performance", "generic", etc.
|
|
36
|
+
* @param eventName - name of the event.
|
|
37
|
+
*/
|
|
38
|
+
export interface ITelemetryBaseEvent extends ITelemetryProperties {
|
|
39
|
+
category: string;
|
|
40
|
+
eventName: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Interface to output telemetry events.
|
|
44
|
+
* Implemented by hosting app / loader
|
|
45
|
+
*/
|
|
46
|
+
export interface ITelemetryBaseLogger {
|
|
47
|
+
send(event: ITelemetryBaseEvent): void;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Informational (non-error) telemetry event
|
|
51
|
+
* Maps to category = "generic"
|
|
52
|
+
*/
|
|
53
|
+
export interface ITelemetryGenericEvent extends ITelemetryProperties {
|
|
54
|
+
eventName: string;
|
|
55
|
+
category?: TelemetryEventCategory;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Error telemetry event.
|
|
59
|
+
* Maps to category = "error"
|
|
60
|
+
*/
|
|
61
|
+
export interface ITelemetryErrorEvent extends ITelemetryProperties {
|
|
62
|
+
eventName: string;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Performance telemetry event.
|
|
66
|
+
* Maps to category = "performance"
|
|
67
|
+
*/
|
|
68
|
+
export interface ITelemetryPerformanceEvent extends ITelemetryGenericEvent {
|
|
69
|
+
duration?: number;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* An error object that supports exporting its properties to be logged to telemetry
|
|
73
|
+
*/
|
|
74
|
+
export interface ILoggingError extends Error {
|
|
75
|
+
/**
|
|
76
|
+
* Return all properties from this object that should be logged to telemetry
|
|
77
|
+
*/
|
|
78
|
+
getTelemetryProperties(): ITelemetryProperties;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* ITelemetryLogger interface contains various helper telemetry methods,
|
|
82
|
+
* encoding in one place schemas for various types of Fluid telemetry events.
|
|
83
|
+
* Creates sub-logger that appends properties to all events
|
|
84
|
+
*/
|
|
85
|
+
export interface ITelemetryLogger extends ITelemetryBaseLogger {
|
|
86
|
+
/**
|
|
87
|
+
* Actual implementation that sends telemetry event
|
|
88
|
+
* Implemented by derived classes
|
|
89
|
+
* @param event - Telemetry event to send over
|
|
90
|
+
*/
|
|
91
|
+
send(event: ITelemetryBaseEvent): void;
|
|
92
|
+
/**
|
|
93
|
+
* Send information telemetry event
|
|
94
|
+
* @param event - Event to send
|
|
95
|
+
* @param error - optional error object to log
|
|
96
|
+
*/
|
|
97
|
+
sendTelemetryEvent(event: ITelemetryGenericEvent, error?: any): void;
|
|
98
|
+
/**
|
|
99
|
+
* Send error telemetry event
|
|
100
|
+
* @param event - Event to send
|
|
101
|
+
*/
|
|
102
|
+
sendErrorEvent(event: ITelemetryErrorEvent, error?: any): void;
|
|
103
|
+
/**
|
|
104
|
+
* Send performance telemetry event
|
|
105
|
+
* @param event - Event to send
|
|
106
|
+
*/
|
|
107
|
+
sendPerformanceEvent(event: ITelemetryPerformanceEvent, error?: any): void;
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +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;CACvC;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;;;;OAIG;IACH,IAAI,CAAC,KAAK,EAAE,mBAAmB,GAAG,IAAI,CAAC;IAEvC;;;;OAIG;IAEH,kBAAkB,CAAC,KAAK,EAAE,sBAAsB,EAAE,KAAK,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC;IAErE;;;OAGG;IAEH,cAAc,CAAC,KAAK,EAAE,oBAAoB,EAAE,KAAK,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC;IAE/D;;;OAGG;IAEH,oBAAoB,CAAC,KAAK,EAAE,0BAA0B,EAAE,KAAK,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC;CAC3E"}
|
package/lib/logger.js
ADDED
|
@@ -0,0 +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(event: ITelemetryGenericEvent, error?: any): void;\n\n\t/**\n\t * Send error telemetry event\n\t * @param event - Event to send\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 */\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tsendPerformanceEvent(event: ITelemetryPerformanceEvent, error?: any): void;\n}\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.5.3.2.178189",
|
|
4
4
|
"description": "Fluid object interfaces",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -15,10 +15,10 @@
|
|
|
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": "^1.
|
|
20
|
-
"@fluidframework/build-tools": "^0.
|
|
21
|
-
"@fluidframework/core-interfaces-previous": "npm:@fluidframework/core-interfaces@2.0.0-internal.
|
|
18
|
+
"@fluid-tools/build-cli": "^0.21.0",
|
|
19
|
+
"@fluidframework/build-common": "^1.2.0",
|
|
20
|
+
"@fluidframework/build-tools": "^0.21.0",
|
|
21
|
+
"@fluidframework/core-interfaces-previous": "npm:@fluidframework/core-interfaces@2.0.0-internal.5.2.0",
|
|
22
22
|
"@fluidframework/eslint-config-fluid": "^2.0.0",
|
|
23
23
|
"@microsoft/api-extractor": "^7.34.4",
|
|
24
24
|
"@types/node": "^14.18.38",
|
|
@@ -33,13 +33,11 @@
|
|
|
33
33
|
"broken": {}
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
|
-
"build": "
|
|
37
|
-
"build:commonjs": "
|
|
38
|
-
"build:compile": "
|
|
36
|
+
"build": "fluid-build . --task build",
|
|
37
|
+
"build:commonjs": "fluid-build . --task commonjs",
|
|
38
|
+
"build:compile": "fluid-build . --task compile",
|
|
39
39
|
"build:docs": "api-extractor run --local --typescript-compiler-folder ../../../node_modules/typescript && copyfiles -u 1 ./_api-extractor-temp/doc-models/* ../../../_api-extractor-temp/",
|
|
40
40
|
"build:esnext": "tsc --project ./tsconfig.esnext.json",
|
|
41
|
-
"build:full": "npm run build",
|
|
42
|
-
"build:full:compile": "npm run build:compile",
|
|
43
41
|
"build:test": "tsc --project ./src/test/tsconfig.json",
|
|
44
42
|
"ci:build": "npm run build:compile",
|
|
45
43
|
"ci:build:docs": "api-extractor run --typescript-compiler-folder ../../../node_modules/typescript && copyfiles -u 1 ./_api-extractor-temp/doc-models/* ../../../_api-extractor-temp/",
|
|
@@ -56,6 +54,6 @@
|
|
|
56
54
|
"tsc": "tsc",
|
|
57
55
|
"tsc:watch": "tsc --watch",
|
|
58
56
|
"typetests:gen": "fluid-type-test-generator",
|
|
59
|
-
"typetests:prepare": "flub
|
|
57
|
+
"typetests:prepare": "flub typetests --dir . --reset --previous --normalize"
|
|
60
58
|
}
|
|
61
59
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Base interface for objects that require lifetime management via explicit disposal.
|
|
8
|
+
*/
|
|
9
|
+
export interface IDisposable {
|
|
10
|
+
/**
|
|
11
|
+
* Whether or not the object has been disposed.
|
|
12
|
+
* If true, the object should be considered invalid, and its other state should be disregarded.
|
|
13
|
+
*/
|
|
14
|
+
readonly disposed: boolean;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Dispose of the object and its resources.
|
|
18
|
+
* @param error - Optional error indicating the reason for the disposal, if the object was
|
|
19
|
+
* disposed as the result of an error.
|
|
20
|
+
*/
|
|
21
|
+
dispose(error?: Error): void;
|
|
22
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -40,3 +40,17 @@ export {
|
|
|
40
40
|
} from "./fluidPackage";
|
|
41
41
|
|
|
42
42
|
export { FluidObjectProviderKeys, FluidObject, FluidObjectKeys } from "./provider";
|
|
43
|
+
export type { IDisposable } from "./disposable";
|
|
44
|
+
export type {
|
|
45
|
+
ILoggingError,
|
|
46
|
+
ITaggedTelemetryPropertyType,
|
|
47
|
+
ITelemetryBaseEvent,
|
|
48
|
+
ITelemetryBaseLogger,
|
|
49
|
+
ITelemetryErrorEvent,
|
|
50
|
+
ITelemetryGenericEvent,
|
|
51
|
+
ITelemetryLogger,
|
|
52
|
+
ITelemetryPerformanceEvent,
|
|
53
|
+
ITelemetryProperties,
|
|
54
|
+
TelemetryEventCategory,
|
|
55
|
+
TelemetryEventPropertyType,
|
|
56
|
+
} from "./logger";
|
package/src/logger.ts
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Examples of known categories, however category can be any string for extensibility.
|
|
8
|
+
*/
|
|
9
|
+
export type TelemetryEventCategory = "generic" | "error" | "performance";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Property types that can be logged.
|
|
13
|
+
*
|
|
14
|
+
* @remarks Logging entire objects is considered extremely dangerous from a telemetry point of view because people can
|
|
15
|
+
* easily add fields to objects that shouldn't be logged and not realize it's going to be logged.
|
|
16
|
+
* General best practice is to explicitly log the fields you care about from objects.
|
|
17
|
+
*/
|
|
18
|
+
export type TelemetryEventPropertyType = string | number | boolean | undefined;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* A property to be logged to telemetry containing both the value and a tag. Tags are generic strings that can be used
|
|
22
|
+
* to mark pieces of information that should be organized or handled differently by loggers in various first or third
|
|
23
|
+
* party scenarios. For example, tags are used to mark data that should not be stored in logs for privacy reasons.
|
|
24
|
+
*/
|
|
25
|
+
export interface ITaggedTelemetryPropertyType {
|
|
26
|
+
value: TelemetryEventPropertyType;
|
|
27
|
+
tag: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* JSON-serializable properties, which will be logged with telemetry.
|
|
32
|
+
*/
|
|
33
|
+
export interface ITelemetryProperties {
|
|
34
|
+
[index: string]: TelemetryEventPropertyType | ITaggedTelemetryPropertyType;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Base interface for logging telemetry statements.
|
|
39
|
+
* Can contain any number of properties that get serialized as json payload.
|
|
40
|
+
* @param category - category of the event, like "error", "performance", "generic", etc.
|
|
41
|
+
* @param eventName - name of the event.
|
|
42
|
+
*/
|
|
43
|
+
export interface ITelemetryBaseEvent extends ITelemetryProperties {
|
|
44
|
+
category: string;
|
|
45
|
+
eventName: string;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Interface to output telemetry events.
|
|
50
|
+
* Implemented by hosting app / loader
|
|
51
|
+
*/
|
|
52
|
+
export interface ITelemetryBaseLogger {
|
|
53
|
+
send(event: ITelemetryBaseEvent): void;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Informational (non-error) telemetry event
|
|
58
|
+
* Maps to category = "generic"
|
|
59
|
+
*/
|
|
60
|
+
export interface ITelemetryGenericEvent extends ITelemetryProperties {
|
|
61
|
+
eventName: string;
|
|
62
|
+
category?: TelemetryEventCategory;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Error telemetry event.
|
|
67
|
+
* Maps to category = "error"
|
|
68
|
+
*/
|
|
69
|
+
export interface ITelemetryErrorEvent extends ITelemetryProperties {
|
|
70
|
+
eventName: string;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Performance telemetry event.
|
|
75
|
+
* Maps to category = "performance"
|
|
76
|
+
*/
|
|
77
|
+
export interface ITelemetryPerformanceEvent extends ITelemetryGenericEvent {
|
|
78
|
+
duration?: number; // Duration of event (optional)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* An error object that supports exporting its properties to be logged to telemetry
|
|
83
|
+
*/
|
|
84
|
+
export interface ILoggingError extends Error {
|
|
85
|
+
/**
|
|
86
|
+
* Return all properties from this object that should be logged to telemetry
|
|
87
|
+
*/
|
|
88
|
+
getTelemetryProperties(): ITelemetryProperties;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* ITelemetryLogger interface contains various helper telemetry methods,
|
|
93
|
+
* encoding in one place schemas for various types of Fluid telemetry events.
|
|
94
|
+
* Creates sub-logger that appends properties to all events
|
|
95
|
+
*/
|
|
96
|
+
export interface ITelemetryLogger extends ITelemetryBaseLogger {
|
|
97
|
+
/**
|
|
98
|
+
* Actual implementation that sends telemetry event
|
|
99
|
+
* Implemented by derived classes
|
|
100
|
+
* @param event - Telemetry event to send over
|
|
101
|
+
*/
|
|
102
|
+
send(event: ITelemetryBaseEvent): void;
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Send information telemetry event
|
|
106
|
+
* @param event - Event to send
|
|
107
|
+
* @param error - optional error object to log
|
|
108
|
+
*/
|
|
109
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
110
|
+
sendTelemetryEvent(event: ITelemetryGenericEvent, error?: any): void;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Send error telemetry event
|
|
114
|
+
* @param event - Event to send
|
|
115
|
+
*/
|
|
116
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
117
|
+
sendErrorEvent(event: ITelemetryErrorEvent, error?: any): void;
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Send performance telemetry event
|
|
121
|
+
* @param event - Event to send
|
|
122
|
+
*/
|
|
123
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
124
|
+
sendPerformanceEvent(event: ITelemetryPerformanceEvent, error?: any): void;
|
|
125
|
+
}
|