@fluidframework/runtime-utils 2.118.0 → 3.0.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.
Files changed (80) hide show
  1. package/CHANGELOG.md +34 -4
  2. package/README.md +53 -50
  3. package/{api-extractor.json → api-extractor/api-extractor-model.json} +1 -1
  4. package/dist/compatibilityBase.d.ts +27 -54
  5. package/dist/compatibilityBase.d.ts.map +1 -1
  6. package/dist/compatibilityBase.js +49 -74
  7. package/dist/compatibilityBase.js.map +1 -1
  8. package/dist/dataStoreHandleContextUtils.js +1 -2
  9. package/dist/dataStoreHandleContextUtils.js.map +1 -1
  10. package/dist/dataStoreHelpers.d.ts.map +1 -1
  11. package/dist/dataStoreHelpers.js +6 -6
  12. package/dist/dataStoreHelpers.js.map +1 -1
  13. package/dist/deltaManager.js +2 -3
  14. package/dist/deltaManager.js.map +1 -1
  15. package/dist/handles.d.ts +1 -1
  16. package/dist/handles.d.ts.map +1 -1
  17. package/dist/handles.js +7 -7
  18. package/dist/handles.js.map +1 -1
  19. package/dist/objectstoragepartition.js +2 -0
  20. package/dist/objectstoragepartition.js.map +1 -1
  21. package/dist/objectstorageutils.js +2 -3
  22. package/dist/objectstorageutils.js.map +1 -1
  23. package/dist/packageVersion.d.ts +1 -1
  24. package/dist/packageVersion.d.ts.map +1 -1
  25. package/dist/packageVersion.js +1 -1
  26. package/dist/packageVersion.js.map +1 -1
  27. package/dist/remoteFluidObjectHandle.js +5 -1
  28. package/dist/remoteFluidObjectHandle.js.map +1 -1
  29. package/dist/requestParser.js +4 -0
  30. package/dist/requestParser.js.map +1 -1
  31. package/dist/serviceClientBase.js +14 -6
  32. package/dist/serviceClientBase.js.map +1 -1
  33. package/dist/serviceClientUtils.js +6 -4
  34. package/dist/serviceClientUtils.js.map +1 -1
  35. package/dist/snapshotUtils.js +1 -2
  36. package/dist/snapshotUtils.js.map +1 -1
  37. package/dist/summaryUtils.d.ts.map +1 -1
  38. package/dist/summaryUtils.js +18 -22
  39. package/dist/summaryUtils.js.map +1 -1
  40. package/dist/unpackUsedRoutes.js +1 -2
  41. package/dist/unpackUsedRoutes.js.map +1 -1
  42. package/dist/utils.js +3 -3
  43. package/dist/utils.js.map +1 -1
  44. package/lib/compatibilityBase.d.ts +27 -54
  45. package/lib/compatibilityBase.d.ts.map +1 -1
  46. package/lib/compatibilityBase.js +40 -65
  47. package/lib/compatibilityBase.js.map +1 -1
  48. package/lib/dataStoreHelpers.d.ts.map +1 -1
  49. package/lib/handles.d.ts +1 -1
  50. package/lib/handles.d.ts.map +1 -1
  51. package/lib/legacy.d.ts +1 -1
  52. package/lib/legacyAlpha.d.ts +1 -1
  53. package/lib/objectstoragepartition.js +2 -0
  54. package/lib/objectstoragepartition.js.map +1 -1
  55. package/lib/packageVersion.d.ts +1 -1
  56. package/lib/packageVersion.d.ts.map +1 -1
  57. package/lib/packageVersion.js +1 -1
  58. package/lib/packageVersion.js.map +1 -1
  59. package/lib/public.d.ts +1 -1
  60. package/lib/remoteFluidObjectHandle.js +5 -1
  61. package/lib/remoteFluidObjectHandle.js.map +1 -1
  62. package/lib/requestParser.js +4 -0
  63. package/lib/requestParser.js.map +1 -1
  64. package/lib/serviceClientBase.js +12 -4
  65. package/lib/serviceClientBase.js.map +1 -1
  66. package/lib/serviceClientUtils.js +2 -0
  67. package/lib/serviceClientUtils.js.map +1 -1
  68. package/lib/summaryUtils.d.ts.map +1 -1
  69. package/lib/summaryUtils.js +6 -10
  70. package/lib/summaryUtils.js.map +1 -1
  71. package/package.json +37 -54
  72. package/src/compatibilityBase.ts +62 -82
  73. package/src/packageVersion.ts +1 -1
  74. package/src/summaryUtils.ts +1 -3
  75. package/tsconfig.json +1 -1
  76. package/internal.d.ts +0 -11
  77. package/legacy/alpha.d.ts +0 -11
  78. package/legacy.d.ts +0 -11
  79. /package/api-extractor/{api-extractor.current.json → api-extractor-report.current.json} +0 -0
  80. /package/api-extractor/{api-extractor.legacy.json → api-extractor-report.legacy.json} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,12 +1,42 @@
1
1
  # @fluidframework/runtime-utils
2
2
 
3
- ## 2.118.0
3
+ ## 3.0.0
4
4
 
5
- Dependency updates only.
5
+ ### Minor Changes
6
6
 
