@fluid-internal/client-utils 2.42.0 → 2.43.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/dist/layerCompat.d.ts +7 -0
- package/dist/layerCompat.d.ts.map +1 -1
- package/dist/layerCompat.js.map +1 -1
- package/lib/layerCompat.d.ts +7 -0
- package/lib/layerCompat.d.ts.map +1 -1
- package/lib/layerCompat.js.map +1 -1
- package/package.json +8 -8
- package/src/layerCompat.ts +7 -0
package/CHANGELOG.md
CHANGED
package/dist/layerCompat.d.ts
CHANGED
|
@@ -43,6 +43,13 @@ export interface ILayerCompatDetails extends Partial<IProvideLayerCompatDetails>
|
|
|
43
43
|
/**
|
|
44
44
|
* The generation of the layer. The other layer at the layer boundary uses this to check if this satisfies
|
|
45
45
|
* the minimum generation it requires to be compatible.
|
|
46
|
+
*
|
|
47
|
+
* @remarks Generation is updated on a regular cadence, say, monthly. This will allow us to determine how
|
|
48
|
+
* far apart two layers are in terms of time and whether they are compatible.
|
|
49
|
+
* For example, say generation is updated every month and the compatibility window between layer1 and layer2 is
|
|
50
|
+
* 6 months. Now, if layer1 is at generation 1 and layer2 is at generation 5, then they are 4 months apart and are
|
|
51
|
+
* compatible. But if layer1 is at generation 1 and layer2 is at generation 8, then they are 7 months apart and
|
|
52
|
+
* are not compatible.
|
|
46
53
|
*/
|
|
47
54
|
readonly generation: number;
|
|
48
55
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layerCompat.d.ts","sourceRoot":"","sources":["../src/layerCompat.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAC/B;IAAE,QAAQ,CAAC,YAAY,EAAE,IAAI,CAAA;CAAE,GAC/B;IACA,QAAQ,CAAC,YAAY,EAAE,KAAK,CAAC;IAC7B;;OAEG;IACH,QAAQ,CAAC,sBAAsB,EAAE,OAAO,CAAC;IACzC;;;OAGG;IACH,QAAQ,CAAC,mBAAmB,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC;CAC3D,CAAC;AAEL;;GAEG;AACH,eAAO,MAAM,mBAAmB,EAAE,MAAM,0BAAkD,CAAC;AAE3F;;GAEG;AACH,MAAM,WAAW,0BAA0B;IAC1C,QAAQ,CAAC,mBAAmB,EAAE,mBAAmB,CAAC;CAClD;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAoB,SAAQ,OAAO,CAAC,0BAA0B,CAAC;IAC/E;;;OAGG;IACH,QAAQ,CAAC,iBAAiB,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAChD
|
|
1
|
+
{"version":3,"file":"layerCompat.d.ts","sourceRoot":"","sources":["../src/layerCompat.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAC/B;IAAE,QAAQ,CAAC,YAAY,EAAE,IAAI,CAAA;CAAE,GAC/B;IACA,QAAQ,CAAC,YAAY,EAAE,KAAK,CAAC;IAC7B;;OAEG;IACH,QAAQ,CAAC,sBAAsB,EAAE,OAAO,CAAC;IACzC;;;OAGG;IACH,QAAQ,CAAC,mBAAmB,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC;CAC3D,CAAC;AAEL;;GAEG;AACH,eAAO,MAAM,mBAAmB,EAAE,MAAM,0BAAkD,CAAC;AAE3F;;GAEG;AACH,MAAM,WAAW,0BAA0B;IAC1C,QAAQ,CAAC,mBAAmB,EAAE,mBAAmB,CAAC;CAClD;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAoB,SAAQ,OAAO,CAAC,0BAA0B,CAAC;IAC/E;;;OAGG;IACH,QAAQ,CAAC,iBAAiB,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAChD;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B;;;OAGG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC5B;AAED;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,EAAE,mBAIvC,CAAC;AAEF;;;GAGG;AACH,MAAM,WAAW,+BAA+B;IAC/C;;OAEG;IACH,QAAQ,CAAC,sBAAsB,EAAE,MAAM,CAAC;IACxC;;OAEG;IACH,QAAQ,CAAC,gBAAgB,EAAE,SAAS,MAAM,EAAE,CAAC;CAC7C;AAED;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CACtC,+BAA+B,EAAE,+BAA+B,EAChE,mBAAmB,EAAE,mBAAmB,GAAG,SAAS,GAClD,sBAAsB,CA4BxB"}
|
package/dist/layerCompat.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layerCompat.js","sourceRoot":"","sources":["../src/layerCompat.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAqBH;;GAEG;AACU,QAAA,mBAAmB,GAAqC,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"layerCompat.js","sourceRoot":"","sources":["../src/layerCompat.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAqBH;;GAEG;AACU,QAAA,mBAAmB,GAAqC,qBAAqB,CAAC;AAsC3F;;;;GAIG;AACU,QAAA,yBAAyB,GAAwB;IAC7D,iBAAiB,EAAE,IAAI,GAAG,EAAE;IAC5B,UAAU,EAAE,CAAC,EAAE,4EAA4E;IAC3F,UAAU,EAAE,SAAS;CACrB,CAAC;AAiBF;;;;;;;;GAQG;AACH,SAAgB,uBAAuB,CACtC,+BAAgE,EAChE,mBAAoD;IAEpD,MAAM,wBAAwB,GAAG,mBAAmB,IAAI,iCAAyB,CAAC;IAClF,IAAI,sBAAsB,GAAG,IAAI,CAAC;IAClC,MAAM,mBAAmB,GAAa,EAAE,CAAC;IAEzC,2FAA2F;IAC3F,6BAA6B;IAC7B,IACC,wBAAwB,CAAC,UAAU;QACnC,+BAA+B,CAAC,sBAAsB,EACrD,CAAC;QACF,sBAAsB,GAAG,KAAK,CAAC;IAChC,CAAC;IAED,gFAAgF;IAChF,KAAK,MAAM,OAAO,IAAI,+BAA+B,CAAC,gBAAgB,EAAE,CAAC;QACxE,IAAI,CAAC,wBAAwB,CAAC,iBAAiB,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC;YAC9D,mBAAmB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACnC,CAAC;IACF,CAAC;IAED,OAAO,sBAAsB,IAAI,mBAAmB,CAAC,MAAM,KAAK,CAAC;QAChE,CAAC,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE;QACxB,CAAC,CAAC;YACA,YAAY,EAAE,KAAK;YACnB,sBAAsB;YACtB,mBAAmB,EAAE,mBAAmB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,SAAS;SACrF,CAAC;AACL,CAAC;AA/BD,0DA+BC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Result of a layer compatibility check - whether a layer is compatible with another layer.\n * @internal\n */\nexport type LayerCompatCheckResult =\n\t| { readonly isCompatible: true }\n\t| {\n\t\t\treadonly isCompatible: false;\n\t\t\t/**\n\t\t\t * Whether the generation of the layer is compatible with the other layer.\n\t\t\t */\n\t\t\treadonly isGenerationCompatible: boolean;\n\t\t\t/**\n\t\t\t * The features that are required by the layer but are not supported by the other layer. This will only\n\t\t\t * be set if there are unsupported features.\n\t\t\t */\n\t\t\treadonly unsupportedFeatures: readonly string[] | undefined;\n\t };\n\n/**\n * @internal\n */\nexport const ILayerCompatDetails: keyof IProvideLayerCompatDetails = \"ILayerCompatDetails\";\n\n/**\n * @internal\n */\nexport interface IProvideLayerCompatDetails {\n\treadonly ILayerCompatDetails: ILayerCompatDetails;\n}\n\n/**\n * This interface is used to communicate the compatibility details of a layer to another layer.\n * @internal\n */\nexport interface ILayerCompatDetails extends Partial<IProvideLayerCompatDetails> {\n\t/**\n\t * A list of features supported by the layer at a particular layer boundary. This is used to check if these\n\t * set of features satisfy the requirements of another layer.\n\t */\n\treadonly supportedFeatures: ReadonlySet<string>;\n\t/**\n\t * The generation of the layer. The other layer at the layer boundary uses this to check if this satisfies\n\t * the minimum generation it requires to be compatible.\n\t *\n\t * @remarks Generation is updated on a regular cadence, say, monthly. This will allow us to determine how\n\t * far apart two layers are in terms of time and whether they are compatible.\n\t * For example, say generation is updated every month and the compatibility window between layer1 and layer2 is\n\t * 6 months. Now, if layer1 is at generation 1 and layer2 is at generation 5, then they are 4 months apart and are\n\t * compatible. But if layer1 is at generation 1 and layer2 is at generation 8, then they are 7 months apart and\n\t * are not compatible.\n\t */\n\treadonly generation: number;\n\t/**\n\t * The package version of the layer. When an incompatibility is detected, this is used to provide more context\n\t * on what the versions of the incompatible layers are.\n\t */\n\treadonly pkgVersion: string;\n}\n\n/**\n * This is the default compat details for a layer when it doesn't provide any compat details. This is used for\n * backwards compatibility to allow older layers to work before compatibility enforcement was introduced.\n * @internal\n */\nexport const defaultLayerCompatDetails: ILayerCompatDetails = {\n\tsupportedFeatures: new Set(),\n\tgeneration: 0, // 0 is reserved for layers before compatibility enforcement was introduced.\n\tpkgVersion: \"unknown\",\n};\n\n/**\n * The requirements that a layer needs another layer to support for them to be compatible.\n * @internal\n */\nexport interface ILayerCompatSupportRequirements {\n\t/**\n\t * The minimum supported generation the other layer needs to be at.\n\t */\n\treadonly minSupportedGeneration: number;\n\t/**\n\t * The features that the other layer needs to support.\n\t */\n\treadonly requiredFeatures: readonly string[];\n}\n\n/**\n * Checks compatibility of a layer (layer1) with another layer (layer2).\n * @param compatSupportRequirementsLayer1 - The requirements from layer1 that layer2 needs to meet.\n * @param compatDetailsLayer2 - The compatibility details of the layer2. If this is undefined, then the\n * default compatibility details are used for backwards compatibility.\n * @returns The result of the compatibility check indicating whether layer2 is compatible with layer1.\n *\n * @internal\n */\nexport function checkLayerCompatibility(\n\tcompatSupportRequirementsLayer1: ILayerCompatSupportRequirements,\n\tcompatDetailsLayer2: ILayerCompatDetails | undefined,\n): LayerCompatCheckResult {\n\tconst compatDetailsLayer2ToUse = compatDetailsLayer2 ?? defaultLayerCompatDetails;\n\tlet isGenerationCompatible = true;\n\tconst unsupportedFeatures: string[] = [];\n\n\t// If layer2's generation is less than the required minimum supported generation of layer1,\n\t// then it is not compatible.\n\tif (\n\t\tcompatDetailsLayer2ToUse.generation <\n\t\tcompatSupportRequirementsLayer1.minSupportedGeneration\n\t) {\n\t\tisGenerationCompatible = false;\n\t}\n\n\t// All features required by layer1 must be supported by layer2 to be compatible.\n\tfor (const feature of compatSupportRequirementsLayer1.requiredFeatures) {\n\t\tif (!compatDetailsLayer2ToUse.supportedFeatures.has(feature)) {\n\t\t\tunsupportedFeatures.push(feature);\n\t\t}\n\t}\n\n\treturn isGenerationCompatible && unsupportedFeatures.length === 0\n\t\t? { isCompatible: true }\n\t\t: {\n\t\t\t\tisCompatible: false,\n\t\t\t\tisGenerationCompatible,\n\t\t\t\tunsupportedFeatures: unsupportedFeatures.length > 0 ? unsupportedFeatures : undefined,\n\t\t\t};\n}\n"]}
|
package/lib/layerCompat.d.ts
CHANGED
|
@@ -43,6 +43,13 @@ export interface ILayerCompatDetails extends Partial<IProvideLayerCompatDetails>
|
|
|
43
43
|
/**
|
|
44
44
|
* The generation of the layer. The other layer at the layer boundary uses this to check if this satisfies
|
|
45
45
|
* the minimum generation it requires to be compatible.
|
|
46
|
+
*
|
|
47
|
+
* @remarks Generation is updated on a regular cadence, say, monthly. This will allow us to determine how
|
|
48
|
+
* far apart two layers are in terms of time and whether they are compatible.
|
|
49
|
+
* For example, say generation is updated every month and the compatibility window between layer1 and layer2 is
|
|
50
|
+
* 6 months. Now, if layer1 is at generation 1 and layer2 is at generation 5, then they are 4 months apart and are
|
|
51
|
+
* compatible. But if layer1 is at generation 1 and layer2 is at generation 8, then they are 7 months apart and
|
|
52
|
+
* are not compatible.
|
|
46
53
|
*/
|
|
47
54
|
readonly generation: number;
|
|
48
55
|
/**
|
package/lib/layerCompat.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layerCompat.d.ts","sourceRoot":"","sources":["../src/layerCompat.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAC/B;IAAE,QAAQ,CAAC,YAAY,EAAE,IAAI,CAAA;CAAE,GAC/B;IACA,QAAQ,CAAC,YAAY,EAAE,KAAK,CAAC;IAC7B;;OAEG;IACH,QAAQ,CAAC,sBAAsB,EAAE,OAAO,CAAC;IACzC;;;OAGG;IACH,QAAQ,CAAC,mBAAmB,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC;CAC3D,CAAC;AAEL;;GAEG;AACH,eAAO,MAAM,mBAAmB,EAAE,MAAM,0BAAkD,CAAC;AAE3F;;GAEG;AACH,MAAM,WAAW,0BAA0B;IAC1C,QAAQ,CAAC,mBAAmB,EAAE,mBAAmB,CAAC;CAClD;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAoB,SAAQ,OAAO,CAAC,0BAA0B,CAAC;IAC/E;;;OAGG;IACH,QAAQ,CAAC,iBAAiB,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAChD
|
|
1
|
+
{"version":3,"file":"layerCompat.d.ts","sourceRoot":"","sources":["../src/layerCompat.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAC/B;IAAE,QAAQ,CAAC,YAAY,EAAE,IAAI,CAAA;CAAE,GAC/B;IACA,QAAQ,CAAC,YAAY,EAAE,KAAK,CAAC;IAC7B;;OAEG;IACH,QAAQ,CAAC,sBAAsB,EAAE,OAAO,CAAC;IACzC;;;OAGG;IACH,QAAQ,CAAC,mBAAmB,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC;CAC3D,CAAC;AAEL;;GAEG;AACH,eAAO,MAAM,mBAAmB,EAAE,MAAM,0BAAkD,CAAC;AAE3F;;GAEG;AACH,MAAM,WAAW,0BAA0B;IAC1C,QAAQ,CAAC,mBAAmB,EAAE,mBAAmB,CAAC;CAClD;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAoB,SAAQ,OAAO,CAAC,0BAA0B,CAAC;IAC/E;;;OAGG;IACH,QAAQ,CAAC,iBAAiB,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAChD;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B;;;OAGG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC5B;AAED;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,EAAE,mBAIvC,CAAC;AAEF;;;GAGG;AACH,MAAM,WAAW,+BAA+B;IAC/C;;OAEG;IACH,QAAQ,CAAC,sBAAsB,EAAE,MAAM,CAAC;IACxC;;OAEG;IACH,QAAQ,CAAC,gBAAgB,EAAE,SAAS,MAAM,EAAE,CAAC;CAC7C;AAED;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CACtC,+BAA+B,EAAE,+BAA+B,EAChE,mBAAmB,EAAE,mBAAmB,GAAG,SAAS,GAClD,sBAAsB,CA4BxB"}
|
package/lib/layerCompat.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layerCompat.js","sourceRoot":"","sources":["../src/layerCompat.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAqBH;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAqC,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"layerCompat.js","sourceRoot":"","sources":["../src/layerCompat.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAqBH;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAqC,qBAAqB,CAAC;AAsC3F;;;;GAIG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAwB;IAC7D,iBAAiB,EAAE,IAAI,GAAG,EAAE;IAC5B,UAAU,EAAE,CAAC,EAAE,4EAA4E;IAC3F,UAAU,EAAE,SAAS;CACrB,CAAC;AAiBF;;;;;;;;GAQG;AACH,MAAM,UAAU,uBAAuB,CACtC,+BAAgE,EAChE,mBAAoD;IAEpD,MAAM,wBAAwB,GAAG,mBAAmB,IAAI,yBAAyB,CAAC;IAClF,IAAI,sBAAsB,GAAG,IAAI,CAAC;IAClC,MAAM,mBAAmB,GAAa,EAAE,CAAC;IAEzC,2FAA2F;IAC3F,6BAA6B;IAC7B,IACC,wBAAwB,CAAC,UAAU;QACnC,+BAA+B,CAAC,sBAAsB,EACrD,CAAC;QACF,sBAAsB,GAAG,KAAK,CAAC;IAChC,CAAC;IAED,gFAAgF;IAChF,KAAK,MAAM,OAAO,IAAI,+BAA+B,CAAC,gBAAgB,EAAE,CAAC;QACxE,IAAI,CAAC,wBAAwB,CAAC,iBAAiB,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC;YAC9D,mBAAmB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACnC,CAAC;IACF,CAAC;IAED,OAAO,sBAAsB,IAAI,mBAAmB,CAAC,MAAM,KAAK,CAAC;QAChE,CAAC,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE;QACxB,CAAC,CAAC;YACA,YAAY,EAAE,KAAK;YACnB,sBAAsB;YACtB,mBAAmB,EAAE,mBAAmB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,SAAS;SACrF,CAAC;AACL,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Result of a layer compatibility check - whether a layer is compatible with another layer.\n * @internal\n */\nexport type LayerCompatCheckResult =\n\t| { readonly isCompatible: true }\n\t| {\n\t\t\treadonly isCompatible: false;\n\t\t\t/**\n\t\t\t * Whether the generation of the layer is compatible with the other layer.\n\t\t\t */\n\t\t\treadonly isGenerationCompatible: boolean;\n\t\t\t/**\n\t\t\t * The features that are required by the layer but are not supported by the other layer. This will only\n\t\t\t * be set if there are unsupported features.\n\t\t\t */\n\t\t\treadonly unsupportedFeatures: readonly string[] | undefined;\n\t };\n\n/**\n * @internal\n */\nexport const ILayerCompatDetails: keyof IProvideLayerCompatDetails = \"ILayerCompatDetails\";\n\n/**\n * @internal\n */\nexport interface IProvideLayerCompatDetails {\n\treadonly ILayerCompatDetails: ILayerCompatDetails;\n}\n\n/**\n * This interface is used to communicate the compatibility details of a layer to another layer.\n * @internal\n */\nexport interface ILayerCompatDetails extends Partial<IProvideLayerCompatDetails> {\n\t/**\n\t * A list of features supported by the layer at a particular layer boundary. This is used to check if these\n\t * set of features satisfy the requirements of another layer.\n\t */\n\treadonly supportedFeatures: ReadonlySet<string>;\n\t/**\n\t * The generation of the layer. The other layer at the layer boundary uses this to check if this satisfies\n\t * the minimum generation it requires to be compatible.\n\t *\n\t * @remarks Generation is updated on a regular cadence, say, monthly. This will allow us to determine how\n\t * far apart two layers are in terms of time and whether they are compatible.\n\t * For example, say generation is updated every month and the compatibility window between layer1 and layer2 is\n\t * 6 months. Now, if layer1 is at generation 1 and layer2 is at generation 5, then they are 4 months apart and are\n\t * compatible. But if layer1 is at generation 1 and layer2 is at generation 8, then they are 7 months apart and\n\t * are not compatible.\n\t */\n\treadonly generation: number;\n\t/**\n\t * The package version of the layer. When an incompatibility is detected, this is used to provide more context\n\t * on what the versions of the incompatible layers are.\n\t */\n\treadonly pkgVersion: string;\n}\n\n/**\n * This is the default compat details for a layer when it doesn't provide any compat details. This is used for\n * backwards compatibility to allow older layers to work before compatibility enforcement was introduced.\n * @internal\n */\nexport const defaultLayerCompatDetails: ILayerCompatDetails = {\n\tsupportedFeatures: new Set(),\n\tgeneration: 0, // 0 is reserved for layers before compatibility enforcement was introduced.\n\tpkgVersion: \"unknown\",\n};\n\n/**\n * The requirements that a layer needs another layer to support for them to be compatible.\n * @internal\n */\nexport interface ILayerCompatSupportRequirements {\n\t/**\n\t * The minimum supported generation the other layer needs to be at.\n\t */\n\treadonly minSupportedGeneration: number;\n\t/**\n\t * The features that the other layer needs to support.\n\t */\n\treadonly requiredFeatures: readonly string[];\n}\n\n/**\n * Checks compatibility of a layer (layer1) with another layer (layer2).\n * @param compatSupportRequirementsLayer1 - The requirements from layer1 that layer2 needs to meet.\n * @param compatDetailsLayer2 - The compatibility details of the layer2. If this is undefined, then the\n * default compatibility details are used for backwards compatibility.\n * @returns The result of the compatibility check indicating whether layer2 is compatible with layer1.\n *\n * @internal\n */\nexport function checkLayerCompatibility(\n\tcompatSupportRequirementsLayer1: ILayerCompatSupportRequirements,\n\tcompatDetailsLayer2: ILayerCompatDetails | undefined,\n): LayerCompatCheckResult {\n\tconst compatDetailsLayer2ToUse = compatDetailsLayer2 ?? defaultLayerCompatDetails;\n\tlet isGenerationCompatible = true;\n\tconst unsupportedFeatures: string[] = [];\n\n\t// If layer2's generation is less than the required minimum supported generation of layer1,\n\t// then it is not compatible.\n\tif (\n\t\tcompatDetailsLayer2ToUse.generation <\n\t\tcompatSupportRequirementsLayer1.minSupportedGeneration\n\t) {\n\t\tisGenerationCompatible = false;\n\t}\n\n\t// All features required by layer1 must be supported by layer2 to be compatible.\n\tfor (const feature of compatSupportRequirementsLayer1.requiredFeatures) {\n\t\tif (!compatDetailsLayer2ToUse.supportedFeatures.has(feature)) {\n\t\t\tunsupportedFeatures.push(feature);\n\t\t}\n\t}\n\n\treturn isGenerationCompatible && unsupportedFeatures.length === 0\n\t\t? { isCompatible: true }\n\t\t: {\n\t\t\t\tisCompatible: false,\n\t\t\t\tisGenerationCompatible,\n\t\t\t\tunsupportedFeatures: unsupportedFeatures.length > 0 ? unsupportedFeatures : undefined,\n\t\t\t};\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluid-internal/client-utils",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.43.0",
|
|
4
4
|
"description": "Not intended for use outside the Fluid Framework.",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -69,8 +69,8 @@
|
|
|
69
69
|
"temp-directory": "nyc/.nyc_output"
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
|
-
"@fluidframework/core-interfaces": "~2.
|
|
73
|
-
"@fluidframework/core-utils": "~2.
|
|
72
|
+
"@fluidframework/core-interfaces": "~2.43.0",
|
|
73
|
+
"@fluidframework/core-utils": "~2.43.0",
|
|
74
74
|
"@types/events_pkg": "npm:@types/events@^3.0.0",
|
|
75
75
|
"base64-js": "^1.5.1",
|
|
76
76
|
"buffer": "^6.0.3",
|
|
@@ -80,16 +80,16 @@
|
|
|
80
80
|
"devDependencies": {
|
|
81
81
|
"@arethetypeswrong/cli": "^0.17.1",
|
|
82
82
|
"@biomejs/biome": "~1.9.3",
|
|
83
|
-
"@fluid-internal/client-utils-previous": "npm:@fluid-internal/client-utils@2.
|
|
84
|
-
"@fluid-internal/mocha-test-setup": "~2.
|
|
85
|
-
"@fluid-tools/build-cli": "^0.
|
|
83
|
+
"@fluid-internal/client-utils-previous": "npm:@fluid-internal/client-utils@2.42.0",
|
|
84
|
+
"@fluid-internal/mocha-test-setup": "~2.43.0",
|
|
85
|
+
"@fluid-tools/build-cli": "^0.56.0",
|
|
86
86
|
"@fluidframework/build-common": "^2.0.3",
|
|
87
|
-
"@fluidframework/build-tools": "^0.
|
|
87
|
+
"@fluidframework/build-tools": "^0.56.0",
|
|
88
88
|
"@fluidframework/eslint-config-fluid": "^5.7.4",
|
|
89
89
|
"@microsoft/api-extractor": "7.52.8",
|
|
90
90
|
"@types/base64-js": "^1.3.0",
|
|
91
91
|
"@types/jest": "29.5.3",
|
|
92
|
-
"@types/jest-environment-puppeteer": "~2.
|
|
92
|
+
"@types/jest-environment-puppeteer": "~2.43.0",
|
|
93
93
|
"@types/mocha": "^10.0.10",
|
|
94
94
|
"@types/node": "^18.19.0",
|
|
95
95
|
"@types/rewire": "^2.5.28",
|
package/src/layerCompat.ts
CHANGED
|
@@ -47,6 +47,13 @@ export interface ILayerCompatDetails extends Partial<IProvideLayerCompatDetails>
|
|
|
47
47
|
/**
|
|
48
48
|
* The generation of the layer. The other layer at the layer boundary uses this to check if this satisfies
|
|
49
49
|
* the minimum generation it requires to be compatible.
|
|
50
|
+
*
|
|
51
|
+
* @remarks Generation is updated on a regular cadence, say, monthly. This will allow us to determine how
|
|
52
|
+
* far apart two layers are in terms of time and whether they are compatible.
|
|
53
|
+
* For example, say generation is updated every month and the compatibility window between layer1 and layer2 is
|
|
54
|
+
* 6 months. Now, if layer1 is at generation 1 and layer2 is at generation 5, then they are 4 months apart and are
|
|
55
|
+
* compatible. But if layer1 is at generation 1 and layer2 is at generation 8, then they are 7 months apart and
|
|
56
|
+
* are not compatible.
|
|
50
57
|
*/
|
|
51
58
|
readonly generation: number;
|
|
52
59
|
/**
|