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