@fluidframework/fluid-static 2.0.0-internal.7.3.0 → 2.0.0-internal.7.4.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.
Files changed (58) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/api-extractor-lint.json +13 -0
  3. package/api-extractor.json +3 -3
  4. package/api-report/fluid-static.api.md +45 -22
  5. package/dist/fluid-static-alpha.d.ts +417 -0
  6. package/dist/fluid-static-beta.d.ts +99 -0
  7. package/dist/fluid-static-public.d.ts +99 -0
  8. package/dist/fluid-static-untrimmed.d.ts +619 -0
  9. package/dist/fluidContainer.cjs +10 -3
  10. package/dist/fluidContainer.cjs.map +1 -1
  11. package/dist/fluidContainer.d.ts +12 -2
  12. package/dist/fluidContainer.d.ts.map +1 -1
  13. package/dist/index.cjs +4 -1
  14. package/dist/index.cjs.map +1 -1
  15. package/dist/index.d.ts +4 -4
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/rootDataObject.cjs +13 -2
  18. package/dist/rootDataObject.cjs.map +1 -1
  19. package/dist/rootDataObject.d.ts +9 -36
  20. package/dist/rootDataObject.d.ts.map +1 -1
  21. package/dist/serviceAudience.cjs +16 -1
  22. package/dist/serviceAudience.cjs.map +1 -1
  23. package/dist/serviceAudience.d.ts +9 -0
  24. package/dist/serviceAudience.d.ts.map +1 -1
  25. package/dist/types.cjs.map +1 -1
  26. package/dist/types.d.ts +21 -1
  27. package/dist/types.d.ts.map +1 -1
  28. package/lib/fluid-static-alpha.d.ts +417 -0
  29. package/lib/fluid-static-beta.d.ts +99 -0
  30. package/lib/fluid-static-public.d.ts +99 -0
  31. package/lib/fluid-static-untrimmed.d.ts +619 -0
  32. package/lib/fluidContainer.d.ts +13 -7
  33. package/lib/fluidContainer.d.ts.map +1 -1
  34. package/lib/fluidContainer.mjs +8 -2
  35. package/lib/fluidContainer.mjs.map +1 -1
  36. package/lib/index.d.ts +4 -9
  37. package/lib/index.d.ts.map +1 -1
  38. package/lib/index.mjs +3 -3
  39. package/lib/index.mjs.map +1 -1
  40. package/lib/rootDataObject.d.ts +9 -40
  41. package/lib/rootDataObject.d.ts.map +1 -1
  42. package/lib/rootDataObject.mjs +12 -1
  43. package/lib/rootDataObject.mjs.map +1 -1
  44. package/lib/serviceAudience.d.ts +10 -1
  45. package/lib/serviceAudience.d.ts.map +1 -1
  46. package/lib/serviceAudience.mjs +14 -0
  47. package/lib/serviceAudience.mjs.map +1 -1
  48. package/lib/types.d.ts +21 -1
  49. package/lib/types.d.ts.map +1 -1
  50. package/lib/types.mjs.map +1 -1
  51. package/lib/utils.d.ts +1 -1
  52. package/lib/utils.d.ts.map +1 -1
  53. package/package.json +38 -31
  54. package/src/fluidContainer.ts +17 -2
  55. package/src/index.ts +7 -2
  56. package/src/rootDataObject.ts +16 -1
  57. package/src/serviceAudience.ts +18 -0
  58. package/src/types.ts +22 -1
package/dist/types.d.ts CHANGED
@@ -7,17 +7,20 @@ import { IChannelFactory } from "@fluidframework/datastore-definitions";
7
7
  import { IFluidDataStoreFactory } from "@fluidframework/runtime-definitions";
8
8
  /**
9
9
  * A mapping of string identifiers to instantiated `DataObject`s or `SharedObject`s.
10
+ * @alpha
10
11
  */
11
12
  export type LoadableObjectRecord = Record<string, IFluidLoadable>;
12
13
  /**
13
14
  * A mapping of string identifiers to classes that will later be used to instantiate a corresponding `DataObject`
14
15
  * or `SharedObject` in a {@link LoadableObjectRecord}.
16
+ * @alpha
15
17
  */
16
18
  export type LoadableObjectClassRecord = Record<string, LoadableObjectClass<any>>;
17
19
  /**
18
20
  * A class object of `DataObject` or `SharedObject`.
19
21
  *
20
22
  * @typeParam T - The class of the `DataObject` or `SharedObject`.
23
+ * @alpha
21
24
  */
22
25
  export type LoadableObjectClass<T extends IFluidLoadable> = DataObjectClass<T> | SharedObjectClass<T>;
