@fluidframework/container-runtime 2.33.0 → 2.33.2

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.
Binary file
@@ -1 +1 @@
1
- {"version":3,"file":"compatUtils.d.ts","sourceRoot":"","sources":["../src/compatUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAeH,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,uBAAuB,CAAC;AAG7E;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,2BAA2B,kBAA4B,CAAC;AAErE;;;;;GAKG;AACH,MAAM,MAAM,2BAA2B,GAAG,GAAG,MAAM,IAAI,MAAM,IAAI,GAAG,GAAG,MAAM,eAAe,CAAC;AAE7F;;GAEG;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;;GAEG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI;KACzD,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG;QACjB,CAAC,OAAO,EAAE,2BAA2B,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;KAC7C;CACD,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,gCAAgC,GAAG,IAAI,CAClD,+BAA+B,EAC7B,kBAAkB,GAClB,qBAAqB,GACrB,gCAAgC,GAChC,gBAAgB,CAClB,CAAC;AAsEF;;GAEG;AACH,wBAAgB,+BAA+B,CAC9C,oBAAoB,EAAE,eAAe,GACnC,gCAAgC,CAOlC;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,CAAC,SAAS,MAAM,CAAC,eAAe,EAAE,OAAO,CAAC,EACjF,oBAAoB,EAAE,eAAe,EACrC,SAAS,EAAE,SAAS,CAAC,C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,CAAC,GACrB,OAAO,CAAC,CAAC,CAAC,CAqBZ;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,oBAAoB,EAAE,eAAe,GAAG,OAAO,CAMnF"}
@@ -3,19 +3,10 @@
3
3
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
4
4
  * Licensed under the MIT License.
5
5
  */
6
- var __importDefault = (this && this.__importDefault) || function (mod) {
7
- return (mod && mod.__esModule) ? mod : { "default": mod };
8
- };
9
6
  Object.defineProperty(exports, "__esModule", { value: true });
10
7
  exports.isValidCompatVersion = exports.getConfigsForCompatMode = exports.getCompatibilityVersionDefaults = exports.defaultCompatibilityVersion = void 0;
11
8
  const internal_1 = require("@fluidframework/runtime-definitions/internal");
12
- // The semver package documents and encourages these imports for users that only need some of the semver functionality.
13
- // eslint-disable-next-line import/no-internal-modules
14
- const gte_js_1 = __importDefault(require("semver/functions/gte.js"));
15
- // eslint-disable-next-line import/no-internal-modules
16
- const lte_js_1 = __importDefault(require("semver/functions/lte.js"));
17
- // eslint-disable-next-line import/no-internal-modules
18
- const valid_js_1 = __importDefault(require("semver/functions/valid.js"));
9
+ const semver_ts_1 = require("semver-ts");
19
10
  const compressionDefinitions_js_1 = require("./compressionDefinitions.js");
20
11
  const packageVersion_js_1 = require("./packageVersion.js");
21
12
  /**
@@ -120,12 +111,12 @@ function getConfigsForCompatMode(compatibilityVersion, configMap) {
120
111
  for (const key of Object.keys(configMap)) {
121
112
  const config = configMap[key];
122
113
  // Sort the versions in ascending order so we can short circuit the loop.
123
- const versions = Object.keys(config).sort((a, b) => ((0, gte_js_1.default)(b, a) ? -1 : 1));
114
+ const versions = Object.keys(config).sort(semver_ts_1.compare);
124
115
  // For each config, we iterate over the keys and check if compatibilityVersion is greater than or equal to the version.
125
116
  // 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
126
117
  // value that is compatible with the version specified as the compatibilityVersion.
127
118
  for (const version of versions) {
128
- if ((0, gte_js_1.default)(compatibilityVersion, version)) {
119
+ if ((0, semver_ts_1.gte)(compatibilityVersion, version)) {
129
120
  defaultConfigs[key] = config[version];
130
121
  }
131
122
  else {
@@ -144,8 +135,8 @@ exports.getConfigsForCompatMode = getConfigsForCompatMode;
144
135
  */
145
136
  function isValidCompatVersion(compatibilityVersion) {
146
137
  return (compatibilityVersion !== undefined &&
147
- (0, valid_js_1.default)(compatibilityVersion) !== null &&
148
- (0, lte_js_1.default)(compatibilityVersion, packageVersion_js_1.pkgVersion));
138
+ (0, semver_ts_1.valid)(compatibilityVersion) !== null &&
139
+ (0, semver_ts_1.lte)(compatibilityVersion, packageVersion_js_1.pkgVersion));
149
140
  }
150
141
  exports.isValidCompatVersion = isValidCompatVersion;
