@fluidframework/odsp-driver Package
Interfaces
Interface | Description |
---|---|
IClpCompliantAppHeader | |
ISharingLinkHeader | |
ISnapshotContents | |
OdspFluidDataStoreLocator | |
ShareLinkFetcherProps | Properties passed to the code responsible for fetching share link for a file. |
Classes
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. |
ReadBuffer | Buffer class, used to sequentially read data. Used by tree code to reconstruct a tree from binary representation. |
Enumerations
Enum | Description |
---|---|
ClpCompliantAppHeader | |
SharingLinkHeader |
Functions
Function | Alerts | Return Type | Description |
---|---|---|---|
checkUrl(documentUrl) | 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) | IDocumentServiceFactory | ||
createOdspCreateContainerRequest(siteUrl, driveId, filePath, fileName, createLinkType) | IRequest | Create the request object with url and headers for creating a new file on OneDrive Sharepoint | |
createOdspUrl(l) | string | Encodes ODC/SPO information into a URL format that can be handled by the Loader | |
encodeOdspFluidDataStoreLocator(locator) | string | Transforms given Fluid data store locator into string that can be embedded into url | |
getApiRoot(origin) | string | Gets the correct API root for the given ODSP url, e.g. 'https://foo-my.sharepoint.com/_api/v2.1' | |
getHashedDocumentId(driveId, itemId) | Promise<string> | ||
getLocatorFromOdspUrl(url) | 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. | |
getOdspUrlParts(url) | Promise<IOdspUrlParts | undefined> | Breaks an ODSP URL into its parts, extracting the site, drive ID, and item ID. Returns undefined for invalid/malformed URLs. | |
isOdcOrigin(origin) | boolean | Checks whether or not the given URL origin is an ODC origin | |
isOdcUrl(url) | boolean | Whether or not the given URL is a valid ODC URL | |
isSpoUrl(url) | boolean | Whether or not the given URL is a valid SPO/ODB URL | |
parseCompactSnapshotResponse(buffer) | ISnapshotContents | Converts snapshot from binary compact representation to tree/blobs/ops. | |
prefetchLatestSnapshot(resolvedUrl, getStorageToken, persistedCache, forceAccessTokenViaAuthorizationHeader, logger, hostSnapshotFetchOptions, enableRedeemFallback, fetchBinarySnapshotFormat, snapshotFormatFetchType) | Deprecated |
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) | void | Embeds Fluid data store locator data into given ODSP url |
Variables
Variable | Type | Description |
---|---|---|
currentReadVersion | ||
locatorQueryParamName | ||
OdcApiSiteOrigin | ||
OdcFileSiteOrigin | ||
snapshotMinReadVersion |
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.
Signature
export declare function checkUrl(documentUrl: URL): DriverPreCheckInfo | undefined;
Parameters
Parameter | Type | Description |
---|---|---|
documentUrl | URL |
Returns
Return type: DriverPreCheckInfo | undefined
createLocalOdspDocumentServiceFactory
Signature
export declare function createLocalOdspDocumentServiceFactory(localSnapshot: Uint8Array | string): IDocumentServiceFactory;
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
Signature
export declare function createOdspCreateContainerRequest(siteUrl: string, driveId: string, filePath: string, fileName: string, createLinkType?: ShareLinkTypes): 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 | |
createLinkType | optional | ShareLinkTypes | type of sharing link you would like to create for this file |
Returns
Return type: 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
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
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
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
Parameter | Type | Description |
---|---|---|
origin | string | The URL origin |
Returns
Return type: string
getHashedDocumentId
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.
Signature
export declare function getLocatorFromOdspUrl(url: URL): OdspFluidDataStoreLocator | undefined;
Parameters
Parameter | Type | Description |
---|---|---|
url | URL | ODSP url representing Fluid file link |
Returns
object representing Fluid data store location in ODSP terms
Return type: OdspFluidDataStoreLocator | undefined
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
Parameter | Type | Description |
---|---|---|
url | URL | The (raw) URL to parse |
Returns
Return type: 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
Parameter | Type | Description |
---|---|---|
origin | string | The URL origin to check |
Returns
Return type: boolean
isOdcUrl
Whether or not the given URL is a valid ODC URL
Signature
export declare function isOdcUrl(url: string | URL): boolean;
Parameters
Parameter | Type | Description |
---|---|---|
url | string | URL | The URL to check |
Returns
Return type: boolean
isSpoUrl
Whether or not the given URL is a valid SPO/ODB URL
Signature
export declare function isSpoUrl(url: string): boolean;
Parameters
Parameter | Type | Description |
---|---|---|
url | string | The URL to check |
Returns
Return type: boolean
parseCompactSnapshotResponse
Converts snapshot from binary compact representation to tree/blobs/ops.
Signature
export declare function parseCompactSnapshotResponse(buffer: ReadBuffer): ISnapshotContents;
Parameters
Parameter | Type | Description |
---|---|---|
buffer | ReadBuffer | Compact snapshot to be parsed into tree/blobs/ops. |
Returns
- tree, blobs and ops from the snapshot.
Return type: ISnapshotContents
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 will be replaced with snapshotFormatFetchType.
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): 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 | whether to force passing given token via authorization header. | |
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. |
fetchBinarySnapshotFormat | optional | boolean | Control if we want to fetch binary format snapshot. |
snapshotFormatFetchType | optional | SnapshotFormatSupportType | Snapshot format to fetch. |
Returns
- True if the snapshot is cached, false otherwise.
Return type: Promise<boolean>
storeLocatorInOdspUrl
Embeds Fluid data store locator data into given ODSP url
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
currentReadVersion
Signature
currentReadVersion = "1.0"
locatorQueryParamName
Signature
locatorQueryParamName = "nav"
OdcApiSiteOrigin
Signature
OdcApiSiteOrigin = "https://my.microsoftpersonalcontent.com"
OdcFileSiteOrigin
Signature
OdcFileSiteOrigin = "https://1drv.ms"
snapshotMinReadVersion
Signature
snapshotMinReadVersion = "1.0"