@fluidframework/core-interfaces 2.0.0-dev.7.4.0.217884 → 2.0.0-dev.7.4.0.221926
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 +10 -0
- package/api-extractor.json +0 -3
- package/lib/config.js +2 -1
- package/lib/config.js.map +1 -1
- package/lib/disposable.js +2 -1
- package/lib/disposable.js.map +1 -1
- package/lib/error.js +4 -1
- package/lib/error.js.map +1 -1
- package/lib/events.js +2 -1
- package/lib/events.js.map +1 -1
- package/lib/fluidLoadable.js +5 -2
- package/lib/fluidLoadable.js.map +1 -1
- package/lib/fluidPackage.js +9 -4
- package/lib/fluidPackage.js.map +1 -1
- package/lib/fluidRouter.js +4 -1
- package/lib/fluidRouter.js.map +1 -1
- package/lib/handles.js +5 -2
- package/lib/handles.js.map +1 -1
- package/lib/index.js +19 -6
- package/lib/index.js.map +1 -1
- package/lib/logger.js +4 -1
- package/lib/logger.js.map +1 -1
- package/lib/provider.js +2 -1
- package/lib/provider.js.map +1 -1
- package/package.json +3 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @fluidframework/core-interfaces
|
|
2
2
|
|
|
3
|
+
## 2.0.0-internal.7.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- telemetry-utils: Deprecate ConfigTypes and IConfigProviderBase ([#18597](https://github.com/microsoft/FluidFramework/issues/18597)) [39b9ff57c0](https://github.com/microsoft/FluidFramework/commits/39b9ff57c0184b72f0e3f9425922dda944995265)
|
|
8
|
+
|
|
9
|
+
The types `ConfigTypes` and `IConfigProviderBase` have been deprecated in the @fluidframework/telemetry-utils package.
|
|
10
|
+
The types can now be found in the @fluidframework/core-interfaces package. Please replace any uses with the types from
|
|
11
|
+
@fluidframework/core-interfaces.
|
|
12
|
+
|
|
3
13
|
## 2.0.0-internal.7.3.0
|
|
4
14
|
|
|
5
15
|
Dependency updates only.
|
package/api-extractor.json
CHANGED
package/lib/config.js
CHANGED
package/lib/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.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 * Types supported by {@link IConfigProviderBase}.\n * @alpha\n */\nexport type ConfigTypes = string | number | boolean | number[] | string[] | boolean[] | undefined;\n\n/**\n * Base interface for providing configurations to enable/disable/control features.\n * @alpha\n */\nexport interface IConfigProviderBase {\n\t/**\n\t * For the specified config name this function gets the value.\n\t *\n\t * This type is meant be easy to implement by Fluid Framework consumers\n\t * so the returned valued needs minimal type coercion, and allows consumers to\n\t * return values in a natural way from whatever source they retrieve them.\n\t *\n\t * For instance a value of 1 maybe be returned as a string or a number.\n\t * For array types a json string or an object are allowable.\n\t *\n\t * It should return undefined if there is no value available for the config name.\n\t *\n\t * @param name - The name of the config to get the value for.\n\t *\n\t * @privateRemarks Generally, this type should only be taken as input, and be wrapped by an\n\t * internal monitoring context from the fluidframework/telemetry-utils package. That will provide\n\t * a wrapper with provides strongly typed access to values via consistent type coercion.\n\t */\n\tgetRawConfig(name: string): ConfigTypes;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.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 * Types supported by {@link IConfigProviderBase}.\n * @alpha\n */\nexport type ConfigTypes = string | number | boolean | number[] | string[] | boolean[] | undefined;\n\n/**\n * Base interface for providing configurations to enable/disable/control features.\n * @alpha\n */\nexport interface IConfigProviderBase {\n\t/**\n\t * For the specified config name this function gets the value.\n\t *\n\t * This type is meant be easy to implement by Fluid Framework consumers\n\t * so the returned valued needs minimal type coercion, and allows consumers to\n\t * return values in a natural way from whatever source they retrieve them.\n\t *\n\t * For instance a value of 1 maybe be returned as a string or a number.\n\t * For array types a json string or an object are allowable.\n\t *\n\t * It should return undefined if there is no value available for the config name.\n\t *\n\t * @param name - The name of the config to get the value for.\n\t *\n\t * @privateRemarks Generally, this type should only be taken as input, and be wrapped by an\n\t * internal monitoring context from the fluidframework/telemetry-utils package. That will provide\n\t * a wrapper with provides strongly typed access to values via consistent type coercion.\n\t */\n\tgetRawConfig(name: string): ConfigTypes;\n}\n"]}
|
package/lib/disposable.js
CHANGED
package/lib/disposable.js.map
CHANGED
|
@@ -1 +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 * @alpha\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"]}
|
|
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 * @alpha\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/error.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/*!
|
|
2
3
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
4
|
* Licensed under the MIT License.
|
|
4
5
|
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.FluidErrorTypes = void 0;
|
|
5
8
|
/**
|
|
6
9
|
* Error types the Fluid Framework may report.
|
|
7
10
|
* @internal
|
|
8
11
|
*/
|
|
9
|
-
|
|
12
|
+
exports.FluidErrorTypes = {
|
|
10
13
|
/**
|
|
11
14
|
* Some error, most likely an exception caught by runtime and propagated to container as critical error
|
|
12
15
|
*/
|
package/lib/error.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.js","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":"AAAA;;;GAGG
|
|
1
|
+
{"version":3,"file":"error.js","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH;;;GAGG;AACU,QAAA,eAAe,GAAG;IAC9B;;OAEG;IACH,YAAY,EAAE,cAAc;IAE5B;;OAEG;IACH,eAAe,EAAE,iBAAiB;IAElC;;OAEG;IACH,mBAAmB,EAAE,qBAAqB;IAE1C;;OAEG;IACH,mBAAmB,EAAE,qBAAqB;IAE1C;;OAEG;IACH,UAAU,EAAE,YAAY;CACf,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryBaseProperties } from \"./index\";\n\n/**\n * Error types the Fluid Framework may report.\n * @internal\n */\nexport const FluidErrorTypes = {\n\t/**\n\t * Some error, most likely an exception caught by runtime and propagated to container as critical error\n\t */\n\tgenericError: \"genericError\",\n\n\t/**\n\t * Throttling error from server. Server is busy and is asking not to reconnect for some time\n\t */\n\tthrottlingError: \"throttlingError\",\n\n\t/**\n\t * Data loss error detected by Container / DeltaManager. Likely points to storage issue.\n\t */\n\tdataCorruptionError: \"dataCorruptionError\",\n\n\t/**\n\t * Error encountered when processing an operation. May correlate with data corruption.\n\t */\n\tdataProcessingError: \"dataProcessingError\",\n\n\t/**\n\t * Error indicating an API is being used improperly resulting in an invalid operation.\n\t */\n\tusageError: \"usageError\",\n} as const;\n/**\n * @internal\n */\nexport type FluidErrorTypes = (typeof FluidErrorTypes)[keyof typeof FluidErrorTypes];\n\n/**\n * Base interface for all errors and warnings emitted the container.\n *\n * @remarks\n *\n * We are in the process of unifying error types across layers of the Framework. For now we have only migrated\n * those from container-definitions. Once fully migrated, this will be a base interface for all errors and\n * warnings emitted by the Fluid Framework. Currently only the container layer is using IErrorBase.\n * Runtime and others will follow soon.\n *\n * @alpha\n */\nexport interface IErrorBase extends Partial<Error> {\n\t/**\n\t * A type tag differentiating kinds of errors emitted by the container.\n\t *\n\t * @see See {@link FluidErrorTypes#genericError} for some common examples.\n\t * - container\n\t * - runtime\n\t * - drivers\n\t */\n\treadonly errorType: string;\n\n\t/**\n\t * See {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error | Error.message}\n\t *\n\t * @remarks\n\t *\n\t * Privacy Note - This is a freeform string that we may not control in all cases (e.g. a dependency throws an error)\n\t * If there are known cases where this contains privacy-sensitive data it will be tagged and included in the result\n\t * of getTelemetryProperties. When logging, consider fetching it that way rather than straight from this field.\n\t */\n\treadonly message: string;\n\n\t/**\n\t * See {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/name | Error.name}\n\t */\n\treadonly name?: string;\n\n\t/**\n\t * See {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/stack | Error.stack}\n\t */\n\treadonly stack?: string;\n\n\t/**\n\t * Returns all properties of this error object that are fit for logging.\n\t * Some may be tagged to indicate they contain some kind of sensitive data.\n\t */\n\tgetTelemetryProperties?(): ITelemetryBaseProperties;\n}\n\n/**\n * Generic wrapper for an unrecognized/uncategorized error object\n * @internal\n */\nexport interface IGenericError extends IErrorBase {\n\t/**\n\t * {@inheritDoc IErrorBase.errorType}\n\t */\n\treadonly errorType: typeof FluidErrorTypes.genericError;\n\n\t// TODO: Use `unknown` instead (API-Breaking)\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\terror?: any;\n}\n\n/**\n * Error indicating an API is being used improperly resulting in an invalid operation.\n * @internal\n */\nexport interface IUsageError extends IErrorBase {\n\t/**\n\t * {@inheritDoc IErrorBase.errorType}\n\t */\n\treadonly errorType: typeof FluidErrorTypes.usageError;\n}\n\n/**\n * Warning emitted when requests to storage are being throttled\n * @internal\n */\nexport interface IThrottlingWarning extends IErrorBase {\n\t/**\n\t * {@inheritDoc IErrorBase.errorType}\n\t */\n\treadonly errorType: typeof FluidErrorTypes.throttlingError;\n\treadonly retryAfterSeconds: number;\n}\n"]}
|
package/lib/events.js
CHANGED
package/lib/events.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.js","sourceRoot":"","sources":["../src/events.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 event emitters.\n * @alpha\n */\nexport interface IEvent {\n\t/**\n\t * Base event emitter signature.\n\t *\n\t * @remarks The event emitter polyfill and the node event emitter have different event types:\n\t * `string | symbol` vs. `string | number`.\n\t *\n\t * So for our typing we'll contrain to string, that way we work with both.\n\t *\n\t * @eventProperty\n\t */\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t(event: string, listener: (...args: any[]) => void);\n}\n\n/**\n * Base interface for error event emitters.\n * @alpha\n */\nexport interface IErrorEvent extends IEvent {\n\t/**\n\t * Base error event emitter signature.\n\t *\n\t * @eventProperty\n\t */\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t(event: \"error\", listener: (message: any) => void);\n}\n\n/**\n * Base interface for event providers.\n * @alpha\n */\nexport interface IEventProvider<TEvent extends IEvent> {\n\t/**\n\t * Registers a callback to be invoked when the corresponding event is triggered.\n\t */\n\treadonly on: IEventTransformer<this, TEvent>;\n\n\t/**\n\t * Registers a callback to be invoked the first time (after registration) the corresponding event is triggered.\n\t */\n\treadonly once: IEventTransformer<this, TEvent>;\n\n\t/**\n\t * Removes the corresponding event if it has been registered.\n\t */\n\treadonly off: IEventTransformer<this, TEvent>;\n}\n\n/**\n * Allows an interface to extend interfaces that already extend an {@link IEventProvider}.\n *\n * @example\n *\n * ``` typescript\n * interface AEvents extends IEvent{\n * (event: \"a-event\",listener: (a: number)=>void);\n * }\n * interface A extends IEventProvider<AEvents>{\n * a: object;\n * }\n *\n * interface BEvents extends IEvent{\n * (event: \"b-event\",listener: (b: string)=>void);\n * }\n * interface B extends ExtendEventProvider<AEvents, A, BEvents>{\n * b: boolean;\n * };\n * ```\n *\n * interface B will now extend interface A and its events\n * @alpha\n */\nexport type ExtendEventProvider<\n\tTBaseEvent extends IEvent,\n\tTBase extends IEventProvider<TBaseEvent>,\n\tTEvent extends TBaseEvent,\n> = Omit<Omit<Omit<TBase, \"on\">, \"once\">, \"off\"> &\n\tIEventProvider<TBaseEvent> &\n\tIEventProvider<TEvent>;\n\n// These types handle replacing IEventThisPlaceHolder with `this`, so we can\n// support polymorphic `this`. For instance if an event wanted to be:\n// (event: \"some-event\", listener:(target: this)=>void)\n//\n// it should be written as\n// (event: \"some-event\", listener:(target: IEventThisPlaceHolder)=>void)\n//\n// and IEventThisPlaceHolder will be replaced with this.\n// This is all consumers of these types need to know.\n\n/**\n * The placeholder type that should be used instead of `this` in events.\n * @alpha\n */\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\nexport type IEventThisPlaceHolder = { thisPlaceHolder: \"thisPlaceHolder\" };\n\n/**\n * Does the type replacement by changing types of {@link IEventThisPlaceHolder} to `TThis`\n * @alpha\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type ReplaceIEventThisPlaceHolder<L extends any[], TThis> = L extends any[]\n\t? { [K in keyof L]: L[K] extends IEventThisPlaceHolder ? TThis : L[K] }\n\t: L;\n\n/**\n * Transforms the event overload by replacing {@link IEventThisPlaceHolder} with `TThis` in the event listener\n * arguments and having the overload return `TTHis` as well\n * @alpha\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type TransformedEvent<TThis, E, A extends any[]> = (\n\tevent: E,\n\tlistener: (...args: ReplaceIEventThisPlaceHolder<A, TThis>) => void,\n) => TThis;\n\n/**\n * This type is a conditional type for transforming all the overloads provided in `TEvent`.\n *\n * @remarks\n * Due to limitations of the TypeScript typing system, we need to handle each number of overload individually.\n * It currently supports the max of 15 event overloads which is more than we use anywhere.\n * At more than 15 overloads we start to hit {@link https://github.com/microsoft/TypeScript/issues/37209 | TS2589}.\n * If we need to move beyond 15 we should evaluate using a mapped type pattern like `{\"event\":(listenerArgs)=>void}`\n * @alpha\n */\nexport type IEventTransformer<TThis, TEvent extends IEvent> = TEvent extends {\n\t(event: infer E0, listener: (...args: infer A0) => void);\n\t(event: infer E1, listener: (...args: infer A1) => void);\n\t(event: infer E2, listener: (...args: infer A2) => void);\n\t(event: infer E3, listener: (...args: infer A3) => void);\n\t(event: infer E4, listener: (...args: infer A4) => void);\n\t(event: infer E5, listener: (...args: infer A5) => void);\n\t(event: infer E6, listener: (...args: infer A6) => void);\n\t(event: infer E7, listener: (...args: infer A7) => void);\n\t(event: infer E8, listener: (...args: infer A8) => void);\n\t(event: infer E9, listener: (...args: infer A9) => void);\n\t(event: infer E10, listener: (...args: infer A10) => void);\n\t(event: infer E11, listener: (...args: infer A11) => void);\n\t(event: infer E12, listener: (...args: infer A12) => void);\n\t(event: infer E13, listener: (...args: infer A13) => void);\n\t(event: infer E14, listener: (...args: infer A14) => void);\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t(event: string, listener: (...args: any[]) => void);\n}\n\t? TransformedEvent<TThis, E0, A0> &\n\t\t\tTransformedEvent<TThis, E1, A1> &\n\t\t\tTransformedEvent<TThis, E2, A2> &\n\t\t\tTransformedEvent<TThis, E3, A3> &\n\t\t\tTransformedEvent<TThis, E4, A4> &\n\t\t\tTransformedEvent<TThis, E5, A5> &\n\t\t\tTransformedEvent<TThis, E6, A6> &\n\t\t\tTransformedEvent<TThis, E7, A7> &\n\t\t\tTransformedEvent<TThis, E8, A8> &\n\t\t\tTransformedEvent<TThis, E9, A9> &\n\t\t\tTransformedEvent<TThis, E10, A10> &\n\t\t\tTransformedEvent<TThis, E11, A11> &\n\t\t\tTransformedEvent<TThis, E12, A12> &\n\t\t\tTransformedEvent<TThis, E13, A13> &\n\t\t\tTransformedEvent<TThis, E14, A14>\n\t: TEvent extends {\n\t\t\t(event: infer E0, listener: (...args: infer A0) => void);\n\t\t\t(event: infer E1, listener: (...args: infer A1) => void);\n\t\t\t(event: infer E2, listener: (...args: infer A2) => void);\n\t\t\t(event: infer E3, listener: (...args: infer A3) => void);\n\t\t\t(event: infer E4, listener: (...args: infer A4) => void);\n\t\t\t(event: infer E5, listener: (...args: infer A5) => void);\n\t\t\t(event: infer E6, listener: (...args: infer A6) => void);\n\t\t\t(event: infer E7, listener: (...args: infer A7) => void);\n\t\t\t(event: infer E8, listener: (...args: infer A8) => void);\n\t\t\t(event: infer E9, listener: (...args: infer A9) => void);\n\t\t\t(event: infer E10, listener: (...args: infer A10) => void);\n\t\t\t(event: infer E11, listener: (...args: infer A11) => void);\n\t\t\t(event: infer E12, listener: (...args: infer A12) => void);\n\t\t\t(event: infer E13, listener: (...args: infer A13) => void);\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t(event: string, listener: (...args: any[]) => void);\n\t }\n\t? TransformedEvent<TThis, E0, A0> &\n\t\t\tTransformedEvent<TThis, E1, A1> &\n\t\t\tTransformedEvent<TThis, E2, A2> &\n\t\t\tTransformedEvent<TThis, E3, A3> &\n\t\t\tTransformedEvent<TThis, E4, A4> &\n\t\t\tTransformedEvent<TThis, E5, A5> &\n\t\t\tTransformedEvent<TThis, E6, A6> &\n\t\t\tTransformedEvent<TThis, E7, A7> &\n\t\t\tTransformedEvent<TThis, E8, A8> &\n\t\t\tTransformedEvent<TThis, E9, A9> &\n\t\t\tTransformedEvent<TThis, E10, A10> &\n\t\t\tTransformedEvent<TThis, E11, A11> &\n\t\t\tTransformedEvent<TThis, E12, A12> &\n\t\t\tTransformedEvent<TThis, E13, A13>\n\t: TEvent extends {\n\t\t\t(event: infer E0, listener: (...args: infer A0) => void);\n\t\t\t(event: infer E1, listener: (...args: infer A1) => void);\n\t\t\t(event: infer E2, listener: (...args: infer A2) => void);\n\t\t\t(event: infer E3, listener: (...args: infer A3) => void);\n\t\t\t(event: infer E4, listener: (...args: infer A4) => void);\n\t\t\t(event: infer E5, listener: (...args: infer A5) => void);\n\t\t\t(event: infer E6, listener: (...args: infer A6) => void);\n\t\t\t(event: infer E7, listener: (...args: infer A7) => void);\n\t\t\t(event: infer E8, listener: (...args: infer A8) => void);\n\t\t\t(event: infer E9, listener: (...args: infer A9) => void);\n\t\t\t(event: infer E10, listener: (...args: infer A10) => void);\n\t\t\t(event: infer E11, listener: (...args: infer A11) => void);\n\t\t\t(event: infer E12, listener: (...args: infer A12) => void);\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t(event: string, listener: (...args: any[]) => void);\n\t }\n\t? TransformedEvent<TThis, E0, A0> &\n\t\t\tTransformedEvent<TThis, E1, A1> &\n\t\t\tTransformedEvent<TThis, E2, A2> &\n\t\t\tTransformedEvent<TThis, E3, A3> &\n\t\t\tTransformedEvent<TThis, E4, A4> &\n\t\t\tTransformedEvent<TThis, E5, A5> &\n\t\t\tTransformedEvent<TThis, E6, A6> &\n\t\t\tTransformedEvent<TThis, E7, A7> &\n\t\t\tTransformedEvent<TThis, E8, A8> &\n\t\t\tTransformedEvent<TThis, E9, A9> &\n\t\t\tTransformedEvent<TThis, E10, A10> &\n\t\t\tTransformedEvent<TThis, E11, A11> &\n\t\t\tTransformedEvent<TThis, E12, A12>\n\t: TEvent extends {\n\t\t\t(event: infer E0, listener: (...args: infer A0) => void);\n\t\t\t(event: infer E1, listener: (...args: infer A1) => void);\n\t\t\t(event: infer E2, listener: (...args: infer A2) => void);\n\t\t\t(event: infer E3, listener: (...args: infer A3) => void);\n\t\t\t(event: infer E4, listener: (...args: infer A4) => void);\n\t\t\t(event: infer E5, listener: (...args: infer A5) => void);\n\t\t\t(event: infer E6, listener: (...args: infer A6) => void);\n\t\t\t(event: infer E7, listener: (...args: infer A7) => void);\n\t\t\t(event: infer E8, listener: (...args: infer A8) => void);\n\t\t\t(event: infer E9, listener: (...args: infer A9) => void);\n\t\t\t(event: infer E10, listener: (...args: infer A10) => void);\n\t\t\t(event: infer E11, listener: (...args: infer A11) => void);\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t(event: string, listener: (...args: any[]) => void);\n\t }\n\t? TransformedEvent<TThis, E0, A0> &\n\t\t\tTransformedEvent<TThis, E1, A1> &\n\t\t\tTransformedEvent<TThis, E2, A2> &\n\t\t\tTransformedEvent<TThis, E3, A3> &\n\t\t\tTransformedEvent<TThis, E4, A4> &\n\t\t\tTransformedEvent<TThis, E5, A5> &\n\t\t\tTransformedEvent<TThis, E6, A6> &\n\t\t\tTransformedEvent<TThis, E7, A7> &\n\t\t\tTransformedEvent<TThis, E8, A8> &\n\t\t\tTransformedEvent<TThis, E9, A9> &\n\t\t\tTransformedEvent<TThis, E10, A10> &\n\t\t\tTransformedEvent<TThis, E11, A11>\n\t: TEvent extends {\n\t\t\t(event: infer E0, listener: (...args: infer A0) => void);\n\t\t\t(event: infer E1, listener: (...args: infer A1) => void);\n\t\t\t(event: infer E2, listener: (...args: infer A2) => void);\n\t\t\t(event: infer E3, listener: (...args: infer A3) => void);\n\t\t\t(event: infer E4, listener: (...args: infer A4) => void);\n\t\t\t(event: infer E5, listener: (...args: infer A5) => void);\n\t\t\t(event: infer E6, listener: (...args: infer A6) => void);\n\t\t\t(event: infer E7, listener: (...args: infer A7) => void);\n\t\t\t(event: infer E8, listener: (...args: infer A8) => void);\n\t\t\t(event: infer E9, listener: (...args: infer A9) => void);\n\t\t\t(event: infer E10, listener: (...args: infer A10) => void);\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t(event: string, listener: (...args: any[]) => void);\n\t }\n\t? TransformedEvent<TThis, E0, A0> &\n\t\t\tTransformedEvent<TThis, E1, A1> &\n\t\t\tTransformedEvent<TThis, E2, A2> &\n\t\t\tTransformedEvent<TThis, E3, A3> &\n\t\t\tTransformedEvent<TThis, E4, A4> &\n\t\t\tTransformedEvent<TThis, E5, A5> &\n\t\t\tTransformedEvent<TThis, E6, A6> &\n\t\t\tTransformedEvent<TThis, E7, A7> &\n\t\t\tTransformedEvent<TThis, E8, A8> &\n\t\t\tTransformedEvent<TThis, E9, A9> &\n\t\t\tTransformedEvent<TThis, E10, A10>\n\t: TEvent extends {\n\t\t\t(event: infer E0, listener: (...args: infer A0) => void);\n\t\t\t(event: infer E1, listener: (...args: infer A1) => void);\n\t\t\t(event: infer E2, listener: (...args: infer A2) => void);\n\t\t\t(event: infer E3, listener: (...args: infer A3) => void);\n\t\t\t(event: infer E4, listener: (...args: infer A4) => void);\n\t\t\t(event: infer E5, listener: (...args: infer A5) => void);\n\t\t\t(event: infer E6, listener: (...args: infer A6) => void);\n\t\t\t(event: infer E7, listener: (...args: infer A7) => void);\n\t\t\t(event: infer E8, listener: (...args: infer A8) => void);\n\t\t\t(event: infer E9, listener: (...args: infer A9) => void);\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t(event: string, listener: (...args: any[]) => void);\n\t }\n\t? TransformedEvent<TThis, E0, A0> &\n\t\t\tTransformedEvent<TThis, E1, A1> &\n\t\t\tTransformedEvent<TThis, E2, A2> &\n\t\t\tTransformedEvent<TThis, E3, A3> &\n\t\t\tTransformedEvent<TThis, E4, A4> &\n\t\t\tTransformedEvent<TThis, E5, A5> &\n\t\t\tTransformedEvent<TThis, E6, A6> &\n\t\t\tTransformedEvent<TThis, E7, A7> &\n\t\t\tTransformedEvent<TThis, E8, A8> &\n\t\t\tTransformedEvent<TThis, E9, A9>\n\t: TEvent extends {\n\t\t\t(event: infer E0, listener: (...args: infer A0) => void);\n\t\t\t(event: infer E1, listener: (...args: infer A1) => void);\n\t\t\t(event: infer E2, listener: (...args: infer A2) => void);\n\t\t\t(event: infer E3, listener: (...args: infer A3) => void);\n\t\t\t(event: infer E4, listener: (...args: infer A4) => void);\n\t\t\t(event: infer E5, listener: (...args: infer A5) => void);\n\t\t\t(event: infer E6, listener: (...args: infer A6) => void);\n\t\t\t(event: infer E7, listener: (...args: infer A7) => void);\n\t\t\t(event: infer E8, listener: (...args: infer A8) => void);\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t(event: string, listener: (...args: any[]) => void);\n\t }\n\t? TransformedEvent<TThis, E0, A0> &\n\t\t\tTransformedEvent<TThis, E1, A1> &\n\t\t\tTransformedEvent<TThis, E2, A2> &\n\t\t\tTransformedEvent<TThis, E3, A3> &\n\t\t\tTransformedEvent<TThis, E4, A4> &\n\t\t\tTransformedEvent<TThis, E5, A5> &\n\t\t\tTransformedEvent<TThis, E6, A6> &\n\t\t\tTransformedEvent<TThis, E7, A7> &\n\t\t\tTransformedEvent<TThis, E8, A8>\n\t: TEvent extends {\n\t\t\t(event: infer E0, listener: (...args: infer A0) => void);\n\t\t\t(event: infer E1, listener: (...args: infer A1) => void);\n\t\t\t(event: infer E2, listener: (...args: infer A2) => void);\n\t\t\t(event: infer E3, listener: (...args: infer A3) => void);\n\t\t\t(event: infer E4, listener: (...args: infer A4) => void);\n\t\t\t(event: infer E5, listener: (...args: infer A5) => void);\n\t\t\t(event: infer E6, listener: (...args: infer A6) => void);\n\t\t\t(event: infer E7, listener: (...args: infer A7) => void);\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t(event: string, listener: (...args: any[]) => void);\n\t }\n\t? TransformedEvent<TThis, E0, A0> &\n\t\t\tTransformedEvent<TThis, E1, A1> &\n\t\t\tTransformedEvent<TThis, E2, A2> &\n\t\t\tTransformedEvent<TThis, E3, A3> &\n\t\t\tTransformedEvent<TThis, E4, A4> &\n\t\t\tTransformedEvent<TThis, E5, A5> &\n\t\t\tTransformedEvent<TThis, E6, A6> &\n\t\t\tTransformedEvent<TThis, E7, A7>\n\t: TEvent extends {\n\t\t\t(event: infer E0, listener: (...args: infer A0) => void);\n\t\t\t(event: infer E1, listener: (...args: infer A1) => void);\n\t\t\t(event: infer E2, listener: (...args: infer A2) => void);\n\t\t\t(event: infer E3, listener: (...args: infer A3) => void);\n\t\t\t(event: infer E4, listener: (...args: infer A4) => void);\n\t\t\t(event: infer E5, listener: (...args: infer A5) => void);\n\t\t\t(event: infer E6, listener: (...args: infer A6) => void);\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t(event: string, listener: (...args: any[]) => void);\n\t }\n\t? TransformedEvent<TThis, E0, A0> &\n\t\t\tTransformedEvent<TThis, E1, A1> &\n\t\t\tTransformedEvent<TThis, E2, A2> &\n\t\t\tTransformedEvent<TThis, E3, A3> &\n\t\t\tTransformedEvent<TThis, E4, A4> &\n\t\t\tTransformedEvent<TThis, E5, A5> &\n\t\t\tTransformedEvent<TThis, E6, A6>\n\t: TEvent extends {\n\t\t\t(event: infer E0, listener: (...args: infer A0) => void);\n\t\t\t(event: infer E1, listener: (...args: infer A1) => void);\n\t\t\t(event: infer E2, listener: (...args: infer A2) => void);\n\t\t\t(event: infer E3, listener: (...args: infer A3) => void);\n\t\t\t(event: infer E4, listener: (...args: infer A4) => void);\n\t\t\t(event: infer E5, listener: (...args: infer A5) => void);\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t(event: string, listener: (...args: any[]) => void);\n\t }\n\t? TransformedEvent<TThis, E0, A0> &\n\t\t\tTransformedEvent<TThis, E1, A1> &\n\t\t\tTransformedEvent<TThis, E2, A2> &\n\t\t\tTransformedEvent<TThis, E3, A3> &\n\t\t\tTransformedEvent<TThis, E4, A4> &\n\t\t\tTransformedEvent<TThis, E5, A5>\n\t: TEvent extends {\n\t\t\t(event: infer E0, listener: (...args: infer A0) => void);\n\t\t\t(event: infer E1, listener: (...args: infer A1) => void);\n\t\t\t(event: infer E2, listener: (...args: infer A2) => void);\n\t\t\t(event: infer E3, listener: (...args: infer A3) => void);\n\t\t\t(event: infer E4, listener: (...args: infer A4) => void);\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t(event: string, listener: (...args: any[]) => void);\n\t }\n\t? TransformedEvent<TThis, E0, A0> &\n\t\t\tTransformedEvent<TThis, E1, A1> &\n\t\t\tTransformedEvent<TThis, E2, A2> &\n\t\t\tTransformedEvent<TThis, E3, A3> &\n\t\t\tTransformedEvent<TThis, E4, A4>\n\t: TEvent extends {\n\t\t\t(event: infer E0, listener: (...args: infer A0) => void);\n\t\t\t(event: infer E1, listener: (...args: infer A1) => void);\n\t\t\t(event: infer E2, listener: (...args: infer A2) => void);\n\t\t\t(event: infer E3, listener: (...args: infer A3) => void);\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t(event: string, listener: (...args: any[]) => void);\n\t }\n\t? TransformedEvent<TThis, E0, A0> &\n\t\t\tTransformedEvent<TThis, E1, A1> &\n\t\t\tTransformedEvent<TThis, E2, A2> &\n\t\t\tTransformedEvent<TThis, E3, A3>\n\t: TEvent extends {\n\t\t\t(event: infer E0, listener: (...args: infer A0) => void);\n\t\t\t(event: infer E1, listener: (...args: infer A1) => void);\n\t\t\t(event: infer E2, listener: (...args: infer A2) => void);\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t(event: string, listener: (...args: any[]) => void);\n\t }\n\t? TransformedEvent<TThis, E0, A0> &\n\t\t\tTransformedEvent<TThis, E1, A1> &\n\t\t\tTransformedEvent<TThis, E2, A2>\n\t: TEvent extends {\n\t\t\t(event: infer E0, listener: (...args: infer A0) => void);\n\t\t\t(event: infer E1, listener: (...args: infer A1) => void);\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t(event: string, listener: (...args: any[]) => void);\n\t }\n\t? TransformedEvent<TThis, E0, A0> & TransformedEvent<TThis, E1, A1>\n\t: TEvent extends {\n\t\t\t(event: infer E0, listener: (...args: infer A0) => void);\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t(event: string, listener: (...args: any[]) => void);\n\t }\n\t? TransformedEvent<TThis, E0, A0>\n\t: // eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t TransformedEvent<TThis, string, any[]>;\n"]}
|
|
1
|
+
{"version":3,"file":"events.js","sourceRoot":"","sources":["../src/events.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 event emitters.\n * @alpha\n */\nexport interface IEvent {\n\t/**\n\t * Base event emitter signature.\n\t *\n\t * @remarks The event emitter polyfill and the node event emitter have different event types:\n\t * `string | symbol` vs. `string | number`.\n\t *\n\t * So for our typing we'll contrain to string, that way we work with both.\n\t *\n\t * @eventProperty\n\t */\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t(event: string, listener: (...args: any[]) => void);\n}\n\n/**\n * Base interface for error event emitters.\n * @alpha\n */\nexport interface IErrorEvent extends IEvent {\n\t/**\n\t * Base error event emitter signature.\n\t *\n\t * @eventProperty\n\t */\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t(event: \"error\", listener: (message: any) => void);\n}\n\n/**\n * Base interface for event providers.\n * @alpha\n */\nexport interface IEventProvider<TEvent extends IEvent> {\n\t/**\n\t * Registers a callback to be invoked when the corresponding event is triggered.\n\t */\n\treadonly on: IEventTransformer<this, TEvent>;\n\n\t/**\n\t * Registers a callback to be invoked the first time (after registration) the corresponding event is triggered.\n\t */\n\treadonly once: IEventTransformer<this, TEvent>;\n\n\t/**\n\t * Removes the corresponding event if it has been registered.\n\t */\n\treadonly off: IEventTransformer<this, TEvent>;\n}\n\n/**\n * Allows an interface to extend interfaces that already extend an {@link IEventProvider}.\n *\n * @example\n *\n * ``` typescript\n * interface AEvents extends IEvent{\n * (event: \"a-event\",listener: (a: number)=>void);\n * }\n * interface A extends IEventProvider<AEvents>{\n * a: object;\n * }\n *\n * interface BEvents extends IEvent{\n * (event: \"b-event\",listener: (b: string)=>void);\n * }\n * interface B extends ExtendEventProvider<AEvents, A, BEvents>{\n * b: boolean;\n * };\n * ```\n *\n * interface B will now extend interface A and its events\n * @alpha\n */\nexport type ExtendEventProvider<\n\tTBaseEvent extends IEvent,\n\tTBase extends IEventProvider<TBaseEvent>,\n\tTEvent extends TBaseEvent,\n> = Omit<Omit<Omit<TBase, \"on\">, \"once\">, \"off\"> &\n\tIEventProvider<TBaseEvent> &\n\tIEventProvider<TEvent>;\n\n// These types handle replacing IEventThisPlaceHolder with `this`, so we can\n// support polymorphic `this`. For instance if an event wanted to be:\n// (event: \"some-event\", listener:(target: this)=>void)\n//\n// it should be written as\n// (event: \"some-event\", listener:(target: IEventThisPlaceHolder)=>void)\n//\n// and IEventThisPlaceHolder will be replaced with this.\n// This is all consumers of these types need to know.\n\n/**\n * The placeholder type that should be used instead of `this` in events.\n * @alpha\n */\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\nexport type IEventThisPlaceHolder = { thisPlaceHolder: \"thisPlaceHolder\" };\n\n/**\n * Does the type replacement by changing types of {@link IEventThisPlaceHolder} to `TThis`\n * @alpha\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type ReplaceIEventThisPlaceHolder<L extends any[], TThis> = L extends any[]\n\t? { [K in keyof L]: L[K] extends IEventThisPlaceHolder ? TThis : L[K] }\n\t: L;\n\n/**\n * Transforms the event overload by replacing {@link IEventThisPlaceHolder} with `TThis` in the event listener\n * arguments and having the overload return `TTHis` as well\n * @alpha\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type TransformedEvent<TThis, E, A extends any[]> = (\n\tevent: E,\n\tlistener: (...args: ReplaceIEventThisPlaceHolder<A, TThis>) => void,\n) => TThis;\n\n/**\n * This type is a conditional type for transforming all the overloads provided in `TEvent`.\n *\n * @remarks\n * Due to limitations of the TypeScript typing system, we need to handle each number of overload individually.\n * It currently supports the max of 15 event overloads which is more than we use anywhere.\n * At more than 15 overloads we start to hit {@link https://github.com/microsoft/TypeScript/issues/37209 | TS2589}.\n * If we need to move beyond 15 we should evaluate using a mapped type pattern like `{\"event\":(listenerArgs)=>void}`\n * @alpha\n */\nexport type IEventTransformer<TThis, TEvent extends IEvent> = TEvent extends {\n\t(event: infer E0, listener: (...args: infer A0) => void);\n\t(event: infer E1, listener: (...args: infer A1) => void);\n\t(event: infer E2, listener: (...args: infer A2) => void);\n\t(event: infer E3, listener: (...args: infer A3) => void);\n\t(event: infer E4, listener: (...args: infer A4) => void);\n\t(event: infer E5, listener: (...args: infer A5) => void);\n\t(event: infer E6, listener: (...args: infer A6) => void);\n\t(event: infer E7, listener: (...args: infer A7) => void);\n\t(event: infer E8, listener: (...args: infer A8) => void);\n\t(event: infer E9, listener: (...args: infer A9) => void);\n\t(event: infer E10, listener: (...args: infer A10) => void);\n\t(event: infer E11, listener: (...args: infer A11) => void);\n\t(event: infer E12, listener: (...args: infer A12) => void);\n\t(event: infer E13, listener: (...args: infer A13) => void);\n\t(event: infer E14, listener: (...args: infer A14) => void);\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t(event: string, listener: (...args: any[]) => void);\n}\n\t? TransformedEvent<TThis, E0, A0> &\n\t\t\tTransformedEvent<TThis, E1, A1> &\n\t\t\tTransformedEvent<TThis, E2, A2> &\n\t\t\tTransformedEvent<TThis, E3, A3> &\n\t\t\tTransformedEvent<TThis, E4, A4> &\n\t\t\tTransformedEvent<TThis, E5, A5> &\n\t\t\tTransformedEvent<TThis, E6, A6> &\n\t\t\tTransformedEvent<TThis, E7, A7> &\n\t\t\tTransformedEvent<TThis, E8, A8> &\n\t\t\tTransformedEvent<TThis, E9, A9> &\n\t\t\tTransformedEvent<TThis, E10, A10> &\n\t\t\tTransformedEvent<TThis, E11, A11> &\n\t\t\tTransformedEvent<TThis, E12, A12> &\n\t\t\tTransformedEvent<TThis, E13, A13> &\n\t\t\tTransformedEvent<TThis, E14, A14>\n\t: TEvent extends {\n\t\t\t(event: infer E0, listener: (...args: infer A0) => void);\n\t\t\t(event: infer E1, listener: (...args: infer A1) => void);\n\t\t\t(event: infer E2, listener: (...args: infer A2) => void);\n\t\t\t(event: infer E3, listener: (...args: infer A3) => void);\n\t\t\t(event: infer E4, listener: (...args: infer A4) => void);\n\t\t\t(event: infer E5, listener: (...args: infer A5) => void);\n\t\t\t(event: infer E6, listener: (...args: infer A6) => void);\n\t\t\t(event: infer E7, listener: (...args: infer A7) => void);\n\t\t\t(event: infer E8, listener: (...args: infer A8) => void);\n\t\t\t(event: infer E9, listener: (...args: infer A9) => void);\n\t\t\t(event: infer E10, listener: (...args: infer A10) => void);\n\t\t\t(event: infer E11, listener: (...args: infer A11) => void);\n\t\t\t(event: infer E12, listener: (...args: infer A12) => void);\n\t\t\t(event: infer E13, listener: (...args: infer A13) => void);\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t(event: string, listener: (...args: any[]) => void);\n\t }\n\t? TransformedEvent<TThis, E0, A0> &\n\t\t\tTransformedEvent<TThis, E1, A1> &\n\t\t\tTransformedEvent<TThis, E2, A2> &\n\t\t\tTransformedEvent<TThis, E3, A3> &\n\t\t\tTransformedEvent<TThis, E4, A4> &\n\t\t\tTransformedEvent<TThis, E5, A5> &\n\t\t\tTransformedEvent<TThis, E6, A6> &\n\t\t\tTransformedEvent<TThis, E7, A7> &\n\t\t\tTransformedEvent<TThis, E8, A8> &\n\t\t\tTransformedEvent<TThis, E9, A9> &\n\t\t\tTransformedEvent<TThis, E10, A10> &\n\t\t\tTransformedEvent<TThis, E11, A11> &\n\t\t\tTransformedEvent<TThis, E12, A12> &\n\t\t\tTransformedEvent<TThis, E13, A13>\n\t: TEvent extends {\n\t\t\t(event: infer E0, listener: (...args: infer A0) => void);\n\t\t\t(event: infer E1, listener: (...args: infer A1) => void);\n\t\t\t(event: infer E2, listener: (...args: infer A2) => void);\n\t\t\t(event: infer E3, listener: (...args: infer A3) => void);\n\t\t\t(event: infer E4, listener: (...args: infer A4) => void);\n\t\t\t(event: infer E5, listener: (...args: infer A5) => void);\n\t\t\t(event: infer E6, listener: (...args: infer A6) => void);\n\t\t\t(event: infer E7, listener: (...args: infer A7) => void);\n\t\t\t(event: infer E8, listener: (...args: infer A8) => void);\n\t\t\t(event: infer E9, listener: (...args: infer A9) => void);\n\t\t\t(event: infer E10, listener: (...args: infer A10) => void);\n\t\t\t(event: infer E11, listener: (...args: infer A11) => void);\n\t\t\t(event: infer E12, listener: (...args: infer A12) => void);\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t(event: string, listener: (...args: any[]) => void);\n\t }\n\t? TransformedEvent<TThis, E0, A0> &\n\t\t\tTransformedEvent<TThis, E1, A1> &\n\t\t\tTransformedEvent<TThis, E2, A2> &\n\t\t\tTransformedEvent<TThis, E3, A3> &\n\t\t\tTransformedEvent<TThis, E4, A4> &\n\t\t\tTransformedEvent<TThis, E5, A5> &\n\t\t\tTransformedEvent<TThis, E6, A6> &\n\t\t\tTransformedEvent<TThis, E7, A7> &\n\t\t\tTransformedEvent<TThis, E8, A8> &\n\t\t\tTransformedEvent<TThis, E9, A9> &\n\t\t\tTransformedEvent<TThis, E10, A10> &\n\t\t\tTransformedEvent<TThis, E11, A11> &\n\t\t\tTransformedEvent<TThis, E12, A12>\n\t: TEvent extends {\n\t\t\t(event: infer E0, listener: (...args: infer A0) => void);\n\t\t\t(event: infer E1, listener: (...args: infer A1) => void);\n\t\t\t(event: infer E2, listener: (...args: infer A2) => void);\n\t\t\t(event: infer E3, listener: (...args: infer A3) => void);\n\t\t\t(event: infer E4, listener: (...args: infer A4) => void);\n\t\t\t(event: infer E5, listener: (...args: infer A5) => void);\n\t\t\t(event: infer E6, listener: (...args: infer A6) => void);\n\t\t\t(event: infer E7, listener: (...args: infer A7) => void);\n\t\t\t(event: infer E8, listener: (...args: infer A8) => void);\n\t\t\t(event: infer E9, listener: (...args: infer A9) => void);\n\t\t\t(event: infer E10, listener: (...args: infer A10) => void);\n\t\t\t(event: infer E11, listener: (...args: infer A11) => void);\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t(event: string, listener: (...args: any[]) => void);\n\t }\n\t? TransformedEvent<TThis, E0, A0> &\n\t\t\tTransformedEvent<TThis, E1, A1> &\n\t\t\tTransformedEvent<TThis, E2, A2> &\n\t\t\tTransformedEvent<TThis, E3, A3> &\n\t\t\tTransformedEvent<TThis, E4, A4> &\n\t\t\tTransformedEvent<TThis, E5, A5> &\n\t\t\tTransformedEvent<TThis, E6, A6> &\n\t\t\tTransformedEvent<TThis, E7, A7> &\n\t\t\tTransformedEvent<TThis, E8, A8> &\n\t\t\tTransformedEvent<TThis, E9, A9> &\n\t\t\tTransformedEvent<TThis, E10, A10> &\n\t\t\tTransformedEvent<TThis, E11, A11>\n\t: TEvent extends {\n\t\t\t(event: infer E0, listener: (...args: infer A0) => void);\n\t\t\t(event: infer E1, listener: (...args: infer A1) => void);\n\t\t\t(event: infer E2, listener: (...args: infer A2) => void);\n\t\t\t(event: infer E3, listener: (...args: infer A3) => void);\n\t\t\t(event: infer E4, listener: (...args: infer A4) => void);\n\t\t\t(event: infer E5, listener: (...args: infer A5) => void);\n\t\t\t(event: infer E6, listener: (...args: infer A6) => void);\n\t\t\t(event: infer E7, listener: (...args: infer A7) => void);\n\t\t\t(event: infer E8, listener: (...args: infer A8) => void);\n\t\t\t(event: infer E9, listener: (...args: infer A9) => void);\n\t\t\t(event: infer E10, listener: (...args: infer A10) => void);\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t(event: string, listener: (...args: any[]) => void);\n\t }\n\t? TransformedEvent<TThis, E0, A0> &\n\t\t\tTransformedEvent<TThis, E1, A1> &\n\t\t\tTransformedEvent<TThis, E2, A2> &\n\t\t\tTransformedEvent<TThis, E3, A3> &\n\t\t\tTransformedEvent<TThis, E4, A4> &\n\t\t\tTransformedEvent<TThis, E5, A5> &\n\t\t\tTransformedEvent<TThis, E6, A6> &\n\t\t\tTransformedEvent<TThis, E7, A7> &\n\t\t\tTransformedEvent<TThis, E8, A8> &\n\t\t\tTransformedEvent<TThis, E9, A9> &\n\t\t\tTransformedEvent<TThis, E10, A10>\n\t: TEvent extends {\n\t\t\t(event: infer E0, listener: (...args: infer A0) => void);\n\t\t\t(event: infer E1, listener: (...args: infer A1) => void);\n\t\t\t(event: infer E2, listener: (...args: infer A2) => void);\n\t\t\t(event: infer E3, listener: (...args: infer A3) => void);\n\t\t\t(event: infer E4, listener: (...args: infer A4) => void);\n\t\t\t(event: infer E5, listener: (...args: infer A5) => void);\n\t\t\t(event: infer E6, listener: (...args: infer A6) => void);\n\t\t\t(event: infer E7, listener: (...args: infer A7) => void);\n\t\t\t(event: infer E8, listener: (...args: infer A8) => void);\n\t\t\t(event: infer E9, listener: (...args: infer A9) => void);\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t(event: string, listener: (...args: any[]) => void);\n\t }\n\t? TransformedEvent<TThis, E0, A0> &\n\t\t\tTransformedEvent<TThis, E1, A1> &\n\t\t\tTransformedEvent<TThis, E2, A2> &\n\t\t\tTransformedEvent<TThis, E3, A3> &\n\t\t\tTransformedEvent<TThis, E4, A4> &\n\t\t\tTransformedEvent<TThis, E5, A5> &\n\t\t\tTransformedEvent<TThis, E6, A6> &\n\t\t\tTransformedEvent<TThis, E7, A7> &\n\t\t\tTransformedEvent<TThis, E8, A8> &\n\t\t\tTransformedEvent<TThis, E9, A9>\n\t: TEvent extends {\n\t\t\t(event: infer E0, listener: (...args: infer A0) => void);\n\t\t\t(event: infer E1, listener: (...args: infer A1) => void);\n\t\t\t(event: infer E2, listener: (...args: infer A2) => void);\n\t\t\t(event: infer E3, listener: (...args: infer A3) => void);\n\t\t\t(event: infer E4, listener: (...args: infer A4) => void);\n\t\t\t(event: infer E5, listener: (...args: infer A5) => void);\n\t\t\t(event: infer E6, listener: (...args: infer A6) => void);\n\t\t\t(event: infer E7, listener: (...args: infer A7) => void);\n\t\t\t(event: infer E8, listener: (...args: infer A8) => void);\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t(event: string, listener: (...args: any[]) => void);\n\t }\n\t? TransformedEvent<TThis, E0, A0> &\n\t\t\tTransformedEvent<TThis, E1, A1> &\n\t\t\tTransformedEvent<TThis, E2, A2> &\n\t\t\tTransformedEvent<TThis, E3, A3> &\n\t\t\tTransformedEvent<TThis, E4, A4> &\n\t\t\tTransformedEvent<TThis, E5, A5> &\n\t\t\tTransformedEvent<TThis, E6, A6> &\n\t\t\tTransformedEvent<TThis, E7, A7> &\n\t\t\tTransformedEvent<TThis, E8, A8>\n\t: TEvent extends {\n\t\t\t(event: infer E0, listener: (...args: infer A0) => void);\n\t\t\t(event: infer E1, listener: (...args: infer A1) => void);\n\t\t\t(event: infer E2, listener: (...args: infer A2) => void);\n\t\t\t(event: infer E3, listener: (...args: infer A3) => void);\n\t\t\t(event: infer E4, listener: (...args: infer A4) => void);\n\t\t\t(event: infer E5, listener: (...args: infer A5) => void);\n\t\t\t(event: infer E6, listener: (...args: infer A6) => void);\n\t\t\t(event: infer E7, listener: (...args: infer A7) => void);\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t(event: string, listener: (...args: any[]) => void);\n\t }\n\t? TransformedEvent<TThis, E0, A0> &\n\t\t\tTransformedEvent<TThis, E1, A1> &\n\t\t\tTransformedEvent<TThis, E2, A2> &\n\t\t\tTransformedEvent<TThis, E3, A3> &\n\t\t\tTransformedEvent<TThis, E4, A4> &\n\t\t\tTransformedEvent<TThis, E5, A5> &\n\t\t\tTransformedEvent<TThis, E6, A6> &\n\t\t\tTransformedEvent<TThis, E7, A7>\n\t: TEvent extends {\n\t\t\t(event: infer E0, listener: (...args: infer A0) => void);\n\t\t\t(event: infer E1, listener: (...args: infer A1) => void);\n\t\t\t(event: infer E2, listener: (...args: infer A2) => void);\n\t\t\t(event: infer E3, listener: (...args: infer A3) => void);\n\t\t\t(event: infer E4, listener: (...args: infer A4) => void);\n\t\t\t(event: infer E5, listener: (...args: infer A5) => void);\n\t\t\t(event: infer E6, listener: (...args: infer A6) => void);\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t(event: string, listener: (...args: any[]) => void);\n\t }\n\t? TransformedEvent<TThis, E0, A0> &\n\t\t\tTransformedEvent<TThis, E1, A1> &\n\t\t\tTransformedEvent<TThis, E2, A2> &\n\t\t\tTransformedEvent<TThis, E3, A3> &\n\t\t\tTransformedEvent<TThis, E4, A4> &\n\t\t\tTransformedEvent<TThis, E5, A5> &\n\t\t\tTransformedEvent<TThis, E6, A6>\n\t: TEvent extends {\n\t\t\t(event: infer E0, listener: (...args: infer A0) => void);\n\t\t\t(event: infer E1, listener: (...args: infer A1) => void);\n\t\t\t(event: infer E2, listener: (...args: infer A2) => void);\n\t\t\t(event: infer E3, listener: (...args: infer A3) => void);\n\t\t\t(event: infer E4, listener: (...args: infer A4) => void);\n\t\t\t(event: infer E5, listener: (...args: infer A5) => void);\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t(event: string, listener: (...args: any[]) => void);\n\t }\n\t? TransformedEvent<TThis, E0, A0> &\n\t\t\tTransformedEvent<TThis, E1, A1> &\n\t\t\tTransformedEvent<TThis, E2, A2> &\n\t\t\tTransformedEvent<TThis, E3, A3> &\n\t\t\tTransformedEvent<TThis, E4, A4> &\n\t\t\tTransformedEvent<TThis, E5, A5>\n\t: TEvent extends {\n\t\t\t(event: infer E0, listener: (...args: infer A0) => void);\n\t\t\t(event: infer E1, listener: (...args: infer A1) => void);\n\t\t\t(event: infer E2, listener: (...args: infer A2) => void);\n\t\t\t(event: infer E3, listener: (...args: infer A3) => void);\n\t\t\t(event: infer E4, listener: (...args: infer A4) => void);\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t(event: string, listener: (...args: any[]) => void);\n\t }\n\t? TransformedEvent<TThis, E0, A0> &\n\t\t\tTransformedEvent<TThis, E1, A1> &\n\t\t\tTransformedEvent<TThis, E2, A2> &\n\t\t\tTransformedEvent<TThis, E3, A3> &\n\t\t\tTransformedEvent<TThis, E4, A4>\n\t: TEvent extends {\n\t\t\t(event: infer E0, listener: (...args: infer A0) => void);\n\t\t\t(event: infer E1, listener: (...args: infer A1) => void);\n\t\t\t(event: infer E2, listener: (...args: infer A2) => void);\n\t\t\t(event: infer E3, listener: (...args: infer A3) => void);\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t(event: string, listener: (...args: any[]) => void);\n\t }\n\t? TransformedEvent<TThis, E0, A0> &\n\t\t\tTransformedEvent<TThis, E1, A1> &\n\t\t\tTransformedEvent<TThis, E2, A2> &\n\t\t\tTransformedEvent<TThis, E3, A3>\n\t: TEvent extends {\n\t\t\t(event: infer E0, listener: (...args: infer A0) => void);\n\t\t\t(event: infer E1, listener: (...args: infer A1) => void);\n\t\t\t(event: infer E2, listener: (...args: infer A2) => void);\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t(event: string, listener: (...args: any[]) => void);\n\t }\n\t? TransformedEvent<TThis, E0, A0> &\n\t\t\tTransformedEvent<TThis, E1, A1> &\n\t\t\tTransformedEvent<TThis, E2, A2>\n\t: TEvent extends {\n\t\t\t(event: infer E0, listener: (...args: infer A0) => void);\n\t\t\t(event: infer E1, listener: (...args: infer A1) => void);\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t(event: string, listener: (...args: any[]) => void);\n\t }\n\t? TransformedEvent<TThis, E0, A0> & TransformedEvent<TThis, E1, A1>\n\t: TEvent extends {\n\t\t\t(event: infer E0, listener: (...args: infer A0) => void);\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t(event: string, listener: (...args: any[]) => void);\n\t }\n\t? TransformedEvent<TThis, E0, A0>\n\t: // eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t TransformedEvent<TThis, string, any[]>;\n"]}
|
package/lib/fluidLoadable.js
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/*!
|
|
2
3
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
4
|
* Licensed under the MIT License.
|
|
4
5
|
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.IFluidRunnable = exports.IFluidLoadable = void 0;
|
|
5
8
|
/**
|
|
6
9
|
* @alpha
|
|
7
10
|
*/
|
|
8
|
-
|
|
11
|
+
exports.IFluidLoadable = "IFluidLoadable";
|
|
9
12
|
/**
|
|
10
13
|
* @internal
|
|
11
14
|
*/
|
|
12
|
-
|
|
15
|
+
exports.IFluidRunnable = "IFluidRunnable";
|
|
13
16
|
//# sourceMappingURL=fluidLoadable.js.map
|
package/lib/fluidLoadable.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fluidLoadable.js","sourceRoot":"","sources":["../src/fluidLoadable.ts"],"names":[],"mappings":"AAAA;;;GAGG
|
|
1
|
+
{"version":3,"file":"fluidLoadable.js","sourceRoot":"","sources":["../src/fluidLoadable.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH;;GAEG;AACU,QAAA,cAAc,GAAgC,gBAAgB,CAAC;AAiB5E;;GAEG;AACU,QAAA,cAAc,GAAgC,gBAAgB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IFluidHandle } from \"./handles\";\n\n/**\n * @alpha\n */\nexport const IFluidLoadable: keyof IProvideFluidLoadable = \"IFluidLoadable\";\n\n/**\n * @alpha\n */\nexport interface IProvideFluidLoadable {\n\treadonly IFluidLoadable: IFluidLoadable;\n}\n/**\n * A shared FluidObject has a URL from which it can be referenced\n * @alpha\n */\nexport interface IFluidLoadable extends IProvideFluidLoadable {\n\t// Handle to the loadable FluidObject\n\thandle: IFluidHandle;\n}\n\n/**\n * @internal\n */\nexport const IFluidRunnable: keyof IProvideFluidRunnable = \"IFluidRunnable\";\n\n/**\n * @internal\n */\nexport interface IProvideFluidRunnable {\n\treadonly IFluidRunnable: IFluidRunnable;\n}\n/**\n * @internal\n */\nexport interface IFluidRunnable {\n\t// TODO: Use `unknown` instead (API-Breaking)\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\trun(...args: any[]): Promise<void>;\n\tstop(reason?: string): void;\n}\n"]}
|
package/lib/fluidPackage.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/*!
|
|
2
3
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
4
|
* Licensed under the MIT License.
|
|
4
5
|
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.IFluidCodeDetailsComparer = exports.isFluidCodeDetails = exports.isFluidPackage = void 0;
|
|
5
8
|
/**
|
|
6
9
|
* Check if the package.json defines a Fluid package.
|
|
7
10
|
*
|
|
@@ -11,26 +14,28 @@
|
|
|
11
14
|
* @param pkg - The package json data to check if it is a Fluid package.
|
|
12
15
|
* @internal
|
|
13
16
|
*/
|
|
14
|
-
|
|
17
|
+
const isFluidPackage = (pkg) => typeof pkg === "object" &&
|
|
15
18
|
typeof pkg?.name === "string" &&
|
|
16
19
|
typeof pkg?.fluid === "object";
|
|
20
|
+
exports.isFluidPackage = isFluidPackage;
|
|
17
21
|
// eslint-disable-next-line jsdoc/require-description
|
|
18
22
|
/**
|
|
19
23
|
* @deprecated in favor of {@link @fluidframework/container-definitions#isFluidCodeDetails}
|
|
20
24
|
* to have code loading modules in same package.
|
|
21
25
|
* @internal
|
|
22
26
|
*/
|
|
23
|
-
|
|
27
|
+
const isFluidCodeDetails = (details) => {
|
|
24
28
|
const maybeCodeDetails = details;
|
|
25
29
|
return (typeof maybeCodeDetails === "object" &&
|
|
26
30
|
(typeof maybeCodeDetails?.package === "string" ||
|
|
27
|
-
isFluidPackage(maybeCodeDetails?.package)) &&
|
|
31
|
+
(0, exports.isFluidPackage)(maybeCodeDetails?.package)) &&
|
|
28
32
|
(maybeCodeDetails?.config === undefined || typeof maybeCodeDetails?.config === "object"));
|
|
29
33
|
};
|
|
34
|
+
exports.isFluidCodeDetails = isFluidCodeDetails;
|
|
30
35
|
/**
|
|
31
36
|
* @deprecated in favor of {@link @fluidframework/container-definitions#IFluidCodeDetailsComparer}
|
|
32
37
|
* to have code loading modules in same package.
|
|
33
38
|
* @internal
|
|
34
39
|
*/
|
|
35
|
-
|
|
40
|
+
exports.IFluidCodeDetailsComparer = "IFluidCodeDetailsComparer";
|
|
36
41
|
//# sourceMappingURL=fluidPackage.js.map
|
package/lib/fluidPackage.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fluidPackage.js","sourceRoot":"","sources":["../src/fluidPackage.ts"],"names":[],"mappings":"AAAA;;;GAGG
|
|
1
|
+
{"version":3,"file":"fluidPackage.js","sourceRoot":"","sources":["../src/fluidPackage.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAkEH;;;;;;;;GAQG;AACI,MAAM,cAAc,GAAG,CAAC,GAAY,EAAkC,EAAE,CAC9E,OAAO,GAAG,KAAK,QAAQ;IACvB,OAAQ,GAA8B,EAAE,IAAI,KAAK,QAAQ;IACzD,OAAQ,GAA8B,EAAE,KAAK,KAAK,QAAQ,CAAC;AAH/C,QAAA,cAAc,kBAGiC;AAiC5D,qDAAqD;AACrD;;;;GAIG;AACI,MAAM,kBAAkB,GAAG,CAAC,OAAgB,EAA0C,EAAE;IAC9F,MAAM,gBAAgB,GAAG,OAAiD,CAAC;IAC3E,OAAO,CACN,OAAO,gBAAgB,KAAK,QAAQ;QACpC,CAAC,OAAO,gBAAgB,EAAE,OAAO,KAAK,QAAQ;YAC7C,IAAA,sBAAc,EAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC;QAC3C,CAAC,gBAAgB,EAAE,MAAM,KAAK,SAAS,IAAI,OAAO,gBAAgB,EAAE,MAAM,KAAK,QAAQ,CAAC,CACxF,CAAC;AACH,CAAC,CAAC;AARW,QAAA,kBAAkB,sBAQ7B;AAEF;;;;GAIG;AACU,QAAA,yBAAyB,GACrC,2BAA2B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Specifies an environment on Fluid property of an {@link IFluidPackage}.\n *\n * @deprecated In favor of {@link @fluidframework/container-definitions#IFluidPackageEnvironment}\n * to have code loading modules in same package.\n * @internal\n */\nexport interface IFluidPackageEnvironment {\n\t/**\n\t * The name of the target. For a browser environment, this could be umd for scripts\n\t * or css for styles.\n\t */\n\t[target: string]:\n\t\t| undefined\n\t\t| {\n\t\t\t\t/**\n\t\t\t\t * List of files for the target. These can be relative or absolute.\n\t\t\t\t * The code loader should resolve relative paths, and validate all\n\t\t\t\t * full urls.\n\t\t\t\t */\n\t\t\t\tfiles: string[];\n\n\t\t\t\t/**\n\t\t\t\t * General access for extended fields as specific usages will\n\t\t\t\t * likely have additional infornamation like a definition\n\t\t\t\t * of Library, the entrypoint for umd packages\n\t\t\t\t */\n\t\t\t\t[key: string]: unknown;\n\t\t };\n}\n\n/**\n * Fluid-specific properties expected on a package to be loaded by the code loader.\n * While compatible with the npm package format it is not necessary that that package is an\n * npm package:\n * {@link https://stackoverflow.com/questions/10065564/add-custom-metadata-or-config-to-package-json-is-it-valid}\n *\n * @deprecated In favor of {@link @fluidframework/container-definitions#IFluidPackage}\n * to have code loading modules in same package.\n * @internal\n */\nexport interface IFluidPackage {\n\t/**\n\t * The name of the package that this code represnets\n\t */\n\tname: string;\n\t/**\n\t * This object represents the Fluid specific properties of the package\n\t */\n\tfluid: {\n\t\t/**\n\t\t * The name of the of the environment. This should be something like browser, or node\n\t\t * and contain the necessary targets for loading this code in that environment.\n\t\t */\n\t\t[environment: string]: undefined | IFluidPackageEnvironment;\n\t};\n\t/**\n\t * General access for extended fields as specific usages will\n\t * likely have additional infornamation like a definition of\n\t * compatible versions, or deployment information like rings or rollouts.\n\t */\n\t[key: string]: unknown;\n}\n\n/**\n * Check if the package.json defines a Fluid package.\n *\n * @deprecated in favor of {@link @fluidframework/container-definitions#isFluidPackage}\n * to have code loading modules in same package.\n *\n * @param pkg - The package json data to check if it is a Fluid package.\n * @internal\n */\nexport const isFluidPackage = (pkg: unknown): pkg is Readonly<IFluidPackage> =>\n\ttypeof pkg === \"object\" &&\n\ttypeof (pkg as Partial<IFluidPackage>)?.name === \"string\" &&\n\ttypeof (pkg as Partial<IFluidPackage>)?.fluid === \"object\";\n\n/**\n * Package manager configuration. Provides a key value mapping of config values.\n *\n * @deprecated in favor of {@link @fluidframework/container-definitions#IFluidCodeDetailsConfig}\n * to have code loading modules in same package.\n * @internal\n */\nexport interface IFluidCodeDetailsConfig {\n\treadonly [key: string]: string;\n}\n\n/**\n * Data structure used to describe the code to load on the Fluid document.\n *\n * @deprecated in favor of {@link @fluidframework/container-definitions#IFluidCodeDetails}\n * to have code loading modules in same package.\n * @internal\n */\nexport interface IFluidCodeDetails {\n\t/**\n\t * The code package to be used on the Fluid document. This is either the package name which will be loaded\n\t * from a package manager. Or the expanded Fluid package.\n\t */\n\treadonly package: string | Readonly<IFluidPackage>;\n\n\t/**\n\t * Configuration details. This includes links to the package manager and base CDNs.\n\t */\n\treadonly config?: IFluidCodeDetailsConfig;\n}\n\n// eslint-disable-next-line jsdoc/require-description\n/**\n * @deprecated in favor of {@link @fluidframework/container-definitions#isFluidCodeDetails}\n * to have code loading modules in same package.\n * @internal\n */\nexport const isFluidCodeDetails = (details: unknown): details is Readonly<IFluidCodeDetails> => {\n\tconst maybeCodeDetails = details as Partial<IFluidCodeDetails> | undefined;\n\treturn (\n\t\ttypeof maybeCodeDetails === \"object\" &&\n\t\t(typeof maybeCodeDetails?.package === \"string\" ||\n\t\t\tisFluidPackage(maybeCodeDetails?.package)) &&\n\t\t(maybeCodeDetails?.config === undefined || typeof maybeCodeDetails?.config === \"object\")\n\t);\n};\n\n/**\n * @deprecated in favor of {@link @fluidframework/container-definitions#IFluidCodeDetailsComparer}\n * to have code loading modules in same package.\n * @internal\n */\nexport const IFluidCodeDetailsComparer: keyof IProvideFluidCodeDetailsComparer =\n\t\"IFluidCodeDetailsComparer\";\n\n/**\n * @deprecated in favor of {@link @fluidframework/container-definitions#IProvideFluidCodeDetailsComparer}\n * to have code loading modules in same package.\n * @internal\n */\nexport interface IProvideFluidCodeDetailsComparer {\n\treadonly IFluidCodeDetailsComparer: IFluidCodeDetailsComparer;\n}\n\n/**\n * Provides capability to compare Fluid code details.\n *\n * @deprecated in favor of {@link @fluidframework/container-definitions#IFluidCodeDetailsComparer}\n * to have code loading modules in same package.\n * @internal\n */\nexport interface IFluidCodeDetailsComparer extends IProvideFluidCodeDetailsComparer {\n\t/**\n\t * Determines if the `candidate` code details satisfy the constraints specified in `constraint` code details.\n\t *\n\t * Similar semantics to:\n\t * {@link https://github.com/npm/node-semver#usage}\n\t */\n\tsatisfies(candidate: IFluidCodeDetails, constraint: IFluidCodeDetails): Promise<boolean>;\n\n\t/**\n\t * Returns a number representing the ascending sort order of the `a` and `b` code details:\n\t *\n\t * - `< 0` if `a < b`.\n\t *\n\t * - `= 0` if `a === b`.\n\t *\n\t * - `> 0` if `a > b`.\n\t *\n\t * - `undefined` if `a` is not comparable to `b`.\n\t *\n\t * Similar semantics to:\n\t * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#description | Array.sort}\n\t */\n\tcompare(a: IFluidCodeDetails, b: IFluidCodeDetails): Promise<number | undefined>;\n}\n"]}
|
package/lib/fluidRouter.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/*!
|
|
2
3
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
4
|
* Licensed under the MIT License.
|
|
4
5
|
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.IFluidRouter = void 0;
|
|
5
8
|
/**
|
|
6
9
|
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
7
10
|
* @alpha
|
|
8
11
|
*/
|
|
9
|
-
|
|
12
|
+
exports.IFluidRouter = "IFluidRouter";
|
|
10
13
|
//# sourceMappingURL=fluidRouter.js.map
|
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;;;AAkCH;;;GAGG;AACU,QAAA,YAAY,GAA8B,cAAc,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * @alpha\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\n/**\n * @alpha\n */\nexport interface IRequest {\n\turl: string;\n\theaders?: IRequestHeader;\n}\n\n/**\n * @alpha\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\n/**\n * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the \"entryPoint\" pattern. Refer to Removing-IFluidRouter.md\n * @alpha\n */\nexport const IFluidRouter: keyof IProvideFluidRouter = \"IFluidRouter\";\n\n/**\n * Request routing\n * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the \"entryPoint\" pattern. Refer to Removing-IFluidRouter.md\n * @alpha\n */\nexport interface IProvideFluidRouter {\n\treadonly IFluidRouter: IFluidRouter;\n}\n\n/**\n * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the \"entryPoint\" pattern. Refer to Removing-IFluidRouter.md\n * @alpha\n */\nexport interface IFluidRouter extends IProvideFluidRouter {\n\trequest(request: IRequest): Promise<IResponse>;\n}\n"]}
|
package/lib/handles.js
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/*!
|
|
2
3
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
4
|
* Licensed under the MIT License.
|
|
4
5
|
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.IFluidHandle = exports.IFluidHandleContext = void 0;
|
|
5
8
|
/**
|
|
6
9
|
* @alpha
|
|
7
10
|
*/
|
|
8
|
-
|
|
11
|
+
exports.IFluidHandleContext = "IFluidHandleContext";
|
|
9
12
|
/**
|
|
10
13
|
* @alpha
|
|
11
14
|
*/
|
|
12
|
-
|
|
15
|
+
exports.IFluidHandle = "IFluidHandle";
|
|
13
16
|
//# sourceMappingURL=handles.js.map
|
package/lib/handles.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handles.js","sourceRoot":"","sources":["../src/handles.ts"],"names":[],"mappings":"AAAA;;;GAGG
|
|
1
|
+
{"version":3,"file":"handles.js","sourceRoot":"","sources":["../src/handles.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAMH;;GAEG;AACU,QAAA,mBAAmB,GAAqC,qBAAqB,CAAC;AAsC3F;;GAEG;AACU,QAAA,YAAY,GAA8B,cAAc,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IRequest, IResponse } from \"./fluidRouter\";\nimport { IFluidLoadable } from \"./fluidLoadable\";\nimport { FluidObject } from \"./provider\";\n\n/**\n * @alpha\n */\nexport const IFluidHandleContext: keyof IProvideFluidHandleContext = \"IFluidHandleContext\";\n\n/**\n * @alpha\n */\nexport interface IProvideFluidHandleContext {\n\treadonly IFluidHandleContext: IFluidHandleContext;\n}\n\n/**\n * Describes a routing context from which other `IFluidHandleContext`s are defined.\n * @alpha\n */\nexport interface IFluidHandleContext extends IProvideFluidHandleContext {\n\t/**\n\t * The absolute path to the handle context from the root.\n\t */\n\treadonly absolutePath: string;\n\n\t/**\n\t * The parent IFluidHandleContext that has provided a route path to this IFluidHandleContext or undefined\n\t * at the root.\n\t */\n\treadonly routeContext?: IFluidHandleContext;\n\n\t/**\n\t * Flag indicating whether or not the entity has services attached.\n\t */\n\treadonly isAttached: boolean;\n\n\t/**\n\t * Runs through the graph and attach the bounded handles.\n\t */\n\tattachGraph(): void;\n\n\tresolveHandle(request: IRequest): Promise<IResponse>;\n}\n\n/**\n * @alpha\n */\nexport const IFluidHandle: keyof IProvideFluidHandle = \"IFluidHandle\";\n\n/**\n * @alpha\n */\nexport interface IProvideFluidHandle {\n\treadonly IFluidHandle: IFluidHandle;\n}\n\n/**\n * Handle to a shared {@link FluidObject}.\n * @alpha\n */\nexport interface IFluidHandle<\n\t// REVIEW: Constrain `T` to something? How do we support dds and datastores safely?\n\tT = FluidObject & IFluidLoadable,\n> extends IProvideFluidHandle {\n\t/**\n\t * @deprecated Do not use handle's path for routing. Use `get` to get the underlying object.\n\t *\n\t * The absolute path to the handle context from the root.\n\t */\n\treadonly absolutePath: string;\n\n\t/**\n\t * Flag indicating whether or not the entity has services attached.\n\t */\n\treadonly isAttached: boolean;\n\n\t/**\n\t * @deprecated To be removed. This is part of an internal API surface and should not be called.\n\t *\n\t * Runs through the graph and attach the bounded handles.\n\t */\n\tattachGraph(): void;\n\n\t/**\n\t * Returns a promise to the Fluid Object referenced by the handle.\n\t */\n\tget(): Promise<T>;\n\n\t/**\n\t * @deprecated To be removed. This is part of an internal API surface and should not be called.\n\t *\n\t * Binds the given handle to this one or attach the given handle if this handle is attached.\n\t * A bound handle will also be attached once this handle is attached.\n\t */\n\tbind(handle: IFluidHandle): void;\n}\n"]}
|
package/lib/index.js
CHANGED
|
@@ -1,14 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/*!
|
|
2
3
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
4
|
* Licensed under the MIT License.
|
|
4
5
|
*/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.LogLevel = exports.IFluidHandle = exports.IFluidHandleContext = exports.IFluidRouter = exports.IFluidCodeDetailsComparer = exports.isFluidCodeDetails = exports.isFluidPackage = exports.IFluidRunnable = exports.IFluidLoadable = exports.FluidErrorTypes = void 0;
|
|
8
|
+
var error_1 = require("./error");
|
|
9
|
+
Object.defineProperty(exports, "FluidErrorTypes", { enumerable: true, get: function () { return error_1.FluidErrorTypes; } });
|
|
10
|
+
var fluidLoadable_1 = require("./fluidLoadable");
|
|
11
|
+
Object.defineProperty(exports, "IFluidLoadable", { enumerable: true, get: function () { return fluidLoadable_1.IFluidLoadable; } });
|
|
12
|
+
Object.defineProperty(exports, "IFluidRunnable", { enumerable: true, get: function () { return fluidLoadable_1.IFluidRunnable; } });
|
|
13
|
+
var fluidPackage_1 = require("./fluidPackage");
|
|
14
|
+
Object.defineProperty(exports, "isFluidPackage", { enumerable: true, get: function () { return fluidPackage_1.isFluidPackage; } });
|
|
15
|
+
Object.defineProperty(exports, "isFluidCodeDetails", { enumerable: true, get: function () { return fluidPackage_1.isFluidCodeDetails; } });
|
|
16
|
+
Object.defineProperty(exports, "IFluidCodeDetailsComparer", { enumerable: true, get: function () { return fluidPackage_1.IFluidCodeDetailsComparer; } });
|
|
8
17
|
// TypeScript forgets the index signature when customers augment IRequestHeader if we export *.
|
|
9
18
|
// So we export the explicit members as a workaround:
|
|
10
19
|
// https://github.com/microsoft/TypeScript/issues/18877#issuecomment-476921038
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
20
|
+
var fluidRouter_1 = require("./fluidRouter");
|
|
21
|
+
Object.defineProperty(exports, "IFluidRouter", { enumerable: true, get: function () { return fluidRouter_1.IFluidRouter; } });
|
|
22
|
+
var handles_1 = require("./handles");
|
|
23
|
+
Object.defineProperty(exports, "IFluidHandleContext", { enumerable: true, get: function () { return handles_1.IFluidHandleContext; } });
|
|
24
|
+
Object.defineProperty(exports, "IFluidHandle", { enumerable: true, get: function () { return handles_1.IFluidHandle; } });
|
|
25
|
+
var logger_1 = require("./logger");
|
|
26
|
+
Object.defineProperty(exports, "LogLevel", { enumerable: true, get: function () { return logger_1.LogLevel; } });
|
|
14
27
|
//# 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,iCAMiB;AALhB,wGAAA,eAAe,OAAA;AAkBhB,iDAKyB;AAJxB,+GAAA,cAAc,OAAA;AAEd,+GAAA,cAAc,OAAA;AAIf,+CASwB;AANvB,8GAAA,cAAc,OAAA;AAGd,kHAAA,kBAAkB,OAAA;AAClB,yHAAA,yBAAyB,OAAA;AAI1B,+FAA+F;AAC/F,qDAAqD;AACrD,8EAA8E;AAC9E,6CAMuB;AADtB,2GAAA,YAAY,OAAA;AAGb,qCAKmB;AAJlB,8GAAA,mBAAmB,OAAA;AAEnB,uGAAA,YAAY,OAAA;AAoBb,mCAAoC;AAA3B,kGAAA,QAAQ,OAAA","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\";\nexport { ConfigTypes, IConfigProviderBase } from \"./config\";\n"]}
|
package/lib/logger.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/*!
|
|
2
3
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
4
|
* Licensed under the MIT License.
|
|
4
5
|
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.LogLevel = void 0;
|
|
5
8
|
/**
|
|
6
9
|
* Specify levels of the logs.
|
|
7
10
|
* @alpha
|
|
8
11
|
*/
|
|
9
|
-
|
|
12
|
+
exports.LogLevel = {
|
|
10
13
|
verbose: 10,
|
|
11
14
|
default: 20,
|
|
12
15
|
error: 30, // To log errors.
|
package/lib/logger.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA;;;GAGG
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAgFH;;;GAGG;AACU,QAAA,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 * @alpha\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 * @internal\n */\nexport type TelemetryBaseEventPropertyType = TelemetryEventPropertyType;\n\n/**\n * {@inheritDoc TelemetryBaseEventPropertyType}\n *\n * @deprecated Renamed to {@link TelemetryBaseEventPropertyType}\n * @alpha\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 * @alpha\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 * @internal\n */\nexport interface ITaggedTelemetryPropertyType {\n\tvalue: TelemetryEventPropertyType;\n\ttag: string;\n}\n\n/**\n * JSON-serializable properties, which will be logged with telemetry.\n * @alpha\n */\nexport type ITelemetryBaseProperties = ITelemetryProperties;\n\n/**\n * {@inheritDoc ITelemetryBaseProperties}\n *\n * @deprecated Renamed to {@link ITelemetryBaseProperties}\n * @alpha\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 * @alpha\n */\nexport interface ITelemetryBaseEvent extends ITelemetryBaseProperties {\n\tcategory: string;\n\teventName: string;\n}\n\n/**\n * Specify levels of the logs.\n * @alpha\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 * @alpha\n */\nexport type LogLevel = (typeof LogLevel)[keyof typeof LogLevel];\n\n/**\n * Interface to output telemetry events.\n * Implemented by hosting app / loader\n * @alpha\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 * @alpha\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 * @alpha\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 * @alpha\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 * @internal\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 * @alpha\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.js
CHANGED
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 * 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 * @alpha\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 * @alpha\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 * @alpha\n */\nexport type FluidObjectKeys<T> = keyof FluidObject<T>;\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 * @alpha\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 * @alpha\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 * @alpha\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.7.4.0.
|
|
3
|
+
"version": "2.0.0-dev.7.4.0.221926",
|
|
4
4
|
"description": "Fluid object interfaces",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"module": "lib/index.js",
|
|
16
16
|
"types": "dist/index.d.ts",
|
|
17
17
|
"devDependencies": {
|
|
18
|
+
"@arethetypeswrong/cli": "^0.13.3",
|
|
18
19
|
"@fluid-tools/build-cli": "^0.28.0",
|
|
19
20
|
"@fluidframework/build-common": "^2.0.3",
|
|
20
21
|
"@fluidframework/build-tools": "^0.28.0",
|
|
@@ -52,6 +53,7 @@
|
|
|
52
53
|
"build:compile": "fluid-build . --task compile",
|
|
53
54
|
"build:esnext": "tsc --project ./tsconfig.esnext.json",
|
|
54
55
|
"build:test": "tsc --project ./src/test/tsconfig.json",
|
|
56
|
+
"check:are-the-types-wrong": "attw --pack",
|
|
55
57
|
"check:release-tags": "api-extractor run --local --config ./api-extractor-lint.json",
|
|
56
58
|
"ci:build": "npm run build:compile",
|
|
57
59
|
"ci:build:docs": "api-extractor run",
|