Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .changeset/happy-states-work.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
"@fluidframework/fluid-static": minor
"@fluidframework/azure-client": minor
"@fluidframework/tinylicious-client": minor
"__section": legacy
---

Remove deprecated CompatibilityMode APIs

Deprecated `CompatibilityMode` exports and overloads have been removed from `@fluidframework/fluid-static`, `@fluidframework/azure-client`, and `@fluidframework/tinylicious-client`.

Use `MinimumVersionForCollab` SemVer strings instead:

- Pass `minVersionForCollaboration` to `createTreeContainerRuntimeFactory`.
- Pass a `MinimumVersionForCollab` argument to `AzureClient.createContainer`, `AzureClient.getContainer`, `AzureClient.viewContainerVersion`, `TinyliciousClient.createContainer`, and `TinyliciousClient.getContainer`.
- Replace legacy mode values `"1"` and `"2"` with `"1.0.0"` and `"2.0.0"`.
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@

```ts

// @public @deprecated
export type CompatibilityMode = "1" | "2";

// @public
export type ContainerAttachProps<T = unknown> = T;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@

```ts

// @public @deprecated
export type CompatibilityMode = "1" | "2";

// @public
export type ContainerAttachProps<T = unknown> = T;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@

```ts

// @public @deprecated
export type CompatibilityMode = "1" | "2";

// @public
export type ContainerAttachProps<T = unknown> = T;

Expand All @@ -24,15 +21,6 @@ export function createTreeContainerRuntimeFactory(props: {
readonly runtimeOptionOverrides?: Partial<IContainerRuntimeOptions>;
}): IRuntimeFactory;

// @beta @deprecated @legacy
export function createTreeContainerRuntimeFactory(props: {
readonly schema: TreeContainerSchema;
readonly compatibilityMode: CompatibilityMode;
readonly rootDataStoreRegistry?: IFluidDataStoreRegistry;
readonly runtimeOptionOverrides?: Partial<IContainerRuntimeOptions>;
readonly minVersionForCollabOverride?: MinimumVersionForCollab;
}): IRuntimeFactory;

// @public
export const getPresence: (fluidContainer: IFluidContainer) => Presence;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@

```ts

// @public @deprecated
export type CompatibilityMode = "1" | "2";

// @public
export type ContainerAttachProps<T = unknown> = T;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@

