@fluidframework/container-definitions
Advanced tools
Comparing version
@@ -16,6 +16,10 @@ ## Beta API Report File for "@fluidframework/container-definitions" | ||
export namespace ConnectionState { | ||
export type CatchingUp = 1; | ||
export type Connected = 2; | ||
export type Disconnected = 0; | ||
export type EstablishingConnection = 3; | ||
const Disconnected = 0; | ||
export type CatchingUp = typeof CatchingUp; | ||
const EstablishingConnection = 3; | ||
export type Connected = typeof Connected; | ||
const CatchingUp = 1; | ||
export type Disconnected = typeof Disconnected; | ||
const Connected = 2; | ||
export type EstablishingConnection = typeof EstablishingConnection; | ||
} | ||
@@ -22,0 +26,0 @@ |
@@ -16,6 +16,10 @@ ## Alpha API Report File for "@fluidframework/container-definitions" | ||
export namespace ConnectionState { | ||
export type CatchingUp = 1; | ||
export type Connected = 2; | ||
export type Disconnected = 0; | ||
export type EstablishingConnection = 3; | ||
const Disconnected = 0; | ||
export type CatchingUp = typeof CatchingUp; | ||
const EstablishingConnection = 3; | ||
export type Connected = typeof Connected; | ||
const CatchingUp = 1; | ||
export type Disconnected = typeof Disconnected; | ||
const Connected = 2; | ||
export type EstablishingConnection = typeof EstablishingConnection; | ||
} | ||
@@ -144,2 +148,3 @@ | ||
getAbsoluteUrl?(relativeUrl: string): Promise<string | undefined>; | ||
readonly getConnectionState?: () => ConnectionState; | ||
// (undocumented) | ||
@@ -159,3 +164,3 @@ getLoadedFromVersion(): IVersion | undefined; | ||
// (undocumented) | ||
readonly storage: IDocumentStorageService; | ||
readonly storage: IContainerStorageService; | ||
// (undocumented) | ||
@@ -207,2 +212,21 @@ readonly submitBatchFn: (batch: IBatchMessage[], referenceSequenceNumber?: number) => number; | ||
// @alpha @legacy | ||
export interface IContainerStorageService { | ||
createBlob(file: ArrayBufferLike): Promise<ICreateBlobResponse>; | ||
// @deprecated | ||
dispose?(error?: Error): void; | ||
// @deprecated | ||
readonly disposed?: boolean; | ||
// @deprecated | ||
downloadSummary(handle: ISummaryHandle): Promise<ISummaryTree>; | ||
getSnapshot?(snapshotFetchOptions?: ISnapshotFetchOptions): Promise<ISnapshot>; | ||
getSnapshotTree(version?: IVersion, scenarioName?: string): Promise<ISnapshotTree | null>; | ||
getVersions(versionId: string | null, count: number, scenarioName?: string, fetchSource?: FetchSource): Promise<IVersion[]>; | ||
readonly maximumCacheDurationMs?: IDocumentStorageServicePolicies["maximumCacheDurationMs"]; | ||
// @deprecated | ||
readonly policies?: IDocumentStorageServicePolicies | undefined; | ||
readBlob(id: string): Promise<ArrayBufferLike>; | ||
uploadSummaryWithContext(summary: ISummaryTree, context: ISummaryContext): Promise<string>; | ||
} | ||
// @public | ||
@@ -209,0 +233,0 @@ export type ICriticalContainerError = IErrorBase_2; |
@@ -16,6 +16,10 @@ ## Public API Report File for "@fluidframework/container-definitions" | ||
export namespace ConnectionState { | ||
export type CatchingUp = 1; | ||
export type Connected = 2; | ||
export type Disconnected = 0; | ||
export type EstablishingConnection = 3; | ||
const Disconnected = 0; | ||
export type CatchingUp = typeof CatchingUp; | ||
const EstablishingConnection = 3; | ||
export type Connected = typeof Connected; | ||
const CatchingUp = 1; | ||
export type Disconnected = typeof Disconnected; | ||
const Connected = 2; | ||
export type EstablishingConnection = typeof EstablishingConnection; | ||
} | ||
@@ -22,0 +26,0 @@ |
@@ -16,6 +16,10 @@ ## Public API Report File for "@fluidframework/container-definitions" | ||
export namespace ConnectionState { | ||
export type CatchingUp = 1; | ||
export type Connected = 2; | ||
export type Disconnected = 0; | ||
export type EstablishingConnection = 3; | ||
const Disconnected = 0; | ||
export type CatchingUp = typeof CatchingUp; | ||
const EstablishingConnection = 3; | ||
export type Connected = typeof Connected; | ||
const CatchingUp = 1; | ||
export type Disconnected = typeof Disconnected; | ||
const Connected = 2; | ||
export type EstablishingConnection = typeof EstablishingConnection; | ||
} | ||
@@ -22,0 +26,0 @@ |
# @fluidframework/container-definitions | ||
## 2.52.0 | ||
### Minor Changes | ||
- Introduced new interface "IContainerStorageService" to replace "IDocumentStorageService" between Loader and Runtime layers ([#25057](https://github.com/microsoft/FluidFramework/pull/25057)) [92012de557](https://github.com/microsoft/FluidFramework/commit/92012de5571d4d87cc14bae2f391431764558735) | ||
Added an interface `IContainerStorageService` which will replace `IDocumentStorageService` in the `Runtime` layer. This is exposed by the `Loader` layer to the `Runtime` layer via `ContainerContext`. This will help remove `Runtime` layer's dependency on the `Driver` layer and replace it with the `Loader` layer that it already maintains. This new interface will only contain properties that are needed and used by the `Runtime` layer. | ||
The following properties from `IContainerStorageService` are deprecated as they are not needed by the `DataStore` layer. These be removed in a future release: | ||
- `policies` - The Runtime only needs `maximumCacheDurationMs` property from it which is added directly on `IContainerStorageService`. | ||
- `downloadSummary` | ||
- `disposed` | ||
- `dispose` | ||
## 2.51.0 | ||
@@ -4,0 +19,0 @@ |
@@ -17,4 +17,4 @@ /*! | ||
export { ContainerErrorTypes } from "./error.js"; | ||
export type { ConnectionState, ICodeDetailsLoader, IContainer, IContainerEvents, IContainerLoadMode, IContainerPolicies, IFluidCodeResolver, IFluidModuleWithDetails, IHostLoader, ILoader, ILoaderHeader, ILoaderOptions, IProvideLoader, IResolvedFluidCodeDetails, ISnapshotTreeWithBlobContents, } from "./loader.js"; | ||
export { LoaderHeader } from "./loader.js"; | ||
export type { ICodeDetailsLoader, IContainer, IContainerEvents, IContainerLoadMode, IContainerPolicies, IFluidCodeResolver, IFluidModuleWithDetails, IHostLoader, ILoader, ILoaderHeader, ILoaderOptions, IProvideLoader, IResolvedFluidCodeDetails, ISnapshotTreeWithBlobContents, } from "./loader.js"; | ||
export { ConnectionState, LoaderHeader } from "./loader.js"; | ||
export type { IFluidModule } from "./fluidModule.js"; | ||
@@ -24,3 +24,3 @@ export type { IFluidPackage, IFluidPackageEnvironment, IFluidCodeDetails, IFluidCodeDetailsConfig, IProvideFluidCodeDetailsComparer, } from "./fluidPackage.js"; | ||
export type { IBatchMessage, IContainerContext, IProvideRuntimeFactory, IRuntime, IGetPendingLocalStateProps, } from "./runtime.js"; | ||
export { AttachState, IRuntimeFactory } from "./runtime.js"; | ||
export { AttachState, IRuntimeFactory, type IContainerStorageService } from "./runtime.js"; | ||
export type { | ||
@@ -27,0 +27,0 @@ /** |
@@ -7,3 +7,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.IRuntimeFactory = exports.AttachState = exports.isFluidCodeDetails = exports.isFluidPackage = exports.IFluidCodeDetailsComparer = exports.LoaderHeader = exports.ContainerErrorTypes = exports.isIDeltaManagerFull = exports.isFluidBrowserPackage = void 0; | ||
exports.IRuntimeFactory = exports.AttachState = exports.isFluidCodeDetails = exports.isFluidPackage = exports.IFluidCodeDetailsComparer = exports.LoaderHeader = exports.ConnectionState = exports.ContainerErrorTypes = exports.isIDeltaManagerFull = exports.isFluidBrowserPackage = void 0; | ||
var browserPackage_js_1 = require("./browserPackage.js"); | ||
@@ -16,2 +16,3 @@ Object.defineProperty(exports, "isFluidBrowserPackage", { enumerable: true, get: function () { return browserPackage_js_1.isFluidBrowserPackage; } }); | ||
var loader_js_1 = require("./loader.js"); | ||
Object.defineProperty(exports, "ConnectionState", { enumerable: true, get: function () { return loader_js_1.ConnectionState; } }); | ||
Object.defineProperty(exports, "LoaderHeader", { enumerable: true, get: function () { return loader_js_1.LoaderHeader; } }); | ||
@@ -18,0 +19,0 @@ var fluidPackage_js_1 = require("./fluidPackage.js"); |
@@ -39,2 +39,3 @@ /*! | ||
IContainerPolicies, | ||
IContainerStorageService, | ||
IDeltaManager, | ||
@@ -41,0 +42,0 @@ IDeltaManagerEvents, |
@@ -242,4 +242,8 @@ /*! | ||
*/ | ||
type Disconnected = 0; | ||
const Disconnected = 0; | ||
/** | ||
* {@inheritdoc @fluidframework/container-definitions#(ConnectionState:namespace).(Disconnected:variable)} | ||
*/ | ||
type Disconnected = typeof Disconnected; | ||
/** | ||
* The container is disconnected but actively trying to establish a new connection. | ||
@@ -249,13 +253,25 @@ * PLEASE NOTE that this numerical value falls out of the order you may expect for this state. | ||
*/ | ||
type EstablishingConnection = 3; | ||
const EstablishingConnection = 3; | ||
/** | ||
* {@inheritdoc @fluidframework/container-definitions#(ConnectionState:namespace).(EstablishingConnection:variable)} | ||
*/ | ||
type EstablishingConnection = typeof EstablishingConnection; | ||
/** | ||
* The container has an inbound connection only, and is catching up to the latest known state from the service. | ||
* @public | ||
*/ | ||
type CatchingUp = 1; | ||
const CatchingUp = 1; | ||
/** | ||
* {@inheritdoc @fluidframework/container-definitions#(ConnectionState:namespace).(CatchingUp:variable)} | ||
*/ | ||
type CatchingUp = typeof CatchingUp; | ||
/** | ||
* The container is fully connected and syncing. | ||
* @public | ||
*/ | ||
type Connected = 2; | ||
const Connected = 2; | ||
/** | ||
* {@inheritdoc @fluidframework/container-definitions#(ConnectionState:namespace).(Connected:variable)} | ||
*/ | ||
type Connected = typeof Connected; | ||
} | ||
@@ -397,3 +413,3 @@ /** | ||
* | ||
* {@link IContainer.connectionState} will be set to {@link (ConnectionState:namespace).Connected}, and the | ||
* {@link IContainer.connectionState} will be set to {@link (ConnectionState:namespace).(Connected:variable)}, and the | ||
* "connected" event will be fired if/when connection succeeds. | ||
@@ -407,3 +423,3 @@ */ | ||
* | ||
* {@link IContainer.connectionState} will be set to {@link (ConnectionState:namespace).Disconnected}, and the | ||
* {@link IContainer.connectionState} will be set to {@link (ConnectionState:namespace).(Disconnected:variable)}, and the | ||
* "disconnected" event will be fired when disconnection completes. | ||
@@ -419,3 +435,3 @@ */ | ||
* | ||
* Set once {@link IContainer.connectionState} is {@link (ConnectionState:namespace).Connected}, | ||
* Set once {@link IContainer.connectionState} is {@link (ConnectionState:namespace).(Connected:variable)}, | ||
* otherwise will be `undefined`. | ||
@@ -422,0 +438,0 @@ */ |
@@ -7,4 +7,36 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.LoaderHeader = void 0; | ||
exports.LoaderHeader = exports.ConnectionState = void 0; | ||
/** | ||
* Namespace for the different connection states a container can be in. | ||
* PLEASE NOTE: The sequence of the numerical values does no correspond to the typical connection state progression. | ||
* @public | ||
*/ | ||
// eslint-disable-next-line @typescript-eslint/no-namespace | ||
var ConnectionState; | ||
(function (ConnectionState) { | ||
/** | ||
* The container is not connected to the delta server. | ||
* Note - When in this state the container may be about to reconnect, | ||
* or may remain disconnected until explicitly told to connect. | ||
* @public | ||
*/ | ||
ConnectionState.Disconnected = 0; | ||
/** | ||
* The container is disconnected but actively trying to establish a new connection. | ||
* PLEASE NOTE that this numerical value falls out of the order you may expect for this state. | ||
* @public | ||
*/ | ||
ConnectionState.EstablishingConnection = 3; | ||
/** | ||
* The container has an inbound connection only, and is catching up to the latest known state from the service. | ||
* @public | ||
*/ | ||
ConnectionState.CatchingUp = 1; | ||
/** | ||
* The container is fully connected and syncing. | ||
* @public | ||
*/ | ||
ConnectionState.Connected = 2; | ||
})(ConnectionState || (exports.ConnectionState = ConnectionState = {})); | ||
/** | ||
* Accepted header keys for requests coming to the Loader | ||
@@ -11,0 +43,0 @@ * @legacy |
@@ -7,7 +7,7 @@ /*! | ||
import type { IClientDetails, IQuorumClients, ISummaryTree } from "@fluidframework/driver-definitions"; | ||
import type { IDocumentStorageService, ISnapshot, IDocumentMessage, ISnapshotTree, ISummaryContent, IVersion, MessageType, ISequencedDocumentMessage } from "@fluidframework/driver-definitions/internal"; | ||
import type { ISnapshot, IDocumentMessage, ISnapshotTree, ISummaryContent, IVersion, MessageType, ISequencedDocumentMessage, ICreateBlobResponse, ISummaryContext, ISnapshotFetchOptions, FetchSource, IDocumentStorageServicePolicies, ISummaryHandle } from "@fluidframework/driver-definitions/internal"; | ||
import type { IAudience } from "./audience.js"; | ||
import type { IDeltaManager } from "./deltas.js"; | ||
import type { ICriticalContainerError } from "./error.js"; | ||
import type { ILoader } from "./loader.js"; | ||
import type { ConnectionState, ILoader } from "./loader.js"; | ||
/** | ||
@@ -100,2 +100,92 @@ * The attachment state of some Fluid data (e.g. a container or data store), denoting whether it is uploaded to the | ||
/** | ||
* Interface to provide access to snapshots and policies to the Runtime layer. This should follow the Loader / Runtime | ||
* layer compatibility rules. | ||
* | ||
* @remarks It contains a subset of APIs from {@link @fluidframework/driver-definitions#IDocumentStorageService} but | ||
* allows the Runtime to not support layer compatibility with the Driver layer. Instead, it supports compatibility | ||
* with the Loader layer which it already does. | ||
* | ||
* @legacy | ||
* @alpha | ||
*/ | ||
export interface IContainerStorageService { | ||
/** | ||
* Whether or not the object has been disposed. | ||
* If true, the object should be considered invalid, and its other state should be disregarded. | ||
* | ||
* @deprecated - This API is deprecated and will be removed in a future release. No replacement is planned as | ||
* it is unused in the Runtime layer. | ||
*/ | ||
readonly disposed?: boolean; | ||
/** | ||
* Dispose of the object and its resources. | ||
* @param error - Optional error indicating the reason for the disposal, if the object was | ||
* disposed as the result of an error. | ||
* | ||
* @deprecated - This API is deprecated and will be removed in a future release. No replacement is planned as | ||
* it is unused in the Runtime layer. | ||
*/ | ||
dispose?(error?: Error): void; | ||
/** | ||
* Policies implemented/instructed by driver. | ||
* | ||
* @deprecated - This will be removed in a future release. The Runtime layer only needs `maximumCacheDurationMs` | ||
* policy which is added as a separate property. | ||
*/ | ||
readonly policies?: IDocumentStorageServicePolicies | undefined; | ||
/** | ||
* See {@link @fluidframework/driver-definitions#IDocumentStorageServicePolicies.maximumCacheDurationMs} | ||
*/ | ||
readonly maximumCacheDurationMs?: IDocumentStorageServicePolicies["maximumCacheDurationMs"]; | ||
/** | ||
* Returns the snapshot tree. | ||
* @param version - Version of the snapshot to be fetched. | ||
* @param scenarioName - scenario in which this api is called. This will be recorded by server and would help | ||
* in debugging purposes to see why this call was made. | ||
*/ | ||
getSnapshotTree(version?: IVersion, scenarioName?: string): Promise<ISnapshotTree | null>; | ||
/** | ||
* Returns the snapshot which can contain other artifacts too like blob contents, ops etc. It is different from | ||
* `getSnapshotTree` api in that, that API only returns the snapshot tree from the snapshot. | ||
* @param snapshotFetchOptions - Options specified by the caller to specify and want certain behavior from the | ||
* driver when fetching the snapshot. | ||
*/ | ||
getSnapshot?(snapshotFetchOptions?: ISnapshotFetchOptions): Promise<ISnapshot>; | ||
/** | ||
* Retrieves all versions of the document starting at the specified versionId - or null if from the head | ||
* @param versionId - Version id of the requested version. | ||
* @param count - Number of the versions to be fetched. | ||
* @param scenarioName - scenario in which this api is called. This will be recorded by server and would help | ||
* in debugging purposes to see why this call was made. | ||
* @param fetchSource - Callers can specify the source of the response. For ex. Driver may choose to cache | ||
* requests and serve data from cache. That will result in stale info returned. Callers can disable this | ||
* functionality by passing fetchSource = noCache and ensuring that driver will return latest information | ||
* from storage. | ||
*/ | ||
getVersions(versionId: string | null, count: number, scenarioName?: string, fetchSource?: FetchSource): Promise<IVersion[]>; | ||
/** | ||
* Creates a blob out of the given buffer | ||
*/ | ||
createBlob(file: ArrayBufferLike): Promise<ICreateBlobResponse>; | ||
/** | ||
* Reads the object with the given ID, returns content in arrayBufferLike | ||
*/ | ||
readBlob(id: string): Promise<ArrayBufferLike>; | ||
/** | ||
* Uploads a summary tree to storage using the given context for reference of previous summary handle. | ||
* The ISummaryHandles in the uploaded tree should have paths to indicate which summary object they are | ||
* referencing from the previously acked summary. | ||
* Returns the uploaded summary handle. | ||
*/ | ||
uploadSummaryWithContext(summary: ISummaryTree, context: ISummaryContext): Promise<string>; | ||
/** | ||
* Retrieves the commit that matches the packfile handle. If the packfile has already been committed and the | ||
* server has deleted it this call may result in a broken promise. | ||
* | ||
* @deprecated - This API is deprecated and will be removed in a future release. No replacement is planned as | ||
* it is unused in the Runtime and below layers. | ||
*/ | ||
downloadSummary(handle: ISummaryHandle): Promise<ISummaryTree>; | ||
} | ||
/** | ||
* IContainerContext is fundamentally just the set of things that an IRuntimeFactory (and IRuntime) will consume from the | ||
@@ -124,6 +214,14 @@ * loader layer. | ||
readonly clientDetails: IClientDetails; | ||
readonly storage: IDocumentStorageService; | ||
readonly storage: IContainerStorageService; | ||
readonly connected: boolean; | ||
readonly baseSnapshot: ISnapshotTree | undefined; | ||
/** | ||
* Gets the current connection state of the container. | ||
* | ||
* @remarks | ||
* This provides more detailed connection state information beyond the simple boolean `connected` property. | ||
* Available starting from version 2.52.0. Property is not present in older versions. | ||
*/ | ||
readonly getConnectionState?: () => ConnectionState; | ||
/** | ||
* @deprecated Please use submitBatchFn & submitSummaryFn | ||
@@ -130,0 +228,0 @@ */ |
@@ -17,4 +17,4 @@ /*! | ||
export { ContainerErrorTypes } from "./error.js"; | ||
export type { ConnectionState, ICodeDetailsLoader, IContainer, IContainerEvents, IContainerLoadMode, IContainerPolicies, IFluidCodeResolver, IFluidModuleWithDetails, IHostLoader, ILoader, ILoaderHeader, ILoaderOptions, IProvideLoader, IResolvedFluidCodeDetails, ISnapshotTreeWithBlobContents, } from "./loader.js"; | ||
export { LoaderHeader } from "./loader.js"; | ||
export type { ICodeDetailsLoader, IContainer, IContainerEvents, IContainerLoadMode, IContainerPolicies, IFluidCodeResolver, IFluidModuleWithDetails, IHostLoader, ILoader, ILoaderHeader, ILoaderOptions, IProvideLoader, IResolvedFluidCodeDetails, ISnapshotTreeWithBlobContents, } from "./loader.js"; | ||
export { ConnectionState, LoaderHeader } from "./loader.js"; | ||
export type { IFluidModule } from "./fluidModule.js"; | ||
@@ -24,3 +24,3 @@ export type { IFluidPackage, IFluidPackageEnvironment, IFluidCodeDetails, IFluidCodeDetailsConfig, IProvideFluidCodeDetailsComparer, } from "./fluidPackage.js"; | ||
export type { IBatchMessage, IContainerContext, IProvideRuntimeFactory, IRuntime, IGetPendingLocalStateProps, } from "./runtime.js"; | ||
export { AttachState, IRuntimeFactory } from "./runtime.js"; | ||
export { AttachState, IRuntimeFactory, type IContainerStorageService } from "./runtime.js"; | ||
export type { | ||
@@ -27,0 +27,0 @@ /** |
@@ -8,5 +8,5 @@ /*! | ||
export { ContainerErrorTypes } from "./error.js"; | ||
export { LoaderHeader } from "./loader.js"; | ||
export { ConnectionState, LoaderHeader } from "./loader.js"; | ||
export { IFluidCodeDetailsComparer, isFluidPackage, isFluidCodeDetails, } from "./fluidPackage.js"; | ||
export { AttachState, IRuntimeFactory } from "./runtime.js"; | ||
//# sourceMappingURL=index.js.map |
@@ -39,2 +39,3 @@ /*! | ||
IContainerPolicies, | ||
IContainerStorageService, | ||
IDeltaManager, | ||
@@ -41,0 +42,0 @@ IDeltaManagerEvents, |
@@ -242,4 +242,8 @@ /*! | ||
*/ | ||
type Disconnected = 0; | ||
const Disconnected = 0; | ||
/** | ||
* {@inheritdoc @fluidframework/container-definitions#(ConnectionState:namespace).(Disconnected:variable)} | ||
*/ | ||
type Disconnected = typeof Disconnected; | ||
/** | ||
* The container is disconnected but actively trying to establish a new connection. | ||
@@ -249,13 +253,25 @@ * PLEASE NOTE that this numerical value falls out of the order you may expect for this state. | ||
*/ | ||
type EstablishingConnection = 3; | ||
const EstablishingConnection = 3; | ||
/** | ||
* {@inheritdoc @fluidframework/container-definitions#(ConnectionState:namespace).(EstablishingConnection:variable)} | ||
*/ | ||
type EstablishingConnection = typeof EstablishingConnection; | ||
/** | ||
* The container has an inbound connection only, and is catching up to the latest known state from the service. | ||
* @public | ||
*/ | ||
type CatchingUp = 1; | ||
const CatchingUp = 1; | ||
/** | ||
* {@inheritdoc @fluidframework/container-definitions#(ConnectionState:namespace).(CatchingUp:variable)} | ||
*/ | ||
type CatchingUp = typeof CatchingUp; | ||
/** | ||
* The container is fully connected and syncing. | ||
* @public | ||
*/ | ||
type Connected = 2; | ||
const Connected = 2; | ||
/** | ||
* {@inheritdoc @fluidframework/container-definitions#(ConnectionState:namespace).(Connected:variable)} | ||
*/ | ||
type Connected = typeof Connected; | ||
} | ||
@@ -397,3 +413,3 @@ /** | ||
* | ||
* {@link IContainer.connectionState} will be set to {@link (ConnectionState:namespace).Connected}, and the | ||
* {@link IContainer.connectionState} will be set to {@link (ConnectionState:namespace).(Connected:variable)}, and the | ||
* "connected" event will be fired if/when connection succeeds. | ||
@@ -407,3 +423,3 @@ */ | ||
* | ||
* {@link IContainer.connectionState} will be set to {@link (ConnectionState:namespace).Disconnected}, and the | ||
* {@link IContainer.connectionState} will be set to {@link (ConnectionState:namespace).(Disconnected:variable)}, and the | ||
* "disconnected" event will be fired when disconnection completes. | ||
@@ -419,3 +435,3 @@ */ | ||
* | ||
* Set once {@link IContainer.connectionState} is {@link (ConnectionState:namespace).Connected}, | ||
* Set once {@link IContainer.connectionState} is {@link (ConnectionState:namespace).(Connected:variable)}, | ||
* otherwise will be `undefined`. | ||
@@ -422,0 +438,0 @@ */ |
@@ -6,2 +6,34 @@ /*! | ||
/** | ||
* Namespace for the different connection states a container can be in. | ||
* PLEASE NOTE: The sequence of the numerical values does no correspond to the typical connection state progression. | ||
* @public | ||
*/ | ||
// eslint-disable-next-line @typescript-eslint/no-namespace | ||
export var ConnectionState; | ||
(function (ConnectionState) { | ||
/** | ||
* The container is not connected to the delta server. | ||
* Note - When in this state the container may be about to reconnect, | ||
* or may remain disconnected until explicitly told to connect. | ||
* @public | ||
*/ | ||
ConnectionState.Disconnected = 0; | ||
/** | ||
* The container is disconnected but actively trying to establish a new connection. | ||
* PLEASE NOTE that this numerical value falls out of the order you may expect for this state. | ||
* @public | ||
*/ | ||
ConnectionState.EstablishingConnection = 3; | ||
/** | ||
* The container has an inbound connection only, and is catching up to the latest known state from the service. | ||
* @public | ||
*/ | ||
ConnectionState.CatchingUp = 1; | ||
/** | ||
* The container is fully connected and syncing. | ||
* @public | ||
*/ | ||
ConnectionState.Connected = 2; | ||
})(ConnectionState || (ConnectionState = {})); | ||
/** | ||
* Accepted header keys for requests coming to the Loader | ||
@@ -8,0 +40,0 @@ * @legacy |
@@ -7,7 +7,7 @@ /*! | ||
import type { IClientDetails, IQuorumClients, ISummaryTree } from "@fluidframework/driver-definitions"; | ||
import type { IDocumentStorageService, ISnapshot, IDocumentMessage, ISnapshotTree, ISummaryContent, IVersion, MessageType, ISequencedDocumentMessage } from "@fluidframework/driver-definitions/internal"; | ||
import type { ISnapshot, IDocumentMessage, ISnapshotTree, ISummaryContent, IVersion, MessageType, ISequencedDocumentMessage, ICreateBlobResponse, ISummaryContext, ISnapshotFetchOptions, FetchSource, IDocumentStorageServicePolicies, ISummaryHandle } from "@fluidframework/driver-definitions/internal"; | ||
import type { IAudience } from "./audience.js"; | ||
import type { IDeltaManager } from "./deltas.js"; | ||
import type { ICriticalContainerError } from "./error.js"; | ||
import type { ILoader } from "./loader.js"; | ||
import type { ConnectionState, ILoader } from "./loader.js"; | ||
/** | ||
@@ -100,2 +100,92 @@ * The attachment state of some Fluid data (e.g. a container or data store), denoting whether it is uploaded to the | ||
/** | ||
* Interface to provide access to snapshots and policies to the Runtime layer. This should follow the Loader / Runtime | ||
* layer compatibility rules. | ||
* | ||
* @remarks It contains a subset of APIs from {@link @fluidframework/driver-definitions#IDocumentStorageService} but | ||
* allows the Runtime to not support layer compatibility with the Driver layer. Instead, it supports compatibility | ||
* with the Loader layer which it already does. | ||
* | ||
* @legacy | ||
* @alpha | ||
*/ | ||
export interface IContainerStorageService { | ||
/** | ||
* Whether or not the object has been disposed. | ||
* If true, the object should be considered invalid, and its other state should be disregarded. | ||
* | ||
* @deprecated - This API is deprecated and will be removed in a future release. No replacement is planned as | ||
* it is unused in the Runtime layer. | ||
*/ | ||
readonly disposed?: boolean; | ||
/** | ||
* Dispose of the object and its resources. | ||
* @param error - Optional error indicating the reason for the disposal, if the object was | ||
* disposed as the result of an error. | ||
* | ||
* @deprecated - This API is deprecated and will be removed in a future release. No replacement is planned as | ||
* it is unused in the Runtime layer. | ||
*/ | ||
dispose?(error?: Error): void; | ||
/** | ||
* Policies implemented/instructed by driver. | ||
* | ||
* @deprecated - This will be removed in a future release. The Runtime layer only needs `maximumCacheDurationMs` | ||
* policy which is added as a separate property. | ||
*/ | ||
readonly policies?: IDocumentStorageServicePolicies | undefined; | ||
/** | ||
* See {@link @fluidframework/driver-definitions#IDocumentStorageServicePolicies.maximumCacheDurationMs} | ||
*/ | ||
readonly maximumCacheDurationMs?: IDocumentStorageServicePolicies["maximumCacheDurationMs"]; | ||
/** | ||
* Returns the snapshot tree. | ||
* @param version - Version of the snapshot to be fetched. | ||
* @param scenarioName - scenario in which this api is called. This will be recorded by server and would help | ||
* in debugging purposes to see why this call was made. | ||
*/ | ||
getSnapshotTree(version?: IVersion, scenarioName?: string): Promise<ISnapshotTree | null>; | ||
/** | ||
* Returns the snapshot which can contain other artifacts too like blob contents, ops etc. It is different from | ||
* `getSnapshotTree` api in that, that API only returns the snapshot tree from the snapshot. | ||
* @param snapshotFetchOptions - Options specified by the caller to specify and want certain behavior from the | ||
* driver when fetching the snapshot. | ||
*/ | ||
getSnapshot?(snapshotFetchOptions?: ISnapshotFetchOptions): Promise<ISnapshot>; | ||
/** | ||
* Retrieves all versions of the document starting at the specified versionId - or null if from the head | ||
* @param versionId - Version id of the requested version. | ||
* @param count - Number of the versions to be fetched. | ||
* @param scenarioName - scenario in which this api is called. This will be recorded by server and would help | ||
* in debugging purposes to see why this call was made. | ||
* @param fetchSource - Callers can specify the source of the response. For ex. Driver may choose to cache | ||
* requests and serve data from cache. That will result in stale info returned. Callers can disable this | ||
* functionality by passing fetchSource = noCache and ensuring that driver will return latest information | ||
* from storage. | ||
*/ | ||
getVersions(versionId: string | null, count: number, scenarioName?: string, fetchSource?: FetchSource): Promise<IVersion[]>; | ||
/** | ||
* Creates a blob out of the given buffer | ||
*/ | ||
createBlob(file: ArrayBufferLike): Promise<ICreateBlobResponse>; | ||
/** | ||
* Reads the object with the given ID, returns content in arrayBufferLike | ||
*/ | ||
readBlob(id: string): Promise<ArrayBufferLike>; | ||
/** | ||
* Uploads a summary tree to storage using the given context for reference of previous summary handle. | ||
* The ISummaryHandles in the uploaded tree should have paths to indicate which summary object they are | ||
* referencing from the previously acked summary. | ||
* Returns the uploaded summary handle. | ||
*/ | ||
uploadSummaryWithContext(summary: ISummaryTree, context: ISummaryContext): Promise<string>; | ||
/** | ||
* Retrieves the commit that matches the packfile handle. If the packfile has already been committed and the | ||
* server has deleted it this call may result in a broken promise. | ||
* | ||
* @deprecated - This API is deprecated and will be removed in a future release. No replacement is planned as | ||
* it is unused in the Runtime and below layers. | ||
*/ | ||
downloadSummary(handle: ISummaryHandle): Promise<ISummaryTree>; | ||
} | ||
/** | ||
* IContainerContext is fundamentally just the set of things that an IRuntimeFactory (and IRuntime) will consume from the | ||
@@ -124,6 +214,14 @@ * loader layer. | ||
readonly clientDetails: IClientDetails; | ||
readonly storage: IDocumentStorageService; | ||
readonly storage: IContainerStorageService; | ||
readonly connected: boolean; | ||
readonly baseSnapshot: ISnapshotTree | undefined; | ||
/** | ||
* Gets the current connection state of the container. | ||
* | ||
* @remarks | ||
* This provides more detailed connection state information beyond the simple boolean `connected` property. | ||
* Available starting from version 2.52.0. Property is not present in older versions. | ||
*/ | ||
readonly getConnectionState?: () => ConnectionState; | ||
/** | ||
* @deprecated Please use submitBatchFn & submitSummaryFn | ||
@@ -130,0 +228,0 @@ */ |
{ | ||
"name": "@fluidframework/container-definitions", | ||
"version": "2.51.0", | ||
"version": "2.52.0", | ||
"description": "Fluid container definitions", | ||
@@ -50,4 +50,4 @@ "homepage": "https://fluidframework.com", | ||
"dependencies": { | ||
"@fluidframework/core-interfaces": "~2.51.0", | ||
"@fluidframework/driver-definitions": "~2.51.0" | ||
"@fluidframework/core-interfaces": "~2.52.0", | ||
"@fluidframework/driver-definitions": "~2.52.0" | ||
}, | ||
@@ -57,6 +57,6 @@ "devDependencies": { | ||
"@biomejs/biome": "~1.9.3", | ||
"@fluid-tools/build-cli": "^0.56.0", | ||
"@fluid-tools/build-cli": "^0.57.0", | ||
"@fluidframework/build-common": "^2.0.3", | ||
"@fluidframework/build-tools": "^0.56.0", | ||
"@fluidframework/container-definitions-previous": "npm:@fluidframework/container-definitions@2.50.0", | ||
"@fluidframework/build-tools": "^0.57.0", | ||
"@fluidframework/container-definitions-previous": "npm:@fluidframework/container-definitions@2.51.0", | ||
"@fluidframework/eslint-config-fluid": "^5.7.4", | ||
@@ -63,0 +63,0 @@ "@microsoft/api-extractor": "7.52.8", |
@@ -32,3 +32,2 @@ /*! | ||
export type { | ||
ConnectionState, | ||
ICodeDetailsLoader, | ||
@@ -49,3 +48,3 @@ IContainer, | ||
} from "./loader.js"; | ||
export { LoaderHeader } from "./loader.js"; | ||
export { ConnectionState, LoaderHeader } from "./loader.js"; | ||
export type { IFluidModule } from "./fluidModule.js"; | ||
@@ -71,3 +70,3 @@ export type { | ||
} from "./runtime.js"; | ||
export { AttachState, IRuntimeFactory } from "./runtime.js"; | ||
export { AttachState, IRuntimeFactory, type IContainerStorageService } from "./runtime.js"; | ||
@@ -74,0 +73,0 @@ export type { |
@@ -286,3 +286,7 @@ /*! | ||
*/ | ||
export type Disconnected = 0; | ||
export const Disconnected = 0; | ||
/** | ||
* {@inheritdoc @fluidframework/container-definitions#(ConnectionState:namespace).(Disconnected:variable)} | ||
*/ | ||
export type Disconnected = typeof Disconnected; | ||
@@ -294,3 +298,7 @@ /** | ||
*/ | ||
export type EstablishingConnection = 3; | ||
export const EstablishingConnection = 3; | ||
/** | ||
* {@inheritdoc @fluidframework/container-definitions#(ConnectionState:namespace).(EstablishingConnection:variable)} | ||
*/ | ||
export type EstablishingConnection = typeof EstablishingConnection; | ||
@@ -301,3 +309,7 @@ /** | ||
*/ | ||
export type CatchingUp = 1; | ||
export const CatchingUp = 1; | ||
/** | ||
* {@inheritdoc @fluidframework/container-definitions#(ConnectionState:namespace).(CatchingUp:variable)} | ||
*/ | ||
export type CatchingUp = typeof CatchingUp; | ||
@@ -308,3 +320,7 @@ /** | ||
*/ | ||
export type Connected = 2; | ||
export const Connected = 2; | ||
/** | ||
* {@inheritdoc @fluidframework/container-definitions#(ConnectionState:namespace).(Connected:variable)} | ||
*/ | ||
export type Connected = typeof Connected; | ||
} | ||
@@ -469,3 +485,3 @@ | ||
* | ||
* {@link IContainer.connectionState} will be set to {@link (ConnectionState:namespace).Connected}, and the | ||
* {@link IContainer.connectionState} will be set to {@link (ConnectionState:namespace).(Connected:variable)}, and the | ||
* "connected" event will be fired if/when connection succeeds. | ||
@@ -480,3 +496,3 @@ */ | ||
* | ||
* {@link IContainer.connectionState} will be set to {@link (ConnectionState:namespace).Disconnected}, and the | ||
* {@link IContainer.connectionState} will be set to {@link (ConnectionState:namespace).(Disconnected:variable)}, and the | ||
* "disconnected" event will be fired when disconnection completes. | ||
@@ -494,3 +510,3 @@ */ | ||
* | ||
* Set once {@link IContainer.connectionState} is {@link (ConnectionState:namespace).Connected}, | ||
* Set once {@link IContainer.connectionState} is {@link (ConnectionState:namespace).(Connected:variable)}, | ||
* otherwise will be `undefined`. | ||
@@ -497,0 +513,0 @@ */ |
@@ -17,3 +17,2 @@ /*! | ||
import type { | ||
IDocumentStorageService, | ||
ISnapshot, | ||
@@ -26,2 +25,8 @@ IDocumentMessage, | ||
ISequencedDocumentMessage, | ||
ICreateBlobResponse, | ||
ISummaryContext, | ||
ISnapshotFetchOptions, | ||
FetchSource, | ||
IDocumentStorageServicePolicies, | ||
ISummaryHandle, | ||
} from "@fluidframework/driver-definitions/internal"; | ||
@@ -32,3 +37,3 @@ | ||
import type { ICriticalContainerError } from "./error.js"; | ||
import type { ILoader } from "./loader.js"; | ||
import type { ConnectionState, ILoader } from "./loader.js"; | ||
@@ -136,2 +141,112 @@ /** | ||
/** | ||
* Interface to provide access to snapshots and policies to the Runtime layer. This should follow the Loader / Runtime | ||
* layer compatibility rules. | ||
* | ||
* @remarks It contains a subset of APIs from {@link @fluidframework/driver-definitions#IDocumentStorageService} but | ||
* allows the Runtime to not support layer compatibility with the Driver layer. Instead, it supports compatibility | ||
* with the Loader layer which it already does. | ||
* | ||
* @legacy | ||
* @alpha | ||
*/ | ||
export interface IContainerStorageService { | ||
/** | ||
* Whether or not the object has been disposed. | ||
* If true, the object should be considered invalid, and its other state should be disregarded. | ||
* | ||
* @deprecated - This API is deprecated and will be removed in a future release. No replacement is planned as | ||
* it is unused in the Runtime layer. | ||
*/ | ||
readonly disposed?: boolean; | ||
/** | ||
* Dispose of the object and its resources. | ||
* @param error - Optional error indicating the reason for the disposal, if the object was | ||
* disposed as the result of an error. | ||
* | ||
* @deprecated - This API is deprecated and will be removed in a future release. No replacement is planned as | ||
* it is unused in the Runtime layer. | ||
*/ | ||
dispose?(error?: Error): void; | ||
/** | ||
* Policies implemented/instructed by driver. | ||
* | ||
* @deprecated - This will be removed in a future release. The Runtime layer only needs `maximumCacheDurationMs` | ||
* policy which is added as a separate property. | ||
*/ | ||
readonly policies?: IDocumentStorageServicePolicies | undefined; | ||
/** | ||
* See {@link @fluidframework/driver-definitions#IDocumentStorageServicePolicies.maximumCacheDurationMs} | ||
*/ | ||
readonly maximumCacheDurationMs?: IDocumentStorageServicePolicies["maximumCacheDurationMs"]; | ||
/** | ||
* Returns the snapshot tree. | ||
* @param version - Version of the snapshot to be fetched. | ||
* @param scenarioName - scenario in which this api is called. This will be recorded by server and would help | ||
* in debugging purposes to see why this call was made. | ||
*/ | ||
// TODO: use `undefined` instead. | ||
// eslint-disable-next-line @rushstack/no-new-null | ||
getSnapshotTree(version?: IVersion, scenarioName?: string): Promise<ISnapshotTree | null>; | ||
/** | ||
* Returns the snapshot which can contain other artifacts too like blob contents, ops etc. It is different from | ||
* `getSnapshotTree` api in that, that API only returns the snapshot tree from the snapshot. | ||
* @param snapshotFetchOptions - Options specified by the caller to specify and want certain behavior from the | ||
* driver when fetching the snapshot. | ||
*/ | ||
getSnapshot?(snapshotFetchOptions?: ISnapshotFetchOptions): Promise<ISnapshot>; | ||
/** | ||
* Retrieves all versions of the document starting at the specified versionId - or null if from the head | ||
* @param versionId - Version id of the requested version. | ||
* @param count - Number of the versions to be fetched. | ||
* @param scenarioName - scenario in which this api is called. This will be recorded by server and would help | ||
* in debugging purposes to see why this call was made. | ||
* @param fetchSource - Callers can specify the source of the response. For ex. Driver may choose to cache | ||
* requests and serve data from cache. That will result in stale info returned. Callers can disable this | ||
* functionality by passing fetchSource = noCache and ensuring that driver will return latest information | ||
* from storage. | ||
*/ | ||
getVersions( | ||
// TODO: use `undefined` instead. | ||
// eslint-disable-next-line @rushstack/no-new-null | ||
versionId: string | null, | ||
count: number, | ||
scenarioName?: string, | ||
fetchSource?: FetchSource, | ||
): Promise<IVersion[]>; | ||
/** | ||
* Creates a blob out of the given buffer | ||
*/ | ||
createBlob(file: ArrayBufferLike): Promise<ICreateBlobResponse>; | ||
/** | ||
* Reads the object with the given ID, returns content in arrayBufferLike | ||
*/ | ||
readBlob(id: string): Promise<ArrayBufferLike>; | ||
/** | ||
* Uploads a summary tree to storage using the given context for reference of previous summary handle. | ||
* The ISummaryHandles in the uploaded tree should have paths to indicate which summary object they are | ||
* referencing from the previously acked summary. | ||
* Returns the uploaded summary handle. | ||
*/ | ||
uploadSummaryWithContext(summary: ISummaryTree, context: ISummaryContext): Promise<string>; | ||
/** | ||
* Retrieves the commit that matches the packfile handle. If the packfile has already been committed and the | ||
* server has deleted it this call may result in a broken promise. | ||
* | ||
* @deprecated - This API is deprecated and will be removed in a future release. No replacement is planned as | ||
* it is unused in the Runtime and below layers. | ||
*/ | ||
downloadSummary(handle: ISummaryHandle): Promise<ISummaryTree>; | ||
} | ||
/** | ||
* IContainerContext is fundamentally just the set of things that an IRuntimeFactory (and IRuntime) will consume from the | ||
@@ -161,6 +276,15 @@ * loader layer. | ||
readonly clientDetails: IClientDetails; | ||
readonly storage: IDocumentStorageService; | ||
readonly storage: IContainerStorageService; | ||
readonly connected: boolean; | ||
readonly baseSnapshot: ISnapshotTree | undefined; | ||
/** | ||
* Gets the current connection state of the container. | ||
* | ||
* @remarks | ||
* This provides more detailed connection state information beyond the simple boolean `connected` property. | ||
* Available starting from version 2.52.0. Property is not present in older versions. | ||
*/ | ||
readonly getConnectionState?: () => ConnectionState; | ||
/** | ||
* @deprecated Please use submitBatchFn & submitSummaryFn | ||
@@ -167,0 +291,0 @@ */ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
506062
8.33%6073
7.52%+ Added
+ Added
- Removed
- Removed