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