151
142
  //# sourceMappingURL=compatUtils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"compatUtils.js","sourceRoot":"","sources":["../src/compatUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH,2EAAyE;AACzE,uHAAuH;AACvH,sDAAsD;AACtD,qEAAgD;AAChD,sDAAsD;AACtD,qEAAgD;AAChD,sDAAsD;AACtD,yEAAoD;AAEpD,2EAGqC;AAErC,2DAAiD;AAEjD;;;;;;;;;;;;;;;;;GAiBG;AACU,QAAA,2BAA2B,GAAG,gBAAyB,CAAC;AAkDrE;;;;;;;;;;;;GAYG;AACH,MAAM,yCAAyC,GAAG;IACjD,qBAAqB,EAAE;QACtB,OAAO,EAAE,KAAK;QACd,gBAAgB,EAAE,IAAI;KACb;IACV,kBAAkB,EAAE;QACnB,OAAO,EAAE,qDAAyB;QAClC,gBAAgB,EAAE,oDAAwB;KACjC;IACV,yBAAyB,EAAE;QAC1B,sEAAsE;QACtE,sDAAsD;QACtD,mEAAmE;QACnE,yDAAyD;QACzD,OAAO,EAAE,SAAS;QAClB,qEAAqE;QACrE,qEAAqE;QACrE,mEAAmE;QACnE,qEAAqE;QACrE,wBAAwB;KACf;IACV,qBAAqB,EAAE;QACtB,OAAO,EAAE,KAAK;QACd,0EAA0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I,QAAQ,EAAE,CAAC;YAChC,IAAI,IAAA,gBAAS,EAAC,oBAAoB,EAAE,OAAO,CAAC,EAAE,CAAC;gBAC9C,cAAc,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,OAAsC,CAAC,CAAC;YACtE,CAAC;iBAAM,CAAC;gBACP,4GAA4G;gBAC5G,sBAAsB;gBACtB,MAAM;YACP,CAAC;QACF,CAAC;IACF,CAAC;IACD,OAAO,cAAc,CAAC;AACvB,CAAC;AAxBD,0DAwBC;AAED;;;GAGG;AACH,SAAgB,oBAAoB,CAAC,oBAAqC;IACzE,OAAO,CACN,oBAAoB,KAAK,SAAS;QAClC,IAAA,kBAAW,EAAC,oBAAoB,CAAC,KAAK,IAAI;QAC1C,IAAA,gBAAS,EAAC,oBAAoB,EAAE,8BAAU,CAAC,CAC3C,CAAC;AACH,CAAC;AAND,oDAMC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { FlushMode } from \"@fluidframework/runtime-definitions/internal\";\n// The semver package documents and encourages these imports for users that only need some of the semver functionality.\n// eslint-disable-next-line import/no-internal-modules\nimport semverGte from \"semver/functions/gte.js\";\n// eslint-disable-next-line import/no-internal-modules\nimport semverLte from \"semver/functions/lte.js\";\n// eslint-disable-next-line import/no-internal-modules\nimport semverValid from \"semver/functions/valid.js\";\n\nimport {\n\tdisabledCompressionConfig,\n\tenabledCompressionConfig,\n} from \"./compressionDefinitions.js\";\nimport type { ContainerRuntimeOptionsInternal } from \"./containerRuntime.js\";\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 compatibility mode, 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 `compatibilityVersion` 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 */\nexport const defaultCompatibilityVersion = \"2.0.0-defaults\" as const;\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 */\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 */\nexport type SemanticVersion =\n\t| `${bigint}.${bigint}.${bigint}`\n\t| `${bigint}.${bigint}.${bigint}-${string}`;\n\n/**\n * Generic type for runtimeOptionsAffectingDocSchemaConfigMap\n */\nexport type ConfigMap<T extends Record<string, unknown>> = {\n\t[K in keyof T]-?: {\n\t\t[version: MinimumMinorSemanticVersion]: T[K];\n\t};\n};\n\n/**\n * Subset of the {@link ContainerRuntimeOptionsInternal} properties which\n * affect {@link IDocumentSchemaFeatures}.\n *\n * @remarks\n * When a new option is added to {@link ContainerRuntimeOptionsInternal}, we\n * must consider if it changes the DocumentSchema. If so, then a corresponding\n * entry must be added to {@link runtimeOptionsAffectingDocSchemaConfigMap}\n * below. If not, then it must be omitted from this type.\n *\n * Note: `Omit` is used instead of `Pick` to ensure that all new options are\n * included in this type by default. If any new properties are added to\n * {@link ContainerRuntimeOptionsInternal}, they will be included in this\n * type unless explicitly omitted. This will prevent us from forgetting to\n * account for any new properties in the future.\n */\nexport type RuntimeOptionsAffectingDocSchema = Omit<\n\tContainerRuntimeOptionsInternal,\n\t| \"chunkSizeInBytes\"\n\t| \"maxBatchSizeInBytes\"\n\t| \"loadSequenceNumberVerification\"\n\t| \"summaryOptions\"\n>;\n\n/**\n * Mapping of RuntimeOptionsAffectingDocSchema to their compatibility related configs.\n *\n * Each key in this map corresponds to a property in RuntimeOptionsAffectingDocSchema. The value is an object that maps SemanticVersions\n * to the appropriate default value for that property to supporting that SemanticVersion. If clients running SemanticVersion X are able to understand\n * the format changes introduced by the property, then the default value for that SemanticVersion will enable the feature associated with the property.\n * Otherwise, the feature will be disabled.\n *\n * For example if the compatibilityVersion is a 1.x version (i.e. \"1.5.0\"), then the default value for `enableGroupedBatching` will be false since 1.x\n * clients do not understand the document format when batching is enabled. If the compatibilityVersion is a 2.x client (i.e. \"2.0.0\" or later), then the\n * default value for `enableGroupedBatching` will be true because clients running 2.0 or later will be able to understand the format changes associated\n * with the batching feature.\n */\nconst runtimeOptionsAffectingDocSchemaConfigMap = {\n\tenableGroupedBatching: {\n\t\t\"1.0.0\": false,\n\t\t\"2.0.0-defaults\": true,\n\t} as const,\n\tcompressionOptions: {\n\t\t\"1.0.0\": disabledCompressionConfig,\n\t\t\"2.0.0-defaults\": enabledCompressionConfig,\n\t} as const,\n\tenableRuntimeIdCompressor: {\n\t\t// For IdCompressorMode, `undefined` represents a logical state (off).\n\t\t// However, to satisfy the Required<> constraint while\n\t\t// `exactOptionalPropertyTypes` is `false` (TODO: AB#8215), we need\n\t\t// to have it defined, so we trick the type checker here.\n\t\t\"1.0.0\": undefined,\n\t\t// We do not yet want to enable idCompressor by default since it will\n\t\t// increase bundle sizes, and not all customers will benefit from it.\n\t\t// Therefore, we will require customers to explicitly enable it. We\n\t\t// are keeping it as a DocSchema affecting option for now as this may\n\t\t// change in the future.\n\t} as const,\n\texplicitSchemaControl: {\n\t\t\"1.0.0\": false,\n\t\t// This option's intention is to prevent 1.x clients from joining sessions\n\t\t// when enabled. This is set to true when the compatibility version is set\n\t\t// to >=2.0.0 (explicitly). This is different than other 2.0 defaults\n\t\t// because it was not enabled by default prior to the implementation of\n\t\t// `compatibilityVersion`.\n\t\t// `defaultCompatibilityVersion` is set to \"2.0.0-defaults\" which \"2.0.0\"\n\t\t// does not satisfy to avoiding enabling this option by default as of\n\t\t// `compatibilityVersion` introduction, which could be unexpected.\n\t\t// Only enable as a default when `compatibilityVersion` is specified at\n\t\t// 2.0.0+.\n\t\t\"2.0.0\": true,\n\t} as const,\n\tflushMode: {\n\t\t// Note: 1.x clients are compatible with TurnBased flushing, but here we elect to remain on Immediate flush mode\n\t\t// as a work-around for inability to send batches larger than 1Mb. Immediate flushing keeps batches smaller as\n\t\t// fewer messages will be included per flush.\n\t\t\"1.0.0\": FlushMode.Immediate,\n\t\t\"2.0.0-defaults\": FlushMode.TurnBased,\n\t} as const,\n\tgcOptions: {\n\t\t\"1.0.0\": {},\n\t\t// Although sweep is supported in 2.x, it is disabled by default until compatibilityVersion>=3.0.0 to be extra safe.\n\t\t\"3.0.0\": { enableGCSweep: true },\n\t} as const,\n\tcreateBlobPayloadPending: {\n\t\t// This feature is new and disabled by default. In the future we will enable it by default, but we have not\n\t\t// closed on the version where that will happen yet. Probably a .10 release since blob functionality is not\n\t\t// exposed on the `@public` API surface.\n\t\t\"1.0.0\": undefined,\n\t} as const,\n} as const satisfies ConfigMap<RuntimeOptionsAffectingDocSchema>;\n\n/**\n * Returns the default RuntimeOptionsAffectingDocSchema configuration for a given compatibility version.\n */\nexport function getCompatibilityVersionDefaults(\n\tcompatibilityVersion: SemanticVersion,\n): RuntimeOptionsAffectingDocSchema {\n\treturn getConfigsForCompatMode(\n\t\tcompatibilityVersion,\n\t\truntimeOptionsAffectingDocSchemaConfigMap,\n\t\t// This is a bad cast away from Partial that getConfigsForCompatMode provides.\n\t\t// ConfigMap should be restructured to provide RuntimeOptionsAffectingDocSchema guarantee.\n\t) as RuntimeOptionsAffectingDocSchema;\n}\n\n/**\n * Returns a default configuration given compatibility version and configuration version map.\n */\nexport function getConfigsForCompatMode<T extends Record<SemanticVersion, unknown>>(\n\tcompatibilityVersion: 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\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((a, b) => (semverGte(b, a) ? -1 : 1));\n\t\t// For each config, we iterate over the keys and check if compatibilityVersion 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 compatibilityVersion.\n\t\tfor (const version of versions) {\n\t\t\tif (semverGte(compatibilityVersion, version)) {\n\t\t\t\tdefaultConfigs[key] = config[version as MinimumMinorSemanticVersion];\n\t\t\t} else {\n\t\t\t\t// If the compatibility mode 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 * Checks if the compatibility version is valid.\n * A valid compatibility version is a string that is a valid semver version and is less than or equal to the current package version.\n */\nexport function isValidCompatVersion(compatibilityVersion: SemanticVersion): boolean {\n\treturn (\n\t\tcompatibilityVersion !== undefined &&\n\t\tsemverValid(compatibilityVersion) !== null &&\n\t\tsemverLte(compatibilityVersion, pkgVersion)\n\t);\n}\n"]}
