@fluidframework/presence 2.41.0 → 2.43.0-343119
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/dist/broadcastControls.d.ts +2 -3
- package/dist/broadcastControls.d.ts.map +1 -1
- package/dist/broadcastControls.js +2 -3
- package/dist/broadcastControls.js.map +1 -1
- package/dist/datastorePresenceManagerFactory.d.ts.map +1 -1
- package/dist/datastorePresenceManagerFactory.js +1 -0
- package/dist/datastorePresenceManagerFactory.js.map +1 -1
- package/dist/datastoreSupport.d.ts +7 -2
- package/dist/datastoreSupport.d.ts.map +1 -1
- package/dist/datastoreSupport.js +6 -4
- package/dist/datastoreSupport.js.map +1 -1
- package/dist/exposedInternalTypes.d.ts +22 -4
- package/dist/exposedInternalTypes.d.ts.map +1 -1
- package/dist/exposedInternalTypes.js.map +1 -1
- package/dist/exposedUtilityTypes.d.ts +6 -5
- package/dist/exposedUtilityTypes.d.ts.map +1 -1
- package/dist/exposedUtilityTypes.js.map +1 -1
- package/dist/internalTypes.d.ts +11 -9
- package/dist/internalTypes.d.ts.map +1 -1
- package/dist/internalTypes.js.map +1 -1
- package/dist/internalUtils.d.ts +26 -8
- package/dist/internalUtils.d.ts.map +1 -1
- package/dist/internalUtils.js +35 -8
- package/dist/internalUtils.js.map +1 -1
- package/dist/latestMapValueManager.d.ts +28 -7
- package/dist/latestMapValueManager.d.ts.map +1 -1
- package/dist/latestMapValueManager.js +10 -9
- package/dist/latestMapValueManager.js.map +1 -1
- package/dist/latestValueManager.d.ts +17 -3
- package/dist/latestValueManager.d.ts.map +1 -1
- package/dist/latestValueManager.js +20 -9
- package/dist/latestValueManager.js.map +1 -1
- package/dist/latestValueTypes.d.ts +11 -1
- package/dist/latestValueTypes.d.ts.map +1 -1
- package/dist/latestValueTypes.js.map +1 -1
- package/dist/notificationsManager.d.ts +2 -2
- package/dist/notificationsManager.d.ts.map +1 -1
- package/dist/notificationsManager.js +14 -7
- package/dist/notificationsManager.js.map +1 -1
- package/dist/presence.d.ts +7 -5
- package/dist/presence.d.ts.map +1 -1
- package/dist/presence.js.map +1 -1
- package/dist/presenceDatastoreManager.d.ts +5 -6
- package/dist/presenceDatastoreManager.d.ts.map +1 -1
- package/dist/presenceDatastoreManager.js +19 -7
- package/dist/presenceDatastoreManager.js.map +1 -1
- package/dist/presenceManager.d.ts +0 -4
- package/dist/presenceManager.d.ts.map +1 -1
- package/dist/presenceManager.js +1 -3
- package/dist/presenceManager.js.map +1 -1
- package/dist/presenceStates.d.ts +9 -14
- package/dist/presenceStates.d.ts.map +1 -1
- package/dist/presenceStates.js +1 -8
- package/dist/presenceStates.js.map +1 -1
- package/dist/protocol.d.ts +37 -12
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js +7 -3
- package/dist/protocol.js.map +1 -1
- package/dist/stateDatastore.d.ts +9 -8
- package/dist/stateDatastore.d.ts.map +1 -1
- package/dist/stateDatastore.js +0 -4
- package/dist/stateDatastore.js.map +1 -1
- package/dist/systemWorkspace.d.ts +12 -6
- package/dist/systemWorkspace.d.ts.map +1 -1
- package/dist/systemWorkspace.js +14 -4
- package/dist/systemWorkspace.js.map +1 -1
- package/dist/types.d.ts +3 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/valueManager.d.ts +0 -4
- package/dist/valueManager.d.ts.map +1 -1
- package/dist/valueManager.js +0 -4
- package/dist/valueManager.js.map +1 -1
- package/lib/broadcastControls.d.ts +2 -3
- package/lib/broadcastControls.d.ts.map +1 -1
- package/lib/broadcastControls.js +2 -3
- package/lib/broadcastControls.js.map +1 -1
- package/lib/datastorePresenceManagerFactory.d.ts.map +1 -1
- package/lib/datastorePresenceManagerFactory.js +1 -0
- package/lib/datastorePresenceManagerFactory.js.map +1 -1
- package/lib/datastoreSupport.d.ts +7 -2
- package/lib/datastoreSupport.d.ts.map +1 -1
- package/lib/datastoreSupport.js +6 -4
- package/lib/datastoreSupport.js.map +1 -1
- package/lib/exposedInternalTypes.d.ts +22 -4
- package/lib/exposedInternalTypes.d.ts.map +1 -1
- package/lib/exposedInternalTypes.js.map +1 -1
- package/lib/exposedUtilityTypes.d.ts +6 -5
- package/lib/exposedUtilityTypes.d.ts.map +1 -1
- package/lib/exposedUtilityTypes.js.map +1 -1
- package/lib/internalTypes.d.ts +11 -9
- package/lib/internalTypes.d.ts.map +1 -1
- package/lib/internalTypes.js.map +1 -1
- package/lib/internalUtils.d.ts +26 -8
- package/lib/internalUtils.d.ts.map +1 -1
- package/lib/internalUtils.js +31 -7
- package/lib/internalUtils.js.map +1 -1
- package/lib/latestMapValueManager.d.ts +28 -7
- package/lib/latestMapValueManager.d.ts.map +1 -1
- package/lib/latestMapValueManager.js +11 -10
- package/lib/latestMapValueManager.js.map +1 -1
- package/lib/latestValueManager.d.ts +17 -3
- package/lib/latestValueManager.d.ts.map +1 -1
- package/lib/latestValueManager.js +19 -9
- package/lib/latestValueManager.js.map +1 -1
- package/lib/latestValueTypes.d.ts +11 -1
- package/lib/latestValueTypes.d.ts.map +1 -1
- package/lib/latestValueTypes.js.map +1 -1
- package/lib/notificationsManager.d.ts +2 -2
- package/lib/notificationsManager.d.ts.map +1 -1
- package/lib/notificationsManager.js +14 -7
- package/lib/notificationsManager.js.map +1 -1
- package/lib/presence.d.ts +7 -5
- package/lib/presence.d.ts.map +1 -1
- package/lib/presence.js.map +1 -1
- package/lib/presenceDatastoreManager.d.ts +5 -6
- package/lib/presenceDatastoreManager.d.ts.map +1 -1
- package/lib/presenceDatastoreManager.js +20 -8
- package/lib/presenceDatastoreManager.js.map +1 -1
- package/lib/presenceManager.d.ts +0 -4
- package/lib/presenceManager.d.ts.map +1 -1
- package/lib/presenceManager.js +1 -3
- package/lib/presenceManager.js.map +1 -1
- package/lib/presenceStates.d.ts +9 -14
- package/lib/presenceStates.d.ts.map +1 -1
- package/lib/presenceStates.js +1 -8
- package/lib/presenceStates.js.map +1 -1
- package/lib/protocol.d.ts +37 -12
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +6 -2
- package/lib/protocol.js.map +1 -1
- package/lib/stateDatastore.d.ts +9 -8
- package/lib/stateDatastore.d.ts.map +1 -1
- package/lib/stateDatastore.js +0 -4
- package/lib/stateDatastore.js.map +1 -1
- package/lib/systemWorkspace.d.ts +12 -6
- package/lib/systemWorkspace.d.ts.map +1 -1
- package/lib/systemWorkspace.js +14 -4
- package/lib/systemWorkspace.js.map +1 -1
- package/lib/types.d.ts +3 -2
- package/lib/types.d.ts.map +1 -1
- package/lib/types.js.map +1 -1
- package/lib/valueManager.d.ts +0 -4
- package/lib/valueManager.d.ts.map +1 -1
- package/lib/valueManager.js +0 -4
- package/lib/valueManager.js.map +1 -1
- package/package.json +17 -17
package/lib/datastoreSupport.js
CHANGED
|
@@ -6,8 +6,9 @@ import { assert } from "@fluidframework/core-utils/internal";
|
|
|
6
6
|
import { FluidDataStoreRuntime } from "@fluidframework/datastore/internal";
|
|
7
7
|
import { create404Response } from "@fluidframework/runtime-utils/internal";
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
* the entrypoint Fluid object that is expected to be a
|
|
9
|
+
* `BasicFluidDataStoreRuntime` extends the FluidDataStoreRuntime to provide a request
|
|
10
|
+
* method that routes requests to the entrypoint Fluid object that is expected to be a
|
|
11
|
+
* {@link LoadableFluidObject}.
|
|
11
12
|
*/
|
|
12
13
|
class BasicFluidDataStoreRuntime extends FluidDataStoreRuntime {
|
|
13
14
|
async request(request) {
|
|
@@ -30,7 +31,7 @@ class BasicFluidDataStoreRuntime extends FluidDataStoreRuntime {
|
|
|
30
31
|
}
|
|
31
32
|
}
|
|
32
33
|
/**
|
|
33
|
-
* @
|
|
34
|
+
* `BasicDataStoreFactory` is the factory for creating a {@link BasicFluidDataStoreRuntime}.
|
|
34
35
|
*/
|
|
35
36
|
export class BasicDataStoreFactory {
|
|
36
37
|
get IFluidDataStoreFactory() {
|
|
@@ -54,7 +55,8 @@ export class BasicDataStoreFactory {
|
|
|
54
55
|
}
|
|
55
56
|
}
|
|
56
57
|
/**
|
|
57
|
-
* @
|
|
58
|
+
* `LoadableFluidObject` is helper to build a DataObject handling the {@link FluidObject}
|
|
59
|
+
* and {@link IFluidLoadable} requirements.
|
|
58
60
|
*/
|
|
59
61
|
export class LoadableFluidObject {
|
|
60
62
|
constructor(runtime) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"datastoreSupport.js","sourceRoot":"","sources":["../src/datastoreSupport.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"datastoreSupport.js","sourceRoot":"","sources":["../src/datastoreSupport.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAcH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAK3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAE3E;;;;GAIG;AACH,MAAM,0BAA2B,SAAQ,qBAAqB;IAC7C,KAAK,CAAC,OAAO,CAAC,OAAiB;QAC9C,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAC9C,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;YAC7B,OAAO,QAAQ,CAAC;QACjB,CAAC;QACD,4DAA4D;QAC5D,4CAA4C;QAC5C,gCAAgC;QAChC,gCAAgC;QAChC,IAAI,OAAO,CAAC,GAAG,KAAK,EAAE,IAAI,OAAO,CAAC,GAAG,KAAK,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YAC/E,qEAAqE;YACrE,mDAAmD;YACnD,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC;YAC/C,MAAM,CACL,UAAU,YAAY,mBAAmB,EACzC,KAAK,CAAC,wDAAwD,CAC9D,CAAC;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esContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * This module provided collection of minimal (slim) helpers to support\n * DataObject creation for temporary {@link ExperimentalPresenceManager}.\n */\n\nimport type {\n\tFluidObject,\n\tIFluidLoadable,\n\tIRequest,\n\tIResponse,\n} from \"@fluidframework/core-interfaces\";\nimport type { IFluidHandleInternal } from \"@fluidframework/core-interfaces/internal\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { FluidDataStoreRuntime } from \"@fluidframework/datastore/internal\";\nimport type {\n\tIFluidDataStoreContext,\n\tIFluidDataStoreFactory,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport { create404Response } from \"@fluidframework/runtime-utils/internal\";\n\n/**\n * `BasicFluidDataStoreRuntime` extends the FluidDataStoreRuntime to provide a request\n * method that routes requests to the entrypoint Fluid object that is expected to be a\n * {@link LoadableFluidObject}.\n */\nclass BasicFluidDataStoreRuntime extends FluidDataStoreRuntime {\n\tpublic override async request(request: IRequest): Promise<IResponse> {\n\t\tconst response = await super.request(request);\n\t\tif (response.status !== 404) {\n\t\t\treturn response;\n\t\t}\n\t\t// Return entrypoint object if someone requests it directly.\n\t\t// Direct requests exist from two scenarios:\n\t\t// 1. the request url is a \"/\"\n\t\t// 2. the request url is empty\n\t\tif (request.url === \"\" || request.url === \"/\" || request.url.startsWith(\"/?\")) {\n\t\t\t// The provideEntryPoint callback below always returns an instance of\n\t\t\t// LoadableFluidObject. Make sure that is the case.\n\t\t\tconst dataObject = await this.entryPoint.get();\n\t\t\tassert(\n\t\t\t\tdataObject instanceof LoadableFluidObject,\n\t\t\t\t0xa36 /* Data store runtime entryPoint is not expected type */,\n\t\t\t);\n\t\t\treturn { mimeType: \"fluid/object\", status: 200, value: dataObject };\n\t\t}\n\t\treturn create404Response(request);\n\t}\n}\n\n/**\n * `BasicDataStoreFactory` is the factory for creating a {@link BasicFluidDataStoreRuntime}.\n */\nexport class BasicDataStoreFactory<Type extends string> implements IFluidDataStoreFactory {\n\tpublic get IFluidDataStoreFactory(): IFluidDataStoreFactory {\n\t\treturn this;\n\t}\n\n\tpublic constructor(\n\t\tpublic readonly type: Type,\n\t\tprivate readonly instanceCtor: new (runtime: FluidDataStoreRuntime) => LoadableFluidObject,\n\t) {}\n\n\tpublic async instantiateDataStore(\n\t\tcontext: IFluidDataStoreContext,\n\t\texisting: boolean,\n\t): Promise<FluidDataStoreRuntime> {\n\t\t// Create a new runtime for our data store.\n\t\t// The runtime is what Fluid uses to route to our data store.\n\t\tconst runtime: FluidDataStoreRuntime = new BasicFluidDataStoreRuntime(\n\t\t\tcontext,\n\t\t\t/* ISharedObjectRegistry */ new Map(),\n\t\t\texisting,\n\t\t\t/* provideEntryPoint */ async () => {\n\t\t\t\tassert(instance !== undefined, 0xa37 /* Intended entryPoint is undefined */);\n\t\t\t\treturn instance;\n\t\t\t},\n\t\t);\n\n\t\tconst instance = new this.instanceCtor(runtime);\n\n\t\treturn runtime;\n\t}\n}\n\n/**\n * `LoadableFluidObject` is helper to build a DataObject handling the {@link FluidObject}\n * and {@link IFluidLoadable} requirements.\n */\nexport abstract class LoadableFluidObject implements FluidObject, IFluidLoadable {\n\tpublic constructor(protected readonly runtime: FluidDataStoreRuntime) {}\n\n\tpublic get IFluidLoadable(): this {\n\t\treturn this;\n\t}\n\n\t/**\n\t * Handle to the this Fluid object.\n\t */\n\tpublic get handle(): IFluidHandleInternal<FluidObject> {\n\t\t// BasicDataStoreFactory provides an entryPoint initialization function\n\t\t// to the data store runtime; so, this object should always have access to a\n\t\t// non-null entryPoint.\n\t\tassert(this.runtime.entryPoint !== undefined, 0xa38 /* EntryPoint was undefined */);\n\t\treturn this.runtime.entryPoint;\n\t}\n}\n"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import type {
|
|
5
|
+
import type { OpaqueJsonDeserialized } from "@fluidframework/core-interfaces/internal/exposedUtilityTypes";
|
|
6
6
|
/**
|
|
7
7
|
* Collection of value types that are not intended to be used/imported
|
|
8
8
|
* directly outside of this package.
|
|
@@ -19,16 +19,34 @@ export declare namespace InternalTypes {
|
|
|
19
19
|
timestamp: number;
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
|
+
* Represents a state that may have a value.
|
|
23
|
+
* And it includes standard metadata.
|
|
24
|
+
*
|
|
25
|
+
* @remarks
|
|
26
|
+
* See {@link InternalTypes.ValueRequiredState}.
|
|
27
|
+
*
|
|
22
28
|
* @system
|
|
23
29
|
*/
|
|
24
30
|
interface ValueOptionalState<TValue> extends ValueStateMetadata {
|
|
25
|
-
value?:
|
|
31
|
+
value?: OpaqueJsonDeserialized<TValue>;
|
|
26
32
|
}
|
|
27
33
|
/**
|
|
34
|
+
* Represents a state that must have a value.
|
|
35
|
+
* And it includes standard metadata.
|
|
36
|
+
*
|
|
37
|
+
* @remarks
|
|
38
|
+
* The value is wrapped in `OpaqueJsonDeserialized` as uses are expected
|
|
39
|
+
* to involve generic or unknown types that will be filtered. It is here
|
|
40
|
+
* mostly as a convenience to the many such uses that would otherwise
|
|
41
|
+
* need to specify some wrapper themselves.
|
|
42
|
+
*
|
|
43
|
+
* For known cases, construct a custom interface that extends
|
|
44
|
+
* {@link InternalTypes.ValueStateMetadata}.
|
|
45
|
+
*
|
|
28
46
|
* @system
|
|
29
47
|
*/
|
|
30
48
|
interface ValueRequiredState<TValue> extends ValueStateMetadata {
|
|
31
|
-
value:
|
|
49
|
+
value: OpaqueJsonDeserialized<TValue>;
|
|
32
50
|
}
|
|
33
51
|
/**
|
|
34
52
|
* @system
|
|
@@ -97,7 +115,7 @@ export declare namespace InternalTypes {
|
|
|
97
115
|
*/
|
|
98
116
|
interface NotificationType {
|
|
99
117
|
name: string;
|
|
100
|
-
args:
|
|
118
|
+
args: unknown[];
|
|
101
119
|
}
|
|
102
120
|
}
|
|
103
121
|
//# sourceMappingURL=exposedInternalTypes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exposedInternalTypes.d.ts","sourceRoot":"","sources":["../src/exposedInternalTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"exposedInternalTypes.d.ts","sourceRoot":"","sources":["../src/exposedInternalTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,8DAA8D,CAAC;AAE3G;;;;;;GAMG;AAEH,yBAAiB,aAAa,CAAC;IAC9B;;OAEG;IACH,UAAiB,kBAAkB;QAClC,GAAG,EAAE,MAAM,CAAC;QACZ,SAAS,EAAE,MAAM,CAAC;KAClB;IAED;;;;;;;;OAQG;IACH,UAAiB,kBAAkB,CAAC,MAAM,CAAE,SAAQ,kBAAkB;QACrE,KAAK,CAAC,EAAE,sBAAsB,CAAC,MAAM,CAAC,CAAC;KACvC;IAED;;;;;;;;;;;;;;OAcG;IACH,UAAiB,kBAAkB,CAAC,MAAM,CAAE,SAAQ,kBAAkB;QACrE,KAAK,EAAE,sBAAsB,CAAC,MAAM,CAAC,CAAC;KACtC;IAED;;OAEG;IACH,UAAiB,cAAc,CAAC,CAAC;QAChC,GAAG,EAAE,MAAM,CAAC;QACZ,KAAK,EAAE;YAIN,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,kBAAkB,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC;SACnE,CAAC;KACF;IAED;;OAEG;IACH,KAAY,qBAAqB,CAAC,CAAC,IAAI,kBAAkB,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC;IAEjF;;OAEG;IACH,UAAiB,aAAa,CAAC,CAAC,EAAE,IAAI,SAAS,MAAM,GAAG,MAAM;QAC7D,GAAG,EAAE,MAAM,CAAC;QACZ,KAAK,EAAE;aAIL,IAAI,IAAI,IAAI,GAAG,kBAAkB,CAAC,CAAC,CAAC;SACrC,CAAC;KACF;IAED;;OAEG;IACH,MAAqB,oBAAoB,CAAC,IAAI,EAAE,MAAM,SAAS,qBAAqB,CAAC,GAAG,CAAC;QACxF,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAqC;KAC1E;IAED;;;;;OAKG;IACH,MAAqB,eAAe,CAAC,CAAC;QACrC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAgB;KAC3C;IAED;;;;;;;;;OASG;IACH,KAAY,UAAU,CAAC,CAAC,IAAI,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC;IAEnD;;;;OAIG;IACH,KAAY,cAAc,CACzB,IAAI,SAAS,MAAM,EACnB,MAAM,SAAS,qBAAqB,CAAC,GAAG,CAAC,EACzC,QAAQ,IACL;QAAE,YAAY,EAAE,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAA;KAAE,GAAG,CAAC,CACpD,GAAG,EAAE,IAAI,EACT,eAAe,EAAE,oBAAoB,CAAC,IAAI,EAAE,MAAM,CAAC,KAC/C;QACJ,WAAW,CAAC,EAAE;YAAE,KAAK,EAAE,MAAM,CAAC;YAAC,wBAAwB,EAAE,MAAM,GAAG,SAAS,CAAA;SAAE,CAAC;QAC9E,OAAO,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC;KAC9B,CAAC,CAAC;IAEH;;OAEG;IACH,UAAiB,gBAAgB;QAChC,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,OAAO,EAAE,CAAC;KAChB;CACD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exposedInternalTypes.js","sourceRoot":"","sources":["../src/exposedInternalTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"exposedInternalTypes.js","sourceRoot":"","sources":["../src/exposedInternalTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;;;;GAMG;AACH,2DAA2D;AAC3D,MAAM,KAAW,aAAa,CA6H7B;AA7HD,WAAiB,aAAa;AA6H9B,CAAC,EA7HgB,aAAa,KAAb,aAAa,QA6H7B","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { OpaqueJsonDeserialized } from \"@fluidframework/core-interfaces/internal/exposedUtilityTypes\";\n\n/**\n * Collection of value types that are not intended to be used/imported\n * directly outside of this package.\n *\n * @beta\n * @system\n */\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace InternalTypes {\n\t/**\n\t * @system\n\t */\n\texport interface ValueStateMetadata {\n\t\trev: number;\n\t\ttimestamp: number;\n\t}\n\n\t/**\n\t * Represents a state that may have a value.\n\t * And it includes standard metadata.\n\t *\n\t * @remarks\n\t * See {@link InternalTypes.ValueRequiredState}.\n\t *\n\t * @system\n\t */\n\texport interface ValueOptionalState<TValue> extends ValueStateMetadata {\n\t\tvalue?: OpaqueJsonDeserialized<TValue>;\n\t}\n\n\t/**\n\t * Represents a state that must have a value.\n\t * And it includes standard metadata.\n\t *\n\t * @remarks\n\t * The value is wrapped in `OpaqueJsonDeserialized` as uses are expected\n\t * to involve generic or unknown types that will be filtered. It is here\n\t * mostly as a convenience to the many such uses that would otherwise\n\t * need to specify some wrapper themselves.\n\t *\n\t * For known cases, construct a custom interface that extends\n\t * {@link InternalTypes.ValueStateMetadata}.\n\t *\n\t * @system\n\t */\n\texport interface ValueRequiredState<TValue> extends ValueStateMetadata {\n\t\tvalue: OpaqueJsonDeserialized<TValue>;\n\t}\n\n\t/**\n\t * @system\n\t */\n\texport interface ValueDirectory<T> {\n\t\trev: number;\n\t\titems: {\n\t\t\t// Caution: any particular item may or may not exist\n\t\t\t// Typescript does not support absent keys without forcing type to also be undefined.\n\t\t\t// See https://github.com/microsoft/TypeScript/issues/42810.\n\t\t\t[name: string | number]: ValueOptionalState<T> | ValueDirectory<T>;\n\t\t};\n\t}\n\n\t/**\n\t * @system\n\t */\n\texport type ValueDirectoryOrState<T> = ValueRequiredState<T> | ValueDirectory<T>;\n\n\t/**\n\t * @system\n\t */\n\texport interface MapValueState<T, Keys extends string | number> {\n\t\trev: number;\n\t\titems: {\n\t\t\t// Caution: any particular item may or may not exist\n\t\t\t// Typescript does not support absent keys without forcing type to also be undefined.\n\t\t\t// See https://github.com/microsoft/TypeScript/issues/42810.\n\t\t\t[name in Keys]: ValueOptionalState<T>;\n\t\t};\n\t}\n\n\t/**\n\t * @system\n\t */\n\texport declare class StateDatastoreHandle<TKey, TValue extends ValueDirectoryOrState<any>> {\n\t\tprivate readonly StateDatastoreHandle: StateDatastoreHandle<TKey, TValue>;\n\t}\n\n\t/**\n\t * Brand to ensure state values internal type safety without revealing\n\t * internals that are subject to change.\n\t *\n\t * @system\n\t */\n\texport declare class StateValueBrand<T> {\n\t\tprivate readonly StateValue: StateValue<T>;\n\t}\n\n\t/**\n\t * This type provides no additional functionality over the type it wraps.\n\t * It is used to ensure type safety within package.\n\t * Users may find it convenient to just use the type it wraps directly.\n\t *\n\t * @privateRemarks\n\t * Checkout filtering omitting unknown from T (`Omit<T,unknown> &`).\n\t *\n\t * @system\n\t */\n\texport type StateValue<T> = T & StateValueBrand<T>;\n\n\t/**\n\t * Package internal function declaration for state and notification instantiation.\n\t *\n\t * @system\n\t */\n\texport type ManagerFactory<\n\t\tTKey extends string,\n\t\tTValue extends ValueDirectoryOrState<any>,\n\t\tTManager,\n\t> = { instanceBase: new (...args: any[]) => any } & ((\n\t\tkey: TKey,\n\t\tdatastoreHandle: StateDatastoreHandle<TKey, TValue>,\n\t) => {\n\t\tinitialData?: { value: TValue; allowableUpdateLatencyMs: number | undefined };\n\t\tmanager: StateValue<TManager>;\n\t});\n\n\t/**\n\t * @system\n\t */\n\texport interface NotificationType {\n\t\tname: string;\n\t\targs: unknown[];\n\t}\n}\n"]}
|
|
@@ -12,11 +12,12 @@ import type { InternalUtilityTypes as CoreInternalUtilityTypes, JsonDeserialized
|
|
|
12
12
|
*/
|
|
13
13
|
export declare namespace InternalUtilityTypes {
|
|
14
14
|
/**
|
|
15
|
-
* `
|
|
15
|
+
* Yields `IfListener` when the given type is an acceptable shape for a notification.
|
|
16
|
+
* `Else` otherwise.
|
|
16
17
|
*
|
|
17
18
|
* @system
|
|
18
19
|
*/
|
|
19
|
-
type
|
|
20
|
+
type IfNotificationListener<Event, IfListener, Else> = Event extends (...args: infer P) => void ? CoreInternalUtilityTypes.IfSameType<P, JsonSerializable<P>, IfListener, Else> : Else;
|
|
20
21
|
/**
|
|
21
22
|
* Used to specify the kinds of notifications emitted by a {@link NotificationListenable}.
|
|
22
23
|
*
|
|
@@ -37,19 +38,19 @@ export declare namespace InternalUtilityTypes {
|
|
|
37
38
|
* @system
|
|
38
39
|
*/
|
|
39
40
|
type NotificationListeners<E> = {
|
|
40
|
-
[P in
|
|
41
|
+
[P in keyof E as IfNotificationListener<E[P], P, never>]: E[P];
|
|
41
42
|
};
|
|
42
43
|
/**
|
|
43
44
|
* {@link @fluidframework/core-interfaces#JsonDeserialized} version of the parameters of a function.
|
|
44
45
|
*
|
|
45
46
|
* @system
|
|
46
47
|
*/
|
|
47
|
-
type JsonDeserializedParameters<T extends (...args: any) => any> = T extends (...args: infer P) => any ? JsonDeserialized<P> : never;
|
|
48
|
+
type JsonDeserializedParameters<T extends (...args: any[]) => any> = T extends (...args: infer P) => any ? JsonDeserialized<P> : never;
|
|
48
49
|
/**
|
|
49
50
|
* {@link @fluidframework/core-interfaces#JsonSerializable} version of the parameters of a function.
|
|
50
51
|
*
|
|
51
52
|
* @system
|
|
52
53
|
*/
|
|
53
|
-
type JsonSerializableParameters<T extends (...args: any) => any> = T extends (...args: infer P) => any ? JsonSerializable<P> : never;
|
|
54
|
+
type JsonSerializableParameters<T extends (...args: any[]) => any> = T extends (...args: infer P) => any ? JsonSerializable<P> : never;
|
|
54
55
|
}
|
|
55
56
|
//# sourceMappingURL=exposedUtilityTypes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exposedUtilityTypes.d.ts","sourceRoot":"","sources":["../src/exposedUtilityTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,oBAAoB,IAAI,wBAAwB,EAChD,gBAAgB,EAChB,gBAAgB,EAChB,MAAM,8DAA8D,CAAC;AAEtE;;;;;;GAMG;AAEH,yBAAiB,oBAAoB,CAAC;IACrC
|
|
1
|
+
{"version":3,"file":"exposedUtilityTypes.d.ts","sourceRoot":"","sources":["../src/exposedUtilityTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,oBAAoB,IAAI,wBAAwB,EAChD,gBAAgB,EAChB,gBAAgB,EAChB,MAAM,8DAA8D,CAAC;AAEtE;;;;;;GAMG;AAEH,yBAAiB,oBAAoB,CAAC;IACrC;;;;;OAKG;IACH,KAAY,sBAAsB,CAAC,KAAK,EAAE,UAAU,EAAE,IAAI,IAAI,KAAK,SAAS,CAC3E,GAAG,IAAI,EAAE,MAAM,CAAC,KACZ,IAAI,GACN,wBAAwB,CAAC,UAAU,CAAC,CAAC,EAAE,gBAAgB,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,IAAI,CAAC,GAC7E,IAAI,CAAC;IAER;;;;;;;;;;;;;;;;;;OAkBG;IACH,KAAY,qBAAqB,CAAC,CAAC,IAAI;SACrC,CAAC,IAAI,MAAM,CAAC,IAAI,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;KAC9D,CAAC;IAEF;;;;OAIG;IACH,KAAY,0BAA0B,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,IAAI,CAAC,SAAS,CACrF,GAAG,IAAI,EAAE,MAAM,CAAC,KACZ,GAAG,GACL,gBAAgB,CAAC,CAAC,CAAC,GACnB,KAAK,CAAC;IAET;;;;OAIG;IACH,KAAY,0BAA0B,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,IAAI,CAAC,SAAS,CACrF,GAAG,IAAI,EAAE,MAAM,CAAC,KACZ,GAAG,GACL,gBAAgB,CAAC,CAAC,CAAC,GACnB,KAAK,CAAC;CACT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exposedUtilityTypes.js","sourceRoot":"","sources":["../src/exposedUtilityTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tInternalUtilityTypes as CoreInternalUtilityTypes,\n\tJsonDeserialized,\n\tJsonSerializable,\n} from \"@fluidframework/core-interfaces/internal/exposedUtilityTypes\";\n\n/**\n * Collection of utility types that are not intended to be used/imported\n * directly outside of this package.\n *\n * @alpha\n * @system\n */\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace InternalUtilityTypes {\n\t/**\n\t * `
|
|
1
|
+
{"version":3,"file":"exposedUtilityTypes.js","sourceRoot":"","sources":["../src/exposedUtilityTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tInternalUtilityTypes as CoreInternalUtilityTypes,\n\tJsonDeserialized,\n\tJsonSerializable,\n} from \"@fluidframework/core-interfaces/internal/exposedUtilityTypes\";\n\n/**\n * Collection of utility types that are not intended to be used/imported\n * directly outside of this package.\n *\n * @alpha\n * @system\n */\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace InternalUtilityTypes {\n\t/**\n\t * Yields `IfListener` when the given type is an acceptable shape for a notification.\n\t * `Else` otherwise.\n\t *\n\t * @system\n\t */\n\texport type IfNotificationListener<Event, IfListener, Else> = Event extends (\n\t\t...args: infer P\n\t) => void\n\t\t? CoreInternalUtilityTypes.IfSameType<P, JsonSerializable<P>, IfListener, Else>\n\t\t: Else;\n\n\t/**\n\t * Used to specify the kinds of notifications emitted by a {@link NotificationListenable}.\n\t *\n\t * @remarks\n\t *\n\t * Any object type is a valid NotificationListeners, but only the notification-like\n\t * properties of that type will be included.\n\t *\n\t * @example\n\t *\n\t * ```typescript\n\t * interface MyNotifications {\n\t * load: (user: string, data: IUserData) => void;\n\t * requestPause: (period: number) => void;\n\t * }\n\t * ```\n\t *\n\t * @system\n\t */\n\texport type NotificationListeners<E> = {\n\t\t[P in keyof E as IfNotificationListener<E[P], P, never>]: E[P];\n\t};\n\n\t/**\n\t * {@link @fluidframework/core-interfaces#JsonDeserialized} version of the parameters of a function.\n\t *\n\t * @system\n\t */\n\texport type JsonDeserializedParameters<T extends (...args: any[]) => any> = T extends (\n\t\t...args: infer P\n\t) => any\n\t\t? JsonDeserialized<P>\n\t\t: never;\n\n\t/**\n\t * {@link @fluidframework/core-interfaces#JsonSerializable} version of the parameters of a function.\n\t *\n\t * @system\n\t */\n\texport type JsonSerializableParameters<T extends (...args: any[]) => any> = T extends (\n\t\t...args: infer P\n\t) => any\n\t\t? JsonSerializable<P>\n\t\t: never;\n}\n"]}
|
package/lib/internalTypes.d.ts
CHANGED
|
@@ -5,21 +5,22 @@
|
|
|
5
5
|
import type { ExtensionHost as ContainerExtensionHost } from "@fluidframework/container-runtime-definitions/internal";
|
|
6
6
|
import type { InternalTypes } from "./exposedInternalTypes.js";
|
|
7
7
|
import type { AttendeeId, Attendee } from "./presence.js";
|
|
8
|
-
import type { OutboundClientJoinMessage, OutboundDatastoreUpdateMessage, SignalMessages } from "./protocol.js";
|
|
8
|
+
import type { OutboundAcknowledgementMessage, OutboundClientJoinMessage, OutboundDatastoreUpdateMessage, SignalMessages } from "./protocol.js";
|
|
9
9
|
/**
|
|
10
10
|
* Presence {@link ContainerExtension} version of {@link @fluidframework/container-runtime-definitions#ExtensionRuntimeProperties}
|
|
11
|
-
* @internal
|
|
12
11
|
*/
|
|
13
12
|
export interface ExtensionRuntimeProperties {
|
|
14
13
|
SignalMessages: SignalMessages;
|
|
15
14
|
}
|
|
16
15
|
/**
|
|
17
16
|
* Presence specific ExtensionHost
|
|
18
|
-
* @internal
|
|
19
17
|
*/
|
|
20
18
|
export type ExtensionHost = ContainerExtensionHost<ExtensionRuntimeProperties>;
|
|
21
19
|
/**
|
|
22
|
-
* @
|
|
20
|
+
* Basic structure of set of {@link Attendee} records within Presence datastore
|
|
21
|
+
*
|
|
22
|
+
* @remarks
|
|
23
|
+
* This is commonly exists per named state in State Managers.
|
|
23
24
|
*/
|
|
24
25
|
export interface ClientRecord<TValue extends InternalTypes.ValueDirectoryOrState<unknown>> {
|
|
25
26
|
[AttendeeId: AttendeeId]: TValue;
|
|
@@ -30,8 +31,6 @@ export interface ClientRecord<TValue extends InternalTypes.ValueDirectoryOrState
|
|
|
30
31
|
*
|
|
31
32
|
* @privateRemarks
|
|
32
33
|
* Replace with non-DataStore based interface.
|
|
33
|
-
*
|
|
34
|
-
* @internal
|
|
35
34
|
*/
|
|
36
35
|
export type IEphemeralRuntime = Omit<ExtensionHost, "logger" | "submitAddressedSignal"> & Partial<Pick<ExtensionHost, "logger">> & {
|
|
37
36
|
/**
|
|
@@ -40,17 +39,20 @@ export type IEphemeralRuntime = Omit<ExtensionHost, "logger" | "submitAddressedS
|
|
|
40
39
|
* @param content - Content of the signal. Should be a JSON serializable object or primitive.
|
|
41
40
|
* @param targetClientId - When specified, the signal is only sent to the provided client id.
|
|
42
41
|
*/
|
|
43
|
-
submitSignal: (message: OutboundClientJoinMessage | OutboundDatastoreUpdateMessage) => void;
|
|
42
|
+
submitSignal: (message: OutboundAcknowledgementMessage | OutboundClientJoinMessage | OutboundDatastoreUpdateMessage) => void;
|
|
44
43
|
};
|
|
45
44
|
/**
|
|
46
|
-
*
|
|
45
|
+
* Contract for State Managers as used by a States Workspace (`PresenceStatesImpl`)
|
|
46
|
+
*
|
|
47
|
+
* @remarks
|
|
48
|
+
* See uses of `unbrandIVM`.
|
|
47
49
|
*/
|
|
48
50
|
export interface ValueManager<TValue, TValueState extends InternalTypes.ValueDirectoryOrState<TValue> = InternalTypes.ValueDirectoryOrState<TValue>> {
|
|
49
51
|
readonly value?: TValueState;
|
|
50
52
|
update(attendee: Attendee, received: number, value: TValueState): PostUpdateAction[];
|
|
51
53
|
}
|
|
52
54
|
/**
|
|
53
|
-
*
|
|
55
|
+
* A function to be called at the end of an update frame
|
|
54
56
|
*/
|
|
55
57
|
export type PostUpdateAction = () => void;
|
|
56
58
|
//# sourceMappingURL=internalTypes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internalTypes.d.ts","sourceRoot":"","sources":["../src/internalTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,IAAI,sBAAsB,EAAE,MAAM,wDAAwD,CAAC;AAEtH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,KAAK,EACX,yBAAyB,EACzB,8BAA8B,EAC9B,cAAc,EACd,MAAM,eAAe,CAAC;AAEvB
|
|
1
|
+
{"version":3,"file":"internalTypes.d.ts","sourceRoot":"","sources":["../src/internalTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,IAAI,sBAAsB,EAAE,MAAM,wDAAwD,CAAC;AAEtH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,KAAK,EACX,8BAA8B,EAC9B,yBAAyB,EACzB,8BAA8B,EAC9B,cAAc,EACd,MAAM,eAAe,CAAC;AAEvB;;GAEG;AACH,MAAM,WAAW,0BAA0B;IAC1C,cAAc,EAAE,cAAc,CAAC;CAC/B;AACD;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,sBAAsB,CAAC,0BAA0B,CAAC,CAAC;AAE/E;;;;;GAKG;AACH,MAAM,WAAW,YAAY,CAAC,MAAM,SAAS,aAAa,CAAC,qBAAqB,CAAC,OAAO,CAAC;IAIxF,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM,CAAC;CACjC;AAED;;;;;;GAMG;AACH,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,aAAa,EAAE,QAAQ,GAAG,uBAAuB,CAAC,GAEtF,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC,GAAG;IACxC;;;;;OAKG;IACH,YAAY,EAAE,CACb,OAAO,EACJ,8BAA8B,GAC9B,yBAAyB,GACzB,8BAA8B,KAC7B,IAAI,CAAC;CACV,CAAC;AAEH;;;;;GAKG;AACH,MAAM,WAAW,YAAY,CAC5B,MAAM,EACN,WAAW,SACV,aAAa,CAAC,qBAAqB,CAAC,MAAM,CAAC,GAAG,aAAa,CAAC,qBAAqB,CAAC,MAAM,CAAC;IAG1F,QAAQ,CAAC,KAAK,CAAC,EAAE,WAAW,CAAC;IAC7B,MAAM,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,GAAG,gBAAgB,EAAE,CAAC;CACrF;AAED;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC"}
|
package/lib/internalTypes.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internalTypes.js","sourceRoot":"","sources":["../src/internalTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ExtensionHost as ContainerExtensionHost } from \"@fluidframework/container-runtime-definitions/internal\";\n\nimport type { InternalTypes } from \"./exposedInternalTypes.js\";\nimport type { AttendeeId, Attendee } from \"./presence.js\";\nimport type {\n\tOutboundClientJoinMessage,\n\tOutboundDatastoreUpdateMessage,\n\tSignalMessages,\n} from \"./protocol.js\";\n\n/**\n * Presence {@link ContainerExtension} version of {@link @fluidframework/container-runtime-definitions#ExtensionRuntimeProperties}\n
|
|
1
|
+
{"version":3,"file":"internalTypes.js","sourceRoot":"","sources":["../src/internalTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ExtensionHost as ContainerExtensionHost } from \"@fluidframework/container-runtime-definitions/internal\";\n\nimport type { InternalTypes } from \"./exposedInternalTypes.js\";\nimport type { AttendeeId, Attendee } from \"./presence.js\";\nimport type {\n\tOutboundAcknowledgementMessage,\n\tOutboundClientJoinMessage,\n\tOutboundDatastoreUpdateMessage,\n\tSignalMessages,\n} from \"./protocol.js\";\n\n/**\n * Presence {@link ContainerExtension} version of {@link @fluidframework/container-runtime-definitions#ExtensionRuntimeProperties}\n */\nexport interface ExtensionRuntimeProperties {\n\tSignalMessages: SignalMessages;\n}\n/**\n * Presence specific ExtensionHost\n */\nexport type ExtensionHost = ContainerExtensionHost<ExtensionRuntimeProperties>;\n\n/**\n * Basic structure of set of {@link Attendee} records within Presence datastore\n *\n * @remarks\n * This is commonly exists per named state in State Managers.\n */\nexport interface ClientRecord<TValue extends InternalTypes.ValueDirectoryOrState<unknown>> {\n\t// Caution: any particular item may or may not exist\n\t// Typescript does not support absent keys without forcing type to also be undefined.\n\t// See https://github.com/microsoft/TypeScript/issues/42810.\n\t[AttendeeId: AttendeeId]: TValue;\n}\n\n/**\n * This interface is a subset of ExtensionHost (and mostly of\n * FluidDataStoreRuntime) that is needed by the Presence States.\n *\n * @privateRemarks\n * Replace with non-DataStore based interface.\n */\nexport type IEphemeralRuntime = Omit<ExtensionHost, \"logger\" | \"submitAddressedSignal\"> &\n\t// Apart from tests, there is always a logger. So this could be promoted to required.\n\tPartial<Pick<ExtensionHost, \"logger\">> & {\n\t\t/**\n\t\t * Submits the signal to be sent to other clients.\n\t\t * @param type - Type of the signal.\n\t\t * @param content - Content of the signal. Should be a JSON serializable object or primitive.\n\t\t * @param targetClientId - When specified, the signal is only sent to the provided client id.\n\t\t */\n\t\tsubmitSignal: (\n\t\t\tmessage:\n\t\t\t\t| OutboundAcknowledgementMessage\n\t\t\t\t| OutboundClientJoinMessage\n\t\t\t\t| OutboundDatastoreUpdateMessage,\n\t\t) => void;\n\t};\n\n/**\n * Contract for State Managers as used by a States Workspace (`PresenceStatesImpl`)\n *\n * @remarks\n * See uses of `unbrandIVM`.\n */\nexport interface ValueManager<\n\tTValue,\n\tTValueState extends\n\t\tInternalTypes.ValueDirectoryOrState<TValue> = InternalTypes.ValueDirectoryOrState<TValue>,\n> {\n\t// State objects should provide value - implement Required<ValueManager<...>>\n\treadonly value?: TValueState;\n\tupdate(attendee: Attendee, received: number, value: TValueState): PostUpdateAction[];\n}\n\n/**\n * A function to be called at the end of an update frame\n */\nexport type PostUpdateAction = () => void;\n"]}
|
package/lib/internalUtils.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import type { DeepReadonly } from "@fluidframework/core-interfaces/internal";
|
|
5
|
+
import type { DeepReadonly, JsonDeserialized, JsonSerializable, OpaqueJsonDeserialized, OpaqueJsonSerializable } from "@fluidframework/core-interfaces/internal";
|
|
6
6
|
/**
|
|
7
7
|
* Returns union of types of values in a record.
|
|
8
8
|
*/
|
|
@@ -23,8 +23,6 @@ type RequiredAndNotUndefined<T> = {
|
|
|
23
23
|
* The is a defect in this utility when a string index appears in the object.
|
|
24
24
|
* In such a case, the only result is `[string, T]`, where `T` is the type
|
|
25
25
|
* of the string index entry.
|
|
26
|
-
*
|
|
27
|
-
* @internal
|
|
28
26
|
*/
|
|
29
27
|
export declare const objectEntries: <const T>(o: T) => KeyValuePairs<T>;
|
|
30
28
|
/**
|
|
@@ -34,14 +32,10 @@ export declare const objectEntries: <const T>(o: T) => KeyValuePairs<T>;
|
|
|
34
32
|
* Given `T` should not contain `undefined` values. If it does, use
|
|
35
33
|
* {@link objectEntries} instead. Without `undefined` values, this
|
|
36
34
|
* typing provides best handling of objects with optional properties.
|
|
37
|
-
*
|
|
38
|
-
* @internal
|
|
39
35
|
*/
|
|
40
36
|
export declare const objectEntriesWithoutUndefined: <const T>(o: T) => KeyValuePairs<RequiredAndNotUndefined<T>>;
|
|
41
37
|
/**
|
|
42
38
|
* Object.keys retyped to preserve known keys and their types.
|
|
43
|
-
*
|
|
44
|
-
* @internal
|
|
45
39
|
*/
|
|
46
40
|
export declare const objectKeys: <const T>(o: T) => (keyof MapNumberIndicesToStrings<T>)[];
|
|
47
41
|
/**
|
|
@@ -58,8 +52,32 @@ export declare const objectKeys: <const T>(o: T) => (keyof MapNumberIndicesToStr
|
|
|
58
52
|
*/
|
|
59
53
|
export declare function getOrCreateRecord<const K extends string | number | symbol, const V>(record: Record<K, V>, key: K, defaultValue: (key: K) => V): V;
|
|
60
54
|
/**
|
|
61
|
-
*
|
|
55
|
+
* No-runtime-effect helper to apply deep immutability to a value's type.
|
|
62
56
|
*/
|
|
63
57
|
export declare function asDeeplyReadonly<T>(value: T): DeepReadonly<T>;
|
|
58
|
+
export declare function asDeeplyReadonlyDeserializedJson<T>(value: OpaqueJsonDeserialized<T>): DeepReadonly<JsonDeserialized<T>>;
|
|
59
|
+
export declare function asDeeplyReadonlyDeserializedJson<T>(value: OpaqueJsonDeserialized<T> | undefined): DeepReadonly<JsonDeserialized<T>> | undefined;
|
|
60
|
+
type RevealOpaqueJsonDeserialized<T> = T extends OpaqueJsonDeserialized<infer U> ? JsonDeserialized<U> : {
|
|
61
|
+
[Key in keyof T]: RevealOpaqueJsonDeserialized<T[Key]>;
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* No-runtime-effect helper to reveal the JSON type from a value's opaque JSON
|
|
65
|
+
* types throughout a structure.
|
|
66
|
+
*
|
|
67
|
+
* @remarks
|
|
68
|
+
* {@link OpaqueJsonDeserialized} instances will be replaced shallowly such
|
|
69
|
+
* that nested instances are retained.
|
|
70
|
+
*/
|
|
71
|
+
export declare function revealOpaqueJson<T>(value: T): RevealOpaqueJsonDeserialized<T>;
|
|
72
|
+
/**
|
|
73
|
+
* No-runtime-effect helper to automatically cast JSON type to Opaque JSON type
|
|
74
|
+
* at outermost scope.
|
|
75
|
+
*
|
|
76
|
+
* @remarks
|
|
77
|
+
* Types that satisfy {@link JsonSerializable} may also be deserialized. Thus,
|
|
78
|
+
* the return type is both {@link OpaqueJsonSerializable} and
|
|
79
|
+
* {@link OpaqueJsonDeserialized}.
|
|
80
|
+
*/
|
|
81
|
+
export declare function toOpaqueJson<const T>(value: JsonSerializable<T>): OpaqueJsonSerializable<T> & OpaqueJsonDeserialized<T>;
|
|
64
82
|
export {};
|
|
65
83
|
//# sourceMappingURL=internalUtils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internalUtils.d.ts","sourceRoot":"","sources":["../src/internalUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"internalUtils.d.ts","sourceRoot":"","sources":["../src/internalUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,EAChB,sBAAsB,EACtB,sBAAsB,EACtB,MAAM,0CAA0C,CAAC;AAElD;;GAEG;AACH,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AAE7C,KAAK,yBAAyB,CAAC,CAAC,IAAI;KAClC,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,SAAS,MAA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B,CAAC,CAAC,CAAC,GAC9B,YAAY,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC;AACrC,wBAAgB,gCAAgC,CAAC,CAAC,EACjD,KAAK,EAAE,sBAAsB,CAAC,CAAC,CAAC,GAAG,SAAS,GAC1C,YAAY,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;AAWjD,KAAK,4BAA4B,CAAC,CAAC,IAAI,CAAC,SAAS,sBAAsB,CAAC,MAAM,CAAC,CAAC,GAC7E,gBAAgB,CAAC,CAAC,CAAC,GACnB;KAAG,GAAG,IAAI,MAAM,CAAC,GAAG,4BAA4B,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;CAAE,CAAC;AAE9D;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,4BAA4B,CAAC,CAAC,CAAC,CAE7E;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,KAAK,CAAC,CAAC,EACnC,KAAK,EAAE,gBAAgB,CAAC,CAAC,CAAC,GACxB,sBAAsB,CAAC,CAAC,CAAC,GAAG,sBAAsB,CAAC,CAAC,CAAC,CAEvD"}
|
package/lib/internalUtils.js
CHANGED
|
@@ -9,8 +9,6 @@
|
|
|
9
9
|
* The is a defect in this utility when a string index appears in the object.
|
|
10
10
|
* In such a case, the only result is `[string, T]`, where `T` is the type
|
|
11
11
|
* of the string index entry.
|
|
12
|
-
*
|
|
13
|
-
* @internal
|
|
14
12
|
*/
|
|
15
13
|
export const objectEntries = Object.entries;
|
|
16
14
|
/**
|
|
@@ -20,14 +18,10 @@ export const objectEntries = Object.entries;
|
|
|
20
18
|
* Given `T` should not contain `undefined` values. If it does, use
|
|
21
19
|
* {@link objectEntries} instead. Without `undefined` values, this
|
|
22
20
|
* typing provides best handling of objects with optional properties.
|
|
23
|
-
*
|
|
24
|
-
* @internal
|
|
25
21
|
*/
|
|
26
22
|
export const objectEntriesWithoutUndefined = Object.entries;
|
|
27
23
|
/**
|
|
28
24
|
* Object.keys retyped to preserve known keys and their types.
|
|
29
|
-
*
|
|
30
|
-
* @internal
|
|
31
25
|
*/
|
|
32
26
|
export const objectKeys = Object.keys;
|
|
33
27
|
/**
|
|
@@ -49,9 +43,39 @@ export function getOrCreateRecord(record, key, defaultValue) {
|
|
|
49
43
|
return record[key];
|
|
50
44
|
}
|
|
51
45
|
/**
|
|
52
|
-
*
|
|
46
|
+
* No-runtime-effect helper to apply deep immutability to a value's type.
|
|
53
47
|
*/
|
|
54
48
|
export function asDeeplyReadonly(value) {
|
|
55
49
|
return value;
|
|
56
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* No-runtime-effect helper to apply deep immutability to a value's opaque JSON
|
|
53
|
+
* type, revealing the JSON type.
|
|
54
|
+
*/
|
|
55
|
+
export function asDeeplyReadonlyDeserializedJson(value) {
|
|
56
|
+
return value;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* No-runtime-effect helper to reveal the JSON type from a value's opaque JSON
|
|
60
|
+
* types throughout a structure.
|
|
61
|
+
*
|
|
62
|
+
* @remarks
|
|
63
|
+
* {@link OpaqueJsonDeserialized} instances will be replaced shallowly such
|
|
64
|
+
* that nested instances are retained.
|
|
65
|
+
*/
|
|
66
|
+
export function revealOpaqueJson(value) {
|
|
67
|
+
return value;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* No-runtime-effect helper to automatically cast JSON type to Opaque JSON type
|
|
71
|
+
* at outermost scope.
|
|
72
|
+
*
|
|
73
|
+
* @remarks
|
|
74
|
+
* Types that satisfy {@link JsonSerializable} may also be deserialized. Thus,
|
|
75
|
+
* the return type is both {@link OpaqueJsonSerializable} and
|
|
76
|
+
* {@link OpaqueJsonDeserialized}.
|
|
77
|
+
*/
|
|
78
|
+
export function toOpaqueJson(value) {
|
|
79
|
+
return value;
|
|
80
|
+
}
|
|
57
81
|
//# sourceMappingURL=internalUtils.js.map
|
package/lib/internalUtils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internalUtils.js","sourceRoot":"","sources":["../src/internalUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"internalUtils.js","sourceRoot":"","sources":["../src/internalUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA2BH;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,OAA8C,CAAC;AAEnF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,MAAM,CAAC,OAEN,CAAC;AAE/C;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC,IAEU,CAAC;AAE5C;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,iBAAiB,CAChC,MAAoB,EACpB,GAAM,EACN,YAA2B;IAE3B,IAAI,CAAC,CAAC,GAAG,IAAI,MAAM,CAAC,EAAE,CAAC;QACtB,MAAM,CAAC,GAAG,CAAC,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC;IACjC,CAAC;IACD,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;AACpB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAI,KAAQ;IAC3C,OAAO,KAAwB,CAAC;AACjC,CAAC;AAQD;;;GAGG;AACH,MAAM,UAAU,gCAAgC,CAC/C,KAA4C;IAE5C,OAAO,KAAsD,CAAC;AAC/D,CAAC;AAMD;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAAI,KAAQ;IAC3C,OAAO,KAAwC,CAAC;AACjD,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,YAAY,CAC3B,KAA0B;IAE1B,OAAO,KAA8D,CAAC;AACvE,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tDeepReadonly,\n\tJsonDeserialized,\n\tJsonSerializable,\n\tOpaqueJsonDeserialized,\n\tOpaqueJsonSerializable,\n} from \"@fluidframework/core-interfaces/internal\";\n\n/**\n * Returns union of types of values in a record.\n */\nexport type RecordEntryTypes<T> = T[keyof T];\n\ntype MapNumberIndicesToStrings<T> = {\n\t[K in keyof T as K extends number ? `${K}` : K]: T[K];\n};\n\ntype KeyValuePairs<T> = {\n\t[K in keyof MapNumberIndicesToStrings<Required<T>>]: [K, Required<T>[K]];\n}[keyof MapNumberIndicesToStrings<Required<T>>][];\n\ntype RequiredAndNotUndefined<T> = {\n\t[K in keyof T]-?: Exclude<T[K], undefined>;\n};\n\n/**\n * Object.entries retyped to preserve known keys and their types.\n *\n * @privateRemarks\n * The is a defect in this utility when a string index appears in the object.\n * In such a case, the only result is `[string, T]`, where `T` is the type\n * of the string index entry.\n */\nexport const objectEntries = Object.entries as <const T>(o: T) => KeyValuePairs<T>;\n\n/**\n * Object.entries retyped to preserve known keys and their types.\n *\n * @remarks\n * Given `T` should not contain `undefined` values. If it does, use\n * {@link objectEntries} instead. Without `undefined` values, this\n * typing provides best handling of objects with optional properties.\n */\nexport const objectEntriesWithoutUndefined = Object.entries as <const T>(\n\to: T,\n) => KeyValuePairs<RequiredAndNotUndefined<T>>;\n\n/**\n * Object.keys retyped to preserve known keys and their types.\n */\nexport const objectKeys = Object.keys as <const T>(\n\to: T,\n) => (keyof MapNumberIndicesToStrings<T>)[];\n\n/**\n * Retrieve a value from a record with the given key, or create a new entry if\n * the key is not in the record.\n *\n * @param record - The record to index/update\n * @param key - The key to lookup in the record\n * @param defaultValue - a function which returns a default value. This is\n * called and used to set an initial value for the given key in the record if\n * none exists.\n * @returns either the existing value for the given key, or the newly-created\n * value (the result of `defaultValue`)\n */\nexport function getOrCreateRecord<const K extends string | number | symbol, const V>(\n\trecord: Record<K, V>,\n\tkey: K,\n\tdefaultValue: (key: K) => V,\n): V {\n\tif (!(key in record)) {\n\t\trecord[key] = defaultValue(key);\n\t}\n\treturn record[key];\n}\n\n/**\n * No-runtime-effect helper to apply deep immutability to a value's type.\n */\nexport function asDeeplyReadonly<T>(value: T): DeepReadonly<T> {\n\treturn value as DeepReadonly<T>;\n}\n\nexport function asDeeplyReadonlyDeserializedJson<T>(\n\tvalue: OpaqueJsonDeserialized<T>,\n): DeepReadonly<JsonDeserialized<T>>;\nexport function asDeeplyReadonlyDeserializedJson<T>(\n\tvalue: OpaqueJsonDeserialized<T> | undefined,\n): DeepReadonly<JsonDeserialized<T>> | undefined;\n/**\n * No-runtime-effect helper to apply deep immutability to a value's opaque JSON\n * type, revealing the JSON type.\n */\nexport function asDeeplyReadonlyDeserializedJson<T>(\n\tvalue: OpaqueJsonDeserialized<T> | undefined,\n): DeepReadonly<JsonDeserialized<T>> | undefined {\n\treturn value as DeepReadonly<JsonDeserialized<T>> | undefined;\n}\n\ntype RevealOpaqueJsonDeserialized<T> = T extends OpaqueJsonDeserialized<infer U>\n\t? JsonDeserialized<U>\n\t: { [Key in keyof T]: RevealOpaqueJsonDeserialized<T[Key]> };\n\n/**\n * No-runtime-effect helper to reveal the JSON type from a value's opaque JSON\n * types throughout a structure.\n *\n * @remarks\n * {@link OpaqueJsonDeserialized} instances will be replaced shallowly such\n * that nested instances are retained.\n */\nexport function revealOpaqueJson<T>(value: T): RevealOpaqueJsonDeserialized<T> {\n\treturn value as RevealOpaqueJsonDeserialized<T>;\n}\n\n/**\n * No-runtime-effect helper to automatically cast JSON type to Opaque JSON type\n * at outermost scope.\n *\n * @remarks\n * Types that satisfy {@link JsonSerializable} may also be deserialized. Thus,\n * the return type is both {@link OpaqueJsonSerializable} and\n * {@link OpaqueJsonDeserialized}.\n */\nexport function toOpaqueJson<const T>(\n\tvalue: JsonSerializable<T>,\n): OpaqueJsonSerializable<T> & OpaqueJsonDeserialized<T> {\n\treturn value as OpaqueJsonSerializable<T> & OpaqueJsonDeserialized<T>;\n}\n"]}
|
|
@@ -9,17 +9,19 @@ import type { InternalTypes } from "./exposedInternalTypes.js";
|
|
|
9
9
|
import type { LatestClientData, LatestData, LatestMetadata } from "./latestValueTypes.js";
|
|
10
10
|
import type { AttendeeId, Attendee, Presence } from "./presence.js";
|
|
11
11
|
/**
|
|
12
|
-
* Collection of latest known values for a specific
|
|
12
|
+
* Collection of latest known values for a specific {@link Attendee}.
|
|
13
13
|
*
|
|
14
14
|
* @sealed
|
|
15
15
|
* @beta
|
|
16
16
|
*/
|
|
17
17
|
export interface LatestMapClientData<T, Keys extends string | number, SpecificAttendeeId extends AttendeeId = AttendeeId> {
|
|
18
18
|
/**
|
|
19
|
-
* Associated
|
|
19
|
+
* Associated {@link Attendee}.
|
|
20
20
|
*/
|
|
21
21
|
attendee: Attendee<SpecificAttendeeId>;
|
|
22
22
|
/**
|
|
23
|
+
* Map of items for the state.
|
|
24
|
+
*
|
|
23
25
|
* @privateRemarks This could be regular map currently as no Map is
|
|
24
26
|
* stored internally and a new instance is created for every request.
|
|
25
27
|
*/
|
|
@@ -32,6 +34,9 @@ export interface LatestMapClientData<T, Keys extends string | number, SpecificAt
|
|
|
32
34
|
* @beta
|
|
33
35
|
*/
|
|
34
36
|
export interface LatestMapItemUpdatedClientData<T, K extends string | number> extends LatestClientData<T> {
|
|
37
|
+
/**
|
|
38
|
+
* Key of the updated item.
|
|
39
|
+
*/
|
|
35
40
|
key: K;
|
|
36
41
|
}
|
|
37
42
|
/**
|
|
@@ -41,11 +46,22 @@ export interface LatestMapItemUpdatedClientData<T, K extends string | number> ex
|
|
|
41
46
|
* @beta
|
|
42
47
|
*/
|
|
43
48
|
export interface LatestMapItemRemovedClientData<K extends string | number> {
|
|
49
|
+
/**
|
|
50
|
+
* Associated {@link Attendee}.
|
|
51
|
+
*/
|
|
44
52
|
attendee: Attendee;
|
|
53
|
+
/**
|
|
54
|
+
* Key of the removed item.
|
|
55
|
+
*/
|
|
45
56
|
key: K;
|
|
57
|
+
/**
|
|
58
|
+
* Metadata associated with the removal of the item.
|
|
59
|
+
*/
|
|
46
60
|
metadata: LatestMetadata;
|
|
47
61
|
}
|
|
48
62
|
/**
|
|
63
|
+
* Events from {@link LatestMapRaw}.
|
|
64
|
+
*
|
|
49
65
|
* @sealed
|
|
50
66
|
* @beta
|
|
51
67
|
*/
|
|
@@ -80,7 +96,7 @@ export interface LatestMapRawEvents<T, K extends string | number> {
|
|
|
80
96
|
* @eventProperty
|
|
81
97
|
*/
|
|
82
98
|
localItemUpdated: (updatedItem: {
|
|
83
|
-
value: DeepReadonly<JsonSerializable<T
|
|
99
|
+
value: DeepReadonly<JsonSerializable<T>>;
|
|
84
100
|
key: K;
|
|
85
101
|
}) => void;
|
|
86
102
|
/**
|
|
@@ -106,6 +122,8 @@ export interface StateMap<K extends string | number, V> {
|
|
|
106
122
|
*/
|
|
107
123
|
clear(): void;
|
|
108
124
|
/**
|
|
125
|
+
* Removes the element with the specified key from the StateMap, if it exists.
|
|
126
|
+
*
|
|
109
127
|
* @returns true if an element in the StateMap existed and has been removed, or false if
|
|
110
128
|
* the element does not exist.
|
|
111
129
|
* @remarks No entry is fully removed. Instead an undefined placeholder is locally and
|
|
@@ -120,11 +138,13 @@ export interface StateMap<K extends string | number, V> {
|
|
|
120
138
|
*/
|
|
121
139
|
forEach(callbackfn: (value: DeepReadonly<JsonDeserialized<V>>, key: K, map: StateMap<K, V>) => void, thisArg?: unknown): void;
|
|
122
140
|
/**
|
|
123
|
-
* Returns
|
|
141
|
+
* Returns the element with the specified key from the StateMap, if it exists.
|
|
142
|
+
*
|
|
124
143
|
* @returns Returns the element associated with the specified key. If no element is associated with the specified key, undefined is returned.
|
|
125
144
|
*/
|
|
126
145
|
get(key: K): DeepReadonly<JsonDeserialized<V>> | undefined;
|
|
127
146
|
/**
|
|
147
|
+
* Checks if an element with the specified key exists in the StateMap.
|
|
128
148
|
* @returns boolean indicating whether an element with the specified key exists or not.
|
|
129
149
|
*/
|
|
130
150
|
has(key: K): boolean;
|
|
@@ -136,9 +156,9 @@ export interface StateMap<K extends string | number, V> {
|
|
|
136
156
|
* Make a deep clone before setting, if needed. No comparison is done to detect changes; all
|
|
137
157
|
* sets are transmitted.
|
|
138
158
|
*/
|
|
139
|
-
set(key: K, value: JsonSerializable<V>
|
|
159
|
+
set(key: K, value: JsonSerializable<V>): this;
|
|
140
160
|
/**
|
|
141
|
-
*
|
|
161
|
+
* The number of elements in the StateMap.
|
|
142
162
|
*/
|
|
143
163
|
readonly size: number;
|
|
144
164
|
/**
|
|
@@ -196,6 +216,7 @@ export interface LatestMapRaw<T, Keys extends string | number = string | number>
|
|
|
196
216
|
/**
|
|
197
217
|
* Arguments that are passed to the {@link StateFactory.latestMap} function.
|
|
198
218
|
*
|
|
219
|
+
* @input
|
|
199
220
|
* @beta
|
|
200
221
|
*/
|
|
201
222
|
export interface LatestMapArguments<T, Keys extends string | number = string | number> {
|
|
@@ -203,7 +224,7 @@ export interface LatestMapArguments<T, Keys extends string | number = string | n
|
|
|
203
224
|
* The initial value of the local state.
|
|
204
225
|
*/
|
|
205
226
|
local?: {
|
|
206
|
-
[K in Keys]: JsonSerializable<T
|
|
227
|
+
[K in Keys]: JsonSerializable<T>;
|
|
207
228
|
};
|
|
208
229
|
/**
|
|
209
230
|
* See {@link BroadcastControlSettings}.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"latestMapValueManager.d.ts","sourceRoot":"","sources":["../src/latestMapValueManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAElE,OAAO,KAAK,EACX,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,EAChB,MAAM,8DAA8D,CAAC;AAEtE,OAAO,KAAK,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAE1F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"latestMapValueManager.d.ts","sourceRoot":"","sources":["../src/latestMapValueManager.ts"],"names":[],"mappings":"AAAA;;;G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