Skip to main content

@fluidframework/runtime-utils Package

Classes

ClassAlertsDescription
FluidHandleBaseLegacyBase class which can be uses to assist implementing IFluidHandleInternal.
RequestParserLegacyThe Request Parser takes an IRequest provides parsing and sub request creation
RuntimeFactoryHelperLegacy
SummaryTreeBuilderLegacyA helper class for building summary trees.

Functions

FunctionAlertsReturn TypeDescription
asLegacyAlpha(runtime)LegacyContainerRuntimeBaseAlphaConverts types to their alpha counterparts to expose alpha functionality.
asLegacyAlpha(runtime)LegacyIFluidDataStoreRuntimeAlphaConverts types to their alpha counterparts to expose alpha functionality.
compareFluidHandles(a, b)booleanCompare two IFluidHandles.
convertToSummaryTreeWithStats(snapshot, fullTree)LegacyISummaryTreeWithStatsConverts snapshot ITree to ISummaryTree format and tracks stats.
create404Response(request)LegacyIResponseCreates a 404 "not found" response for the given request
isFluidHandle(value)value is IFluidHandleCheck if a value is an @fluidframework/core-interfaces#IFluidHandle.
isFluidHandlePayloadPending(handle)Legacyhandle is IFluidHandlePayloadPending<T>Check if the handle is an IFluidHandlePayloadPending.
isLocalFluidHandle(handle)Legacyhandle is ILocalFluidHandle<T>Check if the handle is an ILocalFluidHandle.
lookupTemporaryBlobStorageId(containerRuntime, handle)Legacystring | undefinedLookup the blob storage ID for a blob handle.
toDeltaManagerInternal(deltaManager)LegacyIDeltaManager<ISequencedDocumentMessage, IDocumentMessage>Casts the public API for delta manager into the internal one, exposing access to APIs needed by the implementation of Fluid Framework but not its users.
toFluidHandleErased(handle)LegacyIFluidHandleErased<T>Type erase IFluidHandleInternal for use with fluidHandleSymbol.
toFluidHandleInternal(handle)LegacyIFluidHandleInternal<T>Downcast an IFluidHandle to an IFluidHandleInternal.

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/runtime-utils/legacy.

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

Signature

export declare function asLegacyAlpha(runtime: IContainerRuntimeBase): ContainerRuntimeBaseAlpha;

Parameters

ParameterTypeDescription
runtimeIContainerRuntimeBase

Returns

Return type: ContainerRuntimeBaseAlpha

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/runtime-utils/legacy.

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

Signature

export declare function asLegacyAlpha(runtime: IFluidDataStoreRuntime): IFluidDataStoreRuntimeAlpha;

Parameters

ParameterTypeDescription
runtimeIFluidDataStoreRuntime

Returns

Return type: IFluidDataStoreRuntimeAlpha

compareFluidHandles

Compare two IFluidHandles.

Signature

export declare function compareFluidHandles(a: IFluidHandle, b: IFluidHandle): boolean;

Remarks

Returns true iff both handles have the same internal absolutePath.

Parameters

ParameterTypeDescription
aIFluidHandle
bIFluidHandle

Returns

Return type: boolean

convertToSummaryTreeWithStats

Converts snapshot ITree to ISummaryTree format and tracks stats.

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

To use, import via @fluidframework/runtime-utils/legacy.

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

Signature

export declare function convertToSummaryTreeWithStats(snapshot: ITree, fullTree?: boolean): ISummaryTreeWithStats;

Parameters

ParameterModifiersTypeDescription
snapshotITreesnapshot in ITree format
fullTreeoptionalbooleantrue to never use handles, even if id is specified

Returns

Return type: ISummaryTreeWithStats

create404Response

Creates a 404 "not found" response for the given request

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

To use, import via @fluidframework/runtime-utils/legacy.

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

Signature

create404Response: (request: IRequest) => IResponse

