@fluidframework/runtime-utils 2.72.0 → 2.74.0-365691

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 CHANGED
@@ -1,5 +1,9 @@
1
1
  # @fluidframework/runtime-utils
2
2
 
3
+ ## 2.73.0
4
+
5
+ Dependency updates only.
6
+
3
7
  ## 2.72.0
4
8
 
5
9
  Dependency updates only.
@@ -4,8 +4,8 @@
4
4
  */
5
5
  import type { MinimumVersionForCollab } from "@fluidframework/runtime-definitions/internal";
6
6
  /**
7
- * Our policy is to support N/N-1 compatibility by default, where N is the most
8
- * recent public major release of the runtime.
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
9
  * Therefore, if the customer does not provide a minVersionForCollab, we will
10
10
  * default to use N-1.
11
11
  *
@@ -54,27 +54,53 @@ export type MinimumMinorSemanticVersion = `${bigint}.${bigint}.0` | `${bigint}.0
54
54
  */
55
55
  export type SemanticVersion = `${bigint}.${bigint}.${bigint}` | `${bigint}.${bigint}.${bigint}-${string}`;
56
56
  /**
57
- * Generic type for runtimeOptionsAffectingDocSchemaConfigMap
57
+ * Converts a record into a configuration map that associates each key with an instance of its value type that is based on a {@link MinimumMinorSemanticVersion}.
58
+ * @remarks
59
+ * For a given input {@link @fluidframework/runtime-definitions#MinimumVersionForCollab},
60
+ * the corresponding configuration values can be found by using the entry in the inner objects with the highest {@link MinimumMinorSemanticVersion}
61
+ * that does not exceed the given {@link @fluidframework/runtime-definitions#MinimumVersionForCollab}.
58
62
  *
63
+ * Use {@link getConfigsForMinVersionForCollab} to retrieve the configuration for a given a {@link @fluidframework/runtime-definitions#MinimumVersionForCollab}.
64
+ *
65
+ * See the remarks on {@link MinimumMinorSemanticVersion} for some limitation on how ConfigMaps must handle versioning.
59
66
  * @internal
60
67
  */
61
68
  export type ConfigMap<T extends Record<string, unknown>> = {
62
- [K in keyof T]-?: Record<MinimumMinorSemanticVersion, T[K]>;
69
+ readonly [K in keyof T]-?: ConfigMapEntry<T[K]>;
63
70
  };
71
+ /**
72
+ * Entry in {@link ConfigMap} associating {@link MinimumMinorSemanticVersion} with configuration values that became supported in that version.
73
+ * @remarks
74
+ * All entries must at least provide an entry for {@link lowestMinVersionForCollab}.
75
+ * @internal
76
+ */
77
+ export interface ConfigMapEntry<T> {
78
+ [version: MinimumMinorSemanticVersion]: T;
79
+ [lowestMinVersionForCollab]: T;
80
+ }
64
81
  /**
65
82
  * Generic type for runtimeOptionsAffectingDocSchemaConfigValidationMap
66
83
  *
67
84
  * @internal
68
85
  */
69
86
  export type ConfigValidationMap<T extends Record<string, unknown>> = {
70
- [K in keyof T]-?: (configValue: T[K]) => SemanticVersion | undefined;
87
+ readonly [K in keyof T]-?: (configValue: T[K]) => SemanticVersion | undefined;
71
88
  };
72
89
  /**
73
90
  * Returns a default configuration given minVersionForCollab and configuration version map.
74
91
  *
92
+ * @privateRemarks
93
+ * The extra `Record` type for the `configMap` is just used to allow the body of this function to be more type-safe due to limitations of generic types in TypeScript.
94
+ * It should have no impact on the user of this function.
95
+ * @internal
96
+ */
97
+ export declare function getConfigsForMinVersionForCollab<T extends Record<SemanticVersion, unknown>>(minVersionForCollab: MinimumVersionForCollab, configMap: ConfigMap<T> & Record<keyof T, unknown>): T;
98
+ /**
99
+ * Returns a default configuration given minVersionForCollab and {@link ConfigMapEntry}.
100
+ *
75
101
  * @internal
76
102
  */
77
- export declare function getConfigsForMinVersionForCollab<T extends Record<SemanticVersion, unknown>>(minVersionForCollab: SemanticVersion, configMap: ConfigMap<T>): Partial<T>;
103
+ export declare function getConfigForMinVersionForCollab<T>(minVersionForCollab: MinimumVersionForCollab, config: ConfigMapEntry<T>): T;
78
104
  /**
79
105
  * Returns detailed information about the validity of a minVersionForCollab.
80
106
  * @param minVersionForCollab - The minVersionForCollab to validate.
@@ -82,7 +108,7 @@ export declare function getConfigsForMinVersionForCollab<T extends Record<Semant
82
108
  *
83
109
  * @internal
84
110
  */
