Skip to main content

@fluidframework/container-loader Package

Interfaces

InterfaceAlertsModifiersDescription
ContainerAlphaLegacysealedIContainer interface that includes experimental features still under development.
IBaseProtocolHandlerLegacy
ICaptureFullContainerStatePropsLegacyProperties for captureFullContainerState({ urlResolver, documentServiceFactory, request, logger, }, input).
ICodeDetailsLoaderDeprecated, Legacy
ICreateAndLoadContainerPropsLegacyProperties necessary for creating and loading a container.
ICreateDetachedContainerPropsLegacyProps used to create a detached container.
IFluidModuleWithDetailsDeprecated, Legacy
ILoaderPropsLegacyServices and properties necessary for creating a loader
ILoaderServicesLegacyServices and properties used by and exposed by the loader
ILoadExistingContainerPropsLegacyProps used to load a container.
ILoadFrozenContainerFromPendingStatePropsLegacyProperties required to load a frozen container from pending state.
IParsedUrlLegacyInterface to represent the parsed parts of IResolvedUrl.url to help in getting info about different parts of the url. May not be compatible or relevant for any Url Resolver
IProtocolHandlerLegacy
IQuorumSnapshotLegacySnapshot format for a Quorum
IRehydrateDetachedContainerPropsLegacyProps used to rehydrate a detached container.
IScribeProtocolStateLegacy
OnDemandSummaryResultsLegacyResults from an on-demand summary request.

Classes

ClassAlertsDescription
LoaderLegacyManages Fluid resource loading
PendingLocalStateStoreLegacyA Map-like store for managing pending local container states from attached containers. Optimizes storage by deduplicating shared resources across stored states.

Enumerations

EnumDescription
ConnectionStateThe state of the Container's connection to the service.

Types

TypeAliasAlertsDescription
ILoadSummarizerContainerPropsLegacyProps used to load summarizer container.
LoadSummarizerSummaryResultLegacyOutcome from loadSummarizerContainerAndMakeSummary(loadSummarizerContainerProps).
ProtocolHandlerBuilderLegacyFunction to be used for creating a protocol handler.
QuorumClientsSnapshotLegacySnapshot format for a QuorumClients
QuorumProposalsSnapshotLegacySnapshot format for a QuorumProposals
SummaryStageLegacy

Stages of summary process.

Stages:

  1. "base" - stopped before the summary tree was even generated, and the result only contains the base data
  1. "generate" - the summary tree was generated, and the result will contain that tree + stats
  1. "upload" - the summary was uploaded to storage, and the result contains the server-provided handle
  1. "submit" - the summarize op was submitted, and the result contains the op client sequence number.

Functions

FunctionAlertsReturn TypeDescription
asLegacyAlpha(base)LegacyContainerAlphaConverts types to their alpha counterparts to expose alpha functionality.
captureFullContainerState({ urlResolver, documentServiceFactory, request, logger, }, input)LegacyPromise<string>

Captures the current state of an attached container using only driver-level services, without instantiating a runtime or loading a full container. The returned string is a serialized pending container state in the same wire format produced by a live container's pending-state serialization, and can be handed to loadExistingContainer(loadExistingContainerProps) as pendingLocalState.

The output is a self-contained view of the container's referenced graph: the latest snapshot, inlined contents of every blob reachable through referenced subtrees, inlined contents of every referenced attachment blob keyed by storage id, and all ops with sequence numbers after the base snapshot's sequence number (as read from its attributes blob).

Reachability respects GC. Snapshot subtrees flagged unreferenced: true are skipped (their contents are not inlined). Attachment blobs that GC has marked unreferenced, tombstoned, or deleted are skipped. When the snapshot has no GC tree (GC disabled or pre-GC document), no filtering is applied.

Blob reads on load hit the ContainerStorageAdapter cache populated from the captured snapshotBlobs map, so a frozen loader can serve the full referenced graph without a live storage service.

pendingRuntimeState is undefined — no runtime is instantiated — so the output cannot carry DDS-level in-flight changes. It is intended for state relay, inspection, and durable-state snapshot use cases.

Containers that declare loading groups are not yet supported: the function throws UsageError if any referenced subtree carries a groupId. Group snapshots would need a separate prefetch + serialization path; until there is a known consumer and end-to-end coverage, the capture refuses rather than silently producing pending state that omits group data.

