Skip to main content

@fluidframework/odsp-driver Package

Interfaces

Interface Alerts Description
ICacheAndTracker Legacy
INonPersistentCache Legacy Internal cache interface used within driver only
IOdspCache Legacy Internal cache interface used within driver only
IOdspResponse Legacy
IPersistedFileCache Legacy Similar to IPersistedCache, but exposes cache interface for single file
IPrefetchSnapshotContents Legacy
ISnapshotContents Deprecated, Legacy
OdspFluidDataStoreLocator Legacy
ShareLinkFetcherProps Legacy Properties passed to the code responsible for fetching share link for a file.

Classes

Class Alerts Description
EpochTracker Legacy

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.

OdspDocumentServiceFactory Legacy Factory for creating the sharepoint document service. Use this if you want to use the sharepoint implementation.
OdspDocumentServiceFactoryCore Legacy

Factory for creating the sharepoint document service. Use this if you want to use the sharepoint implementation.

This constructor should be used by environments that support dynamic imports and that wish to leverage code splitting as a means to keep bundles as small as possible.

OdspDriverUrlResolver Legacy Resolver to resolve urls like the ones created by createOdspUrl which is driver inner url format. Ex: ${siteUrl}?driveId=${driveId}&itemId=${itemId}&path=${path}
OdspDriverUrlResolverForShareLink Legacy Resolver 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

Enum Alerts Description
SnapshotFormatSupportType Legacy Enum to support different types of snapshot formats.

Types

TypeAlias Alerts Description
FetchType Legacy
FetchTypeInternal Legacy

Functions

Function Alerts Return Type Description
checkUrl(documentUrl) Legacy DriverPreCheckInfo | undefined 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.
createLocalOdspDocumentServiceFactory(localSnapshot) Legacy IDocumentServiceFactory Creates a factory instance for creating a sharepoint document service from a provided snapshot.
createOdspCreateContainerRequest(siteUrl, driveId, filePath, fileName, createShareLinkType, containerPackageInfo) Legacy IRequest Create the request object with url and headers for creating a new file on OneDrive Sharepoint
createOdspUrl(l) Legacy string Encodes ODC/SPO information into a URL format that can be handled by the Loader
encodeOdspFluidDataStoreLocator(locator) Legacy string Transforms given Fluid data store locator into string that can be embedded into url
getHashedDocumentId(driveId, itemId) Legacy Promise<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) Legacy OdspFluidDataStoreLocator | undefined 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.
isOdspResolvedUrl(resolvedUrl) Legacy resolvedUrl is IOdspResolvedUrl Type narrowing utility to determine if the provided IResolvedUrl is an IOdspResolvedUrl.
prefetchLatestSnapshot(resolvedUrl, getStorageToken, persistedCache, forceAccessTokenViaAuthorizationHeader, logger, hostSnapshotFetchOptions, enableRedeemFallback, fetchBinarySnapshotFormat, snapshotFormatFetchType, odspDocumentServiceFactory) Deprecated, Legacy Promise<boolean> Function to prefetch the snapshot and cached it in the persistant 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) Legacy void Embeds Fluid data store locator data into given ODSP url

Variables

Variable Alerts Modifiers Type Description
locatorQueryParamName Legacy readonly This parameter is provided by host in the resolve request and it contains information about the file like driveId, itemId, siteUrl, datastorePath, packageName etc.
OdcApiSiteOrigin Legacy readonly
OdcFileSiteOrigin Legacy readonly

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

Parameter Type Description
documentUrl URL

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

Parameter Type Description
localSnapshot Uint8Array | 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

Parameter Modifiers Type Description
siteUrl string Base url for OneDrive
driveId string drive identifier
filePath string path where file needs to be created
fileName string name of the new file to be created
createShareLinkType optional ISharingLinkKind type 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
containerPackageInfo optional IContainerPackageInfo | undefined container 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

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

Parameter Type Description
l OdspFluidDataStoreLocator The 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

Parameter Type Description
locator OdspFluidDataStoreLocator describes 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

Parameter Type Description
driveId string
itemId string

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

Parameter Modifiers Type Description
url URL ODSP url representing Fluid file link
requireFluidSignature optional boolean flag 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

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

Parameter Type Description
resolvedUrl IResolvedUrl

Returns

Return type: resolvedUrl is IOdspResolvedUrl

prefetchLatestSnapshot

Function to prefetch the snapshot and cached it in the persistant 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 deprecated and will be removed in a future release.

Not used, true value always used instead. Whether to force passing given token via authorization header.

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

Parameter Modifiers Type Description
resolvedUrl IResolvedUrl Resolved url to fetch the snapshot.
getStorageToken TokenFetcher<OdspResourceTokenFetchOptions> function that can provide the storage token for a given site. This is is also referred to as the "VROOM" token in SPO.
persistedCache IPersistedCache Cache to store the fetched snapshot.
forceAccessTokenViaAuthorizationHeader boolean
logger ITelemetryBaseLogger Logger to have telemetry events.
hostSnapshotFetchOptions ISnapshotOptions | undefined Options to fetch the snapshot if any. Otherwise default will be used.
enableRedeemFallback optional boolean True 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.
fetchBinarySnapshotFormat optional boolean Control if we want to fetch binary format snapshot.
snapshotFormatFetchType optional SnapshotFormatSupportType Snapshot format to fetch.
odspDocumentServiceFactory optional OdspDocumentServiceFactory factory 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

Parameter Type Description
url URL file url in ODSP format (can be either canonical or share link)
locator OdspFluidDataStoreLocator object 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"