Parameters

ParameterTypeDescription
requestIRequestThe request that resulted in the 404 response

Returns

An IResponse with 404 status code.

Return type: IResponse

isFluidHandle

Check if a value is an @fluidframework/core-interfaces#IFluidHandle.

Signature

export declare function isFluidHandle(value: unknown): value is IFluidHandle;

Remarks

Objects which have a field named IFluidHandle can in some cases produce a false positive.

Parameters

ParameterTypeDescription
valueunknown

Returns

Return type: value is IFluidHandle

isFluidHandlePayloadPending

Check if the handle is an IFluidHandlePayloadPending.

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

To use, import via @fluidframework/runtime-utils/legacy.

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

Signature

isFluidHandlePayloadPending: <T>(handle: IFluidHandle<T>) => handle is IFluidHandlePayloadPending<T>
Type Parameters
ParameterDescription
T

Parameters

ParameterTypeDescription
handleIFluidHandle<T>

Returns

Return type: handle is IFluidHandlePayloadPending<T>

isLocalFluidHandle

Check if the handle is an ILocalFluidHandle.

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

To use, import via @fluidframework/runtime-utils/legacy.

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

Signature

isLocalFluidHandle: <T>(handle: IFluidHandle<T>) => handle is ILocalFluidHandle<T>
Type Parameters
ParameterDescription
T

Parameters

ParameterTypeDescription
handleIFluidHandle<T>

Returns

Return type: handle is ILocalFluidHandle<T>

lookupTemporaryBlobStorageId

Lookup the blob storage ID for a blob handle.

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

To use, import via @fluidframework/runtime-utils/legacy.

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

Signature

export declare function lookupTemporaryBlobStorageId(containerRuntime: IContainerRuntime, handle: IFluidHandle): string | undefined;

Remarks

This is a legacy+alpha helper function that provides access to blob storage IDs. For blobs with pending payloads (localId exists but upload hasn't finished), this is expected to return undefined. Consumers should use the observability APIs on the handle (handle.payloadState, payloadShared event) to understand/wait for storage ID availability. Similarly, when the runtime is detached, this will return undefined as no blobs have been uploaded to storage.

Warning: the returned blob URL may expire and does not support permalinks. This API is intended for temporary integration scenarios only.

Parameters

ParameterTypeDescription
containerRuntimeIContainerRuntimeThe container runtime instance
handleIFluidHandleThe blob handle to lookup the storage ID for

Returns

The storage ID if found and the blob is not pending, undefined otherwise

Return type: string | undefined

toDeltaManagerInternal

Casts the public API for delta manager into the internal one, exposing access to APIs needed by the implementation of Fluid Framework but not its users.

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

To use, import via @fluidframework/runtime-utils/legacy.

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

Signature

export declare function toDeltaManagerInternal(deltaManager: IDeltaManagerErased): IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>;

Parameters

ParameterTypeDescription
deltaManagerIDeltaManagerErased

Returns

Return type: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>

toFluidHandleErased

Type erase IFluidHandleInternal for use with fluidHandleSymbol.

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

To use, import via @fluidframework/runtime-utils/legacy.

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

Signature

export declare function toFluidHandleErased<T>(handle: IFluidHandleInternal<T>): IFluidHandleErased<T>;
Type Parameters
ParameterDescription
T

Parameters

ParameterTypeDescription
handleIFluidHandleInternal<T>

Returns

Return type: IFluidHandleErased<T>

toFluidHandleInternal

Downcast an IFluidHandle to an IFluidHandleInternal.

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

To use, import via @fluidframework/runtime-utils/legacy.

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

Signature

export declare function toFluidHandleInternal<T>(handle: IFluidHandle<T>): IFluidHandleInternal<T>;
Type Parameters
ParameterDescription
T

Parameters

ParameterTypeDescription
handleIFluidHandle<T>

Returns

Return type: IFluidHandleInternal<T>