@fluidframework/fluid-static 1.2.6 → 2.0.0-dev.1.3.0.96595
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/.mocharc.js +12 -0
- package/dist/fluidContainer.d.ts +63 -66
- package/dist/fluidContainer.d.ts.map +1 -1
- package/dist/fluidContainer.js +7 -2
- package/dist/fluidContainer.js.map +1 -1
- package/dist/rootDataObject.d.ts +18 -10
- package/dist/rootDataObject.d.ts.map +1 -1
- package/dist/rootDataObject.js +15 -8
- package/dist/rootDataObject.js.map +1 -1
- package/dist/serviceAudience.d.ts +25 -13
- package/dist/serviceAudience.d.ts.map +1 -1
- package/dist/serviceAudience.js +23 -12
- package/dist/serviceAudience.js.map +1 -1
- package/dist/types.d.ts +75 -69
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/lib/fluidContainer.d.ts +63 -66
- package/lib/fluidContainer.d.ts.map +1 -1
- package/lib/fluidContainer.js +7 -2
- package/lib/fluidContainer.js.map +1 -1
- package/lib/rootDataObject.d.ts +18 -10
- package/lib/rootDataObject.d.ts.map +1 -1
- package/lib/rootDataObject.js +15 -8
- package/lib/rootDataObject.js.map +1 -1
- package/lib/serviceAudience.d.ts +25 -13
- package/lib/serviceAudience.d.ts.map +1 -1
- package/lib/serviceAudience.js +23 -12
- package/lib/serviceAudience.js.map +1 -1
- package/lib/types.d.ts +75 -69
- package/lib/types.d.ts.map +1 -1
- package/lib/types.js.map +1 -1
- package/package.json +43 -22
- package/src/fluidContainer.ts +70 -66
- package/src/rootDataObject.ts +18 -10
- package/src/serviceAudience.ts +25 -13
- package/src/types.ts +80 -69
package/lib/types.d.ts
CHANGED
|
@@ -7,56 +7,65 @@ import { IFluidLoadable } from "@fluidframework/core-interfaces";
|
|
|
7
7
|
import { IChannelFactory } from "@fluidframework/datastore-definitions";
|
|
8
8
|
import { IFluidDataStoreFactory } from "@fluidframework/runtime-definitions";
|
|
9
9
|
/**
|
|
10
|
-
* A mapping of string identifiers to instantiated
|
|
10
|
+
* A mapping of string identifiers to instantiated `DataObject`s or `SharedObject`s.
|
|
11
11
|
*/
|
|
12
12
|
export declare type LoadableObjectRecord = Record<string, IFluidLoadable>;
|
|
13
13
|
/**
|
|
14
|
-
* A mapping of string identifiers to classes that will later be used to instantiate a corresponding DataObject
|
|
15
|
-
* or SharedObject in a LoadableObjectRecord.
|
|
14
|
+
* A mapping of string identifiers to classes that will later be used to instantiate a corresponding `DataObject`
|
|
15
|
+
* or `SharedObject` in a {@link LoadableObjectRecord}.
|
|
16
16
|
*/
|
|
17
17
|
export declare type LoadableObjectClassRecord = Record<string, LoadableObjectClass<any>>;
|
|
18
18
|
/**
|
|
19
|
-
* A
|
|
20
|
-
*
|
|
19
|
+
* A class object of `DataObject` or `SharedObject`.
|
|
20
|
+
*
|
|
21
|
+
* @typeParam T - The class of the `DataObject` or `SharedObject`.
|
|
21
22
|
*/
|
|
22
23
|
export declare type LoadableObjectClass<T extends IFluidLoadable> = DataObjectClass<T> | SharedObjectClass<T>;
|
|
23
24
|
/**
|
|
24
|
-
* A
|
|
25
|
-
* constructor that will return the type of the DataObject
|
|
26
|
-
*
|
|
25
|
+
* A class that has a factory that can create a `DataObject` and a
|
|
26
|
+
* constructor that will return the type of the `DataObject`.
|
|
27
|
+
*
|
|
28
|
+
* @typeParam T - The class of the `DataObject`.
|
|
27
29
|
*/
|
|
28
30
|
export declare type DataObjectClass<T extends IFluidLoadable> = {
|
|
29
31
|
readonly factory: IFluidDataStoreFactory;
|
|
30
32
|
} & LoadableObjectCtor<T>;
|
|
31
33
|
/**
|
|
32
|
-
* A
|
|
33
|
-
* constructor that will return the type of the DataObject
|
|
34
|
-
*
|
|
34
|
+
* A class that has a factory that can create a DDSes (`SharedObject`s) and a
|
|
35
|
+
* constructor that will return the type of the `DataObject`.
|
|
36
|
+
*
|
|
37
|
+
* @typeParam T - The class of the `SharedObject`.
|
|
35
38
|
*/
|
|
36
39
|
export declare type SharedObjectClass<T extends IFluidLoadable> = {
|
|
37
40
|
readonly getFactory: () => IChannelFactory;
|
|
38
41
|
} & LoadableObjectCtor<T>;
|
|
39
42
|
/**
|
|
40
|
-
* An object with a constructor that will return an
|
|
41
|
-
*
|
|
43
|
+
* An object with a constructor that will return an {@link @fluidframework/core-interfaces#IFluidLoadable}.
|
|
44
|
+
*
|
|
45
|
+
* @typeParam T - The class of the loadable object.
|
|
42
46
|
*/
|
|
43
47
|
export declare type LoadableObjectCtor<T extends IFluidLoadable> = new (...args: any[]) => T;
|
|
44
48
|
/**
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
49
|
+
* Declares the Fluid objects that will be available in the {@link IFluidContainer | Container}.
|
|
50
|
+
*
|
|
51
|
+
* @remarks
|
|
52
|
+
*
|
|
53
|
+
* It includes both the instances of objects that are initially available upon `Container` creation, as well
|
|
54
|
+
* as the types of objects that may be dynamically created throughout the lifetime of the `Container`.
|
|
48
55
|
*/
|
|
49
56
|
export interface ContainerSchema {
|
|
50
57
|
/**
|
|
51
|
-
* Defines loadable objects that will be created when the
|
|
52
|
-
*
|
|
58
|
+
* Defines loadable objects that will be created when the {@link IFluidContainer | Container} is first created.
|
|
59
|
+
*
|
|
60
|
+
* @remarks It uses the key as the id and the value as the loadable object to create.
|
|
53
61
|
*
|
|
54
62
|
* @example
|
|
55
|
-
*
|
|
63
|
+
*
|
|
64
|
+
* In the example below two objects will be created when the `Container` is first
|
|
56
65
|
* created. One with id "map1" that will return a `SharedMap` and the other with
|
|
57
66
|
* id "pair1" that will return a `KeyValueDataObject`.
|
|
58
67
|
*
|
|
59
|
-
* ```
|
|
68
|
+
* ```typescript
|
|
60
69
|
* {
|
|
61
70
|
* map1: SharedMap,
|
|
62
71
|
* pair1: KeyValueDataObject,
|
|
@@ -65,7 +74,9 @@ export interface ContainerSchema {
|
|
|
65
74
|
*/
|
|
66
75
|
initialObjects: LoadableObjectClassRecord;
|
|
67
76
|
/**
|
|
68
|
-
*
|
|
77
|
+
* Loadable objects that can be created after the initial {@link IFluidContainer | Container} creation.
|
|
78
|
+
*
|
|
79
|
+
* @remarks
|
|
69
80
|
*
|
|
70
81
|
* Types defined in `initialObjects` will always be available and are not required to be provided here.
|
|
71
82
|
*
|
|
@@ -75,60 +86,53 @@ export interface ContainerSchema {
|
|
|
75
86
|
dynamicObjectTypes?: LoadableObjectClass<any>[];
|
|
76
87
|
}
|
|
77
88
|
/**
|
|
78
|
-
*
|
|
79
|
-
* Only changes that would be reflected in the returned map of {@link IServiceAudience}'s
|
|
80
|
-
* {@link IServiceAudience.getMembers} method will emit events.
|
|
81
|
-
*
|
|
82
|
-
* @remarks
|
|
83
|
-
*
|
|
84
|
-
* The following is the list of events emitted.
|
|
85
|
-
*
|
|
86
|
-
* ### "membersChanged"
|
|
87
|
-
*
|
|
88
|
-
* The "membersChanged" event is emitted when a member is either added or removed.
|
|
89
|
-
*
|
|
90
|
-
* #### Listener signature
|
|
91
|
-
*
|
|
92
|
-
* ```typescript
|
|
93
|
-
* () => void;
|
|
94
|
-
* ```
|
|
95
|
-
*
|
|
96
|
-
* ### "memberAdded"
|
|
97
|
-
*
|
|
98
|
-
* The "memberAdded" event is emitted when a member joins the audience.
|
|
99
|
-
*
|
|
100
|
-
* #### Listener signature
|
|
89
|
+
* Signature for {@link IMember} change events.
|
|
101
90
|
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
* ```
|
|
105
|
-
* - `clientId` - A unique identifier for the client
|
|
91
|
+
* @param clientId - A unique identifier for the client.
|
|
92
|
+
* @param member - The service-specific member object for the client.
|
|
106
93
|
*
|
|
107
|
-
*
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
*
|
|
94
|
+
* @see See {@link IServiceAudienceEvents} for usage details.
|
|
95
|
+
*/
|
|
96
|
+
export declare type MemberChangedListener<M extends IMember> = (clientId: string, member: M) => void;
|
|
97
|
+
/**
|
|
98
|
+
* Events that trigger when the roster of members in the Fluid session change.
|
|
112
99
|
*
|
|
113
|
-
*
|
|
100
|
+
* @remarks
|
|
114
101
|
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
* ```
|
|
118
|
-
* - `clientId` - A unique identifier for the client
|
|
102
|
+
* Only changes that would be reflected in the returned map of {@link IServiceAudience}'s
|
|
103
|
+
* {@link IServiceAudience.getMembers} method will emit events.
|
|
119
104
|
*
|
|
120
|
-
*
|
|
121
|
-
* @typeParam M - A service-specific member type.
|
|
105
|
+
* @typeParam M - A service-specific {@link IMember} implementation.
|
|
122
106
|
*/
|
|
123
107
|
export interface IServiceAudienceEvents<M extends IMember> extends IEvent {
|
|
108
|
+
/**
|
|
109
|
+
* Emitted when a {@link IMember | member}(s) are either added or removed.
|
|
110
|
+
*
|
|
111
|
+
* @eventProperty
|
|
112
|
+
*/
|
|
124
113
|
(event: "membersChanged", listener: () => void): void;
|
|
125
|
-
|
|
114
|
+
/**
|
|
115
|
+
* Emitted when a {@link IMember | member} joins the audience.
|
|
116
|
+
*
|
|
117
|
+
* @eventProperty
|
|
118
|
+
*/
|
|
119
|
+
(event: "memberAdded", listener: MemberChangedListener<M>): void;
|
|
120
|
+
/**
|
|
121
|
+
* Emitted when a {@link IMember | member} leaves the audience.
|
|
122
|
+
*
|
|
123
|
+
* @eventProperty
|
|
124
|
+
*/
|
|
125
|
+
(event: "memberRemoved", listener: MemberChangedListener<M>): void;
|
|
126
126
|
}
|
|
127
127
|
/**
|
|
128
|
-
* Base interface to be implemented to fetch each service's audience.
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
*
|
|
128
|
+
* Base interface to be implemented to fetch each service's audience.
|
|
129
|
+
*
|
|
130
|
+
* @remarks
|
|
131
|
+
*
|
|
132
|
+
* The type parameter `M` allows consumers to further extend the client object with service-specific
|
|
133
|
+
* details about the connecting client, such as device information, environment, or a username.
|
|
134
|
+
*
|
|
135
|
+
* @typeParam M - A service-specific {@link IMember} type.
|
|
132
136
|
*/
|
|
133
137
|
export interface IServiceAudience<M extends IMember> extends IEventProvider<IServiceAudienceEvents<M>> {
|
|
134
138
|
/**
|
|
@@ -143,8 +147,9 @@ export interface IServiceAudience<M extends IMember> extends IEventProvider<ISer
|
|
|
143
147
|
getMyself(): M | undefined;
|
|
144
148
|
}
|
|
145
149
|
/**
|
|
146
|
-
* Base interface for information for each connection made to the Fluid session.
|
|
147
|
-
*
|
|
150
|
+
* Base interface for information for each connection made to the Fluid session.
|
|
151
|
+
*
|
|
152
|
+
* @remarks This interface can be extended to provide additional information specific to each service.
|
|
148
153
|
*/
|
|
149
154
|
export interface IConnection {
|
|
150
155
|
/**
|
|
@@ -157,8 +162,9 @@ export interface IConnection {
|
|
|
157
162
|
mode: "write" | "read";
|
|
158
163
|
}
|
|
159
164
|
/**
|
|
160
|
-
* Base interface to be implemented to fetch each service's member.
|
|
161
|
-
*
|
|
165
|
+
* Base interface to be implemented to fetch each service's member.
|
|
166
|
+
*
|
|
167
|
+
* @remarks This interface can be extended by each service to provide additional service-specific user metadata.
|
|
162
168
|
*/
|
|
163
169
|
export interface IMember {
|
|
164
170
|
/**
|
package/lib/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACxE,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAE7E;;GAEG;AACH,oBAAY,oBAAoB,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;AAElE;;;GAGG;AACH,oBAAY,yBAAyB,GAAG,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,GAAG,CAAC,CAAC,CAAC;AAEjF
|
|
1
|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AGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IEvent, IEventProvider } from \"@fluidframework/common-definitions\";\nimport { IFluidLoadable } from \"@fluidframework/core-interfaces\";\nimport { IChannelFactory } from \"@fluidframework/datastore-definitions\";\nimport { IFluidDataStoreFactory } from \"@fluidframework/runtime-definitions\";\n\n/**\n * A mapping of string identifiers to instantiated
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IEvent, IEventProvider } from \"@fluidframework/common-definitions\";\nimport { IFluidLoadable } from \"@fluidframework/core-interfaces\";\nimport { IChannelFactory } from \"@fluidframework/datastore-definitions\";\nimport { IFluidDataStoreFactory } from \"@fluidframework/runtime-definitions\";\n\n/**\n * A mapping of string identifiers to instantiated `DataObject`s or `SharedObject`s.\n */\nexport type LoadableObjectRecord = Record<string, IFluidLoadable>;\n\n/**\n * A mapping of string identifiers to classes that will later be used to instantiate a corresponding `DataObject`\n * or `SharedObject` in a {@link LoadableObjectRecord}.\n */\nexport type LoadableObjectClassRecord = Record<string, LoadableObjectClass<any>>;\n\n/**\n * A class object of `DataObject` or `SharedObject`.\n *\n * @typeParam T - The class of the `DataObject` or `SharedObject`.\n */\nexport type LoadableObjectClass<T extends IFluidLoadable> = DataObjectClass<T> | SharedObjectClass<T>;\n\n/**\n * A class that has a factory that can create a `DataObject` and a\n * constructor that will return the type of the `DataObject`.\n *\n * @typeParam T - The class of the `DataObject`.\n */\nexport type DataObjectClass<T extends IFluidLoadable>\n = { readonly factory: IFluidDataStoreFactory; } & LoadableObjectCtor<T>;\n\n/**\n * A class that has a factory that can create a DDSes (`SharedObject`s) and a\n * constructor that will return the type of the `DataObject`.\n *\n * @typeParam T - The class of the `SharedObject`.\n */\nexport type SharedObjectClass<T extends IFluidLoadable>\n = { readonly getFactory: () => IChannelFactory; } & LoadableObjectCtor<T>;\n\n/**\n * An object with a constructor that will return an {@link @fluidframework/core-interfaces#IFluidLoadable}.\n *\n * @typeParam T - The class of the loadable object.\n */\nexport type LoadableObjectCtor<T extends IFluidLoadable> = new(...args: any[]) => T;\n\n/**\n * Declares the Fluid objects that will be available in the {@link IFluidContainer | Container}.\n *\n * @remarks\n *\n * It includes both the instances of objects that are initially available upon `Container` creation, as well\n * as the types of objects that may be dynamically created throughout the lifetime of the `Container`.\n */\nexport interface ContainerSchema {\n /**\n * Defines loadable objects that will be created when the {@link IFluidContainer | Container} is first created.\n *\n * @remarks It uses the key as the id and the value as the loadable object to create.\n *\n * @example\n *\n * In the example below two objects will be created when the `Container` is first\n * created. One with id \"map1\" that will return a `SharedMap` and the other with\n * id \"pair1\" that will return a `KeyValueDataObject`.\n *\n * ```typescript\n * {\n * map1: SharedMap,\n * pair1: KeyValueDataObject,\n * }\n * ```\n */\n initialObjects: LoadableObjectClassRecord;\n\n /**\n * Loadable objects that can be created after the initial {@link IFluidContainer | Container} creation.\n *\n * @remarks\n *\n * Types defined in `initialObjects` will always be available and are not required to be provided here.\n *\n * For best practice it's recommended to define all the dynamic types you create even if they are\n * included via initialObjects.\n */\n dynamicObjectTypes?: LoadableObjectClass<any>[];\n}\n\n/**\n * Signature for {@link IMember} change events.\n *\n * @param clientId - A unique identifier for the client.\n * @param member - The service-specific member object for the client.\n *\n * @see See {@link IServiceAudienceEvents} for usage details.\n */\nexport type MemberChangedListener<M extends IMember> = (clientId: string, member: M) => void;\n\n/**\n * Events that trigger when the roster of members in the Fluid session change.\n *\n * @remarks\n *\n * Only changes that would be reflected in the returned map of {@link IServiceAudience}'s\n * {@link IServiceAudience.getMembers} method will emit events.\n *\n * @typeParam M - A service-specific {@link IMember} implementation.\n */\nexport interface IServiceAudienceEvents<M extends IMember> extends IEvent {\n /* eslint-disable @typescript-eslint/unified-signatures */\n /**\n * Emitted when a {@link IMember | member}(s) are either added or removed.\n *\n * @eventProperty\n */\n (event: \"membersChanged\", listener: () => void): void;\n\n /**\n * Emitted when a {@link IMember | member} joins the audience.\n *\n * @eventProperty\n */\n (event: \"memberAdded\", listener: MemberChangedListener<M>): void;\n\n /**\n * Emitted when a {@link IMember | member} leaves the audience.\n *\n * @eventProperty\n */\n (event: \"memberRemoved\", listener: MemberChangedListener<M>): void;\n /* eslint-enable @typescript-eslint/unified-signatures */\n}\n\n/**\n * Base interface to be implemented to fetch each service's audience.\n *\n * @remarks\n *\n * The type parameter `M` allows consumers to further extend the client object with service-specific\n * details about the connecting client, such as device information, environment, or a username.\n *\n * @typeParam M - A service-specific {@link IMember} type.\n */\nexport interface IServiceAudience<M extends IMember> extends IEventProvider<IServiceAudienceEvents<M>> {\n /**\n * Returns an map of all users currently in the Fluid session where key is the userId and the value is the\n * member object. The implementation may choose to exclude certain connections from the returned map.\n * E.g. ServiceAudience excludes non-interactive connections to represent only the roster of live users.\n */\n getMembers(): Map<string, M>;\n\n /**\n * Returns the current active user on this client once they are connected. Otherwise, returns undefined.\n */\n getMyself(): M | undefined;\n}\n\n/**\n * Base interface for information for each connection made to the Fluid session.\n *\n * @remarks This interface can be extended to provide additional information specific to each service.\n */\nexport interface IConnection {\n /**\n * A unique ID for the connection. A single user may have multiple connections, each with a different ID.\n */\n id: string;\n\n /**\n * Whether the connection is in read or read/write mode.\n */\n mode: \"write\" | \"read\";\n}\n\n/**\n * Base interface to be implemented to fetch each service's member.\n *\n * @remarks This interface can be extended by each service to provide additional service-specific user metadata.\n */\nexport interface IMember {\n /**\n * An ID for the user, unique among each individual user connecting to the session.\n */\n userId: string;\n\n /**\n * The set of connections the user has made, e.g. from multiple tabs or devices.\n */\n connections: IConnection[];\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/fluid-static",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "2.0.0-dev.1.3.0.96595",
|
|
4
4
|
"description": "A tool to enable consumption of Fluid Data Objects without requiring custom container code.",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -38,44 +38,65 @@
|
|
|
38
38
|
"tsfmt:fix": "tsfmt --replace",
|
|
39
39
|
"typetests:gen": "fluid-type-validator -g -d ."
|
|
40
40
|
},
|
|
41
|
+
"nyc": {
|
|
42
|
+
"all": true,
|
|
43
|
+
"cache-dir": "nyc/.cache",
|
|
44
|
+
"exclude": [
|
|
45
|
+
"src/test/**/*.ts",
|
|
46
|
+
"dist/test/**/*.js"
|
|
47
|
+
],
|
|
48
|
+
"exclude-after-remap": false,
|
|
49
|
+
"include": [
|
|
50
|
+
"src/**/*.ts",
|
|
51
|
+
"dist/**/*.js"
|
|
52
|
+
],
|
|
53
|
+
"report-dir": "nyc/report",
|
|
54
|
+
"reporter": [
|
|
55
|
+
"cobertura",
|
|
56
|
+
"html",
|
|
57
|
+
"text"
|
|
58
|
+
],
|
|
59
|
+
"temp-directory": "nyc/.nyc_output"
|
|
60
|
+
},
|
|
41
61
|
"dependencies": {
|
|
42
|
-
"@fluidframework/aqueduct": "
|
|
62
|
+
"@fluidframework/aqueduct": "2.0.0-dev.1.3.0.96595",
|
|
43
63
|
"@fluidframework/common-definitions": "^0.20.1",
|
|
44
|
-
"@fluidframework/common-utils": "^0.
|
|
45
|
-
"@fluidframework/container-definitions": "
|
|
46
|
-
"@fluidframework/container-loader": "
|
|
47
|
-
"@fluidframework/container-runtime-definitions": "
|
|
48
|
-
"@fluidframework/core-interfaces": "
|
|
49
|
-
"@fluidframework/datastore-definitions": "
|
|
50
|
-
"@fluidframework/protocol-definitions": "^0.
|
|
51
|
-
"@fluidframework/request-handler": "
|
|
52
|
-
"@fluidframework/runtime-definitions": "
|
|
53
|
-
"@fluidframework/runtime-utils": "
|
|
64
|
+
"@fluidframework/common-utils": "^1.0.0",
|
|
65
|
+
"@fluidframework/container-definitions": "2.0.0-dev.1.3.0.96595",
|
|
66
|
+
"@fluidframework/container-loader": "2.0.0-dev.1.3.0.96595",
|
|
67
|
+
"@fluidframework/container-runtime-definitions": "2.0.0-dev.1.3.0.96595",
|
|
68
|
+
"@fluidframework/core-interfaces": "2.0.0-dev.1.3.0.96595",
|
|
69
|
+
"@fluidframework/datastore-definitions": "2.0.0-dev.1.3.0.96595",
|
|
70
|
+
"@fluidframework/protocol-definitions": "^1.0.0",
|
|
71
|
+
"@fluidframework/request-handler": "2.0.0-dev.1.3.0.96595",
|
|
72
|
+
"@fluidframework/runtime-definitions": "2.0.0-dev.1.3.0.96595",
|
|
73
|
+
"@fluidframework/runtime-utils": "2.0.0-dev.1.3.0.96595"
|
|
54
74
|
},
|
|
55
75
|
"devDependencies": {
|
|
56
|
-
"@fluid-experimental/get-container": "
|
|
57
|
-
"@fluidframework/build-common": "^0.
|
|
58
|
-
"@fluidframework/build-tools": "^0.
|
|
59
|
-
"@fluidframework/eslint-config-fluid": "^0.
|
|
60
|
-
"@fluidframework/fluid-static-previous": "npm:@fluidframework/fluid-static
|
|
61
|
-
"@fluidframework/map": "
|
|
62
|
-
"@fluidframework/mocha-test-setup": "
|
|
63
|
-
"@fluidframework/sequence": "
|
|
76
|
+
"@fluid-experimental/get-container": "2.0.0-dev.1.3.0.96595",
|
|
77
|
+
"@fluidframework/build-common": "^1.0.0",
|
|
78
|
+
"@fluidframework/build-tools": "^0.4.6000",
|
|
79
|
+
"@fluidframework/eslint-config-fluid": "^1.0.0",
|
|
80
|
+
"@fluidframework/fluid-static-previous": "npm:@fluidframework/fluid-static@^1.0.0",
|
|
81
|
+
"@fluidframework/map": "2.0.0-dev.1.3.0.96595",
|
|
82
|
+
"@fluidframework/mocha-test-setup": "2.0.0-dev.1.3.0.96595",
|
|
83
|
+
"@fluidframework/sequence": "2.0.0-dev.1.3.0.96595",
|
|
64
84
|
"@microsoft/api-extractor": "^7.22.2",
|
|
65
85
|
"@rushstack/eslint-config": "^2.5.1",
|
|
66
86
|
"@types/mocha": "^9.1.1",
|
|
67
87
|
"@types/node": "^14.18.0",
|
|
68
88
|
"concurrently": "^6.2.0",
|
|
69
|
-
"copyfiles": "^2.1
|
|
89
|
+
"copyfiles": "^2.4.1",
|
|
70
90
|
"cross-env": "^7.0.2",
|
|
71
91
|
"eslint": "~8.6.0",
|
|
72
92
|
"mocha": "^10.0.0",
|
|
93
|
+
"nyc": "^15.0.0",
|
|
73
94
|
"rimraf": "^2.6.2",
|
|
74
95
|
"typescript": "~4.5.5",
|
|
75
96
|
"typescript-formatter": "7.1.0"
|
|
76
97
|
},
|
|
77
98
|
"typeValidation": {
|
|
78
|
-
"version": "
|
|
99
|
+
"version": "2.0.0",
|
|
79
100
|
"broken": {}
|
|
80
101
|
}
|
|
81
102
|
}
|
package/src/fluidContainer.ts
CHANGED
|
@@ -11,64 +11,45 @@ import { RootDataObject } from "./rootDataObject";
|
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Events emitted from {@link IFluidContainer}.
|
|
14
|
-
*
|
|
15
|
-
* @remarks
|
|
16
|
-
*
|
|
17
|
-
* The following is the list of events emitted.
|
|
18
|
-
*
|
|
19
|
-
* ### "connected"
|
|
20
|
-
*
|
|
21
|
-
* The "connected" event is emitted when the `IFluidContainer` completes connecting to the Fluid service.
|
|
22
|
-
*
|
|
23
|
-
* #### Listener signature
|
|
24
|
-
*
|
|
25
|
-
* ```typescript
|
|
26
|
-
* () => void;
|
|
27
|
-
* ```
|
|
28
|
-
*
|
|
29
|
-
* ### "dispose"
|
|
30
|
-
*
|
|
31
|
-
* The "dispose" event is emitted when the `IFluidContainer` is disposed, which permanently disables it.
|
|
32
|
-
*
|
|
33
|
-
* #### Listener signature
|
|
34
|
-
*
|
|
35
|
-
* ```typescript
|
|
36
|
-
* () => void;
|
|
37
|
-
* ```
|
|
38
|
-
*
|
|
39
|
-
* ### "disconnected"
|
|
40
|
-
*
|
|
41
|
-
* The "disconnected" event is emitted when the `IFluidContainer` becomes disconnected from the Fluid service.
|
|
42
|
-
*
|
|
43
|
-
* #### Listener signature
|
|
44
|
-
*
|
|
45
|
-
* ```typescript
|
|
46
|
-
* () => void;
|
|
47
|
-
* ```
|
|
48
|
-
*
|
|
49
|
-
* ### "saved"
|
|
50
|
-
*
|
|
51
|
-
* The "saved" event is emitted when the `IFluidContainer` has local changes acknowledged by the service.
|
|
52
|
-
*
|
|
53
|
-
* #### Listener signature
|
|
54
|
-
*
|
|
55
|
-
* ```typescript
|
|
56
|
-
* () => void
|
|
57
|
-
* ```
|
|
58
|
-
*
|
|
59
|
-
* ### "dirty"
|
|
60
|
-
*
|
|
61
|
-
* The "dirty" event is emitted when the `IFluidContainer` has local changes that have not yet
|
|
62
|
-
* been acknowledged by the service.
|
|
63
|
-
*
|
|
64
|
-
* #### Listener signature
|
|
65
|
-
*
|
|
66
|
-
* ```typescript
|
|
67
|
-
* () => void
|
|
68
|
-
* ```
|
|
69
14
|
*/
|
|
70
15
|
export interface IFluidContainerEvents extends IEvent {
|
|
71
|
-
|
|
16
|
+
/* eslint-disable @typescript-eslint/unified-signatures */
|
|
17
|
+
/**
|
|
18
|
+
* Emitted when the {@link IFluidContainer} completes connecting to the Fluid service.
|
|
19
|
+
*
|
|
20
|
+
* @eventProperty
|
|
21
|
+
*/
|
|
22
|
+
(event: "connected", listener: () => void): void;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Emitted when the {@link IFluidContainer} is disposed, which permanently disables it.
|
|
26
|
+
*
|
|
27
|
+
* @eventProperty
|
|
28
|
+
*/
|
|
29
|
+
(event: "dispose", listener: () => void): void;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Emitted when the {@link IFluidContainer} becomes disconnected from the Fluid service.
|
|
33
|
+
*
|
|
34
|
+
* @eventProperty
|
|
35
|
+
*/
|
|
36
|
+
(event: "disconnected", listener: () => void): void;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Emitted when all of the {@link IFluidContainer}'s local changes have been acknowledged by the service.
|
|
40
|
+
*
|
|
41
|
+
* @eventProperty
|
|
42
|
+
*/
|
|
43
|
+
(event: "saved", listener: () => void): void;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Emitted when the {@link IFluidContainer} has local changes that have not yet been acknowledged by the service.
|
|
47
|
+
*
|
|
48
|
+
* @eventProperty
|
|
49
|
+
*/
|
|
50
|
+
(event: "dirty", listener: () => void): void;
|
|
51
|
+
|
|
52
|
+
/* eslint-enable @typescript-eslint/unified-signatures */
|
|
72
53
|
}
|
|
73
54
|
|
|
74
55
|
/**
|
|
@@ -83,6 +64,9 @@ export interface IFluidContainer extends IEventProvider<IFluidContainerEvents> {
|
|
|
83
64
|
|
|
84
65
|
/**
|
|
85
66
|
* A container is considered **dirty** if it has local changes that have not yet been acknowledged by the service.
|
|
67
|
+
*
|
|
68
|
+
* @remarks
|
|
69
|
+
*
|
|
86
70
|
* You should always check the `isDirty` flag before closing the container or navigating away from the page.
|
|
87
71
|
* Closing the container while `isDirty === true` may result in the loss of operations that have not yet been
|
|
88
72
|
* acknowledged by the service.
|
|
@@ -101,18 +85,23 @@ export interface IFluidContainer extends IEventProvider<IFluidContainerEvents> {
|
|
|
101
85
|
readonly isDirty: boolean;
|
|
102
86
|
|
|
103
87
|
/**
|
|
104
|
-
* Whether the container is disposed, which permanently disables it.
|
|
88
|
+
* Whether or not the container is disposed, which permanently disables it.
|
|
105
89
|
*/
|
|
106
90
|
readonly disposed: boolean;
|
|
107
91
|
|
|
108
92
|
/**
|
|
109
93
|
* The collection of data objects and Distributed Data Stores (DDSes) that were specified by the schema.
|
|
110
|
-
*
|
|
94
|
+
*
|
|
95
|
+
* @remarks These data objects and DDSes exist for the lifetime of the container.
|
|
111
96
|
*/
|
|
112
97
|
readonly initialObjects: LoadableObjectRecord;
|
|
113
98
|
|
|
114
99
|
/**
|
|
115
|
-
* The current attachment state of the container.
|
|
100
|
+
* The current attachment state of the container.
|
|
101
|
+
*
|
|
102
|
+
* @remarks
|
|
103
|
+
*
|
|
104
|
+
* Once a container has been attached, it remains attached.
|
|
116
105
|
* When loading an existing container, it will already be attached.
|
|
117
106
|
*/
|
|
118
107
|
readonly attachState: AttachState;
|
|
@@ -121,7 +110,9 @@ export interface IFluidContainer extends IEventProvider<IFluidContainerEvents> {
|
|
|
121
110
|
* A newly created container starts detached from the collaborative service.
|
|
122
111
|
* Calling `attach()` uploads the new container to the service and connects to the collaborative service.
|
|
123
112
|
*
|
|
124
|
-
* @remarks
|
|
113
|
+
* @remarks
|
|
114
|
+
*
|
|
115
|
+
* This should only be called when the container is in the
|
|
125
116
|
* {@link @fluidframework/container-definitions#AttachState.Detatched} state.
|
|
126
117
|
*
|
|
127
118
|
* This can be determined by observing {@link IFluidContainer.attachState}.
|
|
@@ -134,7 +125,9 @@ export interface IFluidContainer extends IEventProvider<IFluidContainerEvents> {
|
|
|
134
125
|
* Attempts to connect the container to the delta stream and process operations.
|
|
135
126
|
* Will throw an error if unsuccessful.
|
|
136
127
|
*
|
|
137
|
-
* @remarks
|
|
128
|
+
* @remarks
|
|
129
|
+
*
|
|
130
|
+
* This should only be called when the container is in the
|
|
138
131
|
* {@link @fluidframework/container-definitions#ConnectionState.Disconnected} state.
|
|
139
132
|
*
|
|
140
133
|
* This can be determined by observing {@link IFluidContainer.connectionState}.
|
|
@@ -144,7 +137,9 @@ export interface IFluidContainer extends IEventProvider<IFluidContainerEvents> {
|
|
|
144
137
|
/**
|
|
145
138
|
* Disconnects the container from the delta stream and stops processing operations.
|
|
146
139
|
*
|
|
147
|
-
* @remarks
|
|
140
|
+
* @remarks
|
|
141
|
+
*
|
|
142
|
+
* This should only be called when the container is in the
|
|
148
143
|
* {@link @fluidframework/container-definitions#ConnectionState.Connected} state.
|
|
149
144
|
*
|
|
150
145
|
* This can be determined by observing {@link IFluidContainer.connectionState}.
|
|
@@ -154,11 +149,15 @@ export interface IFluidContainer extends IEventProvider<IFluidContainerEvents> {
|
|
|
154
149
|
/**
|
|
155
150
|
* Create a new data object or Distributed Data Store (DDS) of the specified type.
|
|
156
151
|
*
|
|
157
|
-
* @remarks
|
|
152
|
+
* @remarks
|
|
153
|
+
*
|
|
154
|
+
* In order to share the data object or DDS with other
|
|
158
155
|
* collaborators and retrieve it later, store its handle in a collection like a SharedDirectory from your
|
|
159
156
|
* initialObjects.
|
|
160
157
|
*
|
|
161
|
-
* @param objectClass - The class of
|
|
158
|
+
* @param objectClass - The class of the `DataObject` or `SharedObject` to create.
|
|
159
|
+
*
|
|
160
|
+
* @typeParam T - The class of the `DataObject` or `SharedObject`.
|
|
162
161
|
*/
|
|
163
162
|
create<T extends IFluidLoadable>(objectClass: LoadableObjectClass<T>): Promise<T>;
|
|
164
163
|
|
|
@@ -171,7 +170,9 @@ export interface IFluidContainer extends IEventProvider<IFluidContainerEvents> {
|
|
|
171
170
|
/**
|
|
172
171
|
* Base {@link IFluidContainer} implementation.
|
|
173
172
|
*
|
|
174
|
-
* @remarks
|
|
173
|
+
* @remarks
|
|
174
|
+
*
|
|
175
|
+
* Note: this implementation is not complete. Consumers who rely on {@link IFluidContainer.attach}
|
|
175
176
|
* will need to utilize or provide a service-specific implementation of this type that implements that method.
|
|
176
177
|
*/
|
|
177
178
|
export class FluidContainer extends TypedEventEmitter<IFluidContainerEvents> implements IFluidContainer {
|
|
@@ -230,7 +231,10 @@ export class FluidContainer extends TypedEventEmitter<IFluidContainerEvents> imp
|
|
|
230
231
|
|
|
231
232
|
/**
|
|
232
233
|
* Incomplete base implementation of {@link IFluidContainer.attach}.
|
|
233
|
-
*
|
|
234
|
+
*
|
|
235
|
+
* @remarks
|
|
236
|
+
*
|
|
237
|
+
* Note: this implementation will unconditionally throw.
|
|
234
238
|
* Consumers who rely on this will need to utilize or provide a service specific implementation of this base type
|
|
235
239
|
* that provides an implementation of this method.
|
|
236
240
|
*
|