Note: if a new snapshot lands between the snapshot fetch and the ops fetch, the returned state may not reflect the very latest snapshot, but remains internally consistent: ops are anchored to the snapshot that was captured.

No mixinMonitoringContext / configProvider is wired here, deliberately diverging from the sibling entry points in this file. The function reads no feature flags and instantiates no runtime, so there is nothing for a monitoring context to gate or attribute. If a future change introduces config-gated behavior or runtime-attributed telemetry, add the wiring back together with that change.

createDetachedContainer(createDetachedContainerProps)LegacyPromise<IContainer>Creates a new container using the specified code details but in an unattached state. While unattached, all updates will only be local until the user explicitly attaches the container to a service provider.
createFrozenDocumentServiceFactory(factory, readOnly)LegacyIDocumentServiceFactoryCreates an IDocumentServiceFactory that produces a "frozen" document service: one whose delta stream never sends or receives ops, and whose storage service only supports IDocumentStorageService.readBlob. Used to load a container from pending local state without re-establishing a live connection.
loadExistingContainer(loadExistingContainerProps)LegacyPromise<IContainer>Loads a container with an existing snapshot from the service.
loadFrozenContainerFromPendingState(props)LegacyPromise<IContainer>Loads a frozen container from pending local state.
loadSummarizerContainerAndMakeSummary(loadSummarizerContainerProps)LegacyPromise<LoadSummarizerSummaryResult>Loads a summarizer container with the required headers, triggers an on-demand summary, and then closes it. Returns success/failure and an optional error for host-side handling.
rehydrateDetachedContainer(rehydrateDetachedContainerProps)LegacyPromise<IContainer>Creates a new container using the specified snapshot but in an unattached state. While unattached, all updates will only be local until the user explicitly attaches the container to a service provider.
resolveWithLocationRedirectionHandling(api, request, urlResolver, logger)LegacyPromise<T>Handles location redirection while fulfilling the loader request.
tryParseCompatibleResolvedUrl(url)LegacyIParsedUrl | undefinedUtility api to parse the IResolvedUrl.url into specific parts like querystring, path to get deep link info etc. Warning - This function may not be compatible with any Url Resolver's resolved url. It works with urls of type: protocol:///.../..?
waitContainerToCatchUp(container)LegacyPromise<boolean>

Waits until container connects to delta storage and gets up-to-date.

Useful when resolving URIs and hitting 404, due to container being loaded from (stale) snapshot and not being up to date. Host may chose to wait in such case and retry resolving URI.

Warning: Will wait infinitely for connection to establish if there is no connection. May result in deadlock if Container.disconnect() is called and never followed by a call to Container.connect().

Function Details

asLegacyAlpha

Converts types to their alpha counterparts to expose alpha functionality.

This API is provided for existing users, but is not recommended for new users.

To use, import via @fluidframework/container-loader/legacy.

For more information about our API support guarantees, see here.

Signature

export declare function asLegacyAlpha(base: IContainer): ContainerAlpha;

Remarks

For getPendingLocalState, prefer calling IContainer.getPendingLocalState directly on the @legacy @beta surface. This helper is retained for callers that need the typed-required shape and will be removed in a future breaking release.

Parameters

ParameterTypeDescription
baseIContainer

Returns

Return type: ContainerAlpha

captureFullContainerState

Captures the current state of an attached container using only driver-level services, without instantiating a runtime or loading a full container. The returned string is a serialized pending container state in the same wire format produced by a live container's pending-state serialization, and can be handed to loadExistingContainer(loadExistingContainerProps) as pendingLocalState.

The output is a self-contained view of the container's referenced graph: the latest snapshot, inlined contents of every blob reachable through referenced subtrees, inlined contents of every referenced attachment blob keyed by storage id, and all ops with sequence numbers after the base snapshot's sequence number (as read from its attributes blob).

Reachability respects GC. Snapshot subtrees flagged unreferenced: true are skipped (their contents are not inlined). Attachment blobs that GC has marked unreferenced, tombstoned, or deleted are skipped. When the snapshot has no GC tree (GC disabled or pre-GC document), no filtering is applied.

Blob reads on load hit the ContainerStorageAdapter cache populated from the captured snapshotBlobs map, so a frozen loader can serve the full referenced graph without a live storage service.

