@fluidframework/fluid-static 2.0.0-internal.1.4.4 → 2.0.0-internal.2.0.1
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 +51 -14
- package/dist/fluidContainer.d.ts.map +1 -1
- package/dist/fluidContainer.js +13 -4
- package/dist/fluidContainer.js.map +1 -1
- package/dist/rootDataObject.d.ts +18 -10
- package/dist/rootDataObject.d.ts.map +1 -1
- package/dist/rootDataObject.js +15 -8
- package/dist/rootDataObject.js.map +1 -1
- package/dist/serviceAudience.d.ts +25 -13
- package/dist/serviceAudience.d.ts.map +1 -1
- package/dist/serviceAudience.js +23 -12
- package/dist/serviceAudience.js.map +1 -1
- package/dist/types.d.ts +75 -69
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/lib/fluidContainer.d.ts +51 -14
- package/lib/fluidContainer.d.ts.map +1 -1
- package/lib/fluidContainer.js +13 -4
- package/lib/fluidContainer.js.map +1 -1
- package/lib/rootDataObject.d.ts +18 -10
- package/lib/rootDataObject.d.ts.map +1 -1
- package/lib/rootDataObject.js +15 -8
- package/lib/rootDataObject.js.map +1 -1
- package/lib/serviceAudience.d.ts +25 -13
- package/lib/serviceAudience.d.ts.map +1 -1
- package/lib/serviceAudience.js +23 -12
- package/lib/serviceAudience.js.map +1 -1
- package/lib/types.d.ts +75 -69
- package/lib/types.d.ts.map +1 -1
- package/lib/types.js.map +1 -1
- package/package.json +38 -19
- package/src/fluidContainer.ts +64 -18
- package/src/rootDataObject.ts +18 -10
- package/src/serviceAudience.ts +25 -13
- package/src/types.ts +80 -69
package/src/types.ts
CHANGED
|
@@ -9,60 +9,69 @@ import { IChannelFactory } from "@fluidframework/datastore-definitions";
|
|
|
9
9
|
import { IFluidDataStoreFactory } from "@fluidframework/runtime-definitions";
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
* A mapping of string identifiers to instantiated
|
|
12
|
+
* A mapping of string identifiers to instantiated `DataObject`s or `SharedObject`s.
|
|
13
13
|
*/
|
|
14
14
|
export type LoadableObjectRecord = Record<string, IFluidLoadable>;
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
|
-
* A mapping of string identifiers to classes that will later be used to instantiate a corresponding DataObject
|
|
18
|
-
* or SharedObject in a LoadableObjectRecord.
|
|
17
|
+
* A mapping of string identifiers to classes that will later be used to instantiate a corresponding `DataObject`
|
|
18
|
+
* or `SharedObject` in a {@link LoadableObjectRecord}.
|
|
19
19
|
*/
|
|
20
20
|
export type LoadableObjectClassRecord = Record<string, LoadableObjectClass<any>>;
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
|
-
* A
|
|
24
|
-
*
|
|
23
|
+
* A class object of `DataObject` or `SharedObject`.
|
|
24
|
+
*
|
|
25
|
+
* @typeParam T - The class of the `DataObject` or `SharedObject`.
|
|
25
26
|
*/
|
|
26
27
|
export type LoadableObjectClass<T extends IFluidLoadable> = DataObjectClass<T> | SharedObjectClass<T>;
|
|
27
28
|
|
|
28
29
|
/**
|
|
29
|
-
* A
|
|
30
|
-
* constructor that will return the type of the DataObject
|
|
31
|
-
*
|
|
30
|
+
* A class that has a factory that can create a `DataObject` and a
|
|
31
|
+
* constructor that will return the type of the `DataObject`.
|
|
32
|
+
*
|
|
33
|
+
* @typeParam T - The class of the `DataObject`.
|
|
32
34
|
*/
|
|
33
35
|
export type DataObjectClass<T extends IFluidLoadable>
|
|
34
36
|
= { readonly factory: IFluidDataStoreFactory; } & LoadableObjectCtor<T>;
|
|
35
37
|
|
|
36
38
|
/**
|
|
37
|
-
* A
|
|
38
|
-
* constructor that will return the type of the DataObject
|
|
39
|
-
*
|
|
39
|
+
* A class that has a factory that can create a DDSes (`SharedObject`s) and a
|
|
40
|
+
* constructor that will return the type of the `DataObject`.
|
|
41
|
+
*
|
|
42
|
+
* @typeParam T - The class of the `SharedObject`.
|
|
40
43
|
*/
|
|
41
44
|
export type SharedObjectClass<T extends IFluidLoadable>
|
|
42
45
|
= { readonly getFactory: () => IChannelFactory; } & LoadableObjectCtor<T>;
|
|
43
46
|
|
|
44
47
|
/**
|
|
45
|
-
* An object with a constructor that will return an
|
|
46
|
-
*
|
|
48
|
+
* An object with a constructor that will return an {@link @fluidframework/core-interfaces#IFluidLoadable}.
|
|
49
|
+
*
|
|
50
|
+
* @typeParam T - The class of the loadable object.
|
|
47
51
|
*/
|
|
48
52
|
export type LoadableObjectCtor<T extends IFluidLoadable> = new(...args: any[]) => T;
|
|
49
53
|
|
|
50
54
|
/**
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
55
|
+
* Declares the Fluid objects that will be available in the {@link IFluidContainer | Container}.
|
|
56
|
+
*
|
|
57
|
+
* @remarks
|
|
58
|
+
*
|
|
59
|
+
* It includes both the instances of objects that are initially available upon `Container` creation, as well
|
|
60
|
+
* as the types of objects that may be dynamically created throughout the lifetime of the `Container`.
|
|
54
61
|
*/
|
|
55
62
|
export interface ContainerSchema {
|
|
56
63
|
/**
|
|
57
|
-
* Defines loadable objects that will be created when the
|
|
58
|
-
*
|
|
64
|
+
* Defines loadable objects that will be created when the {@link IFluidContainer | Container} is first created.
|
|
65
|
+
*
|
|
66
|
+
* @remarks It uses the key as the id and the value as the loadable object to create.
|
|
59
67
|
*
|
|
60
68
|
* @example
|
|
61
|
-
*
|
|
69
|
+
*
|
|
70
|
+
* In the example below two objects will be created when the `Container` is first
|
|
62
71
|
* created. One with id "map1" that will return a `SharedMap` and the other with
|
|
63
72
|
* id "pair1" that will return a `KeyValueDataObject`.
|
|
64
73
|
*
|
|
65
|
-
* ```
|
|
74
|
+
* ```typescript
|
|
66
75
|
* {
|
|
67
76
|
* map1: SharedMap,
|
|
68
77
|
* pair1: KeyValueDataObject,
|
|
@@ -72,7 +81,9 @@ export interface ContainerSchema {
|
|
|
72
81
|
initialObjects: LoadableObjectClassRecord;
|
|
73
82
|
|
|
74
83
|
/**
|
|
75
|
-
*
|
|
84
|
+
* Loadable objects that can be created after the initial {@link IFluidContainer | Container} creation.
|
|
85
|
+
*
|
|
86
|
+
* @remarks
|
|
76
87
|
*
|
|
77
88
|
* Types defined in `initialObjects` will always be available and are not required to be provided here.
|
|
78
89
|
*
|
|
@@ -83,61 +94,59 @@ export interface ContainerSchema {
|
|
|
83
94
|
}
|
|
84
95
|
|
|
85
96
|
/**
|
|
86
|
-
*
|
|
87
|
-
* Only changes that would be reflected in the returned map of {@link IServiceAudience}'s
|
|
88
|
-
* {@link IServiceAudience.getMembers} method will emit events.
|
|
89
|
-
*
|
|
90
|
-
* @remarks
|
|
91
|
-
*
|
|
92
|
-
* The following is the list of events emitted.
|
|
93
|
-
*
|
|
94
|
-
* ### "membersChanged"
|
|
95
|
-
*
|
|
96
|
-
* The "membersChanged" event is emitted when a member is either added or removed.
|
|
97
|
-
*
|
|
98
|
-
* #### Listener signature
|
|
99
|
-
*
|
|
100
|
-
* ```typescript
|
|
101
|
-
* () => void;
|
|
102
|
-
* ```
|
|
103
|
-
*
|
|
104
|
-
* ### "memberAdded"
|
|
105
|
-
*
|
|
106
|
-
* The "memberAdded" event is emitted when a member joins the audience.
|
|
107
|
-
*
|
|
108
|
-
* #### Listener signature
|
|
109
|
-
*
|
|
110
|
-
* ```typescript
|
|
111
|
-
* (clientId: string, member: M) => void;
|
|
112
|
-
* ```
|
|
113
|
-
* - `clientId` - A unique identifier for the client
|
|
97
|
+
* Signature for {@link IMember} change events.
|
|
114
98
|
*
|
|
115
|
-
*
|
|
99
|
+
* @param clientId - A unique identifier for the client.
|
|
100
|
+
* @param member - The service-specific member object for the client.
|
|
116
101
|
*
|
|
117
|
-
*
|
|
118
|
-
|
|
119
|
-
|
|
102
|
+
* @see See {@link IServiceAudienceEvents} for usage details.
|
|
103
|
+
*/
|
|
104
|
+
export type MemberChangedListener<M extends IMember> = (clientId: string, member: M) => void;
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Events that trigger when the roster of members in the Fluid session change.
|
|
120
108
|
*
|
|
121
|
-
*
|
|
109
|
+
* @remarks
|
|
122
110
|
*
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
* ```
|
|
126
|
-
* - `clientId` - A unique identifier for the client
|
|
111
|
+
* Only changes that would be reflected in the returned map of {@link IServiceAudience}'s
|
|
112
|
+
* {@link IServiceAudience.getMembers} method will emit events.
|
|
127
113
|
*
|
|
128
|
-
*
|
|
129
|
-
* @typeParam M - A service-specific member type.
|
|
114
|
+
* @typeParam M - A service-specific {@link IMember} implementation.
|
|
130
115
|
*/
|
|
131
116
|
export interface IServiceAudienceEvents<M extends IMember> extends IEvent {
|
|
117
|
+
/* eslint-disable @typescript-eslint/unified-signatures */
|
|
118
|
+
/**
|
|
119
|
+
* Emitted when a {@link IMember | member}(s) are either added or removed.
|
|
120
|
+
*
|
|
121
|
+
* @eventProperty
|
|
122
|
+
*/
|
|
132
123
|
(event: "membersChanged", listener: () => void): void;
|
|
133
|
-
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Emitted when a {@link IMember | member} joins the audience.
|
|
127
|
+
*
|
|
128
|
+
* @eventProperty
|
|
129
|
+
*/
|
|
130
|
+
(event: "memberAdded", listener: MemberChangedListener<M>): void;
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Emitted when a {@link IMember | member} leaves the audience.
|
|
134
|
+
*
|
|
135
|
+
* @eventProperty
|
|
136
|
+
*/
|
|
137
|
+
(event: "memberRemoved", listener: MemberChangedListener<M>): void;
|
|
138
|
+
/* eslint-enable @typescript-eslint/unified-signatures */
|
|
134
139
|
}
|
|
135
140
|
|
|
136
141
|
/**
|
|
137
|
-
* Base interface to be implemented to fetch each service's audience.
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
*
|
|
142
|
+
* Base interface to be implemented to fetch each service's audience.
|
|
143
|
+
*
|
|
144
|
+
* @remarks
|
|
145
|
+
*
|
|
146
|
+
* The type parameter `M` allows consumers to further extend the client object with service-specific
|
|
147
|
+
* details about the connecting client, such as device information, environment, or a username.
|
|
148
|
+
*
|
|
149
|
+
* @typeParam M - A service-specific {@link IMember} type.
|
|
141
150
|
*/
|
|
142
151
|
export interface IServiceAudience<M extends IMember> extends IEventProvider<IServiceAudienceEvents<M>> {
|
|
143
152
|
/**
|
|
@@ -154,8 +163,9 @@ export interface IServiceAudience<M extends IMember> extends IEventProvider<ISer
|
|
|
154
163
|
}
|
|
155
164
|
|
|
156
165
|
/**
|
|
157
|
-
* Base interface for information for each connection made to the Fluid session.
|
|
158
|
-
*
|
|
166
|
+
* Base interface for information for each connection made to the Fluid session.
|
|
167
|
+
*
|
|
168
|
+
* @remarks This interface can be extended to provide additional information specific to each service.
|
|
159
169
|
*/
|
|
160
170
|
export interface IConnection {
|
|
161
171
|
/**
|
|
@@ -170,8 +180,9 @@ export interface IConnection {
|
|
|
170
180
|
}
|
|
171
181
|
|
|
172
182
|
/**
|
|
173
|
-
* Base interface to be implemented to fetch each service's member.
|
|
174
|
-
*
|
|
183
|
+
* Base interface to be implemented to fetch each service's member.
|
|
184
|
+
*
|
|
185
|
+
* @remarks This interface can be extended by each service to provide additional service-specific user metadata.
|
|
175
186
|
*/
|
|
176
187
|
export interface IMember {
|
|
177
188
|
/**
|