Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Phase I: Add ICodeDetailsLoader to container-definitions #8478

Merged
merged 9 commits into from
Dec 7, 2021
4 changes: 4 additions & 0 deletions BREAKING.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ There are a few steps you can take to write a good change note and avoid needing
- [Remove `loader` property from `MockFluidDataStoreContext` class](#Remove-loader-property-from-MockFluidDataStoreContext-class)
- [maxMessageSize removed from IConnectionDetails and IDocumentDeltaConnection](#maxMessageSize-removed-from-IConnectionDetails-and-IDocumentDeltaConnection)
- [Remove `IntervalCollection.getView()` from sequence dds](#Remove-IntervalCollectiongetView-from-sequence-dds)
- [Added `ICodeDetailsLoader` and `IFluidModuleWithDetails` interface to `@fluidframework/container-definitions`](#Added-ICodeDetailsLoader-and-IFluidModuleWithDetails-interface-to-fluidframeworkcontainer-definitions)

### `IContainer` interface updated to expose actively used `Container` public APIs
In order to have the `IContainer` interface be the active developer surface that is used when interacting with a `Container` instance, it has been updated to expose the APIs that are necessary for currently used behavior. The motivation here is to move away from using the `Container` class when only its type is required, and to use the `IContainer` interface instead.
Expand Down Expand Up @@ -74,6 +75,9 @@ The `maxMessageSize` property from `IConnectionDetails` and `IDocumentDeltaConne
### Remove `IntervalCollection.getView()` from sequence dds
The `IntervalCollection.getView()` was removed. If you were calling this API, you should instead refer to the `IntervalCollection` itself directly in places where you were using the view.

### Added `ICodeDetailsLoader` and `IFluidModuleWithDetails` interface to `@fluidframework/container-definitions`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding isn't a breaking change, but the impending removal from their old location is. Prefer to lead with the breaking info so that customers can easily understand if they need to take action, e.g. "X & Y deprecated in package A, moving to package B".

The `ICodeDetailsLoader` and `IFluidModuleWithDetails` interface are added to `@fluidframework/container-defintions`. The `ICodeDetailsLoader` interface should be imported from `@fluidframework/container-definition` package. The `ICodeDetailsLoader` and `IFluidModuleWithDetails` are now deprecated and will be removed from `@fluidframework/container-loader` in further releases.

## 0.52 Breaking changes
- [chaincodePackage removed from Container](#chaincodePackage-removed-from-Container)
- [`OdspDocumentInfo` type replaced with `OdspFluidDataStoreLocator` interface](#OdspDocumentInfo-type-replaced-with-OdspFluidDataStoreLocator-interface)
Expand Down
4 changes: 2 additions & 2 deletions api-report/container-loader.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export class Container extends EventEmitterWithErrorHandling<IContainerEvents> i
static version: string;
}

// @public
// @public @deprecated (undocumented)
export interface ICodeDetailsLoader extends Partial<IProvideFluidCodeDetailsComparer> {
load(source: IFluidCodeDetails): Promise<IFluidModuleWithDetails>;
}
Expand Down Expand Up @@ -148,7 +148,7 @@ export type IDetachedBlobStorage = Pick<IDocumentStorageService, "createBlob" |
getBlobIds(): string[];
};

// @public
// @public @deprecated (undocumented)
export interface IFluidModuleWithDetails {
details: IFluidCodeDetails;
module: IFluidModule;
Expand Down
29 changes: 29 additions & 0 deletions common/lib/container-definitions/src/loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,35 @@ export interface ICodeLoader extends Partial<IProvideFluidCodeDetailsComparer> {
load(source: IFluidCodeDetails): Promise<IFluidModule>;
}

/**
* Encapsulates a module entry point with corresponding code details.
*/
export interface IFluidModuleWithDetails {
/** Fluid code module that implements the runtime factory needed to instantiate the container runtime. */
module: IFluidModule;
/**
* Code details associated with the module. Represents a document schema this module supports.
* If the code loader implements the {@link @fluidframework/core-interfaces#IFluidCodeDetailsComparer} interface,
* it'll be called to determine whether the module code details satisfy the new code proposal in the quorum.
*/
details: IFluidCodeDetails;
}

/**
* Fluid code loader resolves a code module matching the document schema, i.e. code details, such as
* a package name and package version range.
*/
export interface ICodeDetailsLoader
sonalivdeshpande marked this conversation as resolved.
Show resolved Hide resolved
extends Partial<IProvideFluidCodeDetailsComparer> {
/**
* Load the code module (package) that is capable to interact with the document.
*
* @param source - Code proposal that articulates the current schema the document is written in.
* @returns - Code module entry point along with the code details associated with it.
*/
load(source: IFluidCodeDetails): Promise<IFluidModuleWithDetails>;
}

/**
* The interface returned from a IFluidCodeResolver which represents IFluidCodeDetails
* that have been resolved and are ready to load
Expand Down
41 changes: 23 additions & 18 deletions packages/loader/container-loader/src/loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,32 +125,37 @@ export interface ILoaderOptions extends ILoaderOptions1{
}

/**
* @deprecated IFluidModuleWithDetails interface is moved to
* {@link @fluidframework/container-definition#IFluidModuleWithDetails}
* to have all the code loading modules in one package. #8193
* Encapsulates a module entry point with corresponding code details.
*/
export interface IFluidModuleWithDetails {
sonalivdeshpande marked this conversation as resolved.
Show resolved Hide resolved
/** Fluid code module that implements the runtime factory needed to instantiate the container runtime. */
module: IFluidModule;
/**
* Code details associated with the module. Represents a document schema this module supports.
* If the code loader implements the {@link @fluidframework/core-interfaces#IFluidCodeDetailsComparer} interface,
* it'll be called to determine whether the module code details satisfy the new code proposal in the quorum.
*/
details: IFluidCodeDetails;
}
/** Fluid code module that implements the runtime factory needed to instantiate the container runtime. */
module: IFluidModule;
/**
* Code details associated with the module. Represents a document schema this module supports.
* If the code loader implements the {@link @fluidframework/core-interfaces#IFluidCodeDetailsComparer} interface,
* it'll be called to determine whether the module code details satisfy the new code proposal in the quorum.
*/
details: IFluidCodeDetails;
}

/**
* @deprecated ICodeDetailsLoader interface is moved to {@link @fluidframework/container-definition#ICodeDetailsLoader}
* to have code loading modules in one package. #8193
* Fluid code loader resolves a code module matching the document schema, i.e. code details, such as
* a package name and package version range.
*/
export interface ICodeDetailsLoader
extends Partial<IProvideFluidCodeDetailsComparer> {
/**
* Load the code module (package) that is capable to interact with the document.
*
* @param source - Code proposal that articulates the current schema the document is written in.
* @returns - Code module entry point along with the code details associated with it.
*/
load(source: IFluidCodeDetails): Promise<IFluidModuleWithDetails>;
export interface ICodeDetailsLoader
sonalivdeshpande marked this conversation as resolved.
Show resolved Hide resolved
extends Partial<IProvideFluidCodeDetailsComparer> {
/**
* Load the code module (package) that is capable to interact with the document.
*
* @param source - Code proposal that articulates the current schema the document is written in.
* @returns - Code module entry point along with the code details associated with it.
*/
load(source: IFluidCodeDetails): Promise<IFluidModuleWithDetails>;
}

/**
Expand Down