23
26
  /**
@@ -25,6 +28,7 @@ export type LoadableObjectClass<T extends IFluidLoadable> = DataObjectClass<T> |
25
28
  * constructor that will return the type of the `DataObject`.
26
29
  *
27
30
  * @typeParam T - The class of the `DataObject`.
31
+ * @alpha
28
32
  */
29
33
  export type DataObjectClass<T extends IFluidLoadable> = {
30
34
  readonly factory: IFluidDataStoreFactory;
@@ -34,6 +38,7 @@ export type DataObjectClass<T extends IFluidLoadable> = {
34
38
  * constructor that will return the type of the `DataObject`.
35
39
  *
36
40
  * @typeParam T - The class of the `SharedObject`.
41
+ * @alpha
37
42
  */
38
43
  export type SharedObjectClass<T extends IFluidLoadable> = {
39
44
  readonly getFactory: () => IChannelFactory;
@@ -42,6 +47,7 @@ export type SharedObjectClass<T extends IFluidLoadable> = {
42
47
  * An object with a constructor that will return an {@link @fluidframework/core-interfaces#IFluidLoadable}.
43
48
  *
44
49
  * @typeParam T - The class of the loadable object.
50
+ * @alpha
45
51
  */
46
52
  export type LoadableObjectCtor<T extends IFluidLoadable> = new (...args: any[]) => T;
47
53
  /**
@@ -51,6 +57,7 @@ export type LoadableObjectCtor<T extends IFluidLoadable> = new (...args: any[])
51
57
  *
52
58
  * It includes both the instances of objects that are initially available upon `Container` creation, as well
53
59
  * as the types of objects that may be dynamically created throughout the lifetime of the `Container`.
60
+ * @alpha
54
61
  */
55
62
  export interface ContainerSchema {
56
63
  /**
@@ -84,11 +91,18 @@ export interface ContainerSchema {
84
91
  */
85
92
  dynamicObjectTypes?: LoadableObjectClass<any>[];
86
93
  }
94
+ /**
95
+ * @internal
96
+ */
97
+ export interface IProvideRootDataObject {
98
+ readonly IRootDataObject?: IRootDataObject;
99
+ }
87
100
  /**
88
101
  * Holds the collection of objects that the container was initially created with, as well as provides the ability
89
102
  * to dynamically create further objects during usage.
103
+ * @internal
90
104
  */
91
- export interface IRootDataObject {
105
+ export interface IRootDataObject extends IProvideRootDataObject {
92
106
  /**
93
107
  * Provides a record of the initial objects defined on creation.
94
108
  */
@@ -109,6 +123,7 @@ export interface IRootDataObject {
109
123
  * @param member - The service-specific member object for the client.
110
124
  *
111
125
  * @see See {@link IServiceAudienceEvents} for usage details.
126
+ * @alpha
112
127
  */
113
128
  export type MemberChangedListener<M extends IMember> = (clientId: string, member: M) => void;
114
129
  /**
@@ -120,6 +135,7 @@ export type MemberChangedListener<M extends IMember> = (clientId: string, member
120
135
  * {@link IServiceAudience.getMembers} method will emit events.
121
136
  *
122
137
  * @typeParam M - A service-specific {@link IMember} implementation.
138
+ * @alpha
123
139
  */
124
140
  export interface IServiceAudienceEvents<M extends IMember> extends IEvent {
125
141
  /**
@@ -150,6 +166,7 @@ export interface IServiceAudienceEvents<M extends IMember> extends IEvent {
150
166
  * details about the connecting client, such as device information, environment, or a username.
151
167
  *
152
168
  * @typeParam M - A service-specific {@link IMember} type.
169
+ * @alpha
153
170
  */
154
171
  export interface IServiceAudience<M extends IMember> extends IEventProvider<IServiceAudienceEvents<M>> {
155
172
  /**
@@ -167,6 +184,7 @@ export interface IServiceAudience<M extends IMember> extends IEventProvider<ISer
167
184
  * Base interface for information for each connection made to the Fluid session.
168
185
  *
169
186
  * @remarks This interface can be extended to provide additional information specific to each service.
187
+ * @alpha
170
188
  */
171
189
  export interface IConnection {
172
190
  /**
@@ -182,6 +200,7 @@ export interface IConnection {
182
200
  * Base interface to be implemented to fetch each service's member.
183
201
  *
184
202
  * @remarks This interface can be extended by each service to provide additional service-specific user metadata.
203
+ * @alpha
185
204
  */
186
205
  export interface IMember {
187
206
  /**
@@ -195,6 +214,7 @@ export interface IMember {
195
214
  }
196
215
  /**
197
216
  * An extended member object that includes currentConnection
217
+ * @alpha
198
218
  */
199
219
  export type Myself<M extends IMember = IMember> = M & {
200
220
  currentConnection: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACzF,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACxE,OAAO,EAAE,sBAAsB,EAAE,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;;GAKG;AACH,MAAM,WAAW,WAAW;IAC3B;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;OAEG;IACH,IAAI,EAAE,OAAO,GAAG,MAAM,CAAC;CACvB;AAED;;;;;GAKG;AACH,MAAM,WAAW,OAAO;IACvB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,WAAW,EAAE,WAAW,EAAE,CAAC;CAC3B;AAED;;;GAGG;AACH,MAAM,MAAM,MAAM,CAAC,CAAC,SAAS,OAAO,GAAG,OAAO,IAAI,CAAC,GAAG;IAAE,iBAAiB,EAAE,MAAM,CAAA;CAAE,CAAC"}
@@ -0,0 +1,417 @@
1
+ /**
2
+ * Provides a simple and powerful way to consume collaborative Fluid data.
3
+ *
4
+ * @packageDocumentation
5
+ */
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';
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';
22
+
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
+ }
64
+
65
+ /* Excluded from this release type: createDOProviderContainerRuntimeFactory */
66
+
67
+ /* Excluded from this release type: createFluidContainer */
68
+
69
+ /* Excluded from this release type: createServiceAudience */
70
+
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>;
81
+
82
+ /* Excluded from this release type: DOProviderContainerRuntimeFactory */
83
+
84
+ /* Excluded from this release type: FluidContainer */
85
+
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
+ }
102
+
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
+ }
214
+
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
+ }
270
+
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
+ }
287
+
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
+ };
295
+
296
+ /* Excluded from this release type: IProvideRootDataObject */
297
+
298
+ /* Excluded from this release type: IRootDataObject */
299
+
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
+ }
323
+
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
+ }
355
+
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>;
363
+
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>>;
370
+
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;
378
+
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>;
384
+
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;
395
+
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
+ };
403
+
404
+ /* Excluded from this release type: ServiceAudience */
405
+
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>;
416
+
417
+ export { }
@@ -0,0 +1,99 @@
1
+ /**
2
+ * Provides a simple and powerful way to consume collaborative Fluid data.
3
+ *
4
+ * @packageDocumentation
5
+ */
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';
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';
22
+
23
+ /* Excluded from this release type: AttachState */
24
+
25
+ /* Excluded from this release type: BaseContainerRuntimeFactory */
26
+
27
+ /* Excluded from this release type: ConnectionState */
28
+
29
+ /* Excluded from this release type: ContainerSchema */
30
+
31
+ /* Excluded from this release type: createDOProviderContainerRuntimeFactory */
32
+
33
+ /* Excluded from this release type: createFluidContainer */
34
+
35
+ /* Excluded from this release type: createServiceAudience */
36
+
37
+ /* Excluded from this release type: DataObjectClass */
38
+
39
+ /* Excluded from this release type: DOProviderContainerRuntimeFactory */
40
+
41
+ /* Excluded from this release type: FluidContainer */
42
+
43
+ /* Excluded from this release type: IAudience */
44
+
45
+ /* Excluded from this release type: IChannelFactory */
46
+
47
+ /* Excluded from this release type: IConnection */
48
+
49
+ /* Excluded from this release type: IContainer */
50
+
51
+ /* Excluded from this release type: IContainerRuntime */
52
+
53
+ /* Excluded from this release type: ICriticalContainerError */
54
+
55
+ /* Excluded from this release type: IEvent */
56
+
57
+ /* Excluded from this release type: IEventProvider */
58
+
59
+ /* Excluded from this release type: IFluidContainer */
60
+
61
+ /* Excluded from this release type: IFluidContainerEvents */
62
+
63
+ /* Excluded from this release type: IFluidDataStoreFactory */
64
+
65
+ /* Excluded from this release type: IFluidLoadable */
66
+
67
+ /* Excluded from this release type: IMember */
68
+
69
+ /* Excluded from this release type: InitialObjects */
70
+
71
+ /* Excluded from this release type: IProvideRootDataObject */
72
+
73
+ /* Excluded from this release type: IRootDataObject */
74
+
75
+ /* Excluded from this release type: IRuntimeFactory */
76
+
77
+ /* Excluded from this release type: IServiceAudience */
78
+
79
+ /* Excluded from this release type: IServiceAudienceEvents */
80
+
81
+ /* Excluded from this release type: LoadableObjectClass */
82
+
83
+ /* Excluded from this release type: LoadableObjectClassRecord */
84
+
85
+ /* Excluded from this release type: LoadableObjectCtor */
86
+
87
+ /* Excluded from this release type: LoadableObjectRecord */
88
+
89
+ /* Excluded from this release type: MemberChangedListener */
90
+
91
+ /* Excluded from this release type: Myself */
92
+
93
+ /* Excluded from this release type: ServiceAudience */
94
+
95
+ /* Excluded from this release type: SharedObjectClass */
96
+
97
+ /* Excluded from this release type: TypedEventEmitter */
98
+
99
+ export { }