Skip to main content

@fluidframework/odsp-driver Package

Interfaces​

InterfaceAlertsDescription
ICacheAndTrackerLegacy
INonPersistentCacheLegacyInternal cache interface used within driver only
IOdspCacheLegacyInternal cache interface used within driver only
IOdspDocumentServiceFactoryOptionsLegacyOptions for creating an ODSP document service factory.
IOdspPointInTimeDocumentServiceImplementationPropsLegacyInputs supplied by the ODSP document service factory to an injected point-in-time implementation.
IOdspResponseLegacy
IPersistedFileCacheLegacySimilar to IPersistedCache, but exposes cache interface for single file
IPointInTimeDocumentServiceFactoryLegacyAn ODSP document service factory that supports point-in-time (sequence-number-based) loading.
IPrefetchSnapshotContentsLegacy
ISnapshotContentsDeprecated, Legacy
OdspFluidDataStoreLocatorLegacy
ShareLinkFetcherPropsLegacyProperties passed to the code responsible for fetching share link for a file.

Classes​

ClassAlertsDescription
EpochTrackerLegacy

In ODSP, the concept of "epoch" refers to binary updates to files. For example, this might include using version restore, or if the user downloads a Fluid file and then uploads it again. These result in the epoch value being incremented.

The implications of these binary updates is that the Fluid state is disrupted: the sequence number might go backwards, the data might be inconsistent with the latest state of collaboration, etc. As a result, it's not safe to continue collaboration across an epoch change. We need to detect these epoch changes and error out from the collaboration.

This class is a wrapper around fetch calls. It adds epoch to the request made so that the server can match it with its epoch value in order to match the version. It also validates the epoch value received in response of fetch calls. If the epoch does not match, then it also clears all the cached entries for the given container.

OdspDocumentServiceFactoryLegacyFactory for creating the sharepoint document service. Use this if you want to use the sharepoint implementation.
OdspDocumentServiceFactoryCoreLegacyFactory for creating the sharepoint document service. Use this if you want to use the sharepoint implementation.
OdspDriverUrlResolverLegacyResolver to resolve urls like the ones created by createOdspUrl which is driver inner url format. Ex: ${siteUrl}?driveId=${driveId}&itemId=${itemId}&path=${path}
OdspDriverUrlResolverForShareLinkLegacyResolver to resolve urls like the ones created by createOdspUrl which is driver inner url format and the ones which have things like driveId, siteId, itemId etc encoded in nav param. This resolver also handles share links and try to generate one for the use by the app.

Enumerations​

EnumAlertsDescription
SnapshotFormatSupportTypeLegacyEnum to support different types of snapshot formats.

Types​

TypeAliasAlertsDescription
FetchTypeLegacy
FetchTypeInternalLegacy
OdspPointInTimeDocumentServiceImplementationLegacyConsumer-provided implementation of ODSP point-in-time loading.

Functions​