1
+ {"version":3,"file":"compatUtils.js","sourceRoot":"","sources":["../src/compatUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2EAAyE;AACzE,yCAAqD;AAErD,2EAGqC;AAErC,2DAAiD;AAEjD;;;;;;;;;;;;;;;;;GAiBG;AACU,QAAA,2BAA2B,GAAG,gBAAyB,CAAC;AAkDrE;;;;;;;;;;;;GAYG;AACH,MAAM,yCAAyC,GAAG;IACjD,qBAAqB,EAAE;QACtB,OAAO,EAAE,KAAK;QACd,gBAAgB,EAAE,IAAI;KACb;IACV,kBAAkB,EAAE;QACnB,OAAO,EAAE,qDAAyB;QAClC,gBAAgB,EAAE,oDAAwB;KACjC;IACV,yBAAyB,EAAE;QAC1B,sEAAsE;QACtE,sDAAsD;QACtD,mE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mF;QACnF,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;YAChC,IAAI,IAAA,eAAG,EAAC,oBAAoB,EAAE,OAAO,CAAC,EAAE,CAAC;gBACxC,cAAc,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,OAAsC,CAAC,CAAC;YACtE,CAAC;iBAAM,CAAC;gBACP,4GAA4G;gBAC5G,sBAAsB;gBACtB,MAAM;YACP,CAAC;QACF,CAAC;IACF,CAAC;IACD,OAAO,cAAc,CAAC;AACvB,CAAC;AAxBD,0DAwBC;AAED;;;GAGG;AACH,SAAgB,oBAAoB,CAAC,oBAAqC;IACzE,OAAO,CACN,oBAAoB,KAAK,SAAS;QAClC,IAAA,iBAAK,EAAC,oBAAoB,CAAC,KAAK,IAAI;QACpC,IAAA,eAAG,EAAC,oBAAoB,EAAE,8BAAU,CAAC,CACrC,CAAC;AACH,CAAC;AAND,oDAMC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { FlushMode } from \"@fluidframework/runtime-definitions/internal\";\nimport { compare, gte, lte, valid } from \"semver-ts\";\n\nimport {\n\tdisabledCompressionConfig,\n\tenabledCompressionConfig,\n} from \"./compressionDefinitions.js\";\nimport type { ContainerRuntimeOptionsInternal } from \"./containerRuntime.js\";\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 compatibility mode, 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 `compatibilityVersion` 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 */\nexport const defaultCompatibilityVersion = \"2.0.0-defaults\" as const;\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 */\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 */\nexport type SemanticVersion =\n\t| `${bigint}.${bigint}.${bigint}`\n\t| `${bigint}.${bigint}.${bigint}-${string}`;\n\n/**\n * Generic type for runtimeOptionsAffectingDocSchemaConfigMap\n */\nexport type ConfigMap<T extends Record<string, unknown>> = {\n\t[K in keyof T]-?: {\n\t\t[version: MinimumMinorSemanticVersion]: T[K];\n\t};\n};\n\n/**\n * Subset of the {@link ContainerRuntimeOptionsInternal} properties which\n * affect {@link IDocumentSchemaFeatures}.\n *\n * @remarks\n * When a new option is added to {@link ContainerRuntimeOptionsInternal}, we\n * must consider if it changes the DocumentSchema. If so, then a corresponding\n * entry must be added to {@link runtimeOptionsAffectingDocSchemaConfigMap}\n * below. If not, then it must be omitted from this type.\n *\n * Note: `Omit` is used instead of `Pick` to ensure that all new options are\n * included in this type by default. If any new properties are added to\n * {@link ContainerRuntimeOptionsInternal}, they will be included in this\n * type unless explicitly omitted. This will prevent us from forgetting to\n * account for any new properties in the future.\n */\nexport type RuntimeOptionsAffectingDocSchema = Omit<\n\tContainerRuntimeOptionsInternal,\n\t| \"chunkSizeInBytes\"\n\t| \"maxBatchSizeInBytes\"\n\t| \"loadSequenceNumberVerification\"\n\t| \"summaryOptions\"\n>;\n\n/**\n * Mapping of RuntimeOptionsAffectingDocSchema to their compatibility related configs.\n *\n * Each key in this map corresponds to a property in RuntimeOptionsAffectingDocSchema. The value is an object that maps SemanticVersions\n * to the appropriate default value for that property to supporting that SemanticVersion. If clients running SemanticVersion X are able to understand\n * the format changes introduced by the property, then the default value for that SemanticVersion will enable the feature associated with the property.\n * Otherwise, the feature will be disabled.\n *\n * For example if the compatibilityVersion is a 1.x version (i.e. \"1.5.0\"), then the default value for `enableGroupedBatching` will be false since 1.x\n * clients do not understand the document format when batching is enabled. If the compatibilityVersion is a 2.x client (i.e. \"2.0.0\" or later), then the\n * default value for `enableGroupedBatching` will be true because clients running 2.0 or later will be able to understand the format changes associated\n * with the batching feature.\n */\nconst runtimeOptionsAffectingDocSchemaConfigMap = {\n\tenableGroupedBatching: {\n\t\t\"1.0.0\": false,\n\t\t\"2.0.0-defaults\": true,\n\t} as const,\n\tcompressionOptions: {\n\t\t\"1.0.0\": disabledCompressionConfig,\n\t\t\"2.0.0-defaults\": enabledCompressionConfig,\n\t} as const,\n\tenableRuntimeIdCompressor: {\n\t\t// For IdCompressorMode, `undefined` represents a logical state (off).\n\t\t// However, to satisfy the Required<> constraint while\n\t\t// `exactOptionalPropertyTypes` is `false` (TODO: AB#8215), we need\n\t\t// to have it defined, so we trick the type checker here.\n\t\t\"1.0.0\": undefined,\n\t\t// We do not yet want to enable idCompressor by default since it will\n\t\t// increase bundle sizes, and not all customers will benefit from it.\n\t\t// Therefore, we will require customers to explicitly enable it. We\n\t\t// are keeping it as a DocSchema affecting option for now as this may\n\t\t// change in the future.\n\t} as const,\n\texplicitSchemaControl: {\n\t\t\"1.0.0\": false,\n\t\t// This option's intention is to prevent 1.x clients from joining sessions\n\t\t// when enabled. This is set to true when the compatibility version is set\n\t\t// to >=2.0.0 (explicitly). This is different than other 2.0 defaults\n\t\t// because it was not enabled by default prior to the implementation of\n\t\t// `compatibilityVersion`.\n\t\t// `defaultCompatibilityVersion` is set to \"2.0.0-defaults\" which \"2.0.0\"\n\t\t// does not satisfy to avoiding enabling this option by default as of\n\t\t// `compatibilityVersion` introduction, which could be unexpected.\n\t\t// Only enable as a default when `compatibilityVersion` is specified at\n\t\t// 2.0.0+.\n\t\t\"2.0.0\": true,\n\t} as const,\n\tflushMode: {\n\t\t// Note: 1.x clients are compatible with TurnBased flushing, but here we elect to remain on Immediate flush mode\n\t\t// as a work-around for inability to send batches larger than 1Mb. Immediate flushing keeps batches smaller as\n\t\t// fewer messages will be included per flush.\n\t\t\"1.0.0\": FlushMode.Immediate,\n\t\t\"2.0.0-defaults\": FlushMode.TurnBased,\n\t} as const,\n\tgcOptions: {\n\t\t\"1.0.0\": {},\n\t\t// Although sweep is supported in 2.x, it is disabled by default until compatibilityVersion>=3.0.0 to be extra safe.\n\t\t\"3.0.0\": { enableGCSweep: true },\n\t} as const,\n\tcreateBlobPayloadPending: {\n\t\t// This feature is new and disabled by default. In the future we will enable it by default, but we have not\n\t\t// closed on the version where that will happen yet. Probably a .10 release since blob functionality is not\n\t\t// exposed on the `@public` API surface.\n\t\t\"1.0.0\": undefined,\n\t} as const,\n} as const satisfies ConfigMap<RuntimeOptionsAffectingDocSchema>;\n\n/**\n * Returns the default RuntimeOptionsAffectingDocSchema configuration for a given compatibility version.\n */\nexport function getCompatibilityVersionDefaults(\n\tcompatibilityVersion: SemanticVersion,\n): RuntimeOptionsAffectingDocSchema {\n\treturn getConfigsForCompatMode(\n\t\tcompatibilityVersion,\n\t\truntimeOptionsAffectingDocSchemaConfigMap,\n\t\t// This is a bad cast away from Partial that getConfigsForCompatMode provides.\n\t\t// ConfigMap should be restructured to provide RuntimeOptionsAffectingDocSchema guarantee.\n\t) as RuntimeOptionsAffectingDocSchema;\n}\n\n/**\n * Returns a default configuration given compatibility version and configuration version map.\n */\nexport function getConfigsForCompatMode<T extends Record<SemanticVersion, unknown>>(\n\tcompatibilityVersion: 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\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 compatibilityVersion 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 compatibilityVersion.\n\t\tfor (const version of versions) {\n\t\t\tif (gte(compatibilityVersion, version)) {\n\t\t\t\tdefaultConfigs[key] = config[version as MinimumMinorSemanticVersion];\n\t\t\t} else {\n\t\t\t\t// If the compatibility mode 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 * Checks if the compatibility version is valid.\n * A valid compatibility version is a string that is a valid semver version and is less than or equal to the current package version.\n */\nexport function isValidCompatVersion(compatibilityVersion: SemanticVersion): boolean {\n\treturn (\n\t\tcompatibilityVersion !== undefined &&\n\t\tvalid(compatibilityVersion) !== null &&\n\t\tlte(compatibilityVersion, pkgVersion)\n\t);\n}\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/container-runtime";
8
- export declare const pkgVersion = "2.33.0";
8
+ export declare const pkgVersion = "2.33.2";
9
9
  //# sourceMappingURL=packageVersion.d.ts.map
@@ -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/container-runtime";
11
- exports.pkgVersion = "2.33.0";
11
+ exports.pkgVersion = "2.33.2";
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,mCAAmC,CAAC;AAC9C,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/container-runtime\";\nexport const pkgVersion = \"2.33.0\";\n"]}
1
+ {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,mCAAmC,CAAC;AAC9C,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/container-runtime\";\nexport const pkgVersion = \"2.33.2\";\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"compatUtils.d.ts","sourceRoot":"","sources":["../src/compatUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAeH,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,uBAAuB,CAAC;AAG7E;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,2BAA2B,kBAA4B,CAAC;AAErE;;;;;GAKG;AACH,MAAM,MAAM,2BAA2B,GAAG,GAAG,MAAM,IAAI,MAAM,IAAI,GAAG,GAAG,MAAM,eAAe,CAAC;AAE7F;;GAEG;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;;GAEG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI;KACzD,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG;QACjB,CAAC,OAAO,EAAE,2BAA2B,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;KAC7C;CACD,CAAC;AAEF;;;;;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;;;;;;;GAeG;AACH,MAAM,MAAM,gCAAgC,GAAG,IAAI,CAClD,+BAA+B,EAC7B,kBAAkB,GAClB,qBAAqB,GACrB,gCAAgC,GAChC,gBAAgB,CAClB,CAAC;AAsEF;;GAEG;AACH,wBAAgB,+BAA+B,CAC9C,oBAAoB,EAAE,eAAe,GACnC,gCAAgC,CAOlC;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,CAAC,SAAS,MAAM,CAAC,eAAe,EAAE,OAAO,CAAC,EACjF,oBAAoB,EAAE,eAAe,EACrC,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,GACrB,OAAO,CAAC,CAAC,CAAC,CAqBZ;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,oBAAoB,EAAE,eAAe,GAAG,OAAO,CAMnF"}
@@ -3,13 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { FlushMode } from "@fluidframework/runtime-definitions/internal";
6
- // The semver package documents and encourages these imports for users that only need some of the semver functionality.
7
- // eslint-disable-next-line import/no-internal-modules
8
- import semverGte from "semver/functions/gte.js";
9
- // eslint-disable-next-line import/no-internal-modules
10
- import semverLte from "semver/functions/lte.js";
11
- // eslint-disable-next-line import/no-internal-modules
12
- import semverValid from "semver/functions/valid.js";
6
+ import { compare, gte, lte, valid } from "semver-ts";
13
7
  import { disabledCompressionConfig, enabledCompressionConfig, } from "./compressionDefinitions.js";
14
8
  import { pkgVersion } from "./packageVersion.js";
15
9
  /**
@@ -113,12 +107,12 @@ export function getConfigsForCompatMode(compatibilityVersion, configMap) {
113
107
  for (const key of Object.keys(configMap)) {
114
108
  const config = configMap[key];
115
109
  // Sort the versions in ascending order so we can short circuit the loop.
116
- const versions = Object.keys(config).sort((a, b) => (semverGte(b, a) ? -1 : 1));
110
+ const versions = Object.keys(config).sort(compare);
117
111
  // For each config, we iterate over the keys and check if compatibilityVersion is greater than or equal to the version.
118
112
  // 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
119
113
  // value that is compatible with the version specified as the compatibilityVersion.
120
114
  for (const version of versions) {
121
- if (semverGte(compatibilityVersion, version)) {
115
+ if (gte(compatibilityVersion, version)) {
122
116
  defaultConfigs[key] = config[version];
123
117
  }
124
118
  else {
@@ -136,7 +130,7 @@ export function getConfigsForCompatMode(compatibilityVersion, configMap) {
136
130
  */
137
131
  export function isValidCompatVersion(compatibilityVersion) {
138
132
  return (compatibilityVersion !== undefined &&
139
- semverValid(compatibilityVersion) !== null &&
140
- semverLte(compatibilityVersion, pkgVersion));
133
+ valid(compatibilityVersion) !== null &&
134
+ lte(compatibilityVersion, pkgVersion));
141
135
  }
