@fluidframework/fluid-static 2.0.0-internal.8.0.0 → 2.0.0-rc.1.0.0
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
|
@@ -15,11 +15,47 @@ import { IEventProvider } from '@fluidframework/core-interfaces';
|
|
|
15
15
|
import { IFluidLoadable } from '@fluidframework/core-interfaces';
|
|
16
16
|
import { IRuntimeFactory } from '@fluidframework/container-definitions';
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
/**
|
|
19
|
+
* Declares the Fluid objects that will be available in the {@link IFluidContainer | Container}.
|
|
20
|
+
*
|
|
21
|
+
* @remarks
|
|
22
|
+
*
|
|
23
|
+
* It includes both the instances of objects that are initially available upon `Container` creation, as well
|
|
24
|
+
* as the types of objects that may be dynamically created throughout the lifetime of the `Container`.
|
|
25
|
+
* @public
|
|
26
|
+
*/
|
|
27
|
+
export declare interface ContainerSchema {
|
|
28
|
+
/**
|
|
29
|
+
* Defines loadable objects that will be created when the {@link IFluidContainer | Container} is first created.
|
|
30
|
+
*
|
|
31
|
+
* @remarks It uses the key as the id and the value as the loadable object to create.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
*
|
|
35
|
+
* In the example below two objects will be created when the `Container` is first
|
|
36
|
+
* created. One with id "map1" that will return a `SharedMap` and the other with
|
|
37
|
+
* id "pair1" that will return a `KeyValueDataObject`.
|
|
38
|
+
*
|
|
39
|
+
* ```typescript
|
|
40
|
+
* {
|
|
41
|
+
* map1: SharedMap,
|
|
42
|
+
* pair1: KeyValueDataObject,
|
|
43
|
+
* }
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
initialObjects: LoadableObjectClassRecord;
|
|
47
|
+
/**
|
|
48
|
+
* Loadable objects that can be created after the initial {@link IFluidContainer | Container} creation.
|
|
49
|
+
*
|
|
50
|
+
* @remarks
|
|
51
|
+
*
|
|
52
|
+
* Types defined in `initialObjects` will always be available and are not required to be provided here.
|
|
53
|
+
*
|
|
54
|
+
* For best practice it's recommended to define all the dynamic types you create even if they are
|
|
55
|
+
* included via initialObjects.
|
|
56
|
+
*/
|
|
57
|
+
dynamicObjectTypes?: LoadableObjectClass<any>[];
|
|
58
|
+
}
|
|
23
59
|
|
|
24
60
|
/* Excluded from this release type: createDOProviderContainerRuntimeFactory */
|
|
25
61
|
|
|
@@ -27,29 +63,234 @@ import { IRuntimeFactory } from '@fluidframework/container-definitions';
|
|
|
27
63
|
|
|
28
64
|
/* Excluded from this release type: createServiceAudience */
|
|
29
65
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
66
|
+
/**
|
|
67
|
+
* A class that has a factory that can create a `DataObject` and a
|
|
68
|
+
* constructor that will return the type of the `DataObject`.
|
|
69
|
+
*
|
|
70
|
+
* @typeParam T - The class of the `DataObject`.
|
|
71
|
+
* @public
|
|
72
|
+
*/
|
|
73
|
+
export declare type DataObjectClass<T extends IFluidLoadable> = {
|
|
74
|
+
readonly factory: {
|
|
75
|
+
IFluidDataStoreFactory: DataObjectClass<T>["factory"];
|
|
76
|
+
};
|
|
77
|
+
} & LoadableObjectCtor<T>;
|
|
33
78
|
|
|
34
|
-
|
|
79
|
+
/**
|
|
80
|
+
* Base interface for information for each connection made to the Fluid session.
|
|
81
|
+
*
|
|
82
|
+
* @remarks This interface can be extended to provide additional information specific to each service.
|
|
83
|
+
* @public
|
|
84
|
+
*/
|
|
85
|
+
export declare interface IConnection {
|
|
86
|
+
/**
|
|
87
|
+
* A unique ID for the connection. A single user may have multiple connections, each with a different ID.
|
|
88
|
+
*/
|
|
89
|
+
id: string;
|
|
90
|
+
/**
|
|
91
|
+
* Whether the connection is in read or read/write mode.
|
|
92
|
+
*/
|
|
93
|
+
mode: "write" | "read";
|
|
94
|
+
}
|
|
35
95
|
|
|
36
96
|
/* Excluded from this release type: IContainer */
|
|
37
97
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
98
|
+
/**
|
|
99
|
+
* Provides an entrypoint into the client side of collaborative Fluid data.
|
|
100
|
+
* Provides access to the data as well as status on the collaboration session.
|
|
101
|
+
*
|
|
102
|
+
* @typeparam TContainerSchema - Used to determine the type of 'initialObjects'.
|
|
103
|
+
*
|
|
104
|
+
* @remarks Note: external implementations of this interface are not supported.
|
|
105
|
+
* @sealed
|
|
106
|
+
* @public
|
|
107
|
+
*/
|
|
108
|
+
export declare interface IFluidContainer<TContainerSchema extends ContainerSchema = ContainerSchema> extends IEventProvider<IFluidContainerEvents> {
|
|
109
|
+
/**
|
|
110
|
+
* Provides the current connected state of the container
|
|
111
|
+
*/
|
|
112
|
+
readonly connectionState: ConnectionState;
|
|
113
|
+
/**
|
|
114
|
+
* A container is considered **dirty** if it has local changes that have not yet been acknowledged by the service.
|
|
115
|
+
*
|
|
116
|
+
* @remarks
|
|
117
|
+
*
|
|
118
|
+
* You should always check the `isDirty` flag before closing the container or navigating away from the page.
|
|
119
|
+
* Closing the container while `isDirty === true` may result in the loss of operations that have not yet been
|
|
120
|
+
* acknowledged by the service.
|
|
121
|
+
*
|
|
122
|
+
* A container is considered dirty in the following cases:
|
|
123
|
+
*
|
|
124
|
+
* 1. The container has been created in the detached state, and either it has not been attached yet or it is
|
|
125
|
+
* in the process of being attached (container is in `attaching` state). If container is closed prior to being
|
|
126
|
+
* attached, host may never know if the file was created or not.
|
|
127
|
+
*
|
|
128
|
+
* 2. The container was attached, but it has local changes that have not yet been saved to service endpoint.
|
|
129
|
+
* This occurs as part of normal op flow where pending operation (changes) are awaiting acknowledgement from the
|
|
130
|
+
* service. In some cases this can be due to lack of network connection. If the network connection is down,
|
|
131
|
+
* it needs to be restored for the pending changes to be acknowledged.
|
|
132
|
+
*/
|
|
133
|
+
readonly isDirty: boolean;
|
|
134
|
+
/**
|
|
135
|
+
* Whether or not the container is disposed, which permanently disables it.
|
|
136
|
+
*/
|
|
137
|
+
readonly disposed: boolean;
|
|
138
|
+
/**
|
|
139
|
+
* The collection of data objects and Distributed Data Stores (DDSes) that were specified by the schema.
|
|
140
|
+
*
|
|
141
|
+
* @remarks These data objects and DDSes exist for the lifetime of the container.
|
|
142
|
+
*/
|
|
143
|
+
readonly initialObjects: InitialObjects<TContainerSchema>;
|
|
144
|
+
/**
|
|
145
|
+
* The current attachment state of the container.
|
|
146
|
+
*
|
|
147
|
+
* @remarks
|
|
148
|
+
*
|
|
149
|
+
* Once a container has been attached, it remains attached.
|
|
150
|
+
* When loading an existing container, it will already be attached.
|
|
151
|
+
*/
|
|
152
|
+
readonly attachState: AttachState;
|
|
153
|
+
/**
|
|
154
|
+
* A newly created container starts detached from the collaborative service.
|
|
155
|
+
* Calling `attach()` uploads the new container to the service and connects to the collaborative service.
|
|
156
|
+
*
|
|
157
|
+
* @remarks
|
|
158
|
+
*
|
|
159
|
+
* This should only be called when the container is in the
|
|
160
|
+
* {@link @fluidframework/container-definitions#AttachState.Detatched} state.
|
|
161
|
+
*
|
|
162
|
+
* This can be determined by observing {@link IFluidContainer.attachState}.
|
|
163
|
+
*
|
|
164
|
+
* @returns A promise which resolves when the attach is complete, with the string identifier of the container.
|
|
165
|
+
*/
|
|
166
|
+
attach(): Promise<string>;
|
|
167
|
+
/**
|
|
168
|
+
* Attempts to connect the container to the delta stream and process operations.
|
|
169
|
+
*
|
|
170
|
+
* @throws Will throw an error if connection is unsuccessful.
|
|
171
|
+
*
|
|
172
|
+
* @remarks
|
|
173
|
+
*
|
|
174
|
+
* This should only be called when the container is in the
|
|
175
|
+
* {@link @fluidframework/container-definitions#ConnectionState.Disconnected} state.
|
|
176
|
+
*
|
|
177
|
+
* This can be determined by observing {@link IFluidContainer.connectionState}.
|
|
178
|
+
*/
|
|
179
|
+
connect(): void;
|
|
180
|
+
/**
|
|
181
|
+
* Disconnects the container from the delta stream and stops processing operations.
|
|
182
|
+
*
|
|
183
|
+
* @remarks
|
|
184
|
+
*
|
|
185
|
+
* This should only be called when the container is in the
|
|
186
|
+
* {@link @fluidframework/container-definitions#ConnectionState.Connected} state.
|
|
187
|
+
*
|
|
188
|
+
* This can be determined by observing {@link IFluidContainer.connectionState}.
|
|
189
|
+
*/
|
|
190
|
+
disconnect(): void;
|
|
191
|
+
/**
|
|
192
|
+
* Create a new data object or Distributed Data Store (DDS) of the specified type.
|
|
193
|
+
*
|
|
194
|
+
* @remarks
|
|
195
|
+
*
|
|
196
|
+
* In order to share the data object or DDS with other
|
|
197
|
+
* collaborators and retrieve it later, store its handle in a collection like a SharedDirectory from your
|
|
198
|
+
* initialObjects.
|
|
199
|
+
*
|
|
200
|
+
* @param objectClass - The class of the `DataObject` or `SharedObject` to create.
|
|
201
|
+
*
|
|
202
|
+
* @typeParam T - The class of the `DataObject` or `SharedObject`.
|
|
203
|
+
*/
|
|
204
|
+
create<T extends IFluidLoadable>(objectClass: LoadableObjectClass<T>): Promise<T>;
|
|
205
|
+
/**
|
|
206
|
+
* Dispose of the container instance, permanently disabling it.
|
|
207
|
+
*/
|
|
208
|
+
dispose(): void;
|
|
209
|
+
}
|
|
47
210
|
|
|
48
|
-
|
|
211
|
+
/**
|
|
212
|
+
* Events emitted from {@link IFluidContainer}.
|
|
213
|
+
*
|
|
214
|
+
* @remarks Note: external implementations of this interface are not supported.
|
|
215
|
+
* @sealed
|
|
216
|
+
* @public
|
|
217
|
+
*/
|
|
218
|
+
export declare interface IFluidContainerEvents extends IEvent {
|
|
219
|
+
/**
|
|
220
|
+
* Emitted when the {@link IFluidContainer} completes connecting to the Fluid service.
|
|
221
|
+
*
|
|
222
|
+
* @remarks Reflects connection state changes against the (delta) service acknowledging ops/edits.
|
|
223
|
+
*
|
|
224
|
+
* @see
|
|
225
|
+
*
|
|
226
|
+
* - {@link IFluidContainer.connectionState}
|
|
227
|
+
*
|
|
228
|
+
* - {@link IFluidContainer.connect}
|
|
229
|
+
*/
|
|
230
|
+
(event: "connected", listener: () => void): void;
|
|
231
|
+
/**
|
|
232
|
+
* Emitted when the {@link IFluidContainer} becomes disconnected from the Fluid service.
|
|
233
|
+
*
|
|
234
|
+
* @remarks Reflects connection state changes against the (delta) service acknowledging ops/edits.
|
|
235
|
+
*
|
|
236
|
+
* @see
|
|
237
|
+
*
|
|
238
|
+
* - {@link IFluidContainer.connectionState}
|
|
239
|
+
*
|
|
240
|
+
* - {@link IFluidContainer.disconnect}
|
|
241
|
+
*/
|
|
242
|
+
(event: "disconnected", listener: () => void): void;
|
|
243
|
+
/**
|
|
244
|
+
* Emitted when all local changes/edits have been acknowledged by the service.
|
|
245
|
+
*
|
|
246
|
+
* @remarks "dirty" event will be emitted when the next local change has been made.
|
|
247
|
+
*
|
|
248
|
+
* @see {@link IFluidContainer.isDirty}
|
|
249
|
+
*/
|
|
250
|
+
(event: "saved", listener: () => void): void;
|
|
251
|
+
/**
|
|
252
|
+
* Emitted when the first local change has been made, following a "saved" event.
|
|
253
|
+
*
|
|
254
|
+
* @remarks "saved" event will be emitted once all local changes have been acknowledged by the service.
|
|
255
|
+
*
|
|
256
|
+
* @see {@link IFluidContainer.isDirty}
|
|
257
|
+
*/
|
|
258
|
+
(event: "dirty", listener: () => void): void;
|
|
259
|
+
/**
|
|
260
|
+
* Emitted when the {@link IFluidContainer} is closed, which permanently disables it.
|
|
261
|
+
*
|
|
262
|
+
* @remarks Listener parameters:
|
|
263
|
+
*
|
|
264
|
+
* - `error`: If the container was closed due to error (as opposed to an explicit call to
|
|
265
|
+
* {@link IFluidContainer.dispose}), this will contain details about the error that caused it.
|
|
266
|
+
*/
|
|
267
|
+
(event: "disposed", listener: (error?: ICriticalContainerError) => void): any;
|
|
268
|
+
}
|
|
49
269
|
|
|
50
|
-
|
|
270
|
+
/**
|
|
271
|
+
* Base interface to be implemented to fetch each service's member.
|
|
272
|
+
*
|
|
273
|
+
* @remarks This interface can be extended by each service to provide additional service-specific user metadata.
|
|
274
|
+
* @public
|
|
275
|
+
*/
|
|
276
|
+
export declare interface IMember {
|
|
277
|
+
/**
|
|
278
|
+
* An ID for the user, unique among each individual user connecting to the session.
|
|
279
|
+
*/
|
|
280
|
+
userId: string;
|
|
281
|
+
/**
|
|
282
|
+
* The set of connections the user has made, e.g. from multiple tabs or devices.
|
|
283
|
+
*/
|
|
284
|
+
connections: IConnection[];
|
|
285
|
+
}
|
|
51
286
|
|
|
52
|
-
|
|
287
|
+
/**
|
|
288
|
+
* Extract the type of 'initialObjects' from the given {@link ContainerSchema} type.
|
|
289
|
+
* @public
|
|
290
|
+
*/
|
|
291
|
+
export declare type InitialObjects<T extends ContainerSchema> = {
|
|
292
|
+
[K in keyof T["initialObjects"]]: T["initialObjects"][K] extends LoadableObjectClass<infer TChannel> ? TChannel : never;
|
|
293
|
+
};
|
|
53
294
|
|
|
54
295
|
/* Excluded from this release type: IProvideRootDataObject */
|
|
55
296
|
|
|
@@ -57,22 +298,115 @@ import { IRuntimeFactory } from '@fluidframework/container-definitions';
|
|
|
57
298
|
|
|
58
299
|
/* Excluded from this release type: IRuntimeFactory */
|
|
59
300
|
|
|
60
|
-
|
|
301
|
+
/**
|
|
302
|
+
* Base interface to be implemented to fetch each service's audience.
|
|
303
|
+
*
|
|
304
|
+
* @remarks
|
|
305
|
+
*
|
|
306
|
+
* The type parameter `M` allows consumers to further extend the client object with service-specific
|
|
307
|
+
* details about the connecting client, such as device information, environment, or a username.
|
|
308
|
+
*
|
|
309
|
+
* @typeParam M - A service-specific {@link IMember} type.
|
|
310
|
+
* @public
|
|
311
|
+
*/
|
|
312
|
+
export declare interface IServiceAudience<M extends IMember> extends IEventProvider<IServiceAudienceEvents<M>> {
|
|
313
|
+
/**
|
|
314
|
+
* Returns an map of all users currently in the Fluid session where key is the userId and the value is the
|
|
315
|
+
* member object. The implementation may choose to exclude certain connections from the returned map.
|
|
316
|
+
* E.g. ServiceAudience excludes non-interactive connections to represent only the roster of live users.
|
|
317
|
+
*/
|
|
318
|
+
getMembers(): Map<string, M>;
|
|
319
|
+
/**
|
|
320
|
+
* Returns the current active user on this client once they are connected. Otherwise, returns undefined.
|
|
321
|
+
*/
|
|
322
|
+
getMyself(): Myself<M> | undefined;
|
|
323
|
+
}
|
|
61
324
|
|
|
62
|
-
|
|
325
|
+
/**
|
|
326
|
+
* Events that trigger when the roster of members in the Fluid session change.
|
|
327
|
+
*
|
|
328
|
+
* @remarks
|
|
329
|
+
*
|
|
330
|
+
* Only changes that would be reflected in the returned map of {@link IServiceAudience}'s
|
|
331
|
+
* {@link IServiceAudience.getMembers} method will emit events.
|
|
332
|
+
*
|
|
333
|
+
* @typeParam M - A service-specific {@link IMember} implementation.
|
|
334
|
+
* @public
|
|
335
|
+
*/
|
|
336
|
+
export declare interface IServiceAudienceEvents<M extends IMember> extends IEvent {
|
|
337
|
+
/**
|
|
338
|
+
* Emitted when a {@link IMember | member}(s) are either added or removed.
|
|
339
|
+
*
|
|
340
|
+
* @eventProperty
|
|
341
|
+
*/
|
|
342
|
+
(event: "membersChanged", listener: () => void): void;
|
|
343
|
+
/**
|
|
344
|
+
* Emitted when a {@link IMember | member} joins the audience.
|
|
345
|
+
*
|
|
346
|
+
* @eventProperty
|
|
347
|
+
*/
|
|
348
|
+
(event: "memberAdded", listener: MemberChangedListener<M>): void;
|
|
349
|
+
/**
|
|
350
|
+
* Emitted when a {@link IMember | member} leaves the audience.
|
|
351
|
+
*
|
|
352
|
+
* @eventProperty
|
|
353
|
+
*/
|
|
354
|
+
(event: "memberRemoved", listener: MemberChangedListener<M>): void;
|
|
355
|
+
}
|
|
63
356
|
|
|
64
|
-
|
|
357
|
+
/**
|
|
358
|
+
* A class object of `DataObject` or `SharedObject`.
|
|
359
|
+
*
|
|
360
|
+
* @typeParam T - The class of the `DataObject` or `SharedObject`.
|
|
361
|
+
* @public
|
|
362
|
+
*/
|
|
363
|
+
export declare type LoadableObjectClass<T extends IFluidLoadable> = DataObjectClass<T> | SharedObjectClass<T>;
|
|
65
364
|
|
|
66
|
-
|
|
365
|
+
/**
|
|
366
|
+
* A mapping of string identifiers to classes that will later be used to instantiate a corresponding `DataObject`
|
|
367
|
+
* or `SharedObject` in a {@link LoadableObjectRecord}.
|
|
368
|
+
* @public
|
|
369
|
+
*/
|
|
370
|
+
export declare type LoadableObjectClassRecord = Record<string, LoadableObjectClass<any>>;
|
|
67
371
|
|
|
68
|
-
|
|
372
|
+
/**
|
|
373
|
+
* An object with a constructor that will return an {@link @fluidframework/core-interfaces#IFluidLoadable}.
|
|
374
|
+
*
|
|
375
|
+
* @typeParam T - The class of the loadable object.
|
|
376
|
+
* @public
|
|
377
|
+
*/
|
|
378
|
+
export declare type LoadableObjectCtor<T extends IFluidLoadable> = new (...args: any[]) => T;
|
|
69
379
|
|
|
70
380
|
/* Excluded from this release type: LoadableObjectRecord */
|
|
71
381
|
|
|
72
|
-
|
|
382
|
+
/**
|
|
383
|
+
* Signature for {@link IMember} change events.
|
|
384
|
+
*
|
|
385
|
+
* @param clientId - A unique identifier for the client.
|
|
386
|
+
* @param member - The service-specific member object for the client.
|
|
387
|
+
*
|
|
388
|
+
* @see See {@link IServiceAudienceEvents} for usage details.
|
|
389
|
+
* @public
|
|
390
|
+
*/
|
|
391
|
+
export declare type MemberChangedListener<M extends IMember> = (clientId: string, member: M) => void;
|
|
73
392
|
|
|
74
|
-
|
|
393
|
+
/**
|
|
394
|
+
* An extended member object that includes currentConnection
|
|
395
|
+
* @public
|
|
396
|
+
*/
|
|
397
|
+
export declare type Myself<M extends IMember = IMember> = M & {
|
|
398
|
+
currentConnection: string;
|
|
399
|
+
};
|
|
75
400
|
|
|
76
|
-
|
|
401
|
+
/**
|
|
402
|
+
* A class that has a factory that can create a DDSes (`SharedObject`s) and a
|
|
403
|
+
* constructor that will return the type of the `DataObject`.
|
|
404
|
+
*
|
|
405
|
+
* @typeParam T - The class of the `SharedObject`.
|
|
406
|
+
* @public
|
|
407
|
+
*/
|
|
408
|
+
export declare type SharedObjectClass<T extends IFluidLoadable> = {
|
|
409
|
+
readonly getFactory: () => IChannelFactory;
|
|
410
|
+
} & LoadableObjectCtor<T>;
|
|
77
411
|
|
|
78
412
|
export { }
|
|
@@ -22,7 +22,7 @@ import { IRuntimeFactory } from '@fluidframework/container-definitions';
|
|
|
22
22
|
*
|
|
23
23
|
* It includes both the instances of objects that are initially available upon `Container` creation, as well
|
|
24
24
|
* as the types of objects that may be dynamically created throughout the lifetime of the `Container`.
|
|
25
|
-
* @
|
|
25
|
+
* @public
|
|
26
26
|
*/
|
|
27
27
|
export declare interface ContainerSchema {
|
|
28
28
|
/**
|
|
@@ -85,7 +85,7 @@ export declare function createServiceAudience<M extends IMember = IMember>(props
|
|
|
85
85
|
* constructor that will return the type of the `DataObject`.
|
|
86
86
|
*
|
|
87
87
|
* @typeParam T - The class of the `DataObject`.
|
|
88
|
-
* @
|
|
88
|
+
* @public
|
|
89
89
|
*/
|
|
90
90
|
export declare type DataObjectClass<T extends IFluidLoadable> = {
|
|
91
91
|
readonly factory: {
|
|
@@ -97,7 +97,7 @@ export declare type DataObjectClass<T extends IFluidLoadable> = {
|
|
|
97
97
|
* Base interface for information for each connection made to the Fluid session.
|
|
98
98
|
*
|
|
99
99
|
* @remarks This interface can be extended to provide additional information specific to each service.
|
|
100
|
-
* @
|
|
100
|
+
* @public
|
|
101
101
|
*/
|
|
102
102
|
export declare interface IConnection {
|
|
103
103
|
/**
|
|
@@ -117,7 +117,8 @@ export declare interface IConnection {
|
|
|
117
117
|
* @typeparam TContainerSchema - Used to determine the type of 'initialObjects'.
|
|
118
118
|
*
|
|
119
119
|
* @remarks Note: external implementations of this interface are not supported.
|
|
120
|
-
* @
|
|
120
|
+
* @sealed
|
|
121
|
+
* @public
|
|
121
122
|
*/
|
|
122
123
|
export declare interface IFluidContainer<TContainerSchema extends ContainerSchema = ContainerSchema> extends IEventProvider<IFluidContainerEvents> {
|
|
123
124
|
/**
|
|
@@ -224,7 +225,10 @@ export declare interface IFluidContainer<TContainerSchema extends ContainerSchem
|
|
|
224
225
|
|
|
225
226
|
/**
|
|
226
227
|
* Events emitted from {@link IFluidContainer}.
|
|
227
|
-
*
|
|
228
|
+
*
|
|
229
|
+
* @remarks Note: external implementations of this interface are not supported.
|
|
230
|
+
* @sealed
|
|
231
|
+
* @public
|
|
228
232
|
*/
|
|
229
233
|
export declare interface IFluidContainerEvents extends IEvent {
|
|
230
234
|
/**
|
|
@@ -282,7 +286,7 @@ export declare interface IFluidContainerEvents extends IEvent {
|
|
|
282
286
|
* Base interface to be implemented to fetch each service's member.
|
|
283
287
|
*
|
|
284
288
|
* @remarks This interface can be extended by each service to provide additional service-specific user metadata.
|
|
285
|
-
* @
|
|
289
|
+
* @public
|
|
286
290
|
*/
|
|
287
291
|
export declare interface IMember {
|
|
288
292
|
/**
|
|
@@ -297,7 +301,7 @@ export declare interface IMember {
|
|
|
297
301
|
|
|
298
302
|
/**
|
|
299
303
|
* Extract the type of 'initialObjects' from the given {@link ContainerSchema} type.
|
|
300
|
-
* @
|
|
304
|
+
* @public
|
|
301
305
|
*/
|
|
302
306
|
export declare type InitialObjects<T extends ContainerSchema> = {
|
|
303
307
|
[K in keyof T["initialObjects"]]: T["initialObjects"][K] extends LoadableObjectClass<infer TChannel> ? TChannel : never;
|
|
@@ -339,7 +343,7 @@ export declare interface IRootDataObject extends IProvideRootDataObject {
|
|
|
339
343
|
* details about the connecting client, such as device information, environment, or a username.
|
|
340
344
|
*
|
|
341
345
|
* @typeParam M - A service-specific {@link IMember} type.
|
|
342
|
-
* @
|
|
346
|
+
* @public
|
|
343
347
|
*/
|
|
344
348
|
export declare interface IServiceAudience<M extends IMember> extends IEventProvider<IServiceAudienceEvents<M>> {
|
|
345
349
|
/**
|
|
@@ -363,7 +367,7 @@ export declare interface IServiceAudience<M extends IMember> extends IEventProvi
|
|
|
363
367
|
* {@link IServiceAudience.getMembers} method will emit events.
|
|
364
368
|
*
|
|
365
369
|
* @typeParam M - A service-specific {@link IMember} implementation.
|
|
366
|
-
* @
|
|
370
|
+
* @public
|
|
367
371
|
*/
|
|
368
372
|
export declare interface IServiceAudienceEvents<M extends IMember> extends IEvent {
|
|
369
373
|
/**
|
|
@@ -390,14 +394,14 @@ export declare interface IServiceAudienceEvents<M extends IMember> extends IEven
|
|
|
390
394
|
* A class object of `DataObject` or `SharedObject`.
|
|
391
395
|
*
|
|
392
396
|
* @typeParam T - The class of the `DataObject` or `SharedObject`.
|
|
393
|
-
* @
|
|
397
|
+
* @public
|
|
394
398
|
*/
|
|
395
399
|
export declare type LoadableObjectClass<T extends IFluidLoadable> = DataObjectClass<T> | SharedObjectClass<T>;
|
|
396
400
|
|
|
397
401
|
/**
|
|
398
402
|
* A mapping of string identifiers to classes that will later be used to instantiate a corresponding `DataObject`
|
|
399
403
|
* or `SharedObject` in a {@link LoadableObjectRecord}.
|
|
400
|
-
* @
|
|
404
|
+
* @public
|
|
401
405
|
*/
|
|
402
406
|
export declare type LoadableObjectClassRecord = Record<string, LoadableObjectClass<any>>;
|
|
403
407
|
|
|
@@ -405,13 +409,13 @@ export declare type LoadableObjectClassRecord = Record<string, LoadableObjectCla
|
|
|
405
409
|
* An object with a constructor that will return an {@link @fluidframework/core-interfaces#IFluidLoadable}.
|
|
406
410
|
*
|
|
407
411
|
* @typeParam T - The class of the loadable object.
|
|
408
|
-
* @
|
|
412
|
+
* @public
|
|
409
413
|
*/
|
|
410
414
|
export declare type LoadableObjectCtor<T extends IFluidLoadable> = new (...args: any[]) => T;
|
|
411
415
|
|
|
412
416
|
/**
|
|
413
417
|
* A mapping of string identifiers to instantiated `DataObject`s or `SharedObject`s.
|
|
414
|
-
* @
|
|
418
|
+
* @internal
|
|
415
419
|
*/
|
|
416
420
|
export declare type LoadableObjectRecord = Record<string, IFluidLoadable>;
|
|
417
421
|
|
|
@@ -422,13 +426,13 @@ export declare type LoadableObjectRecord = Record<string, IFluidLoadable>;
|
|
|
422
426
|
* @param member - The service-specific member object for the client.
|
|
423
427
|
*
|
|
424
428
|
* @see See {@link IServiceAudienceEvents} for usage details.
|
|
425
|
-
* @
|
|
429
|
+
* @public
|
|
426
430
|
*/
|
|
427
431
|
export declare type MemberChangedListener<M extends IMember> = (clientId: string, member: M) => void;
|
|
428
432
|
|
|
429
433
|
/**
|
|
430
434
|
* An extended member object that includes currentConnection
|
|
431
|
-
* @
|
|
435
|
+
* @public
|
|
432
436
|
*/
|
|
433
437
|
export declare type Myself<M extends IMember = IMember> = M & {
|
|
434
438
|
currentConnection: string;
|
|
@@ -439,7 +443,7 @@ export declare type Myself<M extends IMember = IMember> = M & {
|
|
|
439
443
|
* constructor that will return the type of the `DataObject`.
|
|
440
444
|
*
|
|
441
445
|
* @typeParam T - The class of the `SharedObject`.
|
|
442
|
-
* @
|
|
446
|
+
* @public
|
|
443
447
|
*/
|
|
444
448
|
export declare type SharedObjectClass<T extends IFluidLoadable> = {
|
|
445
449
|
readonly getFactory: () => IChannelFactory;
|
package/dist/fluidContainer.d.ts
CHANGED
|
@@ -3,14 +3,17 @@ import { AttachState, IContainer, ICriticalContainerError, ConnectionState } fro
|
|
|
3
3
|
import type { ContainerSchema, IRootDataObject, LoadableObjectClass } from "./types";
|
|
4
4
|
/**
|
|
5
5
|
* Extract the type of 'initialObjects' from the given {@link ContainerSchema} type.
|
|
6
|
-
* @
|
|
6
|
+
* @public
|
|
7
7
|
*/
|
|
8
8
|
export type InitialObjects<T extends ContainerSchema> = {
|
|
9
9
|
[K in keyof T["initialObjects"]]: T["initialObjects"][K] extends LoadableObjectClass<infer TChannel> ? TChannel : never;
|
|
10
10
|
};
|
|
11
11
|
/**
|
|
12
12
|
* Events emitted from {@link IFluidContainer}.
|
|
13
|
-
*
|
|
13
|
+
*
|
|
14
|
+
* @remarks Note: external implementations of this interface are not supported.
|
|
15
|
+
* @sealed
|
|
16
|
+
* @public
|
|
14
17
|
*/
|
|
15
18
|
export interface IFluidContainerEvents extends IEvent {
|
|
16
19
|
/**
|
|
@@ -70,7 +73,8 @@ export interface IFluidContainerEvents extends IEvent {
|
|
|
70
73
|
* @typeparam TContainerSchema - Used to determine the type of 'initialObjects'.
|
|
71
74
|
*
|
|
72
75
|
* @remarks Note: external implementations of this interface are not supported.
|
|
73
|
-
* @
|
|
76
|
+
* @sealed
|
|
77
|
+
* @public
|
|
74
78
|
*/
|
|
75
79
|
export interface IFluidContainer<TContainerSchema extends ContainerSchema = ContainerSchema> extends IEventProvider<IFluidContainerEvents> {
|
|
76
80
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fluidContainer.d.ts","sourceRoot":"","sources":["../src/fluidContainer.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACzF,OAAO,EACN,WAAW,EACX,UAAU,EACV,uBAAuB,EACvB,eAAe,EACf,MAAM,uCAAuC,CAAC;AAC/C,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAErF;;;GAGG;AACH,MAAM,MAAM,cAAc,CAA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gBAAgB,CAAC,CAAC;QACvD,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;QACnD,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,cAAc,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC;QAC7D,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;QAC/C,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;IAChD,CAAC;CAaD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { TypedEventEmitter } from \"@fluid-internal/client-utils\";\nimport { IEvent, IEventProvider, IFluidLoadable } from \"@fluidframework/core-interfaces\";\nimport {\n\tAttachState,\n\tIContainer,\n\tICriticalContainerError,\n\tConnectionState,\n} from \"@fluidframework/container-definitions\";\nimport type { ContainerSchema, IRootDataObject, LoadableObjectClass } from \"./types\";\n\n/**\n * Extract the type of 'initialObjects' from the given {@link ContainerSchema} type.\n * @public\n */\nexport type InitialObjects<T extends ContainerSchema> = {\n\t// Construct a LoadableObjectRecord type by enumerating the keys of\n\t// 'ContainerSchema.initialObjects' and infering the value type of each key.\n\t//\n\t// The '? TChannel : never' is required because infer can only be used in\n\t// a conditional 'extends' expression.\n\t[K in keyof T[\"initialObjects\"]]: T[\"initialObjects\"][K] extends LoadableObjectClass<\n\t\tinfer TChannel\n\t>\n\t\t? TChannel\n\t\t: never;\n};\n\n/**\n * Events emitted from {@link IFluidContainer}.\n *\n * @remarks Note: external implementations of this interface are not supported.\n * @sealed\n * @public\n */\nexport interface IFluidContainerEvents extends IEvent {\n\t/**\n\t * Emitted when the {@link IFluidContainer} completes connecting to the Fluid service.\n\t *\n\t * @remarks Reflects connection state changes against the (delta) service acknowledging ops/edits.\n\t *\n\t * @see\n\t *\n\t * - {@link IFluidContainer.connectionState}\n\t *\n\t * - {@link IFluidContainer.connect}\n\t */\n\t(event: \"connected\", listener: () => void): void;\n\n\t/**\n\t * Emitted when the {@link IFluidContainer} becomes disconnected from the Fluid service.\n\t *\n\t * @remarks Reflects connection state changes against the (delta) service acknowledging ops/edits.\n\t *\n\t * @see\n\t *\n\t * - {@link IFluidContainer.connectionState}\n\t *\n\t * - {@link IFluidContainer.disconnect}\n\t */\n\t(event: \"disconnected\", listener: () => void): void;\n\n\t/**\n\t * Emitted when all local changes/edits have been acknowledged by the service.\n\t *\n\t * @remarks \"dirty\" event will be emitted when the next local change has been made.\n\t *\n\t * @see {@link IFluidContainer.isDirty}\n\t */\n\t(event: \"saved\", listener: () => void): void;\n\n\t/**\n\t * Emitted when the first local change has been made, following a \"saved\" event.\n\t *\n\t * @remarks \"saved\" event will be emitted once all local changes have been acknowledged by the service.\n\t *\n\t * @see {@link IFluidContainer.isDirty}\n\t */\n\t(event: \"dirty\", listener: () => void): void;\n\n\t/**\n\t * Emitted when the {@link IFluidContainer} is closed, which permanently disables it.\n\t *\n\t * @remarks Listener parameters:\n\t *\n\t * - `error`: If the container was closed due to error (as opposed to an explicit call to\n\t * {@link IFluidContainer.dispose}), this will contain details about the error that caused it.\n\t */\n\t(event: \"disposed\", listener: (error?: ICriticalContainerError) => void);\n}\n\n/**\n * Provides an entrypoint into the client side of collaborative Fluid data.\n * Provides access to the data as well as status on the collaboration session.\n *\n * @typeparam TContainerSchema - Used to determine the type of 'initialObjects'.\n *\n * @remarks Note: external implementations of this interface are not supported.\n * @sealed\n * @public\n */\nexport interface IFluidContainer<TContainerSchema extends ContainerSchema = ContainerSchema>\n\textends IEventProvider<IFluidContainerEvents> {\n\t/**\n\t * Provides the current connected state of the container\n\t */\n\treadonly connectionState: ConnectionState;\n\n\t/**\n\t * A container is considered **dirty** if it has local changes that have not yet been acknowledged by the service.\n\t *\n\t * @remarks\n\t *\n\t * You should always check the `isDirty` flag before closing the container or navigating away from the page.\n\t * Closing the container while `isDirty === true` may result in the loss of operations that have not yet been\n\t * acknowledged by the service.\n\t *\n\t * A container is considered dirty in the following cases:\n\t *\n\t * 1. The container has been created in the detached state, and either it has not been attached yet or it is\n\t * in the process of being attached (container is in `attaching` state). If container is closed prior to being\n\t * attached, host may never know if the file was created or not.\n\t *\n\t * 2. The container was attached, but it has local changes that have not yet been saved to service endpoint.\n\t * This occurs as part of normal op flow where pending operation (changes) are awaiting acknowledgement from the\n\t * service. In some cases this can be due to lack of network connection. If the network connection is down,\n\t * it needs to be restored for the pending changes to be acknowledged.\n\t */\n\treadonly isDirty: boolean;\n\n\t/**\n\t * Whether or not the container is disposed, which permanently disables it.\n\t */\n\treadonly disposed: boolean;\n\n\t/**\n\t * The collection of data objects and Distributed Data Stores (DDSes) that were specified by the schema.\n\t *\n\t * @remarks These data objects and DDSes exist for the lifetime of the container.\n\t */\n\treadonly initialObjects: InitialObjects<TContainerSchema>;\n\n\t/**\n\t * The current attachment state of the container.\n\t *\n\t * @remarks\n\t *\n\t * Once a container has been attached, it remains attached.\n\t * When loading an existing container, it will already be attached.\n\t */\n\treadonly attachState: AttachState;\n\n\t/**\n\t * A newly created container starts detached from the collaborative service.\n\t * Calling `attach()` uploads the new container to the service and connects to the collaborative service.\n\t *\n\t * @remarks\n\t *\n\t * This should only be called when the container is in the\n\t * {@link @fluidframework/container-definitions#AttachState.Detatched} state.\n\t *\n\t * This can be determined by observing {@link IFluidContainer.attachState}.\n\t *\n\t * @returns A promise which resolves when the attach is complete, with the string identifier of the container.\n\t */\n\tattach(): Promise<string>;\n\n\t/**\n\t * Attempts to connect the container to the delta stream and process operations.\n\t *\n\t * @throws Will throw an error if connection is unsuccessful.\n\t *\n\t * @remarks\n\t *\n\t * This should only be called when the container is in the\n\t * {@link @fluidframework/container-definitions#ConnectionState.Disconnected} state.\n\t *\n\t * This can be determined by observing {@link IFluidContainer.connectionState}.\n\t */\n\tconnect(): void;\n\n\t/**\n\t * Disconnects the container from the delta stream and stops processing operations.\n\t *\n\t * @remarks\n\t *\n\t * This should only be called when the container is in the\n\t * {@link @fluidframework/container-definitions#ConnectionState.Connected} state.\n\t *\n\t * This can be determined by observing {@link IFluidContainer.connectionState}.\n\t */\n\tdisconnect(): void;\n\n\t/**\n\t * Create a new data object or Distributed Data Store (DDS) of the specified type.\n\t *\n\t * @remarks\n\t *\n\t * In order to share the data object or DDS with other\n\t * collaborators and retrieve it later, store its handle in a collection like a SharedDirectory from your\n\t * initialObjects.\n\t *\n\t * @param objectClass - The class of the `DataObject` or `SharedObject` to create.\n\t *\n\t * @typeParam T - The class of the `DataObject` or `SharedObject`.\n\t */\n\tcreate<T extends IFluidLoadable>(objectClass: LoadableObjectClass<T>): Promise<T>;\n\n\t/**\n\t * Dispose of the container instance, permanently disabling it.\n\t */\n\tdispose(): void;\n}\n\n/**\n * @internal\n */\nexport function createFluidContainer<\n\tTContainerSchema extends ContainerSchema = ContainerSchema,\n>(props: {\n\tcontainer: IContainer;\n\trootDataObject: IRootDataObject;\n}): IFluidContainer<TContainerSchema> {\n\treturn new FluidContainer<TContainerSchema>(props.container, props.rootDataObject);\n}\n\n/**\n * Base {@link IFluidContainer} implementation.\n *\n * @typeparam TContainerSchema - Used to determine the type of 'initialObjects'.\n * @remarks\n *\n * Note: this implementation is not complete. Consumers who rely on {@link IFluidContainer.attach}\n * will need to utilize or provide a service-specific implementation of this type that implements that method.\n * @deprecated use {@link createFluidContainer} and {@link IFluidContainer} instead\n * @internal\n */\nclass FluidContainer<TContainerSchema extends ContainerSchema = ContainerSchema>\n\textends TypedEventEmitter<IFluidContainerEvents>\n\timplements IFluidContainer<TContainerSchema>\n{\n\tprivate readonly connectedHandler = () => this.emit(\"connected\");\n\tprivate readonly disconnectedHandler = () => this.emit(\"disconnected\");\n\tprivate readonly disposedHandler = (error?: ICriticalContainerError) =>\n\t\tthis.emit(\"disposed\", error);\n\tprivate readonly savedHandler = () => this.emit(\"saved\");\n\tprivate readonly dirtyHandler = () => this.emit(\"dirty\");\n\n\tpublic constructor(\n\t\tprivate readonly container: IContainer,\n\t\tprivate readonly rootDataObject: IRootDataObject,\n\t) {\n\t\tsuper();\n\t\tcontainer.on(\"connected\", this.connectedHandler);\n\t\tcontainer.on(\"closed\", this.disposedHandler);\n\t\tcontainer.on(\"disconnected\", this.disconnectedHandler);\n\t\tcontainer.on(\"saved\", this.savedHandler);\n\t\tcontainer.on(\"dirty\", this.dirtyHandler);\n\t}\n\n\t/**\n\t * {@inheritDoc IFluidContainer.isDirty}\n\t */\n\tpublic get isDirty(): boolean {\n\t\treturn this.container.isDirty;\n\t}\n\n\t/**\n\t * {@inheritDoc IFluidContainer.attachState}\n\t */\n\tpublic get attachState(): AttachState {\n\t\treturn this.container.attachState;\n\t}\n\n\t/**\n\t * {@inheritDoc IFluidContainer.disposed}\n\t */\n\tpublic get disposed() {\n\t\treturn this.container.closed;\n\t}\n\n\t/**\n\t * {@inheritDoc IFluidContainer.connectionState}\n\t */\n\tpublic get connectionState(): ConnectionState {\n\t\treturn this.container.connectionState;\n\t}\n\n\t/**\n\t * {@inheritDoc IFluidContainer.initialObjects}\n\t */\n\tpublic get initialObjects(): InitialObjects<TContainerSchema> {\n\t\treturn this.rootDataObject.initialObjects as InitialObjects<TContainerSchema>;\n\t}\n\n\t/**\n\t * Incomplete base implementation of {@link IFluidContainer.attach}.\n\t *\n\t * @remarks\n\t *\n\t * Note: this implementation will unconditionally throw.\n\t * Consumers who rely on this will need to utilize or provide a service specific implementation of this base type\n\t * that provides an implementation of this method.\n\t *\n\t * The reason is because externally we are presenting a separation between the service and the `FluidContainer`,\n\t * but internally this separation is not there.\n\t */\n\tpublic async attach(): Promise<string> {\n\t\tif (this.container.attachState !== AttachState.Detached) {\n\t\t\tthrow new Error(\"Cannot attach container. Container is not in detached state.\");\n\t\t}\n\t\tthrow new Error(\"Cannot attach container. Attach method not provided.\");\n\t}\n\n\t/**\n\t * {@inheritDoc IFluidContainer.connect}\n\t */\n\tpublic async connect(): Promise<void> {\n\t\tthis.container.connect?.();\n\t}\n\n\t/**\n\t * {@inheritDoc IFluidContainer.connect}\n\t */\n\tpublic async disconnect(): Promise<void> {\n\t\tthis.container.disconnect?.();\n\t}\n\n\t/**\n\t * {@inheritDoc IFluidContainer.create}\n\t */\n\tpublic async create<T extends IFluidLoadable>(objectClass: LoadableObjectClass<T>): Promise<T> {\n\t\treturn this.rootDataObject.create(objectClass);\n\t}\n\n\t/**\n\t * {@inheritDoc IFluidContainer.dispose}\n\t */\n\tpublic dispose() {\n\t\tthis.container.close();\n\t\tthis.container.off(\"connected\", this.connectedHandler);\n\t\tthis.container.off(\"closed\", this.disposedHandler);\n\t\tthis.container.off(\"disconnected\", this.disconnectedHandler);\n\t\tthis.container.off(\"saved\", this.savedHandler);\n\t\tthis.container.off(\"dirty\", this.dirtyHandler);\n\t}\n\n\t/**\n\t * FOR INTERNAL USE ONLY. NOT FOR EXTERNAL USE.\n\t * We make no stability guarantees here whatsoever.\n\t *\n\t * Gets the underlying {@link @fluidframework/container-definitions#IContainer}.\n\t *\n\t * @remarks Used to power debug tooling.\n\t */\n\tpublic readonly INTERNAL_CONTAINER_DO_NOT_USE?: () => IContainer = () => {\n\t\treturn this.container;\n\t};\n}\n"]}
|
|
@@ -10,10 +10,10 @@ exports.createServiceAudience = exports.createDOProviderContainerRuntimeFactory
|
|
|
10
10
|
*
|
|
11
11
|
* @packageDocumentation
|
|
12
12
|
*/
|
|
13
|
-
var fluidContainer_1 = require("./fluidContainer
|
|
13
|
+
var fluidContainer_1 = require("./fluidContainer");
|
|
14
14
|
Object.defineProperty(exports, "createFluidContainer", { enumerable: true, get: function () { return fluidContainer_1.createFluidContainer; } });
|
|
15
|
-
var rootDataObject_1 = require("./rootDataObject
|
|
15
|
+
var rootDataObject_1 = require("./rootDataObject");
|
|
16
16
|
Object.defineProperty(exports, "createDOProviderContainerRuntimeFactory", { enumerable: true, get: function () { return rootDataObject_1.createDOProviderContainerRuntimeFactory; } });
|
|
17
|
-
var serviceAudience_1 = require("./serviceAudience
|
|
17
|
+
var serviceAudience_1 = require("./serviceAudience");
|
|
18
18
|
Object.defineProperty(exports, "createServiceAudience", { enumerable: true, get: function () { return serviceAudience_1.createServiceAudience; } });
|
|
19
|
-
//# sourceMappingURL=index.
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;;;GAIG;AAEH,mDAK0B;AAJzB,sHAAA,oBAAoB,OAAA;AAKrB,mDAA2E;AAAlE,yIAAA,uCAAuC,OAAA;AAChD,qDAA0D;AAAjD,wHAAA,qBAAqB,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Provides a simple and powerful way to consume collaborative Fluid data.\n *\n * @packageDocumentation\n */\n\nexport {\n\tcreateFluidContainer,\n\tIFluidContainer,\n\tIFluidContainerEvents,\n\tInitialObjects,\n} from \"./fluidContainer\";\nexport { createDOProviderContainerRuntimeFactory } from \"./rootDataObject\";\nexport { createServiceAudience } from \"./serviceAudience\";\nexport {\n\tContainerSchema,\n\tDataObjectClass,\n\tIConnection,\n\tIMember,\n\tIRootDataObject,\n\tIServiceAudience,\n\tIServiceAudienceEvents,\n\tLoadableObjectClass,\n\tLoadableObjectClassRecord,\n\tLoadableObjectCtor,\n\tLoadableObjectRecord,\n\tMemberChangedListener,\n\tMyself,\n\tSharedObjectClass,\n\tIProvideRootDataObject,\n} from \"./types\";\n"]}
|