FunctionAlertsReturn TypeDescription
checkUrl(documentUrl)LegacyDriverPreCheckInfo | undefinedA check that returns DriverPreCheckInfo if the URL format is likely supported by this driver. Note that returning information here is NOT a full guarantee that resolve will ultimately be successful. Instead, this should be used as a lightweight check that can filter out easily detectable unsupported URLs before the entire Fluid loading process needs to be kicked off.
createLocalOdspDocumentServiceFactory(localSnapshot)LegacyIDocumentServiceFactoryCreates a factory instance for creating a sharepoint document service from a provided snapshot.
createOdspCreateContainerRequest(siteUrl, driveId, filePath, fileName, createShareLinkType, containerPackageInfo)LegacyIRequestCreate the request object with url and headers for creating a new file on OneDrive Sharepoint
createOdspDocumentServiceFactory(options)LegacyOdspDocumentServiceFactoryCreates an ODSP document service factory with optional consumer-provided features.
createOdspUrl(l)LegacystringEncodes ODC/SPO information into a URL format that can be handled by the Loader
encodeOdspFluidDataStoreLocator(locator)LegacystringTransforms given Fluid data store locator into string that can be embedded into url
getHashedDocumentId(driveId, itemId)LegacyPromise<string>Creates a unique and stable id for a document stored in ODSP which doesn't expose the driveId and itemId of said document.
getLocatorFromOdspUrl(url, requireFluidSignature)LegacyOdspFluidDataStoreLocator | undefinedExtract ODSP Fluid data store locator object from given ODSP url. This extracts things like driveId, ItemId, siteUrl etc from a url where these are encoded in nav query param.
getOdspPointInTimeDocumentServiceFactory(getStorageToken, getWebsocketToken, persistedCache, hostPolicy)Deprecated, LegacyIPointInTimeDocumentServiceFactoryCreates an ODSP document service factory that supports point-in-time loading.
isOdspResolvedUrl(resolvedUrl)LegacyresolvedUrl is IOdspResolvedUrlType narrowing utility to determine if the provided IResolvedUrl is an IOdspResolvedUrl.
prefetchLatestSnapshot(resolvedUrl, getStorageToken, persistedCache, _forceAccessTokenViaAuthorizationHeader, logger, hostSnapshotFetchOptions, enableRedeemFallback, _fetchBinarySnapshotFormat, _snapshotFormatFetchType, odspDocumentServiceFactory)LegacyPromise<boolean>Function to prefetch the snapshot and cached it in the persistent cache, so that when the container is loaded the cached latest snapshot could be used and removes the network call from the critical path.
storeLocatorInOdspUrl(url, locator)LegacyvoidEmbeds Fluid data store locator data into given ODSP url

Variables​

VariableAlertsModifiersTypeDescription
locatorQueryParamNameLegacyreadonlyThis parameter is provided by host in the resolve request and it contains information about the file like driveId, itemId, siteUrl, datastorePath, packageName etc.
OdcApiSiteOriginLegacyreadonly
OdcFileSiteOriginLegacyreadonly

Function Details​

checkUrl​

A check that returns DriverPreCheckInfo if the URL format is likely supported by this driver. Note that returning information here is NOT a full guarantee that resolve will ultimately be successful. Instead, this should be used as a lightweight check that can filter out easily detectable unsupported URLs before the entire Fluid loading process needs to be kicked off.

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

To use, import via @fluidframework/odsp-driver/legacy.

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

Signature​

export declare function checkUrl(documentUrl: URL): DriverPreCheckInfo | undefined;

Parameters​

ParameterTypeDescription
documentUrlURL

Returns​

Return type: DriverPreCheckInfo | undefined

createLocalOdspDocumentServiceFactory​

Creates a factory instance for creating a sharepoint document service from a provided snapshot.

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

To use, import via @fluidframework/odsp-driver/legacy.

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

Signature​

export declare function createLocalOdspDocumentServiceFactory(localSnapshot: Uint8Array | string): IDocumentServiceFactory;

Remarks​

Use if you don't want to connect to any kind of external/internal storages and want to provide content directly.

Parameters​

ParameterTypeDescription
localSnapshotUint8Array | string

Returns​

Return type: IDocumentServiceFactory

createOdspCreateContainerRequest​

Create the request object with url and headers for creating a new file on OneDrive Sharepoint

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

To use, import via @fluidframework/odsp-driver/legacy.

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

Signature​

export declare function createOdspCreateContainerRequest(siteUrl: string, driveId: string, filePath: string, fileName: string, createShareLinkType?: ISharingLinkKind, containerPackageInfo?: IContainerPackageInfo | undefined): IRequest;

Parameters​

ParameterModifiersTypeDescription
siteUrlstringBase url for OneDrive
driveIdstringdrive identifier
filePathstringpath where file needs to be created
fileNamestringname of the new file to be created
createShareLinkTypeoptionalISharingLinkKindtype of sharing link you would like to create for this file. ShareLinkTypes will be deprecated soon, so for any new implementation please provide createShareLinkType of type ShareLink
containerPackageInfooptionalIContainerPackageInfo | undefinedContainer package information which will be used to extract the container package name. If not given that means that the container package does not have a name.