7
- ## 2.117.0
7
+ - Removal of direct CommonJS support ([#28124](https://github.com/microsoft/FluidFramework/pull/28124)) [0f84e3b8878](https://github.com/microsoft/FluidFramework/commit/0f84e3b8878a5e75b2253976d98fd963bbd9db88)
8
8
 
9
- Dependency updates only.
9
+ Direct `require()` import is no longer directly supported.
10
+ Package is transpiled as ECMAScript Module.
11
+
12
+ See [Removal of direct CommonJS support in v3.0](https://github.com/microsoft/FluidFramework/issues/27444) for more information.
13
+
14
+ - Require modern TypeScript module resolution ([#27970](https://github.com/microsoft/FluidFramework/pull/27970)) [325e2016ca9](https://github.com/microsoft/FluidFramework/commit/325e2016ca9978d4a1f7552c97ba34feac9df41f)
15
+
16
+ Fluid Framework Client packages no longer include type declaration compatibility entrypoints for TypeScript's legacy Node10 resolution mode (`"moduleResolution": "node"` or `"node10"`).
17
+ Applications upgrading to Fluid Framework 3.0 must use one of the following supported configurations:
18
+ - `"module": "Node16"` with `"moduleResolution": "Node16"`
19
+ - `"module": "NodeNext"` with `"moduleResolution": "NodeNext"`
20
+ - `"module": "ESNext"` with `"moduleResolution": "Bundler"`
21
+
22
+ Existing public package entrypoints exposed through `package.json` exports, including `/alpha`, `/beta`, and `/legacy`, remain available under supported module resolution modes.
23
+
24
+ See [Removal of Node10 resolutions in v3.0](https://github.com/microsoft/FluidFramework/issues/27457) for more information.
25
+
26
+ - Client packages now target ES2022 ([#27846](https://github.com/microsoft/FluidFramework/pull/27846)) [91c78541bdd](https://github.com/microsoft/FluidFramework/commit/91c78541bddcbca5d6c5f357b023eeaee617d885)
27
+
28
+ The TypeScript compilation `target` and `lib` for the Fluid Framework client packages have been raised from ES2021/ES2020 to **ES2022**.
29
+ The published JavaScript now uses ES2022 language features (with correspondingly less down-leveling), so consuming these packages requires a runtime that supports ES2022.
30
+ All actively supported Node.js versions and evergreen browsers already meet this requirement.
31
+
32
+ Note that Fluid Framework has not officially supported targets older than ES2022 since before 2.0: this is documented in [ClientRequirements.md](https://github.com/microsoft/FluidFramework/blob/main/ClientRequirements.md) as well as the README for every client package.
33
+
34
+ It is possible this change could impact users of less up to date JavaScript runtimes.
35
+ Impacted users can use a tool like [babel](https://babeljs.io/) to transpile out unsupported language features.
36
+
37
+ - Build with TypeScript 6 ([#28052](https://github.com/microsoft/FluidFramework/pull/28052)) [7ab015c49de](https://github.com/microsoft/FluidFramework/commit/7ab015c49deec84833cdfe1fb5e1606b901f6e81)
38
+
39
+ FluidFramework Client SDK is now built using TypeScript 6. Consumers should build with TypeScript v6 or v7 or compatible tooling.
10
40
 
11
41
  ## 2.116.0
12
42
 
package/README.md CHANGED
@@ -9,15 +9,15 @@ This package contains code for common utilities used by Fluid Framework runtimes
9
9
 
10
10
  ## Using Fluid Framework libraries
11
11
 
12
- When taking a dependency on a Fluid Framework library's public APIs, we recommend using a `^` (caret) version range, such as `^1.3.4`.
13
- While Fluid Framework libraries may use different ranges with interdependencies between other Fluid Framework libraries,
14
- library consumers should always prefer `^`.
12
+ For a dependency on a Fluid Framework library's public APIs, we recommend a `^` (caret) version range.
13
+ For example, use `^1.3.4`.
15
14
 
16
- If using any of Fluid Framework's unstable APIs (for example, its `beta` APIs), we recommend using a more constrained version range, such as `~`.
15
+ For a dependency on an unstable API, such as a `beta` API, we recommend a more restrictive version range.
16
+ For example, use a `~` version range.
17
17
 
18
18
  ## Installation
19
19
 
20
- To get started, install the package by running the following command:
20
+ Run this command to install the package:
21
21
 
22
22
  ```bash
23
23
  npm i @fluidframework/runtime-utils
@@ -25,16 +25,16 @@ npm i @fluidframework/runtime-utils
25
25
 
26
26
  ## Importing from this package
27
27
 
28
- This package leverages [package.json exports](https://nodejs.org/api/packages.html#exports) to separate its APIs by support level.
29
- For more information on the related support guarantees, see [API Support Levels](https://fluidframework.com/docs/build/releases-and-apitags/#api-support-levels).
28
+ This package uses [package.json exports](https://nodejs.org/api/packages.html#exports) to separate APIs by support level.
29
+ For information about the support guarantees, read [API Support Levels](https://fluidframework.com/docs/build/releases-and-apitags/#api-support-levels).
30
30
 
31
- To access the `public` ([SemVer](https://semver.org/)) APIs, import via `@fluidframework/runtime-utils` like normal.
31
+ Import the `public` APIs from `@fluidframework/runtime-utils`.
32
32
 
33
- To access the `legacy` APIs, import via `@fluidframework/runtime-utils/legacy`.
33
+ Import the `legacy` APIs from `@fluidframework/runtime-utils/legacy`.
34
34
 
35
35
  ## API Documentation
36
36
 
37
- API documentation for **@fluidframework/runtime-utils** is available at <https://fluidframework.com/docs/apis/runtime-utils>.
37
+ Read the **@fluidframework/runtime-utils** API documentation at <https://fluidframework.com/docs/apis/runtime-utils>.
38
38
 
39
39
  <!-- prettier-ignore-end -->
40
40
 
@@ -47,62 +47,69 @@ API documentation for **@fluidframework/runtime-utils** is available at <https:/
47
47
 
48
48
  ## Minimum Client Requirements
49
49
 
50
- These are the platform requirements for the current version of Fluid Framework Client Packages.
51
- These requirements err on the side of being too strict since within a major version they can be relaxed over time, but not made stricter.
52
- For Long Term Support (LTS) versions this can require supporting these platforms for several years.
50
+ Fluid Framework client libraries support the platforms in this document.
51
+ These requirements are intentionally restrictive.
52
+ Within a major version series, we can relax these requirements, but we cannot make them stricter.
53
+ For a Long Term Support (LTS) version, we might need to support these platforms for several years.
53
54
 
54
- It is likely that other configurations will work, but they are not supported: if they stop working, we do not consider that a bug.
55
- If you would benefit from support for something not listed here, file an issue and the product team will evaluate your request.
56
- When making such a request please include if the configuration already works (and thus the request is just that it becomes officially supported), or if changes are required to get it working.
55
+ Other configurations can work, but Fluid Framework does not support them.
56
+ If an unsupported configuration stops working, we do not classify this as a bug.
57
+ To request support for a configuration that is not listed, file an issue.
58
+ The product team will evaluate your request.
59
+ In the issue, specify the current status of the configuration:
60
+
61
+ - The configuration works but needs official support.
62
+ - The configuration does not work and requires changes.
57
63
 
58
64
  ### Supported Runtimes
59
65
 
60
- - NodeJs ^22.22.2 except that we will drop support for it [when NodeJs 22 loses its upstream support on 2027-04-30](https://github.com/nodejs/release#release-schedule), and will support a newer LTS version of NodeJS at least 1 year before 22 is end-of-life.
61
- - Running Fluid in a Node.js environment with the `--no-experimental-fetch` flag is not supported.
62
- - Modern browsers supporting the es2022 standard library: in response to asks we can add explicit support for using babel to polyfill to target specific standards or runtimes (meaning we can avoid/remove use of things that don't polyfill robustly, but otherwise target modern standards).
66
+ - Fluid Framework supports Node.js versions 22 and 24 while they receive [upstream support](https://nodejs.org/en/about/previous-releases).
67
+ - Fluid Framework will stop support for version 22 [when upstream support ends on 2027-04-30](https://github.com/nodejs/release#release-schedule).
68
+ - Fluid Framework does not support Node.js with the `--no-experimental-fetch` flag.
69
+ - Fluid Framework supports modern browsers that support the ES2022 standard library.
63
70
 
64
71
  ### Supported Tools
65
72
 
66
- - TypeScript 5.4:
67
- - All [`strict`](https://www.typescriptlang.org/tsconfig) options are supported.
68
- - [`strictNullChecks`](https://www.typescriptlang.org/tsconfig) is required.
69
- - [Configuration options deprecated in 5.0](https://github.com/microsoft/TypeScript/issues/51909) are not supported.
70
- - `exactOptionalPropertyTypes` is currently not fully supported.
71
- If used, narrowing members of Fluid Framework types types using `in`, `Reflect.has`, `Object.hasOwn` or `Object.prototype.hasOwnProperty` should be avoided as they may incorrectly exclude `undefined` from the possible values in some cases.
73
+ - [TypeScript 6.0](https://typescriptdocs.com/release-notes/TypeScript%206.0):
74
+ - Fluid Framework supports all [`strict`](https://www.typescriptlang.org/tsconfig) options.
75
+ - Set the build targets (`lib`, `target`) to `ES2022` or later.
76
+ - Enable [`strictNullChecks`](https://www.typescriptlang.org/tsconfig).
77
+ - Fluid Framework does not support [configuration options deprecated in TypeScript 6.0](https://typescriptdocs.com/release-notes/TypeScript%206.0#breaking-changes-and-deprecations-in-typescript-6-0).
78
+ - Fluid Framework does not fully support `exactOptionalPropertyTypes`.
79
+ If you enable this option, do not use `in`, `Reflect.has`, `Object.hasOwn`, or `Object.prototype.hasOwnProperty` to narrow members of Fluid Framework types.
80
+ These methods can incorrectly exclude `undefined` from the possible values.
72
81
  - [webpack](https://webpack.js.org/) 5
73
- - We are not intending to be prescriptive about what bundler to use.
74
- Other bundlers which can handle ES Modules should work, but webpack is the only one we actively test.
82
+ - We do not require a specific bundler.
83
+ Other bundlers that handle ES Modules can work, but we actively test only webpack.
75
84
 
76
85
  ### Module Resolution
77
86
 
78
- [`Node16`, `NodeNext`, or `Bundler`](https://www.typescriptlang.org/tsconfig#moduleResolution) resolution should be used with TypeScript compilerOptions to follow the [Node.js v12+ ESM Resolution and Loading algorithm](https://nodejs.github.io/nodejs.dev/en/api/v20/esm/#resolution-and-loading-algorithm).
79
- Node10 resolution is not supported as it does not support Fluid Framework's API structuring pattern that is used to distinguish stable APIs from those that are in development.
87
+ In TypeScript `compilerOptions`, use [`Node16`, `Node20`, `NodeNext`, or `Bundler`](https://www.typescriptlang.org/tsconfig#moduleResolution) module resolution.
88
+ These settings follow the [Node.js v12+ ESM Resolution and Loading algorithm](https://nodejs.github.io/nodejs.dev/en/api/v20/esm/#resolution-and-loading-algorithm).
89
+
90
+ Do not use `Node10` module resolution.
80
91
 
81
92
  ### Module Formats
82
93
 
83
94
  - ES Modules:
84
- ES Modules are the preferred way to consume our client packages (including in NodeJs) and consuming our client packages from ES Modules is fully supported.
85
- - CommonJs:
86
- Consuming our client packages as CommonJs is supported only in NodeJS and only for the cases listed below.
87
- This is done to accommodate some workflows without good ES Module support.
88
- If you have a workflow you would like included in this list, file an issue.
89
- Once this list of workflows motivating CommonJS support is empty, we may drop support for CommonJS one year after notice of the change is posted here.
90
-
91
- - Testing with Jest (which lacks [stable ESM support](https://jestjs.io/docs/ecmascript-modules) due to [unstable APIs in NodeJs](https://github.com/nodejs/node/issues/37648))
95
+ Use ES Modules to consume Fluid Framework client packages, including in Node.js.
96
+ - CommonJS:
97
+ Fluid Framework does not officially support CommonJS in version 3.0 or later.
92
98
 
93
99
  ## Contribution Guidelines
94
100
 
95
- There are many ways to [contribute](https://github.com/microsoft/FluidFramework/blob/main/CONTRIBUTING.md) to Fluid.
101
+ You can [contribute](https://github.com/microsoft/FluidFramework/blob/main/CONTRIBUTING.md) to Fluid Framework in these ways:
96
102
 
97
- - Participate in Q&A in our [GitHub Discussions](https://github.com/microsoft/FluidFramework/discussions).
98
- - [Submit bugs](https://github.com/microsoft/FluidFramework/issues) and help us verify fixes as they are checked in.
99
- - Review the [source code changes](https://github.com/microsoft/FluidFramework/pulls).
103
+ - Answer questions in [GitHub Discussions](https://github.com/microsoft/FluidFramework/discussions).
104
+ - [Submit bug reports](https://github.com/microsoft/FluidFramework/issues) and help verify fixes.
105
+ - Review [source code changes](https://github.com/microsoft/FluidFramework/pulls).
100
106
  - [Contribute bug fixes](https://github.com/microsoft/FluidFramework/blob/main/CONTRIBUTING.md).
101
107
 
102
- Detailed instructions for working in the repo can be found in the [Wiki](https://github.com/microsoft/FluidFramework/blob/main/docs/content/Home.md).
108
+ For detailed instructions, read the [repo documentation](https://github.com/microsoft/FluidFramework/blob/main/docs/content/Home.md).
103
109
 
104
- This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
105
- For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
110
+ This project follows the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
111
+ For more information, read the [Code of Conduct frequently asked questions](https://opensource.microsoft.com/codeofconduct/faq/).
112
+ For questions or comments, contact [opencode@microsoft.com](mailto:opencode@microsoft.com).
106
113
 
107
114
  This project may contain Microsoft trademarks or logos for Microsoft projects, products, or services.
108
115
  Use of these trademarks or logos must follow Microsoft’s [Trademark & Brand Guidelines](https://www.microsoft.com/trademarks).
@@ -110,13 +117,9 @@ Use of Microsoft trademarks or logos in modified versions of this project must n
110
117
 
111
118
  ## Help
112
119
 
113
- Not finding what you're looking for in this README?
114
- Check out [fluidframework.com](https://fluidframework.com/docs/).
115
-
116
- Still not finding what you're looking for?
117
- Please [file an issue](https://github.com/microsoft/FluidFramework/blob/main/docs/content/Contributing/Submitting-Bugs-and-Feature-Requests.md).
120
+ Read the [Fluid Framework documentation](https://fluidframework.com/docs/) for information about Fluid Framework concepts and APIs.
118
121
 
119
- Thank you!
122
+ To request information that the documentation does not contain, [create an issue](https://github.com/microsoft/FluidFramework/blob/main/docs/content/Contributing/Submitting-Bugs-and-Feature-Requests.md).
120
123
 
121
124
  ## Trademark
122
125
 
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3
- "extends": "../../../common/build/build-common/api-extractor-model.esm.json"
3
+ "extends": "<projectFolder>/../../../common/build/build-common/api-extractor-model.esm.json"
4
4
  }
@@ -4,51 +4,36 @@
4
4
  */
5
5
  import type { OldestSupportedClientVersion } from "@fluidframework/runtime-definitions/internal";
6
6
  /**
7
- * Our policy is to support major versions N and N-1, where N is most
8
- * recent public major release of the Fluid Framework Client.
9
- * Therefore, if the customer does not provide a minVersionForCollab, we will
10
- * default to use N-1.
11
- *
12
- * However, this is not consistent with today's behavior. Some options (i.e.
13
- * batching, compression) are enabled by default despite not being compatible
14
- * with 1.x clients. Since the policy was introduced during 2.x's lifespan,
15
- * N/N-1 compatibility by **default** will be in effect starting with 3.0.
16
- * Importantly though, N/N-2 compatibility is still guaranteed with the proper
17
- * configurations set.
18
- *
19
- * Further to distinguish unspecified `minVersionForCollab` from a specified
20
- * version and allow `enableExplicitSchemaControl` to default to `true` for
21
- * any 2.0.0+ version, we will use a special value of `2.0.0-defaults`, which
22
- * is semantically less than 2.0.0.
7
+ * Oldest deployed Fluid Framework client version supported for cross-client compatibility.
23
8
  *
24
9
  * @internal
25
10
  */
26
- export declare const defaultMinVersionForCollab: "2.0.0-defaults";
11
+ export declare const lowestMinVersionForCollab: "2.0.0";
27
12
  /**
28
- * We don't want allow a version before the major public release of the LTS version.
29
- * Today we use "1.0.0", because our policy supports N/N-1 & N/N-2, which includes
30
- * all minor versions of N. Though LTS starts at 1.4.0, we should stay consistent
31
- * with our policy and allow all 1.x versions to be compatible with 2.x.
13
+ * Default oldest supported client for APIs that still permit the setting to be omitted.
32
14
  *
33
- * @privateRemarks
34
- * Exported for use in tests.
15
+ * @remarks
16
+ * This aliases {@link lowestMinVersionForCollab} in Client 3.0. Remove this fallback when
17
+ * customer-facing APIs require `oldestSupportedClient` in Client 3.10.
18
+ * See {@link https://github.com/microsoft/FluidFramework/issues/27180}.
35
19
  *
36
20
  * @internal
37
21
  */
38
- export declare const lowestMinVersionForCollab: "1.0.0";
22
+ export declare const defaultMinVersionForCollab: "2.0.0";
39
23
  /**
40
- * String in a valid semver format specifying bottom of a minor version
41
- * or special "defaults" prerelease of a major.
42
- * @remarks Only 2.0.0-defaults is expected, but index signatures cannot be a
43
- * literal; so, just allow any major -defaults prerelease.
24
+ * String in a valid semver format specifying the bottom of a minor version.
25
+ *
26
+ * @remarks
27
+ * Configuration maps use major/minor checkpoints. Exact patch and prerelease versions are values
28
+ * supplied to the selection logic, not configuration-map keys.
44
29
  *
45
30
  * @internal
46
31
  */
47
- export type MinimumMinorSemanticVersion = `${bigint}.${bigint}.0` | `${bigint}.0.0-defaults`;
32
+ export type MinimumMinorSemanticVersion = `${bigint}.${bigint}.0`;
48
33
  /**
49
34
  * String in a valid semver format of a specific version at least specifying minor.
50
- * Unlike {@link @fluidframework/runtime-definitions#OldestSupportedClientVersion}, this type allows any bigint for the major version.
51
- * Used as a more generic type that allows major versions other than 1 or 2.
35
+ * Unlike {@link @fluidframework/runtime-definitions#OldestSupportedClientVersion}, this type does
36
+ * not encode the active compatibility floor or major-specific patch restrictions.
52
37
  *
53
38
  * @internal
54
39
  */
@@ -134,6 +119,7 @@ export declare function checkValidMinVersionForCollabVerbose(minVersionForCollab
134
119
  isValidSemver: boolean;
135
120
  isGteLowestMinVersion: boolean;
136
121
  isLtePkgVersion: boolean;
122
+ isValidOldestSupportedClientVersion: boolean;
137
123
  };
138
124
  /**
139
125
  * Checks if the minVersionForCollab is valid.
@@ -143,32 +129,21 @@ export declare function checkValidMinVersionForCollabVerbose(minVersionForCollab
143
129
  */
144
130
  export declare function isValidMinVersionForCollab(minVersionForCollab: SemanticVersion): minVersionForCollab is OldestSupportedClientVersion;
145
131
  /**
146
- * `pkgVersion` version without pre-release.
132
+ * `pkgVersion` version without pre-release and with zeroed patch.
147
133
  * @remarks
148
- * This is the version that the code in the current version of the codebase will have when officially released.
149
- * Generally, compatibility of prerelease builds is not guaranteed (especially for how they interact with future releases).
150
- * So while technically a prerelease build is less (older) than the released version which follows it and thus supports less features,
151
- * it makes sense for them to claim to support the same features as the following release so they can be used to test how the release would actually behave.
152
- *
153
- * To accomplish this, the version the next release will have is provided here as `cleanedPackageVersion` while `pkgVersion` may be a prerelease in some cases,
154
- * like when running tests on CI, or in an actual prerelease published package.
155
- * This is then used in {@link validateMinimumVersionForCollab} to allow the version shown on main to be usable as a `minVersionForCollab`, even in CI and prerelease packages.
134
+ * This is the version the current codebase will have when officially released.
135
+ * It allows CI and prerelease builds to test the release's features using that version as their
136
+ * `OldestSupportedClientVersion`.
156
137
  *
157
- * This is of particular note in two cases:
158
- * 1. When landing a new feature, and setting the minVersionForCollab which enables it to be the version that the next release will have.
159
- * Having that version be valid on main, pass tests locally, then fail on CI and when using published prerelease packages would be confusing, and probably undesired.
160
- * 2. Setting the minVersionForCollab to the current version for scenarios that do no involve collab with other package versions seems like it should be valid.
161
- * This is useful for testing new features, and also non collaborative scenarios where the latest features are desired.
162
- *
163
- * To accommodate some uses of the second case, it might be useful to package export this in the future.
138
+ * Code that needs to derive this value from a package version should use
139
+ * {@link @fluidframework/driver-definitions#featureVersion}.
164
140
  *
165
141
  * @privateRemarks
166
- * Since this is used by validateMinimumVersionForCollab, the type case to OldestSupportedClientVersion can not use it directly.
167
- * Thus this is just `as` cast here, and a test confirms it is valid according to validateMinimumVersionForCollab.
142
+ * This value is validated against {@link validateMinimumVersionForCollab} by a test.
168
143
  *
169
144
  * @internal
170
145
  */
171
- export declare const cleanedPackageVersion: OldestSupportedClientVersion;
146
+ export declare const cleanedPackageVersion: "3.0.0";
172
147
  /**
173
148
  * Narrows the type of the provided {@link SemanticVersion} to a {@link @fluidframework/runtime-definitions#OldestSupportedClientVersion}, throwing a UsageError if it is not valid.
174
149
  * @remarks
@@ -184,14 +159,12 @@ export declare function validateMinimumVersionForCollab(semanticVersion: string)
184
159
  /**
185
160
  * Validates the given `overrides`.
186
161
  *
187
- * No-op when minVersionForCollab is set to defaultMinVersionForCollab.
188
- *
189
- * Otherwise this checks that for keys which are in both the `validationMap` and the `overrides`,
162
+ * Checks that for keys which are in both the `validationMap` and the `overrides`,
190
163
  * that the `validationMap` function for that key either returns undefined or a version less than or equal to `minVersionForCollab`.
191
164
  * @privateRemarks
192
165
  * This design seems odd, and might want to be revisited.
193
166
  * Currently it only permits opting out of features, not into them (unless validationMap returns undefined),
194
- * and the handling of defaultMinVersionForCollab and undefined versions seems questionable.
167
+ * and the handling of undefined versions seems questionable.
195
168
  * Also ignoring of extra keys in overrides might be bad since it seems like overrides is supposed to be validated.
196
169
  * @internal
197
170
  */
@@ -1 +1 @@
1
- {"version":3,"file":"compatibilityBase.d.ts","sourceRoot":"","sources":["../src/compatibilityBase.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,8CAA8C,CAAC;AAMjG;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,0BAA0B,kBAC0B,CAAC;AAElE;;;;;;;;;;GAUG;AACH,eAAO,MAAM,yBAAyB,SACkB,CAAC;AAEzD;;;;;;;GAOG;AACH,MAAM,MAAM,2BAA2B,GAAG,GAAG,MAAM,IAAI,MAAM,IAAI,GAAG,GAAG,MAAM,eAAe,CAAC;AAE7F;;;;;;GAM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eAAO,MAAM,qBAAqB,SAEM,CAAC;AAEzC;;;;;;;;;;GAUG;AACH,wBAAgB,+BAA+B,CAC9C,eAAe,EAAE,MAAM,GACrB,OAAO,CAAC,eAAe,IAAI,4BAA4B,CAmBzD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,0BAA0B,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC3E,mBAAmB,EAAE,eAAe,EACpC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC,EACrB,aAAa,EAAE,mBAAmB,CAAC,CAAC,CAAC,GACnC,IAAI,CAqBN;AAED;;;;;GAKG;AACH,wBAAgB,gCAAgC,CAC/C,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,EACxD,GAAG,SAAS,SAAS,CAAC,CAAC,EAAE,eAAe,CAAC,EAAE,EAC1C,cAAc,EAAE,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC,KAAK,eAAe,GAAG,SAAS,CAoCtE"}
@@ -4,44 +4,38 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.configValueToMinVersionForCollab = exports.validateConfigMapOverrides = exports.validateMinimumVersionForCollab = exports.cleanedPackageVersion = exports.isValidMinVersionForCollab = exports.checkValidMinVersionForCollabVerbose = exports.selectVersionRoundedDown = exports.getConfigForMinVersionForCollabIterable = exports.getConfigForMinVersionForCollab = exports.getConfigsForMinVersionForCollab = exports.lowestMinVersionForCollab = exports.defaultMinVersionForCollab = void 0;
7
+ exports.cleanedPackageVersion = exports.defaultMinVersionForCollab = exports.lowestMinVersionForCollab = void 0;
8
+ exports.getConfigsForMinVersionForCollab = getConfigsForMinVersionForCollab;
9
+ exports.getConfigForMinVersionForCollab = getConfigForMinVersionForCollab;
10
+ exports.getConfigForMinVersionForCollabIterable = getConfigForMinVersionForCollabIterable;
11
+ exports.selectVersionRoundedDown = selectVersionRoundedDown;
12
+ exports.checkValidMinVersionForCollabVerbose = checkValidMinVersionForCollabVerbose;
13
+ exports.isValidMinVersionForCollab = isValidMinVersionForCollab;
14
+ exports.validateMinimumVersionForCollab = validateMinimumVersionForCollab;
15
+ exports.validateConfigMapOverrides = validateConfigMapOverrides;
16
+ exports.configValueToMinVersionForCollab = configValueToMinVersionForCollab;
8
17
  const internal_1 = require("@fluidframework/core-utils/internal");
9
18
  const internal_2 = require("@fluidframework/telemetry-utils/internal");
19
+ const internal_3 = require("@fluidframework/driver-definitions/internal");
10
20
  const semver_ts_1 = require("semver-ts");
11
21
  const packageVersion_js_1 = require("./packageVersion.js");
12
22
  /**
13
- * Our policy is to support major versions N and N-1, where N is most
14
- * recent public major release of the Fluid Framework Client.
15
- * Therefore, if the customer does not provide a minVersionForCollab, we will
16
- * default to use N-1.
17
- *
18
- * However, this is not consistent with today's behavior. Some options (i.e.
19
- * batching, compression) are enabled by default despite not being compatible
20
- * with 1.x clients. Since the policy was introduced during 2.x's lifespan,
21
- * N/N-1 compatibility by **default** will be in effect starting with 3.0.
22
- * Importantly though, N/N-2 compatibility is still guaranteed with the proper
23
- * configurations set.
24
- *
25
- * Further to distinguish unspecified `minVersionForCollab` from a specified
26
- * version and allow `enableExplicitSchemaControl` to default to `true` for
27
- * any 2.0.0+ version, we will use a special value of `2.0.0-defaults`, which
28
- * is semantically less than 2.0.0.
23
+ * Oldest deployed Fluid Framework client version supported for cross-client compatibility.
29
24
  *
30
25
  * @internal
31
26
  */
32
- exports.defaultMinVersionForCollab = "2.0.0-defaults";
27
+ exports.lowestMinVersionForCollab = "2.0.0";
33
28
  /**
34
- * We don't want allow a version before the major public release of the LTS version.
35
- * Today we use "1.0.0", because our policy supports N/N-1 & N/N-2, which includes
36
- * all minor versions of N. Though LTS starts at 1.4.0, we should stay consistent
37
- * with our policy and allow all 1.x versions to be compatible with 2.x.
29
+ * Default oldest supported client for APIs that still permit the setting to be omitted.
38
30
  *
39
- * @privateRemarks
40
- * Exported for use in tests.
31
+ * @remarks
32
+ * This aliases {@link lowestMinVersionForCollab} in Client 3.0. Remove this fallback when
33
+ * customer-facing APIs require `oldestSupportedClient` in Client 3.10.
34
+ * See {@link https://github.com/microsoft/FluidFramework/issues/27180}.
41
35
  *
42
36
  * @internal
43
37
  */
44
- exports.lowestMinVersionForCollab = "1.0.0";
38
+ exports.defaultMinVersionForCollab = exports.lowestMinVersionForCollab;
45
39
  /**
46
40
  * Returns a default configuration given minVersionForCollab and configuration version map.
47
41
  *
@@ -60,7 +54,6 @@ function getConfigsForMinVersionForCollab(minVersionForCollab, configMap) {
60
54
  // We have populated every key, so casting away the Partial is now safe:
61
55
  return defaultConfigs;
62
56
  }
63
- exports.getConfigsForMinVersionForCollab = getConfigsForMinVersionForCollab;
64
57
  /**
65
58
  * Returns a default configuration given minVersionForCollab and {@link ConfigMapEntry}.
66
59
  *
@@ -69,7 +62,6 @@ exports.getConfigsForMinVersionForCollab = getConfigsForMinVersionForCollab;
69
62
  function getConfigForMinVersionForCollab(minVersionForCollab, config) {
70
63
  return getConfigForMinVersionForCollabIterable(minVersionForCollab, Object.entries(config));
71
64
  }
72
- exports.getConfigForMinVersionForCollab = getConfigForMinVersionForCollab;
73
65
  /**
74
66
  * Returns a default configuration given minVersionForCollab and the contents of a {@link ConfigMapEntry} in an Iterable.
75
67
  * @remarks
@@ -90,7 +82,6 @@ function getConfigForMinVersionForCollabIterable(minVersionForCollab, entries) {
90
82
  return (selectVersionRoundedDown(minVersionForCollab, versions) ??
91
83
  (0, internal_1.fail)(0xcb8 /* No config map entry for version */))[1];
92
84
  }
93
- exports.getConfigForMinVersionForCollabIterable = getConfigForMinVersionForCollabIterable;
94
85
  /**
95
86
  * Finds the entry for the highest version that is less than or equal to the provided minVersionForCollab.
96
87
  * @remarks
@@ -114,7 +105,6 @@ function selectVersionRoundedDown(minVersionForCollab, entries, compareVersions
114
105
  }
115
106
  return undefined;
116
107
  }
117
- exports.selectVersionRoundedDown = selectVersionRoundedDown;
118
108
  /**
119
109
  * Returns detailed information about the validity of a minVersionForCollab.
120
110
  * @param minVersionForCollab - The minVersionForCollab to validate.
@@ -123,15 +113,22 @@ exports.selectVersionRoundedDown = selectVersionRoundedDown;
123
113
  * @internal
124
114
  */
125
115
  function checkValidMinVersionForCollabVerbose(minVersionForCollab) {
126
- const isValidSemver = (0, semver_ts_1.valid)(minVersionForCollab) !== null;
116
+ const parsed = (0, semver_ts_1.parse)(minVersionForCollab);
117
+ const isValidSemver = parsed !== null && parsed.build.length === 0;
118
+ const isGteLowestMinVersion = isValidSemver && (0, semver_ts_1.gte)(minVersionForCollab, exports.lowestMinVersionForCollab);
119
+ const isLtePkgVersion = isValidSemver && (0, semver_ts_1.lte)(minVersionForCollab, exports.cleanedPackageVersion);
120
+ const isValidOldestSupportedClientVersion = isGteLowestMinVersion &&
121
+ isLtePkgVersion &&
122
+ parsed !== null &&
123
+ parsed.prerelease.length === 0 &&
124
+ (parsed.major < 3 || parsed.patch === 0);
127
125
  return {
128
126
  isValidSemver,
129
- // We have to check if the value is a valid semver before calling gte/lte, otherwise they will throw when parsing the version.
130
- isGteLowestMinVersion: isValidSemver && (0, semver_ts_1.gte)(minVersionForCollab, exports.lowestMinVersionForCollab),
131
- isLtePkgVersion: isValidSemver && (0, semver_ts_1.lte)(minVersionForCollab, exports.cleanedPackageVersion),
127
+ isGteLowestMinVersion,
128
+ isLtePkgVersion,
129
+ isValidOldestSupportedClientVersion,
132
130
  };
133
131
  }
134
- exports.checkValidMinVersionForCollabVerbose = checkValidMinVersionForCollabVerbose;
135
132
  /**
136
133
  * Checks if the minVersionForCollab is valid.
137
134
  * A valid minVersionForCollab is a OldestSupportedClientVersion that is at least `lowestMinVersionForCollab` and less than or equal to the current package version.
@@ -139,38 +136,25 @@ exports.checkValidMinVersionForCollabVerbose = checkValidMinVersionForCollabVerb
139
136
  * @internal
140
137
  */
141
138
  function isValidMinVersionForCollab(minVersionForCollab) {
142
- const { isValidSemver, isGteLowestMinVersion, isLtePkgVersion } = checkValidMinVersionForCollabVerbose(minVersionForCollab);
143
- return isValidSemver && isGteLowestMinVersion && isLtePkgVersion;
139
+ return checkValidMinVersionForCollabVerbose(minVersionForCollab)
140
+ .isValidOldestSupportedClientVersion;
144
141
  }
145
- exports.isValidMinVersionForCollab = isValidMinVersionForCollab;
146
- const parsedPackageVersion = (0, semver_ts_1.parse)(packageVersion_js_1.pkgVersion) ?? (0, internal_1.fail)(0xcb9 /* Invalid package version */);
147
142
  /**
148
- * `pkgVersion` version without pre-release.
143
+ * `pkgVersion` version without pre-release and with zeroed patch.
149
144
  * @remarks
150
- * This is the version that the code in the current version of the codebase will have when officially released.
151
- * Generally, compatibility of prerelease builds is not guaranteed (especially for how they interact with future releases).
152
- * So while technically a prerelease build is less (older) than the released version which follows it and thus supports less features,
153
- * it makes sense for them to claim to support the same features as the following release so they can be used to test how the release would actually behave.
154
- *
155
- * To accomplish this, the version the next release will have is provided here as `cleanedPackageVersion` while `pkgVersion` may be a prerelease in some cases,
156
- * like when running tests on CI, or in an actual prerelease published package.
157
- * This is then used in {@link validateMinimumVersionForCollab} to allow the version shown on main to be usable as a `minVersionForCollab`, even in CI and prerelease packages.
145
+ * This is the version the current codebase will have when officially released.
146
+ * It allows CI and prerelease builds to test the release's features using that version as their
147
+ * `OldestSupportedClientVersion`.
158
148
  *
159
- * This is of particular note in two cases:
160
- * 1. When landing a new feature, and setting the minVersionForCollab which enables it to be the version that the next release will have.
161
- * Having that version be valid on main, pass tests locally, then fail on CI and when using published prerelease packages would be confusing, and probably undesired.
162
- * 2. Setting the minVersionForCollab to the current version for scenarios that do no involve collab with other package versions seems like it should be valid.
163
- * This is useful for testing new features, and also non collaborative scenarios where the latest features are desired.
164
- *
165
- * To accommodate some uses of the second case, it might be useful to package export this in the future.
149
+ * Code that needs to derive this value from a package version should use
150
+ * {@link @fluidframework/driver-definitions#featureVersion}.
166
151
  *
167
152
  * @privateRemarks
168
- * Since this is used by validateMinimumVersionForCollab, the type case to OldestSupportedClientVersion can not use it directly.
169
- * Thus this is just `as` cast here, and a test confirms it is valid according to validateMinimumVersionForCollab.
153
+ * This value is validated against {@link validateMinimumVersionForCollab} by a test.
170
154
  *
171
155
  * @internal
172
156
  */
173
- exports.cleanedPackageVersion = `${parsedPackageVersion.major}.${parsedPackageVersion.minor}.${parsedPackageVersion.patch}`;
157
+ exports.cleanedPackageVersion = (0, internal_3.featureVersion)(packageVersion_js_1.pkgVersion);
174
158
  /**
175
159
  * Narrows the type of the provided {@link SemanticVersion} to a {@link @fluidframework/runtime-definitions#OldestSupportedClientVersion}, throwing a UsageError if it is not valid.
176
160
  * @remarks
@@ -184,36 +168,29 @@ exports.cleanedPackageVersion = `${parsedPackageVersion.major}.${parsedPackageVe
184
168
  */
185
169
  function validateMinimumVersionForCollab(semanticVersion) {
186
170
  const minVersionForCollab = semanticVersion;
187
- const { isValidSemver, isGteLowestMinVersion, isLtePkgVersion } = checkValidMinVersionForCollabVerbose(minVersionForCollab);
188
- if (!(isValidSemver && isGteLowestMinVersion && isLtePkgVersion)) {
171
+ const { isValidSemver, isGteLowestMinVersion, isLtePkgVersion, isValidOldestSupportedClientVersion, } = checkValidMinVersionForCollabVerbose(minVersionForCollab);
172
+ if (!isValidOldestSupportedClientVersion) {
189
173
  throw new internal_2.UsageError(`Version ${minVersionForCollab} is not a valid OldestSupportedClientVersion. ` +
190
174
  `It must be in a valid semver format, at least ${exports.lowestMinVersionForCollab}, ` +
191
- `and less than or equal to the current package version ${exports.cleanedPackageVersion}. ` +
192
- `Details: { isValidSemver: ${isValidSemver}, isGteLowestMinVersion: ${isGteLowestMinVersion}, isLtePkgVersion: ${isLtePkgVersion} }`);
175
+ `less than or equal to the current package version ${exports.cleanedPackageVersion}, ` +
176
+ `have no prerelease component, and use patch version 0 for major version 3 and later. ` +
177
+ `Use "featureVersion" to normalize a package version to the correct format. ` +
178
+ `Details: { isValidSemver: ${isValidSemver}, isGteLowestMinVersion: ${isGteLowestMinVersion}, isLtePkgVersion: ${isLtePkgVersion}, isValidOldestSupportedClientVersion: ${isValidOldestSupportedClientVersion} }`);
193
179
  }
194
180
  }
195
- exports.validateMinimumVersionForCollab = validateMinimumVersionForCollab;
196
181
  /**
197
182
  * Validates the given `overrides`.
198
183
  *
199
- * No-op when minVersionForCollab is set to defaultMinVersionForCollab.
200
- *
201
- * Otherwise this checks that for keys which are in both the `validationMap` and the `overrides`,
184
+ * Checks that for keys which are in both the `validationMap` and the `overrides`,
202
185
  * that the `validationMap` function for that key either returns undefined or a version less than or equal to `minVersionForCollab`.
203
186
  * @privateRemarks
204
187
  * This design seems odd, and might want to be revisited.
205
188
  * Currently it only permits opting out of features, not into them (unless validationMap returns undefined),
206
- * and the handling of defaultMinVersionForCollab and undefined versions seems questionable.
189
+ * and the handling of undefined versions seems questionable.
207
190
  * Also ignoring of extra keys in overrides might be bad since it seems like overrides is supposed to be validated.
208
191
  * @internal
209
192
  */
210
193
  function validateConfigMapOverrides(minVersionForCollab, overrides, validationMap) {
211
- if (minVersionForCollab === exports.defaultMinVersionForCollab) {
212
- // If the minVersionForCollab is set to the default value, then we will not validate the runtime options
213
- // This is to avoid disruption to users who have not yet set the minVersionForCollab value explicitly.
214
- // TODO: This also skips validation for users which explicitly request defaultMinVersionForCollab which seems like a bug.
215
- return;
216
- }
217
194
  // Iterate through each runtime option passed in by the user
218
195
  // Type assertion is safe as entries come from runtimeOptions object
219
196
  for (const [passedRuntimeOption, passedRuntimeOptionValue] of Object.entries(overrides)) {
@@ -229,7 +206,6 @@ function validateConfigMapOverrides(minVersionForCollab, overrides, validationMa
229
206
  }
230
207
  }
231
208
  }
232
- exports.validateConfigMapOverrides = validateConfigMapOverrides;
233
209
  /**
234
210
  * Helper function to map ContainerRuntimeOptionsInternal config values to
235
211
  * minVersionForCollab in, e.g., {@link @fluidframework/container-runtime#runtimeOptionsAffectingDocSchemaConfigValidationMap}.
@@ -267,5 +243,4 @@ function configValueToMinVersionForCollab(configToMinVer) {
267
243
  return undefined;
268
244
  };
269
245
  }
270
- exports.configValueToMinVersionForCollab = configValueToMinVersionForCollab;
271
246
  //# sourceMappingURL=compatibilityBase.js.map