pendingRuntimeState is undefined — no runtime is instantiated — so the output cannot carry DDS-level in-flight changes. It is intended for state relay, inspection, and durable-state snapshot use cases.

Containers that declare loading groups are not yet supported: the function throws UsageError if any referenced subtree carries a groupId. Group snapshots would need a separate prefetch + serialization path; until there is a known consumer and end-to-end coverage, the capture refuses rather than silently producing pending state that omits group data.

Note: if a new snapshot lands between the snapshot fetch and the ops fetch, the returned state may not reflect the very latest snapshot, but remains internally consistent: ops are anchored to the snapshot that was captured.

No mixinMonitoringContext / configProvider is wired here, deliberately diverging from the sibling entry points in this file. The function reads no feature flags and instantiates no runtime, so there is nothing for a monitoring context to gate or attribute. If a future change introduces config-gated behavior or runtime-attributed telemetry, add the wiring back together with that change.

This API is provided for existing users, but is not recommended for new users.

To use, import via @fluidframework/container-loader/legacy.

For more information about our API support guarantees, see here.

Signature

export declare function captureFullContainerState(input: ICaptureFullContainerStateProps): Promise<string>;

Parameters

ParameterTypeDescription
{ urlResolver, documentServiceFactory, request, logger, }
inputICaptureFullContainerStateProps

Returns

Return type: Promise<string>

createDetachedContainer

Creates a new container using the specified code details but in an unattached state. While unattached, all updates will only be local until the user explicitly attaches the container to a service provider.

This API is provided for existing users, but is not recommended for new users.

To use, import via @fluidframework/container-loader/legacy.

For more information about our API support guarantees, see here.

Signature

export declare function createDetachedContainer(createDetachedContainerProps: ICreateDetachedContainerProps): Promise<IContainer>;

Parameters

ParameterTypeDescription
createDetachedContainerPropsICreateDetachedContainerPropsServices and properties necessary for creating detached container.

Returns

Return type: Promise<IContainer>

createFrozenDocumentServiceFactory

Creates an IDocumentServiceFactory that produces a "frozen" document service: one whose delta stream never sends or receives ops, and whose storage service only supports IDocumentStorageService.readBlob. Used to load a container from pending local state without re-establishing a live connection.

This API is provided for existing users, but is not recommended for new users.

To use, import via @fluidframework/container-loader/legacy.

For more information about our API support guarantees, see here.

Signature

export declare function createFrozenDocumentServiceFactory(factory?: IDocumentServiceFactory | Promise<IDocumentServiceFactory>, readOnly?: boolean): IDocumentServiceFactory;

Parameters

ParameterModifiersTypeDescription
factoryoptionalIDocumentServiceFactory | Promise<IDocumentServiceFactory>The underlying factory to wrap. Its storage backs blob reads; all other storage operations throw. May be omitted when blob fetches are not required.
readOnlyoptionalboolean

When true (the default), the document service advertises the IDocumentServicePolicies.storageOnly policy, which causes the loader to surface the container as read-only (see IContainer.readOnlyInfo).

When false, the container is loaded as writable so the runtime will accept DDS submissions. The connection itself stays Connected: ConnectionManager.sendMessages recognizes the WritableFrozenDeltaStream as the live connection and short-circuits — the message is dropped at the network layer rather than triggering a read→write reconnect. Local DDS state continues to update via optimistic apply, and submitted ops accumulate in the runtime's pending-state manager, which is exactly the state needed to capture pending local state. Use false when callers want to accrue and capture pending state without publishing it.

Returns

A factory that produces frozen document services.

Return type: IDocumentServiceFactory

loadExistingContainer

Loads a container with an existing snapshot from the service.

This API is provided for existing users, but is not recommended for new users.

To use, import via @fluidframework/container-loader/legacy.

For more information about our API support guarantees, see here.

Signature

export declare function loadExistingContainer(loadExistingContainerProps: ILoadExistingContainerProps): Promise<IContainer>;

Parameters

ParameterTypeDescription
loadExistingContainerPropsILoadExistingContainerPropsServices and properties necessary for loading an existing container.

Returns

Return type: Promise<IContainer>

loadFrozenContainerFromPendingState

Loads a frozen container from pending local state.

This API is provided for existing users, but is not recommended for new users.

To use, import via @fluidframework/container-loader/legacy.

For more information about our API support guarantees, see here.

Signature