Returns​

Return type: IRequest

createOdspDocumentServiceFactory​

Creates an ODSP document service factory with optional consumer-provided features.

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

To use, import via @fluidframework/odsp-driver/legacy.

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

Signature​

export declare function createOdspDocumentServiceFactory(options: IOdspDocumentServiceFactoryOptions): OdspDocumentServiceFactory;

Parameters​

ParameterTypeDescription
optionsIOdspDocumentServiceFactoryOptionsTokens, cache, host policy, and optional feature implementations.

Returns​

The configured ODSP document service factory.

Return type: OdspDocumentServiceFactory

createOdspUrl​

Encodes ODC/SPO information into a URL format that can be handled by the Loader

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

To use, import via @fluidframework/odsp-driver/legacy.

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

Signature​

export declare function createOdspUrl(l: OdspFluidDataStoreLocator): string;

Parameters​

ParameterTypeDescription
lOdspFluidDataStoreLocatorThe property bag of necessary properties to locate a Fluid data store and craft a url for it

Returns​

Return type: string

encodeOdspFluidDataStoreLocator​

Transforms given Fluid data store locator into string that can be embedded into url

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

To use, import via @fluidframework/odsp-driver/legacy.

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

Signature​

export declare function encodeOdspFluidDataStoreLocator(locator: OdspFluidDataStoreLocator): string;

Parameters​

ParameterTypeDescription
locatorOdspFluidDataStoreLocatordescribes Fluid data store locator info to be encoded

Returns​

string representing encoded Fluid data store locator info

Return type: string

getHashedDocumentId​

Creates a unique and stable id for a document stored in ODSP which doesn't expose the driveId and itemId of said document.

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

To use, import via @fluidframework/odsp-driver/legacy.

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

Signature​

export declare function getHashedDocumentId(driveId: string, itemId: string): Promise<string>;

Parameters​

ParameterTypeDescription
driveIdstring
itemIdstring

Returns​

Return type: Promise<string>

getLocatorFromOdspUrl​

Extract ODSP Fluid data store locator object from given ODSP url. This extracts things like driveId, ItemId, siteUrl etc from a url where these are encoded in nav query param.

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

To use, import via @fluidframework/odsp-driver/legacy.

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

Signature​

export declare function getLocatorFromOdspUrl(url: URL, requireFluidSignature?: boolean): OdspFluidDataStoreLocator | undefined;

Parameters​

ParameterModifiersTypeDescription
urlURLODSP url representing Fluid file link
requireFluidSignatureoptionalbooleanflag representing if the Fluid signature is expected in the url, default true

Returns​

object representing Fluid data store location in ODSP terms

Return type: OdspFluidDataStoreLocator | undefined

getOdspPointInTimeDocumentServiceFactory​

Creates an ODSP document service factory that supports point-in-time loading.

This API is deprecated and will be removed in a future release.

Use createOdspDocumentServiceFactory(options) with a point-in-time implementation instead. See https://github.com/microsoft/FluidFramework/issues/26500 for context.

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

To use, import via @fluidframework/odsp-driver/legacy.

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

Signature​

export declare function getOdspPointInTimeDocumentServiceFactory(getStorageToken: TokenFetcher<OdspResourceTokenFetchOptions>, getWebsocketToken: TokenFetcher<OdspResourceTokenFetchOptions> | undefined, persistedCache?: IPersistedCache, hostPolicy?: HostStoragePolicy): IPointInTimeDocumentServiceFactory;

Parameters​

ParameterModifiersTypeDescription
getStorageTokenTokenFetcher<OdspResourceTokenFetchOptions>Fetches storage access tokens.
getWebsocketTokenTokenFetcher<OdspResourceTokenFetchOptions> | undefinedFetches websocket access tokens, or undefined when unavailable.
persistedCacheoptionalIPersistedCacheOptional persisted ODSP cache.
hostPolicyoptionalHostStoragePolicyOptional host storage policy.

Returns​

