/*! * Copyright (c) Microsoft Corporation and contributors. All rights reserved. * Licensed under the MIT License. */ import type { OldestSupportedClientVersion } from "@fluidframework/runtime-definitions/internal"; /** * Oldest deployed Fluid Framework client version supported for cross-client compatibility. * * @internal */ export declare const lowestMinVersionForCollab: "2.0.0"; /** * Default oldest supported client for APIs that still permit the setting to be omitted. * * @remarks * This aliases {@link lowestMinVersionForCollab} in Client 3.0. Remove this fallback when * customer-facing APIs require `oldestSupportedClient` in Client 3.10. * See {@link https://github.com/microsoft/FluidFramework/issues/27180}. * * @internal */ export declare const defaultMinVersionForCollab: "2.0.0"; /** * String in a valid semver format specifying the bottom of a minor version. * * @remarks * Configuration maps use major/minor checkpoints. Exact patch and prerelease versions are values * supplied to the selection logic, not configuration-map keys. * * @internal */ export type MinimumMinorSemanticVersion = `${bigint}.${bigint}.0`; /** * String in a valid semver format of a specific version at least specifying minor. * Unlike {@link @fluidframework/runtime-definitions#OldestSupportedClientVersion}, this type does * not encode the active compatibility floor or major-specific patch restrictions. * * @internal */ export type SemanticVersion = `${bigint}.${bigint}.${bigint}` | `${bigint}.${bigint}.${bigint}-${string}`; /** * 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}. * @remarks * For a given input {@link @fluidframework/runtime-definitions#OldestSupportedClientVersion}, * the corresponding configuration values can be found by using the entry in the inner objects with the highest {@link MinimumMinorSemanticVersion} * that does not exceed the given {@link @fluidframework/runtime-definitions#OldestSupportedClientVersion}. * * Use {@link getConfigsForMinVersionForCollab} to retrieve the configuration for a given a {@link @fluidframework/runtime-definitions#OldestSupportedClientVersion}. * * See the remarks on {@link MinimumMinorSemanticVersion} for some limitation on how ConfigMaps must handle versioning. * @internal */ export type ConfigMap> = { readonly [K in keyof T]-?: ConfigMapEntry; }; /** * Entry in {@link ConfigMap} associating {@link MinimumMinorSemanticVersion} with configuration values that became supported in that version. * @remarks * All entries must at least provide an entry for {@link lowestMinVersionForCollab}. * @internal */ export interface ConfigMapEntry { [version: MinimumMinorSemanticVersion]: T; [lowestMinVersionForCollab]: T; } /** * Generic type for runtimeOptionsAffectingDocSchemaConfigValidationMap * * @internal */ export type ConfigValidationMap> = { readonly [K in keyof T]-?: (configValue: T[K]) => SemanticVersion | undefined; }; /** * Returns a default configuration given minVersionForCollab and configuration version map. * * @privateRemarks * 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. * It should have no impact on the user of this function. * @internal */ export declare function getConfigsForMinVersionForCollab>(minVersionForCollab: OldestSupportedClientVersion, configMap: ConfigMap & Record): T; /** * Returns a default configuration given minVersionForCollab and {@link ConfigMapEntry}. * * @internal */ export declare function getConfigForMinVersionForCollab(minVersionForCollab: OldestSupportedClientVersion, config: ConfigMapEntry): T; /** * Returns a default configuration given minVersionForCollab and the contents of a {@link ConfigMapEntry} in an Iterable. * @remarks * See also {@link getConfigForMinVersionForCollab} for consuming a ConfigMapEntry directly. * * `ConfigMapEntry` is a nice type safe format for developers to directly author this data, * but it is messy and less type safe to work with it in this format programmatically. * Thus this function exists to help meet the needs of programmatic use cases, * like cases which transform a ConfigMapEntry before selecting a value from it. * @internal */ export declare function getConfigForMinVersionForCollabIterable(minVersionForCollab: OldestSupportedClientVersion, entries: Iterable): T; /** * Finds the entry for the highest version that is less than or equal to the provided minVersionForCollab. * @remarks * If none is found, returns undefined. * * When used with Fluid client versions, use the stricter {@link getConfigForMinVersionForCollabIterable} instead. * * @internal */ export declare function selectVersionRoundedDown(minVersionForCollab: string, entries: Iterable, compareVersions?: (a: string, b: string) => number): readonly [string, T] | undefined; /** * Returns detailed information about the validity of a minVersionForCollab. * @param minVersionForCollab - The minVersionForCollab to validate. * @returns An object containing the validity information. * * @internal */ export declare function checkValidMinVersionForCollabVerbose(minVersionForCollab: SemanticVersion): { isValidSemver: boolean; isGteLowestMinVersion: boolean; isLtePkgVersion: boolean; isValidOldestSupportedClientVersion: boolean; }; /** * Checks if the minVersionForCollab is valid. * A valid minVersionForCollab is a OldestSupportedClientVersion that is at least `lowestMinVersionForCollab` and less than or equal to the current package version. * * @internal */ export declare function isValidMinVersionForCollab(minVersionForCollab: SemanticVersion): minVersionForCollab is OldestSupportedClientVersion; /** * `pkgVersion` version without pre-release and with zeroed patch. * @remarks * This is the version the current codebase will have when officially released. * It allows CI and prerelease builds to test the release's features using that version as their * `OldestSupportedClientVersion`. * * Code that needs to derive this value from a package version should use * {@link @fluidframework/driver-definitions#featureVersion}. * * @privateRemarks * This value is validated against {@link validateMinimumVersionForCollab} by a test. * * @internal */ export declare const cleanedPackageVersion: "3.12.0"; /** * Narrows the type of the provided {@link SemanticVersion} to a {@link @fluidframework/runtime-definitions#OldestSupportedClientVersion}, throwing a UsageError if it is not valid. * @remarks * This is more strict than the type constraints imposed by `OldestSupportedClientVersion`. * Currently there is no type which is used to separate semantically valid and typescript allowed OldestSupportedClientVersion values: * thus users that care about strict validation may want to call this on un-validated `OldestSupportedClientVersion` values. * @param semanticVersion - The version to check. * @throws UsageError if the version is not a valid OldestSupportedClientVersion. * * @internal */ export declare function validateMinimumVersionForCollab(semanticVersion: string): asserts semanticVersion is OldestSupportedClientVersion; /** * Validates the given `overrides`. * * Checks that for keys which are in both the `validationMap` and the `overrides`, * that the `validationMap` function for that key either returns undefined or a version less than or equal to `minVersionForCollab`. * @privateRemarks * This design seems odd, and might want to be revisited. * Currently it only permits opting out of features, not into them (unless validationMap returns undefined), * and the handling of undefined versions seems questionable. * Also ignoring of extra keys in overrides might be bad since it seems like overrides is supposed to be validated. * @internal */ export declare function validateConfigMapOverrides>(minVersionForCollab: SemanticVersion, overrides: Partial, validationMap: ConfigValidationMap): void; /** * Helper function to map ContainerRuntimeOptionsInternal config values to * minVersionForCollab in, e.g., {@link @fluidframework/container-runtime#runtimeOptionsAffectingDocSchemaConfigValidationMap}. * * @internal */ export declare function configValueToMinVersionForCollab(configToMinVer: Arr): (configValue: T) => SemanticVersion | undefined; //# sourceMappingURL=compatibilityBase.d.ts.map