export declare function loadFrozenContainerFromPendingState(props: ILoadFrozenContainerFromPendingStateProps): Promise<IContainer>;

Parameters

ParameterTypeDescription
propsILoadFrozenContainerFromPendingStatePropsProperties required to load a frozen container from pending state.

Returns

Return type: Promise<IContainer>

loadSummarizerContainerAndMakeSummary

Loads a summarizer container with the required headers, triggers an on-demand summary, and then closes it. Returns success/failure and an optional error for host-side handling.

This API is provided for existing users, but is not recommended for new users.

To use, import via @fluidframework/container-loader/legacy.

For more information about our API support guarantees, see here.

Signature

export declare function loadSummarizerContainerAndMakeSummary(loadSummarizerContainerProps: ILoadSummarizerContainerProps): Promise<LoadSummarizerSummaryResult>;

Parameters

ParameterTypeDescription
loadSummarizerContainerPropsILoadSummarizerContainerProps

Returns

Return type: Promise<LoadSummarizerSummaryResult>

rehydrateDetachedContainer

Creates a new container using the specified snapshot but in an unattached state. While unattached, all updates will only be local until the user explicitly attaches the container to a service provider.

This API is provided for existing users, but is not recommended for new users.

To use, import via @fluidframework/container-loader/legacy.

For more information about our API support guarantees, see here.

Signature

export declare function rehydrateDetachedContainer(rehydrateDetachedContainerProps: IRehydrateDetachedContainerProps): Promise<IContainer>;

Parameters

ParameterTypeDescription
rehydrateDetachedContainerPropsIRehydrateDetachedContainerPropsServices and properties necessary for rehydrating detached container from a previously serialized container's state.

Returns

Return type: Promise<IContainer>

resolveWithLocationRedirectionHandling

Handles location redirection while fulfilling the loader request.

This API is provided for existing users, but is not recommended for new users.

To use, import via @fluidframework/container-loader/legacy.

For more information about our API support guarantees, see here.

Signature

export declare function resolveWithLocationRedirectionHandling<T>(api: (request: IRequest) => Promise<T>, request: IRequest, urlResolver: IUrlResolver, logger?: ITelemetryBaseLogger): Promise<T>;
Type Parameters
ParameterDescription
T

Parameters

ParameterModifiersTypeDescription
api(request: IRequest) => Promise<T>Callback in which user can wrap the loader.resolve or loader.request call.
requestIRequestrequest to be resolved.
urlResolverIUrlResolverresolver used to resolve the url.
loggeroptionalITelemetryBaseLoggerlogger to send events.

Returns

Response from the API call.

Return type: Promise<T>

tryParseCompatibleResolvedUrl

Utility api to parse the IResolvedUrl.url into specific parts like querystring, path to get deep link info etc. Warning - This function may not be compatible with any Url Resolver's resolved url. It works with urls of type: protocol:///.../..?

This API is provided for existing users, but is not recommended for new users.

To use, import via @fluidframework/container-loader/legacy.

For more information about our API support guarantees, see here.

Signature

export declare function tryParseCompatibleResolvedUrl(url: string): IParsedUrl | undefined;

Parameters

ParameterTypeDescription
urlstringThis is the IResolvedUrl.url part of the resolved url.

Returns

The IParsedUrl representing the input URL, or undefined if the format was not supported

Return type: IParsedUrl | undefined

waitContainerToCatchUp

Waits until container connects to delta storage and gets up-to-date.

Useful when resolving URIs and hitting 404, due to container being loaded from (stale) snapshot and not being up to date. Host may chose to wait in such case and retry resolving URI.

Warning: Will wait infinitely for connection to establish if there is no connection. May result in deadlock if Container.disconnect() is called and never followed by a call to Container.connect().

This API is provided for existing users, but is not recommended for new users.

To use, import via @fluidframework/container-loader/legacy.

For more information about our API support guarantees, see here.

Signature

export declare function waitContainerToCatchUp(container: IContainer): Promise<boolean>;

Parameters

ParameterTypeDescription
containerIContainer

Returns

true: container is up to date, it processed all the ops that were know at the time of first connection.

false: storage does not provide indication of how far the client is. Container processed all the ops known to it, but it maybe still behind.

Return type: Promise<boolean>

Error Handling

an error beginning with "Container closed" if the container is closed before it catches up.