@fluidframework/datastore 2.23.0 → 2.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +285 -253
- package/api-report/datastore.legacy.alpha.api.md +1 -2
- package/dist/channelDeltaConnection.d.ts.map +1 -1
- package/dist/channelDeltaConnection.js +6 -19
- package/dist/channelDeltaConnection.js.map +1 -1
- package/dist/dataStoreLayerCompatState.d.ts +35 -0
- package/dist/dataStoreLayerCompatState.d.ts.map +1 -0
- package/dist/dataStoreLayerCompatState.js +74 -0
- package/dist/dataStoreLayerCompatState.js.map +1 -0
- package/dist/dataStoreRuntime.d.ts +8 -6
- package/dist/dataStoreRuntime.d.ts.map +1 -1
- package/dist/dataStoreRuntime.js +13 -19
- package/dist/dataStoreRuntime.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/lib/channelDeltaConnection.d.ts.map +1 -1
- package/lib/channelDeltaConnection.js +6 -19
- package/lib/channelDeltaConnection.js.map +1 -1
- package/lib/dataStoreLayerCompatState.d.ts +35 -0
- package/lib/dataStoreLayerCompatState.d.ts.map +1 -0
- package/lib/dataStoreLayerCompatState.js +70 -0
- package/lib/dataStoreLayerCompatState.js.map +1 -0
- package/lib/dataStoreRuntime.d.ts +8 -6
- package/lib/dataStoreRuntime.d.ts.map +1 -1
- package/lib/dataStoreRuntime.js +15 -19
- package/lib/dataStoreRuntime.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/tsdoc-metadata.json +1 -1
- package/package.json +19 -20
- package/src/channelDeltaConnection.ts +8 -19
- package/src/dataStoreLayerCompatState.ts +85 -0
- package/src/dataStoreRuntime.ts +23 -25
- package/src/packageVersion.ts +1 -1
- package/prettier.config.cjs +0 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/datastore",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.31.0",
|
|
4
4
|
"description": "Fluid data store implementation",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -69,44 +69,45 @@
|
|
|
69
69
|
"temp-directory": "nyc/.nyc_output"
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
|
-
"@fluid-internal/client-utils": "~2.
|
|
73
|
-
"@fluidframework/container-definitions": "~2.
|
|
74
|
-
"@fluidframework/core-interfaces": "~2.
|
|
75
|
-
"@fluidframework/core-utils": "~2.
|
|
76
|
-
"@fluidframework/datastore-definitions": "~2.
|
|
77
|
-
"@fluidframework/driver-definitions": "~2.
|
|
78
|
-
"@fluidframework/driver-utils": "~2.
|
|
79
|
-
"@fluidframework/id-compressor": "~2.
|
|
80
|
-
"@fluidframework/runtime-definitions": "~2.
|
|
81
|
-
"@fluidframework/runtime-utils": "~2.
|
|
82
|
-
"@fluidframework/telemetry-utils": "~2.
|
|
72
|
+
"@fluid-internal/client-utils": "~2.31.0",
|
|
73
|
+
"@fluidframework/container-definitions": "~2.31.0",
|
|
74
|
+
"@fluidframework/core-interfaces": "~2.31.0",
|
|
75
|
+
"@fluidframework/core-utils": "~2.31.0",
|
|
76
|
+
"@fluidframework/datastore-definitions": "~2.31.0",
|
|
77
|
+
"@fluidframework/driver-definitions": "~2.31.0",
|
|
78
|
+
"@fluidframework/driver-utils": "~2.31.0",
|
|
79
|
+
"@fluidframework/id-compressor": "~2.31.0",
|
|
80
|
+
"@fluidframework/runtime-definitions": "~2.31.0",
|
|
81
|
+
"@fluidframework/runtime-utils": "~2.31.0",
|
|
82
|
+
"@fluidframework/telemetry-utils": "~2.31.0",
|
|
83
83
|
"uuid": "^9.0.0"
|
|
84
84
|
},
|
|
85
85
|
"devDependencies": {
|
|
86
86
|
"@arethetypeswrong/cli": "^0.17.1",
|
|
87
87
|
"@biomejs/biome": "~1.9.3",
|
|
88
|
-
"@fluid-internal/mocha-test-setup": "~2.
|
|
88
|
+
"@fluid-internal/mocha-test-setup": "~2.31.0",
|
|
89
89
|
"@fluid-tools/build-cli": "^0.54.0",
|
|
90
90
|
"@fluidframework/build-common": "^2.0.3",
|
|
91
91
|
"@fluidframework/build-tools": "^0.54.0",
|
|
92
|
-
"@fluidframework/datastore-previous": "npm:@fluidframework/datastore@2.
|
|
92
|
+
"@fluidframework/datastore-previous": "npm:@fluidframework/datastore@2.30.0",
|
|
93
93
|
"@fluidframework/eslint-config-fluid": "^5.7.3",
|
|
94
|
-
"@fluidframework/test-runtime-utils": "~2.
|
|
95
|
-
"@microsoft/api-extractor": "7.
|
|
94
|
+
"@fluidframework/test-runtime-utils": "~2.31.0",
|
|
95
|
+
"@microsoft/api-extractor": "7.50.1",
|
|
96
96
|
"@types/lodash": "^4.14.118",
|
|
97
97
|
"@types/mocha": "^10.0.10",
|
|
98
98
|
"@types/node": "^18.19.0",
|
|
99
|
+
"@types/sinon": "^17.0.3",
|
|
99
100
|
"@types/uuid": "^9.0.2",
|
|
100
101
|
"c8": "^8.0.1",
|
|
101
102
|
"concurrently": "^8.2.1",
|
|
102
103
|
"copyfiles": "^2.4.1",
|
|
103
104
|
"cross-env": "^7.0.3",
|
|
104
105
|
"eslint": "~8.55.0",
|
|
105
|
-
"mocha": "^10.2
|
|
106
|
+
"mocha": "^10.8.2",
|
|
106
107
|
"mocha-multi-reporters": "^1.5.1",
|
|
107
108
|
"moment": "^2.21.0",
|
|
108
|
-
"prettier": "~3.0.3",
|
|
109
109
|
"rimraf": "^4.4.0",
|
|
110
|
+
"sinon": "^18.0.1",
|
|
110
111
|
"typescript": "~5.4.5"
|
|
111
112
|
},
|
|
112
113
|
"typeValidation": {
|
|
@@ -138,7 +139,6 @@
|
|
|
138
139
|
"check:exports:esm:legacy": "api-extractor run --config api-extractor/api-extractor-lint-legacy.esm.json",
|
|
139
140
|
"check:exports:esm:public": "api-extractor run --config api-extractor/api-extractor-lint-public.esm.json",
|
|
140
141
|
"check:format": "npm run check:biome",
|
|
141
|
-
"check:prettier": "prettier --check . --cache --ignore-path ../../../.prettierignore",
|
|
142
142
|
"ci:build:api-reports": "concurrently \"npm:ci:build:api-reports:*\"",
|
|
143
143
|
"ci:build:api-reports:current": "api-extractor run --config api-extractor/api-extractor.current.json",
|
|
144
144
|
"ci:build:api-reports:legacy": "api-extractor run --config api-extractor/api-extractor.legacy.json",
|
|
@@ -148,7 +148,6 @@
|
|
|
148
148
|
"eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
|
|
149
149
|
"format": "npm run format:biome",
|
|
150
150
|
"format:biome": "biome check . --write",
|
|
151
|
-
"format:prettier": "prettier --write . --cache --ignore-path ../../../.prettierignore",
|
|
152
151
|
"lint": "fluid-build . --task lint",
|
|
153
152
|
"lint:fix": "fluid-build . --task eslint:fix --task format",
|
|
154
153
|
"place:cjs:package-stub": "copyfiles -f ../../../common/build/build-common/src/cjs/package.json ./dist",
|
|
@@ -8,7 +8,6 @@ import {
|
|
|
8
8
|
IDeltaConnection,
|
|
9
9
|
IDeltaHandler,
|
|
10
10
|
} from "@fluidframework/datastore-definitions/internal";
|
|
11
|
-
import type { ISequencedDocumentMessage } from "@fluidframework/driver-definitions/internal";
|
|
12
11
|
import type {
|
|
13
12
|
IRuntimeMessageCollection,
|
|
14
13
|
IRuntimeMessagesContent,
|
|
@@ -100,30 +99,20 @@ export class ChannelDeltaConnection implements IDeltaConnection {
|
|
|
100
99
|
}
|
|
101
100
|
|
|
102
101
|
public processMessages(messageCollection: IRuntimeMessageCollection): void {
|
|
103
|
-
const { envelope, messagesContent, local } = messageCollection;
|
|
104
102
|
// catches as data processing error whether or not they come from async pending queues
|
|
105
103
|
try {
|
|
106
|
-
const newMessagesContent = getContentsWithStashedOpHandling(
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}
|
|
113
|
-
for (const { contents, localOpMetadata, clientSequenceNumber } of newMessagesContent) {
|
|
114
|
-
const compatMessage: ISequencedDocumentMessage = {
|
|
115
|
-
...envelope,
|
|
116
|
-
contents,
|
|
117
|
-
clientSequenceNumber,
|
|
118
|
-
};
|
|
119
|
-
this.handler.process(compatMessage, local, localOpMetadata);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
104
|
+
const newMessagesContent = getContentsWithStashedOpHandling(
|
|
105
|
+
messageCollection.messagesContent,
|
|
106
|
+
);
|
|
107
|
+
this.handler.processMessages({
|
|
108
|
+
...messageCollection,
|
|
109
|
+
messagesContent: newMessagesContent,
|
|
110
|
+
});
|
|
122
111
|
} catch (error) {
|
|
123
112
|
throw DataProcessingError.wrapIfUnrecognized(
|
|
124
113
|
error,
|
|
125
114
|
"channelDeltaConnectionFailedToProcessMessages",
|
|
126
|
-
envelope,
|
|
115
|
+
messageCollection.envelope,
|
|
127
116
|
);
|
|
128
117
|
}
|
|
129
118
|
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
checkLayerCompatibility,
|
|
8
|
+
type ILayerCompatDetails,
|
|
9
|
+
type ILayerCompatSupportRequirements,
|
|
10
|
+
} from "@fluid-internal/client-utils";
|
|
11
|
+
import { UsageError } from "@fluidframework/telemetry-utils/internal";
|
|
12
|
+
|
|
13
|
+
import { pkgVersion } from "./packageVersion.js";
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* The core compatibility details of the DataStore layer that is the same across all layer boundaries.
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
export const dataStoreCoreCompatDetails = {
|
|
20
|
+
/**
|
|
21
|
+
* The package version of the Runtime layer.
|
|
22
|
+
*/
|
|
23
|
+
pkgVersion,
|
|
24
|
+
/**
|
|
25
|
+
* The current generation of the Runtime layer.
|
|
26
|
+
*/
|
|
27
|
+
generation: 1,
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* DataStore's compatibility details that is exposed to the Runtime layer.
|
|
32
|
+
* @internal
|
|
33
|
+
*/
|
|
34
|
+
export const dataStoreCompatDetailsForRuntime: ILayerCompatDetails = {
|
|
35
|
+
...dataStoreCoreCompatDetails,
|
|
36
|
+
/**
|
|
37
|
+
* The features supported by the DataStore layer across the DataStore / Runtime boundary.
|
|
38
|
+
*/
|
|
39
|
+
supportedFeatures: new Set<string>(),
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* The requirements that the Runtime layer must meet to be compatible with this DataStore.
|
|
44
|
+
* @internal
|
|
45
|
+
*/
|
|
46
|
+
export const runtimeSupportRequirements: ILayerCompatSupportRequirements = {
|
|
47
|
+
/**
|
|
48
|
+
* Minimum generation that Runtime must be at to be compatible with DataStore. Note that 0 is used here so
|
|
49
|
+
* that Runtime layers before the introduction of the layer compatibility enforcement are compatible.
|
|
50
|
+
*/
|
|
51
|
+
minSupportedGeneration: 0,
|
|
52
|
+
/**
|
|
53
|
+
* The features that the Runtime must support to be compatible with DataStore.
|
|
54
|
+
*/
|
|
55
|
+
requiredFeatures: [],
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Validates that the Runtime layer is compatible with this DataStore.
|
|
60
|
+
* @internal
|
|
61
|
+
*/
|
|
62
|
+
export function validateRuntimeCompatibility(
|
|
63
|
+
maybeRuntimeCompatDetails: ILayerCompatDetails | undefined,
|
|
64
|
+
disposeFn: () => void,
|
|
65
|
+
): void {
|
|
66
|
+
const layerCheckResult = checkLayerCompatibility(
|
|
67
|
+
runtimeSupportRequirements,
|
|
68
|
+
maybeRuntimeCompatDetails,
|
|
69
|
+
);
|
|
70
|
+
if (!layerCheckResult.isCompatible) {
|
|
71
|
+
const error = new UsageError("DataStore is not compatible with Runtime", {
|
|
72
|
+
errorDetails: JSON.stringify({
|
|
73
|
+
dataStoreVersion: dataStoreCoreCompatDetails.pkgVersion,
|
|
74
|
+
runtimeVersion: maybeRuntimeCompatDetails?.pkgVersion,
|
|
75
|
+
dataStoreGeneration: dataStoreCoreCompatDetails.generation,
|
|
76
|
+
runtimeGeneration: maybeRuntimeCompatDetails?.generation,
|
|
77
|
+
minSupportedGeneration: runtimeSupportRequirements.minSupportedGeneration,
|
|
78
|
+
isGenerationCompatible: layerCheckResult.isGenerationCompatible,
|
|
79
|
+
unsupportedFeatures: layerCheckResult.unsupportedFeatures,
|
|
80
|
+
}),
|
|
81
|
+
});
|
|
82
|
+
disposeFn();
|
|
83
|
+
throw error;
|
|
84
|
+
}
|
|
85
|
+
}
|
package/src/dataStoreRuntime.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { TypedEventEmitter } from "@fluid-internal/client-utils";
|
|
6
|
+
import { TypedEventEmitter, type ILayerCompatDetails } from "@fluid-internal/client-utils";
|
|
7
7
|
import { AttachState, IAudience } from "@fluidframework/container-definitions";
|
|
8
8
|
import { IDeltaManager } from "@fluidframework/container-definitions/internal";
|
|
9
9
|
import {
|
|
@@ -88,6 +88,11 @@ import {
|
|
|
88
88
|
import { v4 as uuid } from "uuid";
|
|
89
89
|
|
|
90
90
|
import { IChannelContext, summarizeChannel } from "./channelContext.js";
|
|
91
|
+
import {
|
|
92
|
+
dataStoreCompatDetailsForRuntime,
|
|
93
|
+
// dataStoreCompatDetailsForRuntime,
|
|
94
|
+
validateRuntimeCompatibility,
|
|
95
|
+
} from "./dataStoreLayerCompatState.js";
|
|
91
96
|
import { FluidObjectHandle } from "./fluidHandle.js";
|
|
92
97
|
import {
|
|
93
98
|
LocalChannelContext,
|
|
@@ -215,6 +220,15 @@ export class FluidDataStoreRuntime
|
|
|
215
220
|
*/
|
|
216
221
|
private localChangesTelemetryCount: number;
|
|
217
222
|
|
|
223
|
+
/**
|
|
224
|
+
* The compatibility details of the DataStore layer that is exposed to the Runtime layer
|
|
225
|
+
* for validating Runtime-DataStore compatibility.
|
|
226
|
+
* @remarks This is for internal use only.
|
|
227
|
+
* The type of this should be ILayerCompatDetails. However, ILayerCompatDetails is internal and this class
|
|
228
|
+
* is currently marked as legacy alpha. So, using unknown here.
|
|
229
|
+
*/
|
|
230
|
+
public readonly ILayerCompatDetails?: unknown = dataStoreCompatDetailsForRuntime;
|
|
231
|
+
|
|
218
232
|
/**
|
|
219
233
|
* Create an instance of a DataStore runtime.
|
|
220
234
|
*
|
|
@@ -239,6 +253,13 @@ export class FluidDataStoreRuntime
|
|
|
239
253
|
0x30e /* Id cannot contain slashes. DataStoreContext should have validated this. */,
|
|
240
254
|
);
|
|
241
255
|
|
|
256
|
+
// Validate that the Runtime is compatible with this DataStore.
|
|
257
|
+
const maybeRuntimeCompatDetails = dataStoreContext as FluidObject<ILayerCompatDetails>;
|
|
258
|
+
validateRuntimeCompatibility(
|
|
259
|
+
maybeRuntimeCompatDetails.ILayerCompatDetails,
|
|
260
|
+
this.dispose.bind(this),
|
|
261
|
+
);
|
|
262
|
+
|
|
242
263
|
this.mc = createChildMonitoringContext({
|
|
243
264
|
logger: dataStoreContext.baseLogger,
|
|
244
265
|
namespace: "FluidDataStoreRuntime",
|
|
@@ -463,7 +484,7 @@ export class FluidDataStoreRuntime
|
|
|
463
484
|
* in the snapshot.
|
|
464
485
|
* So, return short ids only if explicitly enabled via feature flags. Else, return uuid();
|
|
465
486
|
*/
|
|
466
|
-
if (this.mc.config.getBoolean("Fluid.Runtime.
|
|
487
|
+
if (this.mc.config.getBoolean("Fluid.Runtime.IsShortIdEnabled") === true) {
|
|
467
488
|
// We use three non-overlapping namespaces:
|
|
468
489
|
// - detached state: even numbers
|
|
469
490
|
// - attached state: odd numbers
|
|
@@ -788,29 +809,6 @@ export class FluidDataStoreRuntime
|
|
|
788
809
|
}
|
|
789
810
|
}
|
|
790
811
|
|
|
791
|
-
/**
|
|
792
|
-
* back-compat ADO 21575.
|
|
793
|
-
* @deprecated {@link FluidDataStoreRuntime.processMessages} should be used instead to process messages. This is still here for back-compat
|
|
794
|
-
* because it exists on IFluidDataStoreChannel. Once it is removed from the interface, this method can be removed.
|
|
795
|
-
*/
|
|
796
|
-
public process(
|
|
797
|
-
message: ISequencedDocumentMessage,
|
|
798
|
-
local: boolean,
|
|
799
|
-
localOpMetadata: unknown,
|
|
800
|
-
) {
|
|
801
|
-
this.processMessages({
|
|
802
|
-
envelope: message,
|
|
803
|
-
messagesContent: [
|
|
804
|
-
{
|
|
805
|
-
contents: message.contents,
|
|
806
|
-
localOpMetadata,
|
|
807
|
-
clientSequenceNumber: message.clientSequenceNumber,
|
|
808
|
-
},
|
|
809
|
-
],
|
|
810
|
-
local,
|
|
811
|
-
});
|
|
812
|
-
}
|
|
813
|
-
|
|
814
812
|
public processSignal(message: IInboundSignalMessage, local: boolean) {
|
|
815
813
|
this.emit("signal", message, local);
|
|
816
814
|
}
|
package/src/packageVersion.ts
CHANGED