@fluidframework/fluid-static 2.0.0-dev.1.3.0.96595 → 2.0.0-dev.1.4.6.106135
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/fluidContainer.d.ts +66 -63
- package/dist/fluidContainer.d.ts.map +1 -1
- package/dist/fluidContainer.js +2 -7
- package/dist/fluidContainer.js.map +1 -1
- package/dist/rootDataObject.d.ts +10 -18
- package/dist/rootDataObject.d.ts.map +1 -1
- package/dist/rootDataObject.js +8 -15
- package/dist/rootDataObject.js.map +1 -1
- package/dist/serviceAudience.d.ts +13 -25
- package/dist/serviceAudience.d.ts.map +1 -1
- package/dist/serviceAudience.js +12 -23
- package/dist/serviceAudience.js.map +1 -1
- package/dist/types.d.ts +69 -75
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/lib/fluidContainer.d.ts +66 -63
- package/lib/fluidContainer.d.ts.map +1 -1
- package/lib/fluidContainer.js +2 -7
- package/lib/fluidContainer.js.map +1 -1
- package/lib/rootDataObject.d.ts +10 -18
- package/lib/rootDataObject.d.ts.map +1 -1
- package/lib/rootDataObject.js +8 -15
- package/lib/rootDataObject.js.map +1 -1
- package/lib/serviceAudience.d.ts +13 -25
- package/lib/serviceAudience.d.ts.map +1 -1
- package/lib/serviceAudience.js +12 -23
- package/lib/serviceAudience.js.map +1 -1
- package/lib/types.d.ts +69 -75
- package/lib/types.d.ts.map +1 -1
- package/lib/types.js.map +1 -1
- package/package.json +15 -35
- package/src/fluidContainer.ts +66 -70
- package/src/rootDataObject.ts +10 -18
- package/src/serviceAudience.ts +13 -25
- package/src/types.ts +69 -80
package/lib/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.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 { IEvent, IEventProvider } from \"@fluidframework/common-definitions\";\nimport { IFluidLoadable } from \"@fluidframework/core-interfaces\";\nimport { IChannelFactory } from \"@fluidframework/datastore-definitions\";\nimport { IFluidDataStoreFactory } from \"@fluidframework/runtime-definitions\";\n\n/**\n * A mapping of string identifiers to instantiated
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.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 { IEvent, IEventProvider } from \"@fluidframework/common-definitions\";\nimport { IFluidLoadable } from \"@fluidframework/core-interfaces\";\nimport { IChannelFactory } from \"@fluidframework/datastore-definitions\";\nimport { IFluidDataStoreFactory } from \"@fluidframework/runtime-definitions\";\n\n/**\n * A mapping of string identifiers to instantiated DataObjects or SharedObjects.\n */\nexport type LoadableObjectRecord = Record<string, IFluidLoadable>;\n\n/**\n * A mapping of string identifiers to classes that will later be used to instantiate a corresponding DataObject\n * or SharedObject in a LoadableObjectRecord.\n */\nexport type LoadableObjectClassRecord = Record<string, LoadableObjectClass<any>>;\n\n/**\n * A LoadableObjectClass is an class object of DataObject or SharedObject\n * @typeParam T - The class of the DataObject or SharedObject\n */\nexport type LoadableObjectClass<T extends IFluidLoadable> = DataObjectClass<T> | SharedObjectClass<T>;\n\n/**\n * A DataObjectClass is a class that has a factory that can create a DataObject and a\n * constructor that will return the type of the DataObject.\n * @typeParam T - The class of the DataObject\n */\nexport type DataObjectClass<T extends IFluidLoadable>\n = { readonly factory: IFluidDataStoreFactory; } & LoadableObjectCtor<T>;\n\n/**\n * A SharedObjectClass is a class that has a factory that can create a DDS (SharedObject) and a\n * constructor that will return the type of the DataObject.\n * @typeParam T - The class of the SharedObject\n */\nexport type SharedObjectClass<T extends IFluidLoadable>\n = { readonly getFactory: () => IChannelFactory; } & LoadableObjectCtor<T>;\n\n/**\n * An object with a constructor that will return an `IFluidLoadable`.\n * @typeParam T - The class of the loadable object\n */\nexport type LoadableObjectCtor<T extends IFluidLoadable> = new(...args: any[]) => T;\n\n/**\n * The ContainerSchema declares the Fluid objects that will be available in the container. It includes both the\n * instances of objects that are initially available upon container creation, as well as the types of objects that may\n * be dynamically created throughout the lifetime of the container.\n */\nexport interface ContainerSchema {\n /**\n * Defines loadable objects that will be created when the `Container` is first created.\n * It uses the key as the id and the value as the loadable object to create.\n *\n * @example\n * In the example below two objects will be created when the Container is first\n * created. One with id \"map1\" that will return a `SharedMap` and the other with\n * id \"pair1\" that will return a `KeyValueDataObject`.\n *\n * ```\n * {\n * map1: SharedMap,\n * pair1: KeyValueDataObject,\n * }\n * ```\n */\n initialObjects: LoadableObjectClassRecord;\n\n /**\n * Dynamic objects are Loadable objects that can be created after the initial Container creation.\n *\n * Types defined in `initialObjects` will always be available and are not required to be provided here.\n *\n * For best practice it's recommended to define all the dynamic types you create even if they are\n * included via initialObjects.\n */\n dynamicObjectTypes?: LoadableObjectClass<any>[];\n}\n\n/**\n * Events that trigger when the roster of members in the Fluid session change.\n * Only changes that would be reflected in the returned map of {@link IServiceAudience}'s\n * {@link IServiceAudience.getMembers} method will emit events.\n *\n * @remarks\n *\n * The following is the list of events emitted.\n *\n * ### \"membersChanged\"\n *\n * The \"membersChanged\" event is emitted when a member is either added or removed.\n *\n * #### Listener signature\n *\n * ```typescript\n * () => void;\n * ```\n *\n * ### \"memberAdded\"\n *\n * The \"memberAdded\" event is emitted when a member joins the audience.\n *\n * #### Listener signature\n *\n * ```typescript\n * (clientId: string, member: M) => void;\n * ```\n * - `clientId` - A unique identifier for the client\n *\n * - `member` - The service-specific member object for the client\n *\n * ### \"memberRemoved\"\n *\n * The \"memberRemoved\" event is emitted when a member leaves the audience.\n *\n * #### Listener signature\n *\n * ```typescript\n * (clientId: string, member: M) => void;\n * ```\n * - `clientId` - A unique identifier for the client\n *\n * - `member` - The service-specific member object for the client\n * @typeParam M - A service-specific member type.\n */\nexport interface IServiceAudienceEvents<M extends IMember> extends IEvent {\n (event: \"membersChanged\", listener: () => void): void;\n (event: \"memberAdded\" | \"memberRemoved\", listener: (clientId: string, member: M) => void): void;\n}\n\n/**\n * Base interface to be implemented to fetch each service's audience. The generic M allows consumers to further\n * extend the client object with service-specific details about the connecting client, such as device information,\n * environment, or a username.\n * @typeParam M - A service-specific member type.\n */\nexport interface IServiceAudience<M extends IMember> extends IEventProvider<IServiceAudienceEvents<M>> {\n /**\n * Returns an map of all users currently in the Fluid session where key is the userId and the value is the\n * member object. The implementation may choose to exclude certain connections from the returned map.\n * E.g. ServiceAudience excludes non-interactive connections to represent only the roster of live users.\n */\n getMembers(): Map<string, M>;\n\n /**\n * Returns the current active user on this client once they are connected. Otherwise, returns undefined.\n */\n getMyself(): M | undefined;\n}\n\n/**\n * Base interface for information for each connection made to the Fluid session. This interface can be extended\n * to provide additional information specific to each service.\n */\nexport interface IConnection {\n /**\n * A unique ID for the connection. A single user may have multiple connections, each with a different ID.\n */\n id: string;\n\n /**\n * Whether the connection is in read or read/write mode.\n */\n mode: \"write\" | \"read\";\n}\n\n/**\n * Base interface to be implemented to fetch each service's member. This interface can be extended by each service\n * to provide additional service-specific user metadata.\n */\nexport interface IMember {\n /**\n * An ID for the user, unique among each individual user connecting to the session.\n */\n userId: string;\n\n /**\n * The set of connections the user has made, e.g. from multiple tabs or devices.\n */\n connections: IConnection[];\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/fluid-static",
|
|
3
|
-
"version": "2.0.0-dev.1.
|
|
3
|
+
"version": "2.0.0-dev.1.4.6.106135",
|
|
4
4
|
"description": "A tool to enable consumption of Fluid Data Objects without requiring custom container code.",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -38,49 +38,29 @@
|
|
|
38
38
|
"tsfmt:fix": "tsfmt --replace",
|
|
39
39
|
"typetests:gen": "fluid-type-validator -g -d ."
|
|
40
40
|
},
|
|
41
|
-
"nyc": {
|
|
42
|
-
"all": true,
|
|
43
|
-
"cache-dir": "nyc/.cache",
|
|
44
|
-
"exclude": [
|
|
45
|
-
"src/test/**/*.ts",
|
|
46
|
-
"dist/test/**/*.js"
|
|
47
|
-
],
|
|
48
|
-
"exclude-after-remap": false,
|
|
49
|
-
"include": [
|
|
50
|
-
"src/**/*.ts",
|
|
51
|
-
"dist/**/*.js"
|
|
52
|
-
],
|
|
53
|
-
"report-dir": "nyc/report",
|
|
54
|
-
"reporter": [
|
|
55
|
-
"cobertura",
|
|
56
|
-
"html",
|
|
57
|
-
"text"
|
|
58
|
-
],
|
|
59
|
-
"temp-directory": "nyc/.nyc_output"
|
|
60
|
-
},
|
|
61
41
|
"dependencies": {
|
|
62
|
-
"@fluidframework/aqueduct": "2.0.0-dev.1.
|
|
42
|
+
"@fluidframework/aqueduct": "2.0.0-dev.1.4.6.106135",
|
|
63
43
|
"@fluidframework/common-definitions": "^0.20.1",
|
|
64
44
|
"@fluidframework/common-utils": "^1.0.0",
|
|
65
|
-
"@fluidframework/container-definitions": "2.0.0-dev.1.
|
|
66
|
-
"@fluidframework/container-loader": "2.0.0-dev.1.
|
|
67
|
-
"@fluidframework/container-runtime-definitions": "2.0.0-dev.1.
|
|
68
|
-
"@fluidframework/core-interfaces": "2.0.0-dev.1.
|
|
69
|
-
"@fluidframework/datastore-definitions": "2.0.0-dev.1.
|
|
45
|
+
"@fluidframework/container-definitions": "2.0.0-dev.1.4.6.106135",
|
|
46
|
+
"@fluidframework/container-loader": "2.0.0-dev.1.4.6.106135",
|
|
47
|
+
"@fluidframework/container-runtime-definitions": "2.0.0-dev.1.4.6.106135",
|
|
48
|
+
"@fluidframework/core-interfaces": "2.0.0-dev.1.4.6.106135",
|
|
49
|
+
"@fluidframework/datastore-definitions": "2.0.0-dev.1.4.6.106135",
|
|
70
50
|
"@fluidframework/protocol-definitions": "^1.0.0",
|
|
71
|
-
"@fluidframework/request-handler": "2.0.0-dev.1.
|
|
72
|
-
"@fluidframework/runtime-definitions": "2.0.0-dev.1.
|
|
73
|
-
"@fluidframework/runtime-utils": "2.0.0-dev.1.
|
|
51
|
+
"@fluidframework/request-handler": "2.0.0-dev.1.4.6.106135",
|
|
52
|
+
"@fluidframework/runtime-definitions": "2.0.0-dev.1.4.6.106135",
|
|
53
|
+
"@fluidframework/runtime-utils": "2.0.0-dev.1.4.6.106135"
|
|
74
54
|
},
|
|
75
55
|
"devDependencies": {
|
|
76
|
-
"@fluid-experimental/get-container": "2.0.0-dev.1.
|
|
56
|
+
"@fluid-experimental/get-container": "2.0.0-dev.1.4.6.106135",
|
|
77
57
|
"@fluidframework/build-common": "^1.0.0",
|
|
78
|
-
"@fluidframework/build-tools": "^0.4.
|
|
58
|
+
"@fluidframework/build-tools": "^0.4.4000",
|
|
79
59
|
"@fluidframework/eslint-config-fluid": "^1.0.0",
|
|
80
60
|
"@fluidframework/fluid-static-previous": "npm:@fluidframework/fluid-static@^1.0.0",
|
|
81
|
-
"@fluidframework/map": "2.0.0-dev.1.
|
|
82
|
-
"@fluidframework/mocha-test-setup": "2.0.0-dev.1.
|
|
83
|
-
"@fluidframework/sequence": "2.0.0-dev.1.
|
|
61
|
+
"@fluidframework/map": "2.0.0-dev.1.4.6.106135",
|
|
62
|
+
"@fluidframework/mocha-test-setup": "2.0.0-dev.1.4.6.106135",
|
|
63
|
+
"@fluidframework/sequence": "2.0.0-dev.1.4.6.106135",
|
|
84
64
|
"@microsoft/api-extractor": "^7.22.2",
|
|
85
65
|
"@rushstack/eslint-config": "^2.5.1",
|
|
86
66
|
"@types/mocha": "^9.1.1",
|
package/src/fluidContainer.ts
CHANGED
|
@@ -11,45 +11,64 @@ import { RootDataObject } from "./rootDataObject";
|
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Events emitted from {@link IFluidContainer}.
|
|
14
|
+
*
|
|
15
|
+
* @remarks
|
|
16
|
+
*
|
|
17
|
+
* The following is the list of events emitted.
|
|
18
|
+
*
|
|
19
|
+
* ### "connected"
|
|
20
|
+
*
|
|
21
|
+
* The "connected" event is emitted when the `IFluidContainer` completes connecting to the Fluid service.
|
|
22
|
+
*
|
|
23
|
+
* #### Listener signature
|
|
24
|
+
*
|
|
25
|
+
* ```typescript
|
|
26
|
+
* () => void;
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* ### "dispose"
|
|
30
|
+
*
|
|
31
|
+
* The "dispose" event is emitted when the `IFluidContainer` is disposed, which permanently disables it.
|
|
32
|
+
*
|
|
33
|
+
* #### Listener signature
|
|
34
|
+
*
|
|
35
|
+
* ```typescript
|
|
36
|
+
* () => void;
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* ### "disconnected"
|
|
40
|
+
*
|
|
41
|
+
* The "disconnected" event is emitted when the `IFluidContainer` becomes disconnected from the Fluid service.
|
|
42
|
+
*
|
|
43
|
+
* #### Listener signature
|
|
44
|
+
*
|
|
45
|
+
* ```typescript
|
|
46
|
+
* () => void;
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* ### "saved"
|
|
50
|
+
*
|
|
51
|
+
* The "saved" event is emitted when the `IFluidContainer` has local changes acknowledged by the service.
|
|
52
|
+
*
|
|
53
|
+
* #### Listener signature
|
|
54
|
+
*
|
|
55
|
+
* ```typescript
|
|
56
|
+
* () => void
|
|
57
|
+
* ```
|
|
58
|
+
*
|
|
59
|
+
* ### "dirty"
|
|
60
|
+
*
|
|
61
|
+
* The "dirty" event is emitted when the `IFluidContainer` has local changes that have not yet
|
|
62
|
+
* been acknowledged by the service.
|
|
63
|
+
*
|
|
64
|
+
* #### Listener signature
|
|
65
|
+
*
|
|
66
|
+
* ```typescript
|
|
67
|
+
* () => void
|
|
68
|
+
* ```
|
|
14
69
|
*/
|
|
15
70
|
export interface IFluidContainerEvents extends IEvent {
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Emitted when the {@link IFluidContainer} completes connecting to the Fluid service.
|
|
19
|
-
*
|
|
20
|
-
* @eventProperty
|
|
21
|
-
*/
|
|
22
|
-
(event: "connected", listener: () => void): void;
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Emitted when the {@link IFluidContainer} is disposed, which permanently disables it.
|
|
26
|
-
*
|
|
27
|
-
* @eventProperty
|
|
28
|
-
*/
|
|
29
|
-
(event: "dispose", listener: () => void): void;
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Emitted when the {@link IFluidContainer} becomes disconnected from the Fluid service.
|
|
33
|
-
*
|
|
34
|
-
* @eventProperty
|
|
35
|
-
*/
|
|
36
|
-
(event: "disconnected", listener: () => void): void;
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Emitted when all of the {@link IFluidContainer}'s local changes have been acknowledged by the service.
|
|
40
|
-
*
|
|
41
|
-
* @eventProperty
|
|
42
|
-
*/
|
|
43
|
-
(event: "saved", listener: () => void): void;
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Emitted when the {@link IFluidContainer} has local changes that have not yet been acknowledged by the service.
|
|
47
|
-
*
|
|
48
|
-
* @eventProperty
|
|
49
|
-
*/
|
|
50
|
-
(event: "dirty", listener: () => void): void;
|
|
51
|
-
|
|
52
|
-
/* eslint-enable @typescript-eslint/unified-signatures */
|
|
71
|
+
(event: "connected" | "dispose" | "disconnected" | "saved" | "dirty", listener: () => void): void;
|
|
53
72
|
}
|
|
54
73
|
|
|
55
74
|
/**
|
|
@@ -64,9 +83,6 @@ export interface IFluidContainer extends IEventProvider<IFluidContainerEvents> {
|
|
|
64
83
|
|
|
65
84
|
/**
|
|
66
85
|
* A container is considered **dirty** if it has local changes that have not yet been acknowledged by the service.
|
|
67
|
-
*
|
|
68
|
-
* @remarks
|
|
69
|
-
*
|
|
70
86
|
* You should always check the `isDirty` flag before closing the container or navigating away from the page.
|
|
71
87
|
* Closing the container while `isDirty === true` may result in the loss of operations that have not yet been
|
|
72
88
|
* acknowledged by the service.
|
|
@@ -85,23 +101,18 @@ export interface IFluidContainer extends IEventProvider<IFluidContainerEvents> {
|
|
|
85
101
|
readonly isDirty: boolean;
|
|
86
102
|
|
|
87
103
|
/**
|
|
88
|
-
* Whether
|
|
104
|
+
* Whether the container is disposed, which permanently disables it.
|
|
89
105
|
*/
|
|
90
106
|
readonly disposed: boolean;
|
|
91
107
|
|
|
92
108
|
/**
|
|
93
109
|
* The collection of data objects and Distributed Data Stores (DDSes) that were specified by the schema.
|
|
94
|
-
*
|
|
95
|
-
* @remarks These data objects and DDSes exist for the lifetime of the container.
|
|
110
|
+
* These data objects and DDSes exist for the lifetime of the container.
|
|
96
111
|
*/
|
|
97
112
|
readonly initialObjects: LoadableObjectRecord;
|
|
98
113
|
|
|
99
114
|
/**
|
|
100
|
-
* The current attachment state of the container.
|
|
101
|
-
*
|
|
102
|
-
* @remarks
|
|
103
|
-
*
|
|
104
|
-
* Once a container has been attached, it remains attached.
|
|
115
|
+
* The current attachment state of the container. Once a container has been attached, it remains attached.
|
|
105
116
|
* When loading an existing container, it will already be attached.
|
|
106
117
|
*/
|
|
107
118
|
readonly attachState: AttachState;
|
|
@@ -110,9 +121,7 @@ export interface IFluidContainer extends IEventProvider<IFluidContainerEvents> {
|
|
|
110
121
|
* A newly created container starts detached from the collaborative service.
|
|
111
122
|
* Calling `attach()` uploads the new container to the service and connects to the collaborative service.
|
|
112
123
|
*
|
|
113
|
-
* @remarks
|
|
114
|
-
*
|
|
115
|
-
* This should only be called when the container is in the
|
|
124
|
+
* @remarks This should only be called when the container is in the
|
|
116
125
|
* {@link @fluidframework/container-definitions#AttachState.Detatched} state.
|
|
117
126
|
*
|
|
118
127
|
* This can be determined by observing {@link IFluidContainer.attachState}.
|
|
@@ -125,9 +134,7 @@ export interface IFluidContainer extends IEventProvider<IFluidContainerEvents> {
|
|
|
125
134
|
* Attempts to connect the container to the delta stream and process operations.
|
|
126
135
|
* Will throw an error if unsuccessful.
|
|
127
136
|
*
|
|
128
|
-
* @remarks
|
|
129
|
-
*
|
|
130
|
-
* This should only be called when the container is in the
|
|
137
|
+
* @remarks This should only be called when the container is in the
|
|
131
138
|
* {@link @fluidframework/container-definitions#ConnectionState.Disconnected} state.
|
|
132
139
|
*
|
|
133
140
|
* This can be determined by observing {@link IFluidContainer.connectionState}.
|
|
@@ -137,9 +144,7 @@ export interface IFluidContainer extends IEventProvider<IFluidContainerEvents> {
|
|
|
137
144
|
/**
|
|
138
145
|
* Disconnects the container from the delta stream and stops processing operations.
|
|
139
146
|
*
|
|
140
|
-
* @remarks
|
|
141
|
-
*
|
|
142
|
-
* This should only be called when the container is in the
|
|
147
|
+
* @remarks This should only be called when the container is in the
|
|
143
148
|
* {@link @fluidframework/container-definitions#ConnectionState.Connected} state.
|
|
144
149
|
*
|
|
145
150
|
* This can be determined by observing {@link IFluidContainer.connectionState}.
|
|
@@ -149,15 +154,11 @@ export interface IFluidContainer extends IEventProvider<IFluidContainerEvents> {
|
|
|
149
154
|
/**
|
|
150
155
|
* Create a new data object or Distributed Data Store (DDS) of the specified type.
|
|
151
156
|
*
|
|
152
|
-
* @remarks
|
|
153
|
-
*
|
|
154
|
-
* In order to share the data object or DDS with other
|
|
157
|
+
* @remarks In order to share the data object or DDS with other
|
|
155
158
|
* collaborators and retrieve it later, store its handle in a collection like a SharedDirectory from your
|
|
156
159
|
* initialObjects.
|
|
157
160
|
*
|
|
158
|
-
* @param objectClass - The class of
|
|
159
|
-
*
|
|
160
|
-
* @typeParam T - The class of the `DataObject` or `SharedObject`.
|
|
161
|
+
* @param objectClass - The class of data object or DDS to create
|
|
161
162
|
*/
|
|
162
163
|
create<T extends IFluidLoadable>(objectClass: LoadableObjectClass<T>): Promise<T>;
|
|
163
164
|
|
|
@@ -170,9 +171,7 @@ export interface IFluidContainer extends IEventProvider<IFluidContainerEvents> {
|
|
|
170
171
|
/**
|
|
171
172
|
* Base {@link IFluidContainer} implementation.
|
|
172
173
|
*
|
|
173
|
-
* @remarks
|
|
174
|
-
*
|
|
175
|
-
* Note: this implementation is not complete. Consumers who rely on {@link IFluidContainer.attach}
|
|
174
|
+
* @remarks Note: this implementation is not complete. Consumers who rely on {@link IFluidContainer.attach}
|
|
176
175
|
* will need to utilize or provide a service-specific implementation of this type that implements that method.
|
|
177
176
|
*/
|
|
178
177
|
export class FluidContainer extends TypedEventEmitter<IFluidContainerEvents> implements IFluidContainer {
|
|
@@ -231,10 +230,7 @@ export class FluidContainer extends TypedEventEmitter<IFluidContainerEvents> imp
|
|
|
231
230
|
|
|
232
231
|
/**
|
|
233
232
|
* Incomplete base implementation of {@link IFluidContainer.attach}.
|
|
234
|
-
*
|
|
235
|
-
* @remarks
|
|
236
|
-
*
|
|
237
|
-
* Note: this implementation will unconditionally throw.
|
|
233
|
+
* @remarks Note: this implementation will unconditionally throw.
|
|
238
234
|
* Consumers who rely on this will need to utilize or provide a service specific implementation of this base type
|
|
239
235
|
* that provides an implementation of this method.
|
|
240
236
|
*
|
package/src/rootDataObject.ts
CHANGED
|
@@ -23,20 +23,20 @@ import {
|
|
|
23
23
|
import { isDataObjectClass, isSharedObjectClass, parseDataObjectsFromSharedObjects } from "./utils";
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
|
-
* Input props for {@link RootDataObject.initializingFirstTime}
|
|
26
|
+
* Input props for {@link RootDataObject.initializingFirstTime}
|
|
27
27
|
*/
|
|
28
28
|
export interface RootDataObjectProps {
|
|
29
29
|
/**
|
|
30
30
|
* Initial object structure with which the {@link RootDataObject} will be first-time initialized.
|
|
31
|
-
*
|
|
32
|
-
* @see {@link RootDataObject.initializingFirstTime}
|
|
31
|
+
* See {@link RootDataObject.initializingFirstTime}
|
|
33
32
|
*/
|
|
34
33
|
initialObjects: LoadableObjectClassRecord;
|
|
35
34
|
}
|
|
36
35
|
|
|
37
36
|
/**
|
|
38
|
-
* The entry-point/root collaborative object of the
|
|
39
|
-
*
|
|
37
|
+
* The entry-point/root collaborative object of the Fluid Container.
|
|
38
|
+
* This class abstracts the dynamic code required to build a Fluid Container into a static representation
|
|
39
|
+
* for end customers.
|
|
40
40
|
*/
|
|
41
41
|
export class RootDataObject extends DataObject<{ InitialState: RootDataObjectProps; }> {
|
|
42
42
|
private readonly initialObjectsDirKey = "initial-objects-key";
|
|
@@ -54,7 +54,7 @@ export class RootDataObject extends DataObject<{ InitialState: RootDataObjectPro
|
|
|
54
54
|
* The first time this object is initialized, creates each object identified in
|
|
55
55
|
* {@link RootDataObjectProps.initialObjects} and stores them as unique values in the root directory.
|
|
56
56
|
*
|
|
57
|
-
*
|
|
57
|
+
* See {@link @fluidframework/aqueduct#PureDataObject.initializingFirstTime}
|
|
58
58
|
*/
|
|
59
59
|
protected async initializingFirstTime(props: RootDataObjectProps) {
|
|
60
60
|
this.root.createSubDirectory(this.initialObjectsDirKey);
|
|
@@ -76,7 +76,7 @@ export class RootDataObject extends DataObject<{ InitialState: RootDataObjectPro
|
|
|
76
76
|
* Every time an instance is initialized, loads all of the initial objects in the root directory so they can be
|
|
77
77
|
* accessed immediately.
|
|
78
78
|
*
|
|
79
|
-
*
|
|
79
|
+
* See {@link @fluidframework/aqueduct#PureDataObject.hasInitialized}
|
|
80
80
|
*/
|
|
81
81
|
protected async hasInitialized() {
|
|
82
82
|
// We will always load the initial objects so they are available to the developer
|
|
@@ -94,8 +94,7 @@ export class RootDataObject extends DataObject<{ InitialState: RootDataObjectPro
|
|
|
94
94
|
|
|
95
95
|
/**
|
|
96
96
|
* Provides a record of the initial objects defined on creation.
|
|
97
|
-
*
|
|
98
|
-
* @see {@link RootDataObject.initializingFirstTime}
|
|
97
|
+
* See {@link RootDataObject.initializingFirstTime}
|
|
99
98
|
*/
|
|
100
99
|
public get initialObjects(): LoadableObjectRecord {
|
|
101
100
|
if (Object.keys(this._initialObjects).length === 0) {
|
|
@@ -106,10 +105,7 @@ export class RootDataObject extends DataObject<{ InitialState: RootDataObjectPro
|
|
|
106
105
|
|
|
107
106
|
/**
|
|
108
107
|
* Dynamically creates a new detached collaborative object (DDS/DataObject).
|
|
109
|
-
*
|
|
110
108
|
* @param objectClass - Type of the collaborative object to be created.
|
|
111
|
-
*
|
|
112
|
-
* @typeParam T - The class of the `DataObject` or `SharedObject`.
|
|
113
109
|
*/
|
|
114
110
|
public async create<T extends IFluidLoadable>(
|
|
115
111
|
objectClass: LoadableObjectClass<T>,
|
|
@@ -141,12 +137,8 @@ export class RootDataObject extends DataObject<{ InitialState: RootDataObjectPro
|
|
|
141
137
|
const rootDataStoreId = "rootDOId";
|
|
142
138
|
|
|
143
139
|
/**
|
|
144
|
-
* Container code that provides a single {@link RootDataObject}.
|
|
145
|
-
*
|
|
146
|
-
* @remarks
|
|
147
|
-
*
|
|
148
|
-
* This data object is dynamically customized (registry and initial objects) based on the schema provided.
|
|
149
|
-
* to the container runtime factory.
|
|
140
|
+
* Container code that provides a single {@link RootDataObject}. This data object is
|
|
141
|
+
* dynamically customized (registry and initial objects) based on the schema provided to the container runtime factory.
|
|
150
142
|
*/
|
|
151
143
|
export class DOProviderContainerRuntimeFactory extends BaseContainerRuntimeFactory {
|
|
152
144
|
private readonly rootDataObjectFactory: DataObjectFactory<RootDataObject, {
|
package/src/serviceAudience.ts
CHANGED
|
@@ -9,39 +9,29 @@ import { IClient } from "@fluidframework/protocol-definitions";
|
|
|
9
9
|
import { IServiceAudience, IServiceAudienceEvents, IMember } from "./types";
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
* Base class for providing audience information for sessions interacting with
|
|
13
|
-
*
|
|
14
|
-
* @remarks
|
|
15
|
-
*
|
|
12
|
+
* Base class for providing audience information for sessions interacting with FluidContainer
|
|
16
13
|
* This can be extended by different service-specific client packages to additional parameters to
|
|
17
|
-
* the user and client details returned in
|
|
18
|
-
*
|
|
19
|
-
* @typeParam M - A service-specific {@link IMember} implementation.
|
|
14
|
+
* the user and client details returned in IMember
|
|
15
|
+
* @typeParam M - A service-specific member type.
|
|
20
16
|
*/
|
|
21
17
|
export abstract class ServiceAudience<M extends IMember = IMember>
|
|
22
18
|
extends TypedEventEmitter<IServiceAudienceEvents<M>>
|
|
23
19
|
implements IServiceAudience<M> {
|
|
24
20
|
/**
|
|
25
|
-
* Audience object which includes all the existing members of the
|
|
21
|
+
* Audience object which includes all the existing members of the container.
|
|
26
22
|
*/
|
|
27
23
|
protected readonly audience: IAudience;
|
|
28
24
|
|
|
29
25
|
/**
|
|
30
|
-
* Retain the most recent member list.
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
* It also allows us to provide the client details in the event which makes it easier to find that client connection
|
|
40
|
-
* in a map keyed on the `userId` and not `clientId`.
|
|
41
|
-
*
|
|
42
|
-
* This map will always be up-to-date in a `removeMember` event because it is set once at construction and in
|
|
43
|
-
* every `addMember` event. It is mapped `clientId` to `M` to be better work with what the {@link IServiceAudience}
|
|
44
|
-
* events provide.
|
|
26
|
+
* Retain the most recent member list. This is so we have more information about a member
|
|
27
|
+
* leaving the audience in the removeMember event. It allows us to match the behavior of the
|
|
28
|
+
* addMember event where it only fires on a change to the members this class exposes (and would
|
|
29
|
+
* actually produce a change in what getMembers returns). It also allows us to provide the
|
|
30
|
+
* client details in the event which makes it easier to find that client connection in a map
|
|
31
|
+
* keyed on the userId and not clientId.
|
|
32
|
+
* This map will always be up-to-date in a removeMember event because it is set once at
|
|
33
|
+
* construction and in every addMember event.
|
|
34
|
+
* It is mapped clientId to M to be better work with what the IAudience event provides
|
|
45
35
|
*/
|
|
46
36
|
protected lastMembers: Map<string, M> = new Map();
|
|
47
37
|
|
|
@@ -78,7 +68,6 @@ export abstract class ServiceAudience<M extends IMember = IMember>
|
|
|
78
68
|
|
|
79
69
|
/**
|
|
80
70
|
* Provides ability for inheriting class to modify/extend the audience object.
|
|
81
|
-
*
|
|
82
71
|
* @param audienceMember - Record of a specific audience member.
|
|
83
72
|
*/
|
|
84
73
|
protected abstract createServiceMember(audienceMember: IClient): M;
|
|
@@ -138,7 +127,6 @@ export abstract class ServiceAudience<M extends IMember = IMember>
|
|
|
138
127
|
/**
|
|
139
128
|
* Provides ability for the inheriting class to include/omit specific members.
|
|
140
129
|
* An example use case is omitting the summarizer client.
|
|
141
|
-
*
|
|
142
130
|
* @param member - Member to be included/omitted.
|
|
143
131
|
*/
|
|
144
132
|
protected shouldIncludeAsMember(member: IClient): boolean {
|