@fluidframework/odsp-driver Package

Packages > @fluidframework/odsp-driver

Classes

List of classes contained in this package or namespace
Class Description
OdspDocumentServiceFactory Factory for creating the sharepoint document service. Use this if you want to use the sharepoint implementation.
OdspDocumentServiceFactoryCore 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.
OdspDocumentServiceFactoryWithCodeSplit
OdspDriverUrlResolver 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 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

List of enums contained in this package or namespace
Enumeration Description
SharingLinkHeader

Functions

List of functions contained in this package or namespace
Function Description
checkUrl(documentUrl) A check that returns DriverPreCheckInfo if the URL format is likely supported by this driver. Note that returning information here is NOT a full guarentee that resolve will ultimately be successsful. 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.
createOdspCreateContainerRequest(siteUrl, driveId, filePath, fileName)
createOdspUrl(l) Encodes ODC/SPO information into a URL format that can be handled by the Loader
encodeOdspFluidDataStoreLocator(locator) Transforms given Fluid data store locator into string that can be embedded into url
getApiRoot(origin) Gets the correct API root for the given ODSP url, e.g. 'https://foo-my.sharepoint.com/_api/v2.1'
getHashedDocumentId(driveId, itemId)
getLocatorFromOdspUrl(url) 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.
getOdspUrlParts(url) Breaks an ODSP URL into its parts, extracting the site, drive ID, and item ID. Returns undefined for invalid/malformed URLs.
isOdcOrigin(origin) Checks whether or not the given URL origin is an ODC origin
isOdcUrl(url) Whether or not the given URL is a valid ODC URL
isSpoUrl(url) Whether or not the given URL is a valid SPO/ODB URL
storeLocatorInOdspUrl(url, locator) Embeds Fluid data store locator data into given ODSP url

Interfaces

List of interfaces contained in this package or namespace
Interface Description
ISharingLinkHeader
OdspFluidDataStoreLocator
ShareLinkFetcherProps Properties passed to the code responsible for fetching share link for a file.

Variables

List of variables contained in this package or namespace
Variable Description
OdcApiSiteOrigin
OdcFileSiteOrigin

Type Aliases

List of type aliases contained in this package or namespace
Type Alias Description
OdspDocumentInfo

Enumerations

SharingLinkHeader enum

Signature:

export declare enum SharingLinkHeader 

Enumeration Members

List of members in use in this enum
Member Value Description
isSharingLinkToRedeem "isSharingLinkToRedeem"

Functions

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 guarentee that resolve will ultimately be successsful. 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.

Signature:

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

Parameters

List of parameters
Parameter Type Description
documentUrl URL

Returns:

DriverPreCheckInfo | undefined

createOdspCreateContainerRequest

Signature:

export declare function createOdspCreateContainerRequest(siteUrl: string, driveId: string, filePath: string, fileName: string): IRequest;

Parameters

List of parameters
Parameter Type Description
siteUrl string
driveId string
filePath string
fileName string

Returns:

IRequest

createOdspUrl

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

Signature:

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

Parameters

List of 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:

string

encodeOdspFluidDataStoreLocator

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

Signature:

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

Parameters

List of parameters
Parameter Type Description
locator OdspFluidDataStoreLocator describes Fluid data store locator info to be encoded

Returns:

string

string representing encoded Fluid data store locator info

getApiRoot

Gets the correct API root for the given ODSP url, e.g. ‘https://foo-my.sharepoint.com/_api/v2.1’

Signature:

export declare function getApiRoot(origin: string): string;

Parameters

List of parameters
Parameter Type Description
origin string The URL origin

Returns:

string

getHashedDocumentId

Signature:

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

Parameters

List of parameters
Parameter Type Description
driveId string
itemId string

Returns:

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.

Signature:

export declare function getLocatorFromOdspUrl(url: URL): OdspFluidDataStoreLocator | undefined;

Parameters

List of parameters
Parameter Type Description
url URL ODSP url representing Fluid file link

Returns:

OdspFluidDataStoreLocator | undefined

object representing Fluid data store location in ODSP terms

getOdspUrlParts

Breaks an ODSP URL into its parts, extracting the site, drive ID, and item ID. Returns undefined for invalid/malformed URLs.

Signature:

export declare function getOdspUrlParts(url: URL): Promise<IOdspUrlParts | undefined>;

Parameters

List of parameters
Parameter Type Description
url URL The (raw) URL to parse

Returns:

Promise<IOdspUrlParts | undefined>

isOdcOrigin

Checks whether or not the given URL origin is an ODC origin

Signature:

export declare function isOdcOrigin(origin: string): boolean;

Parameters

List of parameters
Parameter Type Description
origin string The URL origin to check

Returns:

boolean

isOdcUrl

Whether or not the given URL is a valid ODC URL

Signature:

export declare function isOdcUrl(url: string | URL): boolean;

Parameters

List of parameters
Parameter Type Description
url string | URL The URL to check

Returns:

boolean

isSpoUrl

Whether or not the given URL is a valid SPO/ODB URL

Signature:

export declare function isSpoUrl(url: string): boolean;

Parameters

List of parameters
Parameter Type Description
url string The URL to check

Returns:

boolean

storeLocatorInOdspUrl

Embeds Fluid data store locator data into given ODSP url

Signature:

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

Parameters

List of 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

Returns:

void

Variables

OdcApiSiteOrigin

Signature:

OdcApiSiteOrigin = "https://api.onedrive.com"

OdcFileSiteOrigin

Signature:

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

Type Aliases

OdspDocumentInfo

Warning: This API is now obsolete.

  • use OdspFluidDataStoreLocator

Signature:

export declare type OdspDocumentInfo = OdspFluidDataStoreLocator;