85
- export declare function checkValidMinVersionForCollabVerbose(minVersionForCollab: MinimumVersionForCollab): {
111
+ export declare function checkValidMinVersionForCollabVerbose(minVersionForCollab: SemanticVersion): {
86
112
  isValidSemver: boolean;
87
113
  isGteLowestMinVersion: boolean;
88
114
  isLtePkgVersion: boolean;
@@ -93,22 +119,60 @@ export declare function checkValidMinVersionForCollabVerbose(minVersionForCollab
93
119
  *
94
120
  * @internal
95
121
  */
96
- export declare function isValidMinVersionForCollab(minVersionForCollab: MinimumVersionForCollab): boolean;
122
+ export declare function isValidMinVersionForCollab(minVersionForCollab: SemanticVersion): minVersionForCollab is MinimumVersionForCollab;
97
123
  /**
98
- * Converts a SemanticVersion to a MinimumVersionForCollab.
99
- * @param semanticVersion - The version to convert.
100
- * @returns The version as a MinimumVersionForCollab.
124
+ * `pkgVersion` version without pre-release.
125
+ * @remarks
126
+ * This is the version that the code in the current version of the codebase will have when officially released.
127
+ * Generally, compatibility of prerelease builds is not guaranteed (especially for how they interact with future releases).
128
+ * So while technically a prerelease build is less (older) than the released version which follows it and thus supports less features,
129
+ * 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.
130
+ *
131
+ * To accomplish this, the version the next release will have is provided here as `cleanedPackageVersion` while `pkgVersion` may be a prerelease in some cases,
132
+ * like when running tests on CI, or in an actual prerelease published package.
133
+ * 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
+ *
135
+ * This is of particular note in two cases:
136
+ * 1. When landing a new feature, and setting the minVersionForCollab which enables it to be the version that the next release will have.
137
+ * 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.
138
+ * 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.
139
+ * This is useful for testing new features, and also non collaborative scenarios where the latest features are desired.
140
+ *
141
+ * To accommodate some uses of the second case, it might be useful to package export this in the future.
142
+ *
143
+ * @privateRemarks
144
+ * Since this is used by validateMinimumVersionForCollab, the type case to MinimumVersionForCollab can not use it directly.
145
+ * Thus this is just `as` cast here, and a test confirms it is valid according to validateMinimumVersionForCollab.
146
+ *
147
+ */
148
+ export declare const cleanedPackageVersion: MinimumVersionForCollab;
149
+ /**
150
+ * Narrows the type of the provided {@link SemanticVersion} to a {@link @fluidframework/runtime-definitions#MinimumVersionForCollab}, throwing a UsageError if it is not valid.
151
+ * @remarks
152
+ * This is more strict than the type constraints imposed by `MinimumVersionForCollab`.
153
+ * Currently there is no type which is used to separate semantically valid and typescript allowed MinimumVersionForCollab values:
154
+ * thus users that care about strict validation may want to call this on un-validated `MinimumVersionForCollab` values.
155
+ * @param semanticVersion - The version to check.
101
156
  * @throws UsageError if the version is not a valid MinimumVersionForCollab.
102
157
  *
103
158
  * @internal
104
159
  */
105
- export declare function semanticVersionToMinimumVersionForCollab(semanticVersion: SemanticVersion): MinimumVersionForCollab;
160
+ export declare function validateMinimumVersionForCollab(semanticVersion: string): asserts semanticVersion is MinimumVersionForCollab;
106
161
  /**
107
- * Generic function to validate runtime options against the minVersionForCollab.
162
+ * Validates the given `overrides`.
108
163
  *
164
+ * No-op when minVersionForCollab is set to defaultMinVersionForCollab.
165
+ *
166
+ * Otherwise this checks that for keys which are in both the `validationMap` and the `overrides`,
167
+ * that the `validationMap` function for that key either returns undefined or a version less than or equal to `minVersionForCollab`.
168
+ * @privateRemarks
169
+ * This design seems odd, and might want to be revisited.
170
+ * Currently it only permits opting out of features, not into them (unless validationMap returns undefined),
171
+ * and the handling of defaultMinVersionForCollab and undefined versions seems questionable.
172
+ * Also ignoring of extra keys in overrides might be bad since it seems like overrides is supposed to be validated.
109
173
  * @internal
110
174
  */
111
- export declare function getValidationForRuntimeOptions<T extends Record<string, unknown>>(minVersionForCollab: SemanticVersion, runtimeOptions: Partial<T>, validationMap: ConfigValidationMap<T>): void;
175
+ export declare function validateConfigMapOverrides<T extends Record<string, unknown>>(minVersionForCollab: SemanticVersion, overrides: Partial<T>, validationMap: ConfigValidationMap<T>): void;
112
176
  /**
113
177
  * Helper function to map ContainerRuntimeOptionsInternal config values to
114
178
  * minVersionForCollab in, e.g., {@link @fluidframework/container-runtime#runtimeOptionsAffectingDocSchemaConfigValidationMap}.
@@ -1 +1 @@
1
- {"version":3,"file":"compatibilityBase.d.ts","sourceRoot":"","sources":["../src/compatibilityBase.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AAM5F;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,0BAA0B,kBACqB,CAAC;AAE7D;;;;;;;;;;GAUG;AACH,eAAO,MAAM,yBAAyB,SAAqD,CAAC;AAE5F;;;;;;;GAOG;AACH,MAAM,MAAM,2BAA2B,GAAG,GAAG,MAAM,IAAI,MAAM,IAAI,GAAG,GAAG,MAAM,eAAe,CAAC;AAE7F;;;;;;GAMG;AACH,MAAM,MAAM,eAAe,GACxB,GAAG,MAAM,IAAI,MAAM,IAAI,MAAM,EAAE,GAC/B,GAAG,MAAM,IAAI,MAAM,IAAI,MAAM,IAAI,MAAM,EAAE,CAAC;AAE7C;;;;GAIG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI;KACzD,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,2BAA2B,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;CAC3D,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI;KACnE,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,eAAe,GAAG,SAAS;CACpE,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,gCAAgC,CAAC,CAAC,SAAS,MAAM,C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uB,EAC5C,MAAM,EAAE,cAAc,CAAC,CAAC,CAAC,GACvB,CAAC,CAkBH;AAED;;;;;;GAMG;AACH,wBAAgB,oCAAoC,CAAC,mBAAmB,EAAE,eAAe,GAAG;IAC3F,aAAa,EAAE,OAAO,CAAC;IACvB,qBAAqB,EAAE,OAAO,CAAC;IAC/B,eAAe,EAAE,OAAO,CAAC;CACzB,CAUA;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CACzC,mBAAmB,EAAE,eAAe,GAClC,mBAAmB,IAAI,uBAAuB,CAIhD;AAID;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,qBAAqB,yBACqF,CAAC;AAExH;;;;;;;;;;GAUG;AACH,wBAAgB,+BAA+B,CAC9C,eAAe,EAAE,MAAM,GACrB,OAAO,CAAC,eAAe,IAAI,uBAAuB,CAYpD;AAED;;;;;;;;;;;;;GAaG;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,CA2BN;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,14 +4,14 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.configValueToMinVersionForCollab = exports.getValidationForRuntimeOptions = exports.semanticVersionToMinimumVersionForCollab = exports.isValidMinVersionForCollab = exports.checkValidMinVersionForCollabVerbose = exports.getConfigsForMinVersionForCollab = exports.lowestMinVersionForCollab = exports.defaultMinVersionForCollab = void 0;
7
+ exports.configValueToMinVersionForCollab = exports.validateConfigMapOverrides = exports.validateMinimumVersionForCollab = exports.cleanedPackageVersion = exports.isValidMinVersionForCollab = exports.checkValidMinVersionForCollabVerbose = exports.getConfigForMinVersionForCollab = exports.getConfigsForMinVersionForCollab = exports.lowestMinVersionForCollab = exports.defaultMinVersionForCollab = void 0;
8
8
  const internal_1 = require("@fluidframework/core-utils/internal");
9
9
  const internal_2 = require("@fluidframework/telemetry-utils/internal");
10
10
  const semver_ts_1 = require("semver-ts");
11
11
  const packageVersion_js_1 = require("./packageVersion.js");
12
12
  /**
13
- * Our policy is to support N/N-1 compatibility by default, where N is the most
14
- * recent public major release of the runtime.
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
15
  * Therefore, if the customer does not provide a minVersionForCollab, we will
16
16
  * default to use N-1.
17
17
  *
@@ -45,34 +45,47 @@ exports.lowestMinVersionForCollab = "1.0.0";
45
45
  /**
46
46
  * Returns a default configuration given minVersionForCollab and configuration version map.
47
47
  *
48
+ * @privateRemarks
49
+ * The extra `Record` type for the `configMap` is just used to allow the body of this function to be more type-safe due to limitations of generic types in TypeScript.
50
+ * It should have no impact on the user of this function.
48
51
  * @internal
49
52
  */
50
53
  function getConfigsForMinVersionForCollab(minVersionForCollab, configMap) {
54
+ validateMinimumVersionForCollab(minVersionForCollab);
51
55
  const defaultConfigs = {};
52
56
  // Iterate over configMap to get default values for each option.
53
- for (const key of Object.keys(configMap)) {
54
- // Type assertion is safe as key comes from Object.keys(configMap)
55
- const config = configMap[key];
56
- // Sort the versions in ascending order so we can short circuit the loop.
57
- const versions = Object.keys(config).sort(semver_ts_1.compare);
58
- // For each config, we iterate over the keys and check if minVersionForCollab is greater than or equal to the version.
59
- // If so, we set it as the default value for the option. At the end of the loop we should have the most recent default
60
- // value that is compatible with the version specified as the minVersionForCollab.
61
- for (const version of versions) {
62
- if ((0, semver_ts_1.gte)(minVersionForCollab, version)) {
63
- // Type assertion is safe as version is a key from the config object
64
- defaultConfigs[key] = config[version];
65
- }
66
- else {
67
- // If the minVersionForCollab is less than the version, we break out of the loop since we don't need to check
68
- // any later versions.
69
- break;
70
- }
71
- }
57
+ for (const [key, config] of Object.entries(configMap)) {
58
+ defaultConfigs[key] = getConfigForMinVersionForCollab(minVersionForCollab, config);
72
59
  }
60
+ // We have populated every key, so casting away the Partial is now safe:
73
61
  return defaultConfigs;
74
62
  }
75
63
  exports.getConfigsForMinVersionForCollab = getConfigsForMinVersionForCollab;
64
+ /**
65
+ * Returns a default configuration given minVersionForCollab and {@link ConfigMapEntry}.
66
+ *
67
+ * @internal
68
+ */
69
+ function getConfigForMinVersionForCollab(minVersionForCollab, config) {
70
+ const entries = Object.entries(config); // Assigning this to a typed variable to convert the "any" into unknown.
71
+ // Validate and strongly type the versions from the configMap.
72
+ const versions = entries.map(([version, value]) => {
73
+ validateMinimumVersionForCollab(version);
74
+ return [version, value];
75
+ });
76
+ // Sort the versions in descending order to find the largest compatible entry.
77
+ // TODO: Enforcing a sorted order might be a good idea. For now tolerates any order.
78
+ versions.sort((a, b) => (0, semver_ts_1.compare)(b[0], a[0]));
79
+ // For each config, we iterate over the keys and check if minVersionForCollab is greater than or equal to the version.
80
+ // If so, we set it as the default value for the option.
81
+ for (const [version, value] of versions) {
82
+ if ((0, semver_ts_1.gte)(minVersionForCollab, version)) {
83
+ return value;
84
+ }
85
+ }
86
+ (0, internal_1.fail)("No config map entry for version");
87
+ }
88
+ exports.getConfigForMinVersionForCollab = getConfigForMinVersionForCollab;
76
89
  /**
77
90
  * Returns detailed information about the validity of a minVersionForCollab.
78
91
  * @param minVersionForCollab - The minVersionForCollab to validate.
@@ -86,7 +99,7 @@ function checkValidMinVersionForCollabVerbose(minVersionForCollab) {
86
99
  isValidSemver,
87
100
  // We have to check if the value is a valid semver before calling gte/lte, otherwise they will throw when parsing the version.
88
101
  isGteLowestMinVersion: isValidSemver && (0, semver_ts_1.gte)(minVersionForCollab, exports.lowestMinVersionForCollab),
89
- isLtePkgVersion: isValidSemver && (0, semver_ts_1.lte)(minVersionForCollab, packageVersion_js_1.pkgVersion),
102
+ isLtePkgVersion: isValidSemver && (0, semver_ts_1.lte)(minVersionForCollab, exports.cleanedPackageVersion),
90
103
  };
91
104
  }
92
105
  exports.checkValidMinVersionForCollabVerbose = checkValidMinVersionForCollabVerbose;
@@ -101,40 +114,79 @@ function isValidMinVersionForCollab(minVersionForCollab) {
101
114
  return isValidSemver && isGteLowestMinVersion && isLtePkgVersion;
102
115
  }
103
116
  exports.isValidMinVersionForCollab = isValidMinVersionForCollab;
117
+ const parsedPackageVersion = (0, semver_ts_1.parse)(packageVersion_js_1.pkgVersion) ?? (0, internal_1.fail)("Invalid package version");
104
118
  /**
105
- * Converts a SemanticVersion to a MinimumVersionForCollab.
106
- * @param semanticVersion - The version to convert.
107
- * @returns The version as a MinimumVersionForCollab.
119
+ * `pkgVersion` version without pre-release.
120
+ * @remarks
121
+ * This is the version that the code in the current version of the codebase will have when officially released.
122
+ * Generally, compatibility of prerelease builds is not guaranteed (especially for how they interact with future releases).
123
+ * So while technically a prerelease build is less (older) than the released version which follows it and thus supports less features,
124
+ * 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.
125
+ *
126
+ * To accomplish this, the version the next release will have is provided here as `cleanedPackageVersion` while `pkgVersion` may be a prerelease in some cases,
127
+ * like when running tests on CI, or in an actual prerelease published package.
128
+ * 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.
129
+ *
130
+ * This is of particular note in two cases:
131
+ * 1. When landing a new feature, and setting the minVersionForCollab which enables it to be the version that the next release will have.
132
+ * 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.
133
+ * 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.
134
+ * This is useful for testing new features, and also non collaborative scenarios where the latest features are desired.
135
+ *
136
+ * To accommodate some uses of the second case, it might be useful to package export this in the future.
137
+ *
138
+ * @privateRemarks
139
+ * Since this is used by validateMinimumVersionForCollab, the type case to MinimumVersionForCollab can not use it directly.
140
+ * Thus this is just `as` cast here, and a test confirms it is valid according to validateMinimumVersionForCollab.
141
+ *
142
+ */
143
+ exports.cleanedPackageVersion = `${parsedPackageVersion.major}.${parsedPackageVersion.minor}.${parsedPackageVersion.patch}`;
144
+ /**
145
+ * Narrows the type of the provided {@link SemanticVersion} to a {@link @fluidframework/runtime-definitions#MinimumVersionForCollab}, throwing a UsageError if it is not valid.
146
+ * @remarks
147
+ * This is more strict than the type constraints imposed by `MinimumVersionForCollab`.
148
+ * Currently there is no type which is used to separate semantically valid and typescript allowed MinimumVersionForCollab values:
149
+ * thus users that care about strict validation may want to call this on un-validated `MinimumVersionForCollab` values.
150
+ * @param semanticVersion - The version to check.
108
151
  * @throws UsageError if the version is not a valid MinimumVersionForCollab.
109
152
  *
110
153
  * @internal
111
154
  */
112
- function semanticVersionToMinimumVersionForCollab(semanticVersion) {
155
+ function validateMinimumVersionForCollab(semanticVersion) {
113
156
  const minVersionForCollab = semanticVersion;
114
157
  const { isValidSemver, isGteLowestMinVersion, isLtePkgVersion } = checkValidMinVersionForCollabVerbose(minVersionForCollab);
115
158
  if (!(isValidSemver && isGteLowestMinVersion && isLtePkgVersion)) {
116
159
  throw new internal_2.UsageError(`Version ${minVersionForCollab} is not a valid MinimumVersionForCollab. ` +
117
160
  `It must be in a valid semver format, at least ${exports.lowestMinVersionForCollab}, ` +
118
- `and less than or equal to the current package version ${packageVersion_js_1.pkgVersion}. ` +
161
+ `and less than or equal to the current package version ${exports.cleanedPackageVersion}. ` +
119
162
  `Details: { isValidSemver: ${isValidSemver}, isGteLowestMinVersion: ${isGteLowestMinVersion}, isLtePkgVersion: ${isLtePkgVersion} }`);
120
163
  }
121
- return minVersionForCollab;
122
164
  }
123
- exports.semanticVersionToMinimumVersionForCollab = semanticVersionToMinimumVersionForCollab;
165
+ exports.validateMinimumVersionForCollab = validateMinimumVersionForCollab;
124
166
  /**
125
- * Generic function to validate runtime options against the minVersionForCollab.
167
+ * Validates the given `overrides`.
126
168
  *
169
+ * No-op when minVersionForCollab is set to defaultMinVersionForCollab.
170
+ *
171
+ * Otherwise this checks that for keys which are in both the `validationMap` and the `overrides`,
172
+ * that the `validationMap` function for that key either returns undefined or a version less than or equal to `minVersionForCollab`.
173
+ * @privateRemarks
174
+ * This design seems odd, and might want to be revisited.
175
+ * Currently it only permits opting out of features, not into them (unless validationMap returns undefined),
176
+ * and the handling of defaultMinVersionForCollab and undefined versions seems questionable.
177
+ * Also ignoring of extra keys in overrides might be bad since it seems like overrides is supposed to be validated.
127
178
  * @internal
128
179
  */
129
- function getValidationForRuntimeOptions(minVersionForCollab, runtimeOptions, validationMap) {
180
+ function validateConfigMapOverrides(minVersionForCollab, overrides, validationMap) {
130
181
  if (minVersionForCollab === exports.defaultMinVersionForCollab) {
131
182
  // If the minVersionForCollab is set to the default value, then we will not validate the runtime options
132
183
  // This is to avoid disruption to users who have not yet set the minVersionForCollab value explicitly.
184
+ // TODO: This also skips validation for users which explicitly request defaultMinVersionForCollab which seems like a bug.
133
185
  return;
134
186
  }
135
187
  // Iterate through each runtime option passed in by the user
136
188
  // Type assertion is safe as entries come from runtimeOptions object
137
- for (const [passedRuntimeOption, passedRuntimeOptionValue] of Object.entries(runtimeOptions)) {
189
+ for (const [passedRuntimeOption, passedRuntimeOptionValue] of Object.entries(overrides)) {
138
190
  // Skip if passedRuntimeOption is not in validation map
139
191
  if (!(passedRuntimeOption in validationMap)) {
140
192
  continue;
@@ -147,7 +199,7 @@ function getValidationForRuntimeOptions(minVersionForCollab, runtimeOptions, val
147
199
  }
148
200
  }
149
201
  }
150
- exports.getValidationForRuntimeOptions = getValidationForRuntimeOptions;
202
+ exports.validateConfigMapOverrides = validateConfigMapOverrides;
151
203
  /**
152
204
  * Helper function to map ContainerRuntimeOptionsInternal config values to
153
205
  * minVersionForCollab in, e.g., {@link @fluidframework/container-runtime#runtimeOptionsAffectingDocSchemaConfigValidationMap}.
@@ -1 +1 @@
1
- {"version":3,"file":"compatibilityBase.js","sourceRoot":"","sources":["../src/compatibilityBase.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAE7D,uEAAsE;AACtE,yCAAyD;AAEzD,2DAAiD;AAEjD;;;;;;;;;;;;;;;;;;;GAmBG;AACU,QAAA,0BAA0B,GACtC,gBAA2D,CAAC;AAE7D;;;;;;;;;;GAUG;AACU,QAAA,yBAAyB,GAAG,OAAkD,CAAC;AAyC5F;;;;GAIG;AACH,SAAgB,gCAAgC,CAC/C,mBAAoC,EACpC,SAAuB;IAEvB,MAAM,cAAc,GAAe,EAAE,CAAC;IACtC,gEAAgE;IAChE,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;QAC1C,kEAAkE;QAClE,MAAM,MAAM,GAAG,SAAS,CAAC,GAAc,CAAC,CAAC;QACzC,yEAAyE;QACzE,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,mBAAO,CAAC,CAAC;QACnD,sHAAsH;QACtH,sHAAsH;QACtH,kFAAkF;QAClF,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;YAChC,IAAI,IAAA,eAAG,EAAC,mBAAmB,EAAE,OAAO,CAAC,EAAE,CAAC;gBACvC,oEAAoE;gBACpE,cAAc,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,OAAsC,CAAC,CAAC;YACtE,CAAC;iBAAM,CAAC;gBACP,6GAA6G;gBAC7G,sBAAsB;gBACtB,MAAM;YACP,CAAC;QACF,CAAC;IACF,CAAC;IACD,OAAO,cAAc,CAAC;AACvB,CAAC;AA1BD,4EA0BC;AAED;;;;;;GAMG;AACH,SAAgB,oCAAoC,CACnD,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FAAgF;YAChF,0FAA0F;YAC1F,kCAAkC;YAClC,IAAI,MAAM,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;gBAChF,gBAAgB,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;YACxC,CAAC;QACF,CAAC;QACD,IAAI,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACjC,2DAA2D;YAC3D,OAAO,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,IAAA,mBAAO,EAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC1D,CAAC;QACD,qFAAqF;QACrF,+DAA+D;QAC/D,OAAO,SAAS,CAAC;IAClB,CAAC,CAAC;AACH,CAAC;AAvCD,4EAuCC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { MinimumVersionForCollab } from \"@fluidframework/runtime-definitions/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\nimport { compare, gt, gte, lte, valid } from \"semver-ts\";\n\nimport { pkgVersion } from \"./packageVersion.js\";\n\n/**\n * Our policy is to support N/N-1 compatibility by default, where N is the most\n * recent public major release of the runtime.\n * Therefore, if the customer does not provide a minVersionForCollab, we will\n * default to use N-1.\n *\n * However, this is not consistent with today's behavior. Some options (i.e.\n * batching, compression) are enabled by default despite not being compatible\n * with 1.x clients. Since the policy was introduced during 2.x's lifespan,\n * N/N-1 compatibility by **default** will be in effect starting with 3.0.\n * Importantly though, N/N-2 compatibility is still guaranteed with the proper\n * configurations set.\n *\n * Further to distinguish unspecified `minVersionForCollab` from a specified\n * version and allow `enableExplicitSchemaControl` to default to `true` for\n * any 2.0.0+ version, we will use a special value of `2.0.0-defaults`, which\n * is semantically less than 2.0.0.\n *\n * @internal\n */\nexport const defaultMinVersionForCollab =\n\t\"2.0.0-defaults\" as const satisfies MinimumVersionForCollab;\n\n/**\n * We don't want allow a version before the major public release of the LTS version.\n * Today we use \"1.0.0\", because our policy supports N/N-1 & N/N-2, which includes\n * all minor versions of N. Though LTS starts at 1.4.0, we should stay consistent\n * with our policy and allow all 1.x versions to be compatible with 2.x.\n *\n * @privateRemarks\n * Exported for use in tests.\n *\n * @internal\n */\nexport const lowestMinVersionForCollab = \"1.0.0\" as const satisfies MinimumVersionForCollab;\n\n/**\n * String in a valid semver format specifying bottom of a minor version\n * or special \"defaults\" prerelease of a major.\n * @remarks Only 2.0.0-defaults is expected, but index signatures cannot be a\n * literal; so, just allow any major -defaults prerelease.\n *\n * @internal\n */\nexport type MinimumMinorSemanticVersion = `${bigint}.${bigint}.0` | `${bigint}.0.0-defaults`;\n\n/**\n * String in a valid semver format of a specific version at least specifying minor.\n * Unlike {@link @fluidframework/runtime-definitions#MinimumVersionForCollab}, this type allows any bigint for the major version.\n * Used as a more generic type that allows major versions other than 1 or 2.\n *\n * @internal\n */\nexport type SemanticVersion =\n\t| `${bigint}.${bigint}.${bigint}`\n\t| `${bigint}.${bigint}.${bigint}-${string}`;\n\n/**\n * Generic type for runtimeOptionsAffectingDocSchemaConfigMap\n *\n * @internal\n */\nexport type ConfigMap<T extends Record<string, unknown>> = {\n\t[K in keyof T]-?: Record<MinimumMinorSemanticVersion, T[K]>;\n};\n\n/**\n * Generic type for runtimeOptionsAffectingDocSchemaConfigValidationMap\n *\n * @internal\n */\nexport type ConfigValidationMap<T extends Record<string, unknown>> = {\n\t[K in keyof T]-?: (configValue: T[K]) => SemanticVersion | undefined;\n};\n\n/**\n * Returns a default configuration given minVersionForCollab and configuration version map.\n *\n * @internal\n */\nexport function getConfigsForMinVersionForCollab<T extends Record<SemanticVersion, unknown>>(\n\tminVersionForCollab: SemanticVersion,\n\tconfigMap: ConfigMap<T>,\n): Partial<T> {\n\tconst defaultConfigs: Partial<T> = {};\n\t// Iterate over configMap to get default values for each option.\n\tfor (const key of Object.keys(configMap)) {\n\t\t// Type assertion is safe as key comes from Object.keys(configMap)\n\t\tconst config = configMap[key as keyof T];\n\t\t// Sort the versions in ascending order so we can short circuit the loop.\n\t\tconst versions = Object.keys(config).sort(compare);\n\t\t// For each config, we iterate over the keys and check if minVersionForCollab is greater than or equal to the version.\n\t\t// If so, we set it as the default value for the option. At the end of the loop we should have the most recent default\n\t\t// value that is compatible with the version specified as the minVersionForCollab.\n\t\tfor (const version of versions) {\n\t\t\tif (gte(minVersionForCollab, version)) {\n\t\t\t\t// Type assertion is safe as version is a key from the config object\n\t\t\t\tdefaultConfigs[key] = config[version as MinimumMinorSemanticVersion];\n\t\t\t} else {\n\t\t\t\t// If the minVersionForCollab is less than the version, we break out of the loop since we don't need to check\n\t\t\t\t// any later versions.\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\treturn defaultConfigs;\n}\n\n/**\n * Returns detailed information about the validity of a minVersionForCollab.\n * @param minVersionForCollab - The minVersionForCollab to validate.\n * @returns An object containing the validity information.\n *\n * @internal\n */\nexport function checkValidMinVersionForCollabVerbose(\n\tminVersionForCollab: MinimumVersionForCollab,\n): {\n\tisValidSemver: boolean;\n\tisGteLowestMinVersion: boolean;\n\tisLtePkgVersion: boolean;\n} {\n\tconst isValidSemver = valid(minVersionForCollab) !== null;\n\treturn {\n\t\tisValidSemver,\n\n\t\t// We have to check if the value is a valid semver before calling gte/lte, otherwise they will throw when parsing the version.\n\t\tisGteLowestMinVersion:\n\t\t\tisValidSemver && gte(minVersionForCollab, lowestMinVersionForCollab),\n\t\tisLtePkgVersion: isValidSemver && lte(minVersionForCollab, pkgVersion),\n\t};\n}\n\n/**\n * Checks if the minVersionForCollab is valid.\n * A valid minVersionForCollab is a MinimumVersionForCollab that is at least `lowestMinVersionForCollab` and less than or equal to the current package version.\n *\n * @internal\n */\nexport function isValidMinVersionForCollab(\n\tminVersionForCollab: MinimumVersionForCollab,\n): boolean {\n\tconst { isValidSemver, isGteLowestMinVersion, isLtePkgVersion } =\n\t\tcheckValidMinVersionForCollabVerbose(minVersionForCollab);\n\treturn isValidSemver && isGteLowestMinVersion && isLtePkgVersion;\n}\n\n/**\n * Converts a SemanticVersion to a MinimumVersionForCollab.\n * @param semanticVersion - The version to convert.\n * @returns The version as a MinimumVersionForCollab.\n * @throws UsageError if the version is not a valid MinimumVersionForCollab.\n *\n * @internal\n */\nexport function semanticVersionToMinimumVersionForCollab(\n\tsemanticVersion: SemanticVersion,\n): MinimumVersionForCollab {\n\tconst minVersionForCollab = semanticVersion as MinimumVersionForCollab;\n\tconst { isValidSemver, isGteLowestMinVersion, isLtePkgVersion } =\n\t\tcheckValidMinVersionForCollabVerbose(minVersionForCollab);\n\tif (!(isValidSemver && isGteLowestMinVersion && isLtePkgVersion)) {\n\t\tthrow new UsageError(\n\t\t\t`Version ${minVersionForCollab} is not a valid MinimumVersionForCollab. ` +\n\t\t\t\t`It must be in a valid semver format, at least ${lowestMinVersionForCollab}, ` +\n\t\t\t\t`and less than or equal to the current package version ${pkgVersion}. ` +\n\t\t\t\t`Details: { isValidSemver: ${isValidSemver}, isGteLowestMinVersion: ${isGteLowestMinVersion}, isLtePkgVersion: ${isLtePkgVersion} }`,\n\t\t);\n\t}\n\n\treturn minVersionForCollab;\n}\n\n/**\n * Generic function to validate runtime options against the minVersionForCollab.\n *\n * @internal\n */\nexport function getValidationForRuntimeOptions<T extends Record<string, unknown>>(\n\tminVersionForCollab: SemanticVersion,\n\truntimeOptions: Partial<T>,\n\tvalidationMap: ConfigValidationMap<T>,\n): void {\n\tif (minVersionForCollab === defaultMinVersionForCollab) {\n\t\t// If the minVersionForCollab is set to the default value, then we will not validate the runtime options\n\t\t// This is to avoid disruption to users who have not yet set the minVersionForCollab value explicitly.\n\t\treturn;\n\t}\n\t// Iterate through each runtime option passed in by the user\n\t// Type assertion is safe as entries come from runtimeOptions object\n\tfor (const [passedRuntimeOption, passedRuntimeOptionValue] of Object.entries(\n\t\truntimeOptions,\n\t) as [keyof T & string, T[keyof T & string]][]) {\n\t\t// Skip if passedRuntimeOption is not in validation map\n\t\tif (!(passedRuntimeOption in validationMap)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst requiredVersion = validationMap[passedRuntimeOption](passedRuntimeOptionValue);\n\t\tif (requiredVersion !== undefined && gt(requiredVersion, minVersionForCollab)) {\n\t\t\tthrow new UsageError(\n\t\t\t\t`Runtime option ${passedRuntimeOption}:${JSON.stringify(passedRuntimeOptionValue)} requires ` +\n\t\t\t\t\t`runtime version ${requiredVersion}. Please update minVersionForCollab ` +\n\t\t\t\t\t`(currently ${minVersionForCollab}) to ${requiredVersion} or later to proceed.`,\n\t\t\t);\n\t\t}\n\t}\n}\n\n/**\n * Helper function to map ContainerRuntimeOptionsInternal config values to\n * minVersionForCollab in, e.g., {@link @fluidframework/container-runtime#runtimeOptionsAffectingDocSchemaConfigValidationMap}.\n *\n * @internal\n */\nexport function configValueToMinVersionForCollab<\n\tT extends string | number | boolean | undefined | object,\n\tArr extends readonly [T, SemanticVersion][],\n>(configToMinVer: Arr): (configValue: T) => SemanticVersion | undefined {\n\tconst configValueToRequiredVersionMap = new Map(configToMinVer);\n\treturn (configValue: T) => {\n\t\t// If the configValue is not an object then we can get the version required directly from the map.\n\t\tif (typeof configValue !== \"object\") {\n\t\t\treturn configValueToRequiredVersionMap.get(configValue);\n\t\t}\n\t\t// When the input `configValue` is an object, this logic determines the minimum runtime version it requires.\n\t\t// It iterates through each entry in `configValueToRequiredVersionMap`. If `possibleConfigValue` shares at\n\t\t// least one key-value pair with the input `configValue`, its associated `versionRequired` is collected into\n\t\t// `matchingVersions`. After checking all entries, the highest among the collected versions is returned.\n\t\t// This represents the overall minimum version required to support the features implied by the input `configValue`.\n\t\tconst matchingVersions: SemanticVersion[] = [];\n\t\tfor (const [\n\t\t\tpossibleConfigValue,\n\t\t\tversionRequired,\n\t\t] of configValueToRequiredVersionMap.entries()) {\n\t\t\tassert(\n\t\t\t\ttypeof possibleConfigValue == \"object\",\n\t\t\t\t0xbb9 /* possibleConfigValue should be an object */,\n\t\t\t);\n\t\t\t// Check if `possibleConfigValue` and the input `configValue` share at least one\n\t\t\t// common key-value pair. If they do, the `versionRequired` for this `possibleConfigValue`\n\t\t\t// is added to `matchingVersions`.\n\t\t\tif (Object.entries(possibleConfigValue).some(([k, v]) => configValue[k] === v)) {\n\t\t\t\tmatchingVersions.push(versionRequired);\n\t\t\t}\n\t\t}\n\t\tif (matchingVersions.length > 0) {\n\t\t\t// Return the latest minVersionForCollab among all matches.\n\t\t\treturn matchingVersions.sort((a, b) => compare(b, a))[0];\n\t\t}\n\t\t// If no matches then we return undefined. This means that the config value passed in\n\t\t// does not require a specific minVersionForCollab to be valid.\n\t\treturn undefined;\n\t};\n}\n"]}
1
+ {"version":3,"file":"compatibilityBase.js","sourceRoot":"","sources":["../src/compatibilityBase.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAAmE;AAEnE,uEAAsE;AACtE,yCAAgE;AAEhE,2DAAiD;AAEjD;;;;;;;;;;;;;;;;;;;GAmBG;AACU,QAAA,0BAA0B,GACtC,gBAA2D,CAAC;AAE7D;;;;;;;;;;GAUG;AACU,QAAA,yBAAyB,GAAG,OAAkD,CAAC;AAiE5F;;;;;;;GAOG;AACH,SAAgB,gCAAgC,CAC/C,mBAA4C,EAC5C,SAAkD;IAElD,+BAA+B,CAAC,mBAAmB,CAAC,CAAC;IACrD,MAAM,cAAc,GAAe,EAAE,CAAC;IACtC,gEAAgE;IAChE,KAAK,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;QACvD,cAAc,CAAC,GAAG,CAAC,GAAG,+BAA+B,CACpD,mBAAmB,EACnB,MAAiC,CACjC,CAAC;IACH,CAAC;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F,0FAA0F;YAC1F,kCAAkC;YAClC,IAAI,MAAM,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;gBAChF,gBAAgB,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;YACxC,CAAC;QACF,CAAC;QACD,IAAI,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACjC,2DAA2D;YAC3D,OAAO,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,IAAA,mBAAO,EAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC1D,CAAC;QACD,qFAAqF;QACrF,+DAA+D;QAC/D,OAAO,SAAS,CAAC;IAClB,CAAC,CAAC;AACH,CAAC;AAvCD,4EAuCC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, fail } from \"@fluidframework/core-utils/internal\";\nimport type { MinimumVersionForCollab } from \"@fluidframework/runtime-definitions/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\nimport { compare, gt, gte, lte, valid, parse } from \"semver-ts\";\n\nimport { pkgVersion } from \"./packageVersion.js\";\n\n/**\n * Our policy is to support major versions N and N-1, where N is most\n * recent public major release of the Fluid Framework Client.\n * Therefore, if the customer does not provide a minVersionForCollab, we will\n * default to use N-1.\n *\n * However, this is not consistent with today's behavior. Some options (i.e.\n * batching, compression) are enabled by default despite not being compatible\n * with 1.x clients. Since the policy was introduced during 2.x's lifespan,\n * N/N-1 compatibility by **default** will be in effect starting with 3.0.\n * Importantly though, N/N-2 compatibility is still guaranteed with the proper\n * configurations set.\n *\n * Further to distinguish unspecified `minVersionForCollab` from a specified\n * version and allow `enableExplicitSchemaControl` to default to `true` for\n * any 2.0.0+ version, we will use a special value of `2.0.0-defaults`, which\n * is semantically less than 2.0.0.\n *\n * @internal\n */\nexport const defaultMinVersionForCollab =\n\t\"2.0.0-defaults\" as const satisfies MinimumVersionForCollab;\n\n/**\n * We don't want allow a version before the major public release of the LTS version.\n * Today we use \"1.0.0\", because our policy supports N/N-1 & N/N-2, which includes\n * all minor versions of N. Though LTS starts at 1.4.0, we should stay consistent\n * with our policy and allow all 1.x versions to be compatible with 2.x.\n *\n * @privateRemarks\n * Exported for use in tests.\n *\n * @internal\n */\nexport const lowestMinVersionForCollab = \"1.0.0\" as const satisfies MinimumVersionForCollab;\n\n/**\n * String in a valid semver format specifying bottom of a minor version\n * or special \"defaults\" prerelease of a major.\n * @remarks Only 2.0.0-defaults is expected, but index signatures cannot be a\n * literal; so, just allow any major -defaults prerelease.\n *\n * @internal\n */\nexport type MinimumMinorSemanticVersion = `${bigint}.${bigint}.0` | `${bigint}.0.0-defaults`;\n\n/**\n * String in a valid semver format of a specific version at least specifying minor.\n * Unlike {@link @fluidframework/runtime-definitions#MinimumVersionForCollab}, this type allows any bigint for the major version.\n * Used as a more generic type that allows major versions other than 1 or 2.\n *\n * @internal\n */\nexport type SemanticVersion =\n\t| `${bigint}.${bigint}.${bigint}`\n\t| `${bigint}.${bigint}.${bigint}-${string}`;\n\n/**\n * Converts a record into a configuration map that associates each key with an instance of its value type that is based on a {@link MinimumMinorSemanticVersion}.\n * @remarks\n * For a given input {@link @fluidframework/runtime-definitions#MinimumVersionForCollab},\n * the corresponding configuration values can be found by using the entry in the inner objects with the highest {@link MinimumMinorSemanticVersion}\n * that does not exceed the given {@link @fluidframework/runtime-definitions#MinimumVersionForCollab}.\n *\n * Use {@link getConfigsForMinVersionForCollab} to retrieve the configuration for a given a {@link @fluidframework/runtime-definitions#MinimumVersionForCollab}.\n *\n * See the remarks on {@link MinimumMinorSemanticVersion} for some limitation on how ConfigMaps must handle versioning.\n * @internal\n */\nexport type ConfigMap<T extends Record<string, unknown>> = {\n\treadonly [K in keyof T]-?: ConfigMapEntry<T[K]>;\n};\n\n/**\n * Entry in {@link ConfigMap} associating {@link MinimumMinorSemanticVersion} with configuration values that became supported in that version.\n * @remarks\n * All entries must at least provide an entry for {@link lowestMinVersionForCollab}.\n * @internal\n */\nexport interface ConfigMapEntry<T> {\n\t// This index signature (See https://www.typescriptlang.org/docs/handbook/2/objects.html#index-signatures) requires all properties on this type to to have keys that are a MinimumMinorSemanticVersion and values of type T.\n\t// Note that the \"version\" part of this syntax is really just documentation and has no impact on the type checking (other than some identifier being required to the syntax here to differentiate it from the computed property syntax).\n\t[version: MinimumMinorSemanticVersion]: T;\n\t// Require an entry for the defaultMinVersionForCollab:\n\t// this ensures that all versions of lowestMinVersionForCollab or later have a specified value in the ConfigMap.\n\t// Note that this is NOT an index signature.\n\t// This is a regular property with a computed name (See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Object_initializer#computed_property_names).\n\t[lowestMinVersionForCollab]: T;\n}\n\n/**\n * Generic type for runtimeOptionsAffectingDocSchemaConfigValidationMap\n *\n * @internal\n */\nexport type ConfigValidationMap<T extends Record<string, unknown>> = {\n\treadonly [K in keyof T]-?: (configValue: T[K]) => SemanticVersion | undefined;\n};\n\n/**\n * Returns a default configuration given minVersionForCollab and configuration version map.\n *\n * @privateRemarks\n * The extra `Record` type for the `configMap` is just used to allow the body of this function to be more type-safe due to limitations of generic types in TypeScript.\n * It should have no impact on the user of this function.\n * @internal\n */\nexport function getConfigsForMinVersionForCollab<T extends Record<SemanticVersion, unknown>>(\n\tminVersionForCollab: MinimumVersionForCollab,\n\tconfigMap: ConfigMap<T> & Record<keyof T, unknown>,\n): T {\n\tvalidateMinimumVersionForCollab(minVersionForCollab);\n\tconst defaultConfigs: Partial<T> = {};\n\t// Iterate over configMap to get default values for each option.\n\tfor (const [key, config] of Object.entries(configMap)) {\n\t\tdefaultConfigs[key] = getConfigForMinVersionForCollab(\n\t\t\tminVersionForCollab,\n\t\t\tconfig as ConfigMapEntry<unknown>,\n\t\t);\n\t}\n\t// We have populated every key, so casting away the Partial is now safe:\n\treturn defaultConfigs as T;\n}\n\n/**\n * Returns a default configuration given minVersionForCollab and {@link ConfigMapEntry}.\n *\n * @internal\n */\nexport function getConfigForMinVersionForCollab<T>(\n\tminVersionForCollab: MinimumVersionForCollab,\n\tconfig: ConfigMapEntry<T>,\n): T {\n\tconst entries: [string, unknown][] = Object.entries(config); // Assigning this to a typed variable to convert the \"any\" into unknown.\n\t// Validate and strongly type the versions from the configMap.\n\tconst versions: [MinimumVersionForCollab, unknown][] = entries.map(([version, value]) => {\n\t\tvalidateMinimumVersionForCollab(version);\n\t\treturn [version, value];\n\t});\n\t// Sort the versions in descending order to find the largest compatible entry.\n\t// TODO: Enforcing a sorted order might be a good idea. For now tolerates any order.\n\tversions.sort((a, b) => compare(b[0], a[0]));\n\t// For each config, we iterate over the keys and check if minVersionForCollab is greater than or equal to the version.\n\t// If so, we set it as the default value for the option.\n\tfor (const [version, value] of versions) {\n\t\tif (gte(minVersionForCollab, version)) {\n\t\t\treturn value as T;\n\t\t}\n\t}\n\tfail(\"No config map entry for version\");\n}\n\n/**\n * Returns detailed information about the validity of a minVersionForCollab.\n * @param minVersionForCollab - The minVersionForCollab to validate.\n * @returns An object containing the validity information.\n *\n * @internal\n */\nexport function checkValidMinVersionForCollabVerbose(minVersionForCollab: SemanticVersion): {\n\tisValidSemver: boolean;\n\tisGteLowestMinVersion: boolean;\n\tisLtePkgVersion: boolean;\n} {\n\tconst isValidSemver = valid(minVersionForCollab) !== null;\n\treturn {\n\t\tisValidSemver,\n\n\t\t// We have to check if the value is a valid semver before calling gte/lte, otherwise they will throw when parsing the version.\n\t\tisGteLowestMinVersion:\n\t\t\tisValidSemver && gte(minVersionForCollab, lowestMinVersionForCollab),\n\t\tisLtePkgVersion: isValidSemver && lte(minVersionForCollab, cleanedPackageVersion),\n\t};\n}\n\n/**\n * Checks if the minVersionForCollab is valid.\n * A valid minVersionForCollab is a MinimumVersionForCollab that is at least `lowestMinVersionForCollab` and less than or equal to the current package version.\n *\n * @internal\n */\nexport function isValidMinVersionForCollab(\n\tminVersionForCollab: SemanticVersion,\n): minVersionForCollab is MinimumVersionForCollab {\n\tconst { isValidSemver, isGteLowestMinVersion, isLtePkgVersion } =\n\t\tcheckValidMinVersionForCollabVerbose(minVersionForCollab);\n\treturn isValidSemver && isGteLowestMinVersion && isLtePkgVersion;\n}\n\nconst parsedPackageVersion = parse(pkgVersion) ?? fail(\"Invalid package version\");\n\n/**\n * `pkgVersion` version without pre-release.\n * @remarks\n * This is the version that the code in the current version of the codebase will have when officially released.\n * Generally, compatibility of prerelease builds is not guaranteed (especially for how they interact with future releases).\n * So while technically a prerelease build is less (older) than the released version which follows it and thus supports less features,\n * 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.\n *\n * To accomplish this, the version the next release will have is provided here as `cleanedPackageVersion` while `pkgVersion` may be a prerelease in some cases,\n * like when running tests on CI, or in an actual prerelease published package.\n * 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.\n *\n * This is of particular note in two cases:\n * 1. When landing a new feature, and setting the minVersionForCollab which enables it to be the version that the next release will have.\n * 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.\n * 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.\n * This is useful for testing new features, and also non collaborative scenarios where the latest features are desired.\n *\n * To accommodate some uses of the second case, it might be useful to package export this in the future.\n *\n * @privateRemarks\n * Since this is used by validateMinimumVersionForCollab, the type case to MinimumVersionForCollab can not use it directly.\n * Thus this is just `as` cast here, and a test confirms it is valid according to validateMinimumVersionForCollab.\n *\n */\nexport const cleanedPackageVersion =\n\t`${parsedPackageVersion.major}.${parsedPackageVersion.minor}.${parsedPackageVersion.patch}` as MinimumVersionForCollab;\n\n/**\n * Narrows the type of the provided {@link SemanticVersion} to a {@link @fluidframework/runtime-definitions#MinimumVersionForCollab}, throwing a UsageError if it is not valid.\n * @remarks\n * This is more strict than the type constraints imposed by `MinimumVersionForCollab`.\n * Currently there is no type which is used to separate semantically valid and typescript allowed MinimumVersionForCollab values:\n * thus users that care about strict validation may want to call this on un-validated `MinimumVersionForCollab` values.\n * @param semanticVersion - The version to check.\n * @throws UsageError if the version is not a valid MinimumVersionForCollab.\n *\n * @internal\n */\nexport function validateMinimumVersionForCollab(\n\tsemanticVersion: string,\n): asserts semanticVersion is MinimumVersionForCollab {\n\tconst minVersionForCollab = semanticVersion as MinimumVersionForCollab;\n\tconst { isValidSemver, isGteLowestMinVersion, isLtePkgVersion } =\n\t\tcheckValidMinVersionForCollabVerbose(minVersionForCollab);\n\tif (!(isValidSemver && isGteLowestMinVersion && isLtePkgVersion)) {\n\t\tthrow new UsageError(\n\t\t\t`Version ${minVersionForCollab} is not a valid MinimumVersionForCollab. ` +\n\t\t\t\t`It must be in a valid semver format, at least ${lowestMinVersionForCollab}, ` +\n\t\t\t\t`and less than or equal to the current package version ${cleanedPackageVersion}. ` +\n\t\t\t\t`Details: { isValidSemver: ${isValidSemver}, isGteLowestMinVersion: ${isGteLowestMinVersion}, isLtePkgVersion: ${isLtePkgVersion} }`,\n\t\t);\n\t}\n}\n\n/**\n * Validates the given `overrides`.\n *\n * No-op when minVersionForCollab is set to defaultMinVersionForCollab.\n *\n * Otherwise this checks that for keys which are in both the `validationMap` and the `overrides`,\n * that the `validationMap` function for that key either returns undefined or a version less than or equal to `minVersionForCollab`.\n * @privateRemarks\n * This design seems odd, and might want to be revisited.\n * Currently it only permits opting out of features, not into them (unless validationMap returns undefined),\n * and the handling of defaultMinVersionForCollab and undefined versions seems questionable.\n * Also ignoring of extra keys in overrides might be bad since it seems like overrides is supposed to be validated.\n * @internal\n */\nexport function validateConfigMapOverrides<T extends Record<string, unknown>>(\n\tminVersionForCollab: SemanticVersion,\n\toverrides: Partial<T>,\n\tvalidationMap: ConfigValidationMap<T>,\n): void {\n\tif (minVersionForCollab === defaultMinVersionForCollab) {\n\t\t// If the minVersionForCollab is set to the default value, then we will not validate the runtime options\n\t\t// This is to avoid disruption to users who have not yet set the minVersionForCollab value explicitly.\n\t\t// TODO: This also skips validation for users which explicitly request defaultMinVersionForCollab which seems like a bug.\n\t\treturn;\n\t}\n\t// Iterate through each runtime option passed in by the user\n\t// Type assertion is safe as entries come from runtimeOptions object\n\tfor (const [passedRuntimeOption, passedRuntimeOptionValue] of Object.entries(overrides) as [\n\t\tkeyof T & string,\n\t\tT[keyof T & string],\n\t][]) {\n\t\t// Skip if passedRuntimeOption is not in validation map\n\t\tif (!(passedRuntimeOption in validationMap)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst requiredVersion = validationMap[passedRuntimeOption](passedRuntimeOptionValue);\n\t\tif (requiredVersion !== undefined && gt(requiredVersion, minVersionForCollab)) {\n\t\t\tthrow new UsageError(\n\t\t\t\t`Runtime option ${passedRuntimeOption}:${JSON.stringify(passedRuntimeOptionValue)} requires ` +\n\t\t\t\t\t`runtime version ${requiredVersion}. Please update minVersionForCollab ` +\n\t\t\t\t\t`(currently ${minVersionForCollab}) to ${requiredVersion} or later to proceed.`,\n\t\t\t);\n\t\t}\n\t}\n}\n\n/**\n * Helper function to map ContainerRuntimeOptionsInternal config values to\n * minVersionForCollab in, e.g., {@link @fluidframework/container-runtime#runtimeOptionsAffectingDocSchemaConfigValidationMap}.\n *\n * @internal\n */\nexport function configValueToMinVersionForCollab<\n\tT extends string | number | boolean | undefined | object,\n\tArr extends readonly [T, SemanticVersion][],\n>(configToMinVer: Arr): (configValue: T) => SemanticVersion | undefined {\n\tconst configValueToRequiredVersionMap = new Map(configToMinVer);\n\treturn (configValue: T) => {\n\t\t// If the configValue is not an object then we can get the version required directly from the map.\n\t\tif (typeof configValue !== \"object\") {\n\t\t\treturn configValueToRequiredVersionMap.get(configValue);\n\t\t}\n\t\t// When the input `configValue` is an object, this logic determines the minimum runtime version it requires.\n\t\t// It iterates through each entry in `configValueToRequiredVersionMap`. If `possibleConfigValue` shares at\n\t\t// least one key-value pair with the input `configValue`, its associated `versionRequired` is collected into\n\t\t// `matchingVersions`. After checking all entries, the highest among the collected versions is returned.\n\t\t// This represents the overall minimum version required to support the features implied by the input `configValue`.\n\t\tconst matchingVersions: SemanticVersion[] = [];\n\t\tfor (const [\n\t\t\tpossibleConfigValue,\n\t\t\tversionRequired,\n\t\t] of configValueToRequiredVersionMap.entries()) {\n\t\t\tassert(\n\t\t\t\ttypeof possibleConfigValue == \"object\",\n\t\t\t\t0xbb9 /* possibleConfigValue should be an object */,\n\t\t\t);\n\t\t\t// Check if `possibleConfigValue` and the input `configValue` share at least one\n\t\t\t// common key-value pair. If they do, the `versionRequired` for this `possibleConfigValue`\n\t\t\t// is added to `matchingVersions`.\n\t\t\tif (Object.entries(possibleConfigValue).some(([k, v]) => configValue[k] === v)) {\n\t\t\t\tmatchingVersions.push(versionRequired);\n\t\t\t}\n\t\t}\n\t\tif (matchingVersions.length > 0) {\n\t\t\t// Return the latest minVersionForCollab among all matches.\n\t\t\treturn matchingVersions.sort((a, b) => compare(b, a))[0];\n\t\t}\n\t\t// If no matches then we return undefined. This means that the config value passed in\n\t\t// does not require a specific minVersionForCollab to be valid.\n\t\treturn undefined;\n\t};\n}\n"]}
package/dist/index.d.ts CHANGED
@@ -17,6 +17,6 @@ export { RuntimeHeaders, seqFromTree, encodeCompactIdToString, } from "./utils.j
17
17
  export type { ReadAndParseBlob } from "./utils.js";
18
18
  export { isSnapshotFetchRequiredForLoadingGroupId } from "./snapshotUtils.js";
19
19
  export { toDeltaManagerErased, toDeltaManagerInternal, } from "./deltaManager.js";
20
- export { configValueToMinVersionForCollab, defaultMinVersionForCollab, getValidationForRuntimeOptions, getConfigsForMinVersionForCollab, isValidMinVersionForCollab, semanticVersionToMinimumVersionForCollab, } from "./compatibilityBase.js";
21
- export type { ConfigMap, ConfigValidationMap, MinimumMinorSemanticVersion, SemanticVersion, } from "./compatibilityBase.js";
20
+ export { configValueToMinVersionForCollab, defaultMinVersionForCollab, validateConfigMapOverrides, getConfigForMinVersionForCollab, getConfigsForMinVersionForCollab, isValidMinVersionForCollab, validateMinimumVersionForCollab, lowestMinVersionForCollab, } from "./compatibilityBase.js";
21
+ export type { ConfigMap, ConfigMapEntry, ConfigValidationMap, MinimumMinorSemanticVersion, SemanticVersion, } from "./compatibilityBase.js";
22
22
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAC7E,OAAO,EACN,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,aAAa,GACb,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACN,mBAAmB,EACnB,4BAA4B,EAC5B,eAAe,EACf,aAAa,EACb,mCAAmC,EACnC,2BAA2B,EAC3B,kBAAkB,EAClB,kBAAkB,EAClB,4BAA4B,EAC5B,mBAAmB,EACnB,qBAAqB,GACrB,MAAM,cAAc,CAAC;AACtB,YAAY,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EACN,mCAAmC,EACnC,mBAAmB,GACnB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EACN,gBAAgB,EAChB,2BAA2B,EAC3B,cAAc,EACd,gCAAgC,EAChC,yBAAyB,EACzB,oBAAoB,EACpB,6BAA6B,EAC7B,aAAa,EACb,WAAW,EACX,UAAU,EACV,0BAA0B,EAC1B,kBAAkB,EAClB,gBAAg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,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EACN,gBAAgB,EAChB,2BAA2B,EAC3B,cAAc,EACd,gCAAgC,EAChC,yBAAyB,EACzB,oBAAoB,EACpB,6BAA6B,EAC7B,aAAa,EACb,WAAW,EACX,UAAU,EACV,0BAA0B,EAC1B,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,GACd,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EACN,cAAc,EACd,WAAW,EACX,uBAAuB,GACvB,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,wCAAwC,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EACN,oBAAoB,EACpB,sBAAsB,GACtB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACN,gCAAgC,EAChC,0BAA0B,EAC1B,0BAA0B,EAC1B,+BAA+B,EAC/B,gCAAgC,EAChC,0BAA0B,EAC1B,+BAA+B,EAC/B,yBAAyB,GACzB,MAAM,wBAAwB,CAAC;AAChC,YAAY,EACX,SAAS,EACT,cAAc,EACd,mBAAmB,EACnB,2BAA2B,EAC3B,eAAe,GACf,MAAM,wBAAwB,CAAC"}
package/dist/index.js CHANGED
@@ -4,7 +4,8 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.semanticVersionToMinimumVersionForCollab = exports.isValidMinVersionForCollab = exports.getConfigsForMinVersionForCollab = exports.getValidationForRuntimeOptions = exports.defaultMinVersionForCollab = exports.configValueToMinVersionForCollab = exports.toDeltaManagerInternal = exports.toDeltaManagerErased = exports.isSnapshotFetchRequiredForLoadingGroupId = exports.encodeCompactIdToString = exports.seqFromTree = exports.RuntimeHeaders = exports.unpackChildNodesUsedRoutes = exports.utf8ByteLength = exports.TelemetryContext = exports.SummaryTreeBuilder = exports.processAttachMessageGCData = exports.mergeStats = exports.getBlobSize = exports.GCDataBuilder = exports.convertToSummaryTreeWithStats = exports.convertToSummaryTree = exports.convertSummaryTreeToITree = exports.convertSnapshotTreeToSummaryTree = exports.calculateStats = exports.addSummarizeResultToSummary = exports.addBlobToSummary = exports.RuntimeFactoryHelper = exports.RequestParser = exports.RemoteFluidObjectHandle = exports.listBlobsAtTreePath = exports.getNormalizedObjectStoragePathParts = exports.ObjectStoragePartition = exports.toFluidHandleInternal = exports.toFluidHandleErased = exports.lookupTemporaryBlobStorageId = exports.isSerializedHandle = exports.isLocalFluidHandle = exports.isFluidHandlePayloadPending = exports.isFluidHandleInternalPayloadPending = exports.isFluidHandle = exports.FluidHandleBase = exports.encodeHandleForSerialization = exports.compareFluidHandles = exports.asLegacyAlpha = exports.responseToException = exports.exceptionToResponse = exports.createResponseError = exports.create404Response = exports.generateHandleContextPath = void 0;
7
+ exports.isValidMinVersionForCollab = exports.getConfigsForMinVersionForCollab = exports.getConfigForMinVersionForCollab = exports.validateConfigMapOverrides = exports.defaultMinVersionForCollab = exports.configValueToMinVersionForCollab = exports.toDeltaManagerInternal = exports.toDeltaManagerErased = exports.isSnapshotFetchRequiredForLoadingGroupId = exports.encodeCompactIdToString = exports.seqFromTree = exports.RuntimeHeaders = exports.unpackChildNodesUsedRoutes = exports.utf8ByteLength = exports.TelemetryContext = exports.SummaryTreeBuilder = exports.processAttachMessageGCData = exports.mergeStats = exports.getBlobSize = exports.GCDataBuilder = exports.convertToSummaryTreeWithStats = exports.convertToSummaryTree = exports.convertSummaryTreeToITree = exports.convertSnapshotTreeToSummaryTree = exports.calculateStats = exports.addSummarizeResultToSummary = exports.addBlobToSummary = exports.RuntimeFactoryHelper = exports.RequestParser = exports.RemoteFluidObjectHandle = exports.listBlobsAtTreePath = exports.getNormalizedObjectStoragePathParts = exports.ObjectStoragePartition = exports.toFluidHandleInternal = exports.toFluidHandleErased = exports.lookupTemporaryBlobStorageId = exports.isSerializedHandle = exports.isLocalFluidHandle = exports.isFluidHandlePayloadPending = exports.isFluidHandleInternalPayloadPending = exports.isFluidHandle = exports.FluidHandleBase = exports.encodeHandleForSerialization = exports.compareFluidHandles = exports.asLegacyAlpha = exports.responseToException = exports.exceptionToResponse = exports.createResponseError = exports.create404Response = exports.generateHandleContextPath = void 0;
8
+ exports.lowestMinVersionForCollab = exports.validateMinimumVersionForCollab = void 0;
8
9
  var dataStoreHandleContextUtils_js_1 = require("./dataStoreHandleContextUtils.js");
9
10
  Object.defineProperty(exports, "generateHandleContextPath", { enumerable: true, get: function () { return dataStoreHandleContextUtils_js_1.generateHandleContextPath; } });
10
11
  var dataStoreHelpers_js_1 = require("./dataStoreHelpers.js");
@@ -65,8 +66,10 @@ Object.defineProperty(exports, "toDeltaManagerInternal", { enumerable: true, get
65
66
  var compatibilityBase_js_1 = require("./compatibilityBase.js");
66
67
  Object.defineProperty(exports, "configValueToMinVersionForCollab", { enumerable: true, get: function () { return compatibilityBase_js_1.configValueToMinVersionForCollab; } });
67
68
  Object.defineProperty(exports, "defaultMinVersionForCollab", { enumerable: true, get: function () { return compatibilityBase_js_1.defaultMinVersionForCollab; } });
68
- Object.defineProperty(exports, "getValidationForRuntimeOptions", { enumerable: true, get: function () { return compatibilityBase_js_1.getValidationForRuntimeOptions; } });
69
+ Object.defineProperty(exports, "validateConfigMapOverrides", { enumerable: true, get: function () { return compatibilityBase_js_1.validateConfigMapOverrides; } });
70
+ Object.defineProperty(exports, "getConfigForMinVersionForCollab", { enumerable: true, get: function () { return compatibilityBase_js_1.getConfigForMinVersionForCollab; } });
69
71
  Object.defineProperty(exports, "getConfigsForMinVersionForCollab", { enumerable: true, get: function () { return compatibilityBase_js_1.getConfigsForMinVersionForCollab; } });
70
72
  Object.defineProperty(exports, "isValidMinVersionForCollab", { enumerable: true, get: function () { return compatibilityBase_js_1.isValidMinVersionForCollab; } });
71
- Object.defineProperty(exports, "semanticVersionToMinimumVersionForCollab", { enumerable: true, get: function () { return compatibilityBase_js_1.semanticVersionToMinimumVersionForCollab; } });
73
+ Object.defineProperty(exports, "validateMinimumVersionForCollab", { enumerable: true, get: function () { return compatibilityBase_js_1.validateMinimumVersionForCollab; } });
74
+ Object.defineProperty(exports, "lowestMinVersionForCollab", { enumerable: true, get: function () { return compatibilityBase_js_1.lowestMinVersionForCollab; } });
72
75
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,mFAA6E;AAApE,2IAAA,yBAAyB,OAAA;AAClC,6DAM+B;AAL9B,wHAAA,iBAAiB,OAAA;AACjB,0HAAA,mBAAmB,OAAA;AACnB,0HAAA,mBAAmB,OAAA;AACnB,0HAAA,mBAAmB,OAAA;AACnB,oHAAA,aAAa,OAAA;AAEd,2CAYsB;AAXrB,iHAAA,mBAAmB,OAAA;AACnB,0HAAA,4BAA4B,OAAA;AAC5B,6GAAA,eAAe,OAAA;AACf,2GAAA,aAAa,OAAA;AACb,iIAAA,mCAAmC,OAAA;AACnC,yHAAA,2BAA2B,OAAA;AAC3B,gHAAA,kBAAkB,OAAA;AAClB,gHAAA,kBAAkB,OAAA;AAClB,0HAAA,4BAA4B,OAAA;AAC5B,iHAAA,mBAAmB,OAAA;AACnB,mHAAA,qBAAqB,OAAA;AAGtB,yEAAqE;AAA5D,mIAAA,sBAAsB,OAAA;AAC/B,iEAGiC;AAFhC,4IAAA,mCAAmC,OAAA;AACnC,4HAAA,mBAAmB,OAAA;AAEpB,2EAAuE;AAA9D,qIAAA,uBAAuB,OAAA;AAChC,uDAAmD;AAA1C,iHAAA,aAAa,OAAA;AACtB,qEAAiE;AAAxD,+HAAA,oBAAoB,OAAA;AAC7B,qDAe2B;AAd1B,mHAAA,gBAAgB,OAAA;AAChB,8HAAA,2BAA2B,OAAA;AAC3B,iHAAA,cAAc,OAAA;AACd,mIAAA,gCAAgC,OAAA;AAChC,4HAAA,yBAAyB,OAAA;AACzB,uHAAA,oBAAoB,OAAA;AACpB,gIAAA,6BAA6B,OAAA;AAC7B,gHAAA,aAAa,OAAA;AACb,8GAAA,WAAW,OAAA;AACX,6GAAA,UAAU,OAAA;AACV,6HAAA,0BAA0B,OAAA;AAC1B,qHAAA,kBAAkB,OAAA;AAClB,mHAAA,gBAAgB,OAAA;AAChB,iHAAA,cAAc,OAAA;AAEf,6DAAmE;AAA1D,iIAAA,0BAA0B,OAAA;AACnC,uCAIoB;AAHnB,0GAAA,cAAc,OAAA;AACd,uGAAA,WAAW,OAAA;AACX,mHAAA,uBAAuB,OAAA;AAGxB,uDAA8E;AAArE,4IAAA,wCAAwC,OAAA;AACjD,qDAG2B;AAF1B,uHAAA,oBAAoB,OAAA;AACpB,yHAAA,sBAAsB,OAAA;AAEvB,+DAOgC;AAN/B,wIAAA,gCAAgC,OAAA;AAChC,kIAAA,0BAA0B,OAAA;AAC1B,sIAAA,8BAA8B,OAAA;AAC9B,wIAAA,gCAAgC,OAAA;AAChC,kIAAA,0BAA0B,OAAA;AAC1B,gJAAA,wCAAwC,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { generateHandleContextPath } from \"./dataStoreHandleContextUtils.js\";\nexport {\n\tcreate404Response,\n\tcreateResponseError,\n\texceptionToResponse,\n\tresponseToException,\n\tasLegacyAlpha,\n} from \"./dataStoreHelpers.js\";\nexport {\n\tcompareFluidHandles,\n\tencodeHandleForSerialization,\n\tFluidHandleBase,\n\tisFluidHandle,\n\tisFluidHandleInternalPayloadPending,\n\tisFluidHandlePayloadPending,\n\tisLocalFluidHandle,\n\tisSerializedHandle,\n\tlookupTemporaryBlobStorageId,\n\ttoFluidHandleErased,\n\ttoFluidHandleInternal,\n} from \"./handles.js\";\nexport type { ISerializedHandle } from \"./handles.js\";\nexport { ObjectStoragePartition } from \"./objectstoragepartition.js\";\nexport {\n\tgetNormalizedObjectStoragePathParts,\n\tlistBlobsAtTreePath,\n} from \"./objectstorageutils.js\";\nexport { RemoteFluidObjectHandle } from \"./remoteFluidObjectHandle.js\";\nexport { RequestParser } from \"./requestParser.js\";\nexport { RuntimeFactoryHelper } from \"./runtimeFactoryHelper.js\";\nexport {\n\taddBlobToSummary,\n\taddSummarizeResultToSummary,\n\tcalculateStats,\n\tconvertSnapshotTreeToSummaryTree,\n\tconvertSummaryTreeToITree,\n\tconvertToSummaryTree,\n\tconvertToSummaryTreeWithStats,\n\tGCDataBuilder,\n\tgetBlobSize,\n\tmergeStats,\n\tprocessAttachMessageGCData,\n\tSummaryTreeBuilder,\n\tTelemetryContext,\n\tutf8ByteLength,\n} from \"./summaryUtils.js\";\nexport { unpackChildNodesUsedRoutes } from \"./unpackUsedRoutes.js\";\nexport {\n\tRuntimeHeaders,\n\tseqFromTree,\n\tencodeCompactIdToString,\n} from \"./utils.js\";\nexport type { ReadAndParseBlob } from \"./utils.js\";\nexport { isSnapshotFetchRequiredForLoadingGroupId } from \"./snapshotUtils.js\";\nexport {\n\ttoDeltaManagerErased,\n\ttoDeltaManagerInternal,\n} from \"./deltaManager.js\";\nexport {\n\tconfigValueToMinVersionForCollab,\n\tdefaultMinVersionForCollab,\n\tgetValidationForRuntimeOptions,\n\tgetConfigsForMinVersionForCollab,\n\tisValidMinVersionForCollab,\n\tsemanticVersionToMinimumVersionForCollab,\n} from \"./compatibilityBase.js\";\nexport type {\n\tConfigMap,\n\tConfigValidationMap,\n\tMinimumMinorSemanticVersion,\n\tSemanticVersion,\n} from \"./compatibilityBase.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;AAEH,mFAA6E;AAApE,2IAAA,yBAAyB,OAAA;AAClC,6DAM+B;AAL9B,wHAAA,iBAAiB,OAAA;AACjB,0HAAA,mBAAmB,OAAA;AACnB,0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,oBAAoB,OAAA;AACpB,yHAAA,sBAAsB,OAAA;AAEvB,+DASgC;AAR/B,wIAAA,gCAAgC,OAAA;AAChC,kIAAA,0BAA0B,OAAA;AAC1B,kIAAA,0BAA0B,OAAA;AAC1B,uIAAA,+BAA+B,OAAA;AAC/B,wIAAA,gCAAgC,OAAA;AAChC,kIAAA,0BAA0B,OAAA;AAC1B,uIAAA,+BAA+B,OAAA;AAC/B,iIAAA,yBAAyB,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { generateHandleContextPath } from \"./dataStoreHandleContextUtils.js\";\nexport {\n\tcreate404Response,\n\tcreateResponseError,\n\texceptionToResponse,\n\tresponseToException,\n\tasLegacyAlpha,\n} from \"./dataStoreHelpers.js\";\nexport {\n\tcompareFluidHandles,\n\tencodeHandleForSerialization,\n\tFluidHandleBase,\n\tisFluidHandle,\n\tisFluidHandleInternalPayloadPending,\n\tisFluidHandlePayloadPending,\n\tisLocalFluidHandle,\n\tisSerializedHandle,\n\tlookupTemporaryBlobStorageId,\n\ttoFluidHandleErased,\n\ttoFluidHandleInternal,\n} from \"./handles.js\";\nexport type { ISerializedHandle } from \"./handles.js\";\nexport { ObjectStoragePartition } from \"./objectstoragepartition.js\";\nexport {\n\tgetNormalizedObjectStoragePathParts,\n\tlistBlobsAtTreePath,\n} from \"./objectstorageutils.js\";\nexport { RemoteFluidObjectHandle } from \"./remoteFluidObjectHandle.js\";\nexport { RequestParser } from \"./requestParser.js\";\nexport { RuntimeFactoryHelper } from \"./runtimeFactoryHelper.js\";\nexport {\n\taddBlobToSummary,\n\taddSummarizeResultToSummary,\n\tcalculateStats,\n\tconvertSnapshotTreeToSummaryTree,\n\tconvertSummaryTreeToITree,\n\tconvertToSummaryTree,\n\tconvertToSummaryTreeWithStats,\n\tGCDataBuilder,\n\tgetBlobSize,\n\tmergeStats,\n\tprocessAttachMessageGCData,\n\tSummaryTreeBuilder,\n\tTelemetryContext,\n\tutf8ByteLength,\n} from \"./summaryUtils.js\";\nexport { unpackChildNodesUsedRoutes } from \"./unpackUsedRoutes.js\";\nexport {\n\tRuntimeHeaders,\n\tseqFromTree,\n\tencodeCompactIdToString,\n} from \"./utils.js\";\nexport type { ReadAndParseBlob } from \"./utils.js\";\nexport { isSnapshotFetchRequiredForLoadingGroupId } from \"./snapshotUtils.js\";\nexport {\n\ttoDeltaManagerErased,\n\ttoDeltaManagerInternal,\n} from \"./deltaManager.js\";\nexport {\n\tconfigValueToMinVersionForCollab,\n\tdefaultMinVersionForCollab,\n\tvalidateConfigMapOverrides,\n\tgetConfigForMinVersionForCollab,\n\tgetConfigsForMinVersionForCollab,\n\tisValidMinVersionForCollab,\n\tvalidateMinimumVersionForCollab,\n\tlowestMinVersionForCollab,\n} from \"./compatibilityBase.js\";\nexport type {\n\tConfigMap,\n\tConfigMapEntry,\n\tConfigValidationMap,\n\tMinimumMinorSemanticVersion,\n\tSemanticVersion,\n} from \"./compatibilityBase.js\";\n"]}
@@ -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/runtime-utils";
8
- export declare const pkgVersion = "2.72.0";
8
+ export declare const pkgVersion = "2.74.0-365691";
9
9
  //# sourceMappingURL=packageVersion.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,kCAAkC,CAAC;AACvD,eAAO,MAAM,UAAU,WAAW,CAAC"}
1
+ {"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,kCAAkC,CAAC;AACvD,eAAO,MAAM,UAAU,kBAAkB,CAAC"}
@@ -8,5 +8,5 @@
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.pkgVersion = exports.pkgName = void 0;
10
10
  exports.pkgName = "@fluidframework/runtime-utils";
11
- exports.pkgVersion = "2.72.0";
11
+ exports.pkgVersion = "2.74.0-365691";
12
12
  //# sourceMappingURL=packageVersion.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,+BAA+B,CAAC;AAC1C,QAAA,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/runtime-utils\";\nexport const pkgVersion = \"2.72.0\";\n"]}
1
+ {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,+BAA+B,CAAC;AAC1C,QAAA,UAAU,GAAG,eAAe,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/runtime-utils\";\nexport const pkgVersion = \"2.74.0-365691\";\n"]}