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