142
136
  //# sourceMappingURL=compatUtils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"compatUtils.js","sourceRoot":"","sources":["../src/compatUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,8CAA8C,CAAC;AACzE,uHAAuH;AACvH,sDAAsD;AACtD,OAAO,SAAS,MAAM,yBAAyB,CAAC;AAChD,sDAAsD;AACtD,OAAO,SAAS,MAAM,yBAAyB,CAAC;AAChD,sDAAsD;AACtD,OAAO,WAAW,MAAM,2BAA2B,CAAC;AAEpD,OAAO,EACN,yBAAyB,EACzB,wBAAwB,GACxB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,gBAAyB,CAAC;AAkDrE;;;;;;;;;;;;GAYG;AACH,MAAM,yCAAyC,GAAG;IACjD,qBAAqB,EAAE;QACtB,OAAO,EAAE,KAAK;QACd,gBAAgB,EAAE,IAAI;KACb;IACV,kBAAkB,EAAE;QACnB,OAAO,EAAE,yBAAyB;QAClC,gBAAgB,EAAE,wBAAwB;KACjC;IACV,yBAAyB,EAAE;QAC1B,sEAAsE;QACtE,sDAAsD;QACtD,mEAAmE;QACnE,y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C,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAChF,uHAAuH;QACvH,sHAAsH;QACtH,mFAAmF;QACnF,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;YAChC,IAAI,SAAS,CAAC,oBAAoB,EAAE,OAAO,CAAC,EAAE,CAAC;gBAC9C,cAAc,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,OAAsC,CAAC,CAAC;YACtE,CAAC;iBAAM,CAAC;gBACP,4GAA4G;gBAC5G,sBAAsB;gBACtB,MAAM;YACP,CAAC;QACF,CAAC;IACF,CAAC;IACD,OAAO,cAAc,CAAC;AACvB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAAC,oBAAqC;IACzE,OAAO,CACN,oBAAoB,KAAK,SAAS;QAClC,WAAW,CAAC,oBAAoB,CAAC,KAAK,IAAI;QAC1C,SAAS,CAAC,oBAAoB,EAAE,UAAU,CAAC,CAC3C,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { FlushMode } from \"@fluidframework/runtime-definitions/internal\";\n// The semver package documents and encourages these imports for users that only need some of the semver functionality.\n// eslint-disable-next-line import/no-internal-modules\nimport semverGte from \"semver/functions/gte.js\";\n// eslint-disable-next-line import/no-internal-modules\nimport semverLte from \"semver/functions/lte.js\";\n// eslint-disable-next-line import/no-internal-modules\nimport semverValid from \"semver/functions/valid.js\";\n\nimport {\n\tdisabledCompressionConfig,\n\tenabledCompressionConfig,\n} from \"./compressionDefinitions.js\";\nimport type { ContainerRuntimeOptionsInternal } from \"./containerRuntime.js\";\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 compatibility mode, 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 `compatibilityVersion` 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 */\nexport const defaultCompatibilityVersion = \"2.0.0-defaults\" as const;\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 */\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 */\nexport type SemanticVersion =\n\t| `${bigint}.${bigint}.${bigint}`\n\t| `${bigint}.${bigint}.${bigint}-${string}`;\n\n/**\n * Generic type for runtimeOptionsAffectingDocSchemaConfigMap\n */\nexport type ConfigMap<T extends Record<string, unknown>> = {\n\t[K in keyof T]-?: {\n\t\t[version: MinimumMinorSemanticVersion]: T[K];\n\t};\n};\n\n/**\n * Subset of the {@link ContainerRuntimeOptionsInternal} properties which\n * affect {@link IDocumentSchemaFeatures}.\n *\n * @remarks\n * When a new option is added to {@link ContainerRuntimeOptionsInternal}, we\n * must consider if it changes the DocumentSchema. If so, then a corresponding\n * entry must be added to {@link runtimeOptionsAffectingDocSchemaConfigMap}\n * below. If not, then it must be omitted from this type.\n *\n * Note: `Omit` is used instead of `Pick` to ensure that all new options are\n * included in this type by default. If any new properties are added to\n * {@link ContainerRuntimeOptionsInternal}, they will be included in this\n * type unless explicitly omitted. This will prevent us from forgetting to\n * account for any new properties in the future.\n */\nexport type RuntimeOptionsAffectingDocSchema = Omit<\n\tContainerRuntimeOptionsInternal,\n\t| \"chunkSizeInBytes\"\n\t| \"maxBatchSizeInBytes\"\n\t| \"loadSequenceNumberVerification\"\n\t| \"summaryOptions\"\n>;\n\n/**\n * Mapping of RuntimeOptionsAffectingDocSchema to their compatibility related configs.\n *\n * Each key in this map corresponds to a property in RuntimeOptionsAffectingDocSchema. The value is an object that maps SemanticVersions\n * to the appropriate default value for that property to supporting that SemanticVersion. If clients running SemanticVersion X are able to understand\n * the format changes introduced by the property, then the default value for that SemanticVersion will enable the feature associated with the property.\n * Otherwise, the feature will be disabled.\n *\n * For example if the compatibilityVersion is a 1.x version (i.e. \"1.5.0\"), then the default value for `enableGroupedBatching` will be false since 1.x\n * clients do not understand the document format when batching is enabled. If the compatibilityVersion is a 2.x client (i.e. \"2.0.0\" or later), then the\n * default value for `enableGroupedBatching` will be true because clients running 2.0 or later will be able to understand the format changes associated\n * with the batching feature.\n */\nconst runtimeOptionsAffectingDocSchemaConfigMap = {\n\tenableGroupedBatching: {\n\t\t\"1.0.0\": false,\n\t\t\"2.0.0-defaults\": true,\n\t} as const,\n\tcompressionOptions: {\n\t\t\"1.0.0\": disabledCompressionConfig,\n\t\t\"2.0.0-defaults\": enabledCompressionConfig,\n\t} as const,\n\tenableRuntimeIdCompressor: {\n\t\t// For IdCompressorMode, `undefined` represents a logical state (off).\n\t\t// However, to satisfy the Required<> constraint while\n\t\t// `exactOptionalPropertyTypes` is `false` (TODO: AB#8215), we need\n\t\t// to have it defined, so we trick the type checker here.\n\t\t\"1.0.0\": undefined,\n\t\t// We do not yet want to enable idCompressor by default since it will\n\t\t// increase bundle sizes, and not all customers will benefit from it.\n\t\t// Therefore, we will require customers to explicitly enable it. We\n\t\t// are keeping it as a DocSchema affecting option for now as this may\n\t\t// change in the future.\n\t} as const,\n\texplicitSchemaControl: {\n\t\t\"1.0.0\": false,\n\t\t// This option's intention is to prevent 1.x clients from joining sessions\n\t\t// when enabled. This is set to true when the compatibility version is set\n\t\t// to >=2.0.0 (explicitly). This is different than other 2.0 defaults\n\t\t// because it was not enabled by default prior to the implementation of\n\t\t// `compatibilityVersion`.\n\t\t// `defaultCompatibilityVersion` is set to \"2.0.0-defaults\" which \"2.0.0\"\n\t\t// does not satisfy to avoiding enabling this option by default as of\n\t\t// `compatibilityVersion` introduction, which could be unexpected.\n\t\t// Only enable as a default when `compatibilityVersion` is specified at\n\t\t// 2.0.0+.\n\t\t\"2.0.0\": true,\n\t} as const,\n\tflushMode: {\n\t\t// Note: 1.x clients are compatible with TurnBased flushing, but here we elect to remain on Immediate flush mode\n\t\t// as a work-around for inability to send batches larger than 1Mb. Immediate flushing keeps batches smaller as\n\t\t// fewer messages will be included per flush.\n\t\t\"1.0.0\": FlushMode.Immediate,\n\t\t\"2.0.0-defaults\": FlushMode.TurnBased,\n\t} as const,\n\tgcOptions: {\n\t\t\"1.0.0\": {},\n\t\t// Although sweep is supported in 2.x, it is disabled by default until compatibilityVersion>=3.0.0 to be extra safe.\n\t\t\"3.0.0\": { enableGCSweep: true },\n\t} as const,\n\tcreateBlobPayloadPending: {\n\t\t// This feature is new and disabled by default. In the future we will enable it by default, but we have not\n\t\t// closed on the version where that will happen yet. Probably a .10 release since blob functionality is not\n\t\t// exposed on the `@public` API surface.\n\t\t\"1.0.0\": undefined,\n\t} as const,\n} as const satisfies ConfigMap<RuntimeOptionsAffectingDocSchema>;\n\n/**\n * Returns the default RuntimeOptionsAffectingDocSchema configuration for a given compatibility version.\n */\nexport function getCompatibilityVersionDefaults(\n\tcompatibilityVersion: SemanticVersion,\n): RuntimeOptionsAffectingDocSchema {\n\treturn getConfigsForCompatMode(\n\t\tcompatibilityVersion,\n\t\truntimeOptionsAffectingDocSchemaConfigMap,\n\t\t// This is a bad cast away from Partial that getConfigsForCompatMode provides.\n\t\t// ConfigMap should be restructured to provide RuntimeOptionsAffectingDocSchema guarantee.\n\t) as RuntimeOptionsAffectingDocSchema;\n}\n\n/**\n * Returns a default configuration given compatibility version and configuration version map.\n */\nexport function getConfigsForCompatMode<T extends Record<SemanticVersion, unknown>>(\n\tcompatibilityVersion: 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\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((a, b) => (semverGte(b, a) ? -1 : 1));\n\t\t// For each config, we iterate over the keys and check if compatibilityVersion 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 compatibilityVersion.\n\t\tfor (const version of versions) {\n\t\t\tif (semverGte(compatibilityVersion, version)) {\n\t\t\t\tdefaultConfigs[key] = config[version as MinimumMinorSemanticVersion];\n\t\t\t} else {\n\t\t\t\t// If the compatibility mode 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 * Checks if the compatibility version is valid.\n * A valid compatibility version is a string that is a valid semver version and is less than or equal to the current package version.\n */\nexport function isValidCompatVersion(compatibilityVersion: SemanticVersion): boolean {\n\treturn (\n\t\tcompatibilityVersion !== undefined &&\n\t\tsemverValid(compatibilityVersion) !== null &&\n\t\tsemverLte(compatibilityVersion, pkgVersion)\n\t);\n}\n"]}
