@fluidframework/fluid-static 2.0.0-dev.7.4.0.217884 → 2.0.0-dev.7.4.0.221926
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/api-extractor.json +0 -3
- package/api-report/fluid-static.api.md +16 -16
- package/dist/fluid-static-alpha.d.ts +363 -18
- package/dist/fluid-static-beta.d.ts +14 -0
- package/dist/fluid-static-public.d.ts +14 -0
- package/dist/fluid-static-untrimmed.d.ts +16 -16
- package/dist/fluidContainer.cjs.map +1 -1
- package/dist/fluidContainer.d.ts +3 -3
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.ts +13 -13
- package/lib/fluid-static-alpha.d.ts +363 -18
- package/lib/fluid-static-beta.d.ts +14 -0
- package/lib/fluid-static-public.d.ts +14 -0
- package/lib/fluid-static-untrimmed.d.ts +16 -16
- package/lib/fluidContainer.d.ts +4 -8
- package/lib/fluidContainer.d.ts.map +1 -1
- package/lib/fluidContainer.mjs.map +1 -1
- package/lib/index.d.ts +4 -9
- package/lib/index.d.ts.map +1 -1
- package/lib/rootDataObject.d.ts +1 -5
- package/lib/rootDataObject.d.ts.map +1 -1
- package/lib/serviceAudience.d.ts +1 -1
- package/lib/serviceAudience.d.ts.map +1 -1
- package/lib/types.d.ts +13 -13
- package/lib/types.d.ts.map +1 -1
- package/lib/types.mjs.map +1 -1
- package/lib/utils.d.ts +1 -1
- package/lib/utils.d.ts.map +1 -1
- package/package.json +16 -26
- package/src/fluidContainer.ts +3 -3
- package/src/types.ts +13 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @fluidframework/fluid-static
|
|
2
2
|
|
|
3
|
+
## 2.0.0-internal.7.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- azure-client: Deprecated FluidStatic Classes ([#18402](https://github.com/microsoft/FluidFramework/issues/18402)) [589ec39de5](https://github.com/microsoft/FluidFramework/commits/589ec39de52116c7f782319e6f6aa61bc5aa9964)
|
|
8
|
+
|
|
9
|
+
Several FluidStatic classes were unnecessarily exposed. They have been replaced with creation functions. This helps us
|
|
10
|
+
keep implementations decoupled from usage which is easier to maintain and extend. It has very minimal impact on the
|
|
11
|
+
public surface area of downstream packages. The deprecated classes are as follows:
|
|
12
|
+
|
|
13
|
+
- `AzureAudience` (use `IAzureAudience` instead)
|
|
14
|
+
- `TinyliciousAudience` (use `ITinyliciousAudience` instead)
|
|
15
|
+
- `DOProviderContainerRuntimeFactory`
|
|
16
|
+
- `FluidContainer`
|
|
17
|
+
- `ServiceAudience`
|
|
18
|
+
|
|
3
19
|
## 2.0.0-internal.7.3.0
|
|
4
20
|
|
|
5
21
|
Dependency updates only.
|
package/api-extractor.json
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
|
3
3
|
"extends": "../../../common/build/build-common/api-extractor-base.json",
|
|
4
|
-
"dtsRollup": {
|
|
5
|
-
"enabled": true
|
|
6
|
-
},
|
|
7
4
|
"messages": {
|
|
8
5
|
"extractorMessageReporting": {
|
|
9
6
|
// TODO: Add missing documentation and remove this rule override
|
|
@@ -20,7 +20,7 @@ import { IFluidLoadable } from '@fluidframework/core-interfaces';
|
|
|
20
20
|
import { IRuntimeFactory } from '@fluidframework/container-definitions';
|
|
21
21
|
import { TypedEventEmitter } from '@fluid-internal/client-utils';
|
|
22
22
|
|
|
23
|
-
// @
|
|
23
|
+
// @alpha
|
|
24
24
|
export interface ContainerSchema {
|
|
25
25
|
dynamicObjectTypes?: LoadableObjectClass<any>[];
|
|
26
26
|
initialObjects: LoadableObjectClassRecord;
|
|
@@ -43,7 +43,7 @@ export function createServiceAudience<M extends IMember = IMember>(props: {
|
|
|
43
43
|
createServiceMember: (audienceMember: IClient) => M;
|
|
44
44
|
}): IServiceAudience<M>;
|
|
45
45
|
|
|
46
|
-
// @
|
|
46
|
+
// @alpha
|
|
47
47
|
export type DataObjectClass<T extends IFluidLoadable> = {
|
|
48
48
|
readonly factory: IFluidDataStoreFactory;
|
|
49
49
|
} & LoadableObjectCtor<T>;
|
|
@@ -71,13 +71,13 @@ export class FluidContainer<TContainerSchema extends ContainerSchema = Container
|
|
|
71
71
|
get isDirty(): boolean;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
// @
|
|
74
|
+
// @alpha
|
|
75
75
|
export interface IConnection {
|
|
76
76
|
id: string;
|
|
77
77
|
mode: "write" | "read";
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
// @
|
|
80
|
+
// @alpha
|
|
81
81
|
export interface IFluidContainer<TContainerSchema extends ContainerSchema = ContainerSchema> extends IEventProvider<IFluidContainerEvents> {
|
|
82
82
|
attach(): Promise<string>;
|
|
83
83
|
readonly attachState: AttachState;
|
|
@@ -91,7 +91,7 @@ export interface IFluidContainer<TContainerSchema extends ContainerSchema = Cont
|
|
|
91
91
|
readonly isDirty: boolean;
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
// @
|
|
94
|
+
// @alpha
|
|
95
95
|
export interface IFluidContainerEvents extends IEvent {
|
|
96
96
|
(event: "connected", listener: () => void): void;
|
|
97
97
|
(event: "disconnected", listener: () => void): void;
|
|
@@ -100,13 +100,13 @@ export interface IFluidContainerEvents extends IEvent {
|
|
|
100
100
|
(event: "disposed", listener: (error?: ICriticalContainerError) => void): any;
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
-
// @
|
|
103
|
+
// @alpha
|
|
104
104
|
export interface IMember {
|
|
105
105
|
connections: IConnection[];
|
|
106
106
|
userId: string;
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
// @
|
|
109
|
+
// @alpha
|
|
110
110
|
export type InitialObjects<T extends ContainerSchema> = {
|
|
111
111
|
[K in keyof T["initialObjects"]]: T["initialObjects"][K] extends LoadableObjectClass<infer TChannel> ? TChannel : never;
|
|
112
112
|
};
|
|
@@ -123,13 +123,13 @@ export interface IRootDataObject extends IProvideRootDataObject {
|
|
|
123
123
|
readonly initialObjects: LoadableObjectRecord;
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
-
// @
|
|
126
|
+
// @alpha
|
|
127
127
|
export interface IServiceAudience<M extends IMember> extends IEventProvider<IServiceAudienceEvents<M>> {
|
|
128
128
|
getMembers(): Map<string, M>;
|
|
129
129
|
getMyself(): Myself<M> | undefined;
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
-
// @
|
|
132
|
+
// @alpha
|
|
133
133
|
export interface IServiceAudienceEvents<M extends IMember> extends IEvent {
|
|
134
134
|
// @eventProperty
|
|
135
135
|
(event: "membersChanged", listener: () => void): void;
|
|
@@ -139,22 +139,22 @@ export interface IServiceAudienceEvents<M extends IMember> extends IEvent {
|
|
|
139
139
|
(event: "memberRemoved", listener: MemberChangedListener<M>): void;
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
-
// @
|
|
142
|
+
// @alpha
|
|
143
143
|
export type LoadableObjectClass<T extends IFluidLoadable> = DataObjectClass<T> | SharedObjectClass<T>;
|
|
144
144
|
|
|
145
|
-
// @
|
|
145
|
+
// @alpha
|
|
146
146
|
export type LoadableObjectClassRecord = Record<string, LoadableObjectClass<any>>;
|
|
147
147
|
|
|
148
|
-
// @
|
|
148
|
+
// @alpha
|
|
149
149
|
export type LoadableObjectCtor<T extends IFluidLoadable> = new (...args: any[]) => T;
|
|
150
150
|
|
|
151
|
-
// @
|
|
151
|
+
// @alpha
|
|
152
152
|
export type LoadableObjectRecord = Record<string, IFluidLoadable>;
|
|
153
153
|
|
|
154
|
-
// @
|
|
154
|
+
// @alpha
|
|
155
155
|
export type MemberChangedListener<M extends IMember> = (clientId: string, member: M) => void;
|
|
156
156
|
|
|
157
|
-
// @
|
|
157
|
+
// @alpha
|
|
158
158
|
export type Myself<M extends IMember = IMember> = M & {
|
|
159
159
|
currentConnection: string;
|
|
160
160
|
};
|
|
@@ -172,7 +172,7 @@ export abstract class ServiceAudience<M extends IMember = IMember> extends Typed
|
|
|
172
172
|
protected shouldIncludeAsMember(member: IClient): boolean;
|
|
173
173
|
}
|
|
174
174
|
|
|
175
|
-
// @
|
|
175
|
+
// @alpha
|
|
176
176
|
export type SharedObjectClass<T extends IFluidLoadable> = {
|
|
177
177
|
readonly getFactory: () => IChannelFactory;
|
|
178
178
|
} & LoadableObjectCtor<T>;
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { AttachState } from '@fluidframework/container-definitions';
|
|
8
|
+
import { BaseContainerRuntimeFactory } from '@fluidframework/aqueduct';
|
|
8
9
|
import { ConnectionState } from '@fluidframework/container-definitions';
|
|
9
10
|
import { IAudience } from '@fluidframework/container-definitions';
|
|
10
11
|
import { IChannelFactory } from '@fluidframework/datastore-definitions';
|
|
@@ -19,9 +20,47 @@ import { IFluidLoadable } from '@fluidframework/core-interfaces';
|
|
|
19
20
|
import { IRuntimeFactory } from '@fluidframework/container-definitions';
|
|
20
21
|
import { TypedEventEmitter } from '@fluid-internal/client-utils';
|
|
21
22
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
/**
|
|
24
|
+
* Declares the Fluid objects that will be available in the {@link IFluidContainer | Container}.
|
|
25
|
+
*
|
|
26
|
+
* @remarks
|
|
27
|
+
*
|
|
28
|
+
* It includes both the instances of objects that are initially available upon `Container` creation, as well
|
|
29
|
+
* as the types of objects that may be dynamically created throughout the lifetime of the `Container`.
|
|
30
|
+
* @alpha
|
|
31
|
+
*/
|
|
32
|
+
export declare interface ContainerSchema {
|
|
33
|
+
/**
|
|
34
|
+
* Defines loadable objects that will be created when the {@link IFluidContainer | Container} is first created.
|
|
35
|
+
*
|
|
36
|
+
* @remarks It uses the key as the id and the value as the loadable object to create.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
*
|
|
40
|
+
* In the example below two objects will be created when the `Container` is first
|
|
41
|
+
* created. One with id "map1" that will return a `SharedMap` and the other with
|
|
42
|
+
* id "pair1" that will return a `KeyValueDataObject`.
|
|
43
|
+
*
|
|
44
|
+
* ```typescript
|
|
45
|
+
* {
|
|
46
|
+
* map1: SharedMap,
|
|
47
|
+
* pair1: KeyValueDataObject,
|
|
48
|
+
* }
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
initialObjects: LoadableObjectClassRecord;
|
|
52
|
+
/**
|
|
53
|
+
* Loadable objects that can be created after the initial {@link IFluidContainer | Container} creation.
|
|
54
|
+
*
|
|
55
|
+
* @remarks
|
|
56
|
+
*
|
|
57
|
+
* Types defined in `initialObjects` will always be available and are not required to be provided here.
|
|
58
|
+
*
|
|
59
|
+
* For best practice it's recommended to define all the dynamic types you create even if they are
|
|
60
|
+
* included via initialObjects.
|
|
61
|
+
*/
|
|
62
|
+
dynamicObjectTypes?: LoadableObjectClass<any>[];
|
|
63
|
+
}
|
|
25
64
|
|
|
26
65
|
/* Excluded from this release type: createDOProviderContainerRuntimeFactory */
|
|
27
66
|
|
|
@@ -29,44 +68,350 @@ import { TypedEventEmitter } from '@fluid-internal/client-utils';
|
|
|
29
68
|
|
|
30
69
|
/* Excluded from this release type: createServiceAudience */
|
|
31
70
|
|
|
32
|
-
|
|
71
|
+
/**
|
|
72
|
+
* A class that has a factory that can create a `DataObject` and a
|
|
73
|
+
* constructor that will return the type of the `DataObject`.
|
|
74
|
+
*
|
|
75
|
+
* @typeParam T - The class of the `DataObject`.
|
|
76
|
+
* @alpha
|
|
77
|
+
*/
|
|
78
|
+
export declare type DataObjectClass<T extends IFluidLoadable> = {
|
|
79
|
+
readonly factory: IFluidDataStoreFactory;
|
|
80
|
+
} & LoadableObjectCtor<T>;
|
|
33
81
|
|
|
34
82
|
/* Excluded from this release type: DOProviderContainerRuntimeFactory */
|
|
35
83
|
|
|
36
84
|
/* Excluded from this release type: FluidContainer */
|
|
37
85
|
|
|
38
|
-
|
|
86
|
+
/**
|
|
87
|
+
* Base interface for information for each connection made to the Fluid session.
|
|
88
|
+
*
|
|
89
|
+
* @remarks This interface can be extended to provide additional information specific to each service.
|
|
90
|
+
* @alpha
|
|
91
|
+
*/
|
|
92
|
+
export declare interface IConnection {
|
|
93
|
+
/**
|
|
94
|
+
* A unique ID for the connection. A single user may have multiple connections, each with a different ID.
|
|
95
|
+
*/
|
|
96
|
+
id: string;
|
|
97
|
+
/**
|
|
98
|
+
* Whether the connection is in read or read/write mode.
|
|
99
|
+
*/
|
|
100
|
+
mode: "write" | "read";
|
|
101
|
+
}
|
|
39
102
|
|
|
40
|
-
|
|
103
|
+
/**
|
|
104
|
+
* Provides an entrypoint into the client side of collaborative Fluid data.
|
|
105
|
+
* Provides access to the data as well as status on the collaboration session.
|
|
106
|
+
*
|
|
107
|
+
* @typeparam TContainerSchema - Used to determine the type of 'initialObjects'.
|
|
108
|
+
*
|
|
109
|
+
* @remarks Note: external implementations of this interface are not supported.
|
|
110
|
+
* @alpha
|
|
111
|
+
*/
|
|
112
|
+
export declare interface IFluidContainer<TContainerSchema extends ContainerSchema = ContainerSchema> extends IEventProvider<IFluidContainerEvents> {
|
|
113
|
+
/**
|
|
114
|
+
* Provides the current connected state of the container
|
|
115
|
+
*/
|
|
116
|
+
readonly connectionState: ConnectionState;
|
|
117
|
+
/**
|
|
118
|
+
* A container is considered **dirty** if it has local changes that have not yet been acknowledged by the service.
|
|
119
|
+
*
|
|
120
|
+
* @remarks
|
|
121
|
+
*
|
|
122
|
+
* You should always check the `isDirty` flag before closing the container or navigating away from the page.
|
|
123
|
+
* Closing the container while `isDirty === true` may result in the loss of operations that have not yet been
|
|
124
|
+
* acknowledged by the service.
|
|
125
|
+
*
|
|
126
|
+
* A container is considered dirty in the following cases:
|
|
127
|
+
*
|
|
128
|
+
* 1. The container has been created in the detached state, and either it has not been attached yet or it is
|
|
129
|
+
* in the process of being attached (container is in `attaching` state). If container is closed prior to being
|
|
130
|
+
* attached, host may never know if the file was created or not.
|
|
131
|
+
*
|
|
132
|
+
* 2. The container was attached, but it has local changes that have not yet been saved to service endpoint.
|
|
133
|
+
* This occurs as part of normal op flow where pending operation (changes) are awaiting acknowledgement from the
|
|
134
|
+
* service. In some cases this can be due to lack of network connection. If the network connection is down,
|
|
135
|
+
* it needs to be restored for the pending changes to be acknowledged.
|
|
136
|
+
*/
|
|
137
|
+
readonly isDirty: boolean;
|
|
138
|
+
/**
|
|
139
|
+
* Whether or not the container is disposed, which permanently disables it.
|
|
140
|
+
*/
|
|
141
|
+
readonly disposed: boolean;
|
|
142
|
+
/**
|
|
143
|
+
* The collection of data objects and Distributed Data Stores (DDSes) that were specified by the schema.
|
|
144
|
+
*
|
|
145
|
+
* @remarks These data objects and DDSes exist for the lifetime of the container.
|
|
146
|
+
*/
|
|
147
|
+
readonly initialObjects: InitialObjects<TContainerSchema>;
|
|
148
|
+
/**
|
|
149
|
+
* The current attachment state of the container.
|
|
150
|
+
*
|
|
151
|
+
* @remarks
|
|
152
|
+
*
|
|
153
|
+
* Once a container has been attached, it remains attached.
|
|
154
|
+
* When loading an existing container, it will already be attached.
|
|
155
|
+
*/
|
|
156
|
+
readonly attachState: AttachState;
|
|
157
|
+
/**
|
|
158
|
+
* A newly created container starts detached from the collaborative service.
|
|
159
|
+
* Calling `attach()` uploads the new container to the service and connects to the collaborative service.
|
|
160
|
+
*
|
|
161
|
+
* @remarks
|
|
162
|
+
*
|
|
163
|
+
* This should only be called when the container is in the
|
|
164
|
+
* {@link @fluidframework/container-definitions#AttachState.Detatched} state.
|
|
165
|
+
*
|
|
166
|
+
* This can be determined by observing {@link IFluidContainer.attachState}.
|
|
167
|
+
*
|
|
168
|
+
* @returns A promise which resolves when the attach is complete, with the string identifier of the container.
|
|
169
|
+
*/
|
|
170
|
+
attach(): Promise<string>;
|
|
171
|
+
/**
|
|
172
|
+
* Attempts to connect the container to the delta stream and process operations.
|
|
173
|
+
*
|
|
174
|
+
* @throws Will throw an error if connection is unsuccessful.
|
|
175
|
+
*
|
|
176
|
+
* @remarks
|
|
177
|
+
*
|
|
178
|
+
* This should only be called when the container is in the
|
|
179
|
+
* {@link @fluidframework/container-definitions#ConnectionState.Disconnected} state.
|
|
180
|
+
*
|
|
181
|
+
* This can be determined by observing {@link IFluidContainer.connectionState}.
|
|
182
|
+
*/
|
|
183
|
+
connect(): void;
|
|
184
|
+
/**
|
|
185
|
+
* Disconnects the container from the delta stream and stops processing operations.
|
|
186
|
+
*
|
|
187
|
+
* @remarks
|
|
188
|
+
*
|
|
189
|
+
* This should only be called when the container is in the
|
|
190
|
+
* {@link @fluidframework/container-definitions#ConnectionState.Connected} state.
|
|
191
|
+
*
|
|
192
|
+
* This can be determined by observing {@link IFluidContainer.connectionState}.
|
|
193
|
+
*/
|
|
194
|
+
disconnect(): void;
|
|
195
|
+
/**
|
|
196
|
+
* Create a new data object or Distributed Data Store (DDS) of the specified type.
|
|
197
|
+
*
|
|
198
|
+
* @remarks
|
|
199
|
+
*
|
|
200
|
+
* In order to share the data object or DDS with other
|
|
201
|
+
* collaborators and retrieve it later, store its handle in a collection like a SharedDirectory from your
|
|
202
|
+
* initialObjects.
|
|
203
|
+
*
|
|
204
|
+
* @param objectClass - The class of the `DataObject` or `SharedObject` to create.
|
|
205
|
+
*
|
|
206
|
+
* @typeParam T - The class of the `DataObject` or `SharedObject`.
|
|
207
|
+
*/
|
|
208
|
+
create<T extends IFluidLoadable>(objectClass: LoadableObjectClass<T>): Promise<T>;
|
|
209
|
+
/**
|
|
210
|
+
* Dispose of the container instance, permanently disabling it.
|
|
211
|
+
*/
|
|
212
|
+
dispose(): void;
|
|
213
|
+
}
|
|
41
214
|
|
|
42
|
-
|
|
215
|
+
/**
|
|
216
|
+
* Events emitted from {@link IFluidContainer}.
|
|
217
|
+
* @alpha
|
|
218
|
+
*/
|
|
219
|
+
export declare interface IFluidContainerEvents extends IEvent {
|
|
220
|
+
/**
|
|
221
|
+
* Emitted when the {@link IFluidContainer} completes connecting to the Fluid service.
|
|
222
|
+
*
|
|
223
|
+
* @remarks Reflects connection state changes against the (delta) service acknowledging ops/edits.
|
|
224
|
+
*
|
|
225
|
+
* @see
|
|
226
|
+
*
|
|
227
|
+
* - {@link IFluidContainer.connectionState}
|
|
228
|
+
*
|
|
229
|
+
* - {@link IFluidContainer.connect}
|
|
230
|
+
*/
|
|
231
|
+
(event: "connected", listener: () => void): void;
|
|
232
|
+
/**
|
|
233
|
+
* Emitted when the {@link IFluidContainer} becomes disconnected from the Fluid service.
|
|
234
|
+
*
|
|
235
|
+
* @remarks Reflects connection state changes against the (delta) service acknowledging ops/edits.
|
|
236
|
+
*
|
|
237
|
+
* @see
|
|
238
|
+
*
|
|
239
|
+
* - {@link IFluidContainer.connectionState}
|
|
240
|
+
*
|
|
241
|
+
* - {@link IFluidContainer.disconnect}
|
|
242
|
+
*/
|
|
243
|
+
(event: "disconnected", listener: () => void): void;
|
|
244
|
+
/**
|
|
245
|
+
* Emitted when all local changes/edits have been acknowledged by the service.
|
|
246
|
+
*
|
|
247
|
+
* @remarks "dirty" event will be emitted when the next local change has been made.
|
|
248
|
+
*
|
|
249
|
+
* @see {@link IFluidContainer.isDirty}
|
|
250
|
+
*/
|
|
251
|
+
(event: "saved", listener: () => void): void;
|
|
252
|
+
/**
|
|
253
|
+
* Emitted when the first local change has been made, following a "saved" event.
|
|
254
|
+
*
|
|
255
|
+
* @remarks "saved" event will be emitted once all local changes have been acknowledged by the service.
|
|
256
|
+
*
|
|
257
|
+
* @see {@link IFluidContainer.isDirty}
|
|
258
|
+
*/
|
|
259
|
+
(event: "dirty", listener: () => void): void;
|
|
260
|
+
/**
|
|
261
|
+
* Emitted when the {@link IFluidContainer} is closed, which permanently disables it.
|
|
262
|
+
*
|
|
263
|
+
* @remarks Listener parameters:
|
|
264
|
+
*
|
|
265
|
+
* - `error`: If the container was closed due to error (as opposed to an explicit call to
|
|
266
|
+
* {@link IFluidContainer.dispose}), this will contain details about the error that caused it.
|
|
267
|
+
*/
|
|
268
|
+
(event: "disposed", listener: (error?: ICriticalContainerError) => void): any;
|
|
269
|
+
}
|
|
43
270
|
|
|
44
|
-
|
|
271
|
+
/**
|
|
272
|
+
* Base interface to be implemented to fetch each service's member.
|
|
273
|
+
*
|
|
274
|
+
* @remarks This interface can be extended by each service to provide additional service-specific user metadata.
|
|
275
|
+
* @alpha
|
|
276
|
+
*/
|
|
277
|
+
export declare interface IMember {
|
|
278
|
+
/**
|
|
279
|
+
* An ID for the user, unique among each individual user connecting to the session.
|
|
280
|
+
*/
|
|
281
|
+
userId: string;
|
|
282
|
+
/**
|
|
283
|
+
* The set of connections the user has made, e.g. from multiple tabs or devices.
|
|
284
|
+
*/
|
|
285
|
+
connections: IConnection[];
|
|
286
|
+
}
|
|
45
287
|
|
|
46
|
-
|
|
288
|
+
/**
|
|
289
|
+
* Extract the type of 'initialObjects' from the given {@link ContainerSchema} type.
|
|
290
|
+
* @alpha
|
|
291
|
+
*/
|
|
292
|
+
export declare type InitialObjects<T extends ContainerSchema> = {
|
|
293
|
+
[K in keyof T["initialObjects"]]: T["initialObjects"][K] extends LoadableObjectClass<infer TChannel> ? TChannel : never;
|
|
294
|
+
};
|
|
47
295
|
|
|
48
296
|
/* Excluded from this release type: IProvideRootDataObject */
|
|
49
297
|
|
|
50
298
|
/* Excluded from this release type: IRootDataObject */
|
|
51
299
|
|
|
52
|
-
|
|
300
|
+
/**
|
|
301
|
+
* Base interface to be implemented to fetch each service's audience.
|
|
302
|
+
*
|
|
303
|
+
* @remarks
|
|
304
|
+
*
|
|
305
|
+
* The type parameter `M` allows consumers to further extend the client object with service-specific
|
|
306
|
+
* details about the connecting client, such as device information, environment, or a username.
|
|
307
|
+
*
|
|
308
|
+
* @typeParam M - A service-specific {@link IMember} type.
|
|
309
|
+
* @alpha
|
|
310
|
+
*/
|
|
311
|
+
export declare interface IServiceAudience<M extends IMember> extends IEventProvider<IServiceAudienceEvents<M>> {
|
|
312
|
+
/**
|
|
313
|
+
* Returns an map of all users currently in the Fluid session where key is the userId and the value is the
|
|
314
|
+
* member object. The implementation may choose to exclude certain connections from the returned map.
|
|
315
|
+
* E.g. ServiceAudience excludes non-interactive connections to represent only the roster of live users.
|
|
316
|
+
*/
|
|
317
|
+
getMembers(): Map<string, M>;
|
|
318
|
+
/**
|
|
319
|
+
* Returns the current active user on this client once they are connected. Otherwise, returns undefined.
|
|
320
|
+
*/
|
|
321
|
+
getMyself(): Myself<M> | undefined;
|
|
322
|
+
}
|
|
53
323
|
|
|
54
|
-
|
|
324
|
+
/**
|
|
325
|
+
* Events that trigger when the roster of members in the Fluid session change.
|
|
326
|
+
*
|
|
327
|
+
* @remarks
|
|
328
|
+
*
|
|
329
|
+
* Only changes that would be reflected in the returned map of {@link IServiceAudience}'s
|
|
330
|
+
* {@link IServiceAudience.getMembers} method will emit events.
|
|
331
|
+
*
|
|
332
|
+
* @typeParam M - A service-specific {@link IMember} implementation.
|
|
333
|
+
* @alpha
|
|
334
|
+
*/
|
|
335
|
+
export declare interface IServiceAudienceEvents<M extends IMember> extends IEvent {
|
|
336
|
+
/**
|
|
337
|
+
* Emitted when a {@link IMember | member}(s) are either added or removed.
|
|
338
|
+
*
|
|
339
|
+
* @eventProperty
|
|
340
|
+
*/
|
|
341
|
+
(event: "membersChanged", listener: () => void): void;
|
|
342
|
+
/**
|
|
343
|
+
* Emitted when a {@link IMember | member} joins the audience.
|
|
344
|
+
*
|
|
345
|
+
* @eventProperty
|
|
346
|
+
*/
|
|
347
|
+
(event: "memberAdded", listener: MemberChangedListener<M>): void;
|
|
348
|
+
/**
|
|
349
|
+
* Emitted when a {@link IMember | member} leaves the audience.
|
|
350
|
+
*
|
|
351
|
+
* @eventProperty
|
|
352
|
+
*/
|
|
353
|
+
(event: "memberRemoved", listener: MemberChangedListener<M>): void;
|
|
354
|
+
}
|
|
55
355
|
|
|
56
|
-
|
|
356
|
+
/**
|
|
357
|
+
* A class object of `DataObject` or `SharedObject`.
|
|
358
|
+
*
|
|
359
|
+
* @typeParam T - The class of the `DataObject` or `SharedObject`.
|
|
360
|
+
* @alpha
|
|
361
|
+
*/
|
|
362
|
+
export declare type LoadableObjectClass<T extends IFluidLoadable> = DataObjectClass<T> | SharedObjectClass<T>;
|
|
57
363
|
|
|
58
|
-
|
|
364
|
+
/**
|
|
365
|
+
* A mapping of string identifiers to classes that will later be used to instantiate a corresponding `DataObject`
|
|
366
|
+
* or `SharedObject` in a {@link LoadableObjectRecord}.
|
|
367
|
+
* @alpha
|
|
368
|
+
*/
|
|
369
|
+
export declare type LoadableObjectClassRecord = Record<string, LoadableObjectClass<any>>;
|
|
59
370
|
|
|
60
|
-
|
|
371
|
+
/**
|
|
372
|
+
* An object with a constructor that will return an {@link @fluidframework/core-interfaces#IFluidLoadable}.
|
|
373
|
+
*
|
|
374
|
+
* @typeParam T - The class of the loadable object.
|
|
375
|
+
* @alpha
|
|
376
|
+
*/
|
|
377
|
+
export declare type LoadableObjectCtor<T extends IFluidLoadable> = new (...args: any[]) => T;
|
|
61
378
|
|
|
62
|
-
|
|
379
|
+
/**
|
|
380
|
+
* A mapping of string identifiers to instantiated `DataObject`s or `SharedObject`s.
|
|
381
|
+
* @alpha
|
|
382
|
+
*/
|
|
383
|
+
export declare type LoadableObjectRecord = Record<string, IFluidLoadable>;
|
|
63
384
|
|
|
64
|
-
|
|
385
|
+
/**
|
|
386
|
+
* Signature for {@link IMember} change events.
|
|
387
|
+
*
|
|
388
|
+
* @param clientId - A unique identifier for the client.
|
|
389
|
+
* @param member - The service-specific member object for the client.
|
|
390
|
+
*
|
|
391
|
+
* @see See {@link IServiceAudienceEvents} for usage details.
|
|
392
|
+
* @alpha
|
|
393
|
+
*/
|
|
394
|
+
export declare type MemberChangedListener<M extends IMember> = (clientId: string, member: M) => void;
|
|
65
395
|
|
|
66
|
-
|
|
396
|
+
/**
|
|
397
|
+
* An extended member object that includes currentConnection
|
|
398
|
+
* @alpha
|
|
399
|
+
*/
|
|
400
|
+
export declare type Myself<M extends IMember = IMember> = M & {
|
|
401
|
+
currentConnection: string;
|
|
402
|
+
};
|
|
67
403
|
|
|
68
404
|
/* Excluded from this release type: ServiceAudience */
|
|
69
405
|
|
|
70
|
-
|
|
406
|
+
/**
|
|
407
|
+
* A class that has a factory that can create a DDSes (`SharedObject`s) and a
|
|
408
|
+
* constructor that will return the type of the `DataObject`.
|
|
409
|
+
*
|
|
410
|
+
* @typeParam T - The class of the `SharedObject`.
|
|
411
|
+
* @alpha
|
|
412
|
+
*/
|
|
413
|
+
export declare type SharedObjectClass<T extends IFluidLoadable> = {
|
|
414
|
+
readonly getFactory: () => IChannelFactory;
|
|
415
|
+
} & LoadableObjectCtor<T>;
|
|
71
416
|
|
|
72
417
|
export { }
|
|
@@ -4,7 +4,21 @@
|
|
|
4
4
|
* @packageDocumentation
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
import { AttachState } from '@fluidframework/container-definitions';
|
|
8
|
+
import { BaseContainerRuntimeFactory } from '@fluidframework/aqueduct';
|
|
9
|
+
import { ConnectionState } from '@fluidframework/container-definitions';
|
|
10
|
+
import { IAudience } from '@fluidframework/container-definitions';
|
|
11
|
+
import { IChannelFactory } from '@fluidframework/datastore-definitions';
|
|
7
12
|
import { IClient } from '@fluidframework/protocol-definitions';
|
|
13
|
+
import { IContainer } from '@fluidframework/container-definitions';
|
|
14
|
+
import { IContainerRuntime } from '@fluidframework/container-runtime-definitions';
|
|
15
|
+
import { ICriticalContainerError } from '@fluidframework/container-definitions';
|
|
16
|
+
import { IEvent } from '@fluidframework/core-interfaces';
|
|
17
|
+
import { IEventProvider } from '@fluidframework/core-interfaces';
|
|
18
|
+
import { IFluidDataStoreFactory } from '@fluidframework/runtime-definitions';
|
|
19
|
+
import { IFluidLoadable } from '@fluidframework/core-interfaces';
|
|
20
|
+
import { IRuntimeFactory } from '@fluidframework/container-definitions';
|
|
21
|
+
import { TypedEventEmitter } from '@fluid-internal/client-utils';
|
|
8
22
|
|
|
9
23
|
/* Excluded from this release type: AttachState */
|
|
10
24
|
|
|
@@ -4,7 +4,21 @@
|
|
|
4
4
|
* @packageDocumentation
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
import { AttachState } from '@fluidframework/container-definitions';
|
|
8
|
+
import { BaseContainerRuntimeFactory } from '@fluidframework/aqueduct';
|
|
9
|
+
import { ConnectionState } from '@fluidframework/container-definitions';
|
|
10
|
+
import { IAudience } from '@fluidframework/container-definitions';
|
|
11
|
+
import { IChannelFactory } from '@fluidframework/datastore-definitions';
|
|
7
12
|
import { IClient } from '@fluidframework/protocol-definitions';
|
|
13
|
+
import { IContainer } from '@fluidframework/container-definitions';
|
|
14
|
+
import { IContainerRuntime } from '@fluidframework/container-runtime-definitions';
|
|
15
|
+
import { ICriticalContainerError } from '@fluidframework/container-definitions';
|
|
16
|
+
import { IEvent } from '@fluidframework/core-interfaces';
|
|
17
|
+
import { IEventProvider } from '@fluidframework/core-interfaces';
|
|
18
|
+
import { IFluidDataStoreFactory } from '@fluidframework/runtime-definitions';
|
|
19
|
+
import { IFluidLoadable } from '@fluidframework/core-interfaces';
|
|
20
|
+
import { IRuntimeFactory } from '@fluidframework/container-definitions';
|
|
21
|
+
import { TypedEventEmitter } from '@fluid-internal/client-utils';
|
|
8
22
|
|
|
9
23
|
/* Excluded from this release type: AttachState */
|
|
10
24
|
|