```ts

// @public @deprecated
export type CompatibilityMode = "1" | "2";

// @public
export type ContainerAttachProps<T = unknown> = T;

Expand Down
7 changes: 6 additions & 1 deletion packages/framework/fluid-static/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,12 @@
"typescript": "~5.4.5"
},
"typeValidation": {
"broken": {},
"broken": {
"TypeAlias_CompatibilityMode": {
"forwardCompat": false,
"backCompat": false
}
},
"entrypoint": "public"
}
}
6 changes: 1 addition & 5 deletions packages/framework/fluid-static/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ export { createDOProviderContainerRuntimeFactory } from "./rootDataObject.js";
export { createServiceAudience } from "./serviceAudience.js";
export { createTreeContainerRuntimeFactory } from "./treeRootDataObject.js";
export type {
CompatibilityMode,
ContainerSchema,
ContainerAttachProps,
IConnection,
Expand All @@ -33,7 +32,4 @@ export type {
Myself,
TreeContainerSchema,
} from "./types.js";
export {
isTreeContainerSchema,
resolveCompatibilityModeToMinVersionForCollab,
} from "./utils.js";
export { isTreeContainerSchema } from "./utils.js";
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ declare type current_as_old_for_Interface_IServiceAudienceEvents = requireAssign
* typeValidation.broken:
* "TypeAlias_CompatibilityMode": {"forwardCompat": false}
*/
// @ts-expect-error compatibility expected to be broken
declare type old_as_current_for_TypeAlias_CompatibilityMode = requireAssignableTo<TypeOnly<old.CompatibilityMode>, TypeOnly<current.CompatibilityMode>>

/*
Expand All @@ -141,6 +142,7 @@ declare type old_as_current_for_TypeAlias_CompatibilityMode = requireAssignableT
* typeValidation.broken:
* "TypeAlias_CompatibilityMode": {"backCompat": false}
*/
// @ts-expect-error compatibility expected to be broken
declare type current_as_old_for_TypeAlias_CompatibilityMode = requireAssignableTo<TypeOnly<current.CompatibilityMode>, TypeOnly<old.CompatibilityMode>>

/*
Expand Down
76 changes: 4 additions & 72 deletions packages/framework/fluid-static/src/treeRootDataObject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ import type { SharedObjectKind } from "@fluidframework/shared-object-base/intern

import { defaultRuntimeOptionsForMinVersion } from "./compatibilityConfiguration.js";
import type {
// eslint-disable-next-line import-x/no-deprecated
CompatibilityMode,
IRootDataObject,
IStaticEntryPoint,
LoadableObjectKind,
Expand All @@ -48,7 +46,6 @@ import {
isSharedObjectKind,
makeFluidObject,
parseDataObjectsFromSharedObjects,
resolveCompatibilityModeToMinVersionForCollab,
} from "./utils.js";

/**
Expand Down Expand Up @@ -225,80 +222,15 @@ export function createTreeContainerRuntimeFactory(props: {
readonly runtimeOptionOverrides?: Partial<IContainerRuntimeOptions>;
}): IRuntimeFactory;

/**
* Creates an {@link @fluidframework/aqueduct#IRuntimeFactory} which constructs containers
* with an entry point containing single tree-based root data object.
*
* @remarks
* The entry point is opaque to caller.
* The root data object's registry and shared objects are configured based on the provided
* SharedTree and optional data store registry.
*
* @deprecated Pass `minVersionForCollaboration` directly instead of using `compatibilityMode`.
*
* @legacy @beta
*/
export function createTreeContainerRuntimeFactory(props: {
/**
* The schema for the container.
*/
readonly schema: TreeContainerSchema;

/**
* Legacy compatibility mode for the container.
*/
// eslint-disable-next-line import-x/no-deprecated
readonly compatibilityMode: CompatibilityMode;
/**
* Optional registry of data stores to pass to the DataObject factory.
* If not provided, one will be created based on the schema.
*/
readonly rootDataStoreRegistry?: IFluidDataStoreRegistry;
/**
* Optional overrides for the container runtime options.
* If not provided, only the default options for the given compatibilityMode will be used.
*/
readonly runtimeOptionOverrides?: Partial<IContainerRuntimeOptions>;
/**
* Optional override for minimum version for collaboration.
* @remarks
* If not provided, the default for the given compatibilityMode will be used.
* Rather than defining this, omit `compatibilityMode` and pass `minVersionForCollaboration` directly.
*/
readonly minVersionForCollabOverride?: MinimumVersionForCollab;
}): IRuntimeFactory;

// Implementation
export function createTreeContainerRuntimeFactory(props: {
readonly schema: TreeContainerSchema;
// eslint-disable-next-line import-x/no-deprecated
readonly compatibilityMode?: CompatibilityMode;
readonly minVersionForCollaboration?: MinimumVersionForCollab;
readonly minVersionForCollaboration: MinimumVersionForCollab;
readonly rootDataStoreRegistry?: IFluidDataStoreRegistry;
readonly runtimeOptionOverrides?: Partial<IContainerRuntimeOptions>;
readonly minVersionForCollabOverride?: MinimumVersionForCollab;
}): IRuntimeFactory {
const {
compatibilityMode,
minVersionForCollaboration,
minVersionForCollabOverride,
rootDataStoreRegistry,
runtimeOptionOverrides,
schema,
} = props;

let minVersionForCollab: MinimumVersionForCollab;
if (minVersionForCollaboration !== undefined) {
minVersionForCollab = minVersionForCollaboration;
} else if (compatibilityMode === undefined) {
throw new Error(
"Either minVersionForCollaboration or compatibilityMode (deprecated) must be provided.",
);
} else {
minVersionForCollab =
minVersionForCollabOverride ??
resolveCompatibilityModeToMinVersionForCollab(compatibilityMode);
}
const { minVersionForCollaboration, rootDataStoreRegistry, runtimeOptionOverrides, schema } =
props;

const [registryEntries, sharedObjects] = parseDataObjectsFromSharedObjects(schema);
const registry = rootDataStoreRegistry ?? new FluidDataStoreRegistry(registryEntries);
Expand All @@ -307,7 +239,7 @@ export function createTreeContainerRuntimeFactory(props: {
new TreeRootDataObjectFactory(sharedObjects, registry),
{
runtimeOptions: runtimeOptionOverrides,
minVersionForCollab,
minVersionForCollab: minVersionForCollaboration,
},
);
}
15 changes: 0 additions & 15 deletions packages/framework/fluid-static/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,6 @@ import type {
} from "@fluidframework/shared-object-base/internal";
import type { ITree } from "@fluidframework/tree";

/**
* Determines the set of runtime options that Fluid Framework will use when running.
* In "1" mode we support full interop between 2.x clients and 1.x clients,
* while in "2" mode we only support interop between 2.x clients.
*
* @deprecated Specify the minimum Fluid Framework version directly via the
* `minVersionForCollab` parameter, which accepts a
* {@link @fluidframework/runtime-definitions#MinimumVersionForCollab} SemVer string. The
* legacy mode "1" is equivalent to `minVersionForCollab: "1.0.0"`; mode "2" is
* equivalent to `"2.0.0"`.
*
* @public
*/
export type CompatibilityMode = "1" | "2";

/**
* A mapping of string identifiers to instantiated `DataObject`s or `SharedObject`s.
*/
Expand Down
29 changes: 1 addition & 28 deletions packages/framework/fluid-static/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,13 @@ import type {
} from "@fluidframework/datastore-definitions/internal";
import type {
IFluidDataStoreContext,
MinimumVersionForCollab,
NamedFluidDataStoreRegistryEntry,
} from "@fluidframework/runtime-definitions/internal";
import type { ISharedObjectKind } from "@fluidframework/shared-object-base/internal";
import { UsageError } from "@fluidframework/telemetry-utils/internal";
import { SharedTreeFactoryType } from "@fluidframework/tree/internal";

import type {
// eslint-disable-next-line import-x/no-deprecated
CompatibilityMode,
ContainerSchema,
LoadableObjectKind,
TreeContainerSchema,
} from "./types.js";
import type { ContainerSchema, LoadableObjectKind, TreeContainerSchema } from "./types.js";

/**
* Runtime check to determine if an object is a {@link DataObjectKind}.
Expand Down Expand Up @@ -147,26 +140,6 @@ export function makeFluidObject<
return Object.defineProperty(object, providerKey, { value: object }) as T;
}

/**
* Resolves the `compatibilityMode` input — either a `MinimumVersionForCollab`
* SemVer string or a legacy `CompatibilityMode` value — into a precise
* `MinimumVersionForCollab`.
*
* TODO: AB#73679: This can be removed when the deprecated CompatibilityMode is removed
*
* @internal
*/
export function resolveCompatibilityModeToMinVersionForCollab(
// eslint-disable-next-line import-x/no-deprecated
compatibilityMode: MinimumVersionForCollab | CompatibilityMode,
): MinimumVersionForCollab {
return compatibilityMode === "1"
? "1.0.0"
: compatibilityMode === "2"
? "2.0.0"
: compatibilityMode;
}

/**
* Determines if the provided schema is a valid tree-based container schema.
* @internal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,14 @@ export class AzureClient {
container: IFluidContainer<TContainerSchema>;
services: AzureContainerServices;
}>;
// @deprecated
createContainer<const TContainerSchema extends ContainerSchema>(containerSchema: TContainerSchema, compatibilityMode: CompatibilityMode): Promise<{
container: IFluidContainer<TContainerSchema>;
services: AzureContainerServices;
}>;
getContainer<TContainerSchema extends ContainerSchema>(id: string, containerSchema: TContainerSchema, minVersionForCollab: MinimumVersionForCollab): Promise<{
container: IFluidContainer<TContainerSchema>;
services: AzureContainerServices;
}>;
// @deprecated
getContainer<TContainerSchema extends ContainerSchema>(id: string, containerSchema: TContainerSchema, compatibilityMode: CompatibilityMode): Promise<{
container: IFluidContainer<TContainerSchema>;
services: AzureContainerServices;
}>;
getContainerVersions(id: string, options?: AzureGetVersionsOptions): Promise<AzureContainerVersion[]>;
viewContainerVersion<TContainerSchema extends ContainerSchema>(id: string, containerSchema: TContainerSchema, version: AzureContainerVersion, minVersionForCollab: MinimumVersionForCollab): Promise<{
container: IFluidContainer<TContainerSchema>;
}>;
// @deprecated
viewContainerVersion<TContainerSchema extends ContainerSchema>(id: string, containerSchema: TContainerSchema, version: AzureContainerVersion, compatibilityMode: CompatibilityMode): Promise<{
container: IFluidContainer<TContainerSchema>;
}>;
}

// @public
Expand Down Expand Up @@ -87,9 +73,6 @@ export interface AzureRemoteConnectionConfig extends AzureConnectionConfig {
type: "remote";
}

// @public @deprecated
export type CompatibilityMode = "1" | "2";

// @public
export type IAzureAudience = IServiceAudience<AzureMember>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,14 @@ export class AzureClient {
container: IFluidContainer<TContainerSchema>;
services: AzureContainerServices;
}>;
// @deprecated
createContainer<const TContainerSchema extends ContainerSchema>(containerSchema: TContainerSchema, compatibilityMode: CompatibilityMode): Promise<{
container: IFluidContainer<TContainerSchema>;
services: AzureContainerServices;
}>;
getContainer<TContainerSchema extends ContainerSchema>(id: string, containerSchema: TContainerSchema, minVersionForCollab: MinimumVersionForCollab): Promise<{
container: IFluidContainer<TContainerSchema>;
services: AzureContainerServices;
}>;
// @deprecated
getContainer<TContainerSchema extends ContainerSchema>(id: string, containerSchema: TContainerSchema, compatibilityMode: CompatibilityMode): Promise<{
container: IFluidContainer<TContainerSchema>;
services: AzureContainerServices;
}>;
getContainerVersions(id: string, options?: AzureGetVersionsOptions): Promise<AzureContainerVersion[]>;
viewContainerVersion<TContainerSchema extends ContainerSchema>(id: string, containerSchema: TContainerSchema, version: AzureContainerVersion, minVersionForCollab: MinimumVersionForCollab): Promise<{
container: IFluidContainer<TContainerSchema>;
}>;
// @deprecated
viewContainerVersion<TContainerSchema extends ContainerSchema>(id: string, containerSchema: TContainerSchema, version: AzureContainerVersion, compatibilityMode: CompatibilityMode): Promise<{
container: IFluidContainer<TContainerSchema>;
}>;
}

// @public
Expand Down Expand Up @@ -87,9 +73,6 @@ export interface AzureRemoteConnectionConfig extends AzureConnectionConfig {
type: "remote";
}

// @public @deprecated
export type CompatibilityMode = "1" | "2";

// @public
export type IAzureAudience = IServiceAudience<AzureMember>;

Expand Down
Loading
Loading