@fluidframework/datastore 1.4.0-121020 → 2.0.0-dev-rc.1.0.0.224419
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/.eslintrc.js +5 -7
- package/.mocharc.js +12 -0
- package/CHANGELOG.md +273 -0
- package/README.md +41 -0
- package/api-extractor-lint.json +4 -0
- package/api-extractor.json +2 -2
- package/api-report/datastore.api.md +168 -0
- package/dist/channelContext.cjs +86 -0
- package/dist/channelContext.cjs.map +1 -0
- package/dist/channelContext.d.ts +15 -9
- package/dist/channelContext.d.ts.map +1 -1
- package/dist/{channelDeltaConnection.js → channelDeltaConnection.cjs} +14 -15
- package/dist/channelDeltaConnection.cjs.map +1 -0
- package/dist/channelDeltaConnection.d.ts +4 -5
- package/dist/channelDeltaConnection.d.ts.map +1 -1
- package/dist/{channelStorageService.js → channelStorageService.cjs} +13 -16
- package/dist/channelStorageService.cjs.map +1 -0
- package/dist/channelStorageService.d.ts +2 -2
- package/dist/channelStorageService.d.ts.map +1 -1
- package/dist/{dataStoreRuntime.js → dataStoreRuntime.cjs} +302 -225
- package/dist/dataStoreRuntime.cjs.map +1 -0
- package/dist/dataStoreRuntime.d.ts +81 -37
- package/dist/dataStoreRuntime.d.ts.map +1 -1
- package/dist/datastore-alpha.d.ts +317 -0
- package/dist/datastore-beta.d.ts +47 -0
- package/dist/datastore-public.d.ts +47 -0
- package/dist/datastore-untrimmed.d.ts +324 -0
- package/dist/{fluidHandle.js → fluidHandle.cjs} +44 -16
- package/dist/fluidHandle.cjs.map +1 -0
- package/dist/fluidHandle.d.ts +33 -6
- package/dist/fluidHandle.d.ts.map +1 -1
- package/dist/index.cjs +15 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/localChannelContext.cjs +190 -0
- package/dist/localChannelContext.cjs.map +1 -0
- package/dist/localChannelContext.d.ts +12 -21
- package/dist/localChannelContext.d.ts.map +1 -1
- package/dist/{localChannelStorageService.js → localChannelStorageService.cjs} +3 -3
- package/dist/localChannelStorageService.cjs.map +1 -0
- package/dist/localChannelStorageService.d.ts.map +1 -1
- package/dist/remoteChannelContext.cjs +124 -0
- package/dist/remoteChannelContext.cjs.map +1 -0
- package/dist/remoteChannelContext.d.ts +5 -10
- package/dist/remoteChannelContext.d.ts.map +1 -1
- package/dist/tsdoc-metadata.json +11 -0
- package/lib/{channelContext.d.ts → channelContext.d.mts} +16 -10
- package/lib/channelContext.d.mts.map +1 -0
- package/lib/channelContext.mjs +78 -0
- package/lib/channelContext.mjs.map +1 -0
- package/lib/{channelDeltaConnection.d.ts → channelDeltaConnection.d.mts} +4 -5
- package/lib/channelDeltaConnection.d.mts.map +1 -0
- package/lib/{channelDeltaConnection.js → channelDeltaConnection.mjs} +11 -12
- package/lib/channelDeltaConnection.mjs.map +1 -0
- package/lib/{channelStorageService.d.ts → channelStorageService.d.mts} +2 -2
- package/lib/channelStorageService.d.mts.map +1 -0
- package/lib/{channelStorageService.js → channelStorageService.mjs} +13 -16
- package/lib/channelStorageService.mjs.map +1 -0
- package/lib/{dataStoreRuntime.d.ts → dataStoreRuntime.d.mts} +81 -37
- package/lib/dataStoreRuntime.d.mts.map +1 -0
- package/lib/{dataStoreRuntime.js → dataStoreRuntime.mjs} +286 -209
- package/lib/dataStoreRuntime.mjs.map +1 -0
- package/lib/datastore-alpha.d.mts +317 -0
- package/lib/datastore-beta.d.mts +47 -0
- package/lib/datastore-public.d.mts +47 -0
- package/lib/datastore-untrimmed.d.mts +324 -0
- package/lib/fluidHandle.d.mts +57 -0
- package/lib/fluidHandle.d.mts.map +1 -0
- package/lib/{fluidHandle.js → fluidHandle.mjs} +44 -16
- package/lib/fluidHandle.mjs.map +1 -0
- package/lib/index.d.mts +7 -0
- package/lib/index.d.mts.map +1 -0
- package/lib/index.mjs +7 -0
- package/lib/index.mjs.map +1 -0
- package/lib/{localChannelContext.d.ts → localChannelContext.d.mts} +13 -22
- package/lib/localChannelContext.d.mts.map +1 -0
- package/lib/{localChannelContext.js → localChannelContext.mjs} +73 -85
- package/lib/localChannelContext.mjs.map +1 -0
- package/lib/localChannelStorageService.d.mts.map +1 -0
- package/lib/{localChannelStorageService.js → localChannelStorageService.mjs} +2 -2
- package/lib/localChannelStorageService.mjs.map +1 -0
- package/lib/{remoteChannelContext.d.ts → remoteChannelContext.d.mts} +7 -12
- package/lib/remoteChannelContext.d.mts.map +1 -0
- package/lib/remoteChannelContext.mjs +120 -0
- package/lib/remoteChannelContext.mjs.map +1 -0
- package/package.json +107 -72
- package/{lib/index.js → prettier.config.cjs} +4 -3
- package/src/channelContext.ts +168 -71
- package/src/channelDeltaConnection.ts +52 -47
- package/src/channelStorageService.ts +59 -55
- package/src/dataStoreRuntime.ts +1158 -983
- package/src/fluidHandle.ts +92 -64
- package/src/index.ts +8 -2
- package/src/localChannelContext.ts +278 -272
- package/src/localChannelStorageService.ts +48 -46
- package/src/remoteChannelContext.ts +237 -300
- package/tsc-multi.test.json +4 -0
- package/tsconfig.json +11 -13
- package/dist/channelContext.js +0 -35
- package/dist/channelContext.js.map +0 -1
- package/dist/channelDeltaConnection.js.map +0 -1
- package/dist/channelStorageService.js.map +0 -1
- package/dist/dataStoreRuntime.js.map +0 -1
- package/dist/fluidHandle.js.map +0 -1
- package/dist/index.js +0 -19
- package/dist/index.js.map +0 -1
- package/dist/localChannelContext.js +0 -202
- package/dist/localChannelContext.js.map +0 -1
- package/dist/localChannelStorageService.js.map +0 -1
- package/dist/packageVersion.d.ts +0 -9
- package/dist/packageVersion.d.ts.map +0 -1
- package/dist/packageVersion.js +0 -12
- package/dist/packageVersion.js.map +0 -1
- package/dist/remoteChannelContext.js +0 -207
- package/dist/remoteChannelContext.js.map +0 -1
- package/lib/channelContext.d.ts.map +0 -1
- package/lib/channelContext.js +0 -29
- package/lib/channelContext.js.map +0 -1
- package/lib/channelDeltaConnection.d.ts.map +0 -1
- package/lib/channelDeltaConnection.js.map +0 -1
- package/lib/channelStorageService.d.ts.map +0 -1
- package/lib/channelStorageService.js.map +0 -1
- package/lib/dataStoreRuntime.d.ts.map +0 -1
- package/lib/dataStoreRuntime.js.map +0 -1
- package/lib/fluidHandle.d.ts +0 -30
- package/lib/fluidHandle.d.ts.map +0 -1
- package/lib/fluidHandle.js.map +0 -1
- package/lib/index.d.ts +0 -7
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/localChannelContext.d.ts.map +0 -1
- package/lib/localChannelContext.js.map +0 -1
- package/lib/localChannelStorageService.d.ts.map +0 -1
- package/lib/localChannelStorageService.js.map +0 -1
- package/lib/packageVersion.d.ts +0 -9
- package/lib/packageVersion.d.ts.map +0 -1
- package/lib/packageVersion.js +0 -9
- package/lib/packageVersion.js.map +0 -1
- package/lib/remoteChannelContext.d.ts.map +0 -1
- package/lib/remoteChannelContext.js +0 -203
- package/lib/remoteChannelContext.js.map +0 -1
- package/src/packageVersion.ts +0 -9
- package/tsconfig.esnext.json +0 -7
- /package/lib/{localChannelStorageService.d.ts → localChannelStorageService.d.mts} +0 -0
package/.eslintrc.js
CHANGED
|
@@ -4,10 +4,8 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
module.exports = {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
}
|
|
7
|
+
extends: [require.resolve("@fluidframework/eslint-config-fluid/minimal"), "prettier"],
|
|
8
|
+
parserOptions: {
|
|
9
|
+
project: ["./tsconfig.json", "./src/test/tsconfig.json"],
|
|
10
|
+
},
|
|
11
|
+
};
|
package/.mocharc.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
"use strict";
|
|
7
|
+
|
|
8
|
+
const getFluidTestMochaConfig = require("@fluidframework/mocha-test-setup/mocharc-common");
|
|
9
|
+
|
|
10
|
+
const packageDir = __dirname;
|
|
11
|
+
const config = getFluidTestMochaConfig(packageDir);
|
|
12
|
+
module.exports = config;
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
# @fluidframework/datastore
|
|
2
|
+
|
|
3
|
+
## 2.0.0-internal.8.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- datastore: Removed `FluidDataStoreRuntime.load(...)` [9a451d4946](https://github.com/microsoft/FluidFramework/commits/9a451d4946b5c51a52e4d1ab5bf51e7b285b0d74)
|
|
8
|
+
|
|
9
|
+
The static method `FluidDataStoreRuntime.load(...)` has been removed. Please migrate all usage of this method to
|
|
10
|
+
`FluidDataStoreRuntime` constructor.
|
|
11
|
+
|
|
12
|
+
- container-definitions: Fix ISnapshotTreeWithBlobContents and mark internal [9a451d4946](https://github.com/microsoft/FluidFramework/commits/9a451d4946b5c51a52e4d1ab5bf51e7b285b0d74)
|
|
13
|
+
|
|
14
|
+
`ISnapshotTreeWithBlobContents` is an internal type that should not be used externally. Additionally, the type didn't
|
|
15
|
+
match the usage, specifically in runtime-utils where an `any` cast was used to work around undefined blobContents. The
|
|
16
|
+
type has been updated to reflect that blobContents can be undefined.
|
|
17
|
+
|
|
18
|
+
- runtime-definitions: Removed IFluidRouter from IFluidDataStoreChannel and FluidDataStoreRuntime [9a451d4946](https://github.com/microsoft/FluidFramework/commits/9a451d4946b5c51a52e4d1ab5bf51e7b285b0d74)
|
|
19
|
+
|
|
20
|
+
The `IFluidRouter` property has been removed from `IFluidDataStoreChannel` and `FluidDataStoreRuntime`. Please migrate
|
|
21
|
+
all usage to the `IFluidDataStoreChannel.entryPoint` API.
|
|
22
|
+
|
|
23
|
+
See
|
|
24
|
+
[Removing-IFluidRouter.md](https://github.com/microsoft/FluidFramework/blob/main/packages/common/core-interfaces/Removing-IFluidRouter.md)
|
|
25
|
+
for more details.
|
|
26
|
+
|
|
27
|
+
## 2.0.0-internal.7.4.0
|
|
28
|
+
|
|
29
|
+
Dependency updates only.
|
|
30
|
+
|
|
31
|
+
## 2.0.0-internal.7.3.0
|
|
32
|
+
|
|
33
|
+
Dependency updates only.
|
|
34
|
+
|
|
35
|
+
## 2.0.0-internal.7.2.0
|
|
36
|
+
|
|
37
|
+
Dependency updates only.
|
|
38
|
+
|
|
39
|
+
## 2.0.0-internal.7.1.0
|
|
40
|
+
|
|
41
|
+
Dependency updates only.
|
|
42
|
+
|
|
43
|
+
## 2.0.0-internal.7.0.0
|
|
44
|
+
|
|
45
|
+
### Major Changes
|
|
46
|
+
|
|
47
|
+
- Dependencies on @fluidframework/protocol-definitions package updated to 3.0.0 [871b3493dd](https://github.com/microsoft/FluidFramework/commits/871b3493dd0d7ea3a89be64998ceb6cb9021a04e)
|
|
48
|
+
|
|
49
|
+
This included the following changes from the protocol-definitions release:
|
|
50
|
+
|
|
51
|
+
- Updating signal interfaces for some planned improvements. The intention is split the interface between signals
|
|
52
|
+
submitted by clients to the server and the resulting signals sent from the server to clients.
|
|
53
|
+
- A new optional type member is available on the ISignalMessage interface and a new ISentSignalMessage interface has
|
|
54
|
+
been added, which will be the typing for signals sent from the client to the server. Both extend a new
|
|
55
|
+
ISignalMessageBase interface that contains common members.
|
|
56
|
+
- The @fluidframework/common-definitions package dependency has been updated to version 1.0.0.
|
|
57
|
+
|
|
58
|
+
- runtime-definitions: `bindToContext` API removed [871b3493dd](https://github.com/microsoft/FluidFramework/commits/871b3493dd0d7ea3a89be64998ceb6cb9021a04e)
|
|
59
|
+
|
|
60
|
+
`bindToContext` has been removed from `FluidDataStoreRuntime`, `IFluidDataStoreContext` and
|
|
61
|
+
`MockFluidDataStoreContext`. This has been deprecated for several releases and cannot be used anymore.
|
|
62
|
+
|
|
63
|
+
- Server upgrade: dependencies on Fluid server packages updated to 2.0.1 [871b3493dd](https://github.com/microsoft/FluidFramework/commits/871b3493dd0d7ea3a89be64998ceb6cb9021a04e)
|
|
64
|
+
|
|
65
|
+
Dependencies on the following Fluid server package have been updated to version 2.0.1:
|
|
66
|
+
|
|
67
|
+
- @fluidframework/gitresources: 2.0.1
|
|
68
|
+
- @fluidframework/server-kafka-orderer: 2.0.1
|
|
69
|
+
- @fluidframework/server-lambdas: 2.0.1
|
|
70
|
+
- @fluidframework/server-lambdas-driver: 2.0.1
|
|
71
|
+
- @fluidframework/server-local-server: 2.0.1
|
|
72
|
+
- @fluidframework/server-memory-orderer: 2.0.1
|
|
73
|
+
- @fluidframework/protocol-base: 2.0.1
|
|
74
|
+
- @fluidframework/server-routerlicious: 2.0.1
|
|
75
|
+
- @fluidframework/server-routerlicious-base: 2.0.1
|
|
76
|
+
- @fluidframework/server-services: 2.0.1
|
|
77
|
+
- @fluidframework/server-services-client: 2.0.1
|
|
78
|
+
- @fluidframework/server-services-core: 2.0.1
|
|
79
|
+
- @fluidframework/server-services-ordering-kafkanode: 2.0.1
|
|
80
|
+
- @fluidframework/server-services-ordering-rdkafka: 2.0.1
|
|
81
|
+
- @fluidframework/server-services-ordering-zookeeper: 2.0.1
|
|
82
|
+
- @fluidframework/server-services-shared: 2.0.1
|
|
83
|
+
- @fluidframework/server-services-telemetry: 2.0.1
|
|
84
|
+
- @fluidframework/server-services-utils: 2.0.1
|
|
85
|
+
- @fluidframework/server-test-utils: 2.0.1
|
|
86
|
+
- tinylicious: 2.0.1
|
|
87
|
+
|
|
88
|
+
- test-utils: provideEntryPoint is required [871b3493dd](https://github.com/microsoft/FluidFramework/commits/871b3493dd0d7ea3a89be64998ceb6cb9021a04e)
|
|
89
|
+
|
|
90
|
+
The optional `provideEntryPoint` method has become required on a number of constructors. A value will need to be provided to the following classes:
|
|
91
|
+
|
|
92
|
+
- `BaseContainerRuntimeFactory`
|
|
93
|
+
- `RuntimeFactory`
|
|
94
|
+
- `ContainerRuntime` (constructor and `loadRuntime`)
|
|
95
|
+
- `FluidDataStoreRuntime`
|
|
96
|
+
|
|
97
|
+
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.
|
|
98
|
+
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.
|
|
99
|
+
|
|
100
|
+
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.
|
|
101
|
+
|
|
102
|
+
For more details, see [Removing-IFluidRouter.md](https://github.com/microsoft/FluidFramework/blob/main/packages/common/core-interfaces/Removing-IFluidRouter.md)
|
|
103
|
+
|
|
104
|
+
- Minimum TypeScript version now 5.1.6 [871b3493dd](https://github.com/microsoft/FluidFramework/commits/871b3493dd0d7ea3a89be64998ceb6cb9021a04e)
|
|
105
|
+
|
|
106
|
+
The minimum supported TypeScript version for Fluid 2.0 clients is now 5.1.6.
|
|
107
|
+
|
|
108
|
+
## 2.0.0-internal.6.4.0
|
|
109
|
+
|
|
110
|
+
### Minor Changes
|
|
111
|
+
|
|
112
|
+
- Some stack traces are improved ([#17380](https://github.com/microsoft/FluidFramework/issues/17380)) [34f2808ee9](https://github.com/microsoft/FluidFramework/commits/34f2808ee9764aef21b990f8b48860d9e3ce27a5)
|
|
113
|
+
|
|
114
|
+
Some stack traces have been improved and might now include frames for async functions that weren't previously included.
|
|
115
|
+
|
|
116
|
+
## 2.0.0-internal.6.3.0
|
|
117
|
+
|
|
118
|
+
Dependency updates only.
|
|
119
|
+
|
|
120
|
+
## 2.0.0-internal.6.2.0
|
|
121
|
+
|
|
122
|
+
### Minor Changes
|
|
123
|
+
|
|
124
|
+
- Remove use of @fluidframework/common-definitions ([#16638](https://github.com/microsoft/FluidFramework/issues/16638)) [a8c81509c9](https://github.com/microsoft/FluidFramework/commits/a8c81509c9bf09cfb2092ebcf7265205f9eb6dbf)
|
|
125
|
+
|
|
126
|
+
The **@fluidframework/common-definitions** package is being deprecated, so the following interfaces and types are now
|
|
127
|
+
imported from the **@fluidframework/core-interfaces** package:
|
|
128
|
+
|
|
129
|
+
- interface IDisposable
|
|
130
|
+
- interface IErrorEvent
|
|
131
|
+
- interface IErrorEvent
|
|
132
|
+
- interface IEvent
|
|
133
|
+
- interface IEventProvider
|
|
134
|
+
- interface ILoggingError
|
|
135
|
+
- interface ITaggedTelemetryPropertyType
|
|
136
|
+
- interface ITelemetryBaseEvent
|
|
137
|
+
- interface ITelemetryBaseLogger
|
|
138
|
+
- interface ITelemetryErrorEvent
|
|
139
|
+
- interface ITelemetryGenericEvent
|
|
140
|
+
- interface ITelemetryLogger
|
|
141
|
+
- interface ITelemetryPerformanceEvent
|
|
142
|
+
- interface ITelemetryProperties
|
|
143
|
+
- type ExtendEventProvider
|
|
144
|
+
- type IEventThisPlaceHolder
|
|
145
|
+
- type IEventTransformer
|
|
146
|
+
- type ReplaceIEventThisPlaceHolder
|
|
147
|
+
- type ReplaceIEventThisPlaceHolder
|
|
148
|
+
- type TelemetryEventCategory
|
|
149
|
+
- type TelemetryEventPropertyType
|
|
150
|
+
|
|
151
|
+
## 2.0.0-internal.6.1.0
|
|
152
|
+
|
|
153
|
+
Dependency updates only.
|
|
154
|
+
|
|
155
|
+
## 2.0.0-internal.6.0.0
|
|
156
|
+
|
|
157
|
+
### Major Changes
|
|
158
|
+
|
|
159
|
+
- Request APIs deprecated from many places [8abce8cdb4](https://github.com/microsoft/FluidFramework/commits/8abce8cdb4e2832fb6405fb44e393bef03d5648a)
|
|
160
|
+
|
|
161
|
+
The `request` API (associated with the `IFluidRouter` interface) has been deprecated on a number of classes and interfaces. The following are impacted:
|
|
162
|
+
|
|
163
|
+
- `IRuntime` and `ContainerRuntime`
|
|
164
|
+
- `IFluidDataStoreRuntime` and `FluidDataStoreRuntime`
|
|
165
|
+
- `IFluidDataStoreChannel`
|
|
166
|
+
- `MockFluidDataStoreRuntime`
|
|
167
|
+
- `TestFluidObject`
|
|
168
|
+
|
|
169
|
+
Please migrate usage to the corresponding `entryPoint` or `getEntryPoint()` of the object. The value for these "entryPoint" related APIs is determined from factories (for `IRuntime` and `IFluidDataStoreRuntime`) via the `initializeEntryPoint` method. If no method is passed to the factory, the corresponding `entryPoint` and `getEntryPoint()` will be undefined.
|
|
170
|
+
|
|
171
|
+
For an example implementation of `initializeEntryPoint`, see [pureDataObjectFactory.ts](https://github.com/microsoft/FluidFramework/blob/next/packages/framework/aqueduct/src/data-object-factories/pureDataObjectFactory.ts#L84).
|
|
172
|
+
|
|
173
|
+
More information of the migration off the request pattern, and current status of its removal, is documented in [Removing-IFluidRouter.md](https://github.com/microsoft/FluidFramework/blob/main/packages/common/core-interfaces/Removing-IFluidRouter.md).
|
|
174
|
+
|
|
175
|
+
- `initializeEntryPoint` will become required [8abce8cdb4](https://github.com/microsoft/FluidFramework/commits/8abce8cdb4e2832fb6405fb44e393bef03d5648a)
|
|
176
|
+
|
|
177
|
+
The optional `initializeEntryPoint` method has been added to a number of constructors. **This method argument will become required in an upcoming release** and a value will need to be provided to the following classes:
|
|
178
|
+
|
|
179
|
+
- `BaseContainerRuntimeFactory`
|
|
180
|
+
- `ContainerRuntimeFactoryWithDefaultDataStore`
|
|
181
|
+
- `RuntimeFactory`
|
|
182
|
+
- `ContainerRuntime` (constructor and `loadRuntime`)
|
|
183
|
+
- `FluidDataStoreRuntime`
|
|
184
|
+
|
|
185
|
+
For an example implementation of `initializeEntryPoint`, see [pureDataObjectFactory.ts](https://github.com/microsoft/FluidFramework/blob/main/packages/framework/aqueduct/src/data-object-factories/pureDataObjectFactory.ts#L84).
|
|
186
|
+
|
|
187
|
+
This work will replace the request pattern. See [Removing-IFluidRouter.md](https://github.com/microsoft/FluidFramework/blob/main/packages/common/core-interfaces/Removing-IFluidRouter.md) for more info on this effort.
|
|
188
|
+
|
|
189
|
+
- FluidDataStoreRuntime.getChannel throws for channels that do not exist [8abce8cdb4](https://github.com/microsoft/FluidFramework/commits/8abce8cdb4e2832fb6405fb44e393bef03d5648a)
|
|
190
|
+
|
|
191
|
+
Previously, calling `FluidDataStoreRuntime.getChannel(id)` for a channel that does not exist would wait for the channel to be created (possibly waiting indefinitely if never created). However, there is no safe means to dynamically create a channel in this manner without risking data corruption. The call will instead now throw for non-existent channels.
|
|
192
|
+
|
|
193
|
+
- Upgraded typescript transpilation target to ES2020 [8abce8cdb4](https://github.com/microsoft/FluidFramework/commits/8abce8cdb4e2832fb6405fb44e393bef03d5648a)
|
|
194
|
+
|
|
195
|
+
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.
|
|
196
|
+
|
|
197
|
+
- IDeltaManager members disposed and dispose() removed [8abce8cdb4](https://github.com/microsoft/FluidFramework/commits/8abce8cdb4e2832fb6405fb44e393bef03d5648a)
|
|
198
|
+
|
|
199
|
+
IDeltaManager members disposed and dispose() were deprecated in 2.0.0-internal.5.3.0 and have now been removed.
|
|
200
|
+
|
|
201
|
+
## 2.0.0-internal.5.4.0
|
|
202
|
+
|
|
203
|
+
Dependency updates only.
|
|
204
|
+
|
|
205
|
+
## 2.0.0-internal.5.3.0
|
|
206
|
+
|
|
207
|
+
Dependency updates only.
|
|
208
|
+
|
|
209
|
+
## 2.0.0-internal.5.2.0
|
|
210
|
+
|
|
211
|
+
Dependency updates only.
|
|
212
|
+
|
|
213
|
+
## 2.0.0-internal.5.1.0
|
|
214
|
+
|
|
215
|
+
Dependency updates only.
|
|
216
|
+
|
|
217
|
+
## 2.0.0-internal.5.0.0
|
|
218
|
+
|
|
219
|
+
### Major Changes
|
|
220
|
+
|
|
221
|
+
- The `@fluidframework/garbage-collector` package was deprecated in version 2.0.0-internal.4.1.0. [8b242fdc79](https://github.com/microsoft/FluidFramework/commits/8b242fdc796714cf1da9ad3f90d02efb122af0c2)
|
|
222
|
+
It has now been removed with the following functions, interfaces, and types in it.
|
|
223
|
+
|
|
224
|
+
- `cloneGCData`
|
|
225
|
+
- `concatGarbageCollectionData`
|
|
226
|
+
- `concatGarbageCollectionStates`
|
|
227
|
+
- `GCDataBuilder`
|
|
228
|
+
- `getGCDataFromSnapshot`
|
|
229
|
+
- `IGCResult`
|
|
230
|
+
- `removeRouteFromAllNodes`
|
|
231
|
+
- `runGarbageCollection`
|
|
232
|
+
- `trimLeadingAndTrailingSlashes`
|
|
233
|
+
- `trimLeadingSlashes`
|
|
234
|
+
- `trimTrailingSlashes`
|
|
235
|
+
- `unpackChildNodesGCDetails`
|
|
236
|
+
- `unpackChildNodesUsedRoutes`
|
|
237
|
+
|
|
238
|
+
## 2.0.0-internal.4.4.0
|
|
239
|
+
|
|
240
|
+
Dependency updates only.
|
|
241
|
+
|
|
242
|
+
## 2.0.0-internal.4.1.0
|
|
243
|
+
|
|
244
|
+
### Minor Changes
|
|
245
|
+
|
|
246
|
+
- GC interfaces removed from runtime-definitions ([#14750](https://github.com/microsoft/FluidFramework/pull-requests/14750)) [60274eacab](https://github.com/microsoft/FluidFramework/commits/60274eacabf14d42f52f6ad1c2f64356e64ba1a2)
|
|
247
|
+
|
|
248
|
+
The following interfaces available in `@fluidframework/runtime-definitions` are internal implementation details and have been deprecated for public use. They will be removed in an upcoming release.
|
|
249
|
+
|
|
250
|
+
- `IGarbageCollectionNodeData`
|
|
251
|
+
- `IGarbageCollectionState`
|
|
252
|
+
- `IGarbageCollectionSnapshotData`
|
|
253
|
+
- `IGarbageCollectionSummaryDetailsLegacy`
|
|
254
|
+
|
|
255
|
+
- @fluidframework/garbage-collector deprecated ([#14750](https://github.com/microsoft/FluidFramework/pull-requests/14750)) [60274eacab](https://github.com/microsoft/FluidFramework/commits/60274eacabf14d42f52f6ad1c2f64356e64ba1a2)
|
|
256
|
+
|
|
257
|
+
The `@fluidframework/garbage-collector` package is deprecated with the following functions, interfaces, and types in it.
|
|
258
|
+
These are internal implementation details and have been deprecated for public use. They will be removed in an upcoming
|
|
259
|
+
release.
|
|
260
|
+
|
|
261
|
+
- `cloneGCData`
|
|
262
|
+
- `concatGarbageCollectionData`
|
|
263
|
+
- `concatGarbageCollectionStates`
|
|
264
|
+
- `GCDataBuilder`
|
|
265
|
+
- `getGCDataFromSnapshot`
|
|
266
|
+
- `IGCResult`
|
|
267
|
+
- `removeRouteFromAllNodes`
|
|
268
|
+
- `runGarbageCollection`
|
|
269
|
+
- `trimLeadingAndTrailingSlashes`
|
|
270
|
+
- `trimLeadingSlashes`
|
|
271
|
+
- `trimTrailingSlashes`
|
|
272
|
+
- `unpackChildNodesGCDetails`
|
|
273
|
+
- `unpackChildNodesUsedRoutes`
|
package/README.md
CHANGED
|
@@ -1,14 +1,55 @@
|
|
|
1
1
|
# @fluidframework/datastore
|
|
2
2
|
|
|
3
|
+
<!-- AUTO-GENERATED-CONTENT:START (README_DEPENDENCY_GUIDELINES_SECTION:includeHeading=TRUE) -->
|
|
4
|
+
|
|
5
|
+
<!-- prettier-ignore-start -->
|
|
6
|
+
<!-- NOTE: This section is automatically generated using @fluid-tools/markdown-magic. Do not update these generated contents directly. -->
|
|
7
|
+
|
|
8
|
+
## Using Fluid Framework libraries
|
|
9
|
+
|
|
10
|
+
When taking a dependency on a Fluid Framework library, we recommend using a `^` (caret) version range, such as `^1.3.4`.
|
|
11
|
+
While Fluid Framework libraries may use different ranges with interdependencies between other Fluid Framework libraries,
|
|
12
|
+
library consumers should always prefer `^`.
|
|
13
|
+
|
|
14
|
+
Note that when depending on a library version of the form `2.0.0-internal.x.y.z`, called the Fluid internal version scheme,
|
|
15
|
+
you must use a `>= <` dependency range (such as `>=2.0.0-internal.x.y.z <2.0.0-internal.w.0.0` where `w` is `x+1`).
|
|
16
|
+
Standard `^` and `~` ranges will not work as expected.
|
|
17
|
+
See the [@fluid-tools/version-tools](https://github.com/microsoft/FluidFramework/blob/main/build-tools/packages/version-tools/README.md)
|
|
18
|
+
package for more information including tools to convert between version schemes.
|
|
19
|
+
|
|
20
|
+
<!-- prettier-ignore-end -->
|
|
21
|
+
|
|
22
|
+
<!-- AUTO-GENERATED-CONTENT:END -->
|
|
23
|
+
|
|
3
24
|
# Fluid Handle
|
|
25
|
+
|
|
4
26
|
A Fluid handle is a handle to a Fluid object like a `DataStore` or a `SharedObject` (DDS). It can be used to represent the object in the system and has the capability to get the underlying object by calling `get()` on it.
|
|
5
27
|
|
|
6
28
|
The two major interfaces required to implement a Fluid handle are `IFluidHandle` and `IFluidHandleContext` defined in [fluidHandle.ts](src/fluidHandle.ts).
|
|
7
29
|
|
|
8
30
|
## IFluidHandle
|
|
31
|
+
|
|
9
32
|
`IFluidHandle` has only one method `get` that is used to retrieve the underlying object it represents. It also extends `IFluidHandleContext`.
|
|
10
33
|
|
|
11
34
|
## IFluidHandleContext
|
|
35
|
+
|
|
12
36
|
`IFluidHandleContext` describes a routing context (another `IFluidHandleContext`) that has a path to this `IFluidHandleContext`. When creating a Data Store Handle the route context should be the `FluidDataStoreRuntime` which knows how to reach the `FluidDataStore`. Similarly, the `FluidDataStoreRuntime's` route context should be the `ContainerRuntime` which knows how to reach it.
|
|
13
37
|
|
|
14
38
|
For more details on Fluid Handles, check this [doc](../../../content/docs/advanced/handles.md).
|
|
39
|
+
|
|
40
|
+
<!-- AUTO-GENERATED-CONTENT:START (README_TRADEMARK_SECTION:includeHeading=TRUE) -->
|
|
41
|
+
|
|
42
|
+
<!-- prettier-ignore-start -->
|
|
43
|
+
<!-- NOTE: This section is automatically generated using @fluid-tools/markdown-magic. Do not update these generated contents directly. -->
|
|
44
|
+
|
|
45
|
+
## Trademark
|
|
46
|
+
|
|
47
|
+
This project may contain Microsoft trademarks or logos for Microsoft projects, products, or services.
|
|
48
|
+
|
|
49
|
+
Use of these trademarks or logos must follow Microsoft's [Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general).
|
|
50
|
+
|
|
51
|
+
Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.
|
|
52
|
+
|
|
53
|
+
<!-- prettier-ignore-end -->
|
|
54
|
+
|
|
55
|
+
<!-- AUTO-GENERATED-CONTENT:END -->
|
package/api-extractor.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
|
3
|
+
"extends": "../../../common/build/build-common/api-extractor-base.json"
|
|
4
4
|
}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
## API Report File for "@fluidframework/datastore"
|
|
2
|
+
|
|
3
|
+
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
|
|
7
|
+
import { AttachState } from '@fluidframework/container-definitions';
|
|
8
|
+
import { FluidObject } from '@fluidframework/core-interfaces';
|
|
9
|
+
import { IAudience } from '@fluidframework/container-definitions';
|
|
10
|
+
import { IChannel } from '@fluidframework/datastore-definitions';
|
|
11
|
+
import { IChannelFactory } from '@fluidframework/datastore-definitions';
|
|
12
|
+
import { IClientDetails } from '@fluidframework/protocol-definitions';
|
|
13
|
+
import { IDeltaManager } from '@fluidframework/container-definitions';
|
|
14
|
+
import { IDocumentMessage } from '@fluidframework/protocol-definitions';
|
|
15
|
+
import { IFluidDataStoreChannel } from '@fluidframework/runtime-definitions';
|
|
16
|
+
import { IFluidDataStoreContext } from '@fluidframework/runtime-definitions';
|
|
17
|
+
import { IFluidDataStoreRuntime } from '@fluidframework/datastore-definitions';
|
|
18
|
+
import { IFluidDataStoreRuntimeEvents } from '@fluidframework/datastore-definitions';
|
|
19
|
+
import { IFluidHandle } from '@fluidframework/core-interfaces';
|
|
20
|
+
import { IFluidHandleContext } from '@fluidframework/core-interfaces';
|
|
21
|
+
import { IGarbageCollectionData } from '@fluidframework/runtime-definitions';
|
|
22
|
+
import { IIdCompressor } from '@fluidframework/runtime-definitions';
|
|
23
|
+
import { IInboundSignalMessage } from '@fluidframework/runtime-definitions';
|
|
24
|
+
import { ILoaderOptions } from '@fluidframework/container-definitions';
|
|
25
|
+
import { IQuorumClients } from '@fluidframework/protocol-definitions';
|
|
26
|
+
import { IRequest } from '@fluidframework/core-interfaces';
|
|
27
|
+
import { IResponse } from '@fluidframework/core-interfaces';
|
|
28
|
+
import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions';
|
|
29
|
+
import { ISummaryTreeWithStats } from '@fluidframework/runtime-definitions';
|
|
30
|
+
import { ITelemetryContext } from '@fluidframework/runtime-definitions';
|
|
31
|
+
import { ITelemetryLoggerExt } from '@fluidframework/telemetry-utils';
|
|
32
|
+
import { TypedEventEmitter } from '@fluid-internal/client-utils';
|
|
33
|
+
import { VisibilityState } from '@fluidframework/runtime-definitions';
|
|
34
|
+
|
|
35
|
+
// @alpha (undocumented)
|
|
36
|
+
export enum DataStoreMessageType {
|
|
37
|
+
// (undocumented)
|
|
38
|
+
Attach = "attach",
|
|
39
|
+
// (undocumented)
|
|
40
|
+
ChannelOp = "op"
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// @alpha
|
|
44
|
+
export class FluidDataStoreRuntime extends TypedEventEmitter<IFluidDataStoreRuntimeEvents> implements IFluidDataStoreChannel, IFluidDataStoreRuntime, IFluidHandleContext {
|
|
45
|
+
constructor(dataStoreContext: IFluidDataStoreContext, sharedObjectRegistry: ISharedObjectRegistry, existing: boolean, provideEntryPoint: (runtime: IFluidDataStoreRuntime) => Promise<FluidObject>);
|
|
46
|
+
// (undocumented)
|
|
47
|
+
get absolutePath(): string;
|
|
48
|
+
addChannel(channel: IChannel): void;
|
|
49
|
+
// (undocumented)
|
|
50
|
+
applyStashedOp(content: any): Promise<unknown>;
|
|
51
|
+
attachGraph(): void;
|
|
52
|
+
// (undocumented)
|
|
53
|
+
get attachState(): AttachState;
|
|
54
|
+
// (undocumented)
|
|
55
|
+
bind(handle: IFluidHandle): void;
|
|
56
|
+
bindChannel(channel: IChannel): void;
|
|
57
|
+
// (undocumented)
|
|
58
|
+
get channelsRoutingContext(): this;
|
|
59
|
+
// (undocumented)
|
|
60
|
+
get clientDetails(): IClientDetails;
|
|
61
|
+
// (undocumented)
|
|
62
|
+
get clientId(): string | undefined;
|
|
63
|
+
// (undocumented)
|
|
64
|
+
get connected(): boolean;
|
|
65
|
+
// (undocumented)
|
|
66
|
+
createChannel(id: string | undefined, type: string): IChannel;
|
|
67
|
+
// (undocumented)
|
|
68
|
+
readonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>;
|
|
69
|
+
// (undocumented)
|
|
70
|
+
dispose(): void;
|
|
71
|
+
// (undocumented)
|
|
72
|
+
get disposed(): boolean;
|
|
73
|
+
ensureNoDataModelChanges<T>(callback: () => T): T;
|
|
74
|
+
// (undocumented)
|
|
75
|
+
readonly entryPoint: IFluidHandle<FluidObject>;
|
|
76
|
+
// (undocumented)
|
|
77
|
+
getAttachSummary(telemetryContext?: ITelemetryContext): ISummaryTreeWithStats;
|
|
78
|
+
// (undocumented)
|
|
79
|
+
getAudience(): IAudience;
|
|
80
|
+
// (undocumented)
|
|
81
|
+
getChannel(id: string): Promise<IChannel>;
|
|
82
|
+
getGCData(fullGC?: boolean): Promise<IGarbageCollectionData>;
|
|
83
|
+
// (undocumented)
|
|
84
|
+
getQuorum(): IQuorumClients;
|
|
85
|
+
// (undocumented)
|
|
86
|
+
readonly id: string;
|
|
87
|
+
// (undocumented)
|
|
88
|
+
get idCompressor(): IIdCompressor | undefined;
|
|
89
|
+
// (undocumented)
|
|
90
|
+
get IFluidHandleContext(): this;
|
|
91
|
+
// (undocumented)
|
|
92
|
+
get isAttached(): boolean;
|
|
93
|
+
// (undocumented)
|
|
94
|
+
get logger(): ITelemetryLoggerExt;
|
|
95
|
+
makeVisibleAndAttachGraph(): void;
|
|
96
|
+
// (undocumented)
|
|
97
|
+
get objectsRoutingContext(): this;
|
|
98
|
+
// (undocumented)
|
|
99
|
+
readonly options: ILoaderOptions;
|
|
100
|
+
// (undocumented)
|
|
101
|
+
process(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void;
|
|
102
|
+
// (undocumented)
|
|
103
|
+
processSignal(message: IInboundSignalMessage, local: boolean): void;
|
|
104
|
+
// (undocumented)
|
|
105
|
+
request(request: IRequest): Promise<IResponse>;
|
|
106
|
+
// (undocumented)
|
|
107
|
+
resolveHandle(request: IRequest): Promise<IResponse>;
|
|
108
|
+
reSubmit(type: DataStoreMessageType, content: any, localOpMetadata: unknown): void;
|
|
109
|
+
rollback?(type: DataStoreMessageType, content: any, localOpMetadata: unknown): void;
|
|
110
|
+
// (undocumented)
|
|
111
|
+
get rootRoutingContext(): this;
|
|
112
|
+
// (undocumented)
|
|
113
|
+
get routeContext(): IFluidHandleContext;
|
|
114
|
+
// (undocumented)
|
|
115
|
+
setConnectionState(connected: boolean, clientId?: string): void;
|
|
116
|
+
// (undocumented)
|
|
117
|
+
submitMessage(type: DataStoreMessageType, content: any, localOpMetadata: unknown): void;
|
|
118
|
+
submitSignal(type: string, content: any, targetClientId?: string): void;
|
|
119
|
+
summarize(fullTree?: boolean, trackState?: boolean, telemetryContext?: ITelemetryContext): Promise<ISummaryTreeWithStats>;
|
|
120
|
+
updateUsedRoutes(usedRoutes: string[]): void;
|
|
121
|
+
// (undocumented)
|
|
122
|
+
uploadBlob(blob: ArrayBufferLike, signal?: AbortSignal): Promise<IFluidHandle<ArrayBufferLike>>;
|
|
123
|
+
// (undocumented)
|
|
124
|
+
visibilityState: VisibilityState;
|
|
125
|
+
waitAttached(): Promise<void>;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// @alpha
|
|
129
|
+
export class FluidObjectHandle<T extends FluidObject = FluidObject> implements IFluidHandle {
|
|
130
|
+
constructor(value: T | Promise<T>, path: string, routeContext: IFluidHandleContext);
|
|
131
|
+
// (undocumented)
|
|
132
|
+
readonly absolutePath: string;
|
|
133
|
+
// (undocumented)
|
|
134
|
+
attachGraph(): void;
|
|
135
|
+
// (undocumented)
|
|
136
|
+
bind(handle: IFluidHandle): void;
|
|
137
|
+
// (undocumented)
|
|
138
|
+
get(): Promise<any>;
|
|
139
|
+
// (undocumented)
|
|
140
|
+
get IFluidHandle(): IFluidHandle;
|
|
141
|
+
// (undocumented)
|
|
142
|
+
get isAttached(): boolean;
|
|
143
|
+
// (undocumented)
|
|
144
|
+
readonly path: string;
|
|
145
|
+
// (undocumented)
|
|
146
|
+
readonly routeContext: IFluidHandleContext;
|
|
147
|
+
// (undocumented)
|
|
148
|
+
protected readonly value: T | Promise<T>;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// @alpha (undocumented)
|
|
152
|
+
export interface ISharedObjectRegistry {
|
|
153
|
+
// (undocumented)
|
|
154
|
+
get(name: string): IChannelFactory | undefined;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// @internal
|
|
158
|
+
export const mixinRequestHandler: (requestHandler: (request: IRequest, runtime: FluidDataStoreRuntime) => Promise<IResponse>, Base?: typeof FluidDataStoreRuntime) => typeof FluidDataStoreRuntime;
|
|
159
|
+
|
|
160
|
+
// @alpha
|
|
161
|
+
export const mixinSummaryHandler: (handler: (runtime: FluidDataStoreRuntime) => Promise<{
|
|
162
|
+
path: string[];
|
|
163
|
+
content: string;
|
|
164
|
+
} | undefined>, Base?: typeof FluidDataStoreRuntime) => typeof FluidDataStoreRuntime;
|
|
165
|
+
|
|
166
|
+
// (No @packageDocumentation comment for this package)
|
|
167
|
+
|
|
168
|
+
```
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.loadChannel = exports.loadChannelFactoryAndAttributes = exports.summarizeChannelAsync = exports.summarizeChannel = exports.createChannelServiceEndpoints = exports.attributesBlobKey = void 0;
|
|
8
|
+
const telemetry_utils_1 = require("@fluidframework/telemetry-utils");
|
|
9
|
+
const runtime_utils_1 = require("@fluidframework/runtime-utils");
|
|
10
|
+
const driver_utils_1 = require("@fluidframework/driver-utils");
|
|
11
|
+
const channelStorageService_1 = require("./channelStorageService.cjs");
|
|
12
|
+
const channelDeltaConnection_1 = require("./channelDeltaConnection.cjs");
|
|
13
|
+
exports.attributesBlobKey = ".attributes";
|
|
14
|
+
function createChannelServiceEndpoints(connected, submitFn, dirtyFn, addedGCOutboundReferenceFn, storageService, logger, tree, extraBlobs) {
|
|
15
|
+
const deltaConnection = new channelDeltaConnection_1.ChannelDeltaConnection(connected, (message, localOpMetadata) => submitFn(message, localOpMetadata), dirtyFn, addedGCOutboundReferenceFn);
|
|
16
|
+
const objectStorage = new channelStorageService_1.ChannelStorageService(tree, storageService, logger, extraBlobs);
|
|
17
|
+
return {
|
|
18
|
+
deltaConnection,
|
|
19
|
+
objectStorage,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
exports.createChannelServiceEndpoints = createChannelServiceEndpoints;
|
|
23
|
+
function summarizeChannel(channel, fullTree = false, trackState = false, telemetryContext) {
|
|
24
|
+
const summarizeResult = channel.getAttachSummary(fullTree, trackState, telemetryContext);
|
|
25
|
+
// Add the channel attributes to the returned result.
|
|
26
|
+
(0, runtime_utils_1.addBlobToSummary)(summarizeResult, exports.attributesBlobKey, JSON.stringify(channel.attributes));
|
|
27
|
+
return summarizeResult;
|
|
28
|
+
}
|
|
29
|
+
exports.summarizeChannel = summarizeChannel;
|
|
30
|
+
async function summarizeChannelAsync(channel, fullTree = false, trackState = false, telemetryContext, incrementalSummaryContext) {
|
|
31
|
+
const summarizeResult = await channel.summarize(fullTree, trackState, telemetryContext, incrementalSummaryContext);
|
|
32
|
+
// Add the channel attributes to the returned result.
|
|
33
|
+
(0, runtime_utils_1.addBlobToSummary)(summarizeResult, exports.attributesBlobKey, JSON.stringify(channel.attributes));
|
|
34
|
+
return summarizeResult;
|
|
35
|
+
}
|
|
36
|
+
exports.summarizeChannelAsync = summarizeChannelAsync;
|
|
37
|
+
async function loadChannelFactoryAndAttributes(dataStoreContext, services, channelId, registry, attachMessageType) {
|
|
38
|
+
let attributes;
|
|
39
|
+
if (await services.objectStorage.contains(exports.attributesBlobKey)) {
|
|
40
|
+
attributes = await (0, driver_utils_1.readAndParse)(services.objectStorage, exports.attributesBlobKey);
|
|
41
|
+
}
|
|
42
|
+
// This is a backward compatibility case where the attach message doesn't include attributes. They must
|
|
43
|
+
// include attach message type.
|
|
44
|
+
// Since old attach messages will not have attributes, we need to keep this as long as we support old attach
|
|
45
|
+
// messages.
|
|
46
|
+
const channelFactoryType = attributes ? attributes.type : attachMessageType;
|
|
47
|
+
if (channelFactoryType === undefined) {
|
|
48
|
+
throw new telemetry_utils_1.DataCorruptionError("channelTypeNotAvailable", (0, telemetry_utils_1.tagCodeArtifacts)({
|
|
49
|
+
channelId,
|
|
50
|
+
dataStoreId: dataStoreContext.id,
|
|
51
|
+
dataStorePackagePath: dataStoreContext.packagePath.join("/"),
|
|
52
|
+
channelFactoryType,
|
|
53
|
+
}));
|
|
54
|
+
}
|
|
55
|
+
const factory = registry.get(channelFactoryType);
|
|
56
|
+
if (factory === undefined) {
|
|
57
|
+
throw new telemetry_utils_1.DataCorruptionError("channelFactoryNotRegisteredForGivenType", (0, telemetry_utils_1.tagCodeArtifacts)({
|
|
58
|
+
channelId,
|
|
59
|
+
dataStoreId: dataStoreContext.id,
|
|
60
|
+
dataStorePackagePath: dataStoreContext.packagePath.join("/"),
|
|
61
|
+
channelFactoryType,
|
|
62
|
+
}));
|
|
63
|
+
}
|
|
64
|
+
// This is a backward compatibility case where the attach message doesn't include attributes. Get the attributes
|
|
65
|
+
// from the factory.
|
|
66
|
+
attributes = attributes ?? factory.attributes;
|
|
67
|
+
return { factory, attributes };
|
|
68
|
+
}
|
|
69
|
+
exports.loadChannelFactoryAndAttributes = loadChannelFactoryAndAttributes;
|
|
70
|
+
async function loadChannel(dataStoreRuntime, attributes, factory, services, logger, channelId) {
|
|
71
|
+
// Compare snapshot version to collaborative object version
|
|
72
|
+
if (attributes.snapshotFormatVersion !== undefined &&
|
|
73
|
+
attributes.snapshotFormatVersion !== factory.attributes.snapshotFormatVersion) {
|
|
74
|
+
logger.sendTelemetryEvent({
|
|
75
|
+
eventName: "ChannelAttributesVersionMismatch",
|
|
76
|
+
...(0, telemetry_utils_1.tagCodeArtifacts)({
|
|
77
|
+
channelType: attributes.type,
|
|
78
|
+
channelSnapshotVersion: `${attributes.snapshotFormatVersion}@${attributes.packageVersion}`,
|
|
79
|
+
channelCodeVersion: `${factory.attributes.snapshotFormatVersion}@${factory.attributes.packageVersion}`,
|
|
80
|
+
}),
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
return factory.load(dataStoreRuntime, channelId, services, attributes);
|
|
84
|
+
}
|
|
85
|
+
exports.loadChannel = loadChannel;
|
|
86
|
+
//# sourceMappingURL=channelContext.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"channelContext.cjs","sourceRoot":"","sources":["../src/channelContext.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,qEAIyC;AAkBzC,iEAAiE;AACjE,+DAA4D;AAC5D,uEAAgE;AAChE,yEAAkE;AAGrD,QAAA,iBAAiB,GAAG,aAAa,CAAC;AA0C/C,SAAgB,6BAA6B,CAC5C,SAAkB,EAClB,QAA0D,EAC1D,OAAmB,EACnB,0BAA2F,EAC3F,cAAuC,EACvC,MAA2B,EAC3B,IAAoB,EACpB,UAAyC;IAEzC,MAAM,eAAe,GAAG,IAAI,+CAAsB,CACjD,SAAS,EACT,CAAC,OAAO,EAAE,eAAe,EAAE,EAAE,CAAC,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC,EAChE,OAAO,EACP,0BAA0B,CAC1B,CAAC;IACF,MAAM,aAAa,GAAG,IAAI,6CAAqB,CAAC,IAAI,EAAE,cAAc,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC;IAE1F,OAAO;QACN,eAAe;QACf,aAAa;KACb,CAAC;AACH,CAAC;AAtBD,sEAsBC;AAED,SAAgB,gBAAgB,CAC/B,OAAiB,EACjB,WAAoB,KAAK,EACzB,aAAsB,KAAK,EAC3B,gBAAoC;IAEpC,MAAM,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC,QAAQ,EAAE,UAAU,EAAE,gBAAgB,CAAC,CAAC;IAEzF,qDAAqD;IACrD,IAAA,gCAAgB,EAAC,eAAe,EAAE,yBAAiB,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC;IACzF,OAAO,eAAe,CAAC;AACxB,CAAC;AAXD,4CAWC;AAEM,KAAK,UAAU,qBAAqB,CAC1C,OAAiB,EACjB,WAAoB,KAAK,EACzB,aAAsB,KAAK,EAC3B,gBAAoC,EACpC,yBAAkE;IAElE,MAAM,eAAe,GAAG,MAAM,OAAO,CAAC,SAAS,CAC9C,QAAQ,EACR,UAAU,EACV,gBAAgB,EAChB,yBAAyB,CACzB,CAAC;IAEF,qDAAqD;IACrD,IAAA,gCAAgB,EAAC,eAAe,EAAE,yBAAiB,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC;IACzF,OAAO,eAAe,CAAC;AACxB,CAAC;AAjBD,sDAiBC;AAEM,KAAK,UAAU,+BAA+B,CACpD,gBAAwC,EACxC,QAAiC,EACjC,SAAiB,EACjB,QAA+B,EAC/B,iBAA0B;IAE1B,IAAI,UAA0C,CAAC;IAC/C,IAAI,MAAM,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,yBAAiB,CAAC,EAAE;QAC7D,UAAU,GAAG,MAAM,IAAA,2BAAY,EAC9B,QAAQ,CAAC,aAAa,EACtB,yBAAiB,CACjB,CAAC;KACF;IAED,uGAAuG;IACvG,+BAA+B;IAC/B,4GAA4G;IAC5G,YAAY;IACZ,MAAM,kBAAkB,GAAG,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,iBAAiB,CAAC;IAC5E,IAAI,kBAAkB,KAAK,SAAS,EAAE;QACrC,MAAM,IAAI,qCAAmB,CAC5B,yBAAyB,EACzB,IAAA,kCAAgB,EAAC;YAChB,SAAS;YACT,WAAW,EAAE,gBAAgB,CAAC,EAAE;YAChC,oBAAoB,EAAE,gBAAgB,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC;YAC5D,kBAAkB;SAClB,CAAC,CACF,CAAC;KACF;IACD,MAAM,OAAO,GAAG,QAAQ,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;IACjD,IAAI,OAAO,KAAK,SAAS,EAAE;QAC1B,MAAM,IAAI,qCAAmB,CAC5B,yCAAyC,EACzC,IAAA,kCAAgB,EAAC;YAChB,SAAS;YACT,WAAW,EAAE,gBAAgB,CAAC,EAAE;YAChC,oBAAoB,EAAE,gBAAgB,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC;YAC5D,kBAAkB;SAClB,CAAC,CACF,CAAC;KACF;IACD,gHAAgH;IAChH,oBAAoB;IACpB,UAAU,GAAG,UAAU,IAAI,OAAO,CAAC,UAAU,CAAC;IAC9C,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC;AAChC,CAAC;AA/CD,0EA+CC;AAEM,KAAK,UAAU,WAAW,CAChC,gBAAwC,EACxC,UAA8B,EAC9B,OAAwB,EACxB,QAAiC,EACjC,MAA2B,EAC3B,SAAiB;IAEjB,2DAA2D;IAC3D,IACC,UAAU,CAAC,qBAAqB,KAAK,SAAS;QAC9C,UAAU,CAAC,qBAAqB,KAAK,OAAO,CAAC,UAAU,CAAC,qBAAqB,EAC5E;QACD,MAAM,CAAC,kBAAkB,CAAC;YACzB,SAAS,EAAE,kCAAkC;YAC7C,GAAG,IAAA,kCAAgB,EAAC;gBACnB,WAAW,EAAE,UAAU,CAAC,IAAI;gBAC5B,sBAAsB,EAAE,GAAG,UAAU,CAAC,qBAAqB,IAAI,UAAU,CAAC,cAAc,EAAE;gBAC1F,kBAAkB,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC,qBAAqB,IAAI,OAAO,CAAC,UAAU,CAAC,cAAc,EAAE;aACtG,CAAC;SACF,CAAC,CAAC;KACH;IAED,OAAO,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;AACxE,CAAC;AAxBD,kCAwBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tDataCorruptionError,\n\tITelemetryLoggerExt,\n\ttagCodeArtifacts,\n} from \"@fluidframework/telemetry-utils\";\nimport { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport {\n\tIChannel,\n\tIChannelAttributes,\n\tIChannelFactory,\n\tIFluidDataStoreRuntime,\n} from \"@fluidframework/datastore-definitions\";\nimport { IDocumentStorageService } from \"@fluidframework/driver-definitions\";\nimport { ISequencedDocumentMessage, ISnapshotTree } from \"@fluidframework/protocol-definitions\";\nimport {\n\tIGarbageCollectionData,\n\tIExperimentalIncrementalSummaryContext,\n\tISummarizeResult,\n\tISummaryTreeWithStats,\n\tITelemetryContext,\n\tIFluidDataStoreContext,\n} from \"@fluidframework/runtime-definitions\";\nimport { addBlobToSummary } from \"@fluidframework/runtime-utils\";\nimport { readAndParse } from \"@fluidframework/driver-utils\";\nimport { ChannelStorageService } from \"./channelStorageService\";\nimport { ChannelDeltaConnection } from \"./channelDeltaConnection\";\nimport { ISharedObjectRegistry } from \"./dataStoreRuntime\";\n\nexport const attributesBlobKey = \".attributes\";\n\nexport interface IChannelContext {\n\tgetChannel(): Promise<IChannel>;\n\n\tsetConnectionState(connected: boolean, clientId?: string);\n\n\tprocessOp(message: ISequencedDocumentMessage, local: boolean, localOpMetadata?: unknown): void;\n\n\tsummarize(\n\t\tfullTree?: boolean,\n\t\ttrackState?: boolean,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): Promise<ISummarizeResult>;\n\n\treSubmit(content: any, localOpMetadata: unknown): void;\n\n\tapplyStashedOp(content: any): unknown;\n\n\trollback(message: any, localOpMetadata: unknown): void;\n\n\t/**\n\t * Returns the data used for garbage collection. This includes a list of GC nodes that represent this context\n\t * including any of its children. Each node has a set of outbound routes to other GC nodes in the document.\n\t * @param fullGC - true to bypass optimizations and force full generation of GC data.\n\t */\n\tgetGCData(fullGC?: boolean): Promise<IGarbageCollectionData>;\n\n\t/**\n\t * After GC has run, called to notify this context of routes that are used in it. These are used for the following:\n\t * 1. To identify if this context is being referenced in the document or not.\n\t * 2. To identify if this context or any of its children's used routes changed since last summary.\n\t * 3. They are added to the summary generated by this context.\n\t */\n\tupdateUsedRoutes(usedRoutes: string[]): void;\n}\n\nexport interface ChannelServiceEndpoints {\n\tdeltaConnection: ChannelDeltaConnection;\n\tobjectStorage: ChannelStorageService;\n}\n\nexport function createChannelServiceEndpoints(\n\tconnected: boolean,\n\tsubmitFn: (content: any, localOpMetadata: unknown) => void,\n\tdirtyFn: () => void,\n\taddedGCOutboundReferenceFn: (srcHandle: IFluidHandle, outboundHandle: IFluidHandle) => void,\n\tstorageService: IDocumentStorageService,\n\tlogger: ITelemetryLoggerExt,\n\ttree?: ISnapshotTree,\n\textraBlobs?: Map<string, ArrayBufferLike>,\n): ChannelServiceEndpoints {\n\tconst deltaConnection = new ChannelDeltaConnection(\n\t\tconnected,\n\t\t(message, localOpMetadata) => submitFn(message, localOpMetadata),\n\t\tdirtyFn,\n\t\taddedGCOutboundReferenceFn,\n\t);\n\tconst objectStorage = new ChannelStorageService(tree, storageService, logger, extraBlobs);\n\n\treturn {\n\t\tdeltaConnection,\n\t\tobjectStorage,\n\t};\n}\n\nexport function summarizeChannel(\n\tchannel: IChannel,\n\tfullTree: boolean = false,\n\ttrackState: boolean = false,\n\ttelemetryContext?: ITelemetryContext,\n): ISummaryTreeWithStats {\n\tconst summarizeResult = channel.getAttachSummary(fullTree, trackState, telemetryContext);\n\n\t// Add the channel attributes to the returned result.\n\taddBlobToSummary(summarizeResult, attributesBlobKey, JSON.stringify(channel.attributes));\n\treturn summarizeResult;\n}\n\nexport async function summarizeChannelAsync(\n\tchannel: IChannel,\n\tfullTree: boolean = false,\n\ttrackState: boolean = false,\n\ttelemetryContext?: ITelemetryContext,\n\tincrementalSummaryContext?: IExperimentalIncrementalSummaryContext,\n): Promise<ISummaryTreeWithStats> {\n\tconst summarizeResult = await channel.summarize(\n\t\tfullTree,\n\t\ttrackState,\n\t\ttelemetryContext,\n\t\tincrementalSummaryContext,\n\t);\n\n\t// Add the channel attributes to the returned result.\n\taddBlobToSummary(summarizeResult, attributesBlobKey, JSON.stringify(channel.attributes));\n\treturn summarizeResult;\n}\n\nexport async function loadChannelFactoryAndAttributes(\n\tdataStoreContext: IFluidDataStoreContext,\n\tservices: ChannelServiceEndpoints,\n\tchannelId: string,\n\tregistry: ISharedObjectRegistry,\n\tattachMessageType?: string,\n): Promise<{ factory: IChannelFactory; attributes: IChannelAttributes }> {\n\tlet attributes: IChannelAttributes | undefined;\n\tif (await services.objectStorage.contains(attributesBlobKey)) {\n\t\tattributes = await readAndParse<IChannelAttributes | undefined>(\n\t\t\tservices.objectStorage,\n\t\t\tattributesBlobKey,\n\t\t);\n\t}\n\n\t// This is a backward compatibility case where the attach message doesn't include attributes. They must\n\t// include attach message type.\n\t// Since old attach messages will not have attributes, we need to keep this as long as we support old attach\n\t// messages.\n\tconst channelFactoryType = attributes ? attributes.type : attachMessageType;\n\tif (channelFactoryType === undefined) {\n\t\tthrow new DataCorruptionError(\n\t\t\t\"channelTypeNotAvailable\",\n\t\t\ttagCodeArtifacts({\n\t\t\t\tchannelId,\n\t\t\t\tdataStoreId: dataStoreContext.id,\n\t\t\t\tdataStorePackagePath: dataStoreContext.packagePath.join(\"/\"),\n\t\t\t\tchannelFactoryType,\n\t\t\t}),\n\t\t);\n\t}\n\tconst factory = registry.get(channelFactoryType);\n\tif (factory === undefined) {\n\t\tthrow new DataCorruptionError(\n\t\t\t\"channelFactoryNotRegisteredForGivenType\",\n\t\t\ttagCodeArtifacts({\n\t\t\t\tchannelId,\n\t\t\t\tdataStoreId: dataStoreContext.id,\n\t\t\t\tdataStorePackagePath: dataStoreContext.packagePath.join(\"/\"),\n\t\t\t\tchannelFactoryType,\n\t\t\t}),\n\t\t);\n\t}\n\t// This is a backward compatibility case where the attach message doesn't include attributes. Get the attributes\n\t// from the factory.\n\tattributes = attributes ?? factory.attributes;\n\treturn { factory, attributes };\n}\n\nexport async function loadChannel(\n\tdataStoreRuntime: IFluidDataStoreRuntime,\n\tattributes: IChannelAttributes,\n\tfactory: IChannelFactory,\n\tservices: ChannelServiceEndpoints,\n\tlogger: ITelemetryLoggerExt,\n\tchannelId: string,\n): Promise<IChannel> {\n\t// Compare snapshot version to collaborative object version\n\tif (\n\t\tattributes.snapshotFormatVersion !== undefined &&\n\t\tattributes.snapshotFormatVersion !== factory.attributes.snapshotFormatVersion\n\t) {\n\t\tlogger.sendTelemetryEvent({\n\t\t\teventName: \"ChannelAttributesVersionMismatch\",\n\t\t\t...tagCodeArtifacts({\n\t\t\t\tchannelType: attributes.type,\n\t\t\t\tchannelSnapshotVersion: `${attributes.snapshotFormatVersion}@${attributes.packageVersion}`,\n\t\t\t\tchannelCodeVersion: `${factory.attributes.snapshotFormatVersion}@${factory.attributes.packageVersion}`,\n\t\t\t}),\n\t\t});\n\t}\n\n\treturn factory.load(dataStoreRuntime, channelId, services, attributes);\n}\n"]}
|