1
+ {"version":3,"file":"compatUtils.js","sourceRoot":"","sources":["../src/compatUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,8CAA8C,CAAC;AACzE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAErD,OAAO,EACN,yBAAyB,EACzB,wBAAwB,GACxB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD;;;;;;;;;;;;;;;;;GAiBG;AACH,MAA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AAC;IACtC,gEAAgE;IAChE,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;QAC1C,MAAM,MAAM,GAAG,SAAS,CAAC,GAAc,CAAC,CAAC;QACzC,yEAAyE;QACzE,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACnD,uHAAuH;QACvH,sHAAsH;QACtH,mFAAmF;QACnF,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;YAChC,IAAI,GAAG,CAAC,oBAAoB,EAAE,OAAO,CAAC,EAAE,CAAC;gBACxC,cAAc,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,OAAsC,CAAC,CAAC;YACtE,CAAC;iBAAM,CAAC;gBACP,4GAA4G;gBAC5G,sBAAsB;gBACtB,MAAM;YACP,CAAC;QACF,CAAC;IACF,CAAC;IACD,OAAO,cAAc,CAAC;AACvB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAAC,oBAAqC;IACzE,OAAO,CACN,oBAAoB,KAAK,SAAS;QAClC,KAAK,CAAC,oBAAoB,CAAC,KAAK,IAAI;QACpC,GAAG,CAAC,oBAAoB,EAAE,UAAU,CAAC,CACrC,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { FlushMode } from \"@fluidframework/runtime-definitions/internal\";\nimport { compare, gte, lte, valid } from \"semver-ts\";\n\nimport {\n\tdisabledCompressionConfig,\n\tenabledCompressionConfig,\n} from \"./compressionDefinitions.js\";\nimport type { ContainerRuntimeOptionsInternal } from \"./containerRuntime.js\";\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 compatibility mode, 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 `compatibilityVersion` 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 */\nexport const defaultCompatibilityVersion = \"2.0.0-defaults\" as const;\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 */\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 */\nexport type SemanticVersion =\n\t| `${bigint}.${bigint}.${bigint}`\n\t| `${bigint}.${bigint}.${bigint}-${string}`;\n\n/**\n * Generic type for runtimeOptionsAffectingDocSchemaConfigMap\n */\nexport type ConfigMap<T extends Record<string, unknown>> = {\n\t[K in keyof T]-?: {\n\t\t[version: MinimumMinorSemanticVersion]: T[K];\n\t};\n};\n\n/**\n * Subset of the {@link ContainerRuntimeOptionsInternal} properties which\n * affect {@link IDocumentSchemaFeatures}.\n *\n * @remarks\n * When a new option is added to {@link ContainerRuntimeOptionsInternal}, we\n * must consider if it changes the DocumentSchema. If so, then a corresponding\n * entry must be added to {@link runtimeOptionsAffectingDocSchemaConfigMap}\n * below. If not, then it must be omitted from this type.\n *\n * Note: `Omit` is used instead of `Pick` to ensure that all new options are\n * included in this type by default. If any new properties are added to\n * {@link ContainerRuntimeOptionsInternal}, they will be included in this\n * type unless explicitly omitted. This will prevent us from forgetting to\n * account for any new properties in the future.\n */\nexport type RuntimeOptionsAffectingDocSchema = Omit<\n\tContainerRuntimeOptionsInternal,\n\t| \"chunkSizeInBytes\"\n\t| \"maxBatchSizeInBytes\"\n\t| \"loadSequenceNumberVerification\"\n\t| \"summaryOptions\"\n>;\n\n/**\n * Mapping of RuntimeOptionsAffectingDocSchema to their compatibility related configs.\n *\n * Each key in this map corresponds to a property in RuntimeOptionsAffectingDocSchema. The value is an object that maps SemanticVersions\n * to the appropriate default value for that property to supporting that SemanticVersion. If clients running SemanticVersion X are able to understand\n * the format changes introduced by the property, then the default value for that SemanticVersion will enable the feature associated with the property.\n * Otherwise, the feature will be disabled.\n *\n * For example if the compatibilityVersion is a 1.x version (i.e. \"1.5.0\"), then the default value for `enableGroupedBatching` will be false since 1.x\n * clients do not understand the document format when batching is enabled. If the compatibilityVersion is a 2.x client (i.e. \"2.0.0\" or later), then the\n * default value for `enableGroupedBatching` will be true because clients running 2.0 or later will be able to understand the format changes associated\n * with the batching feature.\n */\nconst runtimeOptionsAffectingDocSchemaConfigMap = {\n\tenableGroupedBatching: {\n\t\t\"1.0.0\": false,\n\t\t\"2.0.0-defaults\": true,\n\t} as const,\n\tcompressionOptions: {\n\t\t\"1.0.0\": disabledCompressionConfig,\n\t\t\"2.0.0-defaults\": enabledCompressionConfig,\n\t} as const,\n\tenableRuntimeIdCompressor: {\n\t\t// For IdCompressorMode, `undefined` represents a logical state (off).\n\t\t// However, to satisfy the Required<> constraint while\n\t\t// `exactOptionalPropertyTypes` is `false` (TODO: AB#8215), we need\n\t\t// to have it defined, so we trick the type checker here.\n\t\t\"1.0.0\": undefined,\n\t\t// We do not yet want to enable idCompressor by default since it will\n\t\t// increase bundle sizes, and not all customers will benefit from it.\n\t\t// Therefore, we will require customers to explicitly enable it. We\n\t\t// are keeping it as a DocSchema affecting option for now as this may\n\t\t// change in the future.\n\t} as const,\n\texplicitSchemaControl: {\n\t\t\"1.0.0\": false,\n\t\t// This option's intention is to prevent 1.x clients from joining sessions\n\t\t// when enabled. This is set to true when the compatibility version is set\n\t\t// to >=2.0.0 (explicitly). This is different than other 2.0 defaults\n\t\t// because it was not enabled by default prior to the implementation of\n\t\t// `compatibilityVersion`.\n\t\t// `defaultCompatibilityVersion` is set to \"2.0.0-defaults\" which \"2.0.0\"\n\t\t// does not satisfy to avoiding enabling this option by default as of\n\t\t// `compatibilityVersion` introduction, which could be unexpected.\n\t\t// Only enable as a default when `compatibilityVersion` is specified at\n\t\t// 2.0.0+.\n\t\t\"2.0.0\": true,\n\t} as const,\n\tflushMode: {\n\t\t// Note: 1.x clients are compatible with TurnBased flushing, but here we elect to remain on Immediate flush mode\n\t\t// as a work-around for inability to send batches larger than 1Mb. Immediate flushing keeps batches smaller as\n\t\t// fewer messages will be included per flush.\n\t\t\"1.0.0\": FlushMode.Immediate,\n\t\t\"2.0.0-defaults\": FlushMode.TurnBased,\n\t} as const,\n\tgcOptions: {\n\t\t\"1.0.0\": {},\n\t\t// Although sweep is supported in 2.x, it is disabled by default until compatibilityVersion>=3.0.0 to be extra safe.\n\t\t\"3.0.0\": { enableGCSweep: true },\n\t} as const,\n\tcreateBlobPayloadPending: {\n\t\t// This feature is new and disabled by default. In the future we will enable it by default, but we have not\n\t\t// closed on the version where that will happen yet. Probably a .10 release since blob functionality is not\n\t\t// exposed on the `@public` API surface.\n\t\t\"1.0.0\": undefined,\n\t} as const,\n} as const satisfies ConfigMap<RuntimeOptionsAffectingDocSchema>;\n\n/**\n * Returns the default RuntimeOptionsAffectingDocSchema configuration for a given compatibility version.\n */\nexport function getCompatibilityVersionDefaults(\n\tcompatibilityVersion: SemanticVersion,\n): RuntimeOptionsAffectingDocSchema {\n\treturn getConfigsForCompatMode(\n\t\tcompatibilityVersion,\n\t\truntimeOptionsAffectingDocSchemaConfigMap,\n\t\t// This is a bad cast away from Partial that getConfigsForCompatMode provides.\n\t\t// ConfigMap should be restructured to provide RuntimeOptionsAffectingDocSchema guarantee.\n\t) as RuntimeOptionsAffectingDocSchema;\n}\n\n/**\n * Returns a default configuration given compatibility version and configuration version map.\n */\nexport function getConfigsForCompatMode<T extends Record<SemanticVersion, unknown>>(\n\tcompatibilityVersion: 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\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 compatibilityVersion 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 compatibilityVersion.\n\t\tfor (const version of versions) {\n\t\t\tif (gte(compatibilityVersion, version)) {\n\t\t\t\tdefaultConfigs[key] = config[version as MinimumMinorSemanticVersion];\n\t\t\t} else {\n\t\t\t\t// If the compatibility mode 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 * Checks if the compatibility version is valid.\n * A valid compatibility version is a string that is a valid semver version and is less than or equal to the current package version.\n */\nexport function isValidCompatVersion(compatibilityVersion: SemanticVersion): boolean {\n\treturn (\n\t\tcompatibilityVersion !== undefined &&\n\t\tvalid(compatibilityVersion) !== null &&\n\t\tlte(compatibilityVersion, pkgVersion)\n\t);\n}\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/container-runtime";
8
- export declare const pkgVersion = "2.33.0";
8
+ export declare const pkgVersion = "2.33.2";
9
9
  //# sourceMappingURL=packageVersion.d.ts.map
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export const pkgName = "@fluidframework/container-runtime";
8
- export const pkgVersion = "2.33.0";
8
+ export const pkgVersion = "2.33.2";
9
9
  //# sourceMappingURL=packageVersion.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,mCAAmC,CAAC;AAC3D,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/container-runtime\";\nexport const pkgVersion = \"2.33.0\";\n"]}
1
+ {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,mCAAmC,CAAC;AAC3D,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/container-runtime\";\nexport const pkgVersion = \"2.33.2\";\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/container-runtime",
3
- "version": "2.33.0",
3
+ "version": "2.33.2",
4
4
  "description": "Fluid container runtime",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -119,43 +119,42 @@
119
119
  "temp-directory": "nyc/.nyc_output"
120
120
  },
121
121
  "dependencies": {
122
- "@fluid-internal/client-utils": "~2.33.0",
123
- "@fluidframework/container-definitions": "~2.33.0",
124
- "@fluidframework/container-runtime-definitions": "~2.33.0",
125
- "@fluidframework/core-interfaces": "~2.33.0",
126
- "@fluidframework/core-utils": "~2.33.0",
127
- "@fluidframework/datastore": "~2.33.0",
128
- "@fluidframework/driver-definitions": "~2.33.0",
129
- "@fluidframework/driver-utils": "~2.33.0",
130
- "@fluidframework/id-compressor": "~2.33.0",
131
- "@fluidframework/runtime-definitions": "~2.33.0",
132
- "@fluidframework/runtime-utils": "~2.33.0",
133
- "@fluidframework/telemetry-utils": "~2.33.0",
122
+ "@fluid-internal/client-utils": "~2.33.2",
123
+ "@fluidframework/container-definitions": "~2.33.2",
124
+ "@fluidframework/container-runtime-definitions": "~2.33.2",
125
+ "@fluidframework/core-interfaces": "~2.33.2",
126
+ "@fluidframework/core-utils": "~2.33.2",
127
+ "@fluidframework/datastore": "~2.33.2",
128
+ "@fluidframework/driver-definitions": "~2.33.2",
129
+ "@fluidframework/driver-utils": "~2.33.2",
130
+ "@fluidframework/id-compressor": "~2.33.2",
131
+ "@fluidframework/runtime-definitions": "~2.33.2",
132
+ "@fluidframework/runtime-utils": "~2.33.2",
133
+ "@fluidframework/telemetry-utils": "~2.33.2",
134
134
  "@tylerbu/sorted-btree-es6": "^1.8.0",
135
135
  "double-ended-queue": "^2.1.0-0",
136
136
  "lz4js": "^0.2.0",
137
- "semver": "^7.7.1",
137
+ "semver-ts": "^1.0.3",
138
138
  "uuid": "^9.0.0"
139
139
  },
140
140
  "devDependencies": {
141
141
  "@arethetypeswrong/cli": "^0.17.1",
142
142
  "@biomejs/biome": "~1.9.3",
143
- "@fluid-internal/mocha-test-setup": "~2.33.0",
144
- "@fluid-private/stochastic-test-utils": "~2.33.0",
145
- "@fluid-private/test-pairwise-generator": "~2.33.0",
143
+ "@fluid-internal/mocha-test-setup": "~2.33.2",
144
+ "@fluid-private/stochastic-test-utils": "~2.33.2",
145
+ "@fluid-private/test-pairwise-generator": "~2.33.2",
146
146
  "@fluid-tools/benchmark": "^0.50.0",
147
147
  "@fluid-tools/build-cli": "^0.55.0",
148
148
  "@fluidframework/build-common": "^2.0.3",
149
149
  "@fluidframework/build-tools": "^0.55.0",
150
- "@fluidframework/container-runtime-previous": "npm:@fluidframework/container-runtime@2.32.0",
150
+ "@fluidframework/container-runtime-previous": "npm:@fluidframework/container-runtime@2.33.0",
151
151
  "@fluidframework/eslint-config-fluid": "^5.7.3",
152
- "@fluidframework/test-runtime-utils": "~2.33.0",
152
+ "@fluidframework/test-runtime-utils": "~2.33.2",
153
153
  "@microsoft/api-extractor": "7.52.5",
154
154
  "@types/double-ended-queue": "^2.1.0",
155
155
  "@types/lz4js": "^0.2.0",
156
156
  "@types/mocha": "^10.0.10",
157
157
  "@types/node": "^18.19.0",
158
- "@types/semver": "^7.7.0",
159
158
  "@types/sinon": "^17.0.3",
160
159
  "@types/uuid": "^9.0.2",
161
160
  "c8": "^8.0.1",
@@ -4,13 +4,7 @@
4
4
  */
5
5
 
6
6
  import { FlushMode } from "@fluidframework/runtime-definitions/internal";
7
- // The semver package documents and encourages these imports for users that only need some of the semver functionality.
8
- // eslint-disable-next-line import/no-internal-modules
9
- import semverGte from "semver/functions/gte.js";
10
- // eslint-disable-next-line import/no-internal-modules
11
- import semverLte from "semver/functions/lte.js";
12
- // eslint-disable-next-line import/no-internal-modules
13
- import semverValid from "semver/functions/valid.js";
7
+ import { compare, gte, lte, valid } from "semver-ts";
14
8
 
15
9
  import {
16
10
  disabledCompressionConfig,
@@ -181,12 +175,12 @@ export function getConfigsForCompatMode<T extends Record<SemanticVersion, unknow
181
175
  for (const key of Object.keys(configMap)) {
182
176
  const config = configMap[key as keyof T];
183
177
  // Sort the versions in ascending order so we can short circuit the loop.
184
- const versions = Object.keys(config).sort((a, b) => (semverGte(b, a) ? -1 : 1));
178
+ const versions = Object.keys(config).sort(compare);
185
179
  // For each config, we iterate over the keys and check if compatibilityVersion is greater than or equal to the version.
186
180
  // 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
187
181
  // value that is compatible with the version specified as the compatibilityVersion.
188
182
  for (const version of versions) {
189
- if (semverGte(compatibilityVersion, version)) {
183
+ if (gte(compatibilityVersion, version)) {
190
184
  defaultConfigs[key] = config[version as MinimumMinorSemanticVersion];
191
185
  } else {
192
186
  // If the compatibility mode is less than the version, we break out of the loop since we don't need to check
@@ -205,7 +199,7 @@ export function getConfigsForCompatMode<T extends Record<SemanticVersion, unknow
205
199
  export function isValidCompatVersion(compatibilityVersion: SemanticVersion): boolean {
206
200
  return (
207
201
  compatibilityVersion !== undefined &&
208
- semverValid(compatibilityVersion) !== null &&
209
- semverLte(compatibilityVersion, pkgVersion)
202
+ valid(compatibilityVersion) !== null &&
203
+ lte(compatibilityVersion, pkgVersion)
210
204
  );
211
205
  }
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/container-runtime";
9
- export const pkgVersion = "2.33.0";
9
+ export const pkgVersion = "2.33.2";