@fluidframework/fluid-static 2.30.0 → 2.31.1
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 +215 -211
- package/dist/rootDataObject.d.ts.map +1 -1
- package/dist/rootDataObject.js.map +1 -1
- package/lib/rootDataObject.d.ts.map +1 -1
- package/lib/rootDataObject.js.map +1 -1
- package/lib/tsdoc-metadata.json +1 -1
- package/package.json +20 -23
- package/src/rootDataObject.ts +4 -2
- package/prettier.config.cjs +0 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# @fluidframework/fluid-static
|
|
2
2
|
|
|
3
|
+
## 2.31.0
|
|
4
|
+
|
|
5
|
+
Dependency updates only.
|
|
6
|
+
|
|
3
7
|
## 2.30.0
|
|
4
8
|
|
|
5
9
|
Dependency updates only.
|
|
@@ -36,19 +40,19 @@ Dependency updates only.
|
|
|
36
40
|
|
|
37
41
|
### Minor Changes
|
|
38
42
|
|
|
39
|
-
-
|
|
43
|
+
- The inbound and outbound properties have been removed from IDeltaManager ([#22282](https://github.com/microsoft/FluidFramework/pull/22282)) [45a57693f2](https://github.com/microsoft/FluidFramework/commit/45a57693f291e0dc5e91af7f29a9b9c8f82dfad5)
|
|
40
44
|
|
|
41
|
-
|
|
45
|
+
The inbound and outbound properties were [deprecated in version 2.0.0-rc.2.0.0](https://github.com/microsoft/FluidFramework/blob/main/RELEASE_NOTES/2.0.0-rc.2.0.0.md#container-definitions-deprecate-ideltamanagerinbound-and-ideltamanageroutbound) and have been removed from `IDeltaManager`.
|
|
42
46
|
|
|
43
|
-
|
|
47
|
+
`IDeltaManager.inbound` contained functionality that could break core runtime features such as summarization and processing batches if used improperly. Data loss or corruption could occur when `IDeltaManger.inbound.pause()` or `IDeltaManager.inbound.resume()` were called.
|
|
44
48
|
|
|
45
|
-
|
|
49
|
+
Similarly, `IDeltaManager.outbound` contained functionality that could break core runtime features such as generation of batches and chunking. Data loss or corruption could occur when `IDeltaManger.inbound.pause()` or `IDeltaManager.inbound.resume()` were called.
|
|
46
50
|
|
|
47
|
-
|
|
51
|
+
#### Alternatives
|
|
48
52
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
53
|
+
- Alternatives to `IDeltaManager.inbound.on("op", ...)` are `IDeltaManager.on("op", ...)`
|
|
54
|
+
- Alternatives to calling `IDeltaManager.inbound.pause`, `IDeltaManager.outbound.pause` for `IContainer` disconnect use `IContainer.disconnect`.
|
|
55
|
+
- Alternatives to calling `IDeltaManager.inbound.resume`, `IDeltaManager.outbound.resume` for `IContainer` reconnect use `IContainer.connect`.
|
|
52
56
|
|
|
53
57
|
## 2.5.0
|
|
54
58
|
|
|
@@ -74,167 +78,167 @@ Dependency updates only.
|
|
|
74
78
|
|
|
75
79
|
### Minor Changes
|
|
76
80
|
|
|
77
|
-
-
|
|
81
|
+
- fluid-framework: Type Erase ISharedObjectKind ([#21081](https://github.com/microsoft/FluidFramework/pull/21081)) [78f228e370](https://github.com/microsoft/FluidFramework/commit/78f228e37055bd4d9a8f02b3a1eefebf4da9c59c)
|
|
78
82
|
|
|
79
|
-
|
|
83
|
+
A new type, `SharedObjectKind` is added as a type erased version of `ISharedObjectKind` and `DataObjectClass`.
|
|
80
84
|
|
|
81
|
-
|
|
85
|
+
This type fills the role of both `ISharedObjectKind` and `DataObjectClass` in the `@public` "declarative API" exposed in the `fluid-framework` package.
|
|
82
86
|
|
|
83
|
-
|
|
87
|
+
This allows several types referenced by `ISharedObjectKind` to be made `@alpha` as they should only need to be used by legacy code and users of the unstable/alpha/legacy "encapsulated API".
|
|
84
88
|
|
|
85
|
-
|
|
86
|
-
|
|
89
|
+
Access to these now less public types should not be required for users of the `@public` "declarative API" exposed in the `fluid-framework` package, but can still be accessed for those who need them under the `/legacy` import paths.
|
|
90
|
+
The full list of such types is:
|
|
87
91
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
92
|
+
- `SharedTree` as exported from `@fluidframwork/tree`: It is still exported as `@public` from `fluid-framework` as `SharedObjectKind`.
|
|
93
|
+
- `ISharedObjectKind`: See new `SharedObjectKind` type for use in `@public` APIs.
|
|
94
|
+
`ISharedObject`
|
|
95
|
+
- `IChannel`
|
|
96
|
+
- `IChannelAttributes`
|
|
97
|
+
- `IChannelFactory`
|
|
98
|
+
- `IExperimentalIncrementalSummaryContext`
|
|
99
|
+
- `IGarbageCollectionData`
|
|
100
|
+
- `ISummaryStats`
|
|
101
|
+
- `ISummaryTreeWithStats`
|
|
102
|
+
- `ITelemetryContext`
|
|
103
|
+
- `IDeltaManagerErased`
|
|
104
|
+
- `IFluidDataStoreRuntimeEvents`
|
|
105
|
+
- `IFluidHandleContext`
|
|
106
|
+
- `IProvideFluidHandleContext`
|
|
103
107
|
|
|
104
|
-
|
|
108
|
+
Removed APIs:
|
|
105
109
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
+
- `DataObjectClass`: Usages replaced with `SharedObjectKind`.
|
|
111
|
+
- `LoadableObjectClass`: Replaced with `SharedObjectKind`.
|
|
112
|
+
- `LoadableObjectClassRecord`: Replaced with `Record<string, SharedObjectKind>`.
|
|
113
|
+
-
|
|
110
114
|
|
|
111
|
-
-
|
|
115
|
+
- Update to TypeScript 5.4 ([#21214](https://github.com/microsoft/FluidFramework/pull/21214)) [0e6256c722](https://github.com/microsoft/FluidFramework/commit/0e6256c722d8bf024f4325bf02547daeeb18bfa6)
|
|
112
116
|
|
|
113
|
-
|
|
117
|
+
Update package implementations to use TypeScript 5.4.5.
|
|
114
118
|
|
|
115
|
-
-
|
|
119
|
+
- azure-client, tinylicious-client: compatibilityMode parameter added to createContainer and getContainer on AzureClient and TinyliciousClient ([#20997](https://github.com/microsoft/FluidFramework/pull/20997)) [2730787209](https://github.com/microsoft/FluidFramework/commit/2730787209a60155752d51da3c78cf97e1b5f3f9)
|
|
116
120
|
|
|
117
|
-
|
|
121
|
+
To support migration from 1.x to 2.0, a compatibility mode parameter has been added to these methods on AzureClient and TinyliciousClient. When set to "1", this allows interop between the 2.0 clients and 1.x clients. When set to "2", interop with 1.x clients is disallowed but new 2.0 features may be used.
|
|
118
122
|
|
|
119
123
|
## 2.0.0-rc.4.0.0
|
|
120
124
|
|
|
121
125
|
### Minor Changes
|
|
122
126
|
|
|
123
|
-
-
|
|
127
|
+
- Rename `AzureMember.userName` to `AzureMember.name` and `IMember.userId` to `IMember.id` [96872186d0](https://github.com/microsoft/FluidFramework/commit/96872186d0d0f245c1fece7d19b3743e501679b6)
|
|
124
128
|
|
|
125
|
-
|
|
126
|
-
|
|
129
|
+
1. Renamed `AzureMember.userName` to `AzureMember.name` to establish uniform naming across odsp-client and azure-client.
|
|
130
|
+
2. Renamed `IMember.userId` to `IMember.id` to align with the properties received from AFR.
|
|
127
131
|
|
|
128
132
|
## 2.0.0-rc.3.0.0
|
|
129
133
|
|
|
130
134
|
### Major Changes
|
|
131
135
|
|
|
132
|
-
-
|
|
136
|
+
- Packages now use package.json "exports" and require modern module resolution [97d68aa06b](https://github.com/microsoft/FluidFramework/commit/97d68aa06bd5c022ecb026655814aea222a062ae)
|
|
133
137
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
138
|
+
Fluid Framework packages have been updated to use the [package.json "exports"
|
|
139
|
+
field](https://nodejs.org/docs/latest-v18.x/api/packages.html#exports) to define explicit entry points for both
|
|
140
|
+
TypeScript types and implementation code.
|
|
137
141
|
|
|
138
|
-
|
|
142
|
+
This means that using Fluid Framework packages require the following TypeScript settings in tsconfig.json:
|
|
139
143
|
|
|
140
|
-
|
|
141
|
-
|
|
144
|
+
- `"moduleResolution": "Node16"` with `"module": "Node16"`
|
|
145
|
+
- `"moduleResolution": "Bundler"` with `"module": "ESNext"`
|
|
142
146
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
+
We recommend using Node16/Node16 unless absolutely necessary. That will produce transpiled JavaScript that is suitable
|
|
148
|
+
for use with modern versions of Node.js _and_ Bundlers.
|
|
149
|
+
[See the TypeScript documentation](https://www.typescriptlang.org/tsconfig#moduleResolution) for more information
|
|
150
|
+
regarding the module and moduleResolution options.
|
|
147
151
|
|
|
148
|
-
|
|
149
|
-
|
|
152
|
+
**Node10 moduleResolution is not supported; it does not support Fluid Framework's API structuring pattern that is used
|
|
153
|
+
to distinguish stable APIs from those that are in development.**
|
|
150
154
|
|
|
151
155
|
### Minor Changes
|
|
152
156
|
|
|
153
|
-
-
|
|
157
|
+
- fluid-framework: Replace SharedObjectClass with new ISharedObjectKind type. [97d68aa06b](https://github.com/microsoft/FluidFramework/commit/97d68aa06bd5c022ecb026655814aea222a062ae)
|
|
154
158
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
159
|
+
The static objects used as SharedObjectClass now explicitly implement the new ISharedObjectKind type.
|
|
160
|
+
SharedObjectClass has been removed as ISharedObjectKind now fills that role.
|
|
161
|
+
LoadableObjectCtor has been inlined as it only had one use: an external user of it can replace it with `(new (...args: any[]) => T)`.
|
|
158
162
|
|
|
159
|
-
-
|
|
163
|
+
- fluid-framework: Make some interface members readonly [97d68aa06b](https://github.com/microsoft/FluidFramework/commit/97d68aa06bd5c022ecb026655814aea222a062ae)
|
|
160
164
|
|
|
161
|
-
|
|
165
|
+
Remove unneeded mutability from some interface members.
|
|
162
166
|
|
|
163
167
|
## 2.0.0-rc.2.0.0
|
|
164
168
|
|
|
165
169
|
### Minor Changes
|
|
166
170
|
|
|
167
|
-
-
|
|
171
|
+
- fluid-framework: ContainerSchema is now readonly ([#19717](https://github.com/microsoft/FluidFramework/issues/19717)) [ae1d0be26d](https://github.com/microsoft/FluidFramework/commits/ae1d0be26d61453cff316b3f622a9f3647149167)
|
|
168
172
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
173
|
+
The `ContainerSchema` type is intended for defining input to these packages. This should make the APIs more tolerant and
|
|
174
|
+
thus be non-breaking, however its possible for some users of `ContainerSchema` to use it in ways where this could be a
|
|
175
|
+
breaking change: any such users should remove their mutations and/or use a different type.
|
|
172
176
|
|
|
173
177
|
## 2.0.0-rc.1.0.0
|
|
174
178
|
|
|
175
179
|
### Minor Changes
|
|
176
180
|
|
|
177
|
-
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
181
|
+
- Updated server dependencies ([#19122](https://github.com/microsoft/FluidFramework/issues/19122)) [25366b4229](https://github.com/microsoft/FluidFramework/commits/25366b422918cb43685c5f328b50450749592902)
|
|
182
|
+
|
|
183
|
+
The following Fluid server dependencies have been updated to the latest version, 3.0.0. [See the full changelog.](https://github.com/microsoft/FluidFramework/releases/tag/server_v3.0.0)
|
|
184
|
+
|
|
185
|
+
- @fluidframework/gitresources
|
|
186
|
+
- @fluidframework/server-kafka-orderer
|
|
187
|
+
- @fluidframework/server-lambdas
|
|
188
|
+
- @fluidframework/server-lambdas-driver
|
|
189
|
+
- @fluidframework/server-local-server
|
|
190
|
+
- @fluidframework/server-memory-orderer
|
|
191
|
+
- @fluidframework/protocol-base
|
|
192
|
+
- @fluidframework/server-routerlicious
|
|
193
|
+
- @fluidframework/server-routerlicious-base
|
|
194
|
+
- @fluidframework/server-services
|
|
195
|
+
- @fluidframework/server-services-client
|
|
196
|
+
- @fluidframework/server-services-core
|
|
197
|
+
- @fluidframework/server-services-ordering-kafkanode
|
|
198
|
+
- @fluidframework/server-services-ordering-rdkafka
|
|
199
|
+
- @fluidframework/server-services-ordering-zookeeper
|
|
200
|
+
- @fluidframework/server-services-shared
|
|
201
|
+
- @fluidframework/server-services-telemetry
|
|
202
|
+
- @fluidframework/server-services-utils
|
|
203
|
+
- @fluidframework/server-test-utils
|
|
204
|
+
- tinylicious
|
|
205
|
+
|
|
206
|
+
- Updated @fluidframework/protocol-definitions ([#19122](https://github.com/microsoft/FluidFramework/issues/19122)) [25366b4229](https://github.com/microsoft/FluidFramework/commits/25366b422918cb43685c5f328b50450749592902)
|
|
207
|
+
|
|
208
|
+
The @fluidframework/protocol-definitions dependency has been upgraded to v3.1.0. [See the full
|
|
209
|
+
changelog.](https://github.com/microsoft/FluidFramework/blob/main/common/lib/protocol-definitions/CHANGELOG.md#310)
|
|
206
210
|
|
|
207
211
|
## 2.0.0-internal.8.0.0
|
|
208
212
|
|
|
209
213
|
### Major Changes
|
|
210
214
|
|
|
211
|
-
-
|
|
215
|
+
- azure-client: Removed deprecated FluidStatic classes [9a451d4946](https://github.com/microsoft/FluidFramework/commits/9a451d4946b5c51a52e4d1ab5bf51e7b285b0d74)
|
|
212
216
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
217
|
+
Several FluidStatic classes were unnecessarily exposed and were deprecated in an earlier release. They have been replaced with creation functions. This helps us
|
|
218
|
+
keep implementations decoupled from usage which is easier to maintain and extend. It has very minimal impact on the
|
|
219
|
+
public surface area of downstream packages. The removed classes are as follows:
|
|
216
220
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
221
|
+
- `AzureAudience` (use `IAzureAudience` instead)
|
|
222
|
+
- `TinyliciousAudience` (use `ITinyliciousAudience` instead)
|
|
223
|
+
- `DOProviderContainerRuntimeFactory`
|
|
224
|
+
- `FluidContainer`
|
|
225
|
+
- `ServiceAudience`
|
|
222
226
|
|
|
223
227
|
## 2.0.0-internal.7.4.0
|
|
224
228
|
|
|
225
229
|
### Minor Changes
|
|
226
230
|
|
|
227
|
-
-
|
|
231
|
+
- azure-client: Deprecated FluidStatic Classes ([#18402](https://github.com/microsoft/FluidFramework/issues/18402)) [589ec39de5](https://github.com/microsoft/FluidFramework/commits/589ec39de52116c7f782319e6f6aa61bc5aa9964)
|
|
228
232
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
233
|
+
Several FluidStatic classes were unnecessarily exposed. They have been replaced with creation functions. This helps us
|
|
234
|
+
keep implementations decoupled from usage which is easier to maintain and extend. It has very minimal impact on the
|
|
235
|
+
public surface area of downstream packages. The deprecated classes are as follows:
|
|
232
236
|
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
237
|
+
- `AzureAudience` (use `IAzureAudience` instead)
|
|
238
|
+
- `TinyliciousAudience` (use `ITinyliciousAudience` instead)
|
|
239
|
+
- `DOProviderContainerRuntimeFactory`
|
|
240
|
+
- `FluidContainer`
|
|
241
|
+
- `ServiceAudience`
|
|
238
242
|
|
|
239
243
|
## 2.0.0-internal.7.3.0
|
|
240
244
|
|
|
@@ -252,61 +256,61 @@ Dependency updates only.
|
|
|
252
256
|
|
|
253
257
|
### Major Changes
|
|
254
258
|
|
|
255
|
-
-
|
|
259
|
+
- Dependencies on @fluidframework/protocol-definitions package updated to 3.0.0 [871b3493dd](https://github.com/microsoft/FluidFramework/commits/871b3493dd0d7ea3a89be64998ceb6cb9021a04e)
|
|
256
260
|
|
|
257
|
-
|
|
261
|
+
This included the following changes from the protocol-definitions release:
|
|
258
262
|
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
263
|
+
- Updating signal interfaces for some planned improvements. The intention is split the interface between signals
|
|
264
|
+
submitted by clients to the server and the resulting signals sent from the server to clients.
|
|
265
|
+
- A new optional type member is available on the ISignalMessage interface and a new ISentSignalMessage interface has
|
|
266
|
+
been added, which will be the typing for signals sent from the client to the server. Both extend a new
|
|
267
|
+
ISignalMessageBase interface that contains common members.
|
|
268
|
+
- The @fluidframework/common-definitions package dependency has been updated to version 1.0.0.
|
|
265
269
|
|
|
266
|
-
-
|
|
270
|
+
- Server upgrade: dependencies on Fluid server packages updated to 2.0.1 [871b3493dd](https://github.com/microsoft/FluidFramework/commits/871b3493dd0d7ea3a89be64998ceb6cb9021a04e)
|
|
267
271
|
|
|
268
|
-
|
|
272
|
+
Dependencies on the following Fluid server package have been updated to version 2.0.1:
|
|
269
273
|
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
274
|
+
- @fluidframework/gitresources: 2.0.1
|
|
275
|
+
- @fluidframework/server-kafka-orderer: 2.0.1
|
|
276
|
+
- @fluidframework/server-lambdas: 2.0.1
|
|
277
|
+
- @fluidframework/server-lambdas-driver: 2.0.1
|
|
278
|
+
- @fluidframework/server-local-server: 2.0.1
|
|
279
|
+
- @fluidframework/server-memory-orderer: 2.0.1
|
|
280
|
+
- @fluidframework/protocol-base: 2.0.1
|
|
281
|
+
- @fluidframework/server-routerlicious: 2.0.1
|
|
282
|
+
- @fluidframework/server-routerlicious-base: 2.0.1
|
|
283
|
+
- @fluidframework/server-services: 2.0.1
|
|
284
|
+
- @fluidframework/server-services-client: 2.0.1
|
|
285
|
+
- @fluidframework/server-services-core: 2.0.1
|
|
286
|
+
- @fluidframework/server-services-ordering-kafkanode: 2.0.1
|
|
287
|
+
- @fluidframework/server-services-ordering-rdkafka: 2.0.1
|
|
288
|
+
- @fluidframework/server-services-ordering-zookeeper: 2.0.1
|
|
289
|
+
- @fluidframework/server-services-shared: 2.0.1
|
|
290
|
+
- @fluidframework/server-services-telemetry: 2.0.1
|
|
291
|
+
- @fluidframework/server-services-utils: 2.0.1
|
|
292
|
+
- @fluidframework/server-test-utils: 2.0.1
|
|
293
|
+
- tinylicious: 2.0.1
|
|
290
294
|
|
|
291
|
-
-
|
|
295
|
+
- test-utils: provideEntryPoint is required [871b3493dd](https://github.com/microsoft/FluidFramework/commits/871b3493dd0d7ea3a89be64998ceb6cb9021a04e)
|
|
292
296
|
|
|
293
|
-
|
|
297
|
+
The optional `provideEntryPoint` method has become required on a number of constructors. A value will need to be provided to the following classes:
|
|
294
298
|
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
+
- `BaseContainerRuntimeFactory`
|
|
300
|
+
- `RuntimeFactory`
|
|
301
|
+
- `ContainerRuntime` (constructor and `loadRuntime`)
|
|
302
|
+
- `FluidDataStoreRuntime`
|
|
299
303
|
|
|
300
|
-
|
|
301
|
-
|
|
304
|
+
See [testContainerRuntimeFactoryWithDefaultDataStore.ts](https://github.com/microsoft/FluidFramework/tree/main/packages/test/test-utils/src/testContainerRuntimeFactoryWithDefaultDataStore.ts) for an example implemtation of `provideEntryPoint` for ContainerRuntime.
|
|
305
|
+
See [pureDataObjectFactory.ts](https://github.com/microsoft/FluidFramework/tree/main/packages/framework/aqueduct/src/data-object-factories/pureDataObjectFactory.ts#L83) for an example implementation of `provideEntryPoint` for DataStoreRuntime.
|
|
302
306
|
|
|
303
|
-
|
|
307
|
+
Subsequently, various `entryPoint` and `getEntryPoint()` endpoints have become required. Please see [containerRuntime.ts](https://github.com/microsoft/FluidFramework/tree/main/packages/runtime/container-runtime/src/containerRuntime.ts) for example implementations of these APIs.
|
|
304
308
|
|
|
305
|
-
|
|
309
|
+
For more details, see [Removing-IFluidRouter.md](https://github.com/microsoft/FluidFramework/blob/main/packages/common/core-interfaces/Removing-IFluidRouter.md)
|
|
306
310
|
|
|
307
|
-
-
|
|
311
|
+
- Minimum TypeScript version now 5.1.6 [871b3493dd](https://github.com/microsoft/FluidFramework/commits/871b3493dd0d7ea3a89be64998ceb6cb9021a04e)
|
|
308
312
|
|
|
309
|
-
|
|
313
|
+
The minimum supported TypeScript version for Fluid 2.0 clients is now 5.1.6.
|
|
310
314
|
|
|
311
315
|
## 2.0.0-internal.6.4.0
|
|
312
316
|
|
|
@@ -320,32 +324,32 @@ Dependency updates only.
|
|
|
320
324
|
|
|
321
325
|
### Minor Changes
|
|
322
326
|
|
|
323
|
-
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
327
|
+
- Remove use of @fluidframework/common-definitions ([#16638](https://github.com/microsoft/FluidFramework/issues/16638)) [a8c81509c9](https://github.com/microsoft/FluidFramework/commits/a8c81509c9bf09cfb2092ebcf7265205f9eb6dbf)
|
|
328
|
+
|
|
329
|
+
The **@fluidframework/common-definitions** package is being deprecated, so the following interfaces and types are now
|
|
330
|
+
imported from the **@fluidframework/core-interfaces** package:
|
|
331
|
+
|
|
332
|
+
- interface IDisposable
|
|
333
|
+
- interface IErrorEvent
|
|
334
|
+
- interface IErrorEvent
|
|
335
|
+
- interface IEvent
|
|
336
|
+
- interface IEventProvider
|
|
337
|
+
- interface ILoggingError
|
|
338
|
+
- interface ITaggedTelemetryPropertyType
|
|
339
|
+
- interface ITelemetryBaseEvent
|
|
340
|
+
- interface ITelemetryBaseLogger
|
|
341
|
+
- interface ITelemetryErrorEvent
|
|
342
|
+
- interface ITelemetryGenericEvent
|
|
343
|
+
- interface ITelemetryLogger
|
|
344
|
+
- interface ITelemetryPerformanceEvent
|
|
345
|
+
- interface ITelemetryProperties
|
|
346
|
+
- type ExtendEventProvider
|
|
347
|
+
- type IEventThisPlaceHolder
|
|
348
|
+
- type IEventTransformer
|
|
349
|
+
- type ReplaceIEventThisPlaceHolder
|
|
350
|
+
- type ReplaceIEventThisPlaceHolder
|
|
351
|
+
- type TelemetryEventCategory
|
|
352
|
+
- type TelemetryEventPropertyType
|
|
349
353
|
|
|
350
354
|
## 2.0.0-internal.6.1.0
|
|
351
355
|
|
|
@@ -355,13 +359,13 @@ Dependency updates only.
|
|
|
355
359
|
|
|
356
360
|
### Major Changes
|
|
357
361
|
|
|
358
|
-
-
|
|
362
|
+
- RootDataObject and RootDataObjectProps no longer exported from fluid-static or fluid-framework packages [8abce8cdb4](https://github.com/microsoft/FluidFramework/commits/8abce8cdb4e2832fb6405fb44e393bef03d5648a)
|
|
359
363
|
|
|
360
|
-
|
|
364
|
+
RootDataObject and RootDataObjectProps are internal implementations and not intended for direct use. Instead use IRootDataObject to refer to the root data object.
|
|
361
365
|
|
|
362
|
-
-
|
|
366
|
+
- Upgraded typescript transpilation target to ES2020 [8abce8cdb4](https://github.com/microsoft/FluidFramework/commits/8abce8cdb4e2832fb6405fb44e393bef03d5648a)
|
|
363
367
|
|
|
364
|
-
|
|
368
|
+
Upgraded typescript transpilation target to ES2020. This is done in order to decrease the bundle sizes of Fluid Framework packages. This has provided size improvements across the board for ex. Loader, Driver, Runtime etc. Reduced bundle sizes helps to load lesser code in apps and hence also helps to improve the perf.If any app wants to target any older versions of browsers with which this target version is not compatible, then they can use packages like babel to transpile to a older target.
|
|
365
369
|
|
|
366
370
|
## 2.0.0-internal.5.4.0
|
|
367
371
|
|
|
@@ -383,11 +387,11 @@ Dependency updates only.
|
|
|
383
387
|
|
|
384
388
|
### Major Changes
|
|
385
389
|
|
|
386
|
-
-
|
|
390
|
+
- The following functions and classes were deprecated in previous releases and have been removed: [8b242fdc79](https://github.com/microsoft/FluidFramework/commits/8b242fdc796714cf1da9ad3f90d02efb122af0c2)
|
|
387
391
|
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
392
|
+
- `PureDataObject.getFluidObjectFromDirectory`
|
|
393
|
+
- `IProvideContainerRuntime` and its `IContainerRuntime` member.
|
|
394
|
+
- `ContainerRuntime`'s `IProvideContainerRuntime` has also been removed.
|
|
391
395
|
|
|
392
396
|
## 2.0.0-internal.4.4.0
|
|
393
397
|
|
|
@@ -426,11 +430,11 @@ import { SharedMap } from "@fluidframework/map";
|
|
|
426
430
|
// ...
|
|
427
431
|
|
|
428
432
|
const containerConfig = {
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
433
|
+
name: "my-container",
|
|
434
|
+
initialObjects: {
|
|
435
|
+
pair1: KeyValueDataObject,
|
|
436
|
+
map1: SharedMap,
|
|
437
|
+
},
|
|
434
438
|
};
|
|
435
439
|
```
|
|
436
440
|
|
|
@@ -444,11 +448,11 @@ This change also introduces all `initialObjects` as statically loaded when the `
|
|
|
444
448
|
|
|
445
449
|
```javascript
|
|
446
450
|
const config = {
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
451
|
+
name: "my-container",
|
|
452
|
+
initialObjects: {
|
|
453
|
+
map1: SharedMap,
|
|
454
|
+
map2: SharedMap,
|
|
455
|
+
},
|
|
452
456
|
};
|
|
453
457
|
|
|
454
458
|
// ...
|
|
@@ -465,9 +469,9 @@ const map2 = initialObjects["map2"];
|
|
|
465
469
|
|
|
466
470
|
```typescript
|
|
467
471
|
interface ContainerConfig {
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
472
|
+
name: string;
|
|
473
|
+
initialObjects: LoadableObjectClassRecord;
|
|
474
|
+
dynamicObjectTypes?: LoadableObjectClass<any>[];
|
|
471
475
|
}
|
|
472
476
|
```
|
|
473
477
|
|
|
@@ -477,12 +481,12 @@ For details of each property above see `ContainerConfig` in [./src/types](./src/
|
|
|
477
481
|
|
|
478
482
|
```javascript
|
|
479
483
|
const config = {
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
484
|
+
name: "my-container",
|
|
485
|
+
initialObjects: {
|
|
486
|
+
pair1: KeyValueDataObject,
|
|
487
|
+
map1: SharedMap,
|
|
488
|
+
},
|
|
489
|
+
dynamicObjectTypes: [SharedDirectory, SharedString],
|
|
486
490
|
};
|
|
487
491
|
```
|
|
488
492
|
|
|
@@ -514,11 +518,11 @@ Because the `FluidContainer` will no longer be maintaining object lifecycle the
|
|
|
514
518
|
|
|
515
519
|
```javascript
|
|
516
520
|
const config = {
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
521
|
+
name: "my-container",
|
|
522
|
+
initialObjects: {
|
|
523
|
+
map1: SharedMap,
|
|
524
|
+
},
|
|
525
|
+
dynamicObjectTypes: [KeyValueDataObject],
|
|
522
526
|
};
|
|
523
527
|
|
|
524
528
|
const container = Fluid.getContainer("some-id", config);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rootDataObject.d.ts","sourceRoot":"","sources":["../src/rootDataObject.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gDAAgD,CAAC;
|
|
1
|
+
{"version":3,"file":"rootDataObject.d.ts","sourceRoot":"","sources":["../src/rootDataObject.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gDAAgD,CAAC;AAUtF,OAAO,KAAK,EACX,iBAAiB,EACjB,eAAe,EAGf,wBAAwB,EAExB,MAAM,YAAY,CAAC;AAOpB;;GAEG;AACH,MAAM,WAAW,mBAAmB;IACnC;;;;OAIG;IACH,QAAQ,CAAC,cAAc,EAAE,wBAAwB,CAAC;CAClD;AAkHD;;;;;GA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AAc,EACd,aAAa,EACb,EAAE,EACF,eAAe,CACf,CAAC;QACF,MAAM,iBAAiB,GAAG,KAAK,EAC9B,gBAAmC,EAEZ,EAAE;YACzB,MAAM,UAAU,GAAG,MAAM,gBAAgB,CAAC,6BAA6B,CAAC,eAAe,CAAC,CAAC;YACzF,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;gBAC9B,MAAM,IAAI,KAAK,CAAC,sBAAsB,eAAe,cAAc,CAAC,CAAC;YACtE,CAAC;YACD,OAAO,UAAU,CAAC,GAAG,EAAE,CAAC;QACzB,CAAC,CAAC;QACF,KAAK,CAAC;YACL,eAAe,EAAE,CAAC,qBAAqB,CAAC,aAAa,CAAC;YACtD,cAAc,EAAE,+DAA+B,CAAC,iBAAiB,CAAC;YAClE,iBAAiB;SACjB,CAAC,CAAC;QACH,IAAI,CAAC,qBAAqB,GAAG,qBAAqB,CAAC;QACnD,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC;IAC7C,CAAC;IAED;;OAEG;IACO,KAAK,CAAC,8BAA8B,CAAC,OAA0B;QACxE,sEAAsE;QACtE,MAAM,IAAI,CAAC,qBAAqB,CAAC,kBAAkB,CAAC,eAAe,EAAE,OAAO,EAAE;YAC7E,cAAc,EAAE,IAAI,CAAC,cAAc;SACnC,CAAC,CAAC;IACJ,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tBaseContainerRuntimeFactory,\n\tDataObject,\n\ttype DataObjectKind,\n\tDataObjectFactory,\n} from \"@fluidframework/aqueduct/internal\";\nimport type { IRuntimeFactory } from \"@fluidframework/container-definitions/internal\";\nimport type { IContainerRuntime } from \"@fluidframework/container-runtime-definitions/internal\";\nimport type { FluidObject, IFluidLoadable } from \"@fluidframework/core-interfaces\";\nimport type { IDirectory } from \"@fluidframework/map/internal\";\nimport type { SharedObjectKind } from \"@fluidframework/shared-object-base\";\nimport type { ISharedObjectKind } from \"@fluidframework/shared-object-base/internal\";\n\nimport { compatibilityModeRuntimeOptions } from \"./compatibilityConfiguration.js\";\nimport type {\n\tCompatibilityMode,\n\tContainerSchema,\n\tIRootDataObject,\n\tLoadableObjectKind,\n\tLoadableObjectKindRecord,\n\tLoadableObjectRecord,\n} from \"./types.js\";\nimport {\n\tisDataObjectKind,\n\tisSharedObjectKind,\n\tparseDataObjectsFromSharedObjects,\n} from \"./utils.js\";\n\n/**\n * Input props for {@link RootDataObject.initializingFirstTime}.\n */\nexport interface RootDataObjectProps {\n\t/**\n\t * Initial object structure with which the {@link RootDataObject} will be first-time initialized.\n\t *\n\t * @see {@link RootDataObject.initializingFirstTime}\n\t */\n\treadonly initialObjects: LoadableObjectKindRecord;\n}\n\n/**\n * The entry-point/root collaborative object of the {@link IFluidContainer | Fluid Container}.\n * Abstracts the dynamic code required to build a Fluid Container into a static representation for end customers.\n */\nclass RootDataObject\n\textends DataObject<{ InitialState: RootDataObjectProps }>\n\timplements IRootDataObject\n{\n\tprivate readonly initialObjectsDirKey = \"initial-objects-key\";\n\tprivate readonly _initialObjects: LoadableObjectRecord = {};\n\n\tpublic get IRootDataObject(): IRootDataObject {\n\t\treturn this;\n\t}\n\n\tprivate get initialObjectsDir(): IDirectory {\n\t\tconst dir = this.root.getSubDirectory(this.initialObjectsDirKey);\n\t\tif (dir === undefined) {\n\t\t\tthrow new Error(\"InitialObjects sub-directory was not initialized\");\n\t\t}\n\t\treturn dir;\n\t}\n\n\t/**\n\t * The first time this object is initialized, creates each object identified in\n\t * {@link RootDataObjectProps.initialObjects} and stores them as unique values in the root directory.\n\t *\n\t * @see {@link @fluidframework/aqueduct#PureDataObject.initializingFirstTime}\n\t */\n\tprotected async initializingFirstTime(props: RootDataObjectProps): Promise<void> {\n\t\tthis.root.createSubDirectory(this.initialObjectsDirKey);\n\n\t\t// Create initial objects provided by the developer\n\t\tconst initialObjectsP: Promise<void>[] = [];\n\t\tfor (const [id, objectClass] of Object.entries(props.initialObjects)) {\n\t\t\tconst createObject = async (): Promise<void> => {\n\t\t\t\tconst obj = await this.create<IFluidLoadable>(\n\t\t\t\t\tobjectClass as SharedObjectKind<IFluidLoadable>,\n\t\t\t\t);\n\t\t\t\tthis.initialObjectsDir.set(id, obj.handle);\n\t\t\t};\n\t\t\tinitialObjectsP.push(createObject());\n\t\t}\n\n\t\tawait Promise.all(initialObjectsP);\n\t}\n\n\t/**\n\t * Every time an instance is initialized, loads all of the initial objects in the root directory so they can be\n\t * accessed immediately.\n\t *\n\t * @see {@link @fluidframework/aqueduct#PureDataObject.hasInitialized}\n\t */\n\tprotected async hasInitialized(): Promise<void> {\n\t\t// We will always load the initial objects so they are available to the developer\n\t\tconst loadInitialObjectsP: Promise<void>[] = [];\n\t\tfor (const [key, value] of this.initialObjectsDir.entries()) {\n\t\t\tconst loadDir = async (): Promise<void> => {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call\n\t\t\t\tconst obj: unknown = await value.get();\n\t\t\t\tObject.assign(this._initialObjects, { [key]: obj });\n\t\t\t};\n\t\t\tloadInitialObjectsP.push(loadDir());\n\t\t}\n\n\t\tawait Promise.all(loadInitialObjectsP);\n\t}\n\n\t/**\n\t * {@inheritDoc IRootDataObject.initialObjects}\n\t */\n\tpublic get initialObjects(): LoadableObjectRecord {\n\t\tif (Object.keys(this._initialObjects).length === 0) {\n\t\t\tthrow new Error(\"Initial Objects were not correctly initialized\");\n\t\t}\n\t\treturn this._initialObjects;\n\t}\n\n\t/**\n\t * {@inheritDoc IRootDataObject.create}\n\t */\n\tpublic async create<T>(objectClass: SharedObjectKind<T>): Promise<T> {\n\t\tconst internal = objectClass as unknown as LoadableObjectKind<T & IFluidLoadable>;\n\t\tif (isDataObjectKind(internal)) {\n\t\t\treturn this.createDataObject(internal);\n\t\t} else if (isSharedObjectKind(internal)) {\n\t\t\treturn this.createSharedObject(internal);\n\t\t}\n\t\tthrow new Error(\"Could not create new Fluid object because an unknown object was passed\");\n\t}\n\n\tprivate async createDataObject<T extends IFluidLoadable>(\n\t\tdataObjectClass: DataObjectKind<T>,\n\t): Promise<T> {\n\t\tconst factory = dataObjectClass.factory;\n\t\tconst packagePath = [...this.context.packagePath, factory.type];\n\t\tconst dataStore = await this.context.containerRuntime.createDataStore(packagePath);\n\t\tconst entryPoint = await dataStore.entryPoint.get();\n\t\treturn entryPoint as T;\n\t}\n\n\tprivate createSharedObject<T extends IFluidLoadable>(\n\t\tsharedObjectClass: ISharedObjectKind<T>,\n\t): T {\n\t\tconst factory = sharedObjectClass.getFactory();\n\t\tconst obj = this.runtime.createChannel(undefined, factory.type);\n\t\treturn obj as unknown as T;\n\t}\n}\n\nconst rootDataStoreId = \"rootDOId\";\n\n/**\n * Creates an {@link @fluidframework/aqueduct#BaseContainerRuntimeFactory} for a container with a single\n * {@link IRootDataObject}, which is constructed from the provided schema.\n *\n * @internal\n */\nexport function createDOProviderContainerRuntimeFactory(props: {\n\tschema: ContainerSchema;\n\tcompatibilityMode: CompatibilityMode;\n}): IRuntimeFactory {\n\treturn new DOProviderContainerRuntimeFactory(props.schema, props.compatibilityMode);\n}\n\n/**\n * Container code that provides a single {@link IRootDataObject}.\n *\n * @remarks\n *\n * This data object is dynamically customized (registry and initial objects) based on the schema provided.\n * to the container runtime factory.\n *\n * @internal\n */\nclass DOProviderContainerRuntimeFactory extends BaseContainerRuntimeFactory {\n\tprivate readonly rootDataObjectFactory: DataObjectFactory<\n\t\tRootDataObject,\n\t\t{\n\t\t\tInitialState: RootDataObjectProps;\n\t\t}\n\t>;\n\n\tprivate readonly initialObjects: LoadableObjectKindRecord;\n\n\tpublic constructor(schema: ContainerSchema, compatibilityMode: CompatibilityMode) {\n\t\tconst [registryEntries, sharedObjects] = parseDataObjectsFromSharedObjects(schema);\n\t\tconst rootDataObjectFactory = new DataObjectFactory(\n\t\t\t\"rootDO\",\n\t\t\tRootDataObject,\n\t\t\tsharedObjects,\n\t\t\t{},\n\t\t\tregistryEntries,\n\t\t);\n\t\tconst provideEntryPoint = async (\n\t\t\tcontainerRuntime: IContainerRuntime,\n\t\t\t// eslint-disable-next-line unicorn/consistent-function-scoping\n\t\t): Promise<FluidObject> => {\n\t\t\tconst entryPoint = await containerRuntime.getAliasedDataStoreEntryPoint(rootDataStoreId);\n\t\t\tif (entryPoint === undefined) {\n\t\t\t\tthrow new Error(`default dataStore [${rootDataStoreId}] must exist`);\n\t\t\t}\n\t\t\treturn entryPoint.get();\n\t\t};\n\t\tsuper({\n\t\t\tregistryEntries: [rootDataObjectFactory.registryEntry],\n\t\t\truntimeOptions: compatibilityModeRuntimeOptions[compatibilityMode],\n\t\t\tprovideEntryPoint,\n\t\t});\n\t\tthis.rootDataObjectFactory = rootDataObjectFactory;\n\t\tthis.initialObjects = schema.initialObjects;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/aqueduct#BaseContainerRuntimeFactory.containerInitializingFirstTime}\n\t */\n\tprotected async containerInitializingFirstTime(runtime: IContainerRuntime): Promise<void> {\n\t\t// The first time we create the container we create the RootDataObject\n\t\tawait this.rootDataObjectFactory.createRootInstance(rootDataStoreId, runtime, {\n\t\t\tinitialObjects: this.initialObjects,\n\t\t});\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"rootDataObject.js","sourceRoot":"","sources":["../src/rootDataObject.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,gEAK2C;AAU3C,mFAAkF;AASlF,yCAIoB;AAcpB;;;GAGG;AACH,MAAM,cACL,SAAQ,qBAAiD;IAD1D;;QAIkB,yBAAoB,GAAG,qBAAqB,CAAC;QAC7C,oBAAe,GAAyB,EAAE,CAAC;IAmG7D,CAAC;IAjGA,IAAW,eAAe;QACzB,OAAO,IAAI,CAAC;IACb,CAAC;IAED,IAAY,iBAAiB;QAC5B,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;QACjE,IAAI,GA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IAED;;OAEG;IACO,KAAK,CAAC,8BAA8B,CAAC,OAA0B;QACxE,sEAAsE;QACtE,MAAM,IAAI,CAAC,qBAAqB,CAAC,kBAAkB,CAAC,eAAe,EAAE,OAAO,EAAE;YAC7E,cAAc,EAAE,IAAI,CAAC,cAAc;SACnC,CAAC,CAAC;IACJ,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tBaseContainerRuntimeFactory,\n\tDataObject,\n\ttype DataObjectKind,\n\tDataObjectFactory,\n} from \"@fluidframework/aqueduct/internal\";\nimport type { IRuntimeFactory } from \"@fluidframework/container-definitions/internal\";\nimport type { IContainerRuntime } from \"@fluidframework/container-runtime-definitions/internal\";\nimport type { FluidObject, IFluidLoadable } from \"@fluidframework/core-interfaces\";\nimport type { IDirectory } from \"@fluidframework/map/internal\";\nimport type {\n\tISharedObjectKind,\n\tSharedObjectKind,\n} from \"@fluidframework/shared-object-base/internal\";\n\nimport { compatibilityModeRuntimeOptions } from \"./compatibilityConfiguration.js\";\nimport type {\n\tCompatibilityMode,\n\tContainerSchema,\n\tIRootDataObject,\n\tLoadableObjectKind,\n\tLoadableObjectKindRecord,\n\tLoadableObjectRecord,\n} from \"./types.js\";\nimport {\n\tisDataObjectKind,\n\tisSharedObjectKind,\n\tparseDataObjectsFromSharedObjects,\n} from \"./utils.js\";\n\n/**\n * Input props for {@link RootDataObject.initializingFirstTime}.\n */\nexport interface RootDataObjectProps {\n\t/**\n\t * Initial object structure with which the {@link RootDataObject} will be first-time initialized.\n\t *\n\t * @see {@link RootDataObject.initializingFirstTime}\n\t */\n\treadonly initialObjects: LoadableObjectKindRecord;\n}\n\n/**\n * The entry-point/root collaborative object of the {@link IFluidContainer | Fluid Container}.\n * Abstracts the dynamic code required to build a Fluid Container into a static representation for end customers.\n */\nclass RootDataObject\n\textends DataObject<{ InitialState: RootDataObjectProps }>\n\timplements IRootDataObject\n{\n\tprivate readonly initialObjectsDirKey = \"initial-objects-key\";\n\tprivate readonly _initialObjects: LoadableObjectRecord = {};\n\n\tpublic get IRootDataObject(): IRootDataObject {\n\t\treturn this;\n\t}\n\n\tprivate get initialObjectsDir(): IDirectory {\n\t\tconst dir = this.root.getSubDirectory(this.initialObjectsDirKey);\n\t\tif (dir === undefined) {\n\t\t\tthrow new Error(\"InitialObjects sub-directory was not initialized\");\n\t\t}\n\t\treturn dir;\n\t}\n\n\t/**\n\t * The first time this object is initialized, creates each object identified in\n\t * {@link RootDataObjectProps.initialObjects} and stores them as unique values in the root directory.\n\t *\n\t * @see {@link @fluidframework/aqueduct#PureDataObject.initializingFirstTime}\n\t */\n\tprotected async initializingFirstTime(props: RootDataObjectProps): Promise<void> {\n\t\tthis.root.createSubDirectory(this.initialObjectsDirKey);\n\n\t\t// Create initial objects provided by the developer\n\t\tconst initialObjectsP: Promise<void>[] = [];\n\t\tfor (const [id, objectClass] of Object.entries(props.initialObjects)) {\n\t\t\tconst createObject = async (): Promise<void> => {\n\t\t\t\tconst obj = await this.create<IFluidLoadable>(\n\t\t\t\t\tobjectClass as SharedObjectKind<IFluidLoadable>,\n\t\t\t\t);\n\t\t\t\tthis.initialObjectsDir.set(id, obj.handle);\n\t\t\t};\n\t\t\tinitialObjectsP.push(createObject());\n\t\t}\n\n\t\tawait Promise.all(initialObjectsP);\n\t}\n\n\t/**\n\t * Every time an instance is initialized, loads all of the initial objects in the root directory so they can be\n\t * accessed immediately.\n\t *\n\t * @see {@link @fluidframework/aqueduct#PureDataObject.hasInitialized}\n\t */\n\tprotected async hasInitialized(): Promise<void> {\n\t\t// We will always load the initial objects so they are available to the developer\n\t\tconst loadInitialObjectsP: Promise<void>[] = [];\n\t\tfor (const [key, value] of this.initialObjectsDir.entries()) {\n\t\t\tconst loadDir = async (): Promise<void> => {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call\n\t\t\t\tconst obj: unknown = await value.get();\n\t\t\t\tObject.assign(this._initialObjects, { [key]: obj });\n\t\t\t};\n\t\t\tloadInitialObjectsP.push(loadDir());\n\t\t}\n\n\t\tawait Promise.all(loadInitialObjectsP);\n\t}\n\n\t/**\n\t * {@inheritDoc IRootDataObject.initialObjects}\n\t */\n\tpublic get initialObjects(): LoadableObjectRecord {\n\t\tif (Object.keys(this._initialObjects).length === 0) {\n\t\t\tthrow new Error(\"Initial Objects were not correctly initialized\");\n\t\t}\n\t\treturn this._initialObjects;\n\t}\n\n\t/**\n\t * {@inheritDoc IRootDataObject.create}\n\t */\n\tpublic async create<T>(objectClass: SharedObjectKind<T>): Promise<T> {\n\t\tconst internal = objectClass as unknown as LoadableObjectKind<T & IFluidLoadable>;\n\t\tif (isDataObjectKind(internal)) {\n\t\t\treturn this.createDataObject(internal);\n\t\t} else if (isSharedObjectKind(internal)) {\n\t\t\treturn this.createSharedObject(internal);\n\t\t}\n\t\tthrow new Error(\"Could not create new Fluid object because an unknown object was passed\");\n\t}\n\n\tprivate async createDataObject<T extends IFluidLoadable>(\n\t\tdataObjectClass: DataObjectKind<T>,\n\t): Promise<T> {\n\t\tconst factory = dataObjectClass.factory;\n\t\tconst packagePath = [...this.context.packagePath, factory.type];\n\t\tconst dataStore = await this.context.containerRuntime.createDataStore(packagePath);\n\t\tconst entryPoint = await dataStore.entryPoint.get();\n\t\treturn entryPoint as T;\n\t}\n\n\tprivate createSharedObject<T extends IFluidLoadable>(\n\t\tsharedObjectClass: ISharedObjectKind<T>,\n\t): T {\n\t\tconst factory = sharedObjectClass.getFactory();\n\t\tconst obj = this.runtime.createChannel(undefined, factory.type);\n\t\treturn obj as unknown as T;\n\t}\n}\n\nconst rootDataStoreId = \"rootDOId\";\n\n/**\n * Creates an {@link @fluidframework/aqueduct#BaseContainerRuntimeFactory} for a container with a single\n * {@link IRootDataObject}, which is constructed from the provided schema.\n *\n * @internal\n */\nexport function createDOProviderContainerRuntimeFactory(props: {\n\tschema: ContainerSchema;\n\tcompatibilityMode: CompatibilityMode;\n}): IRuntimeFactory {\n\treturn new DOProviderContainerRuntimeFactory(props.schema, props.compatibilityMode);\n}\n\n/**\n * Container code that provides a single {@link IRootDataObject}.\n *\n * @remarks\n *\n * This data object is dynamically customized (registry and initial objects) based on the schema provided.\n * to the container runtime factory.\n *\n * @internal\n */\nclass DOProviderContainerRuntimeFactory extends BaseContainerRuntimeFactory {\n\tprivate readonly rootDataObjectFactory: DataObjectFactory<\n\t\tRootDataObject,\n\t\t{\n\t\t\tInitialState: RootDataObjectProps;\n\t\t}\n\t>;\n\n\tprivate readonly initialObjects: LoadableObjectKindRecord;\n\n\tpublic constructor(schema: ContainerSchema, compatibilityMode: CompatibilityMode) {\n\t\tconst [registryEntries, sharedObjects] = parseDataObjectsFromSharedObjects(schema);\n\t\tconst rootDataObjectFactory = new DataObjectFactory(\n\t\t\t\"rootDO\",\n\t\t\tRootDataObject,\n\t\t\tsharedObjects,\n\t\t\t{},\n\t\t\tregistryEntries,\n\t\t);\n\t\tconst provideEntryPoint = async (\n\t\t\tcontainerRuntime: IContainerRuntime,\n\t\t\t// eslint-disable-next-line unicorn/consistent-function-scoping\n\t\t): Promise<FluidObject> => {\n\t\t\tconst entryPoint = await containerRuntime.getAliasedDataStoreEntryPoint(rootDataStoreId);\n\t\t\tif (entryPoint === undefined) {\n\t\t\t\tthrow new Error(`default dataStore [${rootDataStoreId}] must exist`);\n\t\t\t}\n\t\t\treturn entryPoint.get();\n\t\t};\n\t\tsuper({\n\t\t\tregistryEntries: [rootDataObjectFactory.registryEntry],\n\t\t\truntimeOptions: compatibilityModeRuntimeOptions[compatibilityMode],\n\t\t\tprovideEntryPoint,\n\t\t});\n\t\tthis.rootDataObjectFactory = rootDataObjectFactory;\n\t\tthis.initialObjects = schema.initialObjects;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/aqueduct#BaseContainerRuntimeFactory.containerInitializingFirstTime}\n\t */\n\tprotected async containerInitializingFirstTime(runtime: IContainerRuntime): Promise<void> {\n\t\t// The first time we create the container we create the RootDataObject\n\t\tawait this.rootDataObjectFactory.createRootInstance(rootDataStoreId, runtime, {\n\t\t\tinitialObjects: this.initialObjects,\n\t\t});\n\t}\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rootDataObject.d.ts","sourceRoot":"","sources":["../src/rootDataObject.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gDAAgD,CAAC;
|
|
1
|
+
{"version":3,"file":"rootDataObject.d.ts","sourceRoot":"","sources":["../src/rootDataObject.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gDAAgD,CAAC;AAUtF,OAAO,KAAK,EACX,iBAAiB,EACjB,eAAe,EAGf,wBAAwB,EAExB,MAAM,YAAY,CAAC;AAOpB;;GAEG;AACH,MAAM,WAAW,mBAAmB;IACnC;;;;OAIG;IACH,QAAQ,CAAC,cAAc,EAAE,wBAAwB,CAAC;CAClD;AAkHD;;;;;GAKG;AACH,wBAAgB,uCAAuC,CAAC,KAAK,EAAE;IAC9D,MAAM,EAAE,eAAe,CAAC;IACxB,iBAAiB,EAAE,iBAAiB,CAAC;CACrC,GAAG,eAAe,CAElB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rootDataObject.js","sourceRoot":"","sources":["../src/rootDataObject.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,2BAA2B,EAC3B,UAAU,EAEV,iBAAiB,GACjB,MAAM,mCAAmC,CAAC;AAQ3C,OAAO,EAAE,+BAA+B,EAAE,MAAM,iCAAiC,CAAC;AASlF,OAAO,EACN,gBAAgB,EAChB,kBAAkB,EAClB,iCAAiC,GACjC,MAAM,YAAY,CAAC;AAcpB;;;GAGG;AACH,MAAM,cACL,SAAQ,UAAiD;IAD1D;;QAIkB,yBAAoB,GAAG,qBAAqB,CAAC;QAC7C,oB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C;YACtD,cAAc,EAAE,+BAA+B,CAAC,iBAAiB,CAAC;YAClE,iBAAiB;SACjB,CAAC,CAAC;QACH,IAAI,CAAC,qBAAqB,GAAG,qBAAqB,CAAC;QACnD,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC;IAC7C,CAAC;IAED;;OAEG;IACO,KAAK,CAAC,8BAA8B,CAAC,OAA0B;QACxE,sEAAsE;QACtE,MAAM,IAAI,CAAC,qBAAqB,CAAC,kBAAkB,CAAC,eAAe,EAAE,OAAO,EAAE;YAC7E,cAAc,EAAE,IAAI,CAAC,cAAc;SACnC,CAAC,CAAC;IACJ,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tBaseContainerRuntimeFactory,\n\tDataObject,\n\ttype DataObjectKind,\n\tDataObjectFactory,\n} from \"@fluidframework/aqueduct/internal\";\nimport type { IRuntimeFactory } from \"@fluidframework/container-definitions/internal\";\nimport type { IContainerRuntime } from \"@fluidframework/container-runtime-definitions/internal\";\nimport type { FluidObject, IFluidLoadable } from \"@fluidframework/core-interfaces\";\nimport type { IDirectory } from \"@fluidframework/map/internal\";\nimport type { SharedObjectKind } from \"@fluidframework/shared-object-base\";\nimport type { ISharedObjectKind } from \"@fluidframework/shared-object-base/internal\";\n\nimport { compatibilityModeRuntimeOptions } from \"./compatibilityConfiguration.js\";\nimport type {\n\tCompatibilityMode,\n\tContainerSchema,\n\tIRootDataObject,\n\tLoadableObjectKind,\n\tLoadableObjectKindRecord,\n\tLoadableObjectRecord,\n} from \"./types.js\";\nimport {\n\tisDataObjectKind,\n\tisSharedObjectKind,\n\tparseDataObjectsFromSharedObjects,\n} from \"./utils.js\";\n\n/**\n * Input props for {@link RootDataObject.initializingFirstTime}.\n */\nexport interface RootDataObjectProps {\n\t/**\n\t * Initial object structure with which the {@link RootDataObject} will be first-time initialized.\n\t *\n\t * @see {@link RootDataObject.initializingFirstTime}\n\t */\n\treadonly initialObjects: LoadableObjectKindRecord;\n}\n\n/**\n * The entry-point/root collaborative object of the {@link IFluidContainer | Fluid Container}.\n * Abstracts the dynamic code required to build a Fluid Container into a static representation for end customers.\n */\nclass RootDataObject\n\textends DataObject<{ InitialState: RootDataObjectProps }>\n\timplements IRootDataObject\n{\n\tprivate readonly initialObjectsDirKey = \"initial-objects-key\";\n\tprivate readonly _initialObjects: LoadableObjectRecord = {};\n\n\tpublic get IRootDataObject(): IRootDataObject {\n\t\treturn this;\n\t}\n\n\tprivate get initialObjectsDir(): IDirectory {\n\t\tconst dir = this.root.getSubDirectory(this.initialObjectsDirKey);\n\t\tif (dir === undefined) {\n\t\t\tthrow new Error(\"InitialObjects sub-directory was not initialized\");\n\t\t}\n\t\treturn dir;\n\t}\n\n\t/**\n\t * The first time this object is initialized, creates each object identified in\n\t * {@link RootDataObjectProps.initialObjects} and stores them as unique values in the root directory.\n\t *\n\t * @see {@link @fluidframework/aqueduct#PureDataObject.initializingFirstTime}\n\t */\n\tprotected async initializingFirstTime(props: RootDataObjectProps): Promise<void> {\n\t\tthis.root.createSubDirectory(this.initialObjectsDirKey);\n\n\t\t// Create initial objects provided by the developer\n\t\tconst initialObjectsP: Promise<void>[] = [];\n\t\tfor (const [id, objectClass] of Object.entries(props.initialObjects)) {\n\t\t\tconst createObject = async (): Promise<void> => {\n\t\t\t\tconst obj = await this.create<IFluidLoadable>(\n\t\t\t\t\tobjectClass as SharedObjectKind<IFluidLoadable>,\n\t\t\t\t);\n\t\t\t\tthis.initialObjectsDir.set(id, obj.handle);\n\t\t\t};\n\t\t\tinitialObjectsP.push(createObject());\n\t\t}\n\n\t\tawait Promise.all(initialObjectsP);\n\t}\n\n\t/**\n\t * Every time an instance is initialized, loads all of the initial objects in the root directory so they can be\n\t * accessed immediately.\n\t *\n\t * @see {@link @fluidframework/aqueduct#PureDataObject.hasInitialized}\n\t */\n\tprotected async hasInitialized(): Promise<void> {\n\t\t// We will always load the initial objects so they are available to the developer\n\t\tconst loadInitialObjectsP: Promise<void>[] = [];\n\t\tfor (const [key, value] of this.initialObjectsDir.entries()) {\n\t\t\tconst loadDir = async (): Promise<void> => {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call\n\t\t\t\tconst obj: unknown = await value.get();\n\t\t\t\tObject.assign(this._initialObjects, { [key]: obj });\n\t\t\t};\n\t\t\tloadInitialObjectsP.push(loadDir());\n\t\t}\n\n\t\tawait Promise.all(loadInitialObjectsP);\n\t}\n\n\t/**\n\t * {@inheritDoc IRootDataObject.initialObjects}\n\t */\n\tpublic get initialObjects(): LoadableObjectRecord {\n\t\tif (Object.keys(this._initialObjects).length === 0) {\n\t\t\tthrow new Error(\"Initial Objects were not correctly initialized\");\n\t\t}\n\t\treturn this._initialObjects;\n\t}\n\n\t/**\n\t * {@inheritDoc IRootDataObject.create}\n\t */\n\tpublic async create<T>(objectClass: SharedObjectKind<T>): Promise<T> {\n\t\tconst internal = objectClass as unknown as LoadableObjectKind<T & IFluidLoadable>;\n\t\tif (isDataObjectKind(internal)) {\n\t\t\treturn this.createDataObject(internal);\n\t\t} else if (isSharedObjectKind(internal)) {\n\t\t\treturn this.createSharedObject(internal);\n\t\t}\n\t\tthrow new Error(\"Could not create new Fluid object because an unknown object was passed\");\n\t}\n\n\tprivate async createDataObject<T extends IFluidLoadable>(\n\t\tdataObjectClass: DataObjectKind<T>,\n\t): Promise<T> {\n\t\tconst factory = dataObjectClass.factory;\n\t\tconst packagePath = [...this.context.packagePath, factory.type];\n\t\tconst dataStore = await this.context.containerRuntime.createDataStore(packagePath);\n\t\tconst entryPoint = await dataStore.entryPoint.get();\n\t\treturn entryPoint as T;\n\t}\n\n\tprivate createSharedObject<T extends IFluidLoadable>(\n\t\tsharedObjectClass: ISharedObjectKind<T>,\n\t): T {\n\t\tconst factory = sharedObjectClass.getFactory();\n\t\tconst obj = this.runtime.createChannel(undefined, factory.type);\n\t\treturn obj as unknown as T;\n\t}\n}\n\nconst rootDataStoreId = \"rootDOId\";\n\n/**\n * Creates an {@link @fluidframework/aqueduct#BaseContainerRuntimeFactory} for a container with a single\n * {@link IRootDataObject}, which is constructed from the provided schema.\n *\n * @internal\n */\nexport function createDOProviderContainerRuntimeFactory(props: {\n\tschema: ContainerSchema;\n\tcompatibilityMode: CompatibilityMode;\n}): IRuntimeFactory {\n\treturn new DOProviderContainerRuntimeFactory(props.schema, props.compatibilityMode);\n}\n\n/**\n * Container code that provides a single {@link IRootDataObject}.\n *\n * @remarks\n *\n * This data object is dynamically customized (registry and initial objects) based on the schema provided.\n * to the container runtime factory.\n *\n * @internal\n */\nclass DOProviderContainerRuntimeFactory extends BaseContainerRuntimeFactory {\n\tprivate readonly rootDataObjectFactory: DataObjectFactory<\n\t\tRootDataObject,\n\t\t{\n\t\t\tInitialState: RootDataObjectProps;\n\t\t}\n\t>;\n\n\tprivate readonly initialObjects: LoadableObjectKindRecord;\n\n\tpublic constructor(schema: ContainerSchema, compatibilityMode: CompatibilityMode) {\n\t\tconst [registryEntries, sharedObjects] = parseDataObjectsFromSharedObjects(schema);\n\t\tconst rootDataObjectFactory = new DataObjectFactory(\n\t\t\t\"rootDO\",\n\t\t\tRootDataObject,\n\t\t\tsharedObjects,\n\t\t\t{},\n\t\t\tregistryEntries,\n\t\t);\n\t\tconst provideEntryPoint = async (\n\t\t\tcontainerRuntime: IContainerRuntime,\n\t\t\t// eslint-disable-next-line unicorn/consistent-function-scoping\n\t\t): Promise<FluidObject> => {\n\t\t\tconst entryPoint = await containerRuntime.getAliasedDataStoreEntryPoint(rootDataStoreId);\n\t\t\tif (entryPoint === undefined) {\n\t\t\t\tthrow new Error(`default dataStore [${rootDataStoreId}] must exist`);\n\t\t\t}\n\t\t\treturn entryPoint.get();\n\t\t};\n\t\tsuper({\n\t\t\tregistryEntries: [rootDataObjectFactory.registryEntry],\n\t\t\truntimeOptions: compatibilityModeRuntimeOptions[compatibilityMode],\n\t\t\tprovideEntryPoint,\n\t\t});\n\t\tthis.rootDataObjectFactory = rootDataObjectFactory;\n\t\tthis.initialObjects = schema.initialObjects;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/aqueduct#BaseContainerRuntimeFactory.containerInitializingFirstTime}\n\t */\n\tprotected async containerInitializingFirstTime(runtime: IContainerRuntime): Promise<void> {\n\t\t// The first time we create the container we create the RootDataObject\n\t\tawait this.rootDataObjectFactory.createRootInstance(rootDataStoreId, runtime, {\n\t\t\tinitialObjects: this.initialObjects,\n\t\t});\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"rootDataObject.js","sourceRoot":"","sources":["../src/rootDataObject.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,2BAA2B,EAC3B,UAAU,EAEV,iBAAiB,GACjB,MAAM,mCAAmC,CAAC;AAU3C,OAAO,EAAE,+BAA+B,EAAE,MAAM,iCAAiC,CAAC;AASlF,OAAO,EACN,gBAAgB,EAChB,kBAAkB,EAClB,iCAAiC,GACjC,MAAM,YAAY,CAAC;AAcpB;;;GAGG;AACH,MAAM,cACL,SAAQ,UAAiD;IAD1D;;QAIkB,yBAAoB,GAAG,qBAAqB,CAAC;QAC7C,oBAAe,GAAyB,EAAE,CAAC;IAmG7D,CAAC;IAjGA,IAAW,eAAe;QACzB,OAAO,IAAI,CAAC;IACb,CAAC;IAED,IAAY,iBAAiB;QAC5B,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;QACjE,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;YACvB,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;QACrE,CAAC;QACD,OAAO,GAAG,CAAC;IACZ,CAAC;IAED;;;;;OAKG;IACO,KAAK,CAAC,qBAAqB,CAAC,KAA0B;QAC/D,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;QAExD,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IAAI,iCAAiC,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,iBAAiB,CAAC,CAAC;AACrF,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,iCAAkC,SAAQ,2BAA2B;IAU1E,YAAmB,MAAuB,EAAE,iBAAoC;QAC/E,MAAM,CAAC,eAAe,EAAE,aAAa,CAAC,GAAG,iCAAiC,CAAC,MAAM,CAAC,CAAC;QACnF,MAAM,qBAAqB,GAAG,IAAI,iBAAiB,CAClD,QAAQ,EACR,cAAc,EACd,aAAa,EACb,EAAE,EACF,eAAe,CACf,CAAC;QACF,MAAM,iBAAiB,GAAG,KAAK,EAC9B,gBAAmC,EAEZ,EAAE;YACzB,MAAM,UAAU,GAAG,MAAM,gBAAgB,CAAC,6BAA6B,CAAC,eAAe,CAAC,CAAC;YACzF,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;gBAC9B,MAAM,IAAI,KAAK,CAAC,sBAAsB,eAAe,cAAc,CAAC,CAAC;YACtE,CAAC;YACD,OAAO,UAAU,CAAC,GAAG,EAAE,CAAC;QACzB,CAAC,CAAC;QACF,KAAK,CAAC;YACL,eAAe,EAAE,CAAC,qBAAqB,CAAC,aAAa,CAAC;YACtD,cAAc,EAAE,+BAA+B,CAAC,iBAAiB,CAAC;YAClE,iBAAiB;SACjB,CAAC,CAAC;QACH,IAAI,CAAC,qBAAqB,GAAG,qBAAqB,CAAC;QACnD,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC;IAC7C,CAAC;IAED;;OAEG;IACO,KAAK,CAAC,8BAA8B,CAAC,OAA0B;QACxE,sEAAsE;QACtE,MAAM,IAAI,CAAC,qBAAqB,CAAC,kBAAkB,CAAC,eAAe,EAAE,OAAO,EAAE;YAC7E,cAAc,EAAE,IAAI,CAAC,cAAc;SACnC,CAAC,CAAC;IACJ,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tBaseContainerRuntimeFactory,\n\tDataObject,\n\ttype DataObjectKind,\n\tDataObjectFactory,\n} from \"@fluidframework/aqueduct/internal\";\nimport type { IRuntimeFactory } from \"@fluidframework/container-definitions/internal\";\nimport type { IContainerRuntime } from \"@fluidframework/container-runtime-definitions/internal\";\nimport type { FluidObject, IFluidLoadable } from \"@fluidframework/core-interfaces\";\nimport type { IDirectory } from \"@fluidframework/map/internal\";\nimport type {\n\tISharedObjectKind,\n\tSharedObjectKind,\n} from \"@fluidframework/shared-object-base/internal\";\n\nimport { compatibilityModeRuntimeOptions } from \"./compatibilityConfiguration.js\";\nimport type {\n\tCompatibilityMode,\n\tContainerSchema,\n\tIRootDataObject,\n\tLoadableObjectKind,\n\tLoadableObjectKindRecord,\n\tLoadableObjectRecord,\n} from \"./types.js\";\nimport {\n\tisDataObjectKind,\n\tisSharedObjectKind,\n\tparseDataObjectsFromSharedObjects,\n} from \"./utils.js\";\n\n/**\n * Input props for {@link RootDataObject.initializingFirstTime}.\n */\nexport interface RootDataObjectProps {\n\t/**\n\t * Initial object structure with which the {@link RootDataObject} will be first-time initialized.\n\t *\n\t * @see {@link RootDataObject.initializingFirstTime}\n\t */\n\treadonly initialObjects: LoadableObjectKindRecord;\n}\n\n/**\n * The entry-point/root collaborative object of the {@link IFluidContainer | Fluid Container}.\n * Abstracts the dynamic code required to build a Fluid Container into a static representation for end customers.\n */\nclass RootDataObject\n\textends DataObject<{ InitialState: RootDataObjectProps }>\n\timplements IRootDataObject\n{\n\tprivate readonly initialObjectsDirKey = \"initial-objects-key\";\n\tprivate readonly _initialObjects: LoadableObjectRecord = {};\n\n\tpublic get IRootDataObject(): IRootDataObject {\n\t\treturn this;\n\t}\n\n\tprivate get initialObjectsDir(): IDirectory {\n\t\tconst dir = this.root.getSubDirectory(this.initialObjectsDirKey);\n\t\tif (dir === undefined) {\n\t\t\tthrow new Error(\"InitialObjects sub-directory was not initialized\");\n\t\t}\n\t\treturn dir;\n\t}\n\n\t/**\n\t * The first time this object is initialized, creates each object identified in\n\t * {@link RootDataObjectProps.initialObjects} and stores them as unique values in the root directory.\n\t *\n\t * @see {@link @fluidframework/aqueduct#PureDataObject.initializingFirstTime}\n\t */\n\tprotected async initializingFirstTime(props: RootDataObjectProps): Promise<void> {\n\t\tthis.root.createSubDirectory(this.initialObjectsDirKey);\n\n\t\t// Create initial objects provided by the developer\n\t\tconst initialObjectsP: Promise<void>[] = [];\n\t\tfor (const [id, objectClass] of Object.entries(props.initialObjects)) {\n\t\t\tconst createObject = async (): Promise<void> => {\n\t\t\t\tconst obj = await this.create<IFluidLoadable>(\n\t\t\t\t\tobjectClass as SharedObjectKind<IFluidLoadable>,\n\t\t\t\t);\n\t\t\t\tthis.initialObjectsDir.set(id, obj.handle);\n\t\t\t};\n\t\t\tinitialObjectsP.push(createObject());\n\t\t}\n\n\t\tawait Promise.all(initialObjectsP);\n\t}\n\n\t/**\n\t * Every time an instance is initialized, loads all of the initial objects in the root directory so they can be\n\t * accessed immediately.\n\t *\n\t * @see {@link @fluidframework/aqueduct#PureDataObject.hasInitialized}\n\t */\n\tprotected async hasInitialized(): Promise<void> {\n\t\t// We will always load the initial objects so they are available to the developer\n\t\tconst loadInitialObjectsP: Promise<void>[] = [];\n\t\tfor (const [key, value] of this.initialObjectsDir.entries()) {\n\t\t\tconst loadDir = async (): Promise<void> => {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call\n\t\t\t\tconst obj: unknown = await value.get();\n\t\t\t\tObject.assign(this._initialObjects, { [key]: obj });\n\t\t\t};\n\t\t\tloadInitialObjectsP.push(loadDir());\n\t\t}\n\n\t\tawait Promise.all(loadInitialObjectsP);\n\t}\n\n\t/**\n\t * {@inheritDoc IRootDataObject.initialObjects}\n\t */\n\tpublic get initialObjects(): LoadableObjectRecord {\n\t\tif (Object.keys(this._initialObjects).length === 0) {\n\t\t\tthrow new Error(\"Initial Objects were not correctly initialized\");\n\t\t}\n\t\treturn this._initialObjects;\n\t}\n\n\t/**\n\t * {@inheritDoc IRootDataObject.create}\n\t */\n\tpublic async create<T>(objectClass: SharedObjectKind<T>): Promise<T> {\n\t\tconst internal = objectClass as unknown as LoadableObjectKind<T & IFluidLoadable>;\n\t\tif (isDataObjectKind(internal)) {\n\t\t\treturn this.createDataObject(internal);\n\t\t} else if (isSharedObjectKind(internal)) {\n\t\t\treturn this.createSharedObject(internal);\n\t\t}\n\t\tthrow new Error(\"Could not create new Fluid object because an unknown object was passed\");\n\t}\n\n\tprivate async createDataObject<T extends IFluidLoadable>(\n\t\tdataObjectClass: DataObjectKind<T>,\n\t): Promise<T> {\n\t\tconst factory = dataObjectClass.factory;\n\t\tconst packagePath = [...this.context.packagePath, factory.type];\n\t\tconst dataStore = await this.context.containerRuntime.createDataStore(packagePath);\n\t\tconst entryPoint = await dataStore.entryPoint.get();\n\t\treturn entryPoint as T;\n\t}\n\n\tprivate createSharedObject<T extends IFluidLoadable>(\n\t\tsharedObjectClass: ISharedObjectKind<T>,\n\t): T {\n\t\tconst factory = sharedObjectClass.getFactory();\n\t\tconst obj = this.runtime.createChannel(undefined, factory.type);\n\t\treturn obj as unknown as T;\n\t}\n}\n\nconst rootDataStoreId = \"rootDOId\";\n\n/**\n * Creates an {@link @fluidframework/aqueduct#BaseContainerRuntimeFactory} for a container with a single\n * {@link IRootDataObject}, which is constructed from the provided schema.\n *\n * @internal\n */\nexport function createDOProviderContainerRuntimeFactory(props: {\n\tschema: ContainerSchema;\n\tcompatibilityMode: CompatibilityMode;\n}): IRuntimeFactory {\n\treturn new DOProviderContainerRuntimeFactory(props.schema, props.compatibilityMode);\n}\n\n/**\n * Container code that provides a single {@link IRootDataObject}.\n *\n * @remarks\n *\n * This data object is dynamically customized (registry and initial objects) based on the schema provided.\n * to the container runtime factory.\n *\n * @internal\n */\nclass DOProviderContainerRuntimeFactory extends BaseContainerRuntimeFactory {\n\tprivate readonly rootDataObjectFactory: DataObjectFactory<\n\t\tRootDataObject,\n\t\t{\n\t\t\tInitialState: RootDataObjectProps;\n\t\t}\n\t>;\n\n\tprivate readonly initialObjects: LoadableObjectKindRecord;\n\n\tpublic constructor(schema: ContainerSchema, compatibilityMode: CompatibilityMode) {\n\t\tconst [registryEntries, sharedObjects] = parseDataObjectsFromSharedObjects(schema);\n\t\tconst rootDataObjectFactory = new DataObjectFactory(\n\t\t\t\"rootDO\",\n\t\t\tRootDataObject,\n\t\t\tsharedObjects,\n\t\t\t{},\n\t\t\tregistryEntries,\n\t\t);\n\t\tconst provideEntryPoint = async (\n\t\t\tcontainerRuntime: IContainerRuntime,\n\t\t\t// eslint-disable-next-line unicorn/consistent-function-scoping\n\t\t): Promise<FluidObject> => {\n\t\t\tconst entryPoint = await containerRuntime.getAliasedDataStoreEntryPoint(rootDataStoreId);\n\t\t\tif (entryPoint === undefined) {\n\t\t\t\tthrow new Error(`default dataStore [${rootDataStoreId}] must exist`);\n\t\t\t}\n\t\t\treturn entryPoint.get();\n\t\t};\n\t\tsuper({\n\t\t\tregistryEntries: [rootDataObjectFactory.registryEntry],\n\t\t\truntimeOptions: compatibilityModeRuntimeOptions[compatibilityMode],\n\t\t\tprovideEntryPoint,\n\t\t});\n\t\tthis.rootDataObjectFactory = rootDataObjectFactory;\n\t\tthis.initialObjects = schema.initialObjects;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/aqueduct#BaseContainerRuntimeFactory.containerInitializingFirstTime}\n\t */\n\tprotected async containerInitializingFirstTime(runtime: IContainerRuntime): Promise<void> {\n\t\t// The first time we create the container we create the RootDataObject\n\t\tawait this.rootDataObjectFactory.createRootInstance(rootDataStoreId, runtime, {\n\t\t\tinitialObjects: this.initialObjects,\n\t\t});\n\t}\n}\n"]}
|
package/lib/tsdoc-metadata.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/fluid-static",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.31.1",
|
|
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": {
|
|
@@ -59,33 +59,33 @@
|
|
|
59
59
|
"temp-directory": "nyc/.nyc_output"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@fluid-internal/client-utils": "~2.
|
|
63
|
-
"@fluidframework/aqueduct": "~2.
|
|
64
|
-
"@fluidframework/container-definitions": "~2.
|
|
65
|
-
"@fluidframework/container-loader": "~2.
|
|
66
|
-
"@fluidframework/container-runtime": "~2.
|
|
67
|
-
"@fluidframework/container-runtime-definitions": "~2.
|
|
68
|
-
"@fluidframework/core-interfaces": "~2.
|
|
69
|
-
"@fluidframework/datastore-definitions": "~2.
|
|
70
|
-
"@fluidframework/driver-definitions": "~2.
|
|
71
|
-
"@fluidframework/request-handler": "~2.
|
|
72
|
-
"@fluidframework/runtime-definitions": "~2.
|
|
73
|
-
"@fluidframework/runtime-utils": "~2.
|
|
74
|
-
"@fluidframework/shared-object-base": "~2.
|
|
75
|
-
"@fluidframework/telemetry-utils": "~2.
|
|
62
|
+
"@fluid-internal/client-utils": "~2.31.1",
|
|
63
|
+
"@fluidframework/aqueduct": "~2.31.1",
|
|
64
|
+
"@fluidframework/container-definitions": "~2.31.1",
|
|
65
|
+
"@fluidframework/container-loader": "~2.31.1",
|
|
66
|
+
"@fluidframework/container-runtime": "~2.31.1",
|
|
67
|
+
"@fluidframework/container-runtime-definitions": "~2.31.1",
|
|
68
|
+
"@fluidframework/core-interfaces": "~2.31.1",
|
|
69
|
+
"@fluidframework/datastore-definitions": "~2.31.1",
|
|
70
|
+
"@fluidframework/driver-definitions": "~2.31.1",
|
|
71
|
+
"@fluidframework/request-handler": "~2.31.1",
|
|
72
|
+
"@fluidframework/runtime-definitions": "~2.31.1",
|
|
73
|
+
"@fluidframework/runtime-utils": "~2.31.1",
|
|
74
|
+
"@fluidframework/shared-object-base": "~2.31.1",
|
|
75
|
+
"@fluidframework/telemetry-utils": "~2.31.1"
|
|
76
76
|
},
|
|
77
77
|
"devDependencies": {
|
|
78
78
|
"@arethetypeswrong/cli": "^0.17.1",
|
|
79
79
|
"@biomejs/biome": "~1.9.3",
|
|
80
|
-
"@fluid-internal/mocha-test-setup": "~2.
|
|
80
|
+
"@fluid-internal/mocha-test-setup": "~2.31.1",
|
|
81
81
|
"@fluid-tools/build-cli": "^0.54.0",
|
|
82
82
|
"@fluidframework/build-common": "^2.0.3",
|
|
83
83
|
"@fluidframework/build-tools": "^0.54.0",
|
|
84
84
|
"@fluidframework/eslint-config-fluid": "^5.7.3",
|
|
85
|
-
"@fluidframework/fluid-static-previous": "npm:@fluidframework/fluid-static@2.
|
|
86
|
-
"@fluidframework/map": "~2.
|
|
87
|
-
"@fluidframework/sequence": "~2.
|
|
88
|
-
"@microsoft/api-extractor": "7.
|
|
85
|
+
"@fluidframework/fluid-static-previous": "npm:@fluidframework/fluid-static@2.31.0",
|
|
86
|
+
"@fluidframework/map": "~2.31.1",
|
|
87
|
+
"@fluidframework/sequence": "~2.31.1",
|
|
88
|
+
"@microsoft/api-extractor": "7.50.1",
|
|
89
89
|
"@types/mocha": "^10.0.10",
|
|
90
90
|
"@types/node": "^18.19.0",
|
|
91
91
|
"c8": "^8.0.1",
|
|
@@ -96,7 +96,6 @@
|
|
|
96
96
|
"mocha": "^10.8.2",
|
|
97
97
|
"mocha-multi-reporters": "^1.5.1",
|
|
98
98
|
"moment": "^2.21.0",
|
|
99
|
-
"prettier": "~3.0.3",
|
|
100
99
|
"rimraf": "^4.4.0",
|
|
101
100
|
"typescript": "~5.4.5"
|
|
102
101
|
},
|
|
@@ -123,14 +122,12 @@
|
|
|
123
122
|
"check:exports:cjs:public": "api-extractor run --config api-extractor/api-extractor-lint-public.cjs.json",
|
|
124
123
|
"check:exports:esm:public": "api-extractor run --config api-extractor/api-extractor-lint-public.esm.json",
|
|
125
124
|
"check:format": "npm run check:biome",
|
|
126
|
-
"check:prettier": "prettier --check . --cache --ignore-path ../../../.prettierignore",
|
|
127
125
|
"ci:build:docs": "api-extractor run",
|
|
128
126
|
"clean": "rimraf --glob dist lib {alpha,beta,internal,legacy}.d.ts \"**/*.tsbuildinfo\" \"**/*.build.log\" _api-extractor-temp nyc",
|
|
129
127
|
"eslint": "eslint --format stylish src",
|
|
130
128
|
"eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
|
|
131
129
|
"format": "npm run format:biome",
|
|
132
130
|
"format:biome": "biome check . --write",
|
|
133
|
-
"format:prettier": "prettier --write . --cache --ignore-path ../../../.prettierignore",
|
|
134
131
|
"lint": "fluid-build . --task lint",
|
|
135
132
|
"lint:fix": "fluid-build . --task eslint:fix --task format",
|
|
136
133
|
"test": "npm run test:mocha",
|
package/src/rootDataObject.ts
CHANGED
|
@@ -13,8 +13,10 @@ import type { IRuntimeFactory } from "@fluidframework/container-definitions/inte
|
|
|
13
13
|
import type { IContainerRuntime } from "@fluidframework/container-runtime-definitions/internal";
|
|
14
14
|
import type { FluidObject, IFluidLoadable } from "@fluidframework/core-interfaces";
|
|
15
15
|
import type { IDirectory } from "@fluidframework/map/internal";
|
|
16
|
-
import type {
|
|
17
|
-
|
|
16
|
+
import type {
|
|
17
|
+
ISharedObjectKind,
|
|
18
|
+
SharedObjectKind,
|
|
19
|
+
} from "@fluidframework/shared-object-base/internal";
|
|
18
20
|
|
|
19
21
|
import { compatibilityModeRuntimeOptions } from "./compatibilityConfiguration.js";
|
|
20
22
|
import type {
|