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