An ODSP document service factory with point-in-time loading capability.

Return type: IPointInTimeDocumentServiceFactory

isOdspResolvedUrl​

Type narrowing utility to determine if the provided IResolvedUrl is an IOdspResolvedUrl.

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

To use, import via @fluidframework/odsp-driver/legacy.

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

Signature​

export declare function isOdspResolvedUrl(resolvedUrl: IResolvedUrl): resolvedUrl is IOdspResolvedUrl;

Parameters​

ParameterTypeDescription
resolvedUrlIResolvedUrl

Returns​

Return type: resolvedUrl is IOdspResolvedUrl

prefetchLatestSnapshot​

Function to prefetch the snapshot and cached it in the persistent cache, so that when the container is loaded the cached latest snapshot could be used and removes the network call from the critical path.

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

To use, import via @fluidframework/odsp-driver/legacy.

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

Signature​

export declare function prefetchLatestSnapshot(resolvedUrl: IResolvedUrl, getStorageToken: TokenFetcher<OdspResourceTokenFetchOptions>, persistedCache: IPersistedCache, _forceAccessTokenViaAuthorizationHeader: boolean, logger: ITelemetryBaseLogger, hostSnapshotFetchOptions: ISnapshotOptions | undefined, enableRedeemFallback?: boolean, _fetchBinarySnapshotFormat?: boolean, _snapshotFormatFetchType?: SnapshotFormatSupportType, odspDocumentServiceFactory?: OdspDocumentServiceFactory): Promise<boolean>;

Parameters​

ParameterModifiersTypeDescription
resolvedUrlIResolvedUrlResolved url to fetch the snapshot.
getStorageTokenTokenFetcher<OdspResourceTokenFetchOptions>function that can provide the storage token for a given site. This is is also referred to as the "VROOM" token in SPO.
persistedCacheIPersistedCacheCache to store the fetched snapshot.
_forceAccessTokenViaAuthorizationHeaderbooleanDeprecated and not used.
loggerITelemetryBaseLoggerLogger to have telemetry events.
hostSnapshotFetchOptionsISnapshotOptions | undefinedOptions to fetch the snapshot if any. Otherwise default will be used.
enableRedeemFallbackoptionalbooleanTrue to have the sharing link redeem fallback in case the Trees Latest/Redeem 1RT call fails with redeem error. During fallback it will first redeem the sharing link and then make the Trees latest call. Note: this can be considered deprecated - it will be replaced with snapshotFormatFetchType.
_fetchBinarySnapshotFormatoptionalbooleanDeprecated and not used.
_snapshotFormatFetchTypeoptionalSnapshotFormatSupportTypeDeprecated and not used.
odspDocumentServiceFactoryoptionalOdspDocumentServiceFactoryfactory to access the non persistent cache and store the prefetch promise.

Returns​

true if the snapshot is cached, false otherwise.

Return type: Promise<boolean>

storeLocatorInOdspUrl​

Embeds Fluid data store locator data into given ODSP url

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

To use, import via @fluidframework/odsp-driver/legacy.

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

Signature​

export declare function storeLocatorInOdspUrl(url: URL, locator: OdspFluidDataStoreLocator): void;

Parameters​

ParameterTypeDescription
urlURLfile url in ODSP format (can be either canonical or share link)
locatorOdspFluidDataStoreLocatorobject representing Fluid data store location in ODSP terms

Variable Details​

locatorQueryParamName​

This parameter is provided by host in the resolve request and it contains information about the file like driveId, itemId, siteUrl, datastorePath, packageName etc.

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

To use, import via @fluidframework/odsp-driver/legacy.

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

Signature​

locatorQueryParamName = "nav"

OdcApiSiteOrigin​

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

To use, import via @fluidframework/odsp-driver/legacy.

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

Signature​

OdcApiSiteOrigin = "https://my.microsoftpersonalcontent.com"

OdcFileSiteOrigin​

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

To use, import via @fluidframework/odsp-driver/legacy.

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

Signature​

OdcFileSiteOrigin = "https://1drv.ms"