Skip to content

Commit

Permalink
Phase I: Add ICodeDetailsLoader to container-definitions (#8478)
Browse files Browse the repository at this point in the history
  • Loading branch information
sonalivdeshpande authored Dec 7, 2021
1 parent 685f091 commit ebd8ed6
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 20 deletions.
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)
- [Moved `ICodeDetailsLoader` and `IFluidModuleWithDetails` interface to `@fluidframework/container-definitions`](#Moved-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.

### Moved `ICodeDetailsLoader` and `IFluidModuleWithDetails` interface to `@fluidframework/container-definitions`
The `ICodeDetailsLoader` and `IFluidModuleWithDetails` interface are deprecated in `@fluidframework/container-loader` and moved to `@fluidframework/container-definitions`. The `ICodeDetailsLoader` interface should be imported from `@fluidframework/container-definition` package. The `ICodeDetailsLoader` and `IFluidModuleWithDetails` from `@fluidframework/container-loader` 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
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ export interface ICodeAllowList {
testSource(source: IResolvedFluidCodeDetails): Promise<boolean>;
}

// @public
export interface ICodeDetailsLoader extends Partial<IProvideFluidCodeDetailsComparer> {
load(source: IFluidCodeDetails): Promise<IFluidModuleWithDetails>;
}

// @public @deprecated
export interface ICodeLoader extends Partial<IProvideFluidCodeDetailsComparer> {
load(source: IFluidCodeDetails): Promise<IFluidModule>;
Expand Down Expand Up @@ -356,6 +361,12 @@ export interface IFluidModule {
fluidExport: IFluidObject & FluidObject<IRuntimeFactory & IProvideFluidCodeDetailsComparer>;
}

// @public
export interface IFluidModuleWithDetails {
details: IFluidCodeDetails;
module: IFluidModule;
}

// @public @deprecated (undocumented)
export const IFluidTokenProvider: keyof IProvideFluidTokenProvider;

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
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 {
/** 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;
}
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;
}

/**
* @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>;
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

0 comments on commit ebd8ed6

Please sign in to comment.