@fluidframework/datastore 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.
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export declare const pkgName = "@fluidframework/datastore";
8
- export declare const pkgVersion = "2.30.0";
8
+ export declare const pkgVersion = "2.31.1";
9
9
  //# sourceMappingURL=packageVersion.d.ts.map
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export const pkgName = "@fluidframework/datastore";
8
- export const pkgVersion = "2.30.0";
8
+ export const pkgVersion = "2.31.1";
9
9
  //# sourceMappingURL=packageVersion.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,2BAA2B,CAAC;AACnD,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/datastore\";\nexport const pkgVersion = \"2.30.0\";\n"]}
1
+ {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,2BAA2B,CAAC;AACnD,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/datastore\";\nexport const pkgVersion = \"2.31.1\";\n"]}
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.47.8"
8
+ "packageVersion": "7.50.1"
9
9
  }
10
10
  ]
11
11
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/datastore",
3
- "version": "2.30.0",
3
+ "version": "2.31.1",
4
4
  "description": "Fluid data store implementation",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -69,33 +69,34 @@
69
69
  "temp-directory": "nyc/.nyc_output"
70
70
  },
71
71
  "dependencies": {
72
- "@fluid-internal/client-utils": "~2.30.0",
73
- "@fluidframework/container-definitions": "~2.30.0",
74
- "@fluidframework/core-interfaces": "~2.30.0",
75
- "@fluidframework/core-utils": "~2.30.0",
76
- "@fluidframework/datastore-definitions": "~2.30.0",
77
- "@fluidframework/driver-definitions": "~2.30.0",
78
- "@fluidframework/driver-utils": "~2.30.0",
79
- "@fluidframework/id-compressor": "~2.30.0",
80
- "@fluidframework/runtime-definitions": "~2.30.0",
81
- "@fluidframework/runtime-utils": "~2.30.0",
82
- "@fluidframework/telemetry-utils": "~2.30.0",
72
+ "@fluid-internal/client-utils": "~2.31.1",
73
+ "@fluidframework/container-definitions": "~2.31.1",
74
+ "@fluidframework/core-interfaces": "~2.31.1",
75
+ "@fluidframework/core-utils": "~2.31.1",
76
+ "@fluidframework/datastore-definitions": "~2.31.1",
77
+ "@fluidframework/driver-definitions": "~2.31.1",
78
+ "@fluidframework/driver-utils": "~2.31.1",
79
+ "@fluidframework/id-compressor": "~2.31.1",
80
+ "@fluidframework/runtime-definitions": "~2.31.1",
81
+ "@fluidframework/runtime-utils": "~2.31.1",
82
+ "@fluidframework/telemetry-utils": "~2.31.1",
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.30.0",
88
+ "@fluid-internal/mocha-test-setup": "~2.31.1",
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.23.0",
92
+ "@fluidframework/datastore-previous": "npm:@fluidframework/datastore@2.31.0",
93
93
  "@fluidframework/eslint-config-fluid": "^5.7.3",
94
- "@fluidframework/test-runtime-utils": "~2.30.0",
95
- "@microsoft/api-extractor": "7.47.8",
94
+ "@fluidframework/test-runtime-utils": "~2.31.1",
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",
@@ -105,19 +106,12 @@
105
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": {
113
- "broken": {
114
- "Class_FluidDataStoreRuntime": {
115
- "backCompat": false
116
- },
117
- "ClassStatics_FluidDataStoreRuntime": {
118
- "backCompat": false
119
- }
120
- },
114
+ "broken": {},
121
115
  "entrypoint": "legacy"
122
116
  },
123
117
  "scripts": {
@@ -145,7 +139,6 @@
145
139
  "check:exports:esm:legacy": "api-extractor run --config api-extractor/api-extractor-lint-legacy.esm.json",
146
140
  "check:exports:esm:public": "api-extractor run --config api-extractor/api-extractor-lint-public.esm.json",
147
141
  "check:format": "npm run check:biome",
148
- "check:prettier": "prettier --check . --cache --ignore-path ../../../.prettierignore",
149
142
  "ci:build:api-reports": "concurrently \"npm:ci:build:api-reports:*\"",
150
143
  "ci:build:api-reports:current": "api-extractor run --config api-extractor/api-extractor.current.json",
151
144
  "ci:build:api-reports:legacy": "api-extractor run --config api-extractor/api-extractor.legacy.json",
@@ -155,7 +148,6 @@
155
148
  "eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
156
149
  "format": "npm run format:biome",
157
150
  "format:biome": "biome check . --write",
158
- "format:prettier": "prettier --write . --cache --ignore-path ../../../.prettierignore",
159
151
  "lint": "fluid-build . --task lint",
160
152
  "lint:fix": "fluid-build . --task eslint:fix --task format",
161
153
  "place:cjs:package-stub": "copyfiles -f ../../../common/build/build-common/src/cjs/package.json ./dist",
@@ -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
+ }
@@ -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.UseShortIds") === true) {
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
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/datastore";
9
- export const pkgVersion = "2.30.0";
9
+ export const pkgVersion = "2.31.1";
@@ -1,8 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
-
6
- module.exports = {
7
- ...require("@fluidframework/build-common/prettier.